[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 333
Thread images: 62

File: workingwith.jpg (296KB, 1120x350px) Image search: [Google]
workingwith.jpg
296KB, 1120x350px
What are you working on?
What do you plan on learning?

Old thread: >>62296062
>>
>>62301784
Thought for the day
Having strings compute their hash when they're created and use that for string comparison
>>
>>62301784
second for op is shit
>>
>>62301800
Better thought, have a generic hash + value container that works for more than just strings and lets you avoid modifying the string type.
>>
>>62301818
That makes more sense
>>
p://www.emulator101.com/reference/8080-by-opcode.html

This guy says here that on 8080, little endian is used.Ok.

But let's take for example
00 00 00 c3 d4 18 00

he says that its:
NOP
NOP
NOP
JMP $18d4
NOP

Why are d4 and 18 reversed after c3?

I have a hard time understanding little/big endian.It is an extreme clusterfuck for me.
>>
>>62301800
>strings don't change
>>62301818
std::unordered_set
>>
Oh boy I sure do love functional programming yes sir I do
>>
>>62301844
I don't mean a container of multiple values, I mean a container of a single value that computes a hash and uses it to accelerate certain operations.
>>
>>62301800
>>62301818
Have the hash generated at comparison time if it doesn't exist already, if it's already been generated just use it.
>>
>>62301836
> Why are d4 and 18 reversed after c3?
Because it's little-endian, the least significant byte, d4, goes first.
>>
>>62301844
Can have it recomputed with assignment
>>
>>62301784
Hey goys, what is the problem here? I can't find it.

I have this function
std::ostream& operator<<(std::ostream& os, Rational const& r) {
os << r.num() << '/' << r.denom();
return os;
}

I try to do this:
    Rational r1(1, 2);
Rational r2(2, 4);
Rational r3 = r1 + r2;

std::cout << r3.num() << "/" << r3.denom() << std::endl;
std::cout << r3;

And I get this:
 error: invalid operands to binary expression ('ostream' (aka 'basic_ostream<char>') and 'Rational')
std::cout << r3;
~~~~~~~~~ ^ ~~
>>
>>62301869

so the rom file there is in big endian?
>>
On the fence about dba stuff, exclusive and coders whine but watevs
>>
>>62301959
No? Everything is little-endian, go read the wiki.
>>
>>62301925
>I have this function
To be clear, that is a nonmember function, right?
>>
>>62301925
What if you use just Rational r as the param without const reference?
>>
>>62302013
fucfuckfuckfuck
I just realized, I only implemented it in the .cpp and didn't declare it in the .h
thanks doe, you made me check the header file
>>
>>62301925
It looks fine, must be something with the compiler not being able to find the operator implementation. Where did you put it? It's better to have it as an inline function in a header with Rational itself.
>>
Is Smalltalk worth learning? Is it an interesting language?
I've already learned OOP with C++, but Smalltalk is apparently a very well liked language
>>
>>62302088
t. Uncle Bob
>>
>>62302088
Yes, Pharo looks good and it has a lot of nice documentation, literally several nicely done books, I've been thinking about giving it a try for a while now. Stil tho, don't expect it to be of any practical use other than experience, the language is inherently slow, the libraries and community are non-existent and everything good was stolen by Python and Ruby decades ago.
>>
File: IMG_0332.jpg (2MB, 4032x3024px) Image search: [Google]
IMG_0332.jpg
2MB, 4032x3024px
can any one explain the array of pointers casting. is (void **) lineptr is equivalent to (void *) lineptr[]
>>
>>62302134
sorta.
>>
>>62302134
An array is not a pointer, an array will decay to a pointer to the first element of the array when referenced as a non-array.

What specific line/problem are you having trouble with?
>>
>>62302151
why the need for another * though since we know from preceding declaration that lineptr is an array of char pointers. now wouldn't it make more sense to cast (void *) lineptr ?
>>
>>62301784
What's a good text editor (+ plugins) for Haskell development?
>>
>>62302226
>What specific line/problem are you having trouble with?
the qsort function inside the second if statement
>>
>>62301800
What if you have hash collisions?
>>
>>62302253
ed
>>
>>62302269
Obviously you have to test the strings themselves if the hashes are equal.
>>
>>62302253
vim, decent .vimrc, no plugins needed
>>
>>62302269
Stop having shit luck
>>
>>62302292
. . . so a guaranteed efficiency loss if we're in a situation where most of our comparisons are of identical strings, right?
>>
>>62302134
>is (void **) lineptr is equivalent to (void *) lineptr[]
no.
>>
>>62301800
Java sort of does this, it saves the hashcode value for the String when it is computed and uses that.

For C++ it would be very easy to make a type of structure that wraps an immutable object and stores the hashcode.
>>
>>62302345
Yes. If you have a finite set of strings you can use a perfect hash function, of course, and then you don't need to compare both the hash and the string each time.
>>
>>62302226
can you help me with this >>62302235
>>
>>62302374
Yeah of course that'd happen in that case. But if, for example, we have unknown data which always tends to contain many repeats, a perfect hash function wouldn't be possible so the whole thing would be a pointless exercise
>>
>>62302134
http://www.c-faq.com/aryptr/practdiff.html
>>
File: Screenshot_2017-09-07_21-33-41.jpg (14KB, 452x146px) Image search: [Google]
Screenshot_2017-09-07_21-33-41.jpg
14KB, 452x146px
>>62301784
Totoro!
>>
>>62302408
If you anticipate having many equal strings, a solution might be to have an indexed set of strings that acts as a perfect dynamic hash function. When a new string is encountered, it's checked against all the strings in the set. If it's already in the set, you assign it its index. If not, you add it to the set and assign it the next index. Then you can simply use indices to compare strings already in the system.
>>
>>62302482
Seems like a good solution. I'm fairly convinced that this is a decent idea now.
>>
>>62302391
Here's my best guess, qsort expects an array of pointers to something(void), lineptr is an array of pointers to chars, if you were to do (void *) lineptr you'd be casting the array as a pointer to void which it isn't, it's a pointer to a pointer to a char, the function wants the base address of the array which is **lineptr.

I'm no expert so I could be wrong on this, I often have to reference documentation when dealing with shit like this myself.
>>
File: 1437497521042.jpg (60KB, 1280x720px) Image search: [Google]
1437497521042.jpg
60KB, 1280x720px
Employed Haskell programmer reporting in
>>
>>62302391
>>62302572
>it's a pointer to a pointer to a char
Wait I think that's wrong. I don't know why they do this.
>>
>>62302639
How many Good boy points do you earn?
>>
>>62302432
I understand the distinction, I want to know about the additional * when casting however >>62302226
Also, this confirms my suspicion https://stackoverflow.com/questions/13104123/cast-to-void-for-what-reason
>>
File: 1489513737442.jpg (59KB, 655x527px) Image search: [Google]
1489513737442.jpg
59KB, 655x527px
How the fuck am I supposed to pass math courses in CS?
>>
>>62302663
300K starting
>>
>>62302704
You must be swimming in tendies
>>
>>62302572
>>62302643
https://stackoverflow.com/questions/13104123/cast-to-void-for-what-reason
>That's the type of argument qsort expects. When you pass lineptr, that would become a char** and the compiler should complain. Casting the pointer to the expected type shuts up the compiler because it says "I know what I'm doing" and converts the argument to the correct type.
>>
>>62302685
calculus is easy peasy
>>
>>62302639
What company? Or Industry?
>>
>>62301784
The team who designed the microsoft database stack should be fucking gutted alive.

I think its slowly ruining my health. All the fucking incompatibilities and messed up data in mdb files makes me want to go on a rampage
>>
>>62302753
>respond to /dpt/ shitposter
I shiggy diggy
>>
>>62302749
No it isn't.
>>
>>62302741
I'm gonna consider my answer close but half of my reasoning was wrong. double pointers, 2D arrays, and other multi layered pointer things in C are great but it's maybe the only part of the syntax I struggle with at times, I know what I want to do but not how to do it immediately.
>>
>>62301836
Literal values given to assemblers / compilers are always assumed to be big endian. The only time you need to worry about byte ordering is if you're trying to use calculation results as literal values.
>>
>>62302760
Every time I've been forced to interact with any of the Windows apis I've wanted to die, I don't doubt the rest of their stuff is bad too.
>>
File: yourbrainonmicroshit.png (210KB, 1835x821px) Image search: [Google]
yourbrainonmicroshit.png
210KB, 1835x821px
>>62302823
I mean just look at this.

Some lines get converted correctly while others are fucked up beyond help because of some minor incompatibility.

This is your brain on microsoft
>>
>>62302780
Calculus is easy, but they can make it arbitrarily difficult by using super shitty textbooks and asking you to remember more stuff.

You just have to work your ass off. They use math to weed out people who can't work a project they don't like.
>>
What is the programming equivalent of this?

https://www.youtube.com/watch?v=VqbtbTSeai0
>>
File: 1504556005069.png (408KB, 634x640px) Image search: [Google]
1504556005069.png
408KB, 634x640px
You can't write desktop applications in Python, can you?
>>
>>62302929
I'm sure there's a library for that.
>>
>>62302901
It's not really accurate to say 'Calculus is easy/hard/anything', since it depends to what depth you're studying it. Same for algebra, topology, anything really. Like, yeah, sure memorising a bunch of integrals and knowing how to apply the chain rule is easy. Proving Clairaut's theorem for Fréchet differentiable functions between infinite-dimensional Banach spaces is less so.
>>
>>62301800
So like interning them?

Might be even better.
>>
>>62302929
There are python gui libs
>>
>>62303018
Almost nobody does that in their undergrad calc 123 + diffeq. Maybe at a fancy school. If you're complaining about the math requirements in CS, odds are you're not in one of those.
>>
>>62302929
you can
for example:
https://gnumdk.github.io/lollypop-web/
>>
File: 1504308176559.png (200KB, 512x384px) Image search: [Google]
1504308176559.png
200KB, 512x384px
>>62302959
>>62303341
But you have to pack Python interpreter with your program, don't you?
I think it's a bad idea because it would caise unnecessary bloat.
>>
>>62303575
just list python as a dependency :^)
>>
File: 1502649200550.jpg (413KB, 863x720px) Image search: [Google]
1502649200550.jpg
413KB, 863x720px
>>62303575
yes, use py2exe or cx_freeze
>i thinki it's a bad idea because it would cause unnecessary bloat
many applications do embed runtimes, especially on systems where shared libs aren't a (common) thing (aka windows). compared to VC/.NET redistributables, a python interpreter is nothing.
>>
>>62303575
Write in c++ with single header imgui lib
>>
File: mfw-you-exist.jpg (17KB, 246x374px) Image search: [Google]
mfw-you-exist.jpg
17KB, 246x374px
>>62301800
>Having strings compute their hash when they're created and use that for string comparison
Dumb idea. Who said the user wants to waste cycles computing hashes for strings that will never be compared to anything (which could very well be the vast majority of them)? If you really want to support this use case out of the box, provide a fast compare method that computes and caches a hash on demand.
>>
I only know C. I have an idea for an app, that I would use myself. Would it be possible to create an app for android with C or do I need Java or some other language.
Also how hard is it to actually put an app on the market by yourself? Would I need to trade mark it's name or do some legal shit?
>>
>>62303575
if you care about bloat you shouldn't be using python in general
>>
>>62303683
>animeposter makes a good post
wow
>>
File: 1503971644344.jpg (26KB, 293x313px) Image search: [Google]
1503971644344.jpg
26KB, 293x313px
>>62303851
If >>62303683-kun says
>compared to VC/.NET redistributables, a python
>interpreter is nothing.
does it mean if I ever want to have non-bloated applications, I must not look at C# and program in C++, right?
>>
>>62303730
You need to create the base application in java, then you can use something like SDL with opengl for graphics. There are existing templates that you can just for the java project. You can check sdl's android examples or something like that.
You could also compile GTK for android but there's some limitations.
>>
>>62304073
If you want truly non-bloated applications, write everything in assembler.

If you want to produce apps this decade, stop worrying too much about bloat.

If you don't give shit at all about bloat, write it in Javascript.
>>
>>62302929
if u have to write gui app in python that means u are windows faggot.
People rarely need real gui
>>
File: PSX_20170907_171904.jpg (16KB, 574x85px) Image search: [Google]
PSX_20170907_171904.jpg
16KB, 574x85px
If I want to create a chaotic map with gaussian formula, with alfa input and beta from -1 to 1, what I have to do with X?
>>
ATS would be nice language by the features, too bad about the syntax...
>>
>>62301800
most string comparisons I do involve substring comparisons, so if you mean to say I'm going to create a new substring + hash container for every substring I'm going to compare, you can go fuck yourself
>>
>>62304213
In C.
>>
>>62301784
I've just finished learning Python and feel like I'm capable. I'll still need practice.

But how about a language that will get me employed? No video gamer bullshit, what language should I learn for employment?

C? C++? C#? Lisp? Rust? Haskell? Ruby? Java? It's important to pick a solid one as I'll dedicate all my free time to it.
>>
>>62304073
desktop apps are dead
long live the web
html and javascript for life
you're on a html gui application right now anon
>>
>>62304394
dont remind me
>>
>>62304362
C++, C# or Java.
Python is more popular than Ruby now.
And other languages only for self-enjoynment.
>>
File: 1501800117620.jpg (80KB, 799x720px) Image search: [Google]
1501800117620.jpg
80KB, 799x720px
>>62304073
>>62304394
>just embed chrome with your installer
:^)
>>
>>62304362
Java. Java is the codemonkey language. Java is easy and fairly small.
>>
>>62304428
Appreciate the input. I'm trying to stop being a useless shit.

What's the different between C++ and C? I know C is an assembler language unless I'm a literal retard. And I don't know anything of Java outside Java's webdev implications
>>
>we could have had IMGUI but we got retained mode and web apps
Any other movies where the bad guys win?
>>
>>62304506
you still have your imgui
dumb sepples poster
>>
In Java, I have an iterator that fetches every thread on 4chan.
Iterator<Thread> threads = ... 

Obviously I dont want to keep all the threads in memory at once, so my iterator lazily fetches new threads as they are needed. The tricky bit is I only really care about all the posts in the thread, so I either want
Iterator<Post> posts = ... 

or
Iterator<Iterator<Post>> posts = ...

is there a way to create posts without destroying the lazy fetching of threads?
>>
>>62304417
the web is dead, long live mobile applications
>>
>>62304506
>not writing everything in gtk+2
>>
>>62304573
>obselete
>>
File: is this guy serious.gif (61KB, 736x689px) Image search: [Google]
is this guy serious.gif
61KB, 736x689px
>>62304471
>C is an assembler language
>>
>>62304471
C++ is C after you pile on so much crap that it becomes unreadable and unrecognizable.
>>
>>62302783
>but it's maybe the only part of the syntax I struggle with at times
Then I guess you never had to deal with function pointer types.
>>
>>62304471
>What's the different between C++ and C? I know C is an assembler language unless I'm a literal retard.
C is not an assembler language, it's still a high-level language. C++ has many features already implemented, it's faster to program in C++ (I don't say easier).
>And I don't know anything of Java outside Java's webdev implications
Java is heavily used in enterprise.
>>
>>62304607
Very serious. I'm ignorant and would like to learn.

>>62304621
I've seen the hate but that doesn't really tell me what.

>>62304635
Good to know, thank you so much.

I suppose I'll go with C++ and see after the first half if its any good.
>>
All right, I'm getting close to finishing SICP, and was wondering, how can I find a job as a lisp developer?
>>
I'm taking a beginners course to Java
What IDE should I be using?
Sorry not sorry for asking this question
>>
>>62304694
go looking for lisp jobs ??
>>
File: laughter.jpg (36KB, 400x460px) Image search: [Google]
laughter.jpg
36KB, 400x460px
>>62304694
>>
>>62304704
netbeaner or ellipse
>>
>>62304694
Nice one.
>>
>>62304704
Just use eclipse.
>>
>>62304704
Just use VIM or Emacs. Note++ or Gedit also work. And it's fine these questions are overlooked in /sqt/
>>
>>62304704
>>62304744
Seconding VIM
>>
C++17 is out!
>>
What if Javascript never took off and Scheme was powering browsers
>>
>>62304715
Where, in what industry?
General job search yields me no results :(
>>
>>62304694
Paul Graham is always looking for lisp hackers iirc
>>
>>62304820
It's like the 3rd time it's been out already this year, it's been `finished` since March. They won't publish it until about NY anyway.
>>
>>62304828
>Scheme
things would be even worse.
Youre just trading one shit for another.
>>
>>62304828
that would be glorious
;_;

why, why, why
>>
>>62304854
Yeah but it's been now formally approved and clang just released full support.
>>
>>62304828
What if people didn't try to build applications for scripting language that tries to modify HTML.
>>
>>62304888
Scheme alone can do what HTML, CSS and JS do together.
>>
Should I shower everyday?
>>
>>62304926
Do you sweat a lot? Yes. Do you not? No.
>>
>>62304926
if you want to anon
you don't really need to, and if you do shower every day apparently the heat does damage to your skin.
>>
>>62304986
room temperature showers are what you should be doing. Hot showers are an unnatural convention from the romans.
>>
>>62304885
reference
https://herbsutter.com/2017/09/06/c17-is-formally-approved/
>>
>>62304926
>date] [Auto] No new posts
If you are in a space station you can go a few days without it and it's probably a good idea to conserve water.
>>
>>62304926
only if it's hot and humid and you're fat
if you must know, take the sniff test
take a good long whiff at the armpit area of your tshirt, if you smell even a little BO, people around you are smelling it 10x worse than you because you're desensitized to it.
>>
>>62304926
If you are in a space station, you can go a few days without it.
>>
File: c++17 clang.png (154KB, 696x978px) Image search: [Google]
c++17 clang.png
154KB, 696x978px
>>62304885
> clang just released full support
Noice.
>>
>>62305071
Yep and as of 5.0 stuff is no longer in experimental namespace and hidden behind special compiler options, all you need to do is -std=c++17 and it'll all work.
>>
>>62301784
retard people comparing pure structural vs multi-paradigm languages, being that retard.
>>
Why are brainlets shitting on OOP?
>>
Building a documentation generator for my embedded OS
>>
What's the consensus on making programming for the windows shell via batch files? I'm finding some of the commands useful so far. Has anyone created anything truly extraordinary in batch?
>>
>>62305162
Many virus and trojan payloads have been coded in Windows batch.
>>
>>62305162
I wrote tic-tac-toe in batch. I also wrote a batch script that launched a new instance of itself, then exited. The result was a moving command window that was difficult to close. Good times.
>>
In C++, how can I manipulate a single parameter for all the elements in a vector?

For example: I have a vector of cars and I want to speed up their velocity by the same number simultaneously.
>>
>>62305252
Loop over them?
Call std::for_each with a lambda?
>>
>>62305252
>simultaneously
not possible
>>
>>62305033
>WG21’s active project now is C++20, and we already began work on that at our last meeting in Toronto, including to add a major feature (concepts!)
About time
>>
>>62305262
>>62305263
R-right.
>>
>C has gotten better over time
>C++ has gotten worse

How is this possible?
Does isocpp not realize they're becoming a jack of all trades language, MASTER OF NONE?
>>
>>62305252
for (auto elem : vec)
{
// do shit
}

for (auto &&elem : vec)
{
// do shit
}
>>
>>62305301
Are you retarded?
C++ has gotten way better over time.
>>
>>62305252
>simultaneously
can be done if all of your cars velocities are stored with a pointer
and they all point to the same address
>>
>>62305355
this, C++ wasn't even worth using until C++11
too bad that's when it truly turned hideous
>>
>Need to collect malicious attack data for future testing of a network intrusion detection system
>Decide to come up with own vulnerable programs for testing
>Start hacking out some C
>After about an hour of work, realize how trivial it is to make a vulnerable program in Ruby by abusing :send

This language has never failed me as a swiss army knife. Goddamn.
>>
>>62305369
ruby is vulnerable because it is for girls and girls like you are vulnerable
>>
>>62305369
>:send
what is this exactly
>>
Im new to java and im having trouble producing function code. Does anyone know the boofa command?
>>
>>62305440

:send is a method on every object in Ruby that takes a string or symbol, and any number of arguments, and sends the string as a method to the object, with the rest of the arguments as arguments to it.

1.send :+, 2 # resolves to 3
1.send :eval, "puts 'hello world'" # What do you think happens?
>>
>>62305551
>1.send :eval, "puts 'hello world'" # What do you think happens?
idk ruby, but let me see

1 shoudln't have an eval method right?
or maybe it has an eval inherited from above, since ruby is interpreted if i remember correctly

basically it runs eval(1, "puts 'hello world' ")

if that's the case then that's indeed wacky
>>
>>62305551
>eval is a security risk
stop the fucking presses
>>
>>62305438

Ruby is vulnerable iff:

1. You are dumb with untrusted inputs
and
2. You take advantage of its flexibility

>>62305609

eval is a private method defined on the module Kernel, which is included by Object. send doesn't care if a method is private, protected, or public. You can use public_send as an alternative, but since send is a public method...

Anyways, it's not a language I would use for a server per se. It's a super flexible scripting language though.
>>
>>62302685
sasuga dumb frogposter
>>
>>62305689
>Ruby is vulnerable iff you use it
as expected of rubyist
>>
>>62305763

If you use it while being dumb with untrusted inputs.
>>
oh look ruby said something idiotic again, how surprising.
>>
>>62305813
not an argument
>>
>create database
>use string concatenations to take user input
why do people do this?
>>
File: racial_programming.png (63KB, 576x743px) Image search: [Google]
racial_programming.png
63KB, 576x743px
>>
>>62305822
What's the "proper" way?
>>
>>62305831
>Factory
p a j e e t
>>
>>62305689

>Anyways, it's not a language I would use for a server per se. It's a super flexible scripting language though.

It's an amazing scripting language.

But it's also good for servers. Just don't use that ugly motherfucker Rails, but take something less confusing and more elegant, like Hanami, Cuba or Sinatra.
>>
>>62305888
how does it compare to python
im pretty sure python > ruby
>>
>>62305369
best language unironically
>>
>>62305888

Yes, Sinatra is what I would use if I needed to use Ruby for a server. But strictly speaking, I don't see running servers as its strong point. For me, it is the "automate/script all of the things" language. I honestly can't understand why people use Python for this purpose, but I guess we're all creatures of habit.
>>
>>62305832
Something that doesn't leave you open to a bobby tables attack
>>
>>62305997
What if you dont use sea quil?
>>
LLVM 5.0 is out lads
>>
>>62305832
PreparedStatement.
>>
>>62305030
>we take hot showers because the romans did
>not because it's fug cozy
>>
>>62305529
?
>>
File: 1504578749668.gif (2MB, 428x321px) Image search: [Google]
1504578749668.gif
2MB, 428x321px
Is codeacademy a meme? I want to learn Java btw
>>
>>62306031
it also saps you of energy and mental alertness
it's fine if you're gonna jerk off in there and then go to bed afterwards, but you should never do it in the day unless you have nowhere to be
>>
File: ruby.png (40KB, 536x418px) Image search: [Google]
ruby.png
40KB, 536x418px
>>62305991
>I honestly can't understand why people use Python for this purpose
ruby is too verbose and wonky
>>
I'm so fucking tired of this university. Every fucking assignment is "program this game, bla bla, bla bla". Fuck this. I'm bad at this and I hate it!
>>
>>62306085

>putting parentheses on all of your function calls
Why?
>>
Are programmer books a scam?
Most of them say the same shit over and over, even stuff like the C++ In Depth series (((handpicked))) by stroustrup.
>>
>>62306132
it makes sense and is typical both in terms of math and most programming languages

clearly defines order of operations and that sort of thing
>>
>>62305831
>Foo.hh
kys-tier naming convention
>>
>>62306178
>Are programmer books a scam?
yes
go read a blog and watch the newboston
>>
>>62306218

Right, but it's not often the Ruby way of doing things. Ruby doesn't have to be verbose if you don't want it to. In fact, you can make it as ugly as Perl if you really prefer. Also, you don't seem to make a lot of use of string interpolation, which can make things shorter. For instance...

You can cut back on the + operations on line 70 like so:
puts "Writing #{lines.size} lines to total..."


And you can merge lines 76 and 77 into one line like so:
puts "Game against unlisted team encountered #{line}"


Oh, and I just realized you never closed your open file in create_team_hash
>>
>>62306376
Wouldn't it automatically get closed after the call to create_team_hash when the GC kicks in?
>>
File: perl_seal.png (259KB, 606x607px) Image search: [Google]
perl_seal.png
259KB, 606x607px
>>62305905
Perl is the one true nigga
>>
>>62305905

Python and Ruby are similar in many ways. So it's probably more a matter of personal taste.

I prefer Ruby because it has more things "out of the box" without imports, and I find the syntax easier to remember.

But that's just me, I don't want yet another flamewar..

# print all ruby files in current directory
puts `ls -a`.split.grep(/\.rb/)



>>62305991

I would look into Hanami, it's a better/cleaner/newer version of Rails.

But honestly, I'm trying to get away from Ruby and think about getting into Clojure for webdev. I'm just not good enough (yet).


>>62306085

Your pic is not ideomatic Ruby code, it's not very well written..

For example lines 59-67:

def create_team_hash
File.open('/home/(...blabla..)/index.txt').each do |line|
# do matching here
end
end


Also:

>ruby is too verbose and wonky

I've done Python and Ruby, and Ruby is one of the very few languages that is even more concise than Python. The main reason is that Python just hates functional goodies while Ruby often reads like an OOP version of Haskell..

(1..100) . filter {|n| n.odd?} . map {|n| n < 50 ? n**2  : n**3} . reduce :+
>>
>ruby
>verbose
you should explain how you came to hold this opinion
>>
>>62306718
>
puts `ls -a`.split.grep(/\.rb/)

that's not a very portable way to do so
>>
File: .webm (861KB, 1280x720px) Image search: [Google]
.webm
861KB, 1280x720px
I did a thing.
>>
File: 1492412873819.png (216KB, 380x364px) Image search: [Google]
1492412873819.png
216KB, 380x364px
http://fbinfer.com/
>>
File: 1501374936604.jpg (426KB, 721x991px) Image search: [Google]
1501374936604.jpg
426KB, 721x991px
Which programming language should I use if I'm a masochist?
>>
File: 1501208416761.png (236KB, 622x647px) Image search: [Google]
1501208416761.png
236KB, 622x647px
>>62306885
Why is Akari so cute?
>>
>>62306904
C++ TMP exclusively..
>>
>>62306878
WHAT THE FUCK
are you doing
why didn't you solve the captcha
MODS MODS MODS
>>
>>62306904
https://en.wikipedia.org/wiki/Malbolge
>>
>>62306928
probably just using a captcha solving service
they charge money for every captcha solved because they have poor chinese people sitting there solving them
>>
>>62304885
Slicing maps aren't supported in clang
>>
>>62306928
My server solves them. >>62306954 (for free)
>>
>>62306966
nah, it doesn't
unless you have like a 30% success rate
>>
>>62306922
she's a loli
>>
>>62301800
If you think you're going to be comparing strings a lot, why not just use symbol types instead?
>>
I'm a pedophile
>>
>>62307004
What age of girls/boys are you attracted to?
>>
>>62307004
I know.
>>
>>62306977
Why though? Shouldn't training a basic model on MNIST should get you to 98+%
>>
>>62307017
fugg
>>62307014
10-12 year old lolis
>>
>>62306977
What's wrong with a 30% success rate? :^)
I can get 1/100 using v2 captcha and 1/40~ using text captcha.
I'm thinking about trying to actually solve them but I'm not sure there is any point of a higher success rate when I get them done anyway.
>>
File: 1504402732649.png (668KB, 658x863px) Image search: [Google]
1504402732649.png
668KB, 658x863px
>>62307032
Sick bastard
>>
>>62307032
>10
Well that's pedophilia
>11-14
That's hebophilia, which is 100% fine.
>>
>>62307047
When will hebephilia finally be accepted in our society again?
>>
>>62307036
>I'm not sure there is any point of a higher success rate when I get them done anyway.
you're telling me 4chan allows you to rapidly fail 40+ captchas in a row without any kind of temp ban?
>>
>>62307059
It is already accepted in many societies, Americans/UKucks/Auscucks being overly SJW, they set a trend that if a girl turns 18 she magically becomes "mature" overnight
>>
>>62307076
I submit them to google first to check if they are successfully solved.
4chan has a a few second timeout before you can submit posts, I think
You can fail hundreds of captchas and nothing bad will happen.
>>
>>62307076
>>62307036
>>62307098
I don't get it. Shouldn't this be an easy thing to solve using tensorflow?
The new image based captcha is hard, but ocr is a finished problem for recognizing two words.
>>
>>62302134
Which book is that? Also which thinkpad
>>
File: post.png (58KB, 838x354px) Image search: [Google]
post.png
58KB, 838x354px
>>62307116
>but ocr is a finished problem for recognizing two words.
not with captcha
there's thousands of variations of font alone, not to mention rotation, scaling, added grain effects, colors, partial letters that are supposed to be ignored, and so on
some of them are hardly legible, like this one
>>
>>62307142
not with recaptcha*
>>
>>62307116
https://www.blackhat.com/docs/asia-16/materials/asia-16-Sivakorn-Im-Not-a-Human-Breaking-the-Google-reCAPTCHA-wp.pdf
>>
>>62306904
javascript
>>
>>62307142
>rotation, scaling, added grain effects, colors,
I though it was standard to randomly apply these effects to the dataset to help the training
>some of them are hardly legible
I guess, but that can't ruin your model for more then 10% of cases can it?

Now I want to try, seems like a fun project to practice ML.
>>
>>62306904
Rust.
>>
>>62307076
>you're telling me 4chan allows you to rapidly fail 40+ captchas in a row without any kind of temp ban?

Yep! Google's captcha service is real shite lad.
>>
File: 1496400387120.png (215KB, 332x384px) Image search: [Google]
1496400387120.png
215KB, 332x384px
>>62306985
Lolis are great, yes, but Akari is super great! How can this be explained?
>>
File: 1452760523811.jpg (386KB, 561x1000px) Image search: [Google]
1452760523811.jpg
386KB, 561x1000px
>>62307237
Superloli?
>>
>tfw /dpg/ apply sentiment analysis and pattern recognition algorithms on all the posts to de-deanonymize everyone and then get together on discord to discuss who they should ignore and then laugh at them
I'm on to you
>>
>>62307246
I want to breed a loli
>>
>>62306878
now run it on a cron job.
>>
File: Akarin_106.jpg (126KB, 800x924px) Image search: [Google]
Akarin_106.jpg
126KB, 800x924px
>>62307246
I think you're onto something, anon.
>>
>>62307186
I'd say there's 10% right off the bat that can't be solved no matter what due to a broken sample image, incorrect answer key, or other issue

then there's probably a further 20% that can be solved by people but probably not by a bot, for example an image that is partially obscured but a person can tell what it is (street sign?) and fill in the last letter or two

they also add new squiggly fonts that your bot wont be able to handle until you train it by collecting enough samples manually
which they then remove after a month to make you feel like you're wasting your time
>>
What does /dpt/ think of these lolis?
>>
File: reCaptcha.png (34KB, 304x60px) Image search: [Google]
reCaptcha.png
34KB, 304x60px
>>62307326
Which ones are you talking about? I've never seen those on 4chan at least.
90% of the capcha I see on here is like pic related, which is like you said, enough to solve using just MNIST + translation/skew/color which you can apply on the dataset programatically.
>>
>>62307354
c-c-cute
>>
>>62307354
K A W A I I
A
W
A
I
I
>>
>>62307354
I want to marry the red head, fuck the one with blue hair and pet blackie
but I'm drunk
>>
>>62307354
Not on the list
>>
>>62307380
Rustle is overrated
>>
I-I'm drunk as fuck
Should I open my bottle of white wine?
>>
File: 1504824561585.jpg (430KB, 573x847px) Image search: [Google]
1504824561585.jpg
430KB, 573x847px
>>62307467
Yes, drink to this loli
>>
>>62307476
I love you anon
And I'll drink to that loli, she's cute as fuck!
>>
File: gelbooru-3025859.png (675KB, 1245x728px) Image search: [Google]
gelbooru-3025859.png
675KB, 1245x728px
Why are lolis so verboten, /dpt/?
>>
File: 1501893992685.png (716KB, 1033x1530px) Image search: [Google]
1501893992685.png
716KB, 1033x1530px
>Loli-posting with another anon
F-feels good. But last one I don't wanna derail /dpt/
>>
File: loli.jpg (505KB, 799x1100px) Image search: [Google]
loli.jpg
505KB, 799x1100px
>>62307508
Because of dumb normalfags who don't realize how great lolis are
[spoiler]deutsch[/spoiler]
>>
>>62307535
/dpt/ is dead right now anyway.
>>
>>62307539
Did you get that loli from me? I used to always post it.
Here's another from the same artist
>>
File: ~2016-02-07-808469 (1).jpg (1MB, 2507x1689px) Image search: [Google]
~2016-02-07-808469 (1).jpg
1MB, 2507x1689px
>>62307554
True, but I have to shower and pretend to be a normal human being tomorrow at work
>>
>>62307556
uncomfortable lollies are shit-tier desu
>>
File: yande.re-321491.jpg (973KB, 1212x2172px) Image search: [Google]
yande.re-321491.jpg
973KB, 1212x2172px
>>62307577
Don't go, anon. Be a loser with me forever!
>>
>>62307587
>lewd star
please refrain from doing this in the future.
>>
File: LOLIpng.png (255KB, 600x850px) Image search: [Google]
LOLIpng.png
255KB, 600x850px
>>62307598
next time just ask
>>
File: 1500819458416.jpg (3MB, 2308x3300px) Image search: [Google]
1500819458416.jpg
3MB, 2308x3300px
>>62307596
Sorry, last one
>>
>>62307613
star is unironically not for lewds.
Now please post more non-star, smug lollies you nerd.
>>
File: 94542bd2.png (1009KB, 960x1280px) Image search: [Google]
94542bd2.png
1009KB, 960x1280px
You fags need thicc in your life
>>
File: smug loli suicide.jpg (138KB, 838x638px) Image search: [Google]
smug loli suicide.jpg
138KB, 838x638px
>>62307624
o-ok...
>>
>>62307639
pretty disgusting 2bqh.
proportions are all kinds of wrong.
>>
>>62307659
Go be homo elsewhere
>>
>>62307672
I can't wank to shit art m8.
I don't mind thick, but most artists have no idea how thick bodies actually look. They just draw a regular girl and inflate everything.
>>
>>62307379
lolis for hug not fug
>>
File: konachan.com-234148.png (1MB, 2000x1287px) Image search: [Google]
konachan.com-234148.png
1MB, 2000x1287px
>>62307684
I agree. It looks gross.
>>
So how's that programming coming along lads?
>>
File: 1486220228010.jpg (327KB, 2516x1516px) Image search: [Google]
1486220228010.jpg
327KB, 2516x1516px
I am drunk
but I love all of you
I'll be going to university in ten day
what shall I do
I don't want to end up alone
pic kinda unrelated
>>
File: 1503852489001.jpg (122KB, 650x866px) Image search: [Google]
1503852489001.jpg
122KB, 650x866px
>>62307730
DISGUSTING IRONIC WEEB REDDIOT DIE
You're gonna turn me into a fucking barneyfag
>>
File: 4chan-1445631393171.jpg (3MB, 2110x3036px) Image search: [Google]
4chan-1445631393171.jpg
3MB, 2110x3036px
>>62307810
Porting over some binary decompression algorithm to the language I'm using. Looks like wizardry to me.
>>
>>62307841
What language?
>>
>>62307834
r u ok anon?
>>
File: 1504053534516.jpg (100KB, 1280x720px) Image search: [Google]
1504053534516.jpg
100KB, 1280x720px
>>62307834
Kukuri is a miracle of the universe. I want to fug and hug her.
>>
File: 1504327220388.gif (2MB, 370x689px) Image search: [Google]
1504327220388.gif
2MB, 370x689px
>>62307851
D
>>
>>62307872
GOOD LAD
>>
>>62307810
not very productive judging by this thread
>>
File: 1504327150711.gif (939KB, 317x360px) Image search: [Google]
1504327150711.gif
939KB, 317x360px
>>62307882
I can't tell if you're being ironic or not.

>>62307901
>not loliposting and programming at the same time
Step it up, senpai.
>>
>>62307913
I'm not, D is love desu.
>>
>>62307920
D is dead, use C# or Rust
>>
File: 1504327005469.gif (486KB, 640x360px) Image search: [Google]
1504327005469.gif
486KB, 640x360px
>>62307920
You're an okay guy, anon.
>>
File: gravity.jpg (35KB, 792x612px) Image search: [Google]
gravity.jpg
35KB, 792x612px
What the fuck is happening in this thread?
>>
>>62307934
baka
>>
>>62307934
>C#
why use a gimped sepples?
>Rust
Why use a gimped and tedious haskell + Sepples bastard child?
>>
>>62302911
A pom.xml file
>>
>java is too slow to write
>scala is too slow to compile
>clojure is too slow to run
help me /g/
>>
>>62302929
>Qutebrowser exists
>>
>>62307958
>why use a gimped sepples?
readable compile errors
>>
>>62307999
>readable compile errors
What a compelling reason to abandon a language that already has this and more.
>>
>>62307997
>using anything written in python ever
ever wonder why your computer feels no faster than the one you had 10 years ago?
>>
>>62307981
maybe try Kotlin with the ide
or (((JRuby)))
>>
>guy who wrote the algorithm programmed the rest of his work using some quasi-OPP paradigm
Just kill me now.
>>
>>62308021
kotlin is too slow to write
jruby is too slow to run
>>
You would a Chino.
>>
>>62307958
>C#
>gimped sepples

You have no clue what you're talking about.

C++ has specific use cases where it shines; C# doesn't "take its place" in any regard. C++ when necessary, C# when C++ isn't required.
>>
>>62308098
There is no use-case where C# is better than C++.
And please don't bring up LINQ.
>>
>>62308035
guess you'll just have to kys
>>
>>62308139
I pretty much want a dependently typed language

but I'm not aware of any good ones that can output JVM bytecode

I hate having to target the JVM
>>
>>62301784
What's a good book to learn about how computers work? I want to understand how computers work so I can write programs more optimally
>>
File: 1490598511902.jpg (260KB, 550x727px) Image search: [Google]
1490598511902.jpg
260KB, 550x727px
Old hags are jealous creatures.
>>
>>62308240
Learn x86 asm
>>
>>62308240
https://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf
>>
https://youtu.be/KtltiBfvqCE?t=9m10s
>haskell neckbeards
kek
>>
>>62308274
immutable data make writing correct code a lot easier
>>
>>62308267
Fuck, is this really the best way to learn it?
>>
>>62308165
whats wrong with java,
>clear syntaxis
>very well defined core language as C not shitty tonks of features like C++
>hyper rich API to do almos everything
>documentation style is clear and nice
>Portable AF
>compilation times arent as ridiculous as C++ can be.
>If you learn the basics of a build system like gradle or ant, you cant make thinks as simple as in cmake
>>
>>62308359
>have to write a shitton of code to do anything or rely on magic frameworks that are prone to breaking if you try to do anything slightly unusual
>>
I need to convert the day of the month returned by time.strtime into strings like "the twenty third" or the "first" for my text to speech program to read.

Would it be easier to just create a dictionary with all those values? Or a list?

Or actually write a function that does this?(I feel like the amount of work may actually be below the threshold where this is efficient?
>>
File: 1478228055541.jpg (24KB, 600x445px) Image search: [Google]
1478228055541.jpg
24KB, 600x445px
>>62308388
forgot my anime image!
>>
>>62308307
I'm all for it which is why I'm learning about it just thought it was interesting industry people joke about haskell neckbeards
>>
>ywn be this kawaii when you program
>>
>>62308381
>idk what unit testing is
thats what i read.

dude only an idiot wouldnt do unit testing using a big framework or even a tiny library in ANY language to check if it works correctly.

and guest what, java has great tools for unit testing like junit.
>>
>>62308359
- proprietary
- shitty gc
- verbose
- slow to write
- memory footprint

also android speaks for java's performance very well
>>
>>62308240
I was taught computer architecture on mips asm. The architecture you choose matters much less than the concepts.

>>62308388
I would use a list, it's fast and easy
>>
>>62308422
I'm not talking about bugs I've written. I'm talking about bugs in the framework itself. My choice then is to either hope the maintainers accept a patch, or fork it with all the risks that entails.
>>
>>62308460
>I'm not talking about bugs I've written. I'm talking about bugs in the framework itself.

dude its the same of every other languages, a C application doesnt run directly on the machine, but an enviroment, its like claiming you gonna write your own kernel cuz you dont trust in kernel security to run your apps and you have to wait the fat dudes to fix the kernel.
JVM its mature enought
>>
>>62308444
Tried a list.

The time.strftime function returns a string with the value 01-31.

My practice list wont accept 01 as input.

WHY DOES THIS NOT ALREADY EXIST.

Half the things i work on I realize 2 hours later there is already a standard library module for it, but this is so simple and common place how can it not have a solution already?
>>
>>62308547
Just incase I seem retarded. I did use 01 and not "01". I am not that dumb.
>>
>>62308547
Either do a string lookup (in which case you have to use '01'), or simply cast the day to integer which will "erase" the 0.
>>
>>62308584
Nvm. I am that retarded.

Thank you.

Why didnt my programing book tell me that int() removes 0s infront as well as behind?
>>
File: fuccmepapi.jpg (47KB, 645x968px) Image search: [Google]
fuccmepapi.jpg
47KB, 645x968px
>>62301784
>tfw to dum to not overthink my class java assignment
>tfw gonna have to turn it in only 75% complete
>>
>>62308645
What did you think int() would return for '01' then?
>>
NEW THREAD

>>62308764
>>62308764
>>
File: 1498565680699[1].png (127KB, 601x508px) Image search: [Google]
1498565680699[1].png
127KB, 601x508px
>>62308711
I hope your being Ironic heh : )))))
>>
>>62308699
>>62308782
dumb wojakposters
>>
Trying to make emacs align the equals signs in my code (for Haskell)

Currently, the command
 M-x align regexp RET = RET 

works well, but I want something a bit more useful.

I guess what I'm asking is how to do the following:
Select all text 
perform M-x align regexp RET = RET
name it "align-equals"


I'm not too good at elisp, but so far I know that there's a defalias function I could use... After that I'm stuck
>>
>>62308894
Just do it yourself lad.
Muscle memory is better than relying on a thousand binds.

Or better yet just make your own haskell formatter to run on save.
>>
>>62306822

puts Dir.entries('.').grep /\.rb/
>>
File: 1504593236212.jpg (76KB, 1280x720px) Image search: [Google]
1504593236212.jpg
76KB, 1280x720px
>>62301784
What is the best way to learn python as somebody with little programming experience?
>>
>>62309077
dis gonna fix all

sudo pacman -R emacs
removing shit..............
sudo pacman -S vim
>>
>>62309242
as all python coders
copy pasting stuff from stackoverflow
No seriously, stop learning and coding in that joke language, identation being part of the language is as dumb as if a sentence in a natural language changed its meaning having an extra space between words.
>>
>>62309267
The reason I want to learn python is to do a bunch of cool raspberry pi stuff though.
>>
>>62309267
you could have
doublespace = comma

And english would be just fine.
>>
>>62309975
but is not is not cuz civilization is not retard
>>
>>62310075
I'm sorry have you heard of tonal languages before?
How about non phonetic writing systems?
Gender dependent pronouns?
homophones?
MOTHER FUCKING HETEROPHONES!


Pretty sure civilization is retarded.
>>
>>62310125
asshole handwritten documents would be a mess, what would be the metrics for a double space
you know what ? kill your mom, rape your dog
Disgustiong python lover
oooh now all has sense, homosexuals loves python.
>>
>>62310191
What are the metrics for single space in hand written notes?OH wait its whatever the scrivener feels like!

It even makes sense in lists. space is pause in speaking double space is double pause in speaking.

Dog Cat Frog food store log kog

Now the real question is do you use the oxford double space?
>>
>>62310290
KOG FRog
kog frog
Thread posts: 333
Thread images: 62


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.