[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: 320
Thread images: 19

File: trap programmer5.png (1MB, 1127x1600px) Image search: [Google]
trap programmer5.png
1MB, 1127x1600px
old thread: >>57528432

What are you working on, /g/?
>>
File: 1452678625898.gif (131KB, 600x338px) Image search: [Google]
1452678625898.gif
131KB, 600x338px
Can someone explain dot products to me?
Someone suggested a math-heavy website to learn some linear alg and I didn't get any of it.
>>
First for PHP compiled to Java
>>
>>57534529
kill yourself

fuck all of you faggots
>>
>>57534529
>Posting literal fag shit
Delete this thread and kill yourself.
>>
Ignore hasklel threds.
SAGE hasklel threds.
Report hasklel threds.
>>
>>57534564
What problem are you having with understanding them, anon?
>>
how do I plot serial data using matplotlib?
>>
>>57534564
the dot product
 <x,y> 
is the proyection (or shadow) of x over the direction y or the same way, the projection of y over the direction x.

If <x,y> > 0 then you have an acute angle, <x,y> = 0 then the vectors are ortogonal and if <x,y> < 0 an obtuse angle. Also you can create hyperplanes to delitmit zones thanks to the hahn banach theorem, which is useful on optimization for branch & bound
>>
How do I convert chars to strings in C++?
Because right now, I feel like I'm wasting memory on creating essentially the same of both.
Either that, or taking an inputted string, and changing it after it being inputted. Is that possible?
>>
>>57534564
>Can someone explain dot products to me?
In what context?
Algebraically it's just a simple reduce operation of two arrays of numbers.
Geometrically you can think of it as a way to measure the 'separations' of two vectors or projecting a vector onto another (say you wanna know how 'far along' a vector is along another direction).
>>
>>57534701
You can create a string in C++ by passing a char array to the str function, like this:

char arr[ ] = "OP is a fag";

string str(arr);
>>
>>57534720
It's not an array though. It's just one character. Would it still work?
>>
>>57534730
Yeah, I think so. Though I have to wonder why you're storing a single char as a string.
>>
>>57534746
I'm basically taking a user's input (One letter), and then based on the type of letter they picked, convert said letter into a word, or string. Right now, I'm using two chars, and two strings, both with the same names, just that the chars are in lower case, while the strings are in upper case.
>>
>>57534770
It might help if we could see the code, but yeah I don't think you need duplicates of all your variables.
>>
>>57534781
int main()
{
int result;
char user1, user2, le = 'y';
string USER1, USER2;

while(le == 'y' || le == 'Y'){
cout << "First user, enter paper, rock, or scissors, by typing the first letter of the word: ";
cin >> user1;
cout << "Second user, do the same: ";
cin >> user2;

switch(user1){
case 'p':
case 'P':
USER1 = "Paper";
if(user2 == 'r' || user2 == 'r'){
USER2 = "Rock";
result = 1;
}
else
result = 2;
break;
case 'r':
case 'R':
USER1 = "Rock";
if(user2 == 's' || user2 == 'S'){
USER2 = "Scissors";
result = 1;
}
else
result = 2;
break;
case 's':
case 'S':
USER1 = "Scissors";
if (user2 == 'p' || user2 == 'P'){
USER2 = "Paper";
result = 1;
}
else
result = 2;
break;
default:
cout << "That's not Rock, Paper, or Scissors!";
}
if(result == 1)
cout << "User 1 Wins!\n" << USER1 << " beats " << USER2 << endl;
else if(result == 2)
cout << "User 2 Wins!\n" << USER2 << " beats " << USER1 << endl;

cout << "Press y to play again: ";
cin >> le;
}

return 0;
}
>>
>>57534770
>>57534730
>>57534701
Literally just look in the docs.
You should always keep a tab of the <language X> docs next to your /g/ tab when you program, next to your stackoverflow tab.

http://en.cppreference.com/w/cpp/string/basic_string/basic_string
>2) Constructs the string with count copies of character ch. The behavior is undefined if count >= npos.
char x = 'X';
std::string s = std::string(1, x); // count=1; one copy of character
std::cout << "my string: \"" << s << "\"" << std::endl; // -> my string: "x"
>>
>>57534529
Why would people shill Vim/Emacs over Geany?
>>
>>57534893
Thanks, but that just looks less readable than my existing code. Thought there was some more automated way to do it.
>>
>>57534896
Why would people use anything other than GNU nano?
>>
>>57534921
>GNU nano
It's not GNU anymore. It's just 'nano'.
>Why would people use anything other than GNU nano?
Severe lack of features.
>>
>>57534921
nano is bloat
>>
>>57534896
Why would some no-name shitty VS-clone "IDE" be better than Emacs?

>>57534917
The way to do it would be to have a function that takes in a character abbreviation and outputs a string, e.g.
string get_hand_name (char c) {
switch (c) {
case 'r':
case 'R':
return "Rock";
...
default:
return "";
}


Then be like
char user1_c, user2_c;
string user1, user2;
...
cin >> user1_c;
...
cin >> user2_c;
user1 = get_hand_name(user1_c);
user2 = get_hand_name(user2_c);
if (user1 == "" || user2 == "") {
std::cout << "That's not R/P/S!!" << std::endl;
return 1;
}


And then even better make a function to compute outcome
int outcome (char p1, char p2) {
// returns 1 if p1 wins, 2 if p2 wins
...
}


Also what you probably want to do is have seperate values representing rock / paper / scissors, so you don't have to constantly check cases.
A common C idiom is to define them as numbers.
int ROCK = 1;
int PAPER = 2;
int SCISSORS = 3;
int INVALID = 0;

int parse_move (char inp) {
switch (inp) {
case 'r': case 'R':
return ROCK;
...
default:
return INVALID;
}
}


A cool advantage to this is you get to utilize string indexing
const char* moves[] = {
"-invalid", "Rock", "Paper", "Scissors"
};
int main () {
int user1 = parse_move(user1_c);
...
std::cout << moves[user1] << std::endl;
...
}
>>
>>57534951
https://www.nano-editor.org/

>>57534960
vim and emacs are bloated
geany has GTK bindings, which makes it bloated by design
>>
>>57535003
>vim and emacs are bloated
>useful software
>!! BLOATED!! REE
Have fun ricing your gentoo install, asshole. Do you have a job yet?
>>
>>57534995
>Also what you probably want to do is have seperate values representing rock / paper / scissors, so you don't have to constantly check cases.
>A common C idiom is to define them as numbers.
>
int ROCK = 1;
int PAPER = 2;
int SCISSORS = 3;
int INVALID = 0;

int parse_move (char inp) {
switch (inp) {
case 'r': case 'R':
return ROCK;
...
default:
return INVALID;
}
}

>
>A cool advantage to this is you get to utilize string indexing
>
const char* moves[] = {
"-invalid", "Rock", "Paper", "Scissors"
};
int main () {
int user1 = parse_move(user1_c);
...
std::cout << moves[user1] << std::endl;
...
}


Thanks for that in particular. Didn't think of this.
>>
>>57535003
Well, apparently I was going off of some mis-reported news articles from awhile ago.
>>
>>57535003
vi comes with my minimal install. nano does not. nano is bloat to my workflow because now I have to remember how to use vi and nano, and since i have to use vi to configure my network-scripts every 2 years when I install a nix I have to remember how to use vi. So I just use vi(m?).

tl;dr I don't always have nano. I always have vi so anything I don't use (eg nano) is bloat to my disk and my muscle memory.
>>
>>57534995
>VS-clone
Do you suffer from severe autism?
>>
>>57534995
>int ROCK = 1;
>int PAPER = 2;
>int SCISSORS = 3;
>int INVALID = 0;
No. Just no.
enum {
INVALID,
ROCK,
PAPER,
SCISSORS,
};

or
#define INVALID 0
#define ROCK 1
#define PAPER 2
#define SCISSORS 3
>>
>>57534529
How the fuck is haskell so fucking hard to learn even if you know a shit ton of math

Anyone have experience how to work it?
>>
>>57535027
>muscle memory
>tfw making the transition from vim to emacs
>muscle memory is in shambles
>pause for 5 seconds trying to remember if $ or ^ takes you to the end of line
>accidentally press C-x in vim and the terminal freezes up

>>57535045
He's a beginner. It's easier to understand int variables than learning a new syntax (enum) or using shitty defines. He'll learn those things later but more important than whatever laundry list of advantages enum has to toplevel variables, is just understanding the idea and purpose behind it.
>>
>>57535073
>He's a beginner
That doesn't mean that you should give him misinformation.
There are several very large disadvantages to using an int variable, including NOT being able to use it case labels, which is very fucking important.
>>
>Everyone and his wife's son knows C
fuck why am I so dumb
>>
>>57535084
>including NOT being able to use it case labels, which is very fucking important
Fuck I didn't realize that.
C++ can eat a dick by the way
>>
>tfw you're about to become a wage-cuck

I've failed /g/, I've yet to find a way I can become self-sustaining from my CS Degree.
>>
>>57535093
cuz C is for shitters who only make console apps and fizzbuzzers
>>
>>57535065
What in particular?
>>
>>57535102
>Falling for the CS meme.
Top kek.
>>
>>57535109
>>57535093
>>
>>57534995
http://pastebin.com/QsrDBJ8c
Here is how I would do it.
Could use some cleanup but, w/e.
>>
>>57535109
Same with python :~)
>>
>>57535209
Shouldn't you have a CharLowercase function?
Also use methods from cin instead of _getch() to be more I D I O M A T I C
>>
>>57535243
I use _getch because it doesn't emit it to the console (no reading the other's entry) and you don't need to press enter.
Moving more into functions, like user input (and therefore lowercasing), should be done but I didn't feel like doing it, so I didn't.
>>
>>57535267
Linux doesn't have _getch(), and cygwin doesn't support it either last time I checked.
Yes, I know it's annoying to have to type enter but it's honestly much better for everyone involved, for instance you could pipe a file into your RockPaperScissors program to do automatic testing.
>>
>>57535109
>>57535154
I mean I just wanna learn it because I put so much time into it, but tutorials in the C book are tough for my scrub brain
>>
>>57535314
What don't you understand?
>>
>>57535282
>>57535209

http://pastebin.com/HWyS2CvK
Refactored
*nix support

Happy?
>>
>>57535331
The programs that I copy per every lesson don't do what they describe, or atleast what with my minimal knowledge expect them to
>>
>>57535557
What book is that even?
>>
>>57535556
Yep! Looks great
>>
>>57535607
The C Programming Language 2nd Ed.
>>
>>57535557
Post the question you're having trouble with.
>>
>>57535619
Is that the R&K one?
I think that's a notch too hard for beginners.

If you don't mind switching to c++ for the basics and foundation you could try this book
http://www.cplusplus.com/files/tutorial.pdf
>>
>>57534529
source?
>>
File: 1478668757188.png (253KB, 900x900px) Image search: [Google]
1478668757188.png
253KB, 900x900px
make a program that AWOOOOO~'s
>>
File: fashion slut.jpg (1MB, 1600x1132px) Image search: [Google]
fashion slut.jpg
1MB, 1600x1132px
I feel like making a youtube channel with programming tutorials, but I don't want to make all the mistakes that other people make like making their videos hard to digest at 1 hour in length, scarecam, being indian, etc.

How do I make programming not boring to look at?
>>
>>57535777
lots of anime and emacs
>>
>>57535777
by doing text tutorials on a good looking page with a nice font

video tutorials for programming cant be good
>>
>>57535777
me on the left
>>
>>57535803
qt
>>
>>57535762
#!/bin/sh
aplay awoo.wav
>>
>>57535639
I'll come back with something

>>57535710
Yeah it is
I hope to not switch so soon, but I'll give this a try
>>
>>57535813
senpai pls keep me warm
>>
How should I go about writing a script that uses the thread watcher and waits for multiple (You)'s and "samefag" and then hides one of the (You)'s and takes a screenshot, and then uploads the screenshot as a reply and posts it?
>>
@57535954
this is pathetic as fuck i dont even know where to begin with this post

not even gonna (You)
>>
>>57535954
Regex
>>
>>57536022
roast me senpai
>>
A Compiler
>>
>>57535762
class Awoo{
public static void main(String[] args){
System.out.println("AWOO!!! :^3");
}
}
>>
Spend my night getting stupid stack rewinding for Windows working, only to realize that either the IDE or the virtual machine are broken.

Haven't bothered to fix anything yet. VS and MASM are goddamn retarded.
>>
how to find a large volume of relatively simple github projects to contrib to ?
>>
>>57536148
By not plenking, you retard.
>>
>>57536157
pls, , , don't criticize my typing.. way to judege a book by the front
>>
>>57536170
Someone who does not know about proper spacing probably has major lapses in his overall education and does not deserve others attention. Judging a book by its cover is completely justified.
>>
File: awoo-1.webm (324KB, 806x508px) Image search: [Google]
awoo-1.webm
324KB, 806x508px
>>57535762
I don't know what the fuck am i doing.
>>
>>57536220
>am I doing
Your English is terrible, and so are probably your programming skills.
>>
>>57536178

There's no evidence that they don't know about these things. They could just be pretending to be retarded, etc. It's one thing if someone spouts some truly incomprehensible shit, but insulting someone isn't useful here, nothing comes of it.
>>
>>57536260
>They could just be pretending to be retarded
Then they don't deserve attention either.
>>
>>57536263

Nobody deserves anything, so that's a non-argument.
>>
>>57536234
hey dude chill, out some people need, some casual, grammar,.
>>
>>57536260
>insulting someone isn't useful here
Welcome to 4chan, you fucking faggot.
>>
>>57536273
You deserve to be shot in your head while the ambulance drives over your bleeding corpse and explodes right above you.

>>57536280
Learn English or disembody yourself. Your choice.
>>
>>57536297
Hey Dude Just Chill Tf Out Lol Xd
>>
hey /g/
Over the course of about 6 months, I've made a program, by myself.
I need to present it tomorrow at Uni as a side project, to show my programming initiative.
It's C++.
It is a huge bunch of header and cpp files, and I made it so I can use it to make games in the future.
It's features:
It handles keyboard and mouse input events (I made my own KeyDown KeyHold and KeyUp events)
Debugging to a .txt log and console.
Handles loop time (eg, 50 main loops per second) If it goes over, it logs it to the .txt and console
It handles the loading and drawing of images (strictly 2D)

The only thing I've used externally is SFML.

Essentially you copy and paste all the .h and .cpp files into a new project, and code in the given methods, store data in the ProgramSpecificStorage class, etc.
I never plan on distributing it, because it's just for my shitty use.
But to get extra marks at Uni, I've decided to show it.
Problem is, I don't know what to call it. It's got a name, but I don't know WHAT it is/what to refer to it as in my submission.
Is it an engine? (No UI for coding, it's entirely just files, so probably not)
Is it a framework? (Probs not)
Is it a library? (You can't import it. You have to code IN one of the class' methods)
WHAT IS MY PROGRAM?
>>
>>57535045
>EVER RECOMMENDING THE GARBAGE PREPROCESSOR

kill yourself you neet idiot
>>
>>57536836
>Le pre-processor is bad
Fucking sepplesfags
>>
>>57536824
>It's C++.
Worthless
>>
>>57536840
it is
>>
>>57534529
>>57534529
Souce?????
>>
>>57536860
Just like you and your opinion. Kill yourself, shit stain.
>>
>>57536824
i'd just call it a framework anyway
>>
>>57536890
Not him, but any program written in C++ is worthless.
>>
>>57534564
You have one dot, you have another dot.
You now have two dots.
>>
>>57536898
I guess GCC, GDB, Clang and LLDB are worthless then.
>>
>>57536898
Yeah! fizzbuzzes are what matters.
>>
>>57536883
Kono Joukyou de Otouto Route ga nai no wa Okashii!
>>
>>57536907
You can only say that when you actually had to honor different calling conventions in your code because you had to program it in assembly.

And then you wouldn't sad that GCC is worthless. But C++? Just give me the template system for C and keep all the other retarded shit for yourself.
>>
>>57536891
Yeah I think this is my best option right now.
I mean after reading the definition, it doesn't ENTIRELY fit, but it's not that bad.
>>
>>57536932
>You can only say that when you actually had to honor different calling conventions in your code because you had to program it in assembly.
extern "C" {
void muh_declaration();
}


How hard is that? Everyone uses the C ABI if you're going to call anything from assembly.

>And then you wouldn't sad that GCC is worthless
I don't understand this sentence. My post was obviously meant rhetorically, all those programs are definitively very useful and thus worthy.
>>
any comp sci students here?
im in first year and thinking of quitting because i dont learn anything programming related i dont already know
its like im paying to get arse fucked by difficult math
>>
>>57536907
>GCC
Have you ever seen GCC's source code?
Excluding a C++ specific parts, that shit is practically C except for maybe 1 C++ misfeature used.
>>
>>57536970
>Specifically say "assembly"
>posts example in C++

Congrats, you reached your retard quota for this day. Now remove yourself from this thread.

>How hard is that? Everyone uses the C ABI if you're going to call anything from assembly.

There is no "C ABI". There is the System V AMD64 ABI, there is the Microsoft x64 ABI, and those two are just the popular ones for x64. x86 has a bunch more, stdcall, cdecl, thiscall - and that's again just one target.

>very useful and thus worthy.

That's not how I measure usefulness.
>>
>>57536981
If your in first year comp sci and getting fucked by math you either have a) really good comp sci program, or b) you are really shit at math and should try something more your speed, like art.
>>
>>57536999
You don't need hard math to be a good programmer.
>>
>>57536981
I'm 4th year, and I didn't find the maths hard.
I think programming takes a mathematical/logical mindset.
But it's something you can practice/get over time.

My uni's Comp Science course is focused on Programming though
>>
>>57536932
>>57536998
>Congrats, you reached your retard quota for this day. Now remove yourself from this thread.
Look mom, I can troll too

>saying that C++ is shit because programming assembly is hard
>>
>>57537001
You don't need math to be a code monkey, but anything more that that requires a basic understanding of calc, or higher depending on your field.
>>
>>57537012
I've never used calculus.
I understand it/did it in School, but I've never used it in programming.
The most complex maths I have used was calculating the variance.
Also one program I wrote had to expand binomials.

>>57536981
Really depends what field you want to get into I believe
>>
>>57537008
>saying that C++ is shit because programming assembly is hard

I said, you already reached your retard quota for today. You don't get any extra tendies for it.

My assembly-post was not directed at the usefulness of C++, but on the usefulness of GCC. Because C removes a fucking lot of what you have to care about without any detriments. That's why it's useful.

You cannot say the same about C++. C++ relies way too much on dynamic memory allocation, to a degree where it gets outright silly, and they suddenly introduce reference counting for resources that are shared. Exceptions are unnecessary, maybe more comfortable, but not simple. Simple != comfortable. I hate comfortableness if it's also not simple. And C++ does not try to be simple, it tries to be comfortable - something that could have been done with proper frameworks in C as well, just without the detriments.
>>
if you're shit at math, why are you even trying, you can be a web dev but even then you'll have a harder time than someone who's good at math, programming (not coding) is a highly intellectual pursuit
>>
>>57537012
>>57537002
>>57537001
Are we really having this shitty argument _again_?

Can we just agree if you want to be a web programmer you can probably ignore most math but if you want to do anything even close to math you're going to have to...learn it?

>>57536981
It will get better--your future classes will be more design oriented and you'll eventually finish your math requirements. This is basically the inverse of most other sciences. Keep your head up.
>>
>>57537066
I'm currently doing a PhD in CS, and I failed university calculus and linear algebra two times before barely passing the third and last attempt. I also got shitty grades in formal logic.

I did extremely well in algorithms and data structures though, and also in statistics. When things are on the practical level, I have a firm grasp of it. It's when it gets too abstract I'm having a hard time understanding it.
>>
File: you-cant-parse-HTML-with-regex.png (123KB, 753x639px) Image search: [Google]
you-cant-parse-HTML-with-regex.png
123KB, 753x639px
>>57535954

Well..

In Ruby I'd build a simple webcrawler..
>http://ruby.bastardsbook.com/chapters/web-crawling/

..to get the threads and runs via cronjob.

Then you need to filter the posts. You can't RegEx a complete HTML document (pic related), but you can grab the posts via some parser, in Ruby I'd take NokoGiri. After you got the content you can throw a RegEx at the content, somethings like "/(>>\d{8,8} (\(you\)))*/x"
Note that I already grabbed the "(you)" within a pair of parentheses..

Next step would be "taking a screenshot and hiding the (you)s", but I'd suggest just deleting/replacing the (you) instead of editing the graphic.

After you deleted the (you), you have to start a browser by the script calling the comamnd line. Depending on your browser it should be something like:
"./Google/Chrome/chrome.exe" --app="bla/your_filename.html"

After a short break (time to open the browser) you could use a screeshot-tool..
>https://github.com/browserstack/ruby-screenshots

..and close the browser again.

The next part is pretty tricky, you have to bypass the caption to upload it. The simplest approach would probably be to notify you that another caption is ready and solve it yourself. Or pay some indian guy for that job.


Congrats, you glorious winged faggot just brought shitposting to a whole new level !!
>>
>>57536981
Be something else but related?
>system / cloud admin
>database admin
>faggot ux designer
>pleb qa
>pajeet helpdesk
Take your pick
>>
>>57537012
Explain. I hear people say this all the time. Can you explain an application for higher level math in programming outside of embedded systems programming?
>>
>>57537109
graphics
____analytics____
cryptography
>>
>>57537062
RAII is inherently a good thing, and exceptions are an extension of RAII; they are not meant to be simple or comfortable, they are meant to be a safe way of aborting the current code path and still cleaning up allocated resources.

As for reference counting, I fail to see how it's a bad thing. Why would you hate on the concept of ownership, you basically have the same idea in C where whatever logical unit is malloc'ing, should also be responsible for free'ing. C++ offers a simple way of transferring that ownership through smart pointers.
>>
>>57537109
Graphics transformations (Matrix), Crypto, Motor control (PWM), User analysis(Stats), Big-O, Optimization(General ability to reason with numbers)
>>
>>57537130
woah there, optimization is way more than general ability to reason with numbers. Discrete optimization, combinatorics, etc. are all crazy fields with a lot of active research.
>>
>>57537109

Unles you want to write your own graphical library or audio/video codecs, you won't get in touch with higher math.

You don't need to understand how a hash gets generated if you just have can just use bcrypt. You don't need to understand Diffie-Hellman or RSA when you can use a simple SSH client.

It's nice to know the reasoning behind "why is traveling salesman difficult to solve?", but it's not something you'll encounter in the average programmer's life.


programming == using libraries and frameworks
>>
>>57537128
>RAII is inherently a good thing,
I had a lengthy discussion about RAII literally 5 days ago, and it was concluded that while it helps preventing imbeciles from creating memory holes, it forces actual programmers to program like shit in order to make things work.

>[exceptions] are not meant to be simple or comfortable

Yes, they are meant to be comfortable. Tell a C++ programmer that he is now going to check each function for a return error code, and he's going to complain about how tedious it is to check for an error every single time.

>I fail to see how it's a bad thing.
>Why would you hate on the concept of ownership, you basically have the same idea in C where whatever logical unit is malloc'ing

I was talking about C, not about the standard library which is a train wreck to begin with. And I do not like malloc either. The concept of managing a global list of memory chunks that are beyond the programmer's control is retarded, in C as well as in C++.

Reference counting also requires locks. Sorry, but I rather have my producer construct and free any resources that are used rather than the workers.
>>
>>57537120
I meant a specific example. What in graphics specifically?
>>
>>57537159
This is such a good answer. Math is useful for understanding the tools you're using, but is not necessary for programming in general. I would argue that math will make you a better programmer though.
>>
>>57537185
I have seen many mathematicians and physicists who cannot program for their life. They are awesome at explaining to me how math works, but then I look at their code, ask "What the fuck is this shit?", point at three connection establishments where one would suffice, and then I just get silence as answer.

And it happens - every - single - time.
>>
>>57537165
>it forces actual programmers to program like shit in order to make things work.
If you by "actual programmers" mean pajeet code cowboys who refuse to follow the ideom and prefer using unsafe practices and ideoms, I agree.

>Yes, they are meant to be comfortable. Tell a C++ programmer that he is now going to check each function for a return error code, and he's going to complain about how tedious it is to check for an error every single time.
It's more tedious to create custom exceptions desu senpai. The point of exceptions is NOT to avoid checking what kind of exception it is, it is exactly as I said a way of ensuring that you safely escape the normal code path.

Look at exceptions as a way of doing out of band signalling, rather than using in-band signalling using return values.

It can also be vastly more efficient.

>I was talking about C, not about the standard library which is a train wreck to begin with.
The standard library is very much a part of C.

>And I do not like malloc either. The concept of managing a global list of memory chunks that are beyond the programmer's control is retarded, in C as well as in C++.
That's the only way of writing portable programs anon. You might write programs the old way, assuming that your process has fixed memory addresses, but it would be extremely non portable and would break security features like NX and ALSR.

>Reference counting also requires locks
No, not inherently. There are no locks in memory allocation for example. That's why you have both shared_ptr and atomic_shared_ptr.
>>
>>57537169
literally everything

like blending colors together, doing lighting calculations, animations, etc etc
>>
i'm bored of my school i don't learn shit
i want to drop and teach myself how to code. Any advice? i'm near the breakdown
>>
>>57537299

I'm in a similar position but let me ask you this: Why can't you stay in and learn to program?
>>
>>57537299
Which uni?
>>
1/2

>>57537231
>If you by "actual programmers" mean pajeet code cowboys who refuse to follow the ideom and prefer using unsafe practices and ideoms, I agree.

No, I mean programmers who do not want to refactor their code because a single object declaration automatically triggers a constructor call that might be potentially expensive (several kernel calls in a row), without ever using the object because it's only used in certain execution paths. And only in those execution paths do I want to initialize and use and free it again.
>put it in their own scope then
And have redundant code because I suddenly have to manage two code paths where one has been sufficient with C?

No, thanks.

>It's more tedious to create custom exceptions desu senpai.
I wasn't talking about custom exceptions. I was talking about default exceptions. The ones you get when you run out of memory. When you divide by zero.

The attitude of C++-programmers is:
>lol let it happen, a exception will be generated
The attitude of C programmers is:
>I have to do it, because generated code is not the shit

I am not saying the C system is perfect. It's not. It would be nice to tell a function that, whenever a function returned something other than 0 this value is now going to be the error code, and the object is cleared. But this is not possible. You need to have control in order to properly clean up objects.

>The standard library is very much a part of C.
I do not think so. The standard library is slow and clunky, and it's that way because they wanted to have something that runs on all systems. That does not mean it's good. When writing a decimal number as string takes 500 cycles with sprintf where a custom function takes 60, then something is wrong with the standard library.

>That's the only way of writing portable programs anon.
Define portable. I am living proof that I can cover at least Linux and Windows with my approach, without breaking NX and ALSR.
>>
2/2

>>57537231
>There are no locks in memory allocation for example.

There are. At least once you use multiple threads. They once wrote a lockless allocator based of the broken design of malloc, but it was just a toy, basically dependent on hardware behavior.

If you don't believe me, go look up some memory allocation code and how it acts when it detects whether or not threads are going to be used.
>>
>>57537310
that's my last year. I hope it'll end soon (in 6 months). I can't learn, do IRL stuff, going to school without skipping class. shit i need more time for myself.
>>57537314
frogland school (BTS SNIR) i'm not sure it'll help you.
>>
>>57537185
>>57537201

Both is correct.

A little background in math and theoretical CS will make you a better programmer.

But it's false to assume that you can "automatically" be a good programmer if you know math. I've seen this a lot of times, mathguys or physicists who look down at programming because it's "so simple". But studying biology doesn't make you a better carpenter, aasy stuff is still stuff you have to learn. Also you can't substitute experience, best practices and the reasoning behind certain practices..

"Theory and practice are theoretically the same."
>>
>>57537234
Is that really high level math, though? Or is it just basic algebra?
>>
>>57537366
most of it is not that hard, like high school level, but for someone who sucks at math it would be overwhelmingly difficult for them to do things effectively or even succeed with certain tasks at all
>>
>>57537169

https://www.youtube.com/watch?v=Q2aEzeMDHMA
>>
>>57537424

https://www.youtube.com/watch?v=DVZJDw6wqeM
>>
>>57537424
that's high school level math. The complexity is in the logic of composition.
>>
>>57537494
That's about as complex as math in programming gets. And even then 99.9% of programmers will never write anything like those things for actual work.
>>
>>57537325
> a single object declaration automatically triggers a constructor call that might be potentially expensive (several kernel calls in a row)
RAII doesn't require complete initialisation. It just requires that the object not be "uninitialised" to the point that it will crash if you try to use it (including destruction).

If initialisation is expensive, it's fine to construct objects in a "dormant" state, such that further explicit initialisation steps are required in order to fully utilise it.

E.g. in GUI toolkits (which are something of a poster child for OO design), widgets typically need to be "realised" (i.e. the corresponding OS-level window-system objects created) before you can render to them or even query certain properties. Until they are realised, they're just blobs of memory. Realisation may be explicit, but usually a call to "show" a top-level window will realise that window and all of its descendants. A widget may remain realised thereafter or may allow explicit unrealisation (GTK3 allows this so that you can migrate a window to another display; all client-side state will be preserved, but the OS-level objects have to recreated for the new display).
>>
>>57536297
>Learn English
Why should he learn the cuck language?
>>
>>57537128
> and exceptions are an extension of RAII
Uh, no.

Exceptions pretty much require RAII in order to be useful (there wouldn't be much point having exceptions if you had to catch and re-throw every exception in order to perform explicit clean-up), but they aren't an "extension" of it.
>>
>>57537494

Have some of those, then:

https://www.youtube.com/watch?v=rqhAOc9gvC4

https://www.youtube.com/watch?v=YSi6vgoftZ0

https://www.youtube.com/watch?v=naaeH1qbjdQ
>>
>>57537531
Mathematics is really great, but in all reality, it's not that applicable to programming outside of algebra an maybe trigonometry/geometry.

I feel like CS programs should spend more time on general Logic.
>>
>>57537535
>RAII doesn't require complete initialisation.
That's why I specifically used "refactor".

>>57537551
Like it or not, it's still the lingua franca in the internet.
>>
>>57537565
Totally agree. Even stuff like sorting algorithms are hardly used in the real world. As in, you never have to actually implement that shit yourself unless you're doing something insanely low level.

Maths can be used a lot in programming, but unless you're working for a university running some highly complex and performance sensitive physics simulation or some shit, chances are you'll never really need to use it much.
>>
>>57537593
>Totally agree. Even stuff like sorting algorithms are hardly used in the real world. As in, you never have to actually implement that shit yourself unless you're doing something insanely low level.

Even then you probably don't need to know lots about the math, but lots about the hardware. Because algorithms that sounds good on the board perform really badly on the hardware because of such nasty little things as CPU caches or TLB evictions.

This is shit that isn't taught to you in your math courses.
>>
>>57537582
>Like it or not, it's still the lingua franca in the internet.
It's the lingua cucka of the Internet.
And no, porn and piracy are pretty mult-national, which constitutes 90% of Internet relevance.
The other 10% is social media, which is also multi-lingual and localized. English is useless to a person using Facebook in a non-English country, no point.
Your gaymes are all multi-language, installations as well.
OS's are multi-lang.

English is only relevant to sites such as this one.
Russian chan manages to be better in function and design though, which is a huge fucking KEK.
>>
>>57537628
>It's the lingua cucka of the Internet.
Stopped reading.
>>
>>57537643
There's one thing all cucks have in common:
They come from English speaking countries.
>>
File: 1478482353204.gif (982KB, 320x287px) Image search: [Google]
1478482353204.gif
982KB, 320x287px
>>57534529
>Ctrl+f "C#"
>0 of 0
TRASH THREAD
>>
>>57537657
Funny, I am from Germany.
Und jetzt wäre es extrem freundlich von dir, wenn du dich in das Loch, aus dem du gekrochen bist, zurückficken würdest.
>>
C# is bloated shit
>>
File: LzMqI4I.png (74KB, 898x889px) Image search: [Google]
LzMqI4I.png
74KB, 898x889px
>>57537657
Wrong. Italians are the biggest cucks in the world. The vast popularity of cuckoldry is a recent American development, but Italians have been cucks for centuries.
>>
>>57537681
Don't look up, but i think a lot of Turks are falling into your hole Germcuck.
>>
I'm working on a Java program which asks the user for their email/password then gets the contents of their inbox and displays it. I have it working for gmail addresses, I was wondering if there's a way to handle any email provider? Or do I just have to specify all the big email providers and handle each of them manually?
>>
>>57537683
Get a better computer.
>>
>>57537710
Your program should determine what the provider is based on the address ending, and like you said, handle them accordingly. You've already done gmail which I'm guessing is the hardest because it has that extra security screen?
>>
57537708
>not even giving y_ou y_our (Y_ou).
>>
>>57537683
Compared to what?
>>
>>57537735
your mom
>>
File: ebina.webm (1MB, 1280x720px) Image search: [Google]
ebina.webm
1MB, 1280x720px
/dpt/-chan, daisuki~

>>57537657
cuckolding was prevalent amongst patricians.

>>57537001
Programming is one of the most difficult branches of applied mathematics; the poorer mathematicians had better remain pure mathematicians.

>>57535003
>vim and emacs are bloated
Emacs is not that bloated due to its limitations forcing tools to be external, reusable programs.
https://tkf.github.io/2013/06/04/Emacs-is-dead.html

>>57534896
Emacs is universal. Where will be geany in ten years from now?

>>57534564
http://immersivemath.com/ila/index.html
Chapter 3.

>>57534529
Thank you for using an anime image.
>>
>>57537748
>>>/v/
>>
What's the best C++ IDE for Linux?
>>
>>57537804
eclipse
>>
>>57537804
I am just coming from a shitload of trouble from VS, by many considered to be a decent IDE.

My advice: don't use IDEs. Not worth the fucking trouble.
>>
>>57537804
depends on the person I guess.
I like qtcreator because on small projects, it is very light, but I know some people who prefer kdevelop or vim.
>>
>>57537816
yeah just use a """"text editor"""" with a gorillion different plugins to do the same shit as an IDE
>>
>>57537804
CLion
>>
>>57537816
?
the only bad thing about VS is projects/solution management, and thats easily fixed by using a proper buildsystem anyway
>>
>>57537832
I use vim without plugins.
Believe it or not, but I prefer programming just with a simple text editor. And console over window. Those have caused me way less problems in the past than IDEs.

Especially for big projects.
>>
For "green" user (I mean, I had several programming related subjects at uni, but I HATE programming as a whole), what would be the best language to learn in order to write software for controlling/collecting data from numerous devices connected to PC via RS-232 ports?

I might need something like that in the near future.
>>
>>57537869
""""""""big""""""""" projects
>>
>>57537804
Unironically Netbeans.
>>
>>57537867
VS is slow as hell, analyses code even though intellisense is deactivated, does not show my "OK", "Cancel", "Apply" buttons in about every second dialog box when I have the font size set to 125%, has mad dependency rules for older frameworks (which I recently ran into when having to use DirectX 8 - yes, I know its deprecated, but that didn't save me from having to use it), and sometimes just likes to hang up - and then I have to restart the fucking machine, because I cannot even kill the process in task manager (it just does nothing).

And all the other compilers out there do produce bloated code for Windows.
>>
>>57537871
C is essential for that sort of applications.
>>
>>57537869
IDE's cause a lot of problems. They also save a lot of time. That's why people use them.
>>
>>57537891
Especially BIG projects.
The bigger the are, the worse VS scales.
>>
>>57535065
What do you need help with?
>>
>>57534588
>>57534621
>being legitimately upset by a funny 10/10 meme
maybe you need to grow up a little before you enter /dpt/
>>
>>57537913
That last part about saving time I absolutely cannot confirm. If you like it, fine. I just hate having to deal with them.
>>
>>57537731
Okay I'll just do it that way, thanks
>>
>>57537938
What language do you work with most?
>>
>>57537938
automatic typechecking when highlighting
>>
>>57537947
Assembler and C, and sometimes C++. Mostly C, though.
>>
Is SQLite any good?
>>
need to publish some C++ stuff to windows but i know jackshit about the process
do i have to recompile for all different versions of windows? (one bin for W10, one for W8 etc)
and what about different versions of the standard lib?
>>
>>57537952
I have the compiler telling me rather than the IDE that there is an error in my program. Because the compiler can generate a nice list of error warnings through which I can iterate.

Also this "feature" tends to generate lots of error messages when certain headers are not even included. I do not want that. I want it to start compiling when I tell it to compile, not while I am typing.
>>
>>57537963
Microsoft has the redistributable packages which the client can install in order to run C++ applications that were linked against the latest version of the standard lib.

With this you don't have to recompile for every version. Only for those which are not supported by the latest version (unverified, but I'd count Windows XP out here).
>>
>>57537978
In a properly typed language it is incredibly useful to know the types as you are typing. Waiting until you're compiling is tedious.

You're probably the type of person that wants types abbreviations in variable names.
>>
>>57537963
Distribute sources and let the user worry about compilation.
>>
>>57537997
Nope. I rather have the header open in another tab to switch I can switch with CTRL + PICKUP/PICKDOWN. There are the field names, and there are the types.
>>
>>57538020
And then there are some neckbeards who wonder why nobody takes /g/ seriously.
>inb4 Pajeet
>>
>>57537937
4chan is 18+ weebshit
>>
>>57538022
Wow, that sentence is mangled. I meant
>in another tab I can switch to with CTRL ...
>>
>>57538022
I am convinced you will understand one day
>>
>>57538037
correct.
hence you shouldn't be here if you can't appreciate the OP picture.
>>
>>57537912

Well, that sucks, since I especially hate C and C++.

Would Pascal or Python fit instead? Pascal have nice "drag and drop" editor for GUIs.
>>
>>57538062
That's no argument, that's just condescending hogwash, and you are intelligent enough to know that.
>>
>>57538080
I know it's not an argument, it's not supposed to be
>>
>>57538075
Why do you hate C? The language in itself is beauty, the only problem is that everyone thinks that the issues it has with its non-existing proper runtime library is best solved with inventing new languages rather than ... I dunno ... providing proper runtime libraries?
>>
>>57537978
>I want it to start compiling when I tell it to compile, not while I am typing.
Why tho
>>
>>57538088
Then you could have just shut up as well. Equal results without any time wasted on both sides.
>>
>>57534896
they work in the cli which means you can use them on remote machines over ssh, use them in gnu screen or tmux, and they'll run in a TTY meaning you can use them on more machines and on weaker hardware

also a good argument for vim at least is that vi is on basically every unix-like machine you'll ever encounter, so knowing how to use it is important

I haven't touched emacs myself, I'm more of a vim guy, however emacs seems _really_ cool
>>
>>57537710
you have to handle them individually

it's like you're asking if all email providers use the same technology somehow
>>
>>57538097
Because I am typing right now. I don't want to knock on a parser that is just there to tell me I am doing an error when I am not even finished with writing the code. Only when I tell it that it can start giving me errors it's supposed to give me errors, not while I am in the middle of actually working.
>>
>>57538125
Are you sure you've even used an IDE before?
>>
>>57538125
>I don't want to knock on a parser that is just there to tell me I am doing an error when I am not even finished with writing the code.
Why though. It can tell you about errors in the code you just wrote. If it's telling you about errors that you know are only there because the code is not finished then you can just ignore them.

Also the parser works by partially compiling the code you just changed, making it very quick. You don't need to do a full recompile every time you change a big of code to know if there's a error or not that will prevent compilation.
>>
>>57538139
Pretty sure.
I prefer text editor over IDE 10 times out of 10.
>>
I've been learning java for a month and starting to get more into it. Is a raspberry pi worth it? Or just a gimmick waste of money?
>>
>>57538145
Like notepad?
>>
>>57538155
Depends what you intend to use it for.
>>
>>57538144
>Because I am typing right now.
I don't want to be interrupted when I am working. Not by an annoying co-worker bitch, not by the building alarm, and especially not from an obnoxiously annoying feature that wants to tell me there is an error that I am maybe perfectly aware of. I am WORKING right now. I tell you when YOU can work. Until then shut up and let me do my work.

>Also the parser works by partially compiling the code you just changed, making it very quick.
OK. Who cares? If the price for that is to constantly being bugged by the interface, then that's a price that I am not willing to pay. Simple and easy.
>>
>>57538165
I have already written that I prefer console editors, like vim.
Notepad++ is next to it, though.
>>
>>57538179
>I don't want to be interrupted when I am working.
You're not being interrupted though.

Sounds like you don't like using IDE's for emotional reasons rather than logical ones.
>>
>>57538191
But notepad++ has syntactical highlighting.
>>
>>57538167
Uhh. P-programming. Not any hardware or computer science stuff. I'm trying to get decent at programming asap. Better to just buy some more books or invest in raspi?
>>
>>57538195
>You're not being interrupted though.
Yes, I am.
>Here is an error.
>Here is an error.
>Here is an error.

If you don't feel interrupted by that, that's completely fine. But I do. And I do not tolerate this shit.

>Sounds like you don't like using IDE's for emotional reasons rather than logical ones.
I have given you my reasons. If you don't like them, then don't start pulling them into mud just because you favor IDEs so much that you cannot tolerate criticism.

Also fuck you, 4chan, my post is not spam.
Can someone please shoot Hiroshima-moot? Thank you very much.
>>
>>57538202
I don't care about syntax highlighting. But in this case it means that I can tolerate it, not that I am appalled by it. As long as it changes nothing else in my interface (like, suddenly marking my code red, and filling in error messages) I am fine with it.
>>
>>57538215
>But I do.
Then I feel sorry for you. Must be hard when an error message that pops up completely outside of the code editor area that you are working on can "interrupt" you.
>>
>fw /dpt/ never answers your questions but every pajeet question gets a thorough answer
>>
>>57538277
For example?
>>
>>57538092

Because I never worked as I wanted it to and it was never telling me what went wrong, unless I would place helload of markers across the code.

The only time C worked properly for me was during microprocessors related course, where we were using it to program 16bit microcontrollers. But it was mostly about setting values for variables in hex, according to manual.
>>
>>57538250
>>57538195
you sound like you haven't used any quality control framework like sonarqube. that shit lists like 200+ errors for every compile just because you put an opening bracket beside a function instead of below it, and other useless shit. Eats up resources while it does that
>>
File: 1451626047512.png (450KB, 1300x1100px) Image search: [Google]
1451626047512.png
450KB, 1300x1100px
Python
>>
>>57538331
is shit
>>
>>57538331
I've got a python for you
>>
>>57538351
OwO
>>
>>57538329
You're right, I haven't. Why would I use something that's bad?
>>
>>57538366
Because your sorry ass is gonna be fired if you refuse to work with it.
>>
>>57538366
Because my boss said so ;_;
It's more than that though, some errors are worth it like suggesting a different way to iterate for memory management. But majority is just errors due to improper coding practices. It's actually bad if you use more that 8 conditions in a switch-case or something annoying like that, because of some BS reason they got from a book
>>
>>57534529
So I have a project idea (python 3.x) but have no idea what I need to look up and what to start with, basically you input the name of a bet (doesn't need to be exact e.g got john snow would match got john snow to sit on the iron throne) then the script searchs 5-10 betting sites for the odds of that bet, then it works out the average odds then works out the implied probability to give you a percentage chance of winning the bet

could anyone tell me what to look up or send me a link to a python script that does something similar it's just the website scanning, bet searching and making the odds as values within the script I have no idea about
>>
>>57538204
He's probably gone by now, but:
If you want to become decent at something, you have to practice, practice, practice.

And never assume, not for a second, that you are better than most other people working out there. Only then do you actually have the chance of becoming better than most other people out there.
>>
>>57538457
Punctuation would be a great start. I don't feel like reading posts that just float into each other.
>>
>>57538482
>I don't feel like reading posts that just float into each other.
if you didn't read my post how did you know it's missing punctuation
>>
>>57537960
>Is a hammer any good?

Different tools, different tasks.

It's good for local relational storage.
>>
>>57538457
sent :)
>>
>>57538524
thank you my man
>>
>>57538457
You're talking about linguistic analysis plus web scraping on many sites.

You're going to have to essentially create your own API for each site that doesn't have one, potentially violate their own ToS and get IP blacklisted for scraping, and you'll have constant maintenance nightmares throughout the entire life of the product.
>>
>>57538541
ah shit, guess I could just make it so the user inputs all the odds rather than the script scraping them - thanks
>>
>>57538029
ah yes because tech illiterates are the only serious users
>>
>>57538073
kys
>>
>>57538523
Read that as
>A hammer is good for local relational storage.
>>
What's a good UI toolkit for java that doesn't look like complete shit?
>>
>>57538765
Not that anon, but what are you even trying to say?

Forcing the user to compile it on their own cuts the potential users down to less than 10% of what it would be otherwise.

You should have both options available. Precompiled for the vast majority, and source for the very few power-users.
>>
>>57538801
Unless it's a commercial application (i.e. you have a financial incentive to target the lowest common denominator), plebs who won't even compile the software they use are not worth worrying about and by catering to them you are making the tech illiteracy problem worse.
>>
How do you work on something when you run out of ideas?
>>
>>57538837
Just think up some new idea to work on using your brain.
>>
>>57538795
kys
>>
>>57538836
see
>>57538029
>>
>>57538837
I don't.
>>
We have to make a shell in my Systems programming class. How does this look?
>>
>>57538846
(You)
>>
>>57538884
awful
>>
My python code is going through the wrong if for some reason. ord prints 90 and yet it goes through the first loop

So its a simple cesear shift. I wrote unittests for it and it fails shiftletter('Z',1) which should return 'A' but instead returns '['

def shiftletter(letter,shift):
num = ord(letter)
shift = shift % 26
if num >= ord('a') & num <= ord('z'):
num += shift
if num > ord('z'):
num -= 26
return chr(num)
elif num >= ord('A') & num <= ord('Z'):
num += shift
if num > ord('Z'):
num -=26
return chr(num)
else:
return letter
>>
>>57538887
thanks
>>
>>57538884
Why malloc? Just use a static buffer if you want to have limitations on the amount of characters.

Also you want to re-read the manual to fgets. You got a nice overflow in that code.
>>
>>57538884
#include <stdio.h>

int main()
{
printf("Hello World");
}


There you go! :)
>>
>>57538907
You are not using the logical AND operator here, you are using the binary AND operator.

Look up for yourself which one is the right one.
>>
>>57538932
>int main()
kys
>>
>>57538943
uhm, like, fuck off?!?!
>>
>>57538935

wow. fuck my life. thanks. I just came from c and this was driving me nuts since it was the only failing test case.
>>
>>57534564
[1,2,3] is a vector with elements 1,2,3

dotProduct([1,2,3], [4,5,6]) = 1*4 + 2*5 + 3*6 = 4 + 10 + 18 = 32

dotProduct([5,1,0], [-1, 5, 9] = 5*(-1) + 1*5 + 0*9 = -5 + 5 + 0 = 0

When the dotProduct of two vectors is 0, then the two vectors are orthogonal. Otherwise they're something else.
>>
>>57538932
>int main()
retard
>>
>>57538950

>The function called at program startup is named main. The implementation declares no prototype for this function. It shall be defined with a return type of int and with no parameters:

int main(void) { /* ... */ }


>or with two parameters (referred to here as argc and argv, though any names may be used, as they are local to the function in which they are declared):

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


Again, kys.
>>
>>57534701
Remember that characters in C can be seen as integers. Use sprintf() to convert integers to strings.
>>
>>57538984
Doesn't matter, compiles to same thing any way
>>
>>57538984
int main(void)
is literally the same as
int main()
>>
include <stdio.h>
#include <string.h>
#include <mpi.h>

int main(int argc, char **argv ){
int id,comsize;
char output[101*9];

MPI_Init(&argc,&argv);
MPI_Comm_rank(MPI_COMM_WORLD,&id);
MPI_Comm_size(MPI_COMM_WORLD,&comsize);

float range = 100.0f/(float)comsize;
int start = (int)(range*(float)id+1);
int end = (int)(range*((float)id+1));
char buf[(int)(range*9)+1];

int i,j;
for (i=start,j=0;i<=end;++i,++j){
if (i%3==0 && i%5==0) strcpy(&buf[j*9],"FizzBuzz\n");
else if (i%3==0) strcpy(&buf[j*9],"Fizz\n");
else if (i%5==0) strcpy(&buf[j*9],"Buzz\n");
else sprintf(&buf[j*9],"%d\n",i);
}

MPI_Gather(&buf,(int)(range*9),MPI_CHAR,&output,(int)(range*9),MPI_CHAR,0,MPI_COMM_WORLD);

if (id==0){
for (i=0;i<100;++i)
printf("%s",&output[i*9]);
}

MPI_Finalize();

return 0;
}
>>
>>57539019
not that guy but it is not in <=ANSI C
so it only really matters if you program microcontrollers whos compiler was written 40 years ago desu
>>
>>57539017
>>57539019
It's not, you C++-retard. A function without parameters in C takes a variable amount of arguments.
int main()
is UB, and the compiler is allowed to optimize the living shit out of your program for that.

In C++ functions with no parameters are equal to (void) functions in C.
>>
File: 1453413160689.jpg (133KB, 937x960px) Image search: [Google]
1453413160689.jpg
133KB, 937x960px
Anybody have a programming task image for rolling? I'm bored as fuck.
>>
>>57539055
http://better-dpt-roll.github.io/
>>
File: chkem-ooh.gif (2MB, 366x360px) Image search: [Google]
chkem-ooh.gif
2MB, 366x360px
>>57539079
ok. Rollin'
>>
>>57539091
ugh why are these challenges all requiring more research than programming?
>>
>>57539091
there's a fucking roll button there on the website you fucking mongoloid
>>
>>57539103
Because that's what programming mostly is.
>>
File: are_you_frustrated.jpg (40KB, 500x375px) Image search: [Google]
are_you_frustrated.jpg
40KB, 500x375px
>>57539105
>>
>>57539115
i am, the website was created specifically to prevent people rolling in the threads and further shitting them up
>>
File: fuckingheteros.jpg (79KB, 486x698px) Image search: [Google]
fuckingheteros.jpg
79KB, 486x698px
>>57539127
b-but rolling is half the fun...
>>
>>57539079
rollan
>>
>>57538837
jack off first
>>
>>57536891
Do engines NEED a gui?

I propose FOMEE: The Framework Or Maybe Engine Engine
>>
File: FullSizeRender.jpg (248KB, 960x1280px) Image search: [Google]
FullSizeRender.jpg
248KB, 960x1280px
Boys, I kinda need your assistance here. I have a deadline on friday for a crossplatform application. Some crypto innovation shit.

Custom openssl fork, custom openvpn fork etc. All is nice and quite on the linux front but as a fellow neckbearded basement dweller, I can't handle the windows shit.

Is there an anon lurking with cross-compiling openvpn for gaydows experience?
>>
>>57539276
Why not set up a virtual machine with Windows and compile there? That's what I do. All the cross compiling shit never worked for me.
>>
>>57539310
I would if I could.
https://community.openvpn.net/openvpn/wiki/BuildingOnWindows

> This documentation is obsolete and only applies to some historical versions of OpenVPN. The current instructions for building OpenVPN for Windows are available here.

> Crosscompile only FML
>>
>>57539338
OK, then I'd research how to set up mingw for your distro. The mingw gcc suite should allow you to compile on Linux for Windows.
>>
>>57539355
Already provided by OpenVPN
But as soon as I switch to custom openssl, shit starts with undefined references to the new crypto functions. I have no clue which file formats mingw handles for linking
>>
>>57539389
What error messages exactly?
Are you sure that you have set the cross-compiled libraries as target, and not the ones provided by your system?
>>
Undefined reference error, aka linker not knowing where to find the new functions. On linux it works just fine but I guess the provided build script from openvpn fucks up configure.

I literally did all the steps in their guide
https://community.openvpn.net/openvpn/wiki/BuildingUsingGenericBuildsystem
I replaced the sources with mine ofc
>>
i'm implementing all the common data structures (in j*va) what bare minimum operations should i include for all of them though?
>>
programming a photo cipher where messages are hidden in the rgb values of an image. I have that part along with ciphers like ceasar shift and such, and unit tests.

What else can I add to this project?
>>
>>57538884
in Haskell this is just

main = forever (getLine >>= system)
>>
In C++, whenever I implement functions in the header file I get errors about multiple definitions of them and need to change their definition to static. Are there any other ways of dealing with this problem?

Should I just put function prototypes and implement them in a separate .cpp? Seems slightly long for one-liner functions.
>>
>>57539589
you got 2.5 options, make them static, or inline or move them into an anonymous namespace
>>
>>57539589
Use inclusion guards you dummy

#ifndef __MY_HEADER_H__
#define __MY_HEADER_H__

inline int foo(int b) {
return b << 1;
}

#endif

>>
>>57539589
>whenever I implement functions in the header file

Don't do that unless those are template functions. Instead, put the interface into the header and the implementation into its own source file.
>>
>>57539630
It's fine for one-liners and inlined functions too.
>>
>>57539642
Yes, but then you have to declare them as static inline.
>>
>>57539654
>static inline
No. static does not do what you think it does, unless it is within a class scope.
>>
>>57534529
Can I share something with you fellas?

I had programmer's block for months until last sunday when I put on some of my chubby cousin's clothes (she is visiting from an another state/region)... I am writing code like some stereotypical anime character now. I shit you not, I am fantasizing about being caught by my loli niece all this time and have been sporting a titanium hardon during every break I took. I have never been more productive in my life.

.. You should try it...
>>
>>57539668
get help
>>
File: (Image PNG, 280 × 279 pixels).png (33KB, 280x279px) Image search: [Google]
(Image PNG, 280 × 279 pixels).png
33KB, 280x279px
https://jsfiddle.net/pzpqL9ou/

Why my fractal get pixelated after 47 zooms ? I think it has something to do with the maxium floating point or something like that

Also i feel like my code is shit, any idea to improve it ?
>>
>>57539662
It can be that it does something else in C++ that I am not aware off - I just realized that I was stating this from a C perspective.

But in C it prevents the compiler to export such functions in the object files, which would later cause linking problems for the entire project.
>>
>>57539684
https://jsfiddle.net/pzpqL9ou/2/ *
>>
File: 20160507-132205_1462639103086.gif (787KB, 91x125px) Image search: [Google]
20160507-132205_1462639103086.gif
787KB, 91x125px
>>57539668
Please only engage in serious discussion.
>>
>>57539755
Forgot to include <stdio.h> but still.
>>
>>57539763
Where do you think you are?
>>
>>57539755
First:
>int main()
>int foo()
>int bar()

Learn that fucking functions in C do require "void" if they take no arguments.

Second: <stdio.h> wasn't included.

Third:

$ gcc a.c b.c -o o -I .
/tmp/ccdjtfQ0.o: In function `foo':
bull2.c:(.text+0x0): multiple definition of `foo'
/tmp/ccwVn6Ft.o:bull1.c:(.text+0x0): first defined here


Just what I said.
>>
>>57539855
NEW THREAD

>>57539855
NEW THREAD

>>57539855
NEW THREAD

>>57539855
NEW THREAD

>>57539855
NEW THREAD
>>
Three years and not a single finished project.
It's because I have an insatiable desire to go LOWER.

Abandoning my 3D graphics engine on C to learn embedded programming on a beaglebone.

Wish me luck
>>
>>57539920
>still believing that any project is "finished" at some point
That's cute.
>>
>>57539966
I can finish a project the purpose of which is to assign 1 to a variable and end the program.
>>
>>57539989
And after a while you'll seek for perfection.
>>
>>57539966
>what is a statement for scope of work

I'm fine with scope changes if they are willing to pay for more hours.

After the scope is satisfied, "Fuck you, pay me."
>>
>>57538800
JavaFX
>>
>>57537095
I've got a pass for enhanced captcha free shitposting
>>
>>57534824
if(user2 == 'r' || user2 == 'r')

what

if(user2 == 's' || user2 == 'S')

just do
if(tolower(user2) == 's')
Thread posts: 320
Thread images: 19


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