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

/dpt/ - Daily Programming Thread: Cool Things Edition

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

Thread replies: 357
Thread images: 32

File: 1865428-revycasualmurder.png (520KB, 853x480px) Image search: [Google]
1865428-revycasualmurder.png
520KB, 853x480px
old thread: >>55706201

if you don't post one of your cool projects then get outta here normie
>>
>normie
Fuck off normalfag, this is our programming town
>>
Spent 40 minutes so far ricing my IDE. Goddamn IntelliJ adding background images
>>
>>55711471
Can anyone tell me what I'm doing wrong? I have no idea what I'm doing. Trying to run python with sublime text while I do a online class for programming just started today. the code should work but I'm doing something off with sublime I think.

I'm out of my depth on getting it to work, google results from various searches seem to bring up more complex things then I'm fucking up. I don't need to download python do i?
>>
>>55711499
Consider renaming your file
>>
>>55711499
did you not read your error log?

Your file is named with ", but it's trying to locate the file without the "
>>
File: 1469192515175.jpg (83KB, 1280x720px) Image search: [Google]
1469192515175.jpg
83KB, 1280x720px
What's a nice programming meme book that I can photoshop in here?

It has to be thin, no dumbass low-effort shoops where SICP is magazine sized.
>>
>>55711542
Javascript: The Good Parts
>>
>>55711494
Post pictures
>>
File: double spacing.jpg (103KB, 1024x576px) Image search: [Google]
double spacing.jpg
103KB, 1024x576px
>>55711542
>>
>>55711542

The mythical man month is pretty thin.
>>
File: hvEnMpK.png (276KB, 694x732px) Image search: [Google]
hvEnMpK.png
276KB, 694x732px
>>55711542
this http://lwn.net/Kernel/LDD3/
>>
>>55711471
You shit munching smegma eating ding dongs are such losers. Do something more productive other than programming like getting laid.
>>
File: 1469219381578.jpg (507KB, 1620x2160px) Image search: [Google]
1469219381578.jpg
507KB, 1620x2160px
>>55711557
>>
>>55711610
>first post is incredibly shrunk
>>integers don't start at 0 (correct)

What were you trying to achieve here?
>>
>>55711494
Am I the only one who thinks IntelliJ is a bloatware tier shit software?

There are good devs behind it but it feels cluttered as fuck.
>>
File: 2016-07-23-065611_1366x768_scrot.png (777KB, 1366x768px) Image search: [Google]
2016-07-23-065611_1366x768_scrot.png
777KB, 1366x768px
>>55711557
>>55711619
Goddammit, wrong pic
>>
>>55711621
you're saying base 10 doesn't start at 0 you fucking moron?
>>
>>55711628
I can't really think of any way it could be considered bloat. tbf I use PyCharm for work, and we use almost every feature, from git integration to ssh to vagrant to database integration, etc, so I feel used to it for my personal work

It's bloated for toy scripts, but if you still do those, you're probably still a beginner who should be using Sublime anyway
>>
>>55711647
>what are negative numbers
>>
>>55711632
Jesus fuck that looks bad. Why would you ever have a background picture on your editor like that ?
Are you allergic to readability ?
>>
>>55711632

Postedd a random saved creepshot.. That somehow is in the same folder as screenshots?

The transparency would give me a headache real fast. The dark purple is also incredibly hard to read.
>>
File: screenFetch-2016-07-22_22-00-28.png (1MB, 1366x768px) Image search: [Google]
screenFetch-2016-07-22_22-00-28.png
1MB, 1366x768px
>>55711662
I'm just toying with it fampai

>>55711667
Yeah I keep temp shit on my desktop, was supposed to post the girl pic on /fit/
>>
>>55711699
>>55711632
tacky as fuck

Python """programmers""" are cancer
>>
>>55711699
This isn't much better.
>>
>>55711661
If we started at 0x1 then the first number in computers would be 0001. That would be fucking retarded.
>>
>>55711699
I imagine this is how ulillillia has his IDE set up
>>
>>55711709
>toying with it
Read fampai. I'm not going to use it
>>
>>55711713
numbers start at 10000000
>>
>>55711699
>dat username and password

kek
>>
>>55711738
which of course you know is -128
>>
>>55711739
Creativity with test fixtures is not my strong point lel
>>
Crows back again

Soo I know this works, and I'm not getting any errors. But how to I make it so I can see the output of print in sublime? I know I'm supposed to see something where [finished in 0.0s] is placed.

>inb4 fucking scub pesant lurn mor den come back

First day programming anything thanks for help
>>
>>55711769
Forgot screen shot
>>
File: Bjarne.jpg (159KB, 600x437px) Image search: [Google]
Bjarne.jpg
159KB, 600x437px
>>55711738
that would be CHAR_MIN

Numbers start at 0000 and go up or down from there m8
>>
>>55711769
>first day only

You'll learn better in the long run if you can trudge through and figure things out for yourself (or at least make an effort and put in more time) than just asking us straight away

How are you even running the script?
Also use python 3 not 2
>>
File: Experiment.jpg (42KB, 741x194px) Image search: [Google]
Experiment.jpg
42KB, 741x194px
Running a experiment. I'm playing this playlist constantly at a volume just slightly under audible hearing range at all times I'm at the computer or programming.
>>
>>55711783
CHAR_MIN < 0
>>
>>55711471
>revvie
Thank you for posting good anime instead of weaboo trap shit
>>
>>55711783
>>55711808
char can be either signed or unsigned.
>>
>>55711769
I would suggest learning how to use the terminal. you are in Ubuntu for fuck sake. It'll give you the correct output.
>>
>>55711811
OP here. I hated that fucking insufferable trap poster so I left. I'm only back here for tonight so enjoy it lol
>>
>>55711804
i dont know why this is making me laugh so much its like asmr programming
>>
Interesting project idea for any Java programmers: hacked Pokemon Go client. Niantic seems to be relatively poor on their ability to detect cheating. Right now, there are scripts out there to "scan" a location and give exact coordinates of pokemon nearby. Rather than handling the logic of "am I near a pokemon" on the server side, Niantic appears to be handling this on the client side, giving exact coordinates through their API and hoping nobody notices. With a little bit of reverse engineering of the APK, someone could easily overlay the sprites for the Pokemon overtop their actual locations, so that someone would not need to track them through the broken "nearby Pokemon" list, which currently suffers from glitches.

It might also be interesting to experiment with what else Niantic is trusting the client to have correct. It may be possible to "inject" rare Pokemon into the game and then just tell Niantic, "hey, I found a Mew using incense."
>>
>>55711804
All those things are things you can improve with practice, this is just stupid.

Why don't you listen to sissification hypnosis shit instead?
At least then you might actually notice a change.
>>
>>55711847
I'm still salty that my phone's 4g connection is still shit here in London where there are pokestops fucking everywhere
>>
>>55711847
I'm sure there's a russian guy working on it right now
>>
>>55711846
>asmr

That's pretty similar.

>>55711860

I want to see if it improves things I'm already doing. Sissification would be hard with regular lifting / exercise and a very outspoken confident personality when I'm away from the computer.
>>
File: 2088xdu.jpg (88KB, 1600x1600px) Image search: [Google]
2088xdu.jpg
88KB, 1600x1600px
>>55711905
ishygddt
>>
>>55711905
>Sissification would be hard with regular lifting / exercise and a very outspoken confident personality when I'm away from the computer.
nigga wtf
>>
which is the best book for c++?
>>
>>55711936
>>55711928

Lmao You both underestimate the amount of people from /fit that lurk on dpt.

1st string varsity football player in high school, while I was coding outside of school / practice every day.
>>
>>55711959
I'm from /fit/

wtf r u on
>>
>>55711958
http://www.cplusplus.com/doc/tutorial/

Not even joking. Probably the most understandable language guides out there
>>
>>55711958
Primer
>>
File: 1469160610326.jpg (82KB, 900x675px) Image search: [Google]
1469160610326.jpg
82KB, 900x675px
>>55711822
>>55711776

Yeah you're probably right but I've been dick teased by the interface and was recommend by a programming friend to use it

>>55711792

You're right that logic applies to alot of things. However I spent heaps of time looking up stuff about python in sublime were as I should just continue to watch the programming lessons then fuck around with it after I know more. Only reason I've been trifled with it is that I wanted to use sublime while I watched the lessons.
>>
>>55711985

Thc + High protein diet with a emphasis on nuts, beans, seeds, lean meat, and plenty of veggies.
>>
>>55712010
I think the THC is fucking with your brain dude
>>
>>55712073
This

still don't know what the fuck he's on about
>>
>>55712073

Still functional enough to program. It has cured the violent mood swings completely.
>>
>>55712109
there are a lot of autists who are lucid enough to program too ya know
>>
>>55712186

There are also a lot of close minded individuals who never improve themselves due to ardently holding pre established beliefs without trying alternatives.
>>
What are the largest team sizes you anons have ever worked on? Recently joined a team of 20 and so far its brutal to get used to.
>>
>>55712238
Well, as someone who studies audio engineering and psychology in his spare time I can confirm playing an audio signal especially under hearing level will not effect your mastery or even improvement of a skill. It's barely even a pseudoscience.
>>
>>55712239
I wouldn't really consider myself working on a team. I work on fixing bugs on matured projects. Some other people do that, but there's no communication, we pick or are assigned tickets and work on them by ourselves
>>
>>55712239

Depends on what you consider a "team". With actual close interactions around 40.

>>55712270

There isn't a conclusive concensus in the psychology community yet on whether subliminal techniques are effective or not.

I know in the 1970's the Russians worked on a technology that used infra-sound to help control riots. There have also been more recent studies showing infrasound can have effects on biological organisms.

There is a possible basis to explain why such a technique may work. It just hasn't been well proven or researched.
>>
>>55712239
>a team of 20
How the fuck does that work?
>>
>>55712379
you are correct, the difference is infrasound is done by playing sounds very loudly that were outside the human hearing limit (<20hz >20khz). For one, if you were to do that on your speakers or headphones, it wouldn't work because the drivers do not function at high enough frequencies. Secondly, if I understand you are playing sounds that are literally too low to be perceived by your brain, being that subliminal implies a medium that is able to be perceived.
>>
>>55712436
5 QA, 5 Senior developers, 2 interns, the rest are intermediates... so far its a fucking mess. No one is in charge and the patterns are all over the place.
>>
>>55712494
this makes me really appreciate the 1 person/project initiative at my work
>>
>>55711776
>days_within_year = 360
>365 moron.
>>
>>55712516
>wrong don't you know the earth turns 360 degrees?
>>
>>55712478
>the difference is infrasound is done by playing sounds very loudly that were outside the human hearing limit (<20hz >20khz)
Wrong. INFRAsound is <~20 hz. 'Infra' = below in Latin. >~20 kHz would be called ULTRAsound. 'Ultra' = beyond in Latin.
>>
>>55712528
I turn your mom 360 degrees last night.
>>
>>55712514
there are a bunch of different ways we could change it but the seniors are so resistant to change that nothing ever gets fully implemented, some do dependency injection, some do full public static everywhere, some come from C++ background and refuse to adapt.

supposedly moving to 'micro services' but the mandate is coming from much higher up (enterprise) so I fear its just a flavor of the month thing someone caught onto and nothing will truly change.
>>
>>55712478

Very true in this case it would be low amplitude sounds (They're perceivable by the brain / ears, but at a low enough amplitude to not be registered consciously (Sub-audible subliminal messaging) ) Which I've been having trouble finding any credible research or attempt at research on.

I've seen a few papers from 70's / 80's that showed subliminal messaging played over speakers in stores reduced shoplifting. However, it has been hard finding anything more recent. I truly think the field has just been written off as bs and not fully explored.

It's kinda like the number of doctors who bluntly refused to admit the medical properties of cannabis. They never researched it or actually tried studies and just wrote it off due to bias.
>>
>>55712533
You're right my mistake

>>55712546
It would make an interesting experiment especially with today's much more powerful audio equipment when compared to the 1970s. It'd be interesting to see, given a proper hypothesis is presented.
>>
>>55712673

It definitely would especially if it is mixed with nlp concepts.

We could also easily and transparently apply these techniques as programmers in a automated fashion.
>>
File: bencoding.png (20KB, 961x670px) Image search: [Google]
bencoding.png
20KB, 961x670px
Now to work on decoding bencoded things.
>>
File: 1468535360626.jpg (81KB, 694x530px) Image search: [Google]
1468535360626.jpg
81KB, 694x530px
How much time does /dpt/ spend debugging their freshly written code to get it working properly, compared to how long it took to write it?

Be honest.

>~1.5x here
>>
>>55712836
Why do you spend so much time writing bugs?
>>
>>55712836

Unit testing,
Immutable types whenever possible,
Enforce invariants,
Pretty much the same as above but sanity check everything in debug builds.

That'll lower your time debugging and increase the time spent writing code. The problem is if you're following all of the above bugs will generally be the hard to trace kind.
>>
>>55712892
>Unit testing
Boy do I love unit testing. Racket has lots of love for that and it's a mercy I've never known until I started programming in it.
>>
File: hitler.jpg (34KB, 400x335px) Image search: [Google]
hitler.jpg
34KB, 400x335px
In C, how do I

- read a filename path from a textfile
- specify it as an argument to
fopen()
so that that file itself will be opened by the C program?

It seems like no matter what string hocus-pocus I do, fopen won't accept the string as an argument. I'm worried that I'm somehow leaving a \n or \0 or whatever attached somewhere along the way, but when I printf the char arrays as integers, I don't see any "32" indicating a newline. It's just the literal filename chars themselves, yet it still doesn't work
>>
>>55712892
-I don't unit test because that would eat just as much time as it saves
-Done
-Done
-Done
>>
>>55712528
So... it's at what speed it's turning, and that takes 24hrs for a full 360 degrees, and a year is 365 days, so 24 * 365 numb nuts.
>>
>>55712919
>I don't unit test because that would eat just as much time as it saves
Full retard. Unit testing is an investment. It saves you time in the long run when you decide to scale or extend your projects, because unit testing will catch everything, and it's easy to find where to tweak
>>
>>55712932
I'm talking about a brand new project, not maintaining old code. Then it would make more sense.
>>
>>55712912
do a printf with quotes around it
like printf("\"%s\"", string);
If you see
"/file/name
"
then there is a newline in there
>>
>>55712912
FILE *fp = fopen("yourfile.txt", "rb");
fseek(fp, 0, SEEK_END);
long len = ftell(fp);
fseek(fp, 0, SEEK_SET);
char *data = (char *) malloc(len + 1);
fread(data, len, 1, fp);
data[len] = 0;
fclose(fp);
FILE *ur_file = fopen(data, "r");
>>
>>55712947
>I'm talking about a brand new project
That's where unit test is best
>adding tests to old code
lmao, nobody has the patience
>>
>>55712951
in python this would be 1 line
>>
>>55712912
>In C, how do I

FILE *fp = ...;
char name[256];

// assuming the next line contains the name of the file you want to open:
fgets(name, sizeof(name), fp);

// trim 'name' here, remove \n, \r, \t and whitespace from start and end

FILE *another = fopen(name, ...);

// do something with 'another'

fclose(another);


>don't see any "32" indicating a newline
32 (0x20) is a space, not newline. Newlines are 0x0A (\n) and 0x0D (\r, used in Windows with \n).
>>
Are there any worthwhile programming communities outside of /dpt/? It seems like everywhere else is infested with js hipsters and webdevs now.
>>
>>55712961
Usually on the mailing list or IRC for a given language. For instance, the Racket Users mailing list is excellent.
>>
>>55712947

New projects have to be changed or maintained at some point. Writing the tests from the onset makes life easier / more productive later on. That is assuming the tests are written well enough to not need changing every time you touch the code base. If that is the case then you have bigger issues.
>>
>>55711713
Why? I'll admit 1 is as arbitrary as 0 but other than post hoc arguments like efficient pointer arithmetic (which post-date 0-indexing and are equally arbitrary) there's no reason 1-indexing isn't perfectly valid.
>>
do NOT bully OOP!
>>
Trying to read images and write them to a new image as a collage in Python using only standard libraries. Any tips? I was trying to look in to modifying the read binaries from jpgs but there's not much to read on that.
>>
>>55712990
but it's shit f/am
>>
>>55712991
>using only standard libraries
Why? Pillow is THE python library for image manipulation
>>
>>55712961

I really don't know if you can consider /dpt a worthwhile community. I mean we're mostly trolls and shit posters.
>>
r8
j = \x y z t -> putStrLn $ x $ y map z t
f = (!! 20593)
m = \x y -> y x $ m x y
s = \x y z -> [] : (y z >>= (\t -> x (:t) z))
u = map toEnum [74..85] :: String

main = j f m s u
>>
>>55713015
It's better than node.js and webdevs.
>>
>>55713015
This is true.
Once you go past basic beginner scrub, the probability of /dpt/ helping you on a non-trivial problem becomes worse and worse.

It's why I only come here to post bait and funpost.
>>
>>55713034

I don't go near /wdg.. The sad part is they've been invading dpt lately.
>>
>>55713012
I want people to just be able to have Python and use my program. My next step would be to freeze it so anyone can use it. Or does that work with libraries too?
>>
>>55713029
>j m f s u
0/10

>j = lambda
don't do this

>map toEnum
All bounded enums can be range constructed

>map
use fmap or <$>
>>
>>55713008
DO NOT BULLY
>>
>>55713012
Does it use C, like all good """python""" libraries?

>>55713015
>>55713050
It was good before you fucking faggots ruined it
You're the fucking problem, when you're gone it'll be back in business again
>>
>>55713050

That can be explained.. Programmers are lazy and programmers with jobs don't feel like fucking with anything non-trivial unless it's their own project.
>>
>>55713051
It just seems like every other programming community is entirely focused on webdev, node.js, "hacking", "coding", startups, etc. now.
>>
>>55712533
>playing
>>>/v/
>>
>>55713077

Before you faggots ruined it? :P hate to tell you anon I've been here for years.
>>
>>55713060
>asking people to have Python
Never do this. You want your program converted into an executable. If you're talking about other devs, they will inevitably want to use Pillow

>>55713077
Yes, it uses C
>>
Is the use and heavy promotion of C and C libraries by Python an esoteric form of cμckoldry?
>>
>>55712836
3 x the time i took to write. Beginner programmer here. I am still struggling with syntax errors.

One day, all those syntaxes will be ingrained into my fingers' muscle
>>
>>55713109
I'll be distributing it on 4chan and I don't think people are comfortable with executables
>>
>>55713083

I blame the incentive companies and governments have to push everything towards web connections. I mean it is the easiest way to mass collect data and spy on people's private information without it being "illegal".

The internet in everything movement is a disguise for "We want to wire tap you. Collect all your data and sell it for companies / agencies to analyze and abuse
>>
I'm about to start my junior year as cs student with emphasis on software development. I've already taken c++ classes. What should I learn in my spare time so I'm not a fuck up when I get out??
>>
>>55713150
haskell

alternatively, prolog
>>
>>55712990
O O P
O O
P O O
>>
>>55713150
Haskell
>>
>>55713029
JUST
>>
>>55713143
Oh, then if you don't want to use Pillow, you'll have to parse the image's bytes and take into consideration different file format interpretations and executions, ie reinventing Pillow
>>
>>55713149

If you want to be employable just look at the job listings for the work you want an pickup skills with all the corporate buzz words they commonly list.

The best languages to find work are Java, Js, C, C#, and C++.
>>
>>55713222

That was the wrong post.. meant to reference >>55713150
>>
>>55713222
I want a comfy C job but I don't know where to look.
craigslist certainly doesn't have anything like that
>>
>>55712836
Not very long. I'm using Rust, so once it compiles, it runsâ„¢.
>>
>>55713255

Good luck, outside of embedded systems it's a lot of work that requires security clearance or is actually random ass java / c# / .net webshit they decided to list as a c programming job.
>>
>>55713211
I just need it to work with .jpg files and apparently the header has width and height at an offset of 4 and 6 bytes appropriately. I was gonna start by replacing those with my desired number. After that I was going to move the footer (if that's even a thing) after my new image data.

I'll have multiple images of the same size, and I let the user say how many columns they want. I will then draw an image of the collection of images stacked according to that, though I have no idea how to do that right now.

I don't know much about this stuff. I'm guessing all OS would read a .jpg the same?
>>
>>55713307
>I don't know much about this stuff.
Look at the Pillow source code and you will see that even for just .jpg, you are going leaps and bounds reinventing the wheel. Also keep in mind that it's written in C also due to the fact that image processing is an expensive task
>>
>>55713341
Damn I was excited to work with the binary, I thought it was just gonna be modifying the header and adding image info in. I wasn't too concerned about performance but oh well I guess I'll try out Pillow. And to be honest, I don't know shit about packaging my Python files either. I'd just like to have then double click something in the end, and I guess I have no other option than .exe now that I look at freezing.
>>
>>55713389

Excited about working with image formats.. :P read the official specifications for common formats and have that cringe moment at how much bs you have to sort through to be compliant.
>>
>>55713389
If you package and share it, others will have the Pillow dependency installed anyway. Most libraries people are comfortable with have dependencies. This minimalistic approach some of you have is not productive.

That being said, you will NOT have fun working with the binary because some file formats have many specifications within them
>>
>>55713425
>installed anyway
I mean to say installed automatically, as part of the package downloading process
>>
>normie
Trans gender faggots who think they're special snowflakes but in reality they're just faggots.
>>
>>55713445
its the r9k term for normalfag you dumbfuck
>>
I know it's not that great but it sure as hell beats checking each artifact one by one.
http://pastebin.com/pUsdBQSn
>>
>>55713290
of course, this is not completely true, but it almost is. i love rust

also, when i used c++, the difficulity of working with the program grew exponentially as the size of the program grew. with rust i feel like it's not the same at all, but i'm not sure why.
>>
File: Pengo.gif (305KB, 261x199px) Image search: [Google]
Pengo.gif
305KB, 261x199px
>>55713425
>>55713412
Ooh shit yeah okay I'll try out Pillow when I work on it tomorrow. Good thing I didn't delve too far in to that. I didn't know about the libraries being packaged too that's neat.
>>
File: enrique-king-of-the-hill-68.2.jpg (9KB, 210x240px) Image search: [Google]
enrique-king-of-the-hill-68.2.jpg
9KB, 210x240px
I wrote a program which uses markov chains to take in some input text (best if it's pretty long for more diverse chains) and outputs a random shitpost.

Input: >>55713149
I blame the incentive companies and governments have to push everything towards web connections. I mean it is the easiest way to mass collect data and spy on people's private information without it being "illegal".

The internet in everything movement is a disguise for "We want to wire tap you. Collect all your data and sell it for companies / agencies to analyze and abuse.


Output:
I blame the internet in everything movement is a disguise for "We want to analyz
e and governments have to analyze and governments have to mass collect all you.
Collect all your data and governments have to push everything towards web connec
tions.


I'm thinking about writing a program which automatically replies to 4chan posts using the markov algorithm I implemented.
>>
>>55713500
Packaging and dependency tracking is a common theme in programming languages and non-Windows OS' (or anything with a package manager), so you'll get used to its usefulness eventually
>>
>>55713501
>I'm thinking about writing a program which automatically replies to 4chan posts using the markov algorithm I implemented.
You're a genius. Imagine how mad people will be not knowing they're arguing with a bot.
>>
File: fragezeichen yui.png (94KB, 396x395px) Image search: [Google]
fragezeichen yui.png
94KB, 396x395px
I know how to convert a u32 int into an array of 4 u8 ints, but how do I convert a double into a similar array?

A double is 8 bytes long, right?
Can it be done with simple bitshifting?

When I search Google all I get is people using pre-defined Java functions, which isn't what I want at all.
>>
>>55713540
>java
lmao

What are you converting exactly? The format for double/floats is a little more complex to ints
>>
>>55705343
underrated post from two threads ago
>>
>>55713540

1011 1111 1111 1111 1111 1111 1111 1111
and
1111 0000 0000 0000 0000 0000 0000
equals
1011 0000 0000 0000 0000 0000 0000
>>
>>55713604

forgot the last 4 bits on the second and third line. I think it is about bed time.
>>
how do you decide on a project to program?
any idea I have it's already done better than what I'm capable of doing
>>
>>55713636
You do it anyway you cuck
>>
>>55713636

Just pick a idea and do it. Reinventing the wheel is fine for self improvement.

>>55713604
Another hint after that is "right shift"
>>
>learn Haskell bro
>it's good
THIS IS A MEME!!!!
>>
>>55713684
Yes, we know, it's a language perfect for NEETs who have no career aspirations, hence why it's pushed here
>>
>>55713455
Still faggots who think they're special snowflakes but in reality they're just faggots.
>>
>>55713698
Yes, we know r9k is like that, but they're not the trans people we usually think of
>>
>>55713172
O O P    I    L O O
O P O N N O L O
P O O I O O L
>>
File: 1451260630233.jpg (40KB, 600x600px) Image search: [Google]
1451260630233.jpg
40KB, 600x600px
I made an MPD client that learns what music you like and appends songs to your playlist.
Yes the name is inspired from r/a/dio.
https://github.com/sora-chan/mpdhanyuu
>>
>>55713761
I cba to look at the code, but what information from the songs does it take into account to make decisions?
>>
I give up.
>>
Why is the "Java is insecure" meme still around? Is it just people still confusing the language/JVM with Java web applets?
>>
>>55713792
No idea, but it is a shit language
>>
>>55713810
True, there's better JVM languages, but hey, at least it's not JS, right?
>>
>>55713777
The main thing it considers is the precedence level for that song that it maintains by seeing when you either skip it or listen to it to completion.
Other things it considers is the last time it was played, it will not append a song to your playlist if it was recently played, this is controlled by a formula which is configurable.
It also considers how many times it's been played, if it's zero, it'll double it's chances of being appended to your platlist, of course this is all configurable to your liking.
It also keeps track of how many times you skip it, but it isn't actually used in anything yet.
>>
>>55713819
JS is at least saved by TypeScript, and frameworks like knockout

I could say that Java is somewhat saved by Groovy, but Spring is shit, and I prefer working on something as simple as JS than the verbose and convoluted mess that is Java
>>
>haven't web deved in 3 years, i only work in seesharp now
>got a side job where i will be making a website for my cousin's boss
well, it's like riding a bike right?
i hope i wont get him fired
>>
>>55713761
>.cxx

oh anon
>>
>>55714007
I love some of his normalfag request
"Okay if someone searches for this word on google i would like this website to be the first result"
yeah sure just let me hack the fucking google
>>
>>55714013
What?
>>
>>55714007
3 years is not so much

technology doesn't change that fast
>>
>>55714052
Well it's not like it's going to be hard, he just wasn't the normal shit that doesn't even require any backend coding.
The problem is i was always shit at art so i hope he will be fine with minimalistic design.

I'm going to pull all the stops
- font as MS comics sants
- photos as 100% opacity wallpappers under all text
- music playing in background
- all pieced together in the latest ms office Word of course and saved as .html files
just kidding, actually looking forward to be working in the trade again (i used to do that shit for a living)
>>
File: sex.png (194KB, 418x234px) Image search: [Google]
sex.png
194KB, 418x234px
Is there a course or a textbook out there that really, really goes into Scheme, including macros?

SICP is just an intro to computer science that happens to use Scheme. I want something about the language itself.
>>
Yo guys, I'm a high school dropout (health reasons) neet and I want to learn a marketable skill (programming) in my free time.

I don't want to earn much, just 500-1000$ a month.

I'm currently doing the FreeCodeCamp course, opinions on that one?

Which programming language should I learn first? Python?
>>
>>55714181
Yes Python. I got a job 5 months after picking it up with no degree
>>
>>55714185
What exactly do you do?
>>
>>55714185
That's amazing, I thought it would take much longer.

How did you learn it?
>>
>>55714211
I'm a professional Python shill and I'm an expert at fapping to traps.
>>
File: CirnoAngry2.png (118KB, 238x277px) Image search: [Google]
CirnoAngry2.png
118KB, 238x277px
So, I was changing my MySQL database to use CHECK constraints instead of ENUM for easier changes to the system, and... apparently, MySQL doesn't support CHECK.

Firstly, what the fuck?
But more importantly, I need to know how to change something like
CONSTRAINT account_status_check CHECK(account_status IN('ACTIVE', 'BAN', 'UNVERIFIED'))


Those aren't exact, but I just spent a couple hours redoing all these, and when I got no errors on updates, I figured it was all cool... until it turns out they don't work. At all.
For instance, I was able to make a language with an active_status of 'poTaTO' even with a CHECK of 'ALPHA', 'BETA', 'OPEN', or 'TRANSLATOR'

How do I make a trigger for each table that will accept only certain non-numerical values?
>>
>>55714233
Use MariaDB, you dumb fairy.
>>
>>55714211
CHIP-8 emulator
language interpreters
web scrapers
virtual machine implementation
etc

>>55714214
Official docs
>>
File: desktop1.png (723KB, 1366x768px) Image search: [Google]
desktop1.png
723KB, 1366x768px
irc b0t
>>
File: Screenshot_2016-07-23_05-44-02.png (35KB, 1366x768px) Image search: [Google]
Screenshot_2016-07-23_05-44-02.png
35KB, 1366x768px
>>55714261
>>
>>55711632
superuser password.
>>
>>55714261
good taste in music anon
>>
>>55714304
?
>>
>>55714252
I'll start hosting on GoDaddy.
I will have MySQL.

I need to know how to alter that so it works with MySQL.

This is exactly why I hate asking questions here. There's no 'answer' 80% of the time, only people suggesting a different option than what you have/can do/know/etc.

Please just tell me how to make a check constraint like that into a trigger...
>>
>>55714327
>went to /g/ before google
what did you expect?
>>
>>55714261
nice nested code, faggot.
nice creating the socket over and over again, when you could just issue a new connect() call if the previous fails.
nice using of getaddrinfo when gethostbyname is perfect for what you are doing
also,
>AF_INET
>ptr->ai_addrlen
>not sizeof(ai_addr) or just sizeof(sockaddr_in)
It's a fucking constant length (sockaddr_in is syntactic sugar for sockaddr), unless you use AF_INET6, which you don't, because your code sucks.
>>
>>55714337
>Spent an hour looking it up.
>only examples seem to show numeric triggers
>went to /g/ after searching through SO, SA, Bing, random links
>STILL got this
I don't really know what I expected to be honest.
>>
>>55712836
1.01x

I rarely write shitty code because I know what I'm doing
>>
>his language has a tutorial aimed for retards

learnyouahaskell.com
>>
>>55714357
we need more women in programming
>>
>>55714357
we all know it's a meme m8
>>
Hey everyone,

I am experienced with programming but I don't really know much about 3D programming (opengl to be more specific).

What's a good place to start? Any tutorials where I'm working on something? Most of what I found either seems to be overly basic and just says "this is how the pipeline works" or goes into writing complex shaders.

Where do I start with graphics programming?
>>
>>55714388
>Where do I start with graphics programming?
Check out the api and experiment. OpenGL has some very useful cheat sheets, conveniently categorized and packed set of functions and variables in a well-colored pdf, and you can also check out their docs
>>
File: tumblr_nyp2w3esF61ro7rpno1_1280.jpg (29KB, 640x519px) Image search: [Google]
tumblr_nyp2w3esF61ro7rpno1_1280.jpg
29KB, 640x519px
What GUI framework is the most mainstream nowadays?
Also, should I switch away from GTK?
>>
>>55714417
javaui or some bullshit

If you know GTK and you know how to navigate through that mess then stick with it
>>
>>55712879
Are you retarded? How are you gonna get any sustained income from support job if your programs has no bugs to fix?
>>
>>55712925
it's a meme you dip
>>
>>55712980
theoretically, you could, but it would be stupid because 0x1-0xFFFFFFFF isn't 2^32-1 along with many other memory foibles
>>
File: CirnoBrowsingDarkSweat.jpg (110KB, 620x520px) Image search: [Google]
CirnoBrowsingDarkSweat.jpg
110KB, 620x520px
>>55714233
well, it wasn't that easy, but I think I found what I'll need to look into.

I'm now learning how to create procedures, which seem to validate properly.
Then, I'll have to trigger them.

Doesn't seem too hard, but heavily annoying.
I shouldn't have to do this.
And I fucking lauded MySQL over, say, Oracle, b/c MySQL had enum() and auto_increment.
I was very fucking wrong...
It's only just as good, at best.

ugh...
Now I can't even say MySQL is a good FOSS program.
I always hated FOSS, but I gave MySQL an exception. lmao, I was righter than I thought.

I'll eventually need to make my own system, I guess...
fuck.
>>
File: expertPythonProgrammer.jpg (238KB, 960x1280px) Image search: [Google]
expertPythonProgrammer.jpg
238KB, 960x1280px
>>55714226
post some traps
>>
haskell
factors n = [i | i <- [2..pred n], n `mod` i == 0]
prime n = length (factors n) == 0
pfactors n = last $ map prime (factors n)

main = print $ pfactors 600851475143


python3
g = 600851475143

def factors(n):
s = []
for i in range(2,n):
if n % i == 0: s.append(i)
return s

def isprime(n):
return len(factors(n)) == 0

def primeFactors(n):
f = []
for i in factors(n):
if isprime(i): f.append(i)
return f

print(primeFactors(g)[-1])
>>
>>55714697
That python code looks lovely.
>>
>>55714697
prime = (==0) . length . factors
pfactors = last . map prime . factors


>>55714715
thanks, I realized that
def factors(n):
return list(filter(lambda x: n % x == 0, [i for i in range(2,n)]))

was not the true way of python
>>
>>55714697
>>55714748
That's the most retarded way of finding prime factors I've ever seen, holy shit that's computing intensive

#!/usr/bin/env python

def factorization(k):
if k == 1:
return [1L]

step = 2L
lim = k / 2L
while step <= lim:
if k % step == 0L:
return factorization(k / step) + [step]

step += 1L

return [k]

if __name__ == '__main__':
print int(max(factorization(600851475143L)))
>>
>>55714442
What about the QT framework? I heard some good things about it.
>>
return &reinterpret_cast<mod::sample_info const *>(&reinterpret_cast<char const *>(this)[20])[n];


is this too nasty? new to c++ so i dont know much about code smell
>>
>>55714778
smells like shit f.am
>>
>>55714770
it wasn't meant to showcase a good algorithm
it was mean to showcase haskell v python
if I wanted some performance I would've done up to root n
>>
>>55714748
pls
factors = lambda n: [i for i in range(2, n) if n % i == 0]
>>
>>55714789
>factors = lambda..
Not pep-8 compliant
>>
>>55714788
>it was mean to showcase haskell v python
Writing deliberately verbose Python is not "showcasing Python" you flaming faggot.
>>
>>55714798
what you wrote is more verbose than mine
>>
>>55714796
pep8 also limits the line width to 80 chars
do i give a fuck?
>>
>>55714789
sorry, I just picked up python and come from fp background
I forgot that list comprehensions generally allow for filtering
>>
>>55714796
[citation needed]

>>55714808
How is it more verbose? You have three functions, I have only one.
>>
>>55714785
man its hard to write byte parsing code without a certain amount of smelliness

auto base = &reinterpret_cast<char const *>(this)[20];
return &reinterpret_cast<mod::sample_info const *>(base)[n];


this is better I GUESS
>>
>>55714828
wc -m for mine = 304
wc -m for yours = 326
>>55714796
whats pep8
>>
>>55714810
actually it's 79 chars
>>
>>55714838
god forbid id ever comment my code
>>
>>55714855
>whitespace is verbose
You're a fucking moron
>>
>>55714827
there's also generator expressions, set and dict comprehension.
in addition to being map and filter they've also got a special syntax for 2d iteration.

quick example:
box = [[i] * i for i in range(20)]
flat_box = [i for l in box for i in l]
>>
>>55714864
doesn't matter because mine counts whitespace too
>>
>>55714838
static_assert(std::is_standard_layout<mod::file>::value, "fug :D");


good shit
>>
>>55714881
You use less whitespace than me. Note how your functions are crammed together while my single function isn't?

Also, the whole notion that more characters equals more verbose is fucking pants on head retarded and you've completely misunderstood the Zen of Python.
>>
I'm gonna do it lads, I'm gonna buy a cat
>>
>>55714828
i'm the guy that wrote that code, it isn't pep8 compliant
pep8 suggests
def factor(n):
return [i for i in range(2, n) if n % i == 0]

instead, but pep8 is stupid

why can't all formatting standards be as great and pragmatic as go's?
>>
File: glow.png (261KB, 792x588px) Image search: [Google]
glow.png
261KB, 792x588px
>>55714388
The way I started was with these tutorials:
>opengl-tutorial.org
Those are a "start", lots of shit there is badly implemented but easy to understand, source code is WTFPL. Next up would be the Red Book of opengl, make sure you get one that covers OpenGL 3.2 or 3.3, don't bother learning 4.0 or any of the newer versions, they are not widely supported. After that, these tutorials
>learnopengl.com
Now those tutorials are where the "fun stuff" begins, FBOs, post processing, performance lighting, deferred shading, etc. After that you're pretty much free to go off writing cool stuff, like pic related, a performance glow shader I made in like two days.

More notes for beginners:
Don't learn from NeHe tutorials.
Don't limit your application to more than version 3.3, you can almost always use newer version features with ARB and EXT extensions which you shouldn't fear.
Experiment with buffers, try cramming everything in one VAO with instanced rendering, try having one bing VBO for everything, try having all particles in one buffer, try all kinds of crazy shit.
The goal, almost always is to minimize the amount of drawcalls.
>>
>>55714878
>[i] *
whats the "*" for
and I can understand how flat_box works, kinda hard to get at first though
>>55714895
ok, you youse more whitespace, but only a little bit more
my code is still more readable
>>
>>55714789
pls
factors = lambda n: [i for i in range(2, n) if not n % i]
>>
>>55713540
Engineer your own solution m8

here I made a function that does that

void float_bit_print(float a){
std::string bits;
long cast = *((long*) &a);
for(int i = 0; i < 32; ++i){
bits += (char)((cast&0x1)+'0');
cast >>= 1;
}
std::reverse(bits.begin(), bits.end());
printf("%s\n", bits.c_str());
}
>>
>>55714985
use
puts(bits.c_str());


instead of

printf("%s\n", bits.c_str());
>>
>>55714810
probably not because you're a neet autist who's code no-one will ever read
>>
why do you C++ fags hate the Boost library so much?
it's a free extension of the language that you must know and use
>>
>>55714965
pls
import factor
>>
>>55715032
that's not the same

sorry

try again
>>
>>55715029
i like it because it boosts my confidence with girls
>>
>>55715000
Why? With puts you don't get the newline character in there. It's not unsafe like scanf if that's what you're thinking

side note, the cast can be written like
int cast = *((int*) &a);

It's probably safer that way
>>
>>55715029
overengineered shit
>>
>>55714958
>>> 3 * [1, 2, 3]
[1, 2, 3, 1, 2, 3, 1, 2, 3]


also, bonus:
>>> {i for i in range(0, 100, 3)} | {i for i in range(0, 100, 5)}
{0, 3, 5, 6, 9, 10, 12, 15, 18, 20, 21, 24, 25, 27, 30, 33, 35, 36, 39, 40, 42,
45, 48, 50, 51, 54, 55, 57, 60, 63, 65, 66, 69, 70, 72, 75, 78, 80, 81, 84, 85,
87, 90, 93, 95, 96, 99}
>>> {i for i in range(0, 100, 3)} & {i for i in range(0, 100, 5)}
{0, 75, 45, 15, 90, 60, 30}

mathematical set operations obviously work too.

dict comprehension:
>>> {i: 2*i for i in range(10)}
{0: 0, 1: 2, 2: 4, 3: 6, 4: 8, 5: 10, 6: 12, 7: 14, 8: 16, 9: 18}


generator expressions (these are lazy!):
>>> (i for i in range(10))
<generator object <genexpr> at 0x0000000000625A40>
>>> next(i for i in range(10))
0


>>55714965
i do that when i'm golfing but i think using truthyness like that is bad for readability.
you're looking for numbers where i divides n, the "not" just doesn't fit in there in my mind when reading the code.

also, r8 my LONDON
LONDON = lambda t: print("\n".join(" ".join([" ", t[c], t[r], t[r]][(not r) + ((not c)<<1)] for c in range(len(t))) for r in range(len(t))))
>>
>>55715077
>Why? With puts you don't get the newline character in there. It's not unsafe like scanf if that's what you're thinking

you what? do you even know that puts does?

>puts() writes the string s and a trailing newline to stdout.
>>
>>55714915
And never use glBegin and glEnd
>>
>>55715077
>With puts you don't get the newline character in there
Yes, you do. It's fputs that doesn't append the new line.
>>
>>55715005
not every formatting standard is as defunct as pep8
>>
>>55715088
>And never use glBegin and glEnd
hmm.. why?
>>
>>55715086
Oh I never use puts, but still what does it matter? Readability?
>>
>>55715108
less chars
>>
>>55715107
Because it's deprecated
>>
>>55715107
Deprecated. First there was glBegin/glEnd, then bind VBOs and point attributes and glDrawWhatever, now just bind VAO and call glDrawWhatever
>>
>>55714958
>my code is still more readable
It really isn't.
>>
>>55715125
>>55715131
what do you guys use then?
>>
>>55715146
VBOs
>>
>>55715146
VBOs + VAOs are now the standard.
>>
>>55715145
ur code is unreadable
my code is straight babby tier
stop being contrarian
>>55715085
I see, python's so weird lol
there's a lot of resources for it too
maybe I should hop on back to python train
>>
>>55715168
>ur code is unreadable
>python's so weird lol
kys
>>
>>55715158
>>55715163
what the hell are VBO's?

go fuck yourself
>>
>>55715179
why would u invest hate in the internet man?
and I meant that mine is easier to read & understand
>>
>>55715183
You can imagine it like an array of vertices stored on the GPU. Makes it easier for the GPU cause you don't have to upload the data every time.
>>
>>55715201
>and I meant that mine is easier to read & understand
It really isn't, and it is slow as fuck
>>
>>55715081
what do you use ?
>>
>>55715213
whats so hard to understand about
for i in range(2,n): if n % i == 0: f .append(i)


and I agree, its slow, but it wasn't the purpose to be fast, as I said back
>>
>>55715217
https://twitter.com/id_aa_carmack/status/81104943490146304
>>
>>55715183
>what is thing
>I don't recognized thing
>panics and resorts to being an autist

damn /dpt/ never change
>>
>>55715231
It's not hard to understand you fucking cocksucker....

I'm saying that it is verbose as fuck.


f = [x for x in range(2, n) if x % i == 0]

>>
>>55715233
>inb4 cargo cult meme
>>
>>55715245

f = [x for x in range(2, n) if not x % i]

>>
>>55715245
Typo, if n % i it is supposed to read.
>>
>>55715245
like I said, I'm new to python
I forgot that lists had filtering feature
and you denied a post back that it was easier to read & understand
so which is it?
>>
>>55715271
>and you denied a post back that it was easier to read & understand
No I didn't, I said YOUR code was harder to read.
>>
File: b68065cd07f9b41824f7e15ed3d89afb.jpg (396KB, 1920x1080px) Image search: [Google]
b68065cd07f9b41824f7e15ed3d89afb.jpg
396KB, 1920x1080px
>>55715245
jesus python is a piece of shit language for that to be valid syntax
>>
>>55715217
>>55715233
Why in every stackoverflow question the answer "use this boost feature" always has like 9999 upvotes? I did an #include on a boost thread safe vector library once, compile time went up fucking 3 seconds. Never again.

Boost feels like glue to fix bad overall designs.
>>
>>55715233
> hey anon, implement these matrix operations and math and stats functions in efficient C++
>>
>>55715277
>>55715271
For fuck's sake, even

f = filter(lambda x: x % n == 0, range(2, n))


would have been less verbose than your slow as shit clusterfuck, which --according to you-- is your "showcase" of Python
>>
>>55715299
whoah [<map function body> <loops...> if <filter function body>] sure is difficult syntax
>>
>>55715326
It is difficult syntax when you're an imperative pleb like >>55715299
>>
>>55715303
verbosity has little correlation with understanding
addAnIntegerToANumberCalledX x = x + 1

==
onePlus x = 1 + x

its not harder to understand the former
but its more verbose
learn that friend
>>
>>55715300
99% of the time boost isn't needed. the last time I used it was for a lexical_cast which I could've made if I wasn't a lazy fuck
>>
>>55715300
compared to the hype and its size boost is utter shit

there's just aren't many well written libraries out there
>>
>>55715326
>>55715336
Not difficult, just looks like shit
>>
File: bug.png (310KB, 793x599px) Image search: [Google]
bug.png
310KB, 793x599px
>>55714915
Best part about OpenGL is how bugs can be beautiful.
>>
>>55715337
What the fuck are you on about you fucking nigger?

f = []
for i in range(2, n):
if n % i == 0:
f.append(i)


is objectively more verbose than

f = filter(lambda i: n % i == 0, range(2, n))
>>
>>55715351
it really isn't that bad
you shouldn't use it for big loops and stuff that's nested a lot but it's really fine and expressive syntax for simple stuff
>>
>>55715359
But it's rare...
>>
>>55715362
Functional master race:
def factors(n):
return filter(lambda i: n % i == 0, range(2, n))


Imperative pleb code:
def factors(n):
f = []
for i in range(2, n):
if n % i == 0:
f.append(i)
return f
>>
>>55715362
I never claimed otherwise.
I already admited that mine is more verbose, but its easier to read and understand (which you somehow twist to mean that I mean its less verbose, suggesting you equate verbisty with level of understanding)
>>
// n:[0,30]
mod::sample_info const *mod::file::get_sample_info(std::size_t n) const
{
auto p = &reinterpret_cast<char const *>(this)[mod::file::sample_info_table_offset];
return &reinterpret_cast<mod::sample_info const *>(p)[n];
}


yeah this is good

constexpr is an amazing feature and should be rolled into C
>>
>>55715388
>but its easier to read and understand
But it is NOT, you idiot

List comprehensions,
f = [i for i in range(2, n) if n % i is 0]


is close to natural language

That pile of shit you wrote is as far from natural language you can get, yet you consider it to be a "showcase" of Python despite it being extremely non-pythonic.

And considering how it is horribly inefficient too, you should just quit programming and probably kill yourself.
>>
>>55715380
but then you need to convert the filter type to the list type
I don't like how types are bound to a class
haskell's got it right, make your type be instantiated to classes which you think your type should belong to
>>
The search for a good python graphic library continues...
>>
>>55715419
>but then you need to convert the filter type to the list type
There is no filter type in Python, filter returns a list.

Kill yourself
>>
>>55715412
>if n % i is 0
dangerous play with integer caching friendo
this might not work in every python implementation
>>
>>55715400
you're supposed to write human readable code and not overuse pure C shit in your code tho
>>
>>55715437
>this might not work in every python implementation
Use equality instead.
>>
>>55715437
What the fuck kind of a language are you yuppies using where that "might not work"...
>>
>>55715441
cant be helped when youre reading binary blobs

shits ugly no matter what
>>
>>55715437
How the fuck would n%i==0 not work some of the time
>>
>>55715464
(its an amiga protracker .mod file parser)
>>
>>55715412
list comprehensions are derived from set comprehensions in math
math is the formal expression of behavior found in the universe
its not natural though, because its meant to be rigid
thus
and yes, its more readable because noobies are taught first like that of my code
>>55715436
filter is a object (or type) though
its belongs to the filter class, they're unseparable
and if I remember, one can make custom types with classes
>>
>>55715453
"is" compares identity, not value.
it essentially compares the pointers.
the default python implementation however caches all integers from -128 to 127, so comparing their identity (their pointers) will always yield true, as they're pointing to the same cached integer.
newbies sometimes believe "is" compares value (i did too at the beginning) and then suddenly in a loop from 0 to 200 something breaks at 128.
i agree that the name for that operator was chosed very badly.
>>
>>55715472
see
>>55715490

other implementations (e.g. ironpython, which i use a lot) *might* not do this kinda caching, but i'm not sure.
>>
>>55715372
Not for me.

I FUCKING LOVE FBO'S
>>
>>55715472
`is` and `==` are not the same. `is` Checks if they are the same object, `==` checks for equality.

Python recycles small integers, so small numbers are likely to be shared, but not large numbers.

>>> x = 42
>>> x is 42
True
>>> x = 613
>>> x is 613
False
>>
>>55715484
// 's' must be able to hold 22 bytes
// returns the number of bytes written
std::size_t mod::sample_info::get_name(char *s) const
{
static constexpr std::size_t sz = sizeof(this->name);
auto nil = static_cast<std::uint8_t const *>(std::memchr(this->name, '\0', sz));
std::size_t n = nil ? static_cast<std::size_t>(nil - this->name) : sz;
std::memcpy(s, this->name, n);
return n;
}


im proud of this mess of a function
..,,~~elegant~~..,,
>>
>>55715490
by the way, java has the same issue for integer objects when using == instead of .equals().
>>
File: fuckingshit.png (331KB, 793x596px) Image search: [Google]
fuckingshit.png
331KB, 793x596px
>>55715508
But forreal, how do you extract brightness from a texture? Doing a dot product test is fucking my shit up
>>
>>55715487
>math is the formal expression of behavior found in the universe
And that's why languages like Haskell and Python are good, because you can express yourself mathematically rather than using imperative languages that are nothing but portable assembly implementations (such as C).

>and yes, its more readable because noobies are taught first like that of my code
Get it to your head
- your code is first of all slow as balls, because you suck at algorithms
- your code is obtuse as fuck, you define three functions that call each other instead of being contained
- your code is verbose as fuck, because you insist on using non-pythonic imperative code where a list-comprehension would do

>filter is a object (or type) though
You don't even know Python if you think that filter returns some "filter type" that needs to be converted to a list.

Filter is a built-in function.

https://docs.python.org/2/library/functions.html#filter
>>
>>55715511
Why are you declaring a local variable static?
>>
>>55715527
The only bugs I have is when I for example forget to turn depth testing on again or don't implement proper error testing and get a black screen -.-
>>
wow, I didn't know it was possible to have such heated battles about a toy language like python
>>
new thread
>>55715537
>>55715537
>>55715537
>>
>>55714342
rifk are you mad skid?
socket is required to be recreated
gethostbyname is deprecated
ptr->ai_addrlen is valid
AF_INET6 is for ipv6
>>
>>55715545
static constexpr is just a typed/scoped #define
>>
>>55715549
/dpt/ will argue about anything, even the best way to implement fizz buzz
>>
>>55715550
>that pic
fuck off, this one hasn't even ended
>>
>>55715530
python anon here.

being able to express yourself mathematically comes with a lot of power to abstract.
the power to abstract corrupts, making it easy for devs to write stuff that's hard to read and overengineered
simple languages like c or go prevent this kind of issue at the cost of some expressiveness.

in python, if you overdo it with list comprehensions, i can assure you it'll be a lot harder to read than its imperative counterpart (even when you grew up with functional languages).
>>
>>55715568
it was posted at 310 you fucking idiot
>>
>>55715576
>at 310
yes, you still had to wait one post

your thread staring is invalid
>>
>>55715572
We're not talking about over-abstractions here, we're talking about a simple filter.

You have to be fucking pants on head retarded if you think
f = []
for i in range(2, n):
if n % i == 0:
f.append(i)


is a better, more Pythonic way of expressing the following
f = [i for i in range(2, n) if n % i == 0]
>>
>>55715562
I had to Google what static does inside a function. I had no idea you could do that.
>>
>>55715582
the bump limit is 310

I posted at 310

You sound like the retarded ass trapposter who is butthurt to didn't post that stupid fucking gif about malloc which by the way you always post even before the bump limit
>>
>>55715546
Been there. I've been doing 3D shit for 1 1/2 years and I'd say on a scale of noob being 0 to Carmack being 10, I'm probably 4.
>>
>>55715597
>I posted at 310
you fucked up

delete your internet
>>
>>55715572
List comprehensions are a simple idiom that every intermediate Python dev is familiar with. Experience shows that they are easier for a human to parse than for loops with if statements. They are also faster.
>>
// 'x' must be in the range [-8, 7]
void mod::sample_info::set_finetune(signed char x)
{
static constexpr uint8_t tbl[16] =
{ 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 };
this->finetune = tbl[x + 8];
}


cool i love c++ now

LITERALLY c but better

just compile without templates and rtti

(typed enums holy hell thats an useful feature for bit banging)
>>
>>55715591
i'm just saying that if you use that syntax everywhere (that "simple" filter) it'll be a lot harder to read.
it's easier to read when used in a simple case like that (heck, i'm the anon that wrote the original code that you're defending).
i was merely criticizing your criticism for languages like C for not providing mathematical notation by default.
after many hours of working with others in functional langs, i don't trust other devs with operator overloading or alternative syntax anymore for large projects.
this stuff and lots of mathematical expressiveness is absolutely awesome for scripts and other programs that aren't read as much, though.
>>
>>55715611
>intermediate
Hell, list comprehensions is a thing I learned in the second lecture in my intro to Python class.
>>
>>55715615
>LITERALLY c but better
you're up for a big surprise because that's not how everyone else uses it
>>
>>55715627
>i'm just saying that if you use that syntax everywhere (that "simple" filter) it'll be a lot harder to read.
Your point is fucking irrelevant, I never said anything about using it "everywhere", I'm talking about anons bloated and verbose code in specific, as he -- according to himself -- was """"showcasing"""" python and comparing it to Haskell (and, implied, arguing that Haskell was better than imperative Python).

>i'm the anon that wrote the original code that you're defending
You're not, because I am.
>>
>>55715611
i'm not so sure about that.
i used to use list comprehensions for everything and even devs that were familiar with them and used them regularly got confused.
>>
>>55715615
>LITERALLY c but better
This is how I feel half the time using C++. Once you see the borderline perverted code that goes into C++ standard libraries your opinion is bound to change a little.
>>
>>55715659
>i used to use list comprehensions for everything
LOL WHAT A RETARD
>>
>>55715530
as I've explained, I didn't try to make an effficient factorizaion / prime function, hence the slowness

it think the way I wrote it is ok
functions are meant to be reusable, thats why I made factors a function, meant to be used in different contexts

and as I said before too, im a newbie, I forgot about list comprehensions in python

you're right, I don't know python that much
but filter(predicate, list) returns an object
and filter is a class, and I know that classes are types with custom functions (or methods)
>>
>>55715549
toy langs are productive
>>
>>55715671
>as I've explained, I didn't try to make an effficient factorizaion / prime function, hence the slowness
I get it, I'm taking offence of your claim that it supposedly is """"showcasing"""" Python

>it think the way I wrote it is ok
It's not, you are writing Python in a very imperative way, which is bad, m-kay.

>and as I said before too, im a newbie, I forgot about list comprehensions in python
But you obviously knew about filter, so why didn't you use that?

>but filter(predicate, list) returns an object
Yes, that object is a list.

>and filter is a class, and I know that classes are types with custom functions (or methods)
No, it's not, it's a built-in function. Read the specification.

https://docs.python.org/2/library/functions.html#filter
>>
>>55715664
i dont use the standard libs and im not losing nothing

its v. good imo
>>
>>55715700
>>55715671
>>> type(filter)
<type 'builtin_function_or_method'>
>>
>>55715635
>because that's not how everyone else uses it
Java but with raw memory access for idiots to abuse, yeah?
>>
>>55715684
there's not much mystery to it tho
>>
>>55715490
>"is" compares identity, not value.
Oh okay, carry on then.

It's still dumb, but oh well.
>>
File: 2016-07-23-092531_633x404_scrot.png (12KB, 633x404px) Image search: [Google]
2016-07-23-092531_633x404_scrot.png
12KB, 633x404px
>>55715700
what about this?

also, whats bad about imperative code
python isn't inherently functional
its multi paradigm, right?
>>
>>55715723
its so good
>>
>>55715773
whats that typeface?
>>
>>55715735
technology is for the purpose of productivity
having fun is a mere side effect, not the primary goal
thus, the most productive languages are the best in the technological sense, thus toy languages are the best
this is why you see scientists over at google using python for neural networks / big science
>>
>>55715794
termsyn
>>
>>55715796
>this is why you see scientists over at google using python for neural networks / big science
that's not why, it's just the only language they know
>>
>>55715810
theres a reason for why academia loves scripting langs

before python it was perl

fast dev iteration + simpler semantics
>>
>>55715844
> theres a reason for why academia loves scripting langs
same exact reason kids love it

>before python it was perl
no, it was R
>>
>>55715874
>no, it was R
depends on the field i guess, i know in euro molecular chemistry they used perl 100%

ofc it was always fortran for the heavy lifting
>>
>>55715902
>depends on the field i guess
yeah, but you mentioned neural nets (so stats and ML)

R is a lot faster than python's C libs, btw

python is being developed by poor programmers
>>
>>55716027
ah that wasnt me
just butting in :^) dont know a heck about ML meself
>>
>>55715773
>he fell for the python3 meme
I'm out if you can't even tell the difference between Python 3 and 2.
>>
>>55715874
Academia loves scripting languages because students can't comprehend languages with static types and don't write big programs yet where scripting languages are notorious for bugs.
>>
>>55716580
>Academia loves scripting languages because students can't comprehend languages with static types
baseless projection
> don't write big programs yet where scripting languages are notorious for bugs
they dont need to and thats a plus
>>
how do I find a value in a python dict and then print both it and also the key it was found in?
>>
>>55711542
C by K&R
>>
>>55711471
In ruby, is it possible to make a file_field that immediately activates "submit" as soon as a file is selected to be uploaded? An example of this would be to click the file upload button, select a picture you want to upload, and the moment you've made your selection it's uploaded without having to click any additional buttons. One mainstream website that has this feature is imgur.
Thread posts: 357
Thread images: 32


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

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


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