Post more of these
bump
>>57321285
>>57321285
whats wrong with this code?
>>57321552
Too edgy for /g/.
>>57321552
Could easily use a loop, and reduce the code by 90%. Also allows multiplication by a factor larger than 10.
>>57321552
>>57321552
tits or gtfo
>>57321552
>>57321556
>>57320538
Are they even around somewhere else in the web or are those a /g/ special?
>>57321850
>tfw never did any stupid shit like this because it was the lazier option to just learn this shit.
>>57321552
:^)
>>57321839
How can anyone teaching be this much of a shitter.
>>57321905
>Using the smiley face with the carat nose
>>57321552
Nothing, /g/ just hates women >.<
I've always found deeply embedded software architecture design flaws more amusing than these extremely simple "beginner mistakes".
Bad comp sci graduates are more likely to do the former than the latter, but we never get those examples in this thread, probably because /g/ doesn't understand what real anti-patterns look like.
>>57321934
This is my favourite
>>57321552
for b-- > 0
a =+ a
return a
>>57321934
heh, this is actually pretty good
>>57321934
That's brilliant kek
>>57321981
>>57321975
>>57321939
It's the only one I ever saved because it's so creative
>>57321995
>not using a loop to build a string which you then feed into eval()
What a newbie
>>57322012
What's the problem here?
>>57322040
Returning a pointer to an char array that goes out of scope when the function returns.
>>57322047
Ah right.
>>57322047
data could be a global variable though :^)
>>57322090
data could be, but that's not what the returned pointer returns to. It returns to an anonymous array declared in the return statement.
I hope you are ready for this one.
>>57322109
Please tell me this is a real thing
>>57321839
can someone explain this to me
>>57322119
That would be a lot of effort just for a joke.
This is from a syntax highlighter of mine, think it qualifies?
>>57322135
Base64 is a hash function, not an encryption function. Encryption can't be reversed like hashes can.
>>57322135
Base 64 is an encoding function, not an encryption function (which should be evident since the guy doesn't even talk about keys)
>>57322135
The joke is PHP.
>>57322151
You're retarded, hashes can't by design just be reversed.
>>57322145
It just looks like any good old regular expression. I've seen worse: http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html
>>57322151
Base64 is an encoding. You can easily decode a Base64 string. Hashes are one way, you can't construct the data from only the hash string.
>>57321760
imgur.com/a/lGOvs
found an imgur album
>>57322177
>That link
Geez
so using that function means if one card gets comromised all of them do
isnt this basically same with encrypting a a file filled with card numbers?
>>57322184
>>57322176
My bad niggers, didn't have my coffee yet. I did mean encoding.
>>57322119
It's faster using hardcoded values, that's why someone did that, I think
>>57322151
Base64 is not a hash function. Base64 converts data to a base64 standard and is fully reversable. It is commonly used when you need to exchange binary data but the transfer method can only deal with text strings (and restricts those text strings to printable characters only)
>>57322210
No, it means they could just run base64_decode on the "encrypted" card info if the DB ever got leaked whereas with a real hash they would need to bruteforce it (good luck with that).
>>57322221
ah so it literally just converts a number to base 64
okay i get it now
>>57322210
It means the shit is not encrypted at all, anyone who sees it either at target or in transit now has your credit card number.
>>57322218
This actually true.
The algorithm is called "down algorithm" and it's actually pretty fast.
Here is a paper about it:
http://www.ams.org/journals/mcom/1983-40-162/S0025-5718-1983-0689483-8/S0025-5718-1983-0689483-8.pdf
>>57322151
>Base64 is a hash function
Nope
>>57321964
You are like a little baby. Watch this:int a, b, c;
printf("Enter two numbers: \n");
scanf("%d\n%d", &a, &b);
c = a;
while (b > 1) {
a += a;
b /= 2;
}
if (b == 1)
a += c;
printf("Their product is: %d\n", a);
>>57321934
Buggy code, doesn't account for DST, depending on the situation, you could get today, tomorrow, or the day after tomorrow.
>>57321964
No.
>>57322135
It's like converting your card number to hexadecimal and thinking that makes it secret.
>>57323119
How would one accomplish this? I assume reading the source file and printing it out wouldn't work.
>>57323203
>>57323119
This is interesting.
What if it's compiled? How would one do this without code duplication?
>>57322109
N-nani?!
>>57323203
It's called a quine.
Python example:l='l=%s;print l%%`l`';print l%`l`
>>57321914
Male dominated field.
That's what happens when there's no competition.
That's why we need more women in tech.
>>57323281
>>57323281
>>57320538
>>57323370
>latter
>less readable
>less efficient
When will the functional meme finally die??
>>57323370
Actual two types of programmers:for(int i = 0;;++i)for(int i = 0;;i++)
>>57323370
normie fa/g/ here, which one is better and why?
>>57323319
>>57323332
>everything I don't agree with is bait
>>57323453
Top one for readability, bottom one to show your computer e-penis skills.
>>57323471
Top one for everything, function calls are extremely expensive.
>>57323370
I would fire the second programmer. It's less readable than the first, and has no performance benefits.
I would bet the second programmer would probably consider himself "smarter" since he used standard library functions instead of simple statements, but the opposite is in fact true.
>>57322016
i would punch them in the heart
I love these
>>57323661
>>57323669
>>57321552
mainly just inefficient, also capped at b=10
just do a loop over b and keep adding a
>>57323683
>>57323661
This doesn't seem that unreasonable.
>>57323661
What's wrong with that? Should it just return true / false? Maybe it uses the string it returns?
>>57320538
Hahahahhaha
I have no fucking idea what is going on in this thread
>>57322016
what the shit is the purpose of doing that?
>>57323761
Making the code less readable and harder to maintain?
>>57322016
>there may be unknown bugs caused due to this
I fucking hate this shit so much.
>coworkers writes some shit
>tells me to pull
>"It's not tested though :^)"
>>57323513
I mostly agree, but 2nd version is better if it's lazily evaluated (is it? Haven't really done php7). Memory usage should be kept down.
>>57322119
I did similar things, it can be a lot faster.
>>57323734
>What's wrong with that?
needlessly long I assume.
just split the string, grab the info you need from it and then return it
>>57322048
I have done this once or twice when rushing through an implementation. It just reads better, I always optimize later.
>>57323818
>what is cyclomatic complexity?
>>57323832
If hardcoding is faster depends on the complexity of the alternative. Compiler side optimization will get rid of that monster pretty fast.
boolean isOdd(int n){
boolean[] arr = new boolean[n];
arr[0] = false;
for(int i = 1;i<n+1;i++){
arr[i] = (arr[i-1]) ? false :
}
return(arr[n]);
}
scrot '%Y-%m-%d_$wx$h.png' -e 'mv $f ~/shots/'
From scrots manpage. Not sure if just a bad example or really retarded.
>>57321552
Try using it to calculate 11*11
Not a very good function if it throws an error instead of answering with 121
>>57324353
is this bait?
>>57323725
What's the problem here?
>>57324628
its a loop typed out
>>57324735
You mean "unrolled-loop".
And unless there was an actual comment that the compiler/interpreter wouldn't unroll it, I'd say that this was premature optimization, and therefore completely bogus.