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

/dpt/ - Daily Programming Thread

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

Thread replies: 316
Thread images: 25

File: 1484942237692.jpg (137KB, 1366x768px) Image search: [Google]
1484942237692.jpg
137KB, 1366x768px
What are you working on, /g/?

Old thread: >>58673352
>>
Thanks for not using an anime picture.
>>
>>58681253
You wish.
>>
>>58681139
Refactoring my javascript program to be maintainable
>>
>>58681279
I hope it's browser-only program.
>>
Trying to set light in my OpenGL future game.
>>
>>58681297
It runs on Electron, so no (node.js)
>>
File: 1469611310961.jpg (5KB, 370x334px) Image search: [Google]
1469611310961.jpg
5KB, 370x334px
Is it okay to leave a variable initialised?
int abc;

if(condition)
abc = 15;
else
//finish the rest of the program


And is this a better practice?

int abc=9999;

if(condition)
abc = 15;
else
//finish the rest of the program
>>
>>58681314
fag
>>
>>58681315
>
if(condition)
abc = 15;

I meant
if(condition)
abc =abc*0+ 15;
>>
>>58681315
It doesn't make difference, if you set value in the ELSE block.

>>58681333
Why?
>>
>>58681315
I've seen it both ways.
>>
>>58681353
I don't set the value in the else block, it's a throwaway variable for performing a certain loop.

>why
you can't re-set a variable within the same scope afaik. (C)
>>
>>58681375
you can though
?????
>>
>>58681253
That is an anime, you fucking moron.

Sage this fucking cancer.
>>
>>58681375
>you can't re-set a variable within the same scope afaik.
Who did ever say that to you?
>>
is there anyone developing C++ on windows machine? how good it is? last time I tried (3 years ago) I struggled very hard to install some libraries. how is developing in general?
>>
File: 1484951828869.jpg (106KB, 560x510px) Image search: [Google]
1484951828869.jpg
106KB, 560x510px
>>58681397
>>
>>58681397
>lisp is anime

butthurt weaboo subhuman detected

go back to
>>>/a/
>>
File: 1455028508663.png (100KB, 1920x1080px) Image search: [Google]
1455028508663.png
100KB, 1920x1080px
>>58681387
>>58681402
No one, I found it out myself. I'm pretty new to this, teach me how to
>>
>>58681402
Not him, but I bet it was some Haskell fag.
>>
File: 1484178855691.jpg (75KB, 630x551px) Image search: [Google]
1484178855691.jpg
75KB, 630x551px
>>58681438
>>
>>58681438
Once you give abc a type, you don't need to say it again. Take off the second 'int'
>>
>>58681429
That's a literal screenshot from a chinese animated cartoon, idiot. Reverse image search it, fag.

>>58681427
Stop trolling people with this shit, it's not funny anymore.
>>
>>58681429
That's a shot from Serial Experiments Lain, bro.
>>
>>58681438
To set a value, you just write abc = 19;
In int abc = 19; you try to re-declare already declared variable.
>>
>>58681417
works on my machine :^)
>>
>>58681475
>>58681482
Ah got it, thanks.

But is it still a good practice to leave a variable uninitialised?
>>
>>58681417
C++ is shit.
>>
Daily reminder that C stands for cancer.
>>
>>58681483
putting stuff into PATH is fun
pretty bad without auto-updates
MSYS2 and MinGW probably be okay
>>
>>58681520
>le edgy
>le returning from le reddit once again
>>
my teacher wants us to choose a project in html/css and a few php
can someone give me ideas?
i have no idea at all
>>
File: 1467533252971.png (68KB, 1319x465px) Image search: [Google]
1467533252971.png
68KB, 1319x465px
>>58681417
>Developing in windows
>>
>>58681511
i personally leave them uninitialized unless i need them right away.
>>
>>58681511
It's good practice to only have the variable exist in the smallest possible scope where it can be used. This is one of the reasons for breaking your code up into smaller functions instead of making everything a global and jumping around with GOTO.
>>
>>58681540
a webpage to phish passwords
>>
File: 1484946898225.jpg (276KB, 1920x1200px) Image search: [Google]
1484946898225.jpg
276KB, 1920x1200px
>>58681479
>trolling
I don't know who can be _trolled_ by anime pictures.
Have a (You).
>>
>>58681483
that's nice, are you using some special libraries? I'm developing a physics engine, but the final user want it done for windows for their tools, but still wanting linux compatibility for future proof.
>>
>>58681540
Make an imageboard.
>>
>>58681538
let's not pretend to make c++ something it's not, shall we?
>>
>>58681582
Nagato only pls
>>
>>58681546
dank? dunk? bud?
>>
>>58681598
>shall we
who are you of relevant?
>>
>>58681598
Name one widespread OO language to make native applications.
>>
>>58681582
>haha it's your fault for getting trolled by unrelated shit
Fine, I'm gonna start flooding this fucking board with pictures of Brazilian soccer players then.
>>
>>58681621
Object Pascal.
>>
>>58681650
Why do you evade your ban?
>>
>>58681621
There certainly aren't any good ones, that's for sure. :^)
>>
>>58681650
>widespread
>>
>>58681653
>only one guy likes pascal

>>58681663
It is though. It runs on all platforms and is a lot more popular than a lot of meme languages /g/ keeps memeing.
>>
>>58681654
and you aren't doing one, so fuck off
>>
>>58681621
Ada, you can even shit it up with your trash c++ code if you don't want to rewrite it
>>
>>58681672
>being this mad because his favorite language is shit
You'll come around eventually.
>>
>>58681692
my favorite language is scheme, C++ does the job, and you are faggot (and a worthless one btw)
>>
>>58681706
>not using CL
>not using a Lisp-2
Wow! Scheme is pretty useless. Just when I thought you couldn't sink any lower.
>>
File: 1484694140039.jpg (117KB, 435x750px) Image search: [Google]
1484694140039.jpg
117KB, 435x750px
>>58681728
>lisp-2
Ew groce.
>>
How long does it take to compute a square root compared to multiplication or division on a floating point number
>>
File: WTF_I_LIKE_PASCAL_NOW.png (16KB, 942x667px) Image search: [Google]
WTF_I_LIKE_PASCAL_NOW.png
16KB, 942x667px
>>58681667
>and is a lot more popular
Indeed, lol.
>>
>>58681728
>Scheme is pretty useless
show us those great projects you have done with CL then, fartfag
>>
>>58681746
Enjoy your worthless macro system. :^)
>>
>>58681728
Lisp-2s are bloated, complex, old garbage where as LISP-1 are simple, small, and get the job done in less time.
We even have ported CLOS and have better object systems
>>
>>58681761
By "a lot of meme languages", I was referring to crap like Go, Rust, Haskell and a lot of shit /g/'s always memeing. Also, according to your own source, it is growing.
>>
>>58681139
Verifying XAdES-BES
>>
>>58681796
>Haskell
We are talking about OO languages now.
>>
Thoughts on CakePhP?
>>
File: 5385519400.jpg (30KB, 425x382px) Image search: [Google]
5385519400.jpg
30KB, 425x382px
Why are you guys always angry and triggered?
>>
>>58681828
Sexual frustration.
>>
>>58681820
Rust isn't OO either, you fucking moron.
>>
>>58681828
I can't get a developer job with my skills on haskell, but my friend got that job doing java, that's why I hate those mainstream languages so much
>>
>>58681762
Are you literally shaking yet? There are many useful projects developed in CL. Hell, CL flew aboard NASA projects. Just accept your shitty Scheme will always be a toy language.
>>
>>58681854
The difference is, I don't care about Rust.
>>
is it autistic to code just for "fun" like im neet ill never make the big bucks programming but i do enjoy it whenever something actually fucking works that i code.
>>
>>58681865
it is indeed, so I'm using C++ for doing real task, not repeating again degree homework every day
>>
>>58681820
You can do OO in any language, it's a programming language-independent architectural design pattern. Of couse, some languages implement syntactic sugar and features that facilitate the process. We say those follow the "OOP" paradigm because they encourage you to follow an object-oriented architecture, but you can code in a non-object-oriented manner in those languages too.
>>
>>58681858
Get a scala job

Just learn the cats library and you're good to go with haskell on top to show you know what you're doing
>>
>>58681873
I don't care about what you care.
>>
File: 33877479039257.jpg (327KB, 1110x684px) Image search: [Google]
33877479039257.jpg
327KB, 1110x684px
>>58681858
Fuck you, you false flagging nigger. I already tracked your IP and I'm gonna kill you and your family tonight.
>>
Does anyone know how to create a diamond using strokepolygon in javafx?
 lienzo.strokePolygon(new double[]{60, 90, 60, 90},
new double[]{210, 210, 240, 240}, 4);
>>
>>58681886
nope, it's like drawing for fun
>>
>>58681891
scala is too mainstream for me, I would prefer a job in some lisp dialect, but not clojure, because jvm is shit
>>
>>58681886

yeah it's autistic

but that's a healthy hobby
>>
>>58681786
>a million broken CLOS reimplementations with missing features
>better
Yeah, sure buddy. Keep telling yourself that. :^)
>>
>>58681901
I don't care about what you don't care.
>>
fuck java
fuck java
fuck java
fuck java
fuck java
fuck java
>fuck java
fuck java
>fuck java
fuck java
>fuck java
fuck java
>>
>>58681820
Haskell doesn't need OOP as it's like scheme where you can easily make objects as functions. Heck just throw together the State monad and a few local functions and you have your OOP
>>
>>58681938
i approve of this post
>>
>>58681865
still waiting for your great projects faggot
>>
>>58681933
So looks like we finally agree about something.
>>
>>58681917
Scala is haskell if you use the cats (category) library
Also stop being an autistic fuck and bite the bullet for once, you can interface with scala from haskell if you really want to but first you need the job right?

Also... good luck getting a lisp job that's not clojure since there are almost none advertised externally.
>>
>>58681955
Yes.
Haskell is great.
>>
Is there any way to call a function on every instance of a class in python?

instead of doing like:

a = thing()
b = thing()
c = thing()

a.do(2)
b.do(2)
c.do(2)
>>
Finally got RSA keys to import and export in BasicTV. Now i'm starting work on a telnet based console to control basic functions and variables.

After that, Opus compression, and some finalizing with networking, it'll be ready for a testnet release.
>>
>>58681977
if I wanted to bite the bullet I would be doing java or C
I want to raise my protest here on /g/ and
say the world that even if we are a
minority, we hate C++ so much
>>
>>58681996
No.
>>
>>58681886
You should try out the game
SHENZHEN IO.
It is a fun game where you solve really simple puzzles using a made up asm language.
Then when people ask you what you are doing, just say you are playing a game.
>>
>>58681990
It sure is, it's still a meme language though.
>>
wtf is "Rust" is it a meme language?
>>
>>58682020
Scala is awful, don't learn it
>>
>>58682065
too late, I already know it, if not it would be a blind hate
>>
>>58681315
Uninitialized variables are fine as long as you don't read them.

But it depends on the language. Some just initialize variables willy nilly.
>>
>>58681139

What esoteric programming language is that on the screen?
>>
>>58682090
common lisp
>>
I want to learn a Lisp.

Should I learn Clojure so I can use my Clojure knowledge to do dump ClojureScript stuff?

Or is Scheme/Racket better?
>>
>>58682061
Fuck if know, why not asked reddit? they seem to know more about it.
>>
>>58681954
>what is DART
>what is Mirai
>what is Deep Space 1
>what is Viaweb
>etc. etc.
CL is for getting shit done, Scheme is a toy, and C++ is shit.
>>
>>58682090
>defun
would say clojure, but jvm is shit
>>
>>58681996
If they're stored in an array (or whatever they're called in python) you can iterate over them and call the functions.
>>
>>58682112
Clojure or Common Lisp, your pick.
>>
>>58681417
I'm doing Windows VS2015, Linux cross dev. It is pretty smooth if you know what you are doing.

Modern C++ can be made to look very slick. Templates are duck typing for C++ and lambdas are nice.
>>
>>58682118
>lol I will pick some software I never did nor read the source and put on the imageboard that isn't my beloved reddit, he will never say that it's not my software
>>
File: 1446690994248.png (123KB, 633x758px) Image search: [Google]
1446690994248.png
123KB, 633x758px
>>58681858
Yeah good luck getting a job knowing ONLY haskell.

If you're too dumb to learn mainstream languages AND esoteric languages no relevant company would use, then you were never capable of working at a real job anyways.

My current job has code from 6 languages across the various systems and tools I work on. C#, Powershell, Ruby, Javascript, F#, and Rust. And I don't cry about having to use them, I just do.

You're a fucking loser kid. Just accept it. You'll never learn a mainstream language because of pride. You're a joke. You're the kind of guy me and my co-workers make fun of everyday.
>>
>>58681828
It's suppressed feelings of inadequacy from not having done what I consider serious projects despite every external metric would put me above at least 95% of employed programmers worldwide.
They surface as projected hate.
You're not good enough because you haven't done what I haven't accomplished yet.
I wish this wasn't the case.
>>
File: udy1nj7i27ae6xzzsa1a.jpg (28KB, 620x470px) Image search: [Google]
udy1nj7i27ae6xzzsa1a.jpg
28KB, 620x470px
>>58682156
>You're the kind of guy me and my co-workers make fun of everyday.
>programmers making fun of people
Oh God, my sides.
>>
File: yuki_k&r.png (350KB, 500x492px) Image search: [Google]
yuki_k&r.png
350KB, 500x492px
>>58681607
no problem
>>
File: 1471606885381.png (28KB, 470x241px) Image search: [Google]
1471606885381.png
28KB, 470x241px
>>
>>58682173
We've been made fun of for so long that we've learned to adapt and return fire in ways that cut to the core.
>>
>>58682149
>"gibberish etc"
Maybe if you focused your anger into something more productive, you'd finally come to terms with reality. :^)
>>
>>58682189
No. But I'm not in a position to make you believe me because I would recommend C# over Java. But neither of them are languages I'd use over C99.
>>
>>58682209
Keep at it, dude. One day it might stop the pain.
>>
>>58682156
this sexist white supremacist society is wrong, that's why C++ and java are so popular instead of common lisp. I hate you for not resisting the system.
>>
>>58682189
>4chan meming on twitter
Proof once and for all that those who defend Java are cancer
>>
>>58682237
>How to spot winshills.txt
>>
There is literally nothing wrong with C++
>>
>>58682249
Are you seriously saying >>58682189 is acceptable?
>>
ANON WTF ARE YOU DOING? YOU HAVE 10 SECONDS TO EXPLAIN WHY YOU AREN'T USING NIXOS
>>
>>58682156
Today's coding practices are a social construct. They aren't real. Haskell is pure and just as beautiful as the other languages.
>>
>>58682156
>I use tons of languages and I accomplish tasks
You always find that the people who do the least steer away from what their job is. Your programming languages are not your job.
You should be excelling at efficiently producing software solutions.
>>
>>58682262
it's mainstream, and the kids on /g/ don't like that because some Marx propaganda and stuff.
>>
>>58682271
What happened?
>>
>>58682271
i'm straight
>>
>>58682189
LOL THE 4CHAN IS LEAKING AGAINZ XDDD
>>
>>58682271
I-i don't know! I guess it start using nixos?
Is it associated with Richard Nixon somehow?
>>
https://msdn.microsoft.com/en-us/library/4e2ess30.aspx

>Theclockfunction tells how much wall-clock time has passed since the CRT initialization during process start. Note that this function does not strictly conform to ISO C, which specifies net CPU time as the return value. To obtain CPU times, use the Win32GetProcessTimesfunction. To determine the elapsed time in seconds, divide the value returned by theclockfunction by the macroCLOCKS_PER_SEC.

What the FUCK microsoft? Why intentionally create an api that doesn't follow EVERY FUCKING STANDARD describing it?
>>
>>58682262
Except constructing a parse tree for it is undecidable. Isn't ambiguity a great thing?
>>
>>58682156
Why are you bragging on 4chan that your system is a mess?
>>
>>58682271
Can't get it to build and don't want systemdicks
>>
In python, I have two classes:
classA(I,j)
classB(classA)

How do I take classA parameters and use them in a classB function?
I'm noob to python
>>
>>58682189
thanks
>>
What textEditor/IDE do you use.
Im making my own because Emacs was too complicated, and everything else is shit.
>>
im going to code in java and enjoy it, and you cant stop me.
>>
>>58682297
Are you implying there's anything wrong about not being straight?
>>
>>58682283
Thanks Mr. Manager.
>>
>>58682324
freedom isn't decidably free
>>
>>58682347
Visual Studio Code
>>
>>58682347
>Emacs was too complicated
Not really, assuming you don't go changing everything
>>
>>58682348
Come back when you're ready to be enlightened.
>>
>>58682316
>Why intentionally create an api that doesn't follow EVERY FUCKING STANDARD describing it?
Shitty dev (98% of devs) will use it and produce not portable code. M$ know what they're doing.
>>
>>58682349
That's why it's called straight
>>
>>58682347
QtCreator for C, C++ and QML
Atom for Nodejs and Web stuff
Vim (+ plugins) for eveything else
>>
>>58682387
>le returning from le reddit again
>hurr durr le lol
>>
File: 1468584233786.gif (2MB, 1920x1016px) Image search: [Google]
1468584233786.gif
2MB, 1920x1016px
>>58682347
I use Vim and some plugins. VS can suck my dick.

Have you tried spacemacs?
>>
>>58682376
Emacs seems like the only one to have many of the features i want, but to turn them on and use them...
And if it doesnt have it, i dont want to tackle lisp rn.
>>
>>58682394
That's problematic, son.
>>
>>58681996
>>> map(lambda foo: foo.isalpha(), ('f', '1', '@'))
[True, False, False]
>>
>>58682328
THEN USE GUIX FAGGOT
>>
>>58682325
>systemS

There was a plural there you retard. If you can't read english, you probably can't read code, so you're probably a total fucking idiot IRL.
>>
>>58682401
Never heard of it, it totes as _advanced_ emacs?
I want a adv txt editor that doesnt require learning its 20year dev cycle before i can fully use it.
>>
>>58682441
Vim
>>
>>58682391
Yeah no, if a shitty dev uses clock() as per every tutorial and information online to measure cpu time, his code will actually run better in an ISO C conformant system. I literally see no reason to do that other than just to be a dick.
>>
>>58682450
They (M$) always fuck with the standard to prevent portability.
>>
File: 1485147174946.jpg (150KB, 724x950px) Image search: [Google]
1485147174946.jpg
150KB, 724x950px
>>58682434
Why are you bragging on 4chan that your systemS are a mess?
>>
>>58682478
This may blow your mind but a company with 10,000 employees uses multiple programming languages depending on which is better suited to the task.
>>
>>58682316
Ada doesn't have this problem
>>
>>58682508
pareto law will still hold: 8000 employees will use 2-3 languages and do their job in 20% of the time, while the other 2000 will take 80% of the time boasting that functional paradigm is better
>>
>>58682508
I'm not actually the guy who was originally winding you up, I just joined in because you seemed easy to trigger :)
>>
>>58682541
>the other 2000 will take 80% of the time boasting that functional paradigm is better
so they only take 20% of the time to do the job?
guess functional IS better
>>
>>58682548
I am easy to trigger. Once I get triggered, I trigger other people as quickly as I can. If it doesn't seem possible, I then move on. If it seems possible, I will make sure they feel bad once I'm done with them.

I do like to shit talk little nooblords.
>>
does anyone know how to quantify CPU cache behavior in a way that isn't misleading? i'm using likwid to capture l1, l2, l3 hit ratios, rates, bandwidth etc. but the numbers are very tricky and misleading, for example you might have poor bandwidth at the bottleneck or anywhere beneath it

it would kick ass if there was some statistic where "this goes up, it's good, this goes down, it's bad"
>>
>>58682568
Keep at it, bro, it's very entertaining to watch.
>>
>>58682347
Currently I'm only doing C++. I use Atom, clang and debug in netbeans.
I'm surprised people recommend sublime over Atom. I used it for a little while and it was just not doable. Atom is just very simple. Coffee script looks a bit weird though so I haven't written any packages for it yet.
>>
>>58682617
C++ is shit
>>
>>58681540
Produce a website that showcases a short history on computers.
>>
>>58682595
Tools are very poor at attributing timings to the right instructions. None I have used do it right. But in general it's not super important.

Unrelated:IACA is great. If you're not already using it I suggest you do.
>>
>>58682630
It is but it's also the best option I have.
>>
>>58682617
Atom is Chrome adapted to edit text; it's largely written in JavaScript, and will shit the bed with large files.
>>
What "meme" languages are useful to learn?
I know only Haskell.
>>
>>58682697
>meme language
>useful to learn
Here's a complete list:
>
>>
>>58682697
All of them.

But if you want really useful, learn a logic language. They're slated to 'solve' distributed programming.
>>
File: 1449193733171.jpg (57KB, 567x561px) Image search: [Google]
1449193733171.jpg
57KB, 567x561px
>>58682607
will do m8y
>>
>>58682697
CL of a Lisp-2 will do better
>>
>>58682262
it's too hard to compose iterators with the standard library's start,end idiom. it makes functional code that ought to be concise very verbose, and puts a major hole in C++'s claim that it's a mixed idiom language

for printing and logging << is inferior to string interpolation in almost all cases

template metaprogramming was not designed and it shows. there are lots of quality-of-life features that TMP should have, but the adoption has been incredibly slow. in particular, holy fuck Concepts need to be in the language, they're fucking urgent but they've been delayed every version

it's still the best language
>>
>>58682716
Yeeeahbuddy.
>>
>>58682728
>concepts
>ranges
>modules
all things C++ desperately needs
all delayed

>variants
>optional
ruined by shitty short minded "lol OOP is great, FP is just a meme" twats
>>
>>58682712
>They're slated to 'solve' distributed programming.
for decades, "solving" distributed and parallel programming have been the go-to "applications" for abstruse PL research. it never pans out. SQL is the only success and people hate it for some reason. even MapReduce had more impact in this space and it's fucking garbage
>>
>>58682728
The only thing I really hate of C++ is preprocessor. But I write very low level algorithms and use very little the STL
>>
>>58682707
>he doesn't parse doublequotes
>>
>>58682771
SQL isn't a logic programming langauge.
>>
>>58682690
How large is large? I have 100k loc and that works fine on my machine. Though really I don't see how anything could shit itself over editing text.
>>
>>58682771
How does SQL 'solve' distributed programming?

(I initiated the distancing quote marks for essentially the reasons you've just outlined.)
>>
>>58682774
But there's no connection between the two things you mentioned.
>>
>>58682827
It doesn't. PL/SQL does.
>>
>>58682837
There is. He's clearly stating that he's not exposed to C++ on the whole and he's complaining about something he mostly can't avoid.
>>
>>58681938
>fuck java
No. I don't want to have Oracle on me.
>>
>>58682827
strictly within the constraints of the language, an SQL statement expresses a program whose implementation can be very complicated both algorithmically and as a system. i won't go into the algorithmic shit, but a distributed database has to deal with consistency/versioning, live-and-deadlocking, data partitioning and replication, minimizing network traffic, i.e. the concerns of any serious distributed system. SQL almost entirely isolates you from all of these concerns, you never have to ask yourself questions like "should I pull the data to the computation or push the computation to the data?"
>>
>>58682972
I probably should have phrased that as 'does SQL solve distributed programming?', because it's not generally felt to be a 'solved' problem.
>>
File: wtf.png (146KB, 1920x1080px) Image search: [Google]
wtf.png
146KB, 1920x1080px
Why doesn't this work?

Its just supposed to take a single digit number and check if it is prime.
>>
>>58683039
delete this
>>
>>58683039
is this a meme?
>>
>>58682748
How is optional ruined? Looks pretty functional to me.
>>
>>58683109
Amusing reply.
Where's map? Bind?
>>
>>58682112
Racket is better because it isn't tainted by Java.
>>
>>58683134
Also it has TCO.
>>
>>58683130
I really don't understand. How does that relate to optional?
>>
>>58683033
SQL solves distributed ~programming~ for a very limited but extremely common and important class of programs. there's still a shitload to do in the actual backend, and there's a lot of programs that can be distributed that SQL cannot adequately express, like many graph algorithms

if you view programs as transformations of data, then there's a lot of "database-like" research systems that are intended to make authoring data transformations easy and shield you from the distributed framework. Spark and MapReduce are (shitty, but popular) examples of such systems, they don't have a "language" but they do have an extremely simple programming API that completely black boxes the distributed computing elements. MR has been stable long enough that languages have been built on that API, i think that's inevitable for any popular system with a stable API but lots of these are unstable research systems.

often when people talk about PL "solving" distributed computing they mean some kind of highly general compiler that extracts amorphous parallelism or whatever from a program without any markup. we're pretty far from achieving that but we've had "general purpose distributed computing engines with a simple API" for decades in the research community. i use Galois from UT Austin a lot
>>
>>58683164
You have an optional value.
You want to transform the data it contains, if it contains data.
(Map)

Maybe your transformation itself returns an option, and you end up with optional<optional<x>>.
You want optional<x>, so you use join. (map + join = bind)
>>
>>58682401
Got any resources for learning to write lexers and parsers? I'm kinda shit at it.
>>
>>58683285
Parsec is pretty idiot-proof.
>>
File: Screenshot (3).png (173KB, 1920x1080px) Image search: [Google]
Screenshot (3).png
173KB, 1920x1080px
It worked when I changed the variable for value to a basic int.

Seems like the Switch doesn't take fixed width integers.

Any criticism of the program would be nice.
I know its useless but regardless is it made well?
>>
really dumb question but i dont put my .db file in the main directory of my app right? somewhere on the C drive or something right? it doesnt need to be where my main site files are right?
>>
>>58683327
that's not the way to check for primes m8y
>>
why am i so bad at project euler
>>
>>58683327
It's alright.

Please use code tags to post your code tho.
>>
>>58683378
It's hard man, but what would the fun of it be if it was easy?
>>
>>58683400
problems 1-25 are meant to be "level 1" but i spend hours and hours on them :(
>>
>>58683372
I know m8y, I've made an actual prime checker.

Excuse the retarded variable names

//46337 is the highest prime this will give you (I think)
//Sieve of Eratosthenes
import java.util.Scanner;
public class numbs {
static Scanner scan = new Scanner(System. in );
public static void main(String[] args) {
System.out.print("Enter limit (will list all primes under this number): ");
int brala = scan.nextInt();
boolean[] vampire = new boolean[brala];
int[] blood = new int[brala];
for (int a = 2; a < brala; a++) {
blood[a - 2] = a;
vampire[a - 2] = true; }
for (int a = 2; a < brala; a++) {
for (int b = 2; b < brala; b++) {
if ((blood[a - 2] * b - 2) < brala) {
vampire[(blood[a - 2] * b) - 2] = false; } }
if (vampire[a - 2] == true) {
if (blood[a - 2] >= 2 && blood[a - 2] <= 9) {
System.out.print("000" + blood[a - 2] + " ");
} else if (blood[a - 2] >= 10 && blood[a - 2] <= 99) {
System.out.print("00" + blood[a - 2] + " ");
} else if (blood[a - 2] >= 100 && blood[a - 2] <= 999) {
System.out.print("0" + blood[a - 2] + " ");
} else {
System.out.print(blood[a - 2] + " "); } } }
System.out.println(); } }



I'm just doing simple stuff to get a used to C++
>>
>>58683285
use parsec
>>
>>58683415
You're learning man, noone started out good at programming.
>>
>>58683430
>Excuse the retarded variable names

I can't.
>>
>>58683430
Changing the names would have been about the same amount of work as warning us about them.
>>
>>58681315
>>58682088
This is why the knee jerk thing is to make sure all variables are assigned a value. It's a good general practice that turns into life or death in some languages and a style thing in others.
>>
What are the most prominent features of pajeet code?
>>
>>58683565
It smells like curry and self-loathing.
>>
>>58683565
no indention
>>
>>58683565
>pajeet code
if { else if { else if { else if { else if { else if { else if { else if { else if { else if { else if { else if { else if { else if { else if {

And absolutely no use of classes
>>
>>58681938
I took a Java class. Should I learn python? What are good projects to do
>>
i can't seem to get a way to do this

let's say I have this function
let poopShape (a: SomeGL) (b: Shape) =
a.draw(b)
()


Shape is a sum type of
type Shape =
| Circle of Point
| Square of Point


SomeGL is a type with member
draw : a:Point -> unit



Anyway to "convert" a sum type Shape into a Point? Or just have it pass into the draw function
>>
>>58681621
c# has .NET native
>>
>>58683607

learn a real language that starts with a C and does not contain any other letters or # symbols
>>
>>58683573
>>58683577
>>58683594

Why are they still being hired by top companies if they're so shit?
>>
When will they make a C+++?
>>
>>58683693
they did, its called C+=
>>
>>58683676
What is the most useful, aesthetic and FUN?
>>
>>58683689
I never said they were shit, I said their code smelled like curry and self-loathing.
>>
>>58683727
C++
>>
>>58682189
>C#
>shitty

It's actually Java but orders of magnitude better
>>
>>58683039

>pstdint.h
Why not just <cstdint> or <cinttypes>? Your code isn't portable.
>>
>>58683327
It's because you're reading a character, and the ascii code for the character gets placed into the int8_t. '5' = 35 in ASCII.
>>
>>58683858
Sorry, meant 35 in hex, 53 in ASCII.
>>
Why do people have babies when they could write programs?
>>
>>58683885
because babies are AI which you can fine tune
>>
>>58683778
Look at the sidebar. It seems to be a user-supplied library focusing on actually being portable.

Look at the header in http://www.azillionmonkeys.com/qed/pstdint.h
>>
>>58683907
very fragile AI
>>
>>58683918
in the beginning as it absorbs facial recognition, speech, problem solving, etc.
>>
>>58683727

That's the spirit
>>
>>58683430
>not using single character variable names like a leet hacker
>>
>>58683916

But stdint.h is portable. It works on every standards compliant C11 and C++14 compiler.
>>
How do I run a python script from emacs?
>>
Ed, ex/vi, and emacs are the only editors that matter. Rest are either trying to be special snowflakes or are no better than notepad.
>>
What are some cool programming blogs, m8s.
>>
File: Screenshot (3).png (140KB, 1920x1080px) Image search: [Google]
Screenshot (3).png
140KB, 1920x1080px
>>58683778
They dont work
>>
>>58683134
Racket is good. I'm a CL fag myself, but Typed Racket in particular has caught my eye.
>>
>>58683995
Have you tried reading the message?
>>
>>58683995
Because your system and compiler (crappy windows GCC port) are neither compatibile with the ISO C nor the ISO C++ standard.
>>
>>58683974
>notepad++ is notepad with syntax highlight
>geany is the notepad++ for linux.
>Sublime Text is what a modern code editor is supposed to be but overpriced.
>Atom, VSCode, are for the autistic kid that like to run ChromeOS
>Vim is the utility tier. Everyone need to learn but without basic shit like multiline cursor it's a bit of a hell being productive. To harvest the best here you need a lot of tweaks. Where this tweaks are implemented on Sublime Text
>>
>>58683778
>C/C++
>Windows
>Portable
>>
reading SICP but using Haskell instead of Lisp
>>
>>58684068
>Windows
>Portable
pick one
>>
File: Screenshot (3).png (137KB, 1920x1080px) Image search: [Google]
Screenshot (3).png
137KB, 1920x1080px
>>58684013
Ya I have.

I don't want to use experimental shit.
Although with that said I realize why what I did is retarded.

>>58684031
I tried to make clang work for 2 hours but it fucking won't.
>>
Dude taking screenshots instead of using dpaste.de
>>
>>58683778
You can't have portable code on windows when MS does things like >>58682316 or not shipping stdint.h with its own compiler until 2012 (https://msdn.microsoft.com/en-us/library/hh874765(d=printer,v=vs.110).aspx - click "other versions")
>>
>>58684078
Did you pay close attention to the section titled 'Applicative order versus normal order'?
>>
>>58684045
>but without basic shit like multiline cursor
you mean like the vim visual modes ?
>>
>>58684134
Nope. Visual mode is the block edition. You really never used a modern editor though :D
>>
>>58684090
install gentoo
>>
>>58684129
if I understood it correctly haskell normally uses normal order and lisp normally uses applicative order...?
>>
>>58683689
they cost 1/4 the us programmer
>>
>>58684154
I don't see what can't be accomplished with visual mode that can't be with substitutes, macros, and/or the "." command.
>>
>>58684177
Pretty much, dude. Well done.
>>
>>58684188
s/Visual mode/multiline cursors/
>>
>>58684154
then wtf is a multiline cursor ? i can edit multiple lines easily using visual block mode but i hardly ever need to use it
>>
>>58683039
My guess is there's some undefined behaviour.
Every C++ program is a time bomb now days.
It could be something about cin and int8_t. Check if it's hitting your default case by changing it to true.
>>
File: fffffffff.jpg (40KB, 1026x359px) Image search: [Google]
fffffffff.jpg
40KB, 1026x359px
    int count = 0;
std::string s("0000000000000000000011111111111111111111");
//string s("0011");
do
{
next_permutation(s.begin(), s.end());
count++;
} while (s[0] == '0');
cout << count*2<<endl;

return 0;


this is the best i have managed and it's taking forever. am i an idiot
>>
>>58684226
it's because int8_t is really a typedef to a character type.
>>
Final time asking u guys,

Any idea why these 2 are returning different vals?
void *ptr = ((void**)struct.charArray)[0];
void *ptr = (void*) struct.charArray[0];

Its an array of chars just for masking purposes, i fill every 8 chars with a pointer.
Since index is 0 (for the test) the size of the array elements should matter.
>>
>>58684240
If it were that wouldn't be an issue.
But int8_t suggests its a signed 8bit. Not a char (uint8_t), unsigned 8bit.
>>
>>58684263
You're dereferencing a void**, I'm not sure that's legal.
>>
>>58684289
Of course dereferencing a void** is legal, it's just a pointer to a pointer.
>>
>>58684299
Oh yeah, I'm a retard
Fuck if I know, then.
>>
>>58684264
In pstdint.h it's
    typedef signed char int8_t;
>>
>>58684263
A good way to deconstruct this is realising that
val[0] is just *(val).
>>
>>58684312
Deceptive. But OK.
>>
>>58684240
>>58684329
That's why
operator <<
and
operator >>
are a retarded way to do input-output as opposed to a printf-scanf-format-like api.
>>
>>58684316

So this may be what im looking for?

void *ptr = ((void**)&(struct.charArray))[0];
void *ptr = (void*) struct.charArray[0];

i dont explicitly understand.
so if my struct has an embeded arrray (not a pointer) then
struct.charArray should return a character, right?
the same way struct.charArray[0] would.
If so i see the difference.
>>
Triple indirection looks so good in C

void ***ppp;
>>
>>58682189
Thanks for the cringe
>>
>>58683995

You are using an outdated version of GCC. Update it.
>>
is sicp even that good?
>>
what is the best way to do c winapi programming without visual studio. MSVC toolchain is not too bad but holy shit 12gb for desktop version of VS express is insane.

pelles c, mingw, or something else?

I have no interest in writing portable code.
>>
>>58684434
Yes

Unless you want to be a code monkey all your life
>>
>>58684439
winddk (get the Win 7 version), it's about 1.5GB and comes with the 2008 compiler and it includes an import library for msvcrt.dll so you don't need the bloated vcredist shit.
>>
>>58684442
but I heard the highest maths is trigenometry
>>
>>58684479
*highest maths used
>>
>>58684439
>Pelles C
>it's a thing
Had a chuckle.
>>
>>58681315
I'd say no. Always initialise variables.
Most compilers will give it a junk value that you might accidentally use.
In the event of dereferencing an uninitialised pointer, you can fuck things up by changing values at a random location.

It's pretty bad practise to just assume your variables will be nulled, on the occasion the above happens.
>>
File: 4357752539_d012ce380b.jpg (133KB, 500x375px) Image search: [Google]
4357752539_d012ce380b.jpg
133KB, 500x375px
Talked to some science bitches at my university today. They've got 20 years of data stores in excel spreadsheets, and a single sheet (of many, hosted on an ftp) contains 10,000 rows.

So I told them I'd help out. I noticed that they've got rows which will have columns like
Data 1997 | Data 1998 | Data 1999 | ... | Data 2017


So fixing their shit won't be as simple as converting xml to mysql. I need to convert a single row in excel into at least 20 different rows in SQL. They're not really sure what the advantage of using a SQL database is, but basically I told them that modelling their data is 1,000,000 times easier with SQL, especially when they need to search a 10,000 row excel spreadsheet.

Also, when searching a SQL db, the processing relies on the school's server, and when searching excel, it relies on your local machine (which is crap, generally)

So, I guess I'm working on a tool which converts excel sheets of poorly structured rows into relational tables in SQL, but does it without just a 1:1 conversion of XML to SQL queries
>>
>>58684235
Hint: There are 40 digits and you choose 20 to be 1's. How many ways are there to do this? There is a simple formula you can type into google to solve this.
>>
>>58684549
Do it the unix way. Just stream it through sed.
>>
File: 1483919428061.jpg (34KB, 600x815px) Image search: [Google]
1483919428061.jpg
34KB, 600x815px
>>58684549

I've used openpyxl to read excel sheets in Python. Maybe you could bring the excel data into a more manageable format in Python then do what you wish with it.
>>
>>58684556
wow dude that tip awakened something in me that i learned three years ago and i solved it 10 seconds after i read it
>>
>>58684549
hope you are getting pussy for this
>>
>>58684650
Haha no. Ive already got a job. I just always wanted to work with scientists
>>
>>58684549
1. automate exporting the files to csv
2. sed to replace '|' with ',' while handling quotes, pipe to psql
3. distribute on multiple machines using find | parallel if the data is large

Should be a small amount of time of work.
>>
>>58684549
Out of curiosity, how much disk space do the spreadsheets use altogether? You said there were 20?
>>
why are all the swagfags pushing python?

is python is a meme?
>>
>>58684822
>swagfags
swaggot
>>
>>58684759
No, there are a TON of spreadsheets. I don't have access to the ftp. I said that one spreadsheet would expand to 20 times the number of rows in SQL since they've got columns for each year in each row. So one row contains 20 years of data.
>>
>>58684932
To expand: a 10,000 row spreadsheet would expand to 200,000 rows.
>>
>>58684956
So.. You just need to flip it by 90°? Am I understanding correctly?

Also
>rows which will have columns
>>
>>58684972
No, not All the data is like this. A row might be like:

Tree Id | Tree Type | 1997 | 1998 | ... | 2017 | Average Tree Width
and a bunch of other data I don't understand. So instead I need to expand it to be like:

Tree ID | Data


and another that says

Tree ID | Tree Type


and each tree would populate twenty rows in the first table, and one row in the latter (hence the R in RDBMS)
>>
New thread: >>58685041
>>
>>58684439

MinGW-w64 is the only acceptable C toolchain on Windows.
>>
>>58684708
It's not so simple. 1 row in excel != 1 row in RDBMS
>>
>>58685103
>>58685123
>>
>>58681762
>>58681786
stop fighting about lisp dialects.

This is why there are fags shit posting about how great python is. As long as the lisp communities are in-fighting, we will never succeed.
>>
just got done writing a decision trees implementation in Common Lisp.
Thread posts: 316
Thread images: 25


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