[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: 318
Thread images: 41

File: 1477468839275.jpg (29KB, 450x685px) Image search: [Google]
1477468839275.jpg
29KB, 450x685px
Previous Thread: >>59631903

What are you working on, /g/?
>>
TRAPS!
>>
Why is this macfag posted here?
>>
File: 1487413306014.png (383KB, 611x720px) Image search: [Google]
1487413306014.png
383KB, 611x720px
Third for C(ute).
>>
>>59635744
Lain is female, retard.
>>
File: 1489924022786.jpg (63KB, 694x831px) Image search: [Google]
1489924022786.jpg
63KB, 694x831px
I'm doing something where randomly generated (i.e. 99.99% shit) AIs fight each other, and I'm trying to figure out how to get drawing and simulating to not separate from each other.

The problem is that if I try doing window.requestAnimationFrame(battleStep); then that works, one simulation step per frame, except that because requestAnimationFrame doesn't wait for the function it triggers to finish before continuing the script, I can't return a value since it will try returning values well before it finishes.

What do I do?

Also, fifth for suicide by theobromine poisoning
>>
>>59635770
ask me how I know about your mental illness
>>
File: 1480959165393.png (225KB, 500x368px) Image search: [Google]
1480959165393.png
225KB, 500x368px
quality thread
>>
>>59635770
Lain is an AI with no gender you pleb
>>
Write a method that calculates the sum of two very long positive integer numbers. The numbers are represented as array digits and the last digit (the ones) is stored in the array at index 0. Make the method work for all numbers with length up to 10,000 digits.


I tried with

            string number1 = Console.ReadLine();

int[] listofNumber1 = new int[number1.Length];
listofNumber1 = number1.Reverse().ToArray();


but i can't convert from char to int. Not really sure what to do

Not hw, i learn on my own
>>
File: sel.jpg (167KB, 1010x768px) Image search: [Google]
sel.jpg
167KB, 1010x768px
Let's all love Lain. <3
>>
>>59635934
She has female personality, supertard.
>>
File: burning of troy.jpg (138KB, 1000x618px) Image search: [Google]
burning of troy.jpg
138KB, 1000x618px
"Choosing C over ML was, in retrospect, a profoundly unwise decision. We chose to be 'close to the metal' in an era of kilobytes, at the exclusion of more elegant approaches. The consequences of our near-sightedness, our failure to predict explosive growth in hardware, have been catastrophic and unshakable.

We are trapped in the belly of this horrible machine, and the machine is bleeding to death."

John Carmick, 2017
>>
>>59635985
And? There are males with a female personality.
>>
>>59635989
C was a milkshake
ML was robot
I like dicks desu
>>
Used PyGaze to make an application which switches focus between windows (only works with Thunar at the moment) based which one I'm looking at.

The above was pretty easy; I'm hoping to make one which would do this across multiple monitors soon.
>>
>>59635989
LOL when did Carmack became millenial shitter?
>>
>>59635989
cant find the quotation anywhere
you have a source?
>>
>>59636041
there's nothing millenial about FP
>>
>>59636041
>>59636068
It's not Carmack, it's John Carmick.
>>
>>59636068
why_would_someone_lie_on_the_internet.tar.gz
>>
"Stop using C you lazy cat."

Jon Carmack
>>
>>59636081
LOL faggot changed name to ride on Carmacks popularity, FP shitters really are desperate.
>>
"C is so horrible I cried tears"
Jon Karma
>>
>>59635948
You have to split the string. Split it into an array list and then parse each into an int and store it in the array
>>
"C fucked my mom when I was 5"
J.Kramik
>>
>>59636156
>C cucked my dad
ftfy
>>
>>59636173
Who are you quoting?
>>
>>59635985
Hence she looks and acts like a girl, but isn't one.
>>
>>59635989
Lol the Doom guy?
>>
>>59635709
Let's all love Lain
>>
What's the best way to represent a many-to-many relationship outside of a relational database? e.g. a user can be part of many groups and a group can have many users. If I store lists of all the groups a user belongs to and all users I get the problem of keeping the two in sync.

I'm thinking that I could only actually store this information on one side of the relationship (e.g. only groups have a list of users that belong to them) and if my API requires me to get a list from the other side (e.g. list of groups the user belongs to) I would construct it on the fly based on the other lists, but that leads to very tight coupling between the two data structures.

I'm dealing with this in OO fashion now but the question is more general; I've had this same issue in C before.
>>
tired of python, want to move to another language. python is a mess. version 2 vs 3 is irritating
>>
File: 19836136.png (265KB, 609x461px) Image search: [Google]
19836136.png
265KB, 609x461px
>>59636181
ur'e mom
>>
>>59636216
there's only one python
>>
>>59636216
Criteria of the new language?
You can try Lua, Perl, Ruby, Java, C#, C++, C, Haskell, Lisp, Idris, OCaml and so on.
>>
>>59636245
>Haskell, Lisp, Idris, OCaml
it's like you saved the memes for last on purpose
>>
>>59636238
Germans thought the same thing about their country before 1946.
>>
>>59636261
>I'm mentally ill
>>
>>59636259
I placed all languages considering anon's Python experience, i.e. scripting languages first, then general-purpose languages, later languages with alien (for a pythoner) paradigm.
>>
>>59636245
You forgot Golang.
>>
>>59636207
Well in a database you would put in a mediary and make it two one-to-manys any chance you can work that out?
>>
>>59636292
Rob Pike is faggot and go is shit.
>>
>>59636207
pointers
>>
>>59636299
>go is shit
It's not great but it's better than half the languages >>59636245 listed.
>>
For storing 3d models for OpenGL, .3ds or .obj?
>>
>>59636318
First half or last half?
>>
>>59636326
.trash
>>
>>59636333
Last part and Ruby.
>>
>>59636326
.asc
>>
>>59636351
>An ASC file is an armored ASCII file used by Pretty Good Privacy (PGP), an encryption program used for secure communication. It contains a digitally signed message and may store plain-text written information, as well as binary information encoded as text. ASC files also include a key as clear-signed text, which can be verified using PGP authentication methods.
??
>>
>>59636318
Is go really better than Lua? I mean they're in completely different domains generally... but LuaJIT is fast as shit. I wanna see a comparison now.
>>
>>59636326
.wav
>>
>>59636383
>Is go really better than Lua?
No, Lua is one of the better languages in >>59636245

That said they're meant for completely different application and one couldn't replace the other.
>>
File: 1368368736519.gif (46KB, 300x300px) Image search: [Google]
1368368736519.gif
46KB, 300x300px
"C destroyed my life: The weak typing; the pointer magics; the lack of string; the imperative paradigm... All of this led to my dad being cucked by C, my boipussy being raped by a magical broomstick, and my mom to gain a gazillion lbs of pure fat. I'll never ever recover, NEVER.."
JON Kmircka
>>
>read up about C++98
>mfw
Since when it became popular to hate C++? C++98 seems to be a decent C extension.
>>
>>59636216
lua
trust me
>>
>>59636379
don't be retarded
>>
"I come to estados unidos on visa, work on shooting game, many years go by, many regrets tambien. C es no bueno"

- Juan Carmacho
>>
>>59636481
10/10
>>
>>59636383
Lua is a great language

>designed due to genuine needs and not memes
>portable and very effective at solving problems in the domain it was designed for
>not bloated over time to try and fit ALL THE DOMAINS
>finds some specialised applications in other domains regardless
>>
>>59636481
I thought the wall was supposed to prevent this from happening
>>
>>59636481
/topic
>>
>>59636481
>>59636511
"C has to go back."
JK McMack
>>
>>59636511
are there any C codebases that compile under -Wall
>>
>>59636543
all of them
>>
"J'ai programmé en C, et le résultat n'était pas bon du tout. Le C a ruiné ma vie!"
Jean Cark de la Mak
>>
जावा मेरी पसंदीदा प्रोग्रामिंग भाषा है
>>
"жaқcы бapлық eмec C. өмipiмдi қиpaғaн"
Джoн қapмaқ
>>
>>59636591
where did this pajeet = java meme come from?
>>
File: 1487706947991.png (553KB, 598x1021px) Image search: [Google]
1487706947991.png
553KB, 598x1021px
>>59636206
yus
>>
>>59636501
Who said this?
>>
I found this to be quite pleasing.
http://kotaku.com/5975610/the-exceptional-beauty-of-doom-3s-source-code
>>
Anyone can recommend a good updated place/book to learn C#. I have been recommended "BEGINNING VISUAL C# 2012 PROGRAMMING", but as the name implies its dated and doesn't teach WindowsForms.
>>
>>59636245
>Lua
Trash.
>Perl
Trash.
>Ruby
Trash.
>Java
Trash.
>C#
Trash.
>C++
Trash.
>C
Trash.
>Haskell
Trash.
>Lisp
Absolute trash.
>Idris
Acceptable.
>OCaml
Trash.
>>
>>59636793
ur shit
>>
>trying to figure out why screen blit is taking so long
>run callgrind
>signal is having a huge cost
>remove signal
>screen blit goes from 50ms to 4.2ms
>>
>>59636812
who are you quoting?
>>
>>59636818
this meme has gone too far
>>
>>59635709
>What are you working on, /g/?
Python-like C parser, so I could write without brackets.
>>
>>59636829
>meme
Oh, I see. That explains your retardation quite well.
>>
>>59636818
1$ has been deposited to your bank account
>>
>>59636841
can dpt be about programming and not about idiots shitting up the thread with "who are you quoting?","reddit spacing", or "using c++, post discarded"
that isn't discussion, it's fucking annoying
>>
>>59636863
No. You can leave now.
>>
@59636863
>animooooooooooooooooooo
>>
>>59636863
This isn't related to /dpt/. If you act like a retard, people will treat you like a retard.
>>
>>59636867
so you've directly stated you don't want /dpt/ to be about programming, why are you even here yourself?
>>
>>59636890
>/dpt/
>About programming
Haha
>>
>>59636890
Either that or I simply disagree with your word games and want you to stop replying to me. I don't associate with your kind.
>>
File: dpt.jpg (164KB, 800x1000px) Image search: [Google]
dpt.jpg
164KB, 800x1000px
>>59635709
There's the simple test for a programming language. If you can make a search engine, a driverless car AI, a mobile OS and a browser using the language, the language and its paradigm are not worthless. If you can't, the language is a /dpt/-tier useless shit.
>>
>>59635709
How long till lain is real so I can hold hands with her?
>>
>>59636905
https://en.wikipedia.org/wiki/Turing_completeness
>>
>>59636905
>tier
Stopped reading right there.
>>
„Ich habe in C programmiert und seitdem ist mein Leben ruiniert.”
- Johannes von Karmack
>>
>>59636916
Are you implying you somehow need Turing completeness for most of the things he listed?
>>
>>59636890
>you don't want /dpt/ to be about programming
lad, dpt is about animu and traps; back to rebbit pls
>>
>>59636783
I guess I'll have to go with Microsoft Virtual Academy.
>>
>>59636905
>If you can make..
So pretty much only python and any other non-turing complete language is shit?
>>
In C++, does a particular type of object always have exactly the same size?
Is the object in memory stored as the method table + all member variables?
>>
>>59637073
Do you even know what Turing completeness is? Doesn't seem like it.
>>
>>59637083
yes
no
>>
>>59637073
Python is a glue language, however it's much more useful than Lisp in the real life applications which make the world a better place.
>>
>>59637130
/thread
>>
>>59637097
It's an old meme.
https://learnpythonthehardway.org/book/nopython3.html
Do you know nothing about programming?
>>
>>59637097
The languages which people use for things I listed are by default Turing complete. My point that /dpt/ usually advertises here useless languages which are good only for students.
>>
File: lain.png (179KB, 1024x946px) Image search: [Google]
lain.png
179KB, 1024x946px
>>59635744
>>59635893
>>59635934
>>59635992
>>59636189
Do not talk about Lain like that. She is female you faggots.
Lain is god and is above your sick degeneracies.
>>
File: Lain is always watching.webm (2MB, 676x480px) Image search: [Google]
Lain is always watching.webm
2MB, 676x480px
>>59637184

>Lain is above your sick degeneracies.
>>
>>59637184
>Implying Lain isn't a genderless AI
And you don't seem to understand
>>
>>59637222
>AI
You can't build a fast bayesian decision network in Haskell, only C++.
>>
File: 1367510618239.jpg (25KB, 219x237px) Image search: [Google]
1367510618239.jpg
25KB, 219x237px
>>59637262
What are you trying to imply
>>
>>59637262
http://www.cs.uu.nl/dazzle/f08-schrage.pdf
>>
Can i do something like this in java?

ClassName [] obj = new ClassName [10]; 


i have a class "People" and i need to create a small database, instead of creating 10 objects i've tried that but ClassName.setX() is not reading any value
>>
I'm bored, I'm rusty, and I need something new. I want a game programming project, something I can knock out in about a week's worth of spare time. Language doesn't matter. Just, it can't be a roguelike, or a match-3,or a clone of an obvious arcade classic (Asteroids, etc.).

If those really ARE my only options for a one-week project, then so be it, but I'd love something more creative. Any ideas?
>>
File: wangblows.webm (302KB, 1320x732px) Image search: [Google]
wangblows.webm
302KB, 1320x732px
>>59615683
wew, I guess it's close enough.
>>
>>59637412
as i know, in c# you can't mass produce instances of a class, in java it's probably the same

you can make a Dictionary and assign objects as a value
>>
>>59637430
thats really cool anon
>>
>>59637417
(console) RPG mate, you can literally invent whatever the fuck you want
>>
>>59635709
Trying to get pyglet for python to work woith the babun shell... I get the error "ValueError: _type_ 'v' not supported"

Any ideas?
>>
>>59637431
welp, thats sad, my algorithm was looking really good using the object peoples[i]...

btw, there are pointers and malloc on c#? is there any way to dynamically create new instances?
>>
>>59637417
A text-based adventure/rpg with sanity mechanics.
>>
>>59637473
>is there any way to dynamically create new instances?

as i said, make a dictionary<int,object> with Key something like numberOfAObject and a Value that's something like new YourClass(properties)
>>
>>59637445
>>59637430
Good ideas! Text can be fun. Thanks y'all.
>>
Asking also this here >>59637513
>>
>>59637556
Please remain in your containment thread.
>>
>>59637572
It's a general question. I'm working on a web app but I could encounter these kind of problems with any project.
>>
File: ha1.png (71KB, 171x280px) Image search: [Google]
ha1.png
71KB, 171x280px
>>59636233
>ur'e mom
>you are mom
>you are

It's spelled ur, anon.
>>
File: 1385964120126.jpg (15KB, 475x360px) Image search: [Google]
1385964120126.jpg
15KB, 475x360px
So I'm about to finish my compsci degree.

For years 1-3, you do almost entirely Java. I took an elective in Python and an elective in webdev (mostly PHP) but all of the mandatory courses were in Java.

In year 4 I only had electives left and took most of them in C/C++ (your choice of language to use), and one in Ada.

I have to say I greatly prefer C and C++ to Java. C++ in particular I find is objectively superior. Is this a common sentiment? My understanding is most compsci programs shove Java down your throats.

The final course I'm taking, the professor basically told us (paraphrasing) that Java is a garbage language and if you really want to go places you should focus on C++ and/or Ada. He said a lot of legacy software (for banks, hospitals, etc) is in Ada; is that true?

I've already got a job lined up and it seems to use mostly Python and C++ for projects.
>>
File: 1368203971968.jpg (31KB, 240x226px) Image search: [Google]
1368203971968.jpg
31KB, 240x226px
>>59637675
>>
What is a good language to learn if my focus is image processing/computer visuals/3D graphics? It's a hobby for me and I've been using C exclusively. I really like C as my first language but is there something better, more suited for computer visuals?
>>
>>59637713
It's true that lots of companies have their core programs in old languages.
But not ada specifically.
>>
>>59637417
A text based Tetris

A 'T' tetrimino is falling. 9) rotate 90 deg.  L) move left, R) move right, etc.
>>
>>59637713

Java is the common denominator. It's hard to fuck up in Java, but anything else is better if you know your shit.
>>
>>59637770
i like this idea
>>
File: 14880605298090.jpg (40KB, 470x535px) Image search: [Google]
14880605298090.jpg
40KB, 470x535px
>>59637713
>if you really want to go places you should focus on C++ and/or Ada
But that's a load of horseshit.
>>
>>59637739
C++
>>
>>59637503
>>59637431
i actually did it, heres the process:

People [] peoples = new People[10];

for (int i=0; i<peoples.length; i++){
peoples[i] = new People();
}

>>
File: 1484971958558.jpg (56KB, 462x582px) Image search: [Google]
1484971958558.jpg
56KB, 462x582px
>>59637834
>new People();
>>
>>59637868
Baka animoo fan
>>
File: 1489244884420.jpg (74KB, 422x509px) Image search: [Google]
1489244884420.jpg
74KB, 422x509px
>>59637868
>>
>>59637834
>peoples
>new people
>>
File: 896786756.jpg (32KB, 795x145px) Image search: [Google]
896786756.jpg
32KB, 795x145px
>>
>>59637929
I don't get the top result. Do you have something to confess, Pajeet?
>>
File: 1490617881485.jpg (121KB, 414x490px) Image search: [Google]
1490617881485.jpg
121KB, 414x490px
>>59637907
>>59637868
Is there a complete pack of these images? I only have this one.
>>
File: 1487409098063.jpg (91KB, 336x442px) Image search: [Google]
1487409098063.jpg
91KB, 336x442px
>>59637974
I have 32
>>
>>59638027
Got a link?
>>
>>59636773
>comments are bad
nigga what
>>
>>59638075
It's because Kotaku is a shit site.
>>
>>59637974
>>>/vip/55011
>>
>>59638075
Yeah. I agree completely with that sentiment. Comments aren't solving anything. They're simply treating the symptoms of poorly written code.
>>59638105
It's written by someone who has developed a very large game by himself and he got a positive response from Carmack on the article (it's in the comments).
Kotaku is a site that has very loose affiliation with its editors. They're paid per hit, that's why there's so much junk on the site. But it's not all bad.
>>
>>59638105
He even starts complaining about K&R style because the writer apparently doesn't have a monitor bigger than 640x480.
>>
Should I use three-way quicksort all the time instead of regular quicksort, or is it the kind of thing I should only use if I'm definitely going to be working on an array with duplicate keys?

Is it significantly different from the plain old quicksort in terms of performance?
>>
File: 865879678.jpg (55KB, 335x423px) Image search: [Google]
865879678.jpg
55KB, 335x423px
What language will get me a job?
Google says that Java, Python and JS are the most demanded languages.
but almost everybody here says that those are shit, what should i do?
>>
>>59638223

Everybody knows what's wrong with those languages because everybody has used them at one point or another.

Knowing those languages is good for finding work.
>>
>>59638223
JS isn't really a jobby language, it's an entry point into the world of buzzword frameworks for doomed to fail startups.

Java will probably never go out of style but it's also awful. C++ has good jobs but it's less of an entry level thing.
>>
>>59638172
I know opinions vary, but I'll respectfully disagree with you here. Comments are notes for the next developer down the line, even if that developer is you.

Good comments explain the why, bad comments explain the how. More importantly, good comments serve as a tour guide for understanding the code better. Even with my own code, if I looked at it six months later and it didn't have comments, I'd have no idea what I was trying to accomplish.
>>
>>59638075
>>59638172
>>59638254
Comments can be helpful or not helpful, lots of comments are bad and some are good. In a massive project you can't live without comments but bad/long comments means poor understanding of the project which means shitty design.
>>
>>59636773
i used to comment ascii arts as a signature to my codes
>>
>>59638223
ALL languages are shit, it's just a matter of degree. If you're not programming for fun, then go with whatever language puts food on the table.
>>
>>59638323
how good do i need to be to get a job?
>>
>>59638253
So Java and C++ (also sql) are my hopes.
>>
>>59638116
... and now i have 200 and 32
>>
>>59638374

Depends what you're looking to do.
Don't plan on doing anything on the web if you don't know at least some Javascript, for example.
>>
>>59638254
Method, variable names should be indicate of what you're trying to do. Stop doing several tasks in one go as that leads to having non specific names.
>>
>>59638223
Learn C and enjoy (or suffer) a lifetime of decades-old code maintenance.
>>
If i have an array of {1,2,3,0} in C# and i want to display the elements in reverse order, but WITHOUT that 0 at the end (so 321 would be the result) what would be the best way to do it?

Only last 0 should be skipped
>>
>>59638453
You can't be serious.
>>
File: 563786786.gif (812KB, 768x368px) Image search: [Google]
563786786.gif
812KB, 768x368px
>>59638405
I live in a third world shithole.
So it's most likely that i will have to deal with web stuff.
I was learning ASM and i think it was a good idea since now i don't get lost when people starts talking about memory adresses, registers and stuff like that.
Now i'll go for SQL and JS since those two look somewhat "easy".
>>
>>59638453

Not sure about C# syntax but would
for (i = array.length - 1; i <= 0; i--)
{
...
}

be what you need?
>>
>>59638338
If they care about Git, then make sure you have a few examples showing you know the language. You don't have to be the Next Great Programmer, just demonstrate that you've practiced your way around a bit. A month or two can actually take you a long way.

And, know enough to fake it through an interview. Here's a hint, flash cards actually can take you a long way! Know each keyword, and do a web search on the language's most common patterns, and most common gotchas.

Lastly, don't be an idiot. I interview people regularly, and you'd be surprised how often people fuck up the obvious. Swearing during an interview, not showing up on time, not really knowing the company they're interviewing with, etc.

Keep at it, and good luck!
>>
>>59638453
something like
for(int i=MyArray.Lenght-2; i>=0; i--)
Console.writeln(MyArray[i]);
>>
>>59638489
sure, i solved it using extraordinary retarded logic, there has to be some one-line solution

                for (int i = totalArray.Length - 1; i >= 0; i--)
{
bool zeroCheck = true;
if (totalArray[i] == 0 && zeroCheck == true)
{
zeroCheck = false;
continue;
}
Console.Write(totalArray[i]);
}
>>
>>59638223
>but almost everybody here says that those are shit
Why do you think these things are mutually exclusive?
>>
>>59635709
Is lain waifu or daughteru?
>>
>>59638506
>>59638472
>>59638518
>>
>>59638483

ASM is useless to know unless you're going to be working in something very low level like C.
Web technologies are mostly abstract scripting languages.

SQL and JS don't really mesh together. Why not SQL + PHP? That's most people's entry into backend web development.

>>59638518

If you do
 array.length - 2

then you don't need the zero check.
>>
>>59638561
arr.Length - 1 could be a number that's not a zero, that's why i need to check it
>>
>>59638587

Oh I see.

I think it would be clearer if you just checked the final number once outside of the loop, and then iterated on the rest in the for loop.
>>
File: 1464998874180.jpg (72KB, 720x690px) Image search: [Google]
1464998874180.jpg
72KB, 720x690px
why won't anyone hire me
>>
>>59638630
No social skills
>>
>>59638649
What are these "social skills"?
>>
>>59638660
Ability to work with others, being normal. No one wants the guy that sits in a corner and never talks to anyone.
>>
>>59638704
>No one wants the guy that sits in a corner and never talks to anyone.
Why?
>>
>>59638660
Being able to interact with other people.
Being polite, clean, having work ethic being on time, etc.

>>59638561
>PHP?
desu i have tried learning some php before and i don't know if i have a certain degree of retardation but php looks like fucking clusterfuck to me, i wasn't capable of learning anything.

even c++ looks more friendly to me.
>>
>>59638704
As long as the things we're talking about are work related.
>>
>>59638543
Lain is daughteru, she is best daughter to teach gentoo to.
>>
>>59638660
A thing normies use to oust abnormies from the working market. Literally racism.
>>
>>59638660
The knowledge that you shouldn't be like chris chan and tell every stranger you meet you reguarly shit yourself.
>>
>>59638630
Take an internship.
Do extremely well at the job.
They usually will hire at the end if you made it seem like you're worth keeping

It's the easiest method, but you sacrifice some pay at the start.
>>
Does anyone know why a java program might get slower each time it does something?

I've written a program that draws shapes and moves them to a new x,y position and every time I do this the program runs slightly slower. Initially I thought it was the amount of shapes but adding a bunch of shapes first then moving one has no impact on performance, moving starts off just as fast with lots of shapes as it does with only one shape, and if i clear the screen of shapes and add and move a new one it still inherits the slowness.

I have no idea what could be causing this. I've had a look at the move methods and the amount to move by/rate to move at is not being changed so the slowness is definitely the result of the program running slower.
>>
>>59638734

PHP is absolutely a clusterfuck but it usually takes a novice dev a few months to realize.
It's easy to hack together a quick script in a few minutes, but anything advanced becomes a mess.

It's what most web development platforms use though.
>>
>>59638630
http://www.urbandictionary.com/define.php?term=Internship
>>
>>59638860

probably something going wrong with garbage collection/memory leakage
>>
>>59638764
>Literally racism.
Are you implying this has some negative connotations?
>>
>>59638764
>abnormies
>>
>>59638728
Companies prefer people that can be later promoted to managerial position, where you have to actually interact with others
>>
>>59638877
I'll give it a try again, SQL on the other hand is feeling really understandable.
>>
>>59638880
>>59638832
What if im not in college?
>>
>>59638990
I see. So how do I gain these "social skills"? At least some of them.
>>
>>59638254
>Good comments explain the why
This is super rare. You might explain why you're doing something relatively weird. Sure, that's a good comment.
But commenting code in general is terrible. And as documentation comments are pretty terrible. If you're gonna document why you should probably not put it in the source code.
>More importantly, good comments serve as a tour guide for understanding the code better.
No, this is what's wrong with comments. Comments are treating the symptom of bad code which is hard to understand code. Code that doesn't inform you of the larger systems at play or reasons you're doing certain things. Or simply code that is hard to understad what it does in isolation.
>Even my own code
Yes, why do you keep bringing this up. We all know we need to maintain code. That's not what comments are for though.

Comments go out of date all the time though. And you can't check them automatically (without introducing significant comment writing overhead, which wouldn't be too bad but still). If your code is well written it documents by being well written. If your code is later changed (presumably by a bad programmer or a programmer in need of sleep) to be poorly self-documenting you don't have comments laying around confusing you. If you have the code changed in a way that lets it remain easy to understand it's still documented well.
>>59638277
>but bad/long comments
I don't think there's any instances where the length is a problem aside from the fact that it may be very detailed comments so they're very likely to go out of date.


And the reason you don't "just update your comments accordingly" is because it's a very onerous task to first write a piece of code and then diligently analyze the comments to see if they reflect the code. When you could remove that necessary reflection.
>>
File: frog.jpg (44KB, 448x252px) Image search: [Google]
frog.jpg
44KB, 448x252px
>>59639066
You're gonna have a hard time.
>>
finally figured out why this one function randomly returned bullshit.
I was clearing all fpu registers during an interrupt.
oh man I feel stupid now.
>>
>>59639154
atleast you won't commit the same error again
>>
>>59639138
If it takes a lot of comment to explain something then it's probly not something easily explained and even harder to understand fully. Comment smell.
>>
>>59636793
>python
import trash
>>
>>59635709
I am new on inline assembly in C code.
I am programming in an ARM Cortex M4 with FPU platform. I want to use the VSQRT instruction to perform a square root calculation, but I don't know how to constrain the input variable "squaresum" in the inline assembly.
Basically I have this:
float    squaresum = 0.0f;
[...]
__asm("vsqrt.32 %0, %0": "" squaresum);


I tried "__asm("vsqrt.32 %0, %0": "+r"(squaresum));" but compiler throws me the following error:
Error: VFP single or double precision register expected -- `vsqrt.32 r3,r3'

And doesn't convert into a FPU register (typically s14 or s15 as seen in the compiling results for other FPU instructions I use)

How can I do it?
>>
File: dt170329.gif (122KB, 900x280px) Image search: [Google]
dt170329.gif
122KB, 900x280px
LOL
>>
>>59639183
it's "t" for float and "w" for double, according to this:
https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html#Machine-Constraints
>>
>>59639236
It worked with "t".
Thank you.
>>
>>59639218
depends, you have to be efficient and sometimes this will save you from wasting your time.
Of course if you have already have something to do is better to finish as soon as possible.
>>
>>59639218
Isn't the guy who draws Dilbert super fucked up?
>>
>>59639174
But with your code you've already written a clear relationship between things that functionally describe the situation.
If it's unclear it's a code problem.
If you're using a stupid way to express this in code that makes it hard to understand then you've written bad code. Even if the nice professor at your old college told you OOP is the one true god and taught you how to squat to not get shit on your shoes.
>>
touch .dmenu_note && dmenu -l 100 < .dmenu_note>> .dmenu_note


little one liner notepad/reminder thing for i3wm
>>
"C è senza dubbio il peggior linguaggio che mi sia capitato di dover utilizzare"

Giovanni Carmaco
>>
Is it considered bad/harmful in C to end blocks of code with a semicolon? Like this:

if (this == 1) {
that = true;
};

while (b < MAX) {
b = b + 1;
};
>>
>>59639304
I'm saying that long comments are probably a symptom of bad code/design, not that it's inherently bad to write an essay per function.
>>
>>59639326
Unnecessary. I don't think anyone serious minds.
>>
>I got bullied in school for returning stack allocated string from function. C should be banned.
-- Joni Karmake
>>
>>59639348
But I think these are necessary in case you want to explain how your code works to other people because you'll have to do it at some point, for maintenance and bug fixing.

If you write overly long comments, your problem is not a programming one, but a communicational one.
>>
>>59638990
>Companies prefer people that can be later promoted to managerial position
What if I don't like management and like writing code?
>>
>>59639426
>What if I don't like management and like writing code?
You either need to be really good or you won't be more worth than anyone else that knows how to code.
>>
>>59635798
y dont u fap 2 da picture instead n stop usin javaskript
>>
>>59639490
What the fuck is that supposed to mean? You think experience in programming counts for nothing? Being a manager is probably the most uninteresting boring piece of shit job you can come up with. Management sucks dick.
>>
>>59635709
Is there any way to migrate .net framework libraries to .net core in VS other than copy and paste the code in different Solution?
>>
>>59639511
>You think experience in programming counts for nothing?
No, but they can hire pajeet instead of you and pay him less.
You need something that makes you indispensable.
>>
>>59639533
>No, but they can hire pajeet instead of you and pay him less
The joke's on you, I'm a squatting pajeet.
>>
>>59635709
I'm working on a mobile game app
>>
xd
>>
>>59639326
What does this even do?
a lone ; is a NOP instruction.
>>
I'm just starting a Delphi course, and I'm having trouble doing a simple task.

For a number "x" I enter, I need the program to sum up all the number up to x and give the result.

How I do this?
>>
>>59639694
Is this india?
Who even teaches object pascal in 2017?
At least C gets taught with C++, pascal is a dead language.
>>
>>59639676
it's not even a NOP, the compiler just ignores it.
>>
>>59639621
get ruby and put it on the feminist

swap C & C#
>>
>>59639712
>At least C gets taught with C++


C =/= C++
>>
(speed ranking)
C > Rust > C++ > Java > C# >>>>>>>> Python >>>>>>>>>>>>>>>>>>>>>>>>>> Haskell
>>
>>59639864
>not injecting the machine code directly in the processor.
>>
File: 1468975975408.jpg (54KB, 503x604px) Image search: [Google]
1468975975408.jpg
54KB, 503x604px
This is probably a bit of a weird question, but are there any languages where the following command is "built-in" or something of the like?
var newFormat = createFormat({decimals:X, width:Y, zeropad:bool},etc...);


Building a custom version of a post-processor for a different program, no idea what language I'm even working in or what kind of arguments I can add in to the stuff already here.
No docs either, and the only thing the software devs say about it is "Please refrain"

A lot of my stuff so far has been throwing stuff at the wall and seeing what sticks, but I'm a step away from basic functionality, should just need to get this format changed to pad zero's out to X many decimal places of said format
Pic unrelated
>>
>>59639864
>xe still cares about performance
>>
>>59639621
C++ and C# are flooded with Pajeet as well. Not sure where this perception that C* are the "gentleman's OOP languages", but yeah. Pajeet loves OOP.
>>
>>59639873
I have no idea what you're trying to do and I would highly suggest not writing ANOTHER preprocessor for javascript as there's already too many of those.
>>
>>59639873
do you mean
using namespace std;
stringstream s { };
s << setfill('0') << setprecision(d) << width(w) << number_to_format;

?
>>
>>59639872
Do you use a wire syringe?
>>
>>59639909
>>59639956
Ok, to clarify
It's for a post-processor that generates code for specific machines
There's a couple dozen I used as examples to build one for a non-supported machine
It's pretty much a lone class definition sitting around with some properties and functions that the main program calls to generate the proper code
Also, typo in the code the example was supposed to be
var newFormat = createFormat({decimals:X, width:Y, zeropad:bool,etc...)};
>>
>>59636206
>Let's all fuck Lain
FTFY
>>
>>59640180
no No NO
Lain is not for se*ual
>>
Is Java a SJW free zone?
>>
I can't make a loop for checking if one array matrix included in another one. Like
1 2
2 1
and

1 2 1
2 1 2
1 2 1

should give an answer of "2", however, I don't understand how to we compare everything. Any tips?
>>
>>59640411
Indians are extremely culturally conservative, so yes.
>>
>>59640411
C++, Java, Asm
anything convoluted/not easy enough to scare SJWs
>>
>>59640411
Java is for slow children.
>>
>>59640422
If you're checking square 2 dimensional arrays, you can just start at an offset of a larger one with 2 nested for loops.

I won't say any more because this is how you learn.
>>
>>59640454
great criticism of the language bro
>>
I have a Java compilation problem.

I have an interface Foo not in any package:
public interface Foo


I have a class Bar in package X:
package X;
public class Bar


The files lie in the same directory, but when I perform a compilation, the compiler can't find the interface Foo from Bar:
$ javac *.java
...
error: cannot find symbol


How do I use the Foo interface from witin the Bar class?
>>
>>59639873
>>59640052
Scratch that, started punching in random words as arguments and found one that did what I wanted
>>
>>59640659
Why don't you use a build system?
>>
>>59640854
It's a small school project consisting of five files. Now, how do I compile it?
>>
dumb question. making a form in C# right now and I want a button click to bring up a new form and dynamically create a matrix of buttons on that new form.

Is it possible (read smart) to separate the dynamic creation bit into a new class or do I have to keep it in the form class?
>>
>>59640484
I suppose we should be checking 00 with 00 first time, then 00 with 01, 00 with 10, and 00 with 11.
Then 01 with 01, 01 with 02, 01 with 11, 01 with 12, and so on.

Fuck, I feel I am so close yet unable to put it into code.
>>
you have 30 minutes to write a depth-first tree traversal that uses constant space

GO
>>
>>59641075
isn't this just traversing a linked list with an if statement?
>>
https://github.com/mrFrosty/fit-visualization Anyone good with da campuutah knows why this doesn't work, /g/?
>>
>>59641110
write it
>>
>>59640942
Use an IDE with a build system.
>>
File: 1489206858908.png (126KB, 800x769px) Image search: [Google]
1489206858908.png
126KB, 800x769px
I want to make a program that recognizes and downloads pepe images.
What language is the easiest to achieve this?
How the heck do i create an algorithm (?) that recognizes pepe images (without using google or something like that) i was thinking about neural networks but i don't know a shit about they work.
>>
>>59641259
Sorry, the comic has just been acquired by Adult Swim, and that picture is now longer covered under copyright law.
Please delete this image or I will call the police.
>>
>>59640484
>>59641046

I am fucking stuck. I firstly started with nested loops, however, I don't even imagine how do I put it in the way I described in >>59641046.

One more tip?
>>
>>59641259
Easy way out:
Compare histograms of the pictures you want to recognize with a template pepe picture.
Not garanted to work with every pepe pics, especially pepe with alt colors, but guaranteed to work with a lot of common pepe pictures.
>>
x86 instruction references always include a table like this:
Instruction     Latency     Throughput  Execution Unit
CPUID 0F3n/0F2n 0F3n/0F2n 0F2n
MOVSB/MOVSW 1/0.5 0.5/0.5 ALU

what are these numbers supposed to mean?
>>
>>59641259
Calculate the percentage of pepe green in an image.
>>
"Ivanka reveals she will take computer language class with daughter, 5"

http://www.dailymail.co.uk/news/article-4357158/Ivanka-coding-class-daughter-summer.html
http://edition.cnn.com/2017/03/28/politics/ivanka-trump-coding-class-daughter/

Is programming now a celebrity thing?
>>
>>59641337
>>59641259
Could use an SVM with the histogram of the data, but it would requires you generating histograms for a few (100~) known pepes before hand. You could do this all in probably like 30-40 lines of Python/R code with the right libraries.
>>
>>59641259
I know approximately zero about NN/ML so this may be complete bullshit.
but I imagine it works somewhat like this:
>take neural network
>have one output node (true/false)
>feed it mixed pepe and unrelated images
>save network with the highest ID rate
>use it as base, introduce random modifications
>start over until ID rate is acceptable
>>
>>59641405
Pics like pic related wouldn't be downloaded because they lack the green component, but that's the best you can do at your level.
I have a few more ideas on how to recognize pepe pictures, but they involve convolution matrices and neural networks.
>>
File: 1484939710484.jpg (244KB, 1024x576px) Image search: [Google]
1484939710484.jpg
244KB, 1024x576px
>>59641405
>>59641337
>>59641355
Thank you a fucking lot, i'll start tonight.
i'll use python since it's the one that looks the most friendly to me.
>>
>>59641479
My suggestion is don't use color at all and use a simple CNN (If you don't know anything about CNNs, check our a TensorFlow/Pytorch tutorial using MNIST data). Pepes have a very distinct STRUCTURE, not necessarily color. I would first work on a program that can: 1.) Generate black and white outline of a given pepe, then 2.) Normalize the input Pepe to some size (note that smaller normalized sizes will make training the CNN much faster). After you have a couple hundred labeled training examples (there are prob. hundreds of websites you can easily parse to get these), then train the simple CNN using them. After words, to tell if a new image is a pepe, run it through your normalize then your trained CNN.
>>
>>59641259
tensorflow
>>
File: 1474096937725.jpg (218KB, 600x600px) Image search: [Google]
1474096937725.jpg
218KB, 600x600px
>>59641547
it couldn't recognize this one
>>
>>59641589
dumb frogposter botnet
>>
How to read txt file to 2d array of words in c++?
>>
>>59641623
i googled this whole post and got an answer in the first result
>>
>>59641653
Nice work, Mr. Robot. Or would do you rather wish to be called "Android"?
>>
>>59641653
god dammit why cant my posts even get this type of reply
>>
>>59641670
dumb anime poster
>>
>>59641339
Clock cycles?
>>
File: shell-windows.png (47KB, 256x256px) Image search: [Google]
shell-windows.png
47KB, 256x256px
Batch is a programming language, isn't it?
it was my first approach to langs
>>
>>59641733
how many clock cycles is 0F3n?
is that even a number?
>>
>>59641754
I'm pretty sure it doesn't count, even if it was technically turing complete(which I'm not at all sure it is, and can't be bothered to look up).
>>
>>59641339
>>59641733
It's IPC/CPI, and those 0Fn3's are basically the particular CPU that the instruction is being run on CPI I am pretty sure. Modern day processors can have cores running at different freqs by varying internal voltages ect (for low prio tasks or whatever), or even heterogeneous cores themselves.
>>
VBA Excel people here ?
learning that shit during semester break and have a problem

filled all cells between A1 and C8 with random numbers to test "do while loops"
it doubles all cells in the first column but doesnt jump to the second

Sub test()

Dim i As Integer
i = 1
Dim j As Integer
j = 1

Do Until IsEmpty(Cells(i, j).Value)
Do Until IsEmpty(Cells(i, j).Value)
Cells(i, j).Value = Cells(i, j).Value * 2
i = i + 1
Loop
j = j + 1
Loop


End Sub
>>
>>59641110
since nobody could come up with a solution or even google one here it is

https://pastebin.com/AkeRU5rD
>>
>>59641925
did you really have to show off such a simple linked list traversal?

the comments outnumber the lines of code
>>
>>59640422
>>59640484

Somebody? It fucking kills me.
>>
anyone have a torrent or dl in general for algorithms 2 by princeton that used to be on coursera?
>>
>>59641956
> linked list traversal

that's not what it is at all though
it's a binary tree traversal
>>
>>59641884
you need to reset i to 1 when you increment j
>>
>>59641818
lmao it is actually turing complete, i thought it wasn't.
>>
>>59642007
Post what you have anon.
>>
Anybody made any money from winstore apps?

My current project is UWP and i plan on selling it in the store for a buck.
>>
>>59642017
Well look at this cis sperglord who thinks trees can be only binary. Trees are a fucking specrtrum you turbonerd world ruiner.
>>
>>59642048
I didn't say trees can only be binary you dumb fuck

just that my code traverses specifically binary trees

if trees could only be binary you wouldn't have to specify them as binary

fucking dumb shitposter, at least put some effort into it
>>
>>59641754
>Batch is a programming language, isn't it?

Depends on the language.

I would say that Windows cmd.exe doesn't qualify as a "programming language" because it's missing too much.

But I would say that bash is rich enough to qualify as a programming language. I've seen bash used for a pretty impressive variety of purposes.
>>
>>59642075
95% of binary trees degenerate into a straight linked list anyway
>>
>>59642031
Feels that everything you type as instructions to the computer is Turing complete these days. Shit, even html5+css3 is Turing complete.
>>
>>59642075
fuck off with that reddit spacing retard.
>>
>>59642093
> i can't understand a simple code snippet
>>
>>59642007
Think about if you printed our your matrices and cut them, how would you find a solution then? You would probably overlay the smaller one ontop of the larger one in some corner, see all the overlapping symbols matched, and if so do something (return true or increment some sum), then you would either step down 1 column, or step down the number of columns in the smaller matrix (i.e. overlapping vs. non-overlapping possibilities), and at the end of the row, move the smaller matrix down (or up) 1 row (or the # of rows in the smaller matrix).
>>
File: 1471304839469.png (43KB, 444x287px) Image search: [Google]
1471304839469.png
43KB, 444x287px
>>59642101
>html5+css3 is Turing complete
>>
>>59642130
http://stackoverflow.com/questions/2497146/is-css-turing-complete
>>
>>59641925
adding a predecessor to every node isn't constant space
>>
>>59635709
REEEEEE
i dont know C but i need this really bad:

https://github.com/daurnimator/luasodium

Can someone tell me how to use it?
>>
>>59642212
explain in detail what do you want to do.
>>
>>59642212
>C
>100% lua
???
>>
File: IMG_6203.jpg (42KB, 219x222px) Image search: [Google]
IMG_6203.jpg
42KB, 219x222px
>>59642044
>>
new thread
>>59642274
>>59642274
>>59642274
>>
>>59642239
I want to encrypt/decrypt a file with a priv/pub keypair.
>>
>>59642202
it reuses the already existing NULL right child pointer.

If your tree doesn't have pointers in leaf nodes, it doesn't work obviously.
>>
>>59639872
>Not being a god of your universe where your thoughts manifest into reailty, making programming worhless.
>>
>>59642641
>implying that's fun
>>
>>59642698
True. But you can self impose rules to make your endless/pointless existence a little bit more challenging.
Thread posts: 318
Thread images: 41


[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.