[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: 325
Thread images: 36

File: hime ACNL.png (778KB, 400x720px) Image search: [Google]
hime ACNL.png
778KB, 400x720px
old thread: >>56328179

What are you working on, /g/?
>>
>muh data structures
>muh algorithms
>>
>>56334056
Designing a simulation for bacteria* evolution

*not meant to represent real-world bacteria

Also great pic
>>
File: i2a.jpg (118KB, 1000x750px) Image search: [Google]
i2a.jpg
118KB, 1000x750px
>>56334064
LOVE THIS MEME
>>
>>56334064
>muh datatypes
>>
File: akari eats chippus.png (131KB, 256x256px) Image search: [Google]
akari eats chippus.png
131KB, 256x256px
I'm slowly recreating 4chan in C!
http://akaribbs.mooo.com/

My new host VPS doesn't seem to support the clock() function.
>>
what's your excuse for being in /dpt/ right now
>>
>>56334104
putting off going to sleep
Have to wake up at like 8 to buy my girlfriend a calculator for her test at 9:30.
>>
File: 1468472224634.jpg (61KB, 990x557px) Image search: [Google]
1468472224634.jpg
61KB, 990x557px
>haskell
>>
>>56332717
>Also, what the fuck am I supposed to do about that one Anon who keeps asking where his "mummy" (you) is?

He'll stop eventually. I hope.
>>
>>56334098
Source code when senpai?
>>
>>56334056
I made the mistake of signing up for an online C++ class.
>>
File: 1470074615846.jpg (20KB, 480x514px) Image search: [Google]
1470074615846.jpg
20KB, 480x514px
>java
>>
>>56334122
kuk
>>
>>56334098

CGI is cool.
>>
>>56334203
The worst it can happen is that people start singing. https://www.youtube.com/watch?v=xF0-LGoXtaw
>>
>>56334203
If it's online, that means the class is supposed to be bullshit.
Take a chill pill. You're not going to be mallocing and freeing while dynamically passing function pointers to pthreads.

Worst case scenario, you're a fuckup that doesn't understand how pointers and references work.
>>
>>56334240
cringe
>>
>>56334104

Mostly boredom.
>>
who /learning c++/ here?

on vectors right now. this is truly an amazing language
>>
File: 1424838630615.jpg (25KB, 625x555px) Image search: [Google]
1424838630615.jpg
25KB, 625x555px
>>56334253
>You're not going to be mallocing and freeing while dynamically passing function pointers to pthreads.
Of course not. You're not supposed to use malloc or free in C++, and you use STL threads instead of pthread.
>>
File: Selection_071.png (54KB, 908x170px) Image search: [Google]
Selection_071.png
54KB, 908x170px
Creating an algorithmic trading platform in the world's best language: Rust.

Just wanted to take a moment to share this truly beautiful piece of autogenerated LLVM-IR representing one particularly well-nested type.
>>
>>56334070
What language are you doing this in?
Are you using genetic algorithms?
>>
>>56334289
Rust is better in every way
>>
>>56334326
That looks like C++ error messages.
>>
File: wtf.gif (2MB, 278x342px) Image search: [Google]
wtf.gif
2MB, 278x342px
>>56334336
>>
>>56334289
>who /learning c++/ here?
Yep, I've been using C++ Primer Plus book and everything is okay so far.

But I don't have much time to read it during the day because of OOP Database bullshit from uni.
>>
>>56334342
he's saying it's better at being a shit language
>>
is a vector that holds another vector the same as a 2 dimensional array?
>>
>>56334313

C-fags and their stupid allocation schemes on suicide watch.
>>
>>56334372
A vector of vectors will be "jagged".
>>
>>56334253
The only thing I'm having trouble with is the installation of the IDE's, etc.
Netbeans Compiler and Visual Studio Express are all that's at the school for major tests.

I'm gonna go to bed and wake up tomorrow, cause I think all this shit isn't processing in my brain right now.
>>
I'm writing js right now, ask your questions.
>>
>>56334368
Compiles to LLVM, enforces compile-time safety checks, zero-cost abstractions, actively developed language

It simply can't be beat.
>>
>>56334417
How did you become a faggot?
>>
>>56334412

if you cant even get your IDE up and running then might as well shit yourself and call me scotty
>>
>>56334426
Easily
>>
>>56334440
Upvoted
>>
Can you guys please take the "meme language kys" shitposter back?
>>
>>56334456
Learn Rust
>>
>>56334456
>English
meme language
>>
>>56334313
Instead you get to use new and delete and delete[], and std::thread which is more or less the same bullshit as pthreads with the added convenience of all that in the mutex library.
>>
who /ai/ here?
>>
>>56334466
Some naked faggots are running around killing each other with sticks and stones. Shitty game 0/10
>>
File: Selection_072.png (18KB, 684x157px) Image search: [Google]
Selection_072.png
18KB, 684x157px
I nest my shit like nobody's business

>>56334489
It wouldn't be a shit game if it was written in Rust
>>
>>56334466

are there even any game engines written in Rust?
>>
>>56334342
DELETE THIS
>>
>>56334499
https://piston.rs/
https://www.reddit.com/r/rust_gamedev
>>
am i using pointers right?

    int a = 5;
int* b = &a;
cout << *b << endl;
>>
>>56334525
>one literally nobody has heard about
>link to reddit

captcha is FAGET
>>
>>56334477
>Instead you get to use new and delete and delete[]

Nah, "modern" C++ doesn't even involve new and delete.

I really can't muster any interest in modern C++. It's too hideous, *wildly* too complex[1], and all of the foot-shooting-avoidance is now about following some heuristics to make sure your reference-counting wrappers are done correctly.

[1] C++ seems to take the stance that unlimited cognitive load should be placed on the programmer in the name of eeking some tiny fractional improvement in run time. Personally, I've hardly ever run into any meaningful performance problem in the software I've written, and I've seen far too many software engineers focus on idealized performance long before even the most rudimentary prototype was in place. Gimme some of that syntactic sugar, baby.
>>
>>56334546
Reddit's where the serious programmers go to hang out.
>>
>>56334543
I guess
If it doesn't print 5 try << (*b) <<
>>
>>56334487
>can't even make a minimum wage tier burger flipping robot
>""""AI""""
>>
>>56334543
Yes. Not usefully, but correctly.
>>
>>56334557
>Reddit's where the serious programmers go to hang out.

/r/programming is the only place I've been that's *more* toxic than /g/. It's really kind of amazing. It's like a microcosm of why the industry sucks so much.
>>
>>56334546
>Ask a question
>Butthurt when it's answered

captcha is FUCKO
>>
>>56334575
>implying i asked the question
>implying you are not a faggot
captcha is 105
>>
>>56334559

thats what im doing and yes it does

>>56334563

that was easy as fuck, i dont understand the confusion with pointers for some people
>>
>>56334572
Fuck /r/programming

/r/rust is where it's at

also hackernews is out there; that's where the actual professionals go to have conversations.

Hackernews > Reddit > fagchan
>>
>>56334552
That's why you should use Rust instead.
>>
>>56334560

and force even more people out of jobs? eventually AI will weed out all the retards tho
>>
>>56334589
This guy know's what's up
>>
>>56334427
See, this is what I'm talking about.

I meant the compilers, not the IDEs.

IDE's are fine, fuck.
>>
>>56334583
>also hackernews is out there; that's where the actual professionals go to have conversations.

Eh. It's where all the Bay Area try-hards in hopes of impressing GP's hordes of YC sycophants.

For every one person on HN, there are probably 50 - 100 very capable career software engineers working on "old, boring" technology at unsexy companies where they produce real-world value.
>>
>>56334598
It's honestly exactly what anon wants. Yes, it sacrifices a TINY bit of performance potential, but also opens up new optimizations while significantly decreasing cognitive load.

If only it had dependent types with an SMT solver. Wink, wink.
>>
>>56334596
what are you even using AI for and why are you calling it AI instead of big data or computer vision or someshit
>>
>>56334589

Does Rust have some bunch of jackoffs in a "committee" prioritizing legacy compilation over improved productivity, like C++ has?

Goddamn, fucking Stroustrup and his, "oh you can do it any way you want! Except the one way you want, you can't do that! I'm obsessed with iterators, aren't you?" bullshit.

Oh, and you want a language spec? That will be $25. Fucking C++.
>>
>>56334625

Alright, you cunts, you convinced me to *look at* Rust. Not saying I'm going to actually start using it, because WTF, I'm going to join the hordes of hipster shitheads raking in $100k for fiddling with butthole-easy Javascript.
>>
>>56334546
I mean, the language's only been out for a year now... C++ probably wasn't used for any game engines for a few years too
>>
>>56334638

im making Cortana's secret lesbian friend for my gentoo
>>
>>56334659
This is acceptable.
>>
File: 1471450111834.png (213KB, 484x642px) Image search: [Google]
1471450111834.png
213KB, 484x642px
>learning an impure language
When will bakanon learn?
>>
Babies first sprite based 2D game in C#, what is the current lib of choice?

DirectDraw (does it still exist?), SDL, Unity?
>>
>>56334697
Linearity and affinity make mutation pure, and all notable side effects can be boiled down to (specified by) mutation.
>>
>>56334735
>all notable side effects can be boiled down to (specified by) mutation
non determinism
>>
>>56334743
Such as? PRNGs fall under mutation.
>>
it was all just a meme, they said
>>
>>56334743
>>56334769
And things like reading from /dev/random can use a linear "world" object, threading it through in much the same way that IO works in Haskell.

So I guess it wouldn't be an impure language, but "pure" doesn't have to mean the restrictions of Haskell, which is my point.
>>
File: 1465333395741.png (258KB, 549x560px) Image search: [Google]
1465333395741.png
258KB, 549x560px
>>56334829
>restrictions of Haskell
>>
>>56334839
Immutability.
>>
first for APL
>>
>>56334844
>restriction
>>
>>56334697

>not using a pure object oriented language that foregos the use of "primative" types and uses message passing for all actions
>>
>>56334921
>message passing
>not a side effect
>>
>>56334933
just because you pass explicit state as a function parameter doesn't mean you don't have state and effects
>>
>>56334954
it does though
>>
>>56334972
kill yourself
>>
>>56334988
i get it, you don't understand
>>
>>56334933

You said we should be using a pure language. You didn't say in what way it should be pure. Ruby's pure object orientation is much nicer than Haskell's pure functional approach.
>>
>>56335047
You're right, I didn't say programming language either! What a funny fucking reply!
>>
File: triggered hillary.gif (3MB, 218x272px) Image search: [Google]
triggered hillary.gif
3MB, 218x272px
>>56334342
>>
File: angree shig.jpg (7KB, 338x338px) Image search: [Google]
angree shig.jpg
7KB, 338x338px
>everything is an object
>>
>>56334056
A class that renders JavaScript (X) with reactjs.net for my C# networking library, that way I can send html directly from my back end with components that contain data directly from my database. Server side rendering seems like the way to go to get the best results from seo without PHP.

It all ends out as under 10 lines of C# code and the JavaScript is virtually all copied and pasted from preexisting code which was appended with jQuery in an Ajax callback. Now I'm directing nginx straight to the service for that location.

There's no WDG so I'll post here.
>>
>>56335002
you're delusional
>>
File: 1447993272762.jpg (260KB, 900x948px) Image search: [Google]
1447993272762.jpg
260KB, 900x948px
>>56335116
>methods are properties of objects
>>
why doesnt this work? trying to capitlize strings in a vector

    for (auto i : strings)
strings[i] = toupper(strings[i]);
>>
>>56335131

Nice buzzword salad meme.
>>
>>56335203
for (auto& str : strings)
str = toupper(str);


ranged for loops do not give you an index
>>
>>56335207

i think i have to use a normal for loop because i need to go to each character and upper case it
>>
File: 1472414298425.gif (268KB, 500x281px) Image search: [Google]
1472414298425.gif
268KB, 500x281px
>HASKELL
>>
>>56335254
>each character
for (auto& str : strings)
for (auto& ch : str)
ch = toupper(ch);
>>
>>56335204
How new are you to developing?

The only thing close to a buzzword was seo (search engineer optimisation) and refers to something very real that some people even specialise in. Everything else refers to a library, language or set of functions.

If you're as new as you obviously are, please don't tripfag let alone waste posts in the DPT. It's polite for you to shut the fuck up and lurk moar.

>>56334725
For C# the "proper" library is monogames/XNA (same API), I think these libraries can even be used for Xbox games and somehow monogames can be used for android games.

>>56334638
>>56334560
A burger flipping robot isn't AI, the reason we don't have them is because we can't pry mechanical engineers away from their v8 conversions to design the machinery. From a software perspective, it's just timing. There's no AI necessary.
>>
>>56335254
Two options:
1. Use range based for loop with references:
for (char& c : str) c = toupper(c);


2. Use std::tranform. I would prefer this.
>>
>>56335297
idiot
>>
File: smug harambe.png (649KB, 1800x1195px) Image search: [Google]
smug harambe.png
649KB, 1800x1195px
>>56334921
>primative
>>
>>56335376
stupid frogposter go back to your containment board
>>
File: code bloat.jpg (99KB, 630x655px) Image search: [Google]
code bloat.jpg
99KB, 630x655px
>>56335393
>I program in C++
>>
File: kramer tips.jpg (70KB, 719x686px) Image search: [Google]
kramer tips.jpg
70KB, 719x686px
>My favorite language is C
>>
File: >cia.png (470KB, 452x730px) Image search: [Google]
>cia.png
470KB, 452x730px
>>56335439
She's a big woman
>>
File: 1468540941275.jpg (122KB, 845x740px) Image search: [Google]
1468540941275.jpg
122KB, 845x740px
>>56335440
>I post le hat tipping maymay on 4chan because I'm insecure about myself
>>
>>56335399
>>56335409
>>56335418
i'm not even him but fuck off and die you insufferable butthurt leftist samefag

when trump wins it'll be even more glorious than brexit get rekt fag
>>
>>56335440

java developer detected
>>
>>56335448
for you
>>
File: averaging two integers.png (1001B, 247x40px) Image search: [Google]
averaging two integers.png
1001B, 247x40px
challenge: average 2 integers in your language of choice
>>
>>56335468
yeah like i dreamed about brexit

delusional faggot
>>
>>56335467
We've been over this meme thousands of times:
#include <stdlib.h>

int iavg(int n, const int arr[static const n])
{
int avg = 0;
int rem[2] = {0, 0};
int add[2] = {0, 0};

for (int i = 0; i < n; ++i) {
avg += arr[i] / n;

int a = abs(arr[i] % n);
int j = arr[i] < 0;

if (rem[j] >= n - a) {
rem[j] = a - (n - rem[j]);
++add[j];
} else {
rem[j] += a;
}
}

avg += add[0] - add[1];

if (avg < 0 && rem[0] > rem[1])
++avg;
else if (avg > 0 && rem[0] < rem[1])
--avg;

return avg;
}

Averaging an arbitrary amount of integers, in C, rounded towards zero, without overflow or conversion to a larger type.
>>
>>56335467
* (defmacro avg (&rest nums) `(/ (+ .,nums) ,(length nums)))

AVG
* (avg 3 4)

7/2
>>
>>56335468

>minority detected
>>
File: c is the best language.png (149KB, 600x1242px) Image search: [Google]
c is the best language.png
149KB, 600x1242px
>>56335487
>this is how you average numbers in C
top kek
>>
>>56335467
    def avg(a, b):
return (a + b) / 2
>>
>>56335489
(()(()()))()
>>
>>56335519
It's the same for any language with integer arithmetic.
It's just the meme is about C, so I did it in C.
>>
>>56335521
Arbitrary number of integers:
def arb_avg(num_list):
sum = 0
for num in num_list:
sum += num
return sum / len(num_list)

Typesafe:
def type_safe_arb_avg(num_list):
if type(num_list) not in (list, tuple):
raise TypeError("input must be a list or tuple")
for num in num_list:
if type(num) != int:
raise TypeError("list may only contain integers")
sum += num
return sum / len(num_list)
>>
>>56335519
kill yourself, you can do it the simpler, less efficient way in C too, and it'll still be much more efficient than the built in meme shit in your shitlang
>>
>>56335487
>iavg
>>
>>56335625
What?
>>
>>56335654
>challenge: average two integers
>>
>>56335667
I does average two integers though.
It can average up to INT_MAX integers.
>>
>>56335673
It returns an int
>>
>>56335678
Why wouldn't a function that works with integers not return an int?
I did specify that it rounds towards zero as well, you know.
>>
>>56335678
if it averages two ints it should return a fucking int unless specified otherwise
>>
>>56335680
and you think polls aren't slanted in anyone's favor? what matters is the result on election day
>>
polls couldn't predict the brexit result worth shit
>>
>>56335692
Yes they are. That's the whole point of polling holy shit. Historically his performance is horrific, at this point based on the data we do have and can analyze, he has a larger gap to overcome than goldwater. If he does it, it would be a first in history. His odds are horrifically bad at this stage, that's why the GOP is funneling money to the down ticket.
>>
yougov is one of the most accurate ones, but it's still a bit slanted toward the left
>>
>>56335596
This could be way more concise
Also
>typesafe
All you're doing is raising the error before it would usually be raised
def type_saf_arb_avg(lst):
try:
return sum(lst) / len(lst)
except TypeError:
# error handling code...
>>
>>56335705
we'll see on nov 8 buddy
>>
>>56335687
>Why wouldn't a function that works with integers not return an int?
>>56335688
>if it averages two ints it should return a fucking int unless specified otherwise


Never program again
>>
>>56335751
you're fucking pathetic dude you don't know shit fucking web dev faggot
>>
>>56335765
Nice response

>>56335771
>>56335755
>>56335741
Fuck off
>>
shut the fuck up polls are meaningless right now wait till after the debates, even then its meaningless, trump could gain so much power the election wouldn't even matter, he would literally just take the white house over, if hillary wins then prepare for another civil war
>>
>>56335776
a truncated integer average is still an accurate average to the full precision of an integer
>>
>>56335751
You're fucking retarded.
The average (mean) of a list of numbers is the sum of the numbers divided by the amount of numbers.
Since the question is about integers, it's obvious that we're talking about integer division.

Do you get majorly butthurt when someone does "3 / 2 == 1" as well, or something?
>>
>>56335771
Except Nate Silver showed multiple times how despite all math showing trump to take the nomination that he didn't personally thing he would win based on other factors? Cherry picking much?
>>
>>56335789
>Since the question is about integers, it's obvious that we're talking about integer division.
Even the fucking example he gave had a .5 result
>>
>>56335809
it wasn't even deliberate, it was just a sloppy result of his weakly typed shitlang
>>
Fairly new to programming and I've been stumped by something.

I basically want to take a load of html files and extract the 52nd line in the code from each and output them all into a text file. I have around 7000 html files and cant stand the though of doing this manually. How would you go about this?
>>
>>56335825
google the individual steps like how to read file, how to skip to a specific line, how to write a line of text to file
>>
>>56335814
You're a fucking idiot, you can't even see the evidence right in front of your eyes
>>
>>56335836
ok webtard
>>
>>56335783
Pigs could fly. We could discover a way to harness energy from nuclear fusion tomorrow. We don't know what tomorrow brings, but we know what it's likely not to bring. No one has recovered from the point trump was at. No candidate in recent history since we were able to track this data has been as bad off as trump is. The polls aren't meaningless, they're pretty accurate. He courted a racist vocal base and is facing the consequences of not having any of the Black, Hispanic, Muslim or Jewish vote. Two of which historically voted republican in large quantities in key states. He fucked up hard, bumbles constantly and shows he doesn't know what he's doing. Kasich, Cruz or Rubio would be destroying Clinton right now.
>>
>>56335846
stay delusional retard

>>56335755
>>56335755
>>56335755
he went up 3 points in a week and there are many weeks left for hillary to lose a couple of points and trump to gain a few points
>>
>>56335814
>>56335843
>sloppy
>weak typing
>webtard
Says the faggot who thinks anything involving integers should give an integer.
You couldn't even understand the fucking question, that's how retarded you are.
He gave a fucking example, averaging 3 and 4 to give 3.5
What the fuck should it have been? 3? 4?
Why the fuck do you think he would have averaged two fucking adjacent numbers just to give back the same fucking number?

Jesus Christ you're dense
All you know is to reciprocate bullshit
>>
>>56335864
stay mad faggot
>>
>>56335825
HTML is not programming.

for f in *.c; do sed '52q;d' $f; done > output.txt
>>
File: 26375861581.png (75KB, 430x546px) Image search: [Google]
26375861581.png
75KB, 430x546px
>>56335843
>>56335871

Wow, nice responses, you sure showed me!
You're so intelligent and clearly over the (required) age of 18!
You must know so much about programming!
>>
>>56335855
Yeah it's called a margin of error. On top of that, popular vote doesn't mean anything. We aren't a democracy, we're a democratic republic. Hillary's campaign knows the electoral map in and out. She's playing the meta game while trump is still trying to figure out what the game is. She's too experienced for him to take on, republicans should've kicked his ass to the curb when they had the chance and ate the windfall then nominated Kasich, Cruz or Rubio. Not that I like any of them but that would have been their best opportunity.
>>
>>56335864
Why would he specify "integers" if he wanted the result 3.5?
If you wanted 3.5, he would have specified real numbers.
>>
>>56335892
yeah she's so experienced that she lost to obama lmfao
>>
>>56334289
>Vectors
Make sure you understand the resource and timing impacts of vectors in terms of dynamic allocations, resize/reserve calls, large element usage, etc.
>>
>>56335893
Because that's the fucking meme.
He obviously wanted proper results or he wouldn't have posted the image.
>>
>>56335814
>>56335893
>>56335909
In fact in Haskell, integer division is "div", not /
>>
>>56335920
>Haskell
kys
>integer division is "div", not /
this is objectively inelegant
>>
>>56335932
>>Haskell
>kys
It said "GHCI", are you retarded or something?

>>integer division is "div", not /
>this is objectively inelegant
Yeah, maybe in your weakly typed web language
>>
>>56335947
(You)
>>
>>56335952
The funny thing is you can't even pretend to be shitposting. You are posting what you actually fucking think, when you do think you can defend yourself, and stupid fucking 10 year old remarks when you can't. You are retarded. Never fucking reply to me again unless you're contributing to this thread.
>>
>>56335961
now that's what i call a cool story bro
>>
File: he's back.png (6KB, 350x93px) Image search: [Google]
he's back.png
6KB, 350x93px
>>56334289
>this is truly an amazing language
The syntax is horrible
>>
>>56335983
not as horrible as haskell
>>
File: haskelel.jpg (99KB, 529x598px) Image search: [Google]
haskelel.jpg
99KB, 529x598px
>>
>>56335998
>max! = ... - 1
>maxW + 1

Why?
>>
>>56336008
>your existence
why?
>>
>The quality of posts is extremely important to this community. Contributors are encouraged to provide high-quality images and informative comments.
What did Moot mean by this?
>>
>>56336018
you're mom
>>
>>56336018
>Moot
Who?
>>
Why do people dislike C# so much, especially compared to Java?
>>
>>56336155
They don't
Not on /dpt/ at least
>>
My math is weak and I want to get better so what should i do? I did a linear algebra class on EDX awhile back, should i do calc or trig next
>>
>>56336173
Do both, start with trig if you wanna do graphics
>>
File: LennyFace.png (10KB, 500x250px) Image search: [Google]
LennyFace.png
10KB, 500x250px
>>56334122
I got a calculator for your girlfriend if you know what I mean
>>
>>56336173
calc first imo
>>
>>56336166
What would you say is the best language to know out of C, C++, C# or Java?
Or do they all have their place? And I heard Java is better than C# because C# can only be used with .NET stuff.

I'm just confused, because we've been programming in C# in school, but other people have always rolled their eyes when I mention it to them.
>>
>>56336338
Java is out of the question immediately

If you want performance, C or C++. C++ is a bit higher level than C, with a few extra features, but it's not pretty. C# if you want a comfy language (out of those) and don't care too much about performance.
>>
>>56336355
>and don't care too much about performance.

Here we go again...

C# performs as well as if not faster than C++ in like-for-like situations. The only time C++ outperforms C# is when you put in a sustantial amount of time making improvements.

The development time and general unfriendliness of C++ makes it hard to recommend over C# because in terms of performance at the ground floor C# easily keeps up with C++.
>>
>>56336338
Thanks to mono and Xamarin C# is multiplatform. You can write C# code and use it on windows, Linux, mac, ios, android, ect...

C# is also MUCH comfy to write. But Java had better a IDE (intellij > visual studio)

C and C++ for performance. But these can be a enormous pain if you want multiplatform or use external libraries.
>>
>>56336395
>C# performs as well as if not faster than C++ in like-for-like situations. The only time C++ outperforms C# is when you put in a sustantial amount of time making improvements.
Here we go again...
>>
>>56336338
java and C++

/dpt/ has a ridiculous fascination with C#, sure it has its uses for CRUD and windows GUI stuff but not really anything else (java and/or C++ are better suited for the other things). java has a much cleaner syntax and is much more popular for various kinds of applications, and is especially useful for large applications where many programmers are working on the same project
>>
>>56336395
you're delusional
>>
>>56336409
>>56336422
>I don't have to put more time, effort and knowledge into making improvements in a lower level language
>It's just faster :DDDD

http://www.codeproject.com/Articles/212856/Head-to-head-benchmark-Csharp-vs-NET

Go do some research then come back to me.
>>
>>56336429
C and C++ are automatically faster. No runtime, no GC.
>>
>>56336439
>C
Yes.
>C++
No.
>>
>>56336446
You're retarded.
>>
File: hmm.jpg (13KB, 396x303px) Image search: [Google]
hmm.jpg
13KB, 396x303px
>>56336446
>>
>>56336395
C++ performs better because you have better control over your memory. That doesn't require 'substantial' amounts of time

C++ also doesn't require this giant runtime.

C++ isn't all that unfriendly either. Sure you can go all crazy with templates and shit. But if you don't act like a drooling retarded writting C++ code doesn't take any longer than writting Java code for example.

The only big negative C++ has is using external dependencies. Which can be hell.
>>
So I just found this
https://www.humblebundle.com/books/joy-of-coding-book-bundle
Would this be a good place to start and try to learn code? I'm interested but no idea where to start.
>>
>>56334104
Just got to the office and haven't had any caffeine yet.

>>56336617
There are some okay books in there, but unfortunately, the only good beginner language there is Python, and I'd even recommend starting with C# over Python because the skills are more transferable to other popular (read: static typed) languages.

That being said, if you came out of those books with a reasonable understanding of Python, Javascript, and Linux shell, you'd be set to get a job if you can prove it.
>>
So I've always been using C::B for all my needs and purposes but now that I want to start writing programs larger than one .cpp file I'm having tremendous difficulties trying to get anything to work. Will I be better off switching to a more manual work flow, i.e. notepad++, mingw, ld, makefiles, blablabla, or is there a way to get C::B to work intuitively, i.e. compiling one file at a time in a project?
>>
>>56336617
Most if these books look like shit desu.

Ask yourself, why do you want to learn how to code?
I think a hands on approach is best when it comes to learning programming.
Because most books are like "here is a console window" and "Here is how you parse input", "this is a loop", ect...

Sure that's all useful stuff. But when you've never programmed before you don't see how these things come together to form a full working program.

Personally I wanted to make vidya games so I looked up tutorials on how to make vidya games and learned programming using practical examples.
And now my skills extend far beyond games.
>>
>>56336649
I agree with this anon. C# is a nice language to start.

I think Python is a little to much of a black box.
>>
>>56336681
Books like that nearly always work the menial skills into various utility programs as you go through them.

If there's one thing that needs to be added to every single programming text book, it's how to send and retrieve data from APIs and popular DBMS's.
>>
>>56336709
but there's libraries for that and they're trivial even in C
>>
>>56336715
You'd be surprised how many college graduates are clueless when it comes to working with live data outside of their environment.

I'm not saying it's hard; I'm just saying it's a skill that needs to be taught. Trust me, you'll die a little inside when after 10 interviews, 6 of them had a blank look on their face when you said "API".
>>
>>56336482
>That doesn't require 'substantial' amounts of time
Yes it does. Bugs that are impossible in a garbage collected language are possible in C++. Debugging takes time.

>C++ also doesn't require this giant runtime.
Yes it does. That runtime is your operating system.

>C++ is as easy to use as Java if you're careful.
It's shit.
>>
>>56336770
This is bait, right?
Any way you look at it, this has to be bait
This can't not be bait
>>
>>56336800
yes, yes it is

it's typical of pajeet tier morons to make openly ridiculous posts like that in defence of their meme language.
>>
>>56335998
thanks for using my pic
>>
>>56336829
Hey, don't lump me in with that moron.

While I think C# is easier to learn and faster to dev in, I know that C++ is nearly always going to compute faster given enough development time.
>>
>>56336770
I've literally never made a memory leak. And I write pretty much everything in C++ and don't even bother to apply the principles of RAII.
And even if I did, there are tools and ways that make tracking then easy.

>C++ is as easy to use as Java if you're careful
If you're going to quote, quote correctly
>>
>>56336837
it's your code maybe but i did the overlay on the puking dog pic
>>
>>56336847
Yes. I remember when I posted that, you got so mad that you immediately had to do the edit and posted it on your shity Twitter account as well.
>>
So im trying to make a bot with a few slack commands.

How can I query my mongodb with a get request using express?

i.e how can i look into the "text" field for "today","Today", or "tonight, and return the results?
>>
>>56336800
No, it's not bait. Manual memory management allows for new bugs, a modern operating system has to buffer memory for calls to malloc and new, and C++ being as easy to use as Java isn't very impressive.

>>56336829
Which meme language would that be?

>>56336844
>I've literally never made a memory leak.
You've either never had to write anything complex or you never see your leaks because you don't test for them.
>>
>>56336917
>Which meme language would that be?
don't remember

haven't got space upstairs to store the name of every irrelevant meme language I encounter. too busy getting paid ACTUAL MONEY to write """code""".
>>
File: Ym9f9jr.png (700KB, 1376x832px) Image search: [Google]
Ym9f9jr.png
700KB, 1376x832px
Image comparison testing is going well.

Trying to find more testing metrics so I have some more numbers to work with.

Currently the most complex images I have are a folder full of garbage memes so they'll have to do.

Anyone have any advice on other possible tests I could run?
>>
>>56336992
>too busy getting paid ACTUAL MONEY to write """code""".
I have no idea what you're trying to say.

>>56336904
>using express
What?
>>
>>56336992
The only meme languages of late are Go, Swift, and Rust.
>>
Developing platform for early health testing that could accumulate similar services and grow into a neuronet.
>>
>>56337039
>I have no idea what you're trying to say.
It's quite simple: I work as a software developer. I get paid money to write code. This means I'm a better person than you and my opinions are worth more.
>>
reminder that you can write an OS in C++ but not in C#
>>
>>56337063
But you said """code"""", implying that you don't actually write code.

I'm not the anon you're arguing with, and I also have a job writing code. Or """code""", I guess.

Or maybe you're being facetious against the general holier-than-thou attitude the employed have towards NEETs.

I don't even know anymore, man.

11 years of 4chan starts to grind you down.
>>
>>56336674

Plain old makefiles have always worked perfectly for me.
>>
>>56337090
Nobody in their right mind would write an OS in C++ either.
Even Microsoft isn't that stupid.
>>
>>56337090
You can write an OS in C#. I'm not sure why you would want to, though.

But you're going to ignore this fact and declare that the OS's that were already built in C# weren't really written in C#, so it's a bit of a moot point.

SharpOS even wrote their own kernel and AoT compiler so that the OS could be fully written in managed C# and the boot sequence didn't rely on anything else.
>>
>>56337096
well, I was trying to combine a meagre valuation of the code I write with an arrogant over appreciation of my own worth to create the impression in other poster that they are communicating a higher being i.e. "I'm such an important and valuable person that people will even pay me to write pure shit".
>>
>>56337130
>Nobody in their right mind would write an OS in C++ either
it's like writing an OS in C

>>56337144
what's managing the memory?
>>
>>56337039
*using the router from express to handle requests

its a node application
>>
>>56337153
Surely you can see how that sort of blatant cognitive dissonance is confusing to the reader, right?

Typically, an egotist such as you were attempting to portray would also see their code as valuable, rather than bragging about not actually writing valuable code.

It would be a rare specimen which flaunts having no skills, while riding on the ignorance of their managers.

I like the attempt at role-playing though, even if it was somewhat close to the truth.
>>
>>56337013
If you're going for a Google reverse image search kinda thing, I think they use different algorithms.
Though I forgot the name for it.
>>
>>56337130
Only because it's harder to interface C++ with other languages.

C's ffi is pretty simple. Pretty much every language has a way to work with C. This is not true for C++.
>>
>>56337184
>Surely you can see how that sort of blatant cognitive dissonance is confusing to the reader, right?
I have no illusions about my abilities so you're using the wrong word there friendo.

I said I don't, not that I can't.
>>
just got my first GPU
its kinda underwhelming for gamin, and the power consumption both idle and under load went up a lot

Give me some interesting ideas what to program on a GPU that is simply unthinkable to do on a CPU, or i will be tempted to return it and stay an APU pleb

the only things that come to mind is password hashing (but one GPU is still too low for "professional" blackhattery) and bitcoin mining, but i vaguely remember that ASICS have taken over years ago.
>>
>>56337172
>what's managing the memory?
Who's managing malloc?
>>
>>56336992
I get paid to write Python and C#, but okay.
>>
>>56337290
You don't need to use malloc, you can edit memory at will
>>
>>56337290
Freestanding code doesn't have access to malloc.
>>
File: anal beads.png (7KB, 206x199px) Image search: [Google]
anal beads.png
7KB, 206x199px
>>56337278
I call these employees "tsunderes".

They write shit code even though they're completely capable of taking their time and doing it well.

>I-it's not like I w-wanted to write good code or anything, BAKA.

Generally, I'll leave a printed image of Taiga or Louise on their desk when they aren't there.

The office is a fun place when your manager is a shameless weeaboo, and your HR department doesn't give a fuck.
>>
File: 1466283913904.webm (428KB, 469x720px) Image search: [Google]
1466283913904.webm
428KB, 469x720px
Besides C what other language should I learn?
>>
>>56337359
Do you already know C, or did you get memed to pick that as your first language?
>>
>>56337341
>Generally, I'll leave a printed image of Taiga or Louise on their desk when they aren't there.
Pajeetslayer, you are simply the best.
>>
>>56337359
Guile.

https://www.gnu.org/software/guile/
https://www.gnu.org/software/guile/manual/html_node/API-Reference.html#API-Reference
>>
>>56337246
The FFI isn't relevant here, unless you're talking about kernel modules.
Programs don't communicate with the kernel like it does with other programs.

C++ is retarded because it's ridiculously complicated and hides all sorts of details from you.
You can't use most of the features because there is runtime support required or there are terrible performance implications. You would have to limit the language massively and would have access to your "nice C++ features". At that point, you may as well stop being retarded and just use C.
>>
>>56337386
>At that point, you may as well stop being retarded and just use C.
Not true.

Namespaces
Ad hoc polymorphism
Parametric polymorphism
Constructors
Destructors
Operator overloading
Lambdas
>>
>>56337386
>would
wouldn't*
>>
File: astronaut_glenda.jpg (8KB, 200x230px) Image search: [Google]
astronaut_glenda.jpg
8KB, 200x230px
Why did they change a lot of the features in Plan 9 C from ANSI C?
>>
>>56337410
>Namespaces
Useless.
>Ad hoc polymorphism
It's shit and hides information. Also, C can actually do this too, but it's still shit.
>Parametric polymorphism
Code bloat.
>Constructors
Useless.
>Destructors
Useless.
>Operator overloading
Useless. Also hides information.
>Lambdas
Useless.
>>
>>56337410
>Constructors
>Destructors
>Operator overloading
That's honestly just syntactic sugar.
>>
>>56337341
don't think that would effect my smug sense of superiority 2bh

would probably make me think there's a proper 22 carat mong somewhere in the office though
>>
>>56337461
Because they wanted to be special snowflakes.
>>
FizzBuzz in ook!
>>
File: 1471897595829.png (34KB, 400x250px) Image search: [Google]
1471897595829.png
34KB, 400x250px
>>56337368

I need languages that fill the gaps left by C.
>>
>>56337475
Lambdas too
...What's your point?

>>56337474
90% of this "code bloat" reduces code size
>>
File: IMG_20160826_150959.jpg (72KB, 1334x750px) Image search: [Google]
IMG_20160826_150959.jpg
72KB, 1334x750px
>>56337386
Nasa prefers C++ over C.

Personally i write on this style of C++ as well.
Thou I use operator overloading and exceptionally I use templates for syntax suger.
>>
>>56337511
>90% of this "code bloat" reduces code size
Object code bloat, not source code bloat.
>>
>>56337510
I already linked Guile, but yes, that's what it does. Guile is a dialect of Scheme that plays nicely with C. You can learn all the other things you want through it and hook it up to existing C code.
>>
>>56337487
But how did it improve C?
>>
>>56337475
C is just syntactic sugar for better, lower-level languages.
>>
>>56337519
>Object code bloat, not source code bloat.
There should be different words for these. Binary bloat and source bloat? I can't think of anything succinct.
>>
>>56337519
Not if you use them properly.
>>
>>56337510
Learn something high-level, like C#.

You'll have a multipurpose language that can do anything, and you can write helper libraries in C if you need a specific component to be faster.

It's easy to work with C in any major high-level language, so take your pick from C#, Java, or Python.
>>
>>56337475
Syntax sugar is important too.
It increases productivity and readability.

C++ is also more type safe than C.
>>
File: ok.png (2KB, 512x512px) Image search: [Google]
ok.png
2KB, 512x512px
>>
>>56337541
More features to dance around, making sure you don't accidentally fuck up?
Great.
>>
>>56334056
what to do when you hit a dead end ?

I get stressed out to easily, over engineer everything and feel too dumb for everything, yet I cant move away from programming, it keeps sucking me back in
>>
>>56337568
>Dance around
Are you literally retarded?
>>
>>56337568
>t. never done even a mildly complex project in an OOP language
don't be a moron
>>
>>56337625
OOP is NOT appropriate for operating systems. In fact, it's not appropriate for anything.
OOP is pure trash.
>>
Is it possible for a shared object loaded after program initialization (by a call to dlopen for example) to get the calling process's argv?

This needs to be "unix-portable", so a solution not working with Windows is OK, but it needs to work on Linux and OSX.

I've read something about the .init_array section, but it's not called when the shared object is dlopen'd.
>>
>>56337647
nice bait, moron
>>
>>56337647
>OOP is pure trash.
why?
>>
>>56337647
(You)
>>
>>56337548
Object *o = new Object(parameters);
Object *o = create_object(parameters);

I don't really see the productivity improvement in constructors/destructors.

Operator overloading can save you a lot of typing but you should use it rather sparingly for obvious reasons.
>>
>>56337658
I'm not baiting. It really is shit.
OOP encourages shared state.
>>
>>56337568
No, you idiot.
Features to use appropriately.
Not doing
vec<int>, vec<unsigned int>, vec<size_t>, vec<float>, vec<vec<int>> etc
>>
>>56337013
What's your goal? If you want to do something like reverse search, you really ought to step it up, something like deep convolutional neural networks.
>>
>>56337586
>>56337586
any advice, please ?
>>
>>56337673
First, you're using pointers.
You're barely using constructors.

Object o {parameters};

unique_ptr<Object> o {parameters};
// no new


...
// no delete
>>
>>56337474
>someone is going to fall for this bait

>>56337410
>no HKTs or HITs
Why even try?
>>
>>56337702
>no HKTs
What are you talking about? You can do HKTs in C++.
>>
>>56337692
just when you thought you was out, they pull you back in
>>
>>56337216
>>56337681
That's sort of what I'm going for, obviously it's never going to be advanced as something like Google's algorithms but I wanted to make a decent rough approximation that was relatively fast for processing a whole bunch of images.

Currently my sobel edge detection and colour averaging methods are relatively accurate, just need to massively optimise it and multithread it to get the thing moving fast enough - currently 1.8m comparisons (1909 images compared to each other image one time) is ~16 hours on my current execution.

Not even begun with the optimisation though, I mean multithreading alone for my cpu should give me 1/8th that time.
>>
/tmp/tmpBv25eZ/source.c: In function 'main':
/tmp/tmpBv25eZ/source.c:32:3: error: unknown type name 'ssize_t'
ssize_t size = getline(&str, &len, fp);
^
/tmp/tmpBv25eZ/source.c:32:3: warning: implicit declaration of function 'getline' [-Wimplicit-function-declaration]


Does CodeEval not support dynamic memory extensions?
>>
>>56337692
>space before question mark

What third-world country are you living in?
>>
>>56337720
Ok, but still not HITs, path induction or corecursion-coinduction.
>>
>>56337586
>>56337692
Plan what you're going to do beforehand and avoid doing more that.
>>
>>56337741
Including the <stddef.h> header should fix your problem
>>
>>56337785
ssize_t isn't a standard C type, it's a POSIX C type.

>>56337741
>Does CodeEval not support dynamic memory extensions?
Probably not.
>>
>>56337675
>OOP encourages shared state.
So do closures.
>>
>>56337780
do you make a plan, if yes what and how do you plan ahead ?
>>
>>56337765
sorry, didnt mean to hurt your feelings
>>
>>56337725
If you want image based search you can't just compare your image with every other image. That doesn't scale.
You need to generate a fingerprint for each image and search based on that.

Like I said I've forgotten the name of the algorithm. Just Google around a bit and you might find it.
>>
>>56337647

t. Linus
>>
>>56337805
If it's complicated I plan it out.
http://www.joelonsoftware.com/articles/whattimeisit.html
>>
>>56334056
Deep learning experiments in Rust.
>>
>>56337842
you're learning real hard?
>>
>>56337829
thanks for the link, it looks like a promising solution
>>
File: cute anime pic 0102.jpg (2KB, 120x117px) Image search: [Google]
cute anime pic 0102.jpg
2KB, 120x117px
>>56337785
including stddef.h didn't help

>>56337790
Well, time to hack together my own shitty getline implementation.
>>
Hello, /g/, I'm trying to get the expected output of this function. I've figured that it just reverses it, so the output is "jihgfedcba".
Am I right?
Thanks
int stringTest() {
std::wstring input = L"abcdefghij";
std::wstring output;
for (std::wstring::iterator i = input.begin(); i != input.end(); i++) {
output += (*i) + 1;
}
}

>>
How do I get into programming, fellas?
>>
>>56337890
>wstring
Anon pls.
>>
>>56334056
Working on a Bot_In_Maze game, the goal is to create an IA that can take the bot out of a given scenario with one exit.
>>
>>56337911
Better you go to /sqt/...
>>
>>56337890
#include <algorithm>
std::string input = "abcdefghij";
std::reverse(str.begin(), str.end());
>>
>>56336482

C++ needs a good package manager...
>>
>>56337943
Well you do have NuGet on Windows. Too bad it's proprietary.
>>
>>56337510
>that fill the gaps left by C.
Definitely Rust, in this case.
>>
>>56337912
It's not about functionality, just a "challenge" task
>>
File: 1420744981873.jpg (117KB, 513x651px) Image search: [Google]
1420744981873.jpg
117KB, 513x651px
>>56334204
>TFW Building a mobile app
>TFW Xamarin fucking flops hard
>TFW Forced to learn JAVA and Android Studio

Krill me
>>
>>56337341
Out of Javascript and Java, which more horrible to work with?

I find it hard to choose because Java forces you to work inside of really heavy inheritance trees and when you work around the language's bullshit it becomes unsafe unstable spaghetti code, whereas JavaScript will unexpectedly do nonsensical typecasts and comparisons, completely silently, just like PHP. Also if you're working with JS you're probably working with the DOM.

Actually Java 8 is pretty flexible (with default implementations and static methods on interfaces) so I'd say Java is the lesser evil here.

Anyway, also fuck SQL.
>>
>>56336701

What bullshit. How big is the .net SDK? Or did you forget in the time it took to download?
>>
>>56338014
I know that feel bro.

Though Android studio (and all other intellij IDE) is better than Visual studio.

Visual studio id quite laggy.
>>
>>56338051
What? What i mean is that python abstract away more stuff than C# does.
>>
>>56337130

VxWorks is written in C++... it's also a clusterfuck to work with.
>>
New thread:
>>56338119
>>56338119
>>56338119
>>
>>56338014
Does Android support Java 8? If so you can use interfaces more strongly rather than inheritance hierarchy everywhere.
>>
>>56338168
Yes
>>
>>56335725
"explicit is better than implicit"
"Simple is better than complex."
>>
>>56338726
"redundant is dumb as shit"
>>
>>56338748
All I see here is:
> I don't have a job. Therefore, I can't understand that it's a waste of time to turn everything into code golf and optimise every last line of code.

Stay NEET.
>>
>>56338918
"I have a job and you don't" is not an argument.

His solution didn't involve anything reducing readability or performance, on the contrary, he made it more readable by removing redundant checks, and using the langage builtin facilities instead, which helps for a more maintainable code base.

He's literally more likely to have a job than you.

Meanwhile, you're here thinking your pathetic paraphrase is akin to an actual argument.
>>
>>56337341
TFW Rust isn't even on the list

Feels bad
>>
>>56337510
Rust
>>
>>56338049
Java is for companies with corporate overlords who you never see and make 50x more than you.

JavaScript is for bosses named Clemence or Francois who will come up behind you, put a hand on both of your shoulders, and ask if you can work until 7 today.
>>
>>56338975
To be honest with you, his solution is how I would actually write it. Actually, I'd probably leave out the try except block unless there was something to do if the argument was not a list or tuple as the interpreter would tell me what the problem was anyways. In fact, I have a method in my current project that does just this and it's written almost exactly the same as his.

While I agree that his version is more concise, I would argue that my version is actually easier to debug as the error messages would be more precise. Depending on what his version would have for "error handling code", it may not say exactly what the error is. My version will tell you that either the incorrect data structure was passed as and argument or that one of the items in the sequence is not the correct type.

If I pass a string into his function(without try/except) I get an error: "unsupported operand type for +: 'int' and 'str'". This is because strings are inalterable but you cannot 'sum' them. I think most people would probably recognize this error fairly quickly.

My version on the other hand would catch the incorrect type immediately and tell you exactly what's wrong. The problem with passing a string to the function isn't the '+' operator's inability to operate on it; it's that a string should have never been passed in the first place.

What if I wanted to modify the function so it could accept CLI arguments in the form of stdin strings such as '123' as well as a list or tuple of integers? It would be trivial to modify my version to catch that a string has been passed and cast each item to an integer. His version would need to be modified to catch the string anyways.

While I agree that his version is more concise, I do not agree that it is more maintainable.
>>
>>56339388
>This is because strings are inalterable
should be
This is because strings are *iterable
Thread posts: 325
Thread images: 36


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