[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 / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vip /vp / vr / w / wg / wsg / wsr / x / y ] [Search | Home]
4Archive logo
/dpt/ - Daily Programming Thread
If images are not shown try to refresh the page. If you like this website, please disable any AdBlock software!

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

Thread replies: 323
Thread images: 40
File: trig.gif (3 MB, 961x491) Image search: [iqdb] [SauceNao] [Google]
trig.gif
3 MB, 961x491
tornado remembrance edition
>>
>>52351785
IT WASN'T EVEN ON THE TENTH PAGE

MODS
>>52346599
>>
Did you add some sleep functions there?
Why is your tornado so fucking slow?
>>
File: xdress.png (1 MB, 1702x2471) Image search: [iqdb] [SauceNao] [Google]
xdress.png
1 MB, 1702x2471
>>>52351782
How is Rust associated with SJWs?
>>
F# is a meme.
>>
>>52351821
because of sleep
>>
>>52351822
It's made by Mozilla
>>
>>52351827

What about OCaml?
>>
>>52351844
Genuinely good.
>>
>>52351844
It's legit. It's a fantastic language.
>>
File: Capture2.png (25 KB, 329x305) Image search: [iqdb] [SauceNao] [Google]
Capture2.png
25 KB, 329x305
still looking for a solution for proportional typeface

made some sight progress
def aproxWidth(st):
size = 0
for s in st:
if s in 'lij|\' ': size += 37
elif s in '![]fI.,:;/\\t': size += 50
elif s in '`-(){}r"': size += 60
elif s in '*^zcsJkvxy': size += 85
elif s in 'aebdhnopqug#$L+<>=?_~FZT' + string.digits: size += 95
elif s in 'BSPEAKVXY&UwNRCHD': size += 112
elif s in 'QGOMm%W@': size += 135
else: size += 50
return size * 6 / 1000.0
>>
>>52351844
obviously

how do you even have to ask that question
>>
Where does this "you need to know advanced math to understand SICP" meme come from?

It's high school math at most.
>>
>>52351822
CoC
>if you say anything non-SJW in any social media, no matter how removed from the project, you are no longer allowed to participate in any rust community
>>
>>52351844
The memest
>>
>>52351785
You should make it turn at random times to make it look like it's alive.
>>
>>52351865
The problems are kind of hard and require you to think.
Retarded people just associate problem solving with math.
They can then claim that they are just bad at math and not actually retarded.
>>
>>52351865
They're probably talking about discrete math

If you've already been programming for a while, it's mostly the same skill set
>>
File: 1451553795827.jpg (21 KB, 500x500) Image search: [iqdb] [SauceNao] [Google]
1451553795827.jpg
21 KB, 500x500
>>52351865
>>52351908

>programming is not math
>>
File: SICP.jpg (194 KB, 931x1398) Image search: [iqdb] [SauceNao] [Google]
SICP.jpg
194 KB, 931x1398
About to delve into pic related.

What should I expect?
>>
>>52351924
Programming is never, has never been and will never be math. Get butthurt, pajeesh.
>>
>>52351934
To achieve satori.
>>
>>52351934
math on a higher level than the triple integral
>>
>>52351924
Technically it's not math

Though you're fucking retarded if you're not using math when programming.
>>
>>52351785
Sauce!
>>
>>52351965
You are genuine idiot.
>>
>>52352048
What math do you need to write unit tests, pajeet?
>>
>>52351858
so you're looking to do what, exactly?

make ascii art in variable width fonts for meme spewing?
>>
I would think Ranjeep would be the one saying programming isn't math, not the other way around
>>
>>52352087
DEDICATED
>>
File: 1452407561369.jpg (380 KB, 980x1196) Image search: [iqdb] [SauceNao] [Google]
1452407561369.jpg
380 KB, 980x1196
>>52351934
Don't fall for the meme, anon.

A book that compares programming to wizardry belongs in the bin.
>>
>>52352100
precisely
>>
>>52352107
GRAPHICS
>>
>>52352078
think it's python m8
>>
>>52352122
STREET
>>
>>52352122

I'D JUST LIKE TO INTERJECT FOR A MOMENT...
>>
what are you nerds arguing about

math and programming are two separate things. you can use them together, and often do, but they are not one in the same.
>>
>>52352142
OF
>>
>>52352114
>bin
What the fuck is a bin?
>>
>sicp exercises
I'm never going to be a good programmer
>>
>>52352220
maybe watching the lectures could help, they're widely available on youtube
>>
>>52352191
short binary/binaries
>>
>>52352248
>my attention span
I'm never going to be a good programmer
>>
>>52352191
jog on yank
>>
>>52352191
fuck off you fat cunt
>>
>>52352191
FOY
>>
>>52352146
>this queer
pick up a book will ya
>>
>>52352191
FOY
>>
>>52352191
a place to chuck big fat yank bastards
>>
>>52352078
tornado text + sine wave offset
>>
>>52351827
>>52351717
>>
>>52352191
mv ./structure_and_interpretation_of_computer_programs /bin/
>>
>>52352191
u pullin me leg ther chum?
>>
>>52352191
- /bin, a common Unix directory
- bin(), a function in Python that converts an integer into a binary number
- .bin, a filename extension for binary files
- .bin, a CD disk image file format
>>
>>52351827
E flat > F sharp
>>
>>52352191
u 'avin a giggle m8?
'aven't u heard of a bin lorry?
>>
>>52352395
u fuhgo' the bin wer we chuk fat yank basterds amirite lads?
>>
>>52352407
Sharps >>>>>>>>>>>>>>>>>>>> flats
>>
This is the author of Cracking the Coding Interview

She's pretty qt
>>
>>52352444
I'd crack her code

if you guys understand where I'm getting at
>>
void cleanup()
{
free_memory_used_by(things);
free_memory_used_by(window);
}

int main(int argc, char* argv)
{
...

cleanup();

return 0;
}


Or

int main(int argc, char* argv)
{
...

/* cleanup */
free_memory_used_by(things);
free_memory_used_by(window);

return 0;
}


and why?
>>
>>52352444
N O G F
O
G
F
>>
>>52352474
like bags of memes
>>
File: laughin_anime_girl.gif (134 KB, 340x340) Image search: [iqdb] [SauceNao] [Google]
laughin_anime_girl.gif
134 KB, 340x340
>>52351965
>he doesn't use a type system based directly off of mathematical theories
>>
>>52352435
sharps are for fucking retards

flat master race
>>
ORIGINAL PIRATE MATERIAL
>>
File: 1452437195842.png (643 KB, 1068x1089) Image search: [iqdb] [SauceNao] [Google]
1452437195842.png
643 KB, 1068x1089
>>52352474
I deleted that image, I thought it might have been a bit too lewd for /dpt/.
>>
>>52352459
first

everyone does it that way
>>
>>52352505
I love type theory
data Nat : Type where
Zero : Nat
Succ : Nat -> Nat

double : Nat -> Nat
double Zero = Zero
double (Succ m) = Succ . Succ $ double m


Nat : Type
Nat = (i : Fin 2) & case i of {
0 => Fin 1;
1 => rec Nat
}

double : Nat -> Nat
double = \v0 -> let v0i, v0x = v0 in case v0i of {
0 => 0, case v0x of {0 => 0};
1 => 1, let m = v0x in store (1, store (double (load m)))
}
>>
File: 1451751832808.png (17 KB, 418x359) Image search: [iqdb] [SauceNao] [Google]
1451751832808.png
17 KB, 418x359
>>52352505
>he does
>>
>>52352505
Using a calculator is not programming, despite a calculator being made through programming.
>>
>>52352119
I'd imagine this is doomed from the start, considering the width varies from font to font, so there's no guarantee that your meme spewing will be the same on everybody's computers, especially on /g/ where we're all special snowflakes and so naturally all have different fonts on our web browsers.

Also, correct me if I'm wrong, but I'm under the impression that character width doesn't change uniformly with text size (so a 12 point j and a 16 point j may have a different difference in width than a 12 and 16 point w, for example)

The other issue is a lot of fonts don't work for this, mathematically speaking. For example, if I is three pixels wide, and W is 25 or whatever, and your spacer is 10 pixels wide, there's no way to get I and W to be the same length, as W will always be at least two pixels wider than I with spacers. You might be able to get it to line up pretty well, and there might be a font where it turns out perfect, but I'm pretty sure you can't do it using only one or two spacer characters in times new roman, at least.

The best way I can think of to attempt it in python is using dictionaries, at least that way you can loop.
>>
File: memeguy.png (96 KB, 262x259) Image search: [iqdb] [SauceNao] [Google]
memeguy.png
96 KB, 262x259
>spent time programming the past 4 years of hs instead of studying
>somewhat fucked up my grades the past 2 years
>3 days left to apply for college
>personal statement neither started nor promising, referee still not replied
>will probably get rejected by everyone anyway
I'm applying for an engi degree mildly related to programming(mainly cfd) but which is of main interest to me
If I fail I assume that road is shut and closed for me, so only remaining thing going on for me is programming, but I want to avoid CS like the plague
is it possible, without a cs degree, but with a say portfolio, to get anywhere interesting like for example in systems programming
all I want is to avoid the youth circle jerks and super corporate/business/entrepreneurial/startup oriented bullshit
or should I bite the bullet and go with CS if I fail my main target

thx for reading my blog
I've always appreciated your support dpt
>>
File: 1452369306056.jpg (33 KB, 600x564) Image search: [iqdb] [SauceNao] [Google]
1452369306056.jpg
33 KB, 600x564
>>52352532
I swear to fucking god, anon. If you frog post once more.
>>
>>52352459
int main(int argc, char* argv)
{
atexit(cleanup);
...
return 0;
}
>>
>>52352544
i was thinking let the user set the font. maybe if i use some text to image thing that supports most fonts i could calculate the width of characters depending on font
>>
>>52352541
if the calculator involved both writing proofs and writing code then it would be math and programming
>>
>>52352530
Of course, the bottom can be optimized a fair bit right off the bat
double = \v0 => let v0i, v0x = v0 in case v0i of {
0 => 0, v0x;
1 => 1, store (1, mutate double v0x)
}
>>
File: 1451754656606.png (17 KB, 418x359) Image search: [iqdb] [SauceNao] [Google]
1451754656606.png
17 KB, 418x359
>>52352551
>>
>>52351785
now do it with c++
>>
>>52352577
GNO.
>>
File: 1452413066290.png (139 KB, 400x398) Image search: [iqdb] [SauceNao] [Google]
1452413066290.png
139 KB, 400x398
>he says JavaScript is shit but he has never used it
>>
>>52352577
>both writing proofs and writing code
Same thing innit
>>
>>52352594
now do it with x86

>am i fitting in yet
>>
>>52352547
this something I've concentrated on for the past 7 months: https://github.com/cogloch/Flysmith
am I worthy of anything or should I just kill myself?
>>
>>52352598
>he says javascript is good
L O L
O O !
L ! L
>>
Any chance someone could have me would my Xcode problem?
http://stackoverflow.com/questions/34499600/how-do-i-get-a-function-class-definition-from-a-cpp-by-including-its-correspond/34709943#34709943
>>
Why hasn't /g/ written an Introductory programming book yet?
>>
>>52352580
>>52352530
is your language going to require the { ; } anywhere or is that just a stylistic choice to distinguish different parts of the language?
>>
>>52352618
get a better readme
>>
>>52352594
How is that any harder?
>>
File: 1452351060385.jpg (36 KB, 500x211) Image search: [iqdb] [SauceNao] [Google]
1452351060385.jpg
36 KB, 500x211
Well, I think I've learnt enough JS for now.

What language should I move onto next?

I was thinking PHP.
>>
>>52352641
I'm too smart for that
>>
>>52352646
Like Haskell or Agda or anything similar, you can use it to escape significant whitespace.

I prefer to use it all the time when writing intermediate code out, dunno why.
>>
>>52352598
>he says cancer is shit but he has never had it
>>
>>52352547
Good caricature, I like it. Saved.
>>
>>52352641
We'd be too busy arguing what language would be best
>>
>>52352692
>introductory
python would be best
>inb4 bad practices
>>
>>52352660
fuck's sake just make it consistent

have semicolons or don't have them
>>
File: 1452448056047.png (924 KB, 1241x1754) Image search: [iqdb] [SauceNao] [Google]
1452448056047.png
924 KB, 1241x1754
Press F12, go to console and paste this in:

document.querySelector("form").childNodes[2].value


Post results.
>>
>>52352576
You still run into the issue of there being no solution for
a+c*n_1 = b+c*n_2
where a is the width of character 1, b is the width of character 2 and c is the width of your spacer

for a lot of characters. I mean you could manually edit this, but that's kinda cheating.
>>
>>52352630
Shit, i meant this:
http://stackoverflow.com/questions/34709920/how-do-i-link-cpp-files-to-hpp-files-in-xcode-that-were-made-outside-of-the-pr
>>
>>52352712
I don't see any reason to, and this method seems to be pretty tried-and-true.
case x of
0 => foo
1 => bar

and
case x of {
0 => foo;
1 => bar
}

are entirely equivalent, but the second could be written like
case x of {0 => foo; 1 => bar}

or any other way you like.

It's a nice compromise.
>>
>>52352662
apples and oranges anon

Pick a language you know and love. 10 different anons will shit on it or praise it for their own reasons. Doesn't mean shit, just try it and form your own opinion.
>>
how do i fizzbuzz in c++?
>>
>>52352736
yeah i get what you mean, nobody wants to do this by hand
>>
>>52352728
Not suspicious at all.
>>
>>52352758
no idea chum, but here's brainfuck:
 >++++++++++[<++++++++++>-]<[>+>[-]>++++++++++[<++++++++++>-]<+<<[->>->+<<<]>>>
[-<<<+>>>]<>>+++<<[->+>-[>+>>]>[+[-<+>]>+>>]<<<<<<]>[-<+>]+>[-]>[<<->>[-]]>[-]
<<<[[-]++++++++++[>++++++++++<-]>++.+++.[-]<[-]+++++++++++[>+++++++++++<-]>+..
[-]<[-]<<[-]>>]<>>+++++<<[->+>-[>+>>]>[+[-<+>]>+>>]<<<<<<]>[-<+>]+>[-]>[<<->>[
-]]>[-]<<<[[-]+++++++++[>+++++++++++<-]>-.[-]<[-]+++++++++[>+++++++++++++<-]>.
+++++..[-]<[-]<<[-]>>]<<[[-]>>++++++++++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]>>[
>++++++++[<++++++>-]<.[-]]<>++++++++[<++++++>-]<.[-]<<<]>[-]++++++++++.[-]<[-]
<-]
>>
>>52352758
modulo
>>
>>52352754
javascript, php and python are objectively shit. countless experts agree.
>>
>>52352782
example pls
>>
>>52352799
int main() {
cout << "fizzbuzz";
}
>>
>>52352787
Try them and form your own opinion.

Or do you trust the experts who say that c and java are shit too?
>>
Hey guys, i suck at c. How do i convert a decimal number to binary using arrays?
>>
>>52352728
_bTmhn4gy9TMNgBLUikcY2RfJOyFjGA65

wtf is this
>>
>>52352787
lmao countless experts say c is shit
>>
>>52352831
ur fucked lmao
>>
>>52352830
switch to c++
>>52352799
if (array[i] % 3 == 0)
{cout << "Fizz";}
>>
>>52352833
>lmao countless experts say c is shit
>experts
>>
>>52352831
kek you're fucked
>>
>>52352517
Flat are for singers
Singers are often musically meh
>>
>>52352799
#include <iostream>

int main()
{
for(int i = 1; i <= 100; ++i) {
if(i & 3 == 0 && i % 5 == 0) {
std::cout << "fizzbuzz";
}
else if(i % 3 == 0) {
std::cout << "fizz";
}
else if(i % 5 == 0) {
std::cout << "buzz";
}
else {
std::cout << i;
}

std::cout << std::endl;
}
}
>>
>>52352831
you fell for it retard
>>
>>52352868
JC would never approve of something so verbose
>>
>>52352728
post password?
>>
File: file.png (29 KB, 677x342) Image search: [iqdb] [SauceNao] [Google]
file.png
29 KB, 677x342
Anyone have any clue what i'm fucking up on? It's not giving me a .exe file. I'm using w7 and minGW.
>>
>>52352868
ow the edge

    for(int i=1; i<101; i++){
if (i%3!=0 and i%5!=0) cout << i;
if(i%3==0) cout << "Fizz";
if (i%5==0) cout << "Buzz";
cout << '\n';
}
>>
>>52352878
kill yourself

it's not even verbose retard kill yourself
>>
>>52352758
You can't, it's impossible.
>>
>>52352831
document.querySelector("form").childNodes[2]

<input type="hidden" name="pwd" id="postPassword" value="kek">
>>
>>52352692
Nah, we already decided that's OCaml.
>>
>>52352864
uu wwoott
>>
>>52352894
>and
>>
>>52352773
I didn't mean do it by hand, I meant use an edited font file that is "times new roman, but not really" so that you can have nice character widths for your spacer character. but at that point you might as well just download a monospace version of your font.

I know there are a lot of monospace versions of fonts out there, for example I use a monospace comic sans for IDLE
>>
Tried to feel the difference between folds and
 foldl (+) 0 [1..]
almost blew my system up. I really thought there would be a limit like there is for foldr...
>>
>>52352851
>>52352858
>>52352876
It doesn't even let me delete his post, it says password incorrect.

I'm using his password now:

_bTmhn4gy9TMNgBLUikcY2RfJOyFjGA65

Someone see if they can delete my post.
>>
>>52352901
>it's not even verbose
lmao c++ cucks believe this
>>
>>52352749
OCaml doesn't have significant whitespace and yet doesn't have that issue.
>>
>>52352916
and works faggot
>>
File: hax.png (8 KB, 734x72) Image search: [iqdb] [SauceNao] [Google]
hax.png
8 KB, 734x72
am i hax yet?
>>
>>52352923
you got trolled m8
>>
>>52352089
assertEqual(1, 2)
>>
>>52352894
>>>52352868
looks a lot better

i bet you think python looks good because it isn't as """"""""verbose"""""""" lmfao kill yourself
>>
>>52352923
u got double crossed lmao
>>
>>52352547
my experience is not going to be encouraging. I've been programming since I was 12 so I have a lot of experience and I took my a levels early so I had what I thought was a decent CV.

Unfortunately no matter how many places I sent it off to I didn't get any response so I applied for uni. Since starting uni I've had an internship and a part time job programming.
>>
>>52352926
punctuation, whitespace, namespace specifiers, proper for loop syntax isn't verbose you fucking shitkid

it's like you think a comic book is better than a textbook because it isn't as verbose
>>
File: w398fav.gif (2 MB, 333x194) Image search: [iqdb] [SauceNao] [Google]
w398fav.gif
2 MB, 333x194
>>52352087
Holy shit
>>
>>52352963
>he thinks I was considering those
lmao it's still verbose
>>
>>52352972
no it isn't it's a standard fucking fizzbuzz

one in python would look similar
>>
>>52352928
many structures which are used in Haskell-like languages require significant whitespace, and it can help clean up syntax in some places. things like the do syntax are gonna have it anyways unless you want to write out huge ugly blocks of code everywhere, so there's no reason not to include it in other parts of the language.
>>
>>52352928
I'm not really a fan of how ML does their syntax. There's no compromise there -- sure, whitespace isn't significant, but you have to have the boilerplate symbols all the time.
>>
>>52352985
It's standard if you are a babby

and in python, the following works
for i in range(1, 101): print "FizzBuzz"[i*i%3*4:8--i**4%5] or i
>>
>>52352929
Anon is right ... "and" does actually work. I never knew.
>>
>>52352551
>>52352583
Shit, this shouldn't have made me laugh so hard
>>
>>52353008
fucking retard kill yourself

no one wants obfuscated code in a real program

it's not even as efficient that the standard fizzbuzz and it's all in one long ass line

you'd fail the interview with that fizzbuzz
>>
>>52353018
Whoops, I meant "password" without the fullstop.
>>
File: 1451779320598.png (20 KB, 418x359) Image search: [iqdb] [SauceNao] [Google]
1451779320598.png
20 KB, 418x359
>>52353037
>that
>obfuscated
>me
>fail interviews
>>
what's a good snack to obscenely munch while programming

off to the shops in a bit and I'm probably going to be up all night
>>
>>52353051
dicks
>>
>>52353051
chicken tendies tbqf
>>
>>52352444
She's a 6/10 milf, so basically 4/10.
>>
>>52353045
>he is this smug about writing "fizzbuzz of the christ"
>>
Working on the sunshine app for Udacity's android course.

How do i go about having a separate class that provides the user current location using Google play services. That way I can call it from the fragment's async task like LocationService.getUserCurrentLocation()

Can't seem to figure it out since I need to pass the context in order to configure the googleapiclient and passing the activity's context and trying to cast it from the service throws me an exception.
>>
>>52353018
I don't see a password cookie to edit.
>>
File: 1452270251666.png (141 KB, 439x290) Image search: [iqdb] [SauceNao] [Google]
1452270251666.png
141 KB, 439x290
>>52353080
>he isn't
>>
>>52353076
STILL BEATS NOGF ;_;

;_;
>>
>>52352758
see>>52352894
>>
>>52353051
bbq chips
>>
>>52352831
I got
_vXjniGgeRB1StArDZSb8jKekd5m81ijV
>>
>>52352929
it's deprecated shit that doesn't belong in code written in 2016
>>
>>52353151
>Error: Password incorrect.
>>
>>52353051
usually i go with some kind of potato chips but then my fingers get greasy so i need to be able to wipe them off every time i type some shit. i also like flaming hot cheetos but then my fingers get gross as fuck and i just start typing with one hand and eating with the other
>>
>>52353051

chopped pineapple
>>
>>52352888
pls respond i've been working on this for almost 2 days now
>>
>>52353172
trolololo
>>
>>52353051
>>52353179
don't eat any kind of messy shit at the computer it's disgusting

go and eat and then come back

regular food eaten with utensils is fine at the computer
>>
>>52352926
That ain't really verbose doe. Verbose is like pic related.
>>
>>52353179
>>52353149
crisps are out of the question. can't handle grease on my keyboard.

I'm thinking chocolate peanuts would go down a treat especially since I drink a lot of coffee

>>52353182
that's not a thing

>>52353065
that's a gimmick
>>
>>52352888
don't you need to specify more parameters?
>>
>>52353091
Either you're fucking with me or that actually worked.
>>
>>52353201
Post your genuine password, anon. I just want to see if it's possible for me to delete your post.

All I can do with it is delete your posts.
>>
>>52353208
it's verbose for a fizzbuzz in c++
>>
>>52353198
check your user directory, it's probably putting the output there
>>
>>52353204
>eaten with utensils
then you fucking drop crumbs into the keyboard dumbass
>>52353211
one time i had some chocolate peanuts and i was snacking on them while working on something and it ended up being a few hours so i ate like 100 or so and then i had diarrhea for the rest of the week. idk if it's just me but i can't eat a lot of peanuts without that happening i guess
>>
>>52353234
no it isn't, it's completely standard

just because you compact the formatting and fuck up the readability like it >>52352894 doesn't make it better
>>
>>52353091
Kek, you actually did it, anon.

The passwords aren't a meme after all.
>>
>>52352922
foldr and foldl basically apply the + operator from different directions.
foldr will be from the right while foldl will be from the left.
foldr
1 + (2 + (3 + (... + 0)))


foldl
(0 + 1) + 2) + 3) + ...)
>>
File: maxresdefault.jpg (102 KB, 1280x720) Image search: [iqdb] [SauceNao] [Google]
maxresdefault.jpg
102 KB, 1280x720
>>52353234
Well, that is true. I just googled fizzbuzz c++ and pic related.
>>
>>52353271
your idea of a standard is the inefficient entry-level implementation

I didn't compact the code, I'm guessing that's why you were coming at me with the whitespace, etc post before
>>
>>52353251
nah, I can eat what I want without problems. I habitually eat so little during the day that anything I snack on is digested without a problem.
>>
>>52353251
>then you fucking drop crumbs into the keyboard dumbass
no you have the plate on the desk and your keyboard placed further into the desk

what kind of food do you eat anyway that drops crumbs when you eat it
>>
>>52352728
> document.querySelector("form").childNodes[2]
<input type="hidden" name="pwd" id="postPassword">

Totally not at all suspicious ...
>>
>>52351924
faggot CRUD monkeys can make a website with 0 knowledge now.
>>
>>52353298
you're late
>>
File: file.png (34 KB, 677x342) Image search: [iqdb] [SauceNao] [Google]
file.png
34 KB, 677x342
>>52353222
Not really, I can do this to change the filename of the exe from a to test though.

>>52353237
Holy crap you're right i'm a fucking dumbass. Thanks a bunch. Now i'm back to the problem I had yesterday. If I run the .exe it doesn't bring up a console, but it does open a process in my task manager that is open in SYSTEM so I can't stop it. Any idea what's wrong?

I did everything i've done on this (my main pc) on a another pc I have around and everything worked, so I don't know what is different on this pc to cause this.
>>
>>52353298
It's just for fun. All I can do with it is delete your recent posts.
>>
>>52353271
I bet you write comments every other line.
>>
>>52353289
kill yourself

you should always use braces and newlines

and yours isn't more efficient because you print twice on "FizzBuzz" (I/O is by far the heaviest operation)

if you cared about efficiency you'd bake the newlines like "Fizz\n"

fuck's sake
>>
>>52353304
sorry, is there a problem with CRUD interfaces? Even for desktop applications it makes sense.
>>
>>52353266
>Password Incorrect
smdh
>>
File: mount stupid.jpg (23 KB, 600x338) Image search: [iqdb] [SauceNao] [Google]
mount stupid.jpg
23 KB, 600x338
>>52353331
kill yourself newfag

you don't know what you're talking about
>>
>>52353324
try adding a
system ("PAUSE");

before you return statement in the main function
>>
>>52353337
>and yours isn't more efficient because you print twice on "FizzBuzz" (I/O is by far the heaviest operation)
Wow you are retarded

>you should always use braces and newlines
Didn't deny that, I criticized your implementation
>>
>>52351827
D-F#-C => D-G-B
>>
>>52353366
k tard

it's 100% the standard fizzbuzz
>>
>>52353285
Yeah, from that it makes sense, but everyone seems to recommend using foldr which is counter-intuitive. Still trying to get used to the laziness I guess.
>>
["fizzbuzz" if x%15==0 else "fizz" if x%3==0 else "buzz" if x%5==0 else x for x in range(1,101)]


How do I run the print function on every element in a nice one-line fashion?
>>
File: 62407182.jpg (115 KB, 400x400) Image search: [iqdb] [SauceNao] [Google]
62407182.jpg
115 KB, 400x400
>>52353355
Being this much buttmad you start attacking trolls.
>>
>>52353350
Opened incognito window and ran that code
got
>"_urLNxDpurToZkyHOjCbf6u5DRlIvsm7v"
Then tried to delete the "_3ms 7vpTaeD RuvhJ XE1fuevjve5 sz45W2" post and it worked
I don't know what that code is but it doesn't seem to be related to post deleting
>>
>>52352191
It's like you're not even Anglo master race.
>>
>>52353399
one liners aren't cool outside of code golfing
>>
>>52353381
>D-F#-C
I like me some diminished sevenths
>>
>>52353389
I'm sorry about your inability to read. Like I said, I didn't compact your post. I didn't deny the standard, just said it's the entry-level implementation. No need to be so rustled about being entry-level
>>
File: file.png (15 KB, 428x236) Image search: [iqdb] [SauceNao] [Google]
file.png
15 KB, 428x236
>>52353365
Didn't change anything. However I did notice that it still appears to be loading (when I bring up my user folder my mouse icon changes to the loading icon).

This is the code after adding the system("pause");
Maybe I fucked up here? I'm really new to this.
>>
File: LOL-I-TROLL-YOU.png (87 KB, 755x1255) Image search: [iqdb] [SauceNao] [Google]
LOL-I-TROLL-YOU.png
87 KB, 755x1255
>>52353417
epic

what a great use of your time
>>
>>52353399
print " ".join([...])
>>
>>52352868
If you put the elses on the same lines as the closing braces, it would look a bit better.
>>
>>52352459
#define cleanup() free_memory_used_by(things); free_memory_used_by(window)

int main(int argc, char *argv[])
{
...

cleanup();

return 0;
}
>>
>>52352888
it will place it in a file named a.out or a.exe
you can specify a name with -o
g++ desktop\test.cpp -o desktop\IAMAFAGGOT.EXE
>>
>>52353459
thank you anon
>>
>>52353431
it's not "entry-level", it's a perfectly sensible implementation. it's fucking smug newfags that think they're so clever for writing shit like "fizzbuzz of the christ" which is not better whatsoever.
>>
>>52353474
Yeah it's sensible, but it's still entry-level.
>>
>>52352598
I'm a girl
>>
HEY GUYS, I SUCK, HOW DO I CHECK IF THERE ARE ELEMENTS WITH THE SAME VALUE BETWEEN 2 ARRAYS IN C?
>>
>>52353462
i like having a bit of fresh air

this isn't python you can afford to have some whitespace

a lot of people use the "cuddled else" like you suggest but having the else on the next line is also a valid style
>>
>>52352913
There is a significant trend in western music of XVII, XVIII and XIX century to write vocal music in tonalities (does this word exist?) with a lot of flat notes (sorry I don't know the exact English terminology), and it happens that most of the singers I meet are musically mediocre. Hence my post.
>>
>>52352987
It is better to have extra syntax in exceptional situations (effect-full computations in a functional language) than to have it everywhere.
There is no need for the symbols outside effect-full computations in an ML language as shown by the likes of OCaml.

>>52352991
Best syntax is lisp syntax. It's 100% consistent everywhere, trivially parseable, and infinitely malleable.
>>
>>52353421
It is, the way they have it set up on the backend, I think, is like this:

First it checks your IP, if your IP matches, it deletes your post, if the IP doesn't match it checks your post password.

An anon deleted my post before.

I've set my password to "password" if someone wants to test again.
>>
>>52353481
go ahead and show us your turing award-winning best-selling expert-grade enterprise fizzbuzz
>>
>>52353504
nested loops
>>
>>52353520
>100%
What about special forms?
>>
File: IMAG0284.jpg (1 MB, 1520x2688) Image search: [iqdb] [SauceNao] [Google]
IMAG0284.jpg
1 MB, 1520x2688
>>52353458
Ur still a goober
>>
>>52353504
size_t i, j;
for (i = 0; i < len_a; ++i)
for (j = 0; j < len_b; ++j)
if (a[i] == b[j])
/* do something */
>>
>>52353547
i'm right in the middle of your shit so what the fuck? nice outfit goober
>>
>>52353538
Special forms are completely consistent, but macros can introduce inconsistencies, it's true. For instance, the meaning of (for x from 0 to 10 do (1+ x)) differs from using unquoted symbols that aren't bound and which value doesn't matter while the name does.
>>
>>52353507
wot? you can have whitespace in python too

but I agree with him, it looks nicer cuddled
>>
>>52353574
python shitters usually write horrible looking code with minimal whitespace
>>
>>52353527
do your own homework lmao
>>
>>52353395
> everyone seems to recommend using foldr which is counter-intuitive.
foldr is only strict if the function itself is strict, so you can use foldr on infinite lists. Also, if you only end up using part of the result, it will only evaluate as much as it needs to.

Also, foldl and foldr produce different results if the function isn't commutative.
>>
>>52352894
>i%3!=0 and i%5!=0
 i%3 + i%5 != 0
>>
>>52353593
kill yourself retard

>here is a perfectly sensible fizzbuzz
>it's entry-level. goml
>let's see you do better
>do your own homework lmao
>>
>>52353592
that has nothing to do with python, and more to do with user tendencies across any language. If you base it off /dpt/ where we like trying to write short code so it fits better on a screen, off course you're going to see it more
>>
>>52353570
Thank you goober, I just came out of the shower.
>>
>>52353618
is it still december in here?
>>
>>52353620
seriously, do your own homework. Don't use "sensible" as some defense against the original claim about it being verbose since the 2 aren't related
>>
File: 3a0.gif (522 KB, 200x200) Image search: [iqdb] [SauceNao] [Google]
3a0.gif
522 KB, 200x200
>>52353618
>exact same results
>>
>>52353599
> so you can use foldr on infinite lists.
If foldr folds from the right, how does it reach the "end" of an infinite list to start the fold? That's one thing that was really bothering me.
>>
>>52353641
kill

you're

self
>>
>>52353599
What about foldl'?
>>
>>52353464
Is this a troll? Because I seriously hope no-one is dumb enough to do that in real code.

First rule of macros: don't use macros unless you absolutely positively definitely have no alternative.
>>
>>52353658
rustled as fuck lmao
>>
>>52353520
nested matches don't work out to well. but the bigger thing is that there's no way to do things like inline type annotations in OCaml's syntax. i tried to think up some ways to do it for my own language (although i still have barely even started on it) and the best i could come up with was:
val f : Int -> Int where
let f = (+) 1

but it's still a lot more verbose than using significant whitespace.
and while i do like Lisp syntax for a lot of things, i don't think it fits everywhere. trying to fit the semantics of a strongly typed language into it comfortably is difficult on its own, but a big language like Haskell is just too much work
>>
File: 1452367796069.png (1 MB, 1831x1337) Image search: [iqdb] [SauceNao] [Google]
1452367796069.png
1 MB, 1831x1337
Press F12, go to console, paste this in:
String.prototype.reverse = function() {
var val = "";

for(var i = 1; i <= this.length; i++) {
val += this[this.length - i];
}

return val;
};

var star = function(str) {
var val = "\n";

if(str.length <= 2) {
throw "MemeError: The string length of \"" + str + "\" is too small, you retard.";
}

for(var i = 0; i < str.length - 1; i++){
val += (" ".repeat(i) + ( str[i] + " ".repeat(str.length - (2 + i)) ).repeat(2) + str[i] + "\n");
}

val += str + str.substring(0, str.length - 1).reverse() + "\n";

for(var i = 2; i <= str.length; i++){
val += (" ".repeat(str.length - i) + ( str[str.length - i] + " ".repeat(i - 2)).repeat(2) + str[str.length - i] + "\n");
}

return val;
}

star(document.querySelector("form").childNodes[2].value);


Post results.
>>
>>52353658
>kill
>you are
>self

Sorry, I had to
>>
File: pretending.jpg (49 KB, 600x1104) Image search: [iqdb] [SauceNao] [Google]
pretending.jpg
49 KB, 600x1104
>>52353668
>>
How to quit a python script:
1 / 0
That's the most evil trick I know, but I like it.
>>
>>52353427
That's a dominant seventh though. There's no A language, so it's missing a fifth. There's A#, but that would be dissonant.
>>
>>52353648
computationally cheaper
>>
>>52353672
nice one
>>
>>52353663
It wouldn't work in the code you replied to

It checks if neither the number mod 3 or 5 is 0, checking it against 15 will print 3 or 10 for example
>>
>>52353677
it's a meme you dip

>>52353663
keeping it as i%3 and i%5 can be more efficient since the compiler won't have to do i%15. not that efficiency matters in fizzbuzz. i%3 and i%5 also expresses intent more clearly and lends itself to being expanded to other numbers than 3 and 5
>>
>>52353667
Better than passing things and window as an argument. Lexical scoping yo.
>>
>>52353678
you are too angry about your inability to argue lad, calm down
>>
>>52353687
even if it were it wouldn't matter and the compiler can optimize it anyway
>>
>>52353685
It causes an ugly error message though. Try:

import sys

try:
x=1/0
except ZeroDivisionError:
sys.exit(0)
>>
>>52353687
It now takes 0.001ms instead of 0.0013ms
>>
>>52353720
>inability to argue
you're the one who claims it's verbose and you haven't posted any argument except a retarded "fizzbuzz of the christ" and a shitty code example that thinks it's being clever for disregarding code style guidelines

and it's obviously not my homework ffs
>>
>>52353710
>not that efficiency matters in fizzbuzz
efficiency matters as a general programming idiom to follow, no matter how simple the task. Good practices > Bad practices
>>
>>52353734
import sys

try:
raise Exception
except Exception:
sys.exit(0)
>>
File: 1452422571428.jpg (112 KB, 1280x720) Image search: [iqdb] [SauceNao] [Google]
1452422571428.jpg
112 KB, 1280x720
Press F12, go to console, paste this in:

var triangle = function(str, n) {
var val = "\n";

if(n === undefined) {
n = str.length;
}

for(var i = 1; i <= n; i++){
val += " ".repeat(n-i) + str.repeat(i * 2 - 1).substring(0, i * 2 - 1) + "\n";
}

return val;
}

triangle(document.querySelector("form").childNodes[2].value);


Post results.
>>
>>52353747
I'm not the one who spent 90% of the argument using "standard" and "sensible", etc as opposing "verbose" lmao
>>
>>52353554
thx m8
>>
>>52353670
>nested matches don't work out to well
Parentheses, just like any other similar form (f g x -> f (g x))
>there's no way to do things like inline type annotations in OCaml's syntax
What are you talking about?
let fn (x:Int32) (y:Int32) : Int32 = Int32.add x y
>>
>>52353748
you're pissing me off, it better be intentional fucking pisskid

readability is what matters first and foremost, especially for these types of tasks. if you're going to optimize fizzbuzz then use a string buffer or something, don't do fucking micro-optimizations on the single instruction level that don't even do anything to help performance.
>>
>>52353759
noice
now make a dildo
>>
>>52353670
Also,
>trying to fit the semantics of a strongly typed language into it comfortably is difficult on its own
I disagree. See chicken for example.
>>
>>52353779
>string buffers
>optimize
>>
>>52353764
it's not verbose.
>>
>>52353657
> If foldr folds from the right, how does it reach the "end" of an infinite list to start the fold?
It doesn't. For the same reason, it never uses the "initial value" argument.
> take 5 (foldr (:) undefined [1..])
[1,2,3,4,5]


>>52353660
> What about foldl'?
foldl' is just foldl except that it forces eager evaluation of the intermediate results to avoid building up thunks.
foldl (+) 0 [1,2,3]
= foldl (+) (0+1) [2,3]
= foldl (+) ((0+1)+2) [3]
= foldl (+) (((0+1)+2)+3) []
= (((0+1)+2)+3)
= ((1+2)+3)
= (3+3)
= 6

versus
foldl' (+) 0 [1,2,3]
= foldl' (+) 1 [2,3]
= foldl' (+) 3 [3]
= foldl' (+) 6 []
= 6
>>
>>52353779
If the alternative isn't readable, consider actually programming or practicing it more you entry-level cuck
>>
>>52353797
>printing 200 times is more efficient than printing once
>>
>>52353799
It is, compared to other implementations, which is the original argument, unless you want to repeat the argument
>>
print("\n".join(["fizzbuzz" if x%15==0 else "fizz" if x%3==0 else "buzz" if x%5==0 else str(x) for x in range(1,101)]))


How would one do this in Java?
>>
>>52353808
>code should be readable
Are you autistic?
>>
When will haskell have a non-shit AD or SD library?
>>
QUICK, make a lottery program that actually prints the right numbers
one for powerball and another for mega millions
>>
>>52353808
i hope you die in cancer and that your nurse steals your pain medication so you don't get any

what's infuriating is that you can't even see how much of a newfag pisskid you are
>>
>>52353839
Are you? I was arguing against someone saying code should be readable and how the alternative still is
>>
>>52353829
kill yourself
>>
>>52353504
nesting is for figots
#include <stdio.h>
#include <string.h>
#define RSMLR(s1, s2) strlen(s1) < strlen(s2) ? s1 : s2

int main() {
char* string1 = "howdy pardenr!";
char* string2 = "hiddly diddly";
for(int i = 0; i < strlen(RSMLR(string1, string2)); ++i)
if(string1[i] == string2[i])
printf("%d match!\n", i);
return 0;
}
>>
>>52353857
stop being angry chap, you lost, deal with it
>>
>>52353858
I'm not autsitic, I only replied to your reply, I didn't go back until the op to follow your debate.
>>
What's a good introduction to POST methods with python. I have no idea what I'm doing with all the shit I've read. If a POST element has several attributes, what do I pass? All the urllib shit I've read doesn't hold my hand enough
>>
>this thread
>programming101babbies think they're clever for writing fizzbuzz one-liners

https://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect
>>
>>52353878
>until the op
Literally just the post I was replying to that you first quoted
>>
How much of a nightmare would preprocessing a csv file with VBScript be? I need to parse the text of one column in every row to scan for phrases that would determine True/False values of other columns, which the script would also need to create. It also needs to perform minor calculations on numeric data in the table, and create new columns for those return values.

I know I could do it with python or a C# plugin pretty easily, but I'm doing it for my job and getting approval to install new software is a major pain in the ass.
>>
>tfw you could easily make a program that prints out all lotto possibilities and your program will have correctly guessed the lotto numbers but you just don't know which guess was the right one until after the fact
>>
>>52353685
> 1 / 0
That just raises a ZeroDivisionError exception. It will only terminate the script if it isn't caught.

Note that sys.exit() just raises a SystemExit exception, but that's less likely to be caught because it isn't derived from StandardError (if you want to catch "all errors", you're supposed to catch StandardError so that you don't catch e.g. SystemExit or KeyboardInterrupt as well).
>>
>>52353881
here you go anon

http://docs.python-requests.org/en/latest/
>>
>>52353885
>posting wikipedia link
Dunning-Kruger in effect
>>
>>52353885

Wow, you've heard about a well known psychology term! You know so much! So smart!
>>
>>52353885
>thinking they are clever
Where did they call themselves that?
>>
>>52353893
suck my dick, I'm going to sleep, I have wageslave work tomorrow.
>>
I want to hook into a game and provide a simple text overlay with some information about the current track or whatever.

Using C#.

Where should I start?
>>
>>52353921
you're delusional

next you're gonna tell me you're gonna make gaymes in unity/love2d/libgdx/pygame
>>
>>52353941
>>52353941
>>52353941
NEW
>>
>>52353938
In your fave ide.
>>
>>52353924
you're delusional

>>52353930
literally assburger
>>
>>52353939
the fuck are you on about?
>make gaymes
you're on the wrong general
>>
>>52353900
There are sometimes flaws in the distribution of winning numbers. This can be exploited using big data analysis techniques. You can then obtain the posterior likelihood of winning given the same bias is still active. You could run your program over all the lotteries you know about and then choose the one you're most likely to win. Go balls deep and invest the amount of money you're expected to need to win.
>>
>>52353943
Dumbass
>>
File: 2015-06-16-1.jpg (51 KB, 360x384) Image search: [iqdb] [SauceNao] [Google]
2015-06-16-1.jpg
51 KB, 360x384
>>52353909
Thank you anon. Much appreciated
>>
>>52353956
>being so asspained because somebody wrote shorter fizzbuzz than you
You really are a small person.
>>
>>52353956
Well done! So clever! I'm so proud!
>>
>>52353908
I don't catch exception. It's useless.
>>
File: 1358198817347s.jpg (2 KB, 125x116) Image search: [iqdb] [SauceNao] [Google]
1358198817347s.jpg
2 KB, 125x116
>>52353434
ah, to have problems with hello word again
>>
>>52354113
The problem is that I can't get it to run. Running the .exe brings up a process in the task manager, but I don't get a console. Additionally the process is apparently opened in SYSTEM and I can't close it without restarting my computer.
>>
>>52354013
Explain yourself.
>>
>>52354219
They catch him
>>
>>52354219
It was a joke.
>>
>>52352618
I think that that engine isnt a engine
>>
BeOS master race
>>
>>52352594
it's not hard, i did it in c once
pretty easy desu, too bad i lost the code
Thread replies: 323
Thread images: 40
Thread DB ID: 394519



[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 / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vip /vp / vr / w / wg / wsg / wsr / x / y] [Search | Home]

[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 / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vip /vp / vr / w / wg / wsg / wsr / x / y] [Search | 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.
This is a 4chan archive - all of the shown content originated from that site. This means that 4Archive shows their content, archived. If you need information for a Poster - contact them.
If a post contains personal/copyrighted/illegal content, then use the post's [Report] link! If a post is not removed within 24h contact me at [email protected] with the post's information.