[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 39
File: hime on the front page!.jpg (94 KB, 500x701) Image search: [Google]
hime on the front page!.jpg
94 KB, 500x701
old thread: >>53805279

What are you working on, /g/?
>>
Why can't you just use a programming related image for the OP
>>
>>53810667
hime is programming related
>>
File: 1368637306212.jpg (55 KB, 250x250) Image search: [Google]
1368637306212.jpg
55 KB, 250x250
>>53810667
>anime
>not programming related
>>
https://gitgud.io/0xBA5/matcha
Trying to display content in a HTML table.
>>
>>53810682
Post your code on a real git host.
>>
>>139392629
that moment when zou moved then destroyed the whole jack's fleet in one hit. thank you (g)Oda
>>
>>53810667
Go away car fag
>>
>>53810655
who is this attractive two dimensional female?
>>
>>53810715
>female
>>
File: K&R himegoto.jpg (159 KB, 500x700) Image search: [Google]
K&R himegoto.jpg
159 KB, 500x700
>>53810667
but hime possesses a deep understanding of sign extension and floating point representation methodologies~
>>
working on my MOO still
>>
File: harp.jpg (49 KB, 934x525) Image search: [Google]
harp.jpg
49 KB, 934x525
>>53810715
>attractive
>>
>Tfw you have to be good at math to program
>>
>>53810753
No shit, programming is maths + engineering + philosophy + science + whatever you're programming
>>
>>53810691
I initially had my project on GitHub. The biggest reason I moved over is muh ethics.
>>
>>53810753
So learn math. There's nothing stopping you.
>>
File: 1459272045776.jpg (13 KB, 253x299) Image search: [Google]
1459272045776.jpg
13 KB, 253x299
>>53810753
>>
>>53810779
You realize you're not better than an SJW at this point?
You're just a far right SJW and you lash out against far left SJWs.
>>
Hey guys, what do you think is easier to do,
write a text-messaging app for Android (similar to Kik, Whatsapp, etc., in Java),
or write a VoIP program for the desktop (similar to Skype, also in Java)
>>
File: my son.jpg (11 KB, 293x250) Image search: [Google]
my son.jpg
11 KB, 293x250
>>53810808
>far right SJW
>for avoiding github
>>
Longer names aren't essentially more readable, if names are too long, the flow of the code is obscured.

Name length varies depending on context: If declaration and usage are close, meaning the scope is small, a shorter name is better, especially if the meaning of the variable is immediately obvious in the given context (maybe because a type is attached, the variable is something obvious like "i" or "n" or the respective construct adds meaning, like for each v in values).

Also, another factor that should be considered is how often a name is expected to be used. If something is used a lot, even in a large scope, then a shorter name is better as well, because it can be expected that the reader likely knows the name (math instead of mathematics, fmt instead of formatting, str instead of strings, ...).

Also, occasionally longer names should be chosen when name collisions may be an issue (occasionally situations arise where you're stealing names from your user).
>>
>>53810780
I did but I still suck at math so it makes programming harder
>>
>>53810845
what's the problem
>>
>>53810808
>far right SJW

The far right are trying to protect liberty. It's the far left (socialists, communists, fascists, etc) that want to snuff out the last bit of individual liberty left in this world.
>>
>>53810808
>Yeah SJWs breathe air, but have you noticed that YOU also breathe air? That makes you know better than the SJWs!
>>
>>53810850
suckingg at math
>>
File: tumblr_mv5ibtQQM51qa6vgoo2_500.png (185 KB, 500x217) Image search: [Google]
tumblr_mv5ibtQQM51qa6vgoo2_500.png
185 KB, 500x217
>>53810739
>>53810732
nice meme guys,
who is it?
>>
>>53810655
Please use a roll image next time.
>>
>>53810874
nobody can help you if you don't tell them what the problem is
>>
>>53810870
Shit, *no better
>>
>>53810877
whoever it is, it has a penis
>>
>>53810887
>being triggered by internet posts
>correcting posts on the internet
What are you, some kind of SJW?
>>
Help /dpt/, I got called asking to schedule an interview for a software development position involving CUDA but I've never used it before

What are some ez ideas that parallelize well to practice CUDA with

Pic related I need to learn CUDA passably enough to convince them I can learn the rest on the job
>>
>>53810938
bitcoin mining
dogecoin mining
trumpcoin mining
>>
>>53810952
Tripcode generator.
>>
File: CoralineEhmke-crop.jpg (44 KB, 797x400) Image search: [Google]
CoralineEhmke-crop.jpg
44 KB, 797x400
>>53810808
I disagree. I don't lash out against SJWs. I simply refuse to use a service run by pic related.
>>
File: bloat.jpg (99 KB, 630x655) Image search: [Google]
bloat.jpg
99 KB, 630x655
>>53810977
what is that disgusting creature
>>
>>53810997
This can't be real
>>
>>53810930
>accusing someone of being an SJW
Sounds like something an SJW would do
>>
>>53811015
https://www.google.co.uk/images?q=belgium+health+minister
>>
>>53810997
Who cares if she's fat as long as she does her fucking job?
Faggot.
>>
>>53810977
Forgot to add this:
I didn't pick gitgud.io because of the gamergate stuff hosted on there. If I did, that'd make me the polar opposite of a SJW indeed.
I might switch to neetco.de though. I really like the gogs UI.
>>
>>53811045
found the fatty
>>
>>53811045
Never fucking reply to me again unless you're losing some weight.
>>
whats the most masculine language?
>>
File: not SJW.jpg (183 KB, 1024x887) Image search: [Google]
not SJW.jpg
183 KB, 1024x887
>>53810808
>>
>>53810753
You literally don't even have to be amazing, but if you go a little more advanced, a few hours and google will literally solve lifes problems.
>>
File: D.jpg (42 KB, 512x512) Image search: [Google]
D.jpg
42 KB, 512x512
>>53811061
D
>>
>>53810938
If you're good at math, simulate some shit with the finite-difference method. (I'm doing one for my assignment, simulating heat conduction over a plate, i'm not parallelizing it though)
>>
>>53811056
>>53811059
Topkek, nice projecting here faggots.
I'm skinny AF, doesn't mean I have to hate fat people. Retarded people though, they can go choke on a dick.
>>
>>53811093
I have infinitely more respect for retards than fatsos

Now go and don't come back until you've got a normal BMI
>>
>>53811045
Would you trust a fat nutritionist?
Either their education is worthless or they don't follow their own advice.
And frankly I don't want to believe that an educated person would purposefully ignore their education because they eat too many sweets.,
>>
File: 1448870372218.gif (3 MB, 550x309) Image search: [Google]
1448870372218.gif
3 MB, 550x309
>>53811111
Checked
>pls be in London
>>
>>53811111
nice digits
>>
>>53811105
Sweetie I couldn't be fat if I tried, I'm too lazy to cook or go out unless I'm starving.

>>53811111
>Would you trust a fat nutritionist?
>Either their education is worthless or they don't follow their own advice.
There's literally nothing wrong with giving advice that you don't personnally follow, as long as you understand what's hapenning and it's a conscious decision.

>And frankly I don't want to believe that an educated person would purposefully ignore their education because they eat too many sweets.
But that's a common thing. For example a fuckton of people keep procrastinating, which is completely stupid and will fuck them over. They know it's not good to be late all the time and scramble to do low-quality shit right before the deadline, they do it anyways. Is it any better? I don't know, but it happens all the time and nobody cares.

Check'd.
>>
I really want to know who the OP womyn is.
>>
>>53811202
Oh no
It's retarded
>>
>>53811217
Wow you really got me there I'm crying pls stop being so mean :'( :'(
Eat shit kid.
>>
>>53811216
Hime from Himegoto.
Protip: I got banned for 2 days after posting a pic of him/her/it half naked.
>>
>>53811236
mass * height^-2
>>
>>53811259
Man you sure are autistic. I haven't measured myself in forever, because unlike you fat fucks I don't need to give a shit.
Guess I'm roughly around 21, whatever that means.
>>
>>53811059
fat guy here, here's your (You)
>>
>Tfw you are all plebs at programming
>>
>>53811202
>There's literally nothing wrong with giving advice that you don't personnally follow,
yeah there is
>>
>>53811244
The mods are based indeed
>>
C++ newbie here, learnt what the command "system" does so I decided to make a program to check if I'm connected to the internet but when I execute it, it eats up all my ram, my cpu power and doesn't close by any means(alt f4, X button, task manager). It also creates a billion processes. I learnt that "system" just writes stuff to cmd. Here is the code;

#include <iostream>
using namespace std;
main ()

{
system("ping google.com");
system("pause");
return 0;
}

I know I didn't use any std commands, I was going to but I tried executing this primary stage of the program to see if it works and all hell broke loose. What the fuck is happening?

(If you wanna debug I suggest using a VM)
>>
>>53811244
its he
or it, depends wether he is japanese or not
>>
>>53811350
How so? Unless you're purposes are malicious, there's literally nothing wrong with giving advice. Whether you follow your own advice is irrelevant, and might affect the quality of your advice, but there's nothing inherently wrong with it.
>>
>>53811365
http://stackoverflow.com
>>
>>53811350
There isn't tho, as long as you're qualified, you know what advice to give. Wether you follow it or not is irrelevant.

Her job isn't personally teaching people how to eat well, all she needs to do is manage the money, completely different set of skills.
>>
>>53811352
I think you meant to reply to this
>>53811350
>>
>>53811365
Any code with
system(...)
is shit.
>>
>>53811379
Oh fuck off.
People like you are the reason we have bureaucrats who haven't stepped foot in a classroom in 40 years, and yet they're running schools.
They couldn't be more disconnected from the education process if they tried, and yet they're the one calling all the shots.
>>
File: liberty-stops.png (4 KB, 276x386) Image search: [Google]
liberty-stops.png
4 KB, 276x386
>>53811365
My guess: your program is called "ping" and the system call invokes it instead of the system ping, so it creates an infinite loop of doom. BTW this wouldn't have happened if you were running an actual operating system.
>>
>>53811365
Is your program's binary named "ping" or "ping.exe" by chance?
Because except infinite recursion, there's no reason this shouldn't work.

And don't fucking use system. Anything but system.
>>
>>53811410
it's named ping.exe. I assume there is already a program in windows OS named like that and that's the reason this is happening?
>>
I can not program
>>
>>53811410
there's nothing wrong with using system() so long as you use conditional compile flags for your command strings.

#ifdef __linux__
static const del_cmd = "rm";
#else
static const del_cmd = "del"
#endif
>>
File: file.png (9 KB, 323x413) Image search: [Google]
file.png
9 KB, 323x413
I have a noob question.

So I have the game loops seen in the picture.

>The main loop creates the Char and Map objects
>The Battle Prep loop instantiates the chars and generates a map
>Combat loop does movement, combat, etc.

So my question is this: What's the best way to pass the reference of the map and chars? Simply adding them as a parameter would just end up making the code extremely unwieldy and it wouldn't really be a good way to make any sort of concurrence.

Can I make some sort of shared memory pool and then simply mutex my way out of it?
>>
>>53811447
monad
>>
>>53811404
That's not the same thing at all, teaching is not a science like nutrition. Of course you want people who what they are doing to call the shots. But the people who know what food is good for your kids are the scientists, not the lunch ladies.

>>53811423
There's your problem. When you do system("ping google.com") it finds your program "ping.exe", not the system ping, because system() is crap.
You made a program that opens itself, so it'll keep openning itself until your computer slows down to a crawl.
>>
>>53811460
Not changing languages.
>>
lmao, I remember writing a .bat to .exe compiler waaay back in the day by doing this:

outputting
#include <iostream>
using namespace std;

int main() {


Then, reading every line of the batch file and outputting
system("<LINE>")


Then, outputting
  return 0;


Then compiling it with g++ or whatever compiler i had on windows.
>>
>>53811445
Enjoy your blatant security vulnerabilities and nonportable behavior, I guess.
>>
>>53811423
No, it would also fuck up if you called your program "fgwza" and system'd on "fgwza". Whether there is another program with the same name is irrelevant. The problem is that the name you're invoking gets looked up in the current directory before being searched amongst the commands of the OS. This is a design flaw of windows btw.

>>53811445
Then you come into one of these bomb directories where there's a dir.bat that contains "format c:", and your program fucks the user over, even though they haven't committed the mistake themselves and you should have been doing some system calls instead.
>>
>>53811476
if you've got generics and first class functions you've got monads
>>
>>53811514
>your program fucks the user over, even though they haven't committed the mistake themselves and you should have been doing some system calls instead.

There's nothing stopping your user from having his copy of the standard library compromised if that's really your goal.
>>
>>53811447
Do you have classes in your lang? then make an object per main loop, have the loops be methods and the 2 objects attributes and you're done.
>>
>>53811550
>There's nothing stopping your user from having his copy of the standard library compromised if that's really your goal.
Yes there is, that's called file permissions and it's been here for decades.
>>
>>53811572
If you have access to their computer, all bets are off.
>>
>>53810778
+ alchohol
>>
File: col.png (1 KB, 93x50) Image search: [Google]
col.png
1 KB, 93x50
If you don't put a fucking empty line between a closing brace and the next statement fucking kill yourself
>>
>>53811474
>>53811514
Okay I get that but why would it not close? At the press any key to continue part it just opens again and I assume "X, alt f4 and end task" are being counted as fucking single keystrokes so it does what any other key does; open the program again. Is my assumption correct?
>>
>>53811550
>corrupted SYSTEM library is the same as having just unpacked a dangerous zip.
And if this library is statically linked, then you have to compromise the kernel first. But don't you see that, in the first case, you have a vulnerability in your shitty program, whereas in the other ones, the attacker already have access to pretty much anything and can do whatever they want with or without your shitty program?
>>
>>53811593
} else if () {
>>
>>53811588
If you have access to a limited user account, and some fucktard used system() in a privileged program (or just any program running as a different user), you just got the world's easiest privilege escalation.
This is like search path hijacking 101.
>>
>>53811596
>it does what any other key does; open the program again
What the fuck? what are you working under?
>>
>>53811559
So there's no way to do it with using separate classes?

I guess I could merge it to 1 class but I had hoped to avoid it.

Using Java btw.
>>
File: DealWithIt.gif (498 KB, 405x228) Image search: [Google]
DealWithIt.gif
498 KB, 405x228
>>53810667
because you're fag,that's why.
>>
is Sicp a meme book?
>>
>>53811647
Aye.
>>
>>53811647
It's interesting, but it's not the panacea.
I read a couple chapters and it was good, just not mindblowing.
>>
>>53811647
Yes. But you'll benefit from reading it.
>>
>>53810655
kill yourself

>>53811639
kill yourself
>>
>>53811635
What separate classes? Are you making MainLoop a class? (Does it have to be instanciated?) Then you get away with a public variable, you've guessed it, but there are ways to do it that are more meaningful, so you've got to choose.
>>
>>53811647
it's only a meme if you haven't read it.
>>
>>53810655

I'm learning rails. super late to the party tho lol. been at it for a bit but I just feel like I'm learning where to put shit and then magic happens. don't really feel like I'm getting better at programming. whatev.
>>
>>53810655
I watched a bit of this, and it was cute and all, but once every single character ended up being a dude it was kinda meh.
>>
def exercises(arr):
newString = ""
paldubs = []
right = 0 # if right is equal to newString/2 it's a pal
for i in range(0,len(arr)):
for j in range(0,len(arr)):
if arr[i][0] == arr[j][len(arr[j])-1] or arr[i][len(arr[i])-1] == arr[j][0]:
for k in range(0, len(arr[i]) + len(arr[j])):
if k < len(arr[i]):
newString +=arr[i][k]
else:
newString +=arr[j][k-len(arr[i])]
for k in range(0,len(newString)/2):
if newString[k] == newString[len(newString)-1-k]:
right += 1
if right == len(newString)/2:
print 'found'
right = 0
paldubs.append(i)
paldubs.append(j)
print paldubs
paldubs = []
exercises(['bat','tab','cat'])



is this cancer yet
>>
>>53811679
>>>/g/wdg/
>>
Why do all the proper principles and best practices of object oriented programming fall apart whenever you get to the persistence layer?

I feel like there is no ORM that actually employs best practices. They're all fucking awful, no matter the language.
>>
>>53811680
that one boy that follows around the orange panties girl is actually a girl, so there's that.

also read the manga, it's much better
>>
>>53811663
no. every chapter is mindblowing.
>>
>>53811674
Every loop is a separate class for now because I figured that would help me if I needed to do concurrency later.

Yes MainLoop is a class.
>>
>>53811709
because OOP Is An Expensive Disaster Which Must End.
>>
>>53811722
If you're new to both programming and math, maybe.
>>
>making the switch from github to bitbucket because of the SJWs

feels good man

actually they are almost identical. I'm surprised one or the other doesn't have a proprietary claim to a lot of the stuff.
>>
>>53811695

shit didn't even know that existed. I don't look at anything else on /g/ so I just ctrl-f for daily programmer. thanks anon.
>>
>>53811709
#justcrudthings
>>
>>53811731
github is just a fancy frontend for git with a bunch of convenience features added
there's no "pull request" in git, it's just a merge from another person's fork.

Do other git hosts even offer pull requests?
>>
>>53811724
>help me if I needed to do concurrency later.
How? Because Java forces you to pass objects rather than first-class functions (which don't exist) to threads? Maybe, but it still means you have to instanciate them, so I'd go for putting Map and Char into a separate Data object which you can pass around, extend, or have multiple instances of.
>>
>>53811750
>ctrl-f for daily programmer.
why not use filters?
>>
So I found out that functions can't return matrices (new to C), is there a somewhat easy way to bypass that? Perhaps with pointers? I already found a way to solve the problem but I'm trying to condense my code and make it more intiutive.
>>
>>53811729
>If you're new to both programming
but that exactly what sicp is for ! it's an introduction book to programming.
>>
>>53811811
return a pointer to a 2D array
why is this even a question?
>>
>>53811816
If you're new to programming, go to /webdev/ not /dpt/
>>
>have to comb through thousand lines C file with K&R bracing and underscore naming
>>
>>53811786
Lets say I make an ADT called Data that encompasses all my types etc. I make the ADT a Singleton for concurrencies sake.

Will I still be able to extend Lists and add objects to the Data object?
>>
Started using Git at my new job and I have to say it's a little confusing and harder to follow. TFS is much better and friendlier (except branching is a bitch), and I miss it already. (inb4 M$ shill)
>>
>>53811820
>>53811811
You should dynamically allocate an array to store the matrix content. If you want to make it clean, make a Matrix struct with pointer-to-data and dimensions (you can return this directly) and write a bunch of functions to create an free it.
>>
>>53811851
I don't understand why people say Git it hard, it's super intuitive.
It's just a big tree of hashes with some named pointers.
>>
>>53811846
use your IDE formatter if you get so triggered by the bracing
>>
>>53811851
I agree Git is too hard
>>
>>53811878
because anything more simple than git push and git clone requires you to have a deep and abiding understanding of git internal delta representation of your text.

Every time I want to do something mildly complex, like undo my last commit, I have to look it up.
>>
>>53811847
>ADT
abstract design pattern? abstract data type?

>Will I still be able to extend Lists and add objects to the Data object?
There's no reason you won't be able to mutate it. What's the problem? I don't see any.
>>
>>53811846
You're lucky you got code that is formatted properly, anon.
>>
>>53811878
When a lot of people work in one repo it's really confusing with all the merges you get. If there are several commits to pull before you push, you have to commit also a merge. TFS does not do that - you have to merge changes before you commit and you get a nice and clean commit with your changes only.
Also having tasks in TFS and directly linking changesets to them makes understanding logic changes really easy - requirements are one click away.
I have no idea how Git integrates with Jira but I doubt it's that easy
>>
>Linus Torvalds assesses his net worth as $150M
>tfw you will never be this rich
actually i might but it'll take decades
>>
>>53811933
>you will never be this unlikeable
>>
>>53811952
torvalds is nothing short of annoying
i can't even listen to his public talks because his ego is so massive
>>
>>53811907
>a deep and abiding understanding of git internal delta representation of your text.
Diff, it's just diff, what are you expecting?

>Every time I want to do something mildly complex, like undo my last commit, I have to look it up.
Undo is revert, HEAD means current, and ^ means previous. So "git revert HEAD^" goes back one commit before current.
It actually makes sense, so it's easy to remember.

>>53811929
>When a lot of people work in one repo it's really confusing with all the merges you get.
If multiple people modify the same files, a merge is unavoidable.

>If there are several commits to pull before you push, you have to commit also a merge.
> TFS does not do that - you have to merge changes before you commit and you get a nice and clean commit with your changes only.
No, you just need to rebase your changes instead of merging. You're looking for git rebase, or just "git pull -r" to rebase when you're pulling.

>Also having tasks in TFS and directly linking changesets to them makes understanding logic changes really easy - requirements are one click away.
>I have no idea how Git integrates with Jira but I doubt it's that easy
Git integrates with a lot of stuff, I haven't used Jira, but I doubt it's a problem.
>>
>>53811963
to be fair, with that kind of money a big ego is kind of justified
>>
>>53811811

I usually do things like
struct matrix { ... };

...
/* matrix_multiply: calculates a*b, stores the result in result */
/* returns 0 on success, 1 on allocation failure, 2 if dimensions mismatch */
int matrix_multiply(struct matrix* result, struct matrix* a, struct matrix* b);


to use it, simply do
struct matrix a,b,c;
...
matrix_multiply(&c, &a, &b); /* c = a*b */
>>
>>53811952
Who cares what people think about you if you're rich and can afford to do the things you enjoy (preferably away from the people you hate)? I dislike most people unless they're family members, friends or patients.
>>
>>53811963
It would be annoying, except he's actually right.
If that bothers you, it's called jealousy.
>>
>>53811907
>because anything more simple than git push and git clone requires you to have a deep and abiding understanding of git internal delta representation of your text.
How so? On the contrary, I would argue that Git has a nicer model that the rest, because it is focused on workdir states, which is what you put in and want to get back. I believe that earlier vcs where focused on deltas because of a lack of abstraction over the way the data is deduplicated. what requires such a deep understanding, and what makes you call the representation "delta"?

>Every time I want to do something mildly complex, like undo my last commit, I have to look it up.
How could "commit --amend" be more rememberable? Wait no, I got it, you mean "reset" etc. Yes, you need to understand the "three kind of trees" as they call it on git-scm. That's not so bad I would say. Also resetting stuff this way is bad practice because it makes remote histories deviate, so "ugliness is a feature" it this case.
>>
>>53811862
>>53811984
Thanks for your answers people but it sounds like unecessary work for a 300 line school project and a function that is called 2-3 times throughout the program. Still going to look into it though cause it seems interesting.
>>
Write a program that displays a heap graphically the program lets you insert and delete an element from the heap.
>>
>>53812004
He's a smart guy. But I can't understand his uncontrollable rage. He flips out over everything. To discuss a technical problem with him is to have him call you a fucking idiot and a retard.
>>
>>53811978
Rebasing is off the question in this job since some dudes fucked up the repo several times by rebasing.
It's a bitch to plow through a 200 files merge to get the 1 file that is actually changed
>>
File: tired pepe.jpg (20 KB, 306x306) Image search: [Google]
tired pepe.jpg
20 KB, 306x306
>>53810655
>draw a flat chested girl
>call it a boy
>>
>>53812038
It's just a cultural thing, the same way we call people faggots here for the smallest thing.
If he gets mad, it just means he disagrees and he wants you to know it. When he's wrong feel free to call what he said braindead in return.

>>53812040
Don't blame the tools if 1) one guy fucked up 2) everyone else overreacted to one fuck up.
>>
File: Linus-Torvalds.jpg (162 KB, 800x400) Image search: [Google]
Linus-Torvalds.jpg
162 KB, 800x400
>>53811963
>implying torvalds's behavior is not vital in this era full of sjws and turncoats.
>>
>>53811709
Because objects don't map well to databases.
I've found that not having an ORM, while a lot more verbose, actually seems a lot cleaner and simpler, as long as the library you're using for persistance is good (which thankfully most get right).
>>
>>53812075
>It's just a cultural thing
I know of no culture where people are that fucking mad at everything normally. It's certainly not in finland.

>the same way we call people faggots here for the smallest thing.
Yes it's exactly like. Discourse of 4chan is fucking retarded largely for that reason.
>>
>ywn never contribute code to the kernel and get called mean things by Torvalds for seemingly minor mistakes
>>
Why does PHP still get so much shit? It has awfully unintuitive standard functions but its implementation of classes isn't bad. Sure like 10 years ago its entire codebase was horseshit but i bet if you compare the aggregate quality of php code written in 2016 with the quality of ruby code then PHP would probs win.
>>
>>53812114
Linus mentioned one time that the most essential trait you must have to survive in the open source world is thick skin. Don't let these fuckers get to you and put them in their respective place
>>
>>53812114
>I know of no culture where people are that fucking mad at everything normally. It's certainly not in finland.
It's the Internet, body language and emotions don't transfer very well over text, so brutal honesty is what you have to deal with.

>Yes it's exactly like. Discourse of 4chan is fucking retarded largely for that reason.
It's what you make of it, I've had good discussions with other anons, even if they say things like "fucking retarded" instead of explaining what the issue is.
>>
>>53812150
Because ruby is also shit.

Why to people here always justify langugaes by pointing out that they are better than some other even worse language?
>>
>>53812127
I call bullshit, Torvalds is very nice to newcomers. He only shits on people who have responsabilities and should know better.
>>
>>53812150
>aggregate quality of php code written in 2016 with the quality of ruby code then PHP would probs win
Think about who uses PHP for a second and then rethink that statement.
There are a lot more retarded PHP users.

For PHP to become decent, it'd have to become a different language and break all backwards compatability.
>>
>A certain string-processing language allows a programmer to break a string into two pieces. Because this operation copies the string, it costs n time units to break a string of n characters into two pieces. Suppose a programmer wants to break a string into many pieces. The order in which the breaks occur can affect the total amount of time used. For example, suppose that the programmer wants to break a 20-character string after characters 2, 8, and 10 (numbering the characters in ascending order from the left-hand end, starting from 1). If she programs the breaks to occur in left-to-right order, then the first break costs 20 time units, the second break costs 18 time units (breaking the string from characters 3 to 20 at character 8), and the third break costs 12 time units, totaling 50 time units. If she programs the breaks to occur in right-to-left order, however, then the first break costs 20 time units, the second break costs 10 time units, and the third break costs 8 time units, totaling 38 time units. In yet another order, she could break first at 8 (costing 20), then break the left piece at 2 (costing 8), and finally the right piece at 10 (costing 12), for a total cost of 40.

>Design an algorithm that, given the numbers of characters after which to break, determines a least-cost way to sequence those breaks. More formally, given a string S with n characters and an array L[1..m] containing the break points, compute the lowest cost for a sequence of breaks, along with a sequence of breaks that achieves this cost.

me and my homework group sat around for an hour just on this one single problem and we didn't make any progress at all. please help
>>
>>53812156
That's quite possibly true. It doesn't explain his behaviour at all however. Most OSS projects manage to be led by someone who isn't a rageaholic. I can't think of a single other programmer who is as notoriously angry as Linus who manages a project.
>>
File: php masterrace.png (2 MB, 1598x1585) Image search: [Google]
php masterrace.png
2 MB, 1598x1585
>>53812150
>>
>>53812181
>There are a lot more retarded PHP users.

I disagree. Sure that definitely USED to be true but newcomers who want to write websites just don't gravitate to PHP anymore.
>>
>>53812182
Wow, I'm glad I'm self-taught.
>>
>>53812182
The premise is so awful I would refuse to work on this. No sane language would copy 20 characters THEN discard the 18 last. You just allocate space for two chars and copy them.
>>
>>53812182
make the string immutable and compute offsets + lengths
>>
>>53812210
Judging from stack overflow, that is wrong.
Just think about it, PHP is pretty much a second native language in India.
>>
>>53812180
ssshhh, don't ruin the meme
>>
>>53812182
How is it not really easy? Can't you try every permutation of L, compute the number of time units it will take and keep the best result? Brute-force isn't always right, but here it seems right, no?

>>53812232
Isn't the content of the string irrelevant anyway? We just need the length
>>
>>53812114
>that fucking mad at everything normally
i know of one: the one where people care about shit. and it's not like he usually just gets in people's face, that's a misconception perpetuated by the reports. whenever he has been intentionally harsh, it was the second or third time the person on the receiving end had done something stupid.

>fucking retarded largely for that reason
the difference being that people, on average, seem to be much dumber here than on LKML and they don't have a common project to work on.

i agree with >>53812091. he's not unreasonable in criticism, albeit refreshing and perhaps often overly clear in tone, even though a lot of his hyperbole is also wrongly portrayed as mean spirit.

don't mimimi.
>>
>>53812246
>How is it not really easy? Can't you try every permutation of L, compute the number of time units it will take and keep the best result? Brute-force isn't always right, but here it seems right, no?
It looks like an algorithm problem, not a real world problem. They probably don't want performance or common sense, just the "right" answer.
>>
>>53812246
>>53812261
the section we're on is dynamic programming so i assumed we were supposed to use that for the question, but it doesn't look like it specifies you have to use dynamic programming. so that may be what we end up having to do. my brain just explodes when i try to read the question and make a dynamic programming solution
>>
File: [tilting increases].png (27 KB, 500x500) Image search: [Google]
[tilting increases].png
27 KB, 500x500
>>53812294
>dynamic programming
>>
>>53812241
Hmm i guess i forgot that third world shithole exists.
>>
>>53812261
Right, I took you for dumber than you actually are. So if we find every possible shortcut, it's the right answer?

>>53812294
cost(breakpoints, i, j) computes what the cost is for jus the section between i and j, recursing if necessary. Base case: there are no breakpoints between i and j, so not splitting it up obviously costs 0. make one (i,j) cache per breakpoints array for this function, done.

Maybe you need to keep only the values that will be useful again in the cache?
>>
>>53811683
>#https://leetcode.com/problems
Is there a place to see optimal answers? mine just has lots of loops even though I think all of them are necessary



def exercises(arr):

newString = ""
paldubs = []
right = 0 # if right is equal to newString/2 it's a pal
for i in range(0,len(arr)):
for j in range(0,len(arr)):
if arr[i][0] == arr[j][len(arr[j])-1] or arr[i][len(arr[i])-1] == arr[j][0]:
for k in range(0, len(arr[i]) + len(arr[j])):
if k < len(arr[i]):
newString +=arr[i][k]
elif k >= len(arr[i]):
newString +=arr[j][k-len(arr[i])]
for k in range(0,len(newString)/2):
if newString[k] == newString[len(newString)-1-k]:
right += 1
if right == len(newString)/2:
print 'found'
right = 0
paldubs.append(i)
paldubs.append(j)
print paldubs
paldubs = []
right = 0
newString = ""


exercises(['bat','tab','lls','s',"abcd", "dcba", "lls", "s", "sssll"])
>>
How do websites like https://ideone.com/ and http://golf.shinh.org/ run arbitrary code without it being a security issue?
>>
>>53812341
thinking about it in terms of the base case helps. thanks brad
>>
>>53812371
I'm glad
>>
Its all sandboxed to fuck. It's probably running in like 17 VMs
>>
>>53812355
I assume they run everything under AppArmor/SELinux with everything blocked and kill programs if they take too long.
>>
>>53812355
every piece of code is run on a fresh docker instance and disposed of immediately after 10 seconds
>>
Is there a bigger buzzword than dynamic programming?
>>
>>53812420
TDD
>>
File: vulkan.jpg (77 KB, 1616x223) Image search: [Google]
vulkan.jpg
77 KB, 1616x223
>What are you working on, /g/?
fucking around with some vulkan.
>>
>>53812420
Agile.
>>
File: burning eyes.jpg (24 KB, 448x256) Image search: [Google]
burning eyes.jpg
24 KB, 448x256
>going from patrician tomorrow theme to the google+ parody
>>
>>53811494
fuck you fag, your post is fucking up my json parser
apparently, its the "read" function's error
I don't know how to fix
there should be enough context for it to know I want an Int
pic related

any haskell fags can help me?
>>
>>53812420
It's a buzzword, it should be called something else, I agree, but at least it's not a meme. Also lazy evaluation plays well with so-called "dynamic" programming patterns.
>>
>>53812420
how is dynamic programming a buzzword? it's a useful term
>>
>>53812451
I told myself I could handle this for a day, but I already want the original style back
>>
>>53812420
data scientist
>>
>>53812459
Top fucking kek that's what you get for using a meme language!
>>
>>53812473
I imagine some cunt in a lab coat at a computer
>>
File: haskelel.jpg (99 KB, 529x598) Image search: [Google]
haskelel.jpg
99 KB, 529x598
>>53812459
>muh hasklel
>muh purity
>muh safety
>muh correctness
>>
>>53812459
Just download Clang++
>>
>>53812459
What is causing it in this post? I guess it does not happen with ECMAscript implementations, right? Try sinking the contents of the post with QuickCheck if you don't know what part fucks up. It's the lazy method, and I'm feeling lazy right now. Also Haskell is lazy.
>>
>>53812438
>m_
Fuck you.
>>
>>53812471
browse from mobile
>>
>>53812459
i mean looking at the json i don't see a problem with that post (it's happening in the post number)
http://a.4cdn.org/g/thread/53810655.json. Only thing i can think of is that you're including some other part of the JSON in that. Maybe put:
trace a $ Jint (read a)

on the right hand side of line 65 and see what you get?
>>
>>53812550
>Fuck you.
What's a better naming convention then?
I don't really do C++, but I think I've seen m_ before so I just went with it.
>>
>>53812459
It's funny since the content of the post is disgusting to a rare degree. What are primitives and appropriate in your memecode btw?

Maybe it's "<LINE>"...
>>
File: haskelel2.jpg (745 KB, 1920x1080) Image search: [Google]
haskelel2.jpg
745 KB, 1920x1080
>>53812459
>>
>>53812260
>and it's not like he usually just gets in people's face, that's a misconception perpetuated by the reports.
It's not about just caring about shit. I'll get mad as fuck at people if they are making the quality of the project suffer because they are being lazy or too close minded to consider better solutions. Linus blows up over tiny shit where there isn't a clear answer. Imagine suggesting a way to make a project you are working on better to a colleague, and then him getting fucking pissed as shit at you for being "wrong" and "wanting to ruin the project", is that helpful? It's as easy to say "We're not doing that because of reason X" and let him either accept that, suggest why that might not be a good reason or improve his suggestion. The media tends to post Linus's entire email threads where he blows a fuse at someone, and I've read a few of these. It's not misrepresentation. He get's mad about shit that totally does not warrant it.

>overly clear in tone
Saying everything loud and angry does not make you any clearer. If it did, every project manager everywhere would aspire to act like Linus. They don't because this obviously is not a good way of working with people, it's just a way for people with anger management problems to get some relief.
>>
>>53812438
Whatya making?
>>
>>53812612
Not using m_
>>
Who wants to collab and make a program together
>>
>>53812536
the "resto" int
every other thread but this one works
>>53812629
here its the source code so u can understand;
https://0x0.st/PBx.hs
why do u call it a memecode?
>>
>>53812709
Communists
>>
>>53812696
Nothing, just seeing if I can get shit to work.
>>
typedef int buffer_t;
buffer_t buffer[BUFFER_SIZE];


why not just call it an int? what's the purpose of making a new type?
>>
>>53812721
God speed anon. I'd like to make a OpenGL powered painting app someday, like procreate for iPad... Was thinking Vulkan would be pretty sweet for that too if it was mature enough.
>>
>>53812728
typedef float degrees;
typedef float radians;
>>
>>53812728
in C the more _t's and underscores you have before variable names, the faster it goes.
>>
>>53812728
it's mostly not needed but you could change the type to e.g. int32_t at the typedef and everything that uses buffer_t would just work
>>
>>53812728
The only reason that would make sense is if buffer_t is changed depending on platform, etc. to something that isn't int.

Otherwise it's bad practice.
>>
>>53812728
i use typedefs only for structs and other compound types.
>>
>>53812728
It sounds like buffer_t is a buffer rather than an element of the buffer, the purpose of this is clearly to confuse people.
>>
>C fags need to litter their code with typedef
>>
The only thing you should ever be using typedef for are opaque, or otherwise implementation-specific, types.
>>
>>53812728

The other rule it's breaking is naming itself name_here_t. Any _t names are reserved by POSIX yet everyone breaks that rule.
>>
>>53812728
I would think buffer_t is a complete buffer object and not just a fucking int, who writes code like this?
>>
>>53812836
Nice memename
>>
>>53812832
>Any _t names are reserved by POSIX yet everyone breaks that rule.
this desu
Thankfully it's fine most of the time, but if you do something like name something float_t and include math.h, you'll be in trouble.
>>
Why the fuck does everyone have a tripnames?
>>
>>53812832
>Caring about posix compliance
Nice one, Sean.
>>
>>53812859
It's retarded-css day in western countries on the first of april.
>>
>>53812859
APRILS FOOLS YOU JUST GOT PRANKED
>>
>>53812859
It's so no one will know that I am the Sussman.
>>
>>53812864
It is fucking retarded anyway and there is no reason to do it other than being massive cunt.
>>
>>53812873
>>53812878

Ummm, okay? So that is what's breaking my appchan.
>>
>>53812859
Google+ has a strict real names policy
>>
File: Capture du 2016-04-01 23-08-45.png (75 KB, 782x694) Image search: [Google]
Capture du 2016-04-01 23-08-45.png
75 KB, 782x694
>>53812859
also this is how 4chan looks today on computers. I assume you're a Jap on their phone?
>>
>>53812856
they don't want you to use double __underscores for your internal function names, but people do it anyway
>>
>>53812908
TROLLED HARD
>>
>>53812923
> XD
>>
>>53810820
Messager
>>
>>53812970
> XD
>not CX
complete sudoku
>>
File: jesus_burns.png (16 KB, 544x130) Image search: [Google]
jesus_burns.png
16 KB, 544x130
what are applications of
with statement 
[/code[
in python

how often do you use it?

With try: it is simple, but with?
>>
>>53812709
How about you teach me and be my mentor
>>
>>53812977
>being named after an herb
>>
>>53812977
>complete sudoku
Nice meme! Can I copy paste it into my meme database implemented in a MEAN-stack =P?
>>
>>53812990
I am sorry, I fucked up syntax

what are applications of
with statement 


in python

how often do you use it?

With try: it is simple, but with?
>>
>>53812903

>No reason
>In the standard

Educate yourself.

http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_02_02

>The identifiers reserved for use by the implementation are described below
>ANY header
>_t
>>
>>53813008
make sure to add the tag
Get Suicided
>>
>>53813037
No, you kill yourself, faggot.
I bet you like Haskell too.
>>
>>53813073
Woah, why are you telling me to kill myself? That's fucking harsh, what the fuck is wrong with you?
>>
Post your homework or assignments and I will do it for you
>>
>>53813121
Averaging two fizzbuzzes
>>
>>53813121
How do I draw a circle programatically?
>>
>>53813011
show me your vang, marta
>>
>>53813096
Is today shitposting day too?
>>53813121

Neural Network based controller an UAV?
Thread replies: 255
Thread images: 39

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

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.