[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: 348
Thread images: 46

File: 1460419622660.png (28KB, 413x360px) Image search: [Google]
1460419622660.png
28KB, 413x360px
 op.image.isAnime() == true 
edition

What are you working on, /g/?

Previous: >>57339289
>>
>>57342052
>no anime image
>xkcd
Bye /g/.
>>
>>57342080
>autism triggered
>>
ok so i can code now (finished buckeys C++) now what?
>>
File: 1468243235605.jpg (50KB, 633x758px) Image search: [Google]
1468243235605.jpg
50KB, 633x758px
I'm fucking tired of having to use Windows just to play one fucking game

I hate developing on Windows, I hate everything about this shitty operating system
>>
>>57342139
>Don't play that shitty game
Fixed.
>>
File: 1469822159587.gif (2MB, 400x222px) Image search: [Google]
1469822159587.gif
2MB, 400x222px
>>57342080
>>
>>57342139
Dual boot, you retard.
>>
>>57342052
Some guy in the dorms only uses facebook to text, I don't use facebook, so I'm making a messaging application. Currently writing a thing to guarantee every recipients gets all the messages, even if they weren't online when the message was sent.


Writing it all in java
>>
>>57342138
>bucky teaching anything worth a shit
(You)
>>
>>57342139
what game?
>>
>>57342173
not even meming i did 72 tutorials now idk what to do
>>
>>57342184
osu!
>>
does anyone have the extended xkcd comic or its copycat where you have different excuses for different branches of jobs like 3d modeller saying it's rendering
>>
>>57342184
nethack
>>
>>57342187
i wasn't questioning that you finished his tutorials, i was questioning that you actually can program as a result
>>
>>57342139
>>57342184
Yes, I want to know two
>>
>>57342052
So I'm learning python and want to make a script to crack common codes and ciphers here's what I plan on having binary, hex, decimal, ceaser shift, base64
I know binary, hex, decimal and base64 aren't codes or ciphers but I see them being used on /r/ciphers a fair amount so I decided to add them

anything else I should add, just looking for ones commonly used and crackable
>>
>>57342187
Make a thing
>>
File: 1478030873822.jpg (36KB, 480x375px) Image search: [Google]
1478030873822.jpg
36KB, 480x375px
>>
>>57342209
I use UpperCamelCase for types and lowerCamelCase for not-types. Fight me.
>>
File: Untitled.png (94KB, 480x375px) Image search: [Google]
Untitled.png
94KB, 480x375px
>>57342209
>>
>>57342202
well i dont see why not, i mean hes basically a spoken version of an intro to code book. he just teaches in an odd order.

>>57342207
yes but what thing.
>>
>>57342157
Dual booting is inconvenient
>>
>>57342248
he basically just lists features of the language and uses them in contrived examples without actually explaining anything
>>
>>57342248
make a program that inverts a binary search tree (left becomes right & v.v.)
>>
>>57342257
This. Dual boot is like living in two homes at the same time.
>>
>>57342271
>solving the problem the guy had two threads ago
nice try guy from two threads ago
>>
File: 1446959738751.png (15KB, 551x518px) Image search: [Google]
1446959738751.png
15KB, 551x518px
Is there actually any use for Hungarian notation
>>
>>57342275
or it's like having a home and a workplace, or a home and a studio. you may just be using it wrong if it's potential positives are negatives for you
>>
>>57342227
> object Object; //:^)
>>
>>57342312
I don't use that kind of language.
>>
>>57342271
i never said i could do that sort of programming.

>>57342263
i doubt he actuallly understands it himself, or all of the other languages he teaches. i sort of subbed it with other learning but now idk what to do.
>>
>>57342300
invert(BST myTree){
BST newTree;
newTree.left = invert(myTree.right);
newTree.right = invert(myTree.left);
newTree.value = myTree.value;
}
>>
>>57342322
> struct object *Object; //:^)
>>
>>57342302
Nope. Fuck everyone that use abbreviations. There are completely useless if you aren't an old cuck that type more than 2 words.h^-1
>>
>>57342302
could be useful for writing auto documented code in a dynamically typed language.
>>
>He works on open source software.

kek
>>
>>57342369
ITT: Cancer
>>
>>57342369
well, you know that more and more proprietary softwares are now open source, right?
>>
>pic related
hillary's website has a server side word list that bans certain names. let's have some fun with their api :)

POST https://www.hillaryclinton.com/api/selfie/validate_text

> request headers
Cookie:uwotm8
Host:www.hillaryclinton.com
Connection:keep-alive
Content-Length:20
Origin:https://www.hillaryclinton.com
User-Agent:Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1
Content-Type:application/json
Accept:*/*
Referer:https://www.hillaryclinton.com/inhonorof/honoree/
Accept-Encoding:gzip, deflate, br
Accept-Language:en-US,en;q=0.8

> request body
> raw (application/json)
{"text":"Seth Rich"}
>>
File: seth.png (20KB, 868x456px) Image search: [Google]
seth.png
20KB, 868x456px
>>57342419
related /pol/ thread:
>>>/pol/95555032

pic related is an example
>>
pointers, are we for or against them and why
>>
daily reminder that webdevs are the trashmen of computer science.

https://twitter.com/addyosmani/status/793197147713773568
>>
File: 1450224930619.jpg (96KB, 960x960px) Image search: [Google]
1450224930619.jpg
96KB, 960x960px
Made this little thingy.
How would you improve it?

char* IntToStr(int number)
{
static char result[32] = "";
char digits[10] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
bool negative = 0;

// Clear (static) result array
for(int i = 0; i < 32; i++)
result[i] = 0;

// Edge-case for 0
if(number == 0)
{
result[0] = '0';
return result;
}

for(int i = 0; i < 32; i++)
{
if(number < 0)
{
negative = 1;
result[0] = '-';
continue;
}
if(number == 0)
break;

result[i] = digits[negative + number % 10];

number /= 10;
}

//reverse(result, result + strlen(result));

return result;
}
>>
>>57342419
What's the point? Are you trying to build a list of banned words?

I don't get it.
>>
>>57342441
pointers are just another kind of comonad
>>
>>57342476
the banned list of names will be telling

e.g., Seth Rich is probably the guy who is behind the DNC Leaks; he died under very suspicious circumstances:

https://en.wikipedia.org/wiki/Murder_of_Seth_Rich
>>
>>57342052

Could I write a geometry shader in OpenGL that takes in number of sides as a vertex attribute and then makes a regular polygon around it?

Also is the correct place to transform/scale/rotate a shape in the vertex or geometry stage
>>
>>57342476
>>57342515

known banned words so far:

Seth Rich
Vince Foster
Monica Lewinsky
Gennifer Flowers
Paula Jones
Julian Assange
Anthony Weiner
Chris Stevens
Juanita Broaddrick
Sean Smith
Benghazi
Tyrone Woods
Glen Doherty
Embassy Cat
Super Predator
Bill Clinton's Cigar
>>
>>57342515
Holy shit.. Also I don't think we need more proof that Hillary is a cunt.
>>
Let's say I want to download 10 files simultaneously and have their completion percentage display in the terminal in realtime.
like so:
file 1 -- completed 65324 bytes of 135220 total (47%)
file 2 -- completed 1276 bytes of 109220 total (1%)
...


How would I do that with pthreads in C?

I don't really understand how you could get all the files to display in the correct order upon every carriage return when dealing with threads.
>>
>>57342528
Yes. Normally, you'd do that in the vertex shader but if you're generating geometry in the geometry shader you often have to put some or all of the transformations after that.
>>
>>57342453
char *IntToStr(int number)
{
char str[15];
sprintf(str, "%d", number);
return str;
}
>>
>>57342571
I wanted to use my own implementation, obviously.
>>
>>57342594
Your own implementation sucks and is not optimized for the compiler
>>
>>57342602
What about it sucks?
>>
>>57342539
>Bill Clinton's Cigar
lolwhat
>>
>>57342620
That it isn't optimized for the compiler.
>>
>>57342548
Via locks. All threads have to report in an array how many bytes are received, and how many are expected (if you are talking about HTTP that cannot really be done unless Content-Length is available as an header). Then the main thread has to constantly go through the list (locking it for reading) and display the status of all threads.

Since printing takes a long time, I'd considering just creating a copy of the list in the main thread's stack and then releasing the list immediately. That way all threads that want to report their current status don't wait too long on the output of the main thread.
>>
What's the semantic difference between a class and a struct?

In c++ the only technical difference, afaik, is the default access level to members. My autistic friend insists that structs should not have methods, but that just means i have to write any functions that operate on the data in the struct as taking one extra argument. To me this seems conceptually exactly the same as a method, only with slightly more annoying syntax.
>>
>>57342659
>Your own implementation sucks and is not optimized for the compiler
>sucks and is not optimized
>sucks AND is not optimized
>AND
>implying there are reasons behind why it sucks, in addition to it not being optimized for the compiler
Sick reasoning, bro. I'm guessing English isn't your first language AND you're retarded.

Also why the fuck would it matter if that code was compiler optimized or not? It's obviously not meant to be used at a low enough level for it to matter. You're trying too hard.
>>
whats a better way of doing this

//checks if the current time is unix time

systime = time
x = 0

fetch systime

for (x<systime; x+=1){
cout << "waiting";
}

if(x<140000000){
cout << "Thats not unix time, or your clocks too early!}
else{
cout << "welp its unix time"}
>>
>>57342742
I like to use struct for something that is POD (i.e. C struct semantics) and class otherwise. POD means no private/protected members, no virtual methods, and default destructor/copy/move constructors/operators. However, a struct can have methods as long as they aren't virtual and remain POD just fine.
>>
>>57342762
>https://linux.die.net/man/2/time
>time() returns the time as the number of seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC).
>Conforming to SVr4, 4.3BSD, C89, C99, POSIX.1-2001

You can be sure that time() always returns the UNIX time.
>>
>>57342052
>14 million lines of code
>entire project compiles in <5 minutes
>you will never be a programmer in the 80s when you did daily builds because it took all night to compile
>>
>>57342795
This makes sense to me.
>>
I've been gone for a while, this pajeet meme is pretty lame
>>
>>57342818
this is why you dont just compile an executable, you have smaller easily replaceable files
>>
File: umaru.jpg (282KB, 640x961px) Image search: [Google]
umaru.jpg
282KB, 640x961px
>>57342818
no, today you wait the whole week for eclipse to start.
>>
>>57342882
Pajeet here.
It's not a problem. I know a lot of people who last used C++ 10-15 years ago and nobody died, they are good specialists, but if they have to use it they would learn it quickly again. C++ itself as a language won't give you shit, besides shitty memory management practices.
Now we need to know technologies, APIs, frameworks, 3rd-party software, you need to be more a devops/build engineer/admin/troubleshooter than actually a software developer. You need to represent several professions in your skills. You use your smartphone, but I don't think you have full grasp how it works inside, you can develop programs in java or swift without having full understanding about smartphone guts, even 11 y.o. can. You just need to have some basic understanding about low-level programming, but everything is already done for you by other people, you just need to know how to properly use it. Every language gives you a set of abstractions. Every product if it has at least a little bit of self-respect offers api clients for many languages. Now we can do mobile development using C# with Xamarin, it would be impossible even 10 years ago.
Nowadays it's highly recommended to be a quick learner. The matter is not in a language. You should be really smart to be a good developer. On my personal opinion you can be a programmer only if you were top of your class at high school, you have to have a good memory, because in the real world you will investigate issues not having anything, by indirect sings you need to understand the reason of some failure, you need to be a really smart guy otherwise your job will turn into torture for you. You can't learn it - you need to have a talent.
Think twice. If you are Pajeet like me and was born in a shithole than go ahead and be a programmer, because we have no other choice, but if you are from a country like germany, usa, canada, italy with set of available professions and you have other choice I would think twice if I were you.
>>
>>57342818
How many LoC is Qt? I've heard it's a monster to compile.

The game engine we worked with at school took a couple of hours to compile.
>>
>>57342893
>>57342881
>>
>>57342870
If you want to make sure your struct really is POD, you can include
<type_traits>
and put
static_assert(std::is_pod<MyStruct>::value);
somewhere.
>>
>>57342149
>omitting the part where he turns and calls his wife's name

Weak.
>>
>>57342903
The problem with all C++ projects is not that those are monsters. I mean, they are, but that's not the problem.

The problem is that compiling C++ code takes unbelievably long because of optimizer shit.
>>
>>57342903
Qt takes forever because of generics and template hell. Once it is compiled though, you should create a precompiled header for your project to avoid recompiling qt everytime you change a header file.
>>
>>57342938
Oh, i thought >>57342818 was complaining that everything compiles too quickly today.
>>
>>57342938
disable optimizer then


also where does this monster stereotype come from? as opposed to what??
>>
>>57342818
Currently working at a company 30 years old, still using BCPL, still using a reaally old hardware architecture that they custom build virtual emulators for because there is no where in the world that supports it as of 10 year sago. Still takes 8~ hours to compile and build all of the codebase to distribute to test machines.
>>
>>57342971
I am not him. I wish projects like thunderbird or firefox - or generally all C++ stuff - wouldn't take so fucking long. C compiles so damn fast and C++ so damn slow that if I had hair left I'd tear it out.
>>
>>57342908
Why would i not know if my struct is POD? Am i an idiot?
Well, i mean, yes i am, but i'm not THAT stupid, am i?
>>
>>57342870
It's not my wallet
>>
File: hahahahahaguys.jpg (96KB, 689x768px) Image search: [Google]
hahahahahaguys.jpg
96KB, 689x768px
>>57342515

>its all going to end soon
>>
>>57342983
>disable optimizer then

If you disable optimizers your code literally becomes shit covered in shit-stained rags begging to be tossed in shit. The reason why people program in higher languages is because of the fucking optimizer which is supposed to produce better code than what normal people can do with assembly.

Fuck you with "disabling optimizers".
>>
>>57343011
I forgot to mention that all the fields also need to be POD. So you could make a change to the type of one of the fields that makes it non-POD, and you might not realize that you've now made everything that contains it also non-POD.
>>
>>57343019
Wat?
>>
>>57343033
In any case, i learned about a new thing in the stl. Thanks for that.
>>
>>57342971
UGH I hate how my code compiles quickly
>>
>>57343158
you were born too late
>>
File: why.png (48KB, 889x609px) Image search: [Google]
why.png
48KB, 889x609px
Why do i get that symbole?
>>
>>57343285
you forgot to add the offset for ascii in the second for loop
>>
>>57343326
How do i add it(im beginner)
>>
>>57343285
Could it be you actually meant 'a','z' instead of 1,26?
>>
>>57342312
Are you retarded? it's the other fucking way around you dipshit
>>
>>57343355
same way you did it in the first loop
>>
>>57343355
Retard:
>http://stackoverflow.com/questions/1674126/how-to-get-a-random-letter-in-java

I hope you pajeet die soon enough.
>>
>>57342205
r/ciphers is a fucking joke. Also, hex is not encryption ffs. Neither is decimal you fucking pleb. But seriously, some of the posts on r/ciphers are ridiculous.
>>
>>57342197
It sucks that it lags with playonlinux.

>>57342139
If you play visual novels and stuff you can still use loonix
>>
>>57343391
read my post
>I know binary, hex, decimal and base64 aren't codes or ciphers
is there a better place to learn about codes and ciphers, maybe r/codes or something? or will I just have to stick to books?
>>
what do you guys use to record your screen on linux? I want to show my program running but don't know what screen recording program to use.
>>
>>57343388
Anon, that's not Java.
>>
>>57343443
Forgot to mention I am using kubuntu
>>
>>57343436
Try a transposition cipher. That's more of a challenge that programming a caesar cipher.
>>
>>57343504
will do, thanks
>>
>>57342349
>not struct object *o
do you even C?
>>
>>57343582
I just threw up
>>
>>57343496
I use kazam, it works pretty well
>>
>>57343601
Yes, you did.
>>
>>57342453
adding char '0' to a number 0 through 9 converts it to its ascii equivalent
likewise subtracting char '0' from char '0' to '9' converts it to the corresponding number
>>
>>57342893
What can you say about embedded development?
>>
>>57342165
Is the idea to make this guy use your application?
>>
>>57343676
Right you are. I tried using that before, but I messed something up and switched it to that array-based solution.
The '0' -way is better. Thanks.
>>
>>57342996
How does BCPL compare to regular C?
Is it true BCPL is just C with only word type?
>>
>>57343744
The idea is to make the application, if he uses it then I'll be a tad bit more satisfied. Don't worry, I'll make it with a pretty UI and notifications
>>
>>57342165
You want to make a messaging app that uni students will use? Fill the gaping void that Yik Yak has left behind now that they're just Twitter with downboats.
>>
>>57343871
First let's see a working thing that works with 2 people on a nano aws server, and go from there.
>>
Why do so many people dislike simplicity?
>>
On the topic of endianess.

Is there any reason one would make ones architecture little endian on the bit level, but big endian on the byte level, or vice versa? Is there any architecture that does?
Does this question even make sense?
>>
>>57344088
Why do so many people mix up simplicity with comfort?
>>
>>57342571
>>57342744
Your implementation does suck though, you're returning a pointer to automatic memory.
>>
>>57344120
>Implying I did
Things should be as simple as possible but no more.
>>
>>57342938

C generally is able to make the same types of optimizations as C++, but compiles significantly faster. The reason C++ takes so damn long to compile is because of templates.

>>57344116

As far as a programmer is to be concerned, even at the assembly level, bit level endianness isn't a thing, because you cannot address bits.
>>
>>57344148
I didn't imply anything; I answered a question with yet another one.

I see people complaining that C isn't simple, and it make me want to choke them for being this retarded. C is simple. It's just uncomfortable. But that's not the fault of C, but of the fact that all frameworks out there suck.
>>
>>57344185
Except with networked programming.
>>
How do you guys convert videos to webm on linux?
>>
>>57344204
ffmpeg
>>
File: fbos.webm (135KB, 720x420px) Image search: [Google]
fbos.webm
135KB, 720x420px
>>57344204
ffmpeg or melt on top of ffmpeg to do a little editing before hand
>>
>>57344196
I'm sorry but I don't think everyone to be smart enough to contribute in this world.
>>
>>57344246
>tfw no high performance double buffered cache optimised fizzbuzz
>>
>>57344214
>>57344246
Thanks
>>
>>57344204
ffmpeg
>>
>>57344246
>FizzBuzzOS
hum.... Source please? :^)
>>
>>57344185
Not being able to adress bits does in no way preclude analysis on a bit level.
For example, reading up on the Opus compression format, the first byte of an Opus packet describes the compression mode of the packet with 5 bits, stereo or mono with 1 bit, and 2 bits for a code describing the number of frames in the packet.
When encoding multiple fields of information in one bit like that, i should say bit level endianess matters.
>>
>>57344294
https://gist.github.com/anonymous/74c951c2a45ca498c05652c8debcdf18
>>
>>57344324
in one byte*
>>
>>57344259
What do you mean by that exactly?
>>
>>57344344
Thanks. How are fonts handled though? Am I missing something?
>>
>>57344204
I have website that can do that, i could upload it to github so you can use it on localhost.

>it is php + ffmpeg
>>
>>57344395
https://en.wikipedia.org/wiki/VGA-compatible_text_mode
>>
>>57344324
Yes, but you being the only one regarding it as feasible how does one practically apply endianness at the bit level for people like >>57344116 ?

I always figured endianness just accounted for iterator direction as far as optimal performance was concerned...

[ little
] big
>>
Hi, just wondering, I know Python and am looking into C and imo its not too much of a step up from Python. (From what I am looking at)

I am certain I can write a lot of C equivalents of Python number algorithms in C but is there any need to write C code other than for linking with other languages?
>>
>>57344198

Well, no. Even if you're writing a network driver in pure assembly language, and are dealing with raw ethernet frames, bit ordering is not something you are ever exposed to. Byte ordering definitely, but not bit ordering.

>>57344324

With regards to bitfields, the CPU is going to perceive it the same way no matter what. Ordering the bits the right way is the job of whatever bus is handling serial/network data as it is loaded into RAM.
>>
>>57344503
> is there any need to write C code
Yes, when perfomance matters.
>>
>>57344442
Those are both me. Reading about Opus is what got me thinking about the significance of bit level endianess. It is not obvious, to me at least, that bit level endian model necessarily is the same as byte level endianess.
>>
>>57344503
https://github.com/numpy/numpy
click the two-colored bar
>>
>>57344388
Nothing, I'll just kill myself painfully.
>>
>>57344503
When the library uses a macro instead of a function call, making you have to interface using a self made c file to call the macro by wrapping it in a function.
>>
Taking a CS50 class. Filling in some missing functionality in a server.c file.
First part of one of the functions works now. Enjoy my shit code that I spend days on.


bool parse(const char* line, char* abs_path, char* query)
{

char to_abs_path[LimitRequestLine + 1];

char* path = strchr(line, '/');
char* tail = strrchr(line, 'H');

if(line[0] != 'G')
error(405);
if(line[3] != ' ')
error(405);
if(line[4] != '/')
error(501);
if(strchr(line, '"'))
error(400);
if(strcmp(tail, "HTTP/1.1\r\n") != 0)
error(505);

for(int j = 0;path[j]!= 'q' && path[j] != ' ' ; j++)
to_abs_path[j] = path[j];

to_abs_path[strlen(to_abs_path)] = '\0';
strcpy(abs_path, to_abs_path);

printf("%s\n", abs_path);
return true;
>>
>>57344521
But in this case there is no right way, as far as the bus knows. It must fall on my responsibility as a programmer to interpret the bit field in the correct order, or my data will be garbled.
>>
>>57344409
Cool, lets see it.
>>
>>57344587
And you made sure your content is NUL terminated? If I remember correctly, there's nothing stating that HTTP needs to be NUL terminated.

In fact I'd consider it bad practice terminating what you read from the socket. And you could have an array of all supported methods instead of performing checks like
line[0] != 'G'
, that's buttugly.
>>
>>57344672
Also, learn how2 memcpy. Or just avoid copies in general if you can help it.
>>
File: 1449996136236.jpg (7KB, 208x208px) Image search: [Google]
1449996136236.jpg
7KB, 208x208px
h-hello /dpt/
Having a little trouble here.
I got my videoplayer to pause/play with spacebar but I have to click on the player first before it allows to register the key. How do I get it to autofocus on the window or something.

$('video').click(function(){this.paused?this.play() :this.pause();});
$(window).keypress(function(e) {
if (e.keyCode == 32 || e.keyCode === 32) {
$('video').get(0).paused?$('video').get(0).play() :$('video').get(0).pause();
}
});
>>
>>57344324
>When encoding multiple fields of information in one bit like that, i should say bit level endianess matters.
Endianess doesn't matter, it''s the actual bit format (i.e what does bit 0, bit 1, bit 2, etc represent) that matters and that can be whatever the programmer wants.
>>
>>57344691
No.js
>>
what codecs should I use for ffmpeg if I wan't to convert an avi to a webm?
>>
>>57344691
This seems like reasonable behaviour for a video player.
>>
>>57344706
But which one is bit 0?
>>
File: IMG_2782.jpg (73KB, 900x900px) Image search: [Google]
IMG_2782.jpg
73KB, 900x900px
>>57344691
>if (e.keyCode == 32 || e.keyCode === 32) {

kys.js
>>
>>57342302

I never got all the hate for hungarian notation..

I guess nowadays everybody uses clever IDEs that always show the type, but there's no damage doen when you put down the type asa reminder..
>>
help /dpt/
I desperately want to learn how to program. To keep this short, I've tried in the past to use Language Manuals (K&R, LPTH, etc) but the problem is they teach me how to use a language, not how to program itself.

I need a book that teaches the fundamentals of programming. Of course, there's SICP but it's written for the individual with a passing background of computer science. My area of expertise is more networking and systems administration so a lot of it goes over my head.

Is there a book that's as I describe? Teaches the fundamentals of programming without assuming anything instead of teaching me a language with the idea I'm already educated on the matter?
>>
Where should I start if I want to make a real life anonymous imageboard:
When you send a handwritten letter to an authority, copies are resent to everyone automatically.

How to build a fully automated postal address? Should I create a prototype with arduino to find the most efficient way to process letters?

Also, I want drawings/doodles raws to be kept as-is.
>>
>>57344716
Avi is just a container just like webm.
>>
Is there a possibility in MATLAB to form calls like in python, i.e. calling
some_func(delta=2.5,gamma=2.3);

without reading just one string and dissect it?

I just finished the function I had to make, but calling it could be a lot easier.
>>
>>57344747
because the code becomes an unreadable clusterfuck
>>
>>57344745
just making sure :^)

>>57344747
>no damage done
>>
File: 1372401199636.png (70KB, 256x399px) Image search: [Google]
1372401199636.png
70KB, 256x399px
>>57344711
>>57344745
Please forgive me plebeianess!
>>
>>57344607

Regardless of the way the bits are sent over your network cable, serial cable, or whatever, bitshifts and bitmasking at a byte level is always going to produce an equivalent result, regardless of CPU architecture. That is, if your bitfield is specified as being xxxxxyyz, to access field z, you would use a bitwise and with 1, regardless of instruction set. Thus, to a programmer, you needn't ever concern yourself with bit ordering. Byte ordering, however, is of importance to programmers, and bit ordering is of importance if you are designing hardware.
>>
>>57344743
The one representing 2^0, i.e: x & 1.
Until you have actual instructions that can address a single bit, there are no endianess issues with bits.
>>
Sounds like you want to install Linux.

All joking aside, this system basically teaches you how to learn proper programming on its own.
>>
>>57344749
Just write some programs my dude. There's no other way to become a decent programmer other than plenty of experience.
>>
>>57344791
I forgive you, but please don't post js in the future.
This thread is for programming, not scripting.
>>
>>57344691
>e.keyCode == 32 || e.keyCode === 32
>e.keyCode == 32 || e.keyCode === 32
>e.keyCode == 32 || e.keyCode === 32
>e.keyCode == 32 || e.keyCode === 32
But... why?
>>
>>57344766
What does that mean?
>>
>>57344755
>buy a copy machine
>get sponsors, send their flyers along with the copies
>get money from sponsors
>pay some guy to work on the copy machine and deliver copies to the postal office
>>
File: wallhaven-256687.jpg (137KB, 3440x1440px) Image search: [Google]
wallhaven-256687.jpg
137KB, 3440x1440px
>>57344688
Thanks sempai
>>
>>57344809
You don't need the Philosopher's stone to take a bar of lead out of a box and put it in a differently-shaped box.
>>
File: do_not.jpg (31KB, 600x465px) Image search: [Google]
do_not.jpg
31KB, 600x465px
>>57344749

Let me guess:

You READ K&R but haven't done the exercises?
Programmign is a lot about "learnign by doing".

Just learn the basics of A-N-Y langauge (it really doesn'T matter where you start) and then you do small projects, then small-to-meidum project then your first medium project, then your first bigger project.. and you're a programmer.

Just google "tutorial for [langauge xyz]" and then google "programming challenge" or "ideas for small projects".

If you have no clue at all, just start with C, Java or Python.
>>
>>57344646
ill in few minutes, just need to remove my info from files headers
>>
>>57344810
Ehrm.. I don't want anonymity to be violated by investors.
>>
>>57344607
You can never get just a single bit over the bus, it will always be at least a byte (or more likely, a word).
>>
>>57344807
Probably another unfortunate case of Cargo Cult Programming :(
>>
>>57344749
Thanks for feeding my ego with your inferior intelligence. Can I kiss you?
>>
>>57344791
This drawing is actually terrible. Sorry k-on fags but you must be blind or full of shit.
>>
>>57344800

That's what I tried doing in the past. It just never clicked with me, the most complicated things I've ever written is something in C that spits randomly colored characters to a terminal screen and a High/Low game written in BASIC.

I know of for/while/if/etc. I know what they do. I do not, however, know of the clever applications of these or how to write a program more complicated than anything that can be contained in the main() function.

I know of data types like int, string, char, etc. Again, I don't know their applications or why they're like that or what all magic can be done with them.

I could go on, but the point is I just wish I had a concrete starting point to build a solid foundation to expand my learning

>>57344841
the above applies to this too, but I have something more to say
I tried my damnedest to do the exercises but it always seemed like they used some obtuse solution that wasn't covered when they introduced the program feature.

I've always wanted to write a tiny graphical text editor in C, but again I have no idea where to even start. I know of functions and a very light understanding of how they work, but I don't know how they operate within a program or the program flow of a program utilizing multiple functions, or how people write programs that seem to almost completely eschew main() and pass everything off to other functions

this just goes back to what I said about a solid beginning point to learn from
>>
>>57344755
Handling letters physically is very complicated. I mean it. They come in different sizes, are not folded unformly, and might be hard to open or even damaged in opening. There are machines that process letters, but those are fuckhueg.
>>
>>57344877
if you can recommend me books you can fuck my boi pussy if you want
>>
>>57342302
There are two versions of the idea of Hungarian notation. The first is called Apps Hungarian, because Simonyi was working at the apps division of Microsoft, on Excell iirc, that states to prefix your variable with your use case type. For instance, you might have an int describing a column, then you prefix your variable name with 'col'. This way you don't confuse it with a row. This is sensible.
Simonyi wrote a paper on this, and someone in the systems division at Microsoft missunderstood what was meant by typ. This is from here the idea to prefix your variable with the data type comes, and is called Systems Hungarian. Sys Hungarian is generally regarded as silly and useless, and is the reason Hungarian notation has gotten such a bad reputation. Apps Hungarian makes sense.

Even if i personally like to prefix some of my pointers with p, to remind me to deference it properly.
>>
>>57344900
>>57344841
I should add, K&R and co. always assumed my knowledge of programming before hand. They would tell me the features of C and how to implement them, but never what they really did and how you could actually /use/ them in a program
>>
>>57344936
>never what they really did
I know, right? Just what is the deal with pointers? What do they actually DO?
>>
I just realized I fucking love programming.

I don't know how I was able to live without it for the past 3 years - if you can call that a life.
>>
>>57344942
I'm too autistic to tell if you're being sarcastic

from what I know they're like references to a specific point in a program's memory, but they don't actually contain the data stored in that memory chunk?
>>
File: CS-homework.png (131KB, 664x949px) Image search: [Google]
CS-homework.png
131KB, 664x949px
/g/ please do my java project. Halfway through the semester of intro CS and have no idea whats going on.
>>
>>57344936
kernighan has a couple of books that are more "soft". have you looked at those?
>>
>>57344795
>The one representing 2^0
And which bit is that? The first or the last?
>>
>>57344900

Oh well, because of your dubs I'll grant you one wish..

Here's a book which contains a lot of theory (and practice), read it, WORK with it (again, any langauge of your choice) and you'll be pretty well grounded.

>http://io.acad.athabascau.ca/~oscar/ebook/algorithms.pdf


One more thing:
C is not really the easiest langauge. If it just doen't click you might think about learning Python (or Ruby) first, because they do a lot of work for you so you can focus on concepts instead of low level shit ("why doesn't my code compile ?!?!").

C will give you good foundation though, so if you like C, then nothing wrong with that.
>>
>>57344964
Go away and stay go. We don't do other people's homework, we already had our share of them.
>>
>>57344912
I was scared that this might be true. Thinking about this letters would be fold if not correctly handled.

Too bad, I really liked the idea
>>
>>57344804
So what are you doing here? You're obviously not a programmer.
>>
>>57344959
>but they don't actually contain the data stored in that memory chunk
It's not implied whether they contain or not the data.
You should care on yourself about that.
>>
>>57344855
Well duh, but i still don't get how the ordering of the bits in that byte is irrelevant.
>>
>>57344987
I am in fact a pro grammer
>>
File: 1451686989432.png (1MB, 1000x1400px) Image search: [Google]
1451686989432.png
1MB, 1000x1400px
>>57344917
Pic related is the only book you'll ever need.
>>
File: out.webm (673KB, 1138x640px) Image search: [Google]
out.webm
673KB, 1138x640px
/dpt/ outside of a sense of accomplishment, is there value in trying to solve a solved problem on your own?

In particular I am playing a game called Shenzhen and I have to implement division with simple I/O controllers that have limited hardware instructions. A method of doing it with limited registers and arithmetic operators was never taught to me and I'm wondering if it's worth trying to figure out on my own as opposed to just looking up the method and implementing it in this language within limitations. This kind of thing has popped into my head before in actual programming with higher level languages for hobby as well, reinventing the wheel doesn't always seem necessary but knowing building blocks such as these seems valuable, what I can't determine is if there's any meaningful difference in solving this problem through my own mental grinding or if it's just as valuable if someone tells me how it's done and I remember that. Is one actual learning while the other is just memorization?

Is there experience to be gained in the process of deriving your own algorithms or is it just a waste of time when one already exists?

webm is of the game but not the problem, for what it's worth I've only ever used C when dealing with microcontrollers.
>>
File: paste.webm (541KB, 697x428px) Image search: [Google]
paste.webm
541KB, 697x428px
Ok, I have this program that goes through all the posts on pastebin.com/archive/python and checks for key words to see if the post is interesting or not. Any idea on how I can improve the program. Like, displaying the text better or a better way to determine if the post is interesting.
>>
>>57344964

Dude.

The exercise already gives you the idea about the solution. All you have to do is write down what's written there (i.e. a method "nextRow") and fill in some baby logic.

C'mon, you can do it. Just start somewhere.
>>
File: 9475206_orig.jpg (63KB, 420x591px) Image search: [Google]
9475206_orig.jpg
63KB, 420x591px
Implemented a text categorization algorithm i found. It recognizes in which language a given text is written, i've made it into a web service thinking i'd use it in a future project or something.
https://www.let.rug.nl/~vannoord/TextCat/textcat.pdf
>>
>>57345031
If you're trying to learn, solve it yourself. If you're trying to create a finished product, use someone elses solution.
>>
>>57345031
Yes since you need to understand how things work anyway. Your neural network needs consistent knowledge to process information.
>>
>>57345039
I'm not quite sure what it does. does it require actions from the user?
>>
>>57342149
>using the mouse with the left hand

he deserved it
>>
Going to develop a CLI tool to parse youtube and search for videos in shit to be used in combination with MPV and youtube-dl so I never, ever have to expose my browser to that aids ridden website ever again.

Can't decide on a language though. I refuse to use python because it makes me feel ill when writing in it.
Perl maybe?
>>
>>57345021
Is that a manga? What if i can't read japanese? Is there a fanlation?
>>
File: sicp.png (842KB, 1596x514px) Image search: [Google]
sicp.png
842KB, 1596x514px
Post a bigger drop off rate
>>
>>57345039
Post interesting pastes.
>>
>>57345039
Make it a daemon, keep it running and constantly checking the newest pastes. Then have it pop up notifications when it finds a keyword. That way you can be the first person to find new pastes with, for example, the word "password" in it.
>>
>>57345061
>>57345062
Alright, I'll keep prototyping. This is an area I'm not well versed in so hopefully this will be the means with which to strengthen it.
>>
>>57345031
But you were taught division using registers and shit. It's called long division and should have been taught in primary school. Try doing it in base 2 and you're pretty much set.
>>
>>57345039
Fucking pedo fagg just die already.
>>
>>57345087
Plain bash. It shouldn't be more than 50 lines.
>>
>>57345087
I second this guy: >>57345132
>>
>>57345087
Python is literally perfect for what you want. just stop being a bitch and use it.
>>
>>57345129
Fucking idiot just kys already.
>>
>>57344968
The first.
>>
>>57345103
Yea I was thinking about that, but how would the notification work?
>>57345129
Wut
>>
>>57344964
there you go anon

public class Main {

static int index = 0;

public static int[] nextRow(int[] currentRow) {
final int[] solution = {73,32,65,77,32,65,32,66,82,65,73,78,76,69,83,83,32,67,79,68,69,77,79,78,75,69,89};
System.out.print((char)solution[index++]);

return new int[0];
}

public static void main(String[] args) {
for (int i = 0; i < 27; i++) {
nextRow(new int[0]);
}
}
}
>>
>>57345151
No it isn't. Go fuck yourself.

>>57345132
>>57345150
I guess. I was planning on adding some more things in other than just "search youtube" like authenticating with jewgle to pull up the recommended videos page, check subscriptions, etc.
Though I suppose there's no reason that can't all be handled in bash either
>>
>>57345091
https://www.amazon.com/Programming-Language-Brian-W-Kernighan/dp/0131103628
>>
>>57345179
Why not using python?

>inb4 retarded thinking
Kys immediately faggut.
>>
>>57345060

That looks awfully complicated..

Why not using the top 500 words of the top 200 languages and put them into a Radix tree?

Check each word of a sentence and then take the top scored language.
>>
>>57345199
Because I hate using it. I loathe whitespace syntax, I'd rather deal with the ten trillion parentheses of lisp.
That's the only justification I need.
>>
>>57345187
That's not the book i wanted. I wanted the book with the cute 2D girl on the cover.
>>
>>57345223
You're fat, aren't you?
>>
>>57345087

Use Ruby.

There's already plenty of premade stuff, for example:

>https://github.com/rb2k/viddl-rb
>https://rubygems.org/gems/curltube
>https://rubygems.org/gems/youtube-downloader/versions/1.2
>>
File: controllers.png (180KB, 1920x1040px) Image search: [Google]
controllers.png
180KB, 1920x1040px
>>57345114
In this particular case I think I messed myself up by trying with a single register device, I didn't realize initially that the other controller had both an accumulator and additional storage.
>>
File: 1472935884094.png (3KB, 430x373px) Image search: [Google]
1472935884094.png
3KB, 430x373px
>>57345241
No but I am a manlet
pls no bully
>>
>>57345097
worthless meme course
>>
>>57345206
I didn't think i could come up with an actually good method by myself and the one in the paper looked a lot less complicated than what i expected
You're right tho thre's probably a more efficient algo
>>
File: 1477636172985.webm (2MB, 600x338px) Image search: [Google]
1477636172985.webm
2MB, 600x338px
>>57345240
>cute anime girl
:^)
>>
File: Kaa.jpg (51KB, 1024x768px) Image search: [Google]
Kaa.jpg
51KB, 1024x768px
>>57345223
But it's powerful and you have a huge development speed.

>Come to ussss
>>
>>57345246

BTW I once started making a script to download a youtube playlist. Unfortunately it's not complete, since I only fetches the HTML (and not the actual videos), but it might give you an idea about how to do it in Ruby...

require 'rubygems'
require 'open-uri'
require 'nokogiri'


PAGE_URL = "https://www.youtube.com/playlist?list=PL5A408DF7FB9A7F06"
page = Nokogiri::HTML(open(PAGE_URL))

l = page.css('a[class=yt-uix-sessionlink]')
.reduce([]) { |acc, l| acc << l['href'] }
.select{ |l| l.size > 2}
.map {|l| "http://www.youtube.com" << l}

l.each do |link|
puts "[ Downloading #{link}.. ]\n\n"
`wget "#{link}"`
end
>>
is rm *.*~ safe for getting filenames ending with a tilde?

also has anyone got the swi-prolog emacs editor working on ubuntu 16.04 here?
>>
>>57345285
>powerful
but its not
>huge development speed
but i wont because I'll constantly be fighting the whitespace
>>
>>57345310
Isn't this more of a Linux thing? Go back to your containment bread
>>
>>57345285
>tfw searching for images of Kaa on google images delves you head first into a world of autistic image manips and vore fetish.

>>57345317
I'm not a fan of Python myself, mainly due to the community, but I need to say: Packages in python are usually very easy to use and enormously expand the functionality without requiring much knowledge.
>>
>>57345317
>but i wont because I'll constantly be fighting the whitespace
dont be daft lad

>>57345330
would you prefer i shitpost about x being a meme instead? besides, theres a greater likelihood of someone here knowing these answers than someone on the linux thread.
>>
>>57345317

So why not Ruby then?
It's like a mixture of Python and Perl, but without whitespace indention.

Some guys prefere Ruby, some prefer Python, some prefer Perl , nothing wrong with each of them..
>>
Found the badly drawn parody of personified languages. Yaoi flavor.
>>
>>57345372
yeah but lazily throwing packages at a problem isn't "powerful", just convenient.

>>57345310
Is there a reason that rm *~ wouldn't work?

>>57345384
Mostly because I've written a lot of stuff in Ruby and felt like a change.
I'm just gunna try and do it in Bash, I need to learn how to do bash scripts anyways
>>
>>57345401

>PHP without My SQL
>>
>>57345407
im more worried about the presence of the tilde, considering it typically means home in a unix system
>>
>>57345376
>would you prefer i shitpost about x being a meme instead?

That, or argue the semantics of
if( op.image.isAnime() == true )
>>
>>57345407

>Mostly because I've written a lot of stuff in Ruby and felt like a change.

This is probalby the most retarded reason I ever heard, but OK..

Lua maybe? VBA?
>>
>>57345401
This is so gay on so many levels.
>>
>>57345401
This has nothing to do with the languages presented - except for the php guy to look really retarded. On the other hand, they all do.
>>
>>57345425
Looks like it worked fine on WSL
>>
>>57345401
C -> C++ -> Perl /Java -> Javascript
I love how the guy is basically more depressed.
>>
>>57345451
nano Test.txt~

> not
touch Test.txt~

Also why are you writing extensions to be perfectly honest with you
>>
>>57345330
No such thing as "containing" Linux at a programming thread.

>>57345310
Yeah, it is, as far as I know - but keep in mind it requires a dot be in the filename, which is probably a good thing anyway.

>>57345284
:^)

>>57345425
But a path using tilde has to begin with tilde (i.e. it can't be foo/bar/~/documents) so since you require a period, you're good. Even if you didn't have a period, I just did a test on OSX and, although ls ~ returns my home folder, ls *~ only works if I make an actual directory called ~ in my current directory.
>>
>>57345451
is ~ still there?

>>57345487
good to know
>>
>>57345485
I purposefully wrote the extension because he wants to delete things with ~ after the extension.
Also yes I could have used touch. Whatever. I don't normally create blank files without a purpose so it wasnt the first thing that came into my mind.
>>
>>57345500
>I don't normally create blank files without a purpose so it wasnt the first thing that came into my mind.
What are you, a normie?
>>
>>57345497
yeah, although i did do it from inside ~ itself.
Did it again from one directory above, still only removed the file.
>>
File: 1474080067610.jpg (436KB, 907x1350px) Image search: [Google]
1474080067610.jpg
436KB, 907x1350px
At Google, what are the odds that I'm able to host match with a project I request?
>>
>>57345428
There is nothing to argue about. It's retarded and degenerated.
>>
>>57342628
Billy shoved a cigar up a woman's cooter, no joke
>>
>>57345571
Yes. I agree anime is retarded and degenerate
>>
File: resume.jpg (381KB, 1275x1650px) Image search: [Google]
resume.jpg
381KB, 1275x1650px
>>
>>57344646
here anon, code is shitty, created long time ago.
Maybe there is some class that has no point, and i forgot to delete it but it works.
https://github.com/dek992/webm-convert-and-compress

when i look at it now, i see how stupid it is
>>
Why is reddit so triggered by Ada?
>>
File: 798.png (264KB, 593x540px) Image search: [Google]
798.png
264KB, 593x540px
>>57345629
Nope
>>
>>57345668
How would you know that reddit is triggered by Ada?
>>
>>57345629
this
>>
File: fug.jpg (235KB, 1200x1200px) Image search: [Google]
fug.jpg
235KB, 1200x1200px
>>57345629
I may be degenerate, but I'm at least not retarded.
>>
File: NO IDEA.png (193KB, 1920x1080px) Image search: [Google]
NO IDEA.png
193KB, 1920x1080px
help.
>>
File: 1455796709769.jpg (19KB, 320x320px) Image search: [Google]
1455796709769.jpg
19KB, 320x320px
>>57345763
You should give up and become a trash man instead.
>>
>>57345763
>uninstall botnet
>install freebsd
>program in C
Fixed your life.
>>
>>57345763
>That if/else chaining
>That bracket spacing
>Randomly switching between bracket-less single line if/else and bracketed
anon pls
>>
>>57345763
You could do that with switch, less code
>>
>>57345808
I didn't really think it through, I should've used functions but I didn't realize that until halfway through. The code does work though, you think my instructer will be alright with it?
>>
>>57345845
no
refactor it
that's some easy copy+pasting into functions
>>
File: hereyougo.gif (88KB, 10000x10000px) Image search: [Google]
hereyougo.gif
88KB, 10000x10000px
>>57345763
>give up c++
>use python
>???
>profit?
>>
>>57345845
If he's actually worth anything he'll laughingly rip you apart while standing.
>>
>>57345668
>Muh BRACKETS
>Muh Segmentation Faults
>Muh UNDETECTED stack variables getting overwritten on accident
>I'm too stupid to remember all those keywords
>Ignoring the overhead of checking your c program to prove correctness, but criticize Ada checks.
>>
I need some assistance on a few questions that I have been struggling with ;/
1. Write a program that asks the user for 2 numbers, and then displays the largest number.
2. Modify your program from Question 1 to also check for 2 equal numbers.
3. Write a program that asks the user for 2 numbers then asks the user whether to add, subtract, multiply or
divide them. Display the result.
4. Write a program that asks for 2 numbers and displays their sum, product and average. If the calculated
sum is over 200, an asterisk is to be displayed beside the sum.
5. Write a program that asks a user for their account balance and then whether they wish to deposit or
withdraw. If they try to withdraw more than the available funds then display an appropriate message
otherwise display the new balance.
6. Design a program that will allow a teacher to enter a test result and it will display the appropriate grade
>>
>>57345867
>give up c++
>use python


C++ is best programming language ever created.
>>
File: not python.png (47KB, 1072x462px) Image search: [Google]
not python.png
47KB, 1072x462px
>>57345897
>not compiling C via the use of the Python System library
>>
>>57345897
It is, but OP will realize he doesn't have the potential to do anything with it.
>>
>>57345896
Those are not questions, those are homework.

If your question is if we'd do your homework: get lost, never come back.
>>
>>57345896
kek

>>57345904
>>57345905
my professor used to say that c++ is greatest, but to be good c++ programmer you must be masochist
>>
>>57345904
>2016
>using nano
Do you even vim
>>
>>57345923
I would install it if I had root permissions
>>
>>57345923

Why would you use that when you have Sublime and Atom?

I'm using Atom as c++ IDE, shit works amazing. press f5, and code is compiled and running and it is so light.
Fuck your vim
>>
>>57345948
>being serious
>Atom
R.I.P /g/.
>>
>>57345920
Very true, I started using it. I realized it was great for literally everything but my brain just wasn't compatible with it. Then I switched to python and started making shit like reverse shells and websites now I am a professional web dev.
>>
>>57345896
I'm new to this general, are these posts bait ?
>>
File: still not python.png (21KB, 1034x373px) Image search: [Google]
still not python.png
21KB, 1034x373px
>>57345923
nvm I'm stupid, vim is installed
>>
>>57345954
Very false, C++ is plain retarded.
>>
File: d1565946.jpg (53KB, 1280x720px) Image search: [Google]
d1565946.jpg
53KB, 1280x720px
>>57345897
>C++ is best programming language ever created.
C++ is an impressive compromise. but the best programming language? lol
>>
>>57345955
Nah It's just some guy who made a program that generate random posts designed to crash human brains
>>
>>57345948
I don't use a fucking IDE at all.
I have tabs open for all source files that I am editing right now. Switching through them with PAGEUP/PAGEDOWN, compiling with UP+ENTER on a specific tab.

Shit couldn't be easier even if they tried.
>hurr durr that only works with smaller projects
I am having 50.000 LOC under my fingertips.
>>
>>57345961
Obviously you aren't compatible either. C++ can do anything and is great performance wise. You just have to be really dedicated to use it.
>>
>>57345973
You're fucking with me right? You don't really think 50K LOC is a large project do you? I'm not trying to be condescending here but... most real world code bases you'll work on are significantly larger than that... you little baby... you little insignificant baby
>>
>>57345977
What was the problem with just returning error codes? Why did we have the need to perform an heap allocation every fucking time there is an exception?

Several concepts of C++ are so much retarded that it drags the language down as a whole. Which is a shame because I kinda like the template system and would have liked to see it in C. But not for the detriments of C++. No, never.
>>
>>57345994
This is a private project that is already doing things way more correctly than you'll ever do in the rest of your entire life. Using malloc/new? You already lost.

At work I am dealing with way more LOC, and we still don't use IDEs. Because they are retarded, and we know that.
>>
>>57345954
I tried Django with basic knowledge of python, and i got fucking lost like never.

Since my first 3 languages were c/c++ and java, PHP was so easy, it is just natural way of programming for me.


>>57345970
which one is anon?

>>57345973
>I have tabs open for all source files that I am editing right now. Switching through them with PAGEUP/PAGEDOWN, compiling with UP+ENTER on a specific tab.

you have never worked on big projects, projects where you need to use also others people code
>>
>>57342328
>i never said i could do that sort of programming.
thought you took 72 tutorials?
>>
>>57346009
Here's the thing about exceptions: there is zero cost unless one is thrown, in which case it is expensive. With error codes (or algebraic data types in some languages), there is a slight, constant cost. Both are valid and it depends on whether the error is truly exceptional or whether it might occur under normal operation. Contrast a missing required dependency with the user entering improperly formatted input, for instance.
>>
File: chaos god.png (297KB, 953x767px) Image search: [Google]
chaos god.png
297KB, 953x767px
I made a forum crawler/indexer some time ago and I want to look into statistics or some interesting shit to display with the data I have, it's mysql and it's basically like this

Post table:
Post id
Thread id
User id
Message
Edited bool
Post date etc

Thread table:
Thread id
User id
Forum id


User table:
User id
User name


Where can I read on how to implement certain relevant/fun statistics and that kind of shit? also to calculate post number I do
SELECT count(*) from Posts WHERE Thread id = X
for each thread in the main page which is kind of slow, any other methods faster methods I'm missing here? thanks
>>
>>57346009
>>57346045
That's not to say that the STL is good about this, of course. I just think exceptions are perfectly fine as a tool in general.
>>
>>57346037
>you have never worked on big projects, projects where you need to use also others people code
I have. Stop talking blatant bullshit just because you are fucking incompetent.
>>
>>57345977
If you think there is some kind of "compatibility" needed by your brain to do something then you're retarded.

>>57345994
>Hur duh look at my bloated mess
I would love to see what you call a "real" code base. Actually, anyone logical would split big projects into clearly defined modules.
>>
>>57345948
>press f5, and code is compiled and running and it is so light.
you can do this in vim
>>
>>57346061
Ok anon, can you show me what type of programs you are working on?
This is what we do
https://www.youtube.com/watch?v=Typ03BN8ARo
>>
>>57346045
>there is zero cost unless one is thrown,
THAT'S WHAT I AM TALKING ABOUT.
I have an error. Might not be even something dramatic. Just, like, not enough space to write into a buffer. In C: no fucking problem, error code tells me I need more buffer, so I allocate it, and be done with it.

In C++: allocate memory on the heap, create the exception object - possibly with some more base object initializations - throw the object, catch the exception somewhere, check if it's "out of memory", destroy the exception object, free the memory, and then allocate more memory.

Go away with your retarded error handling. It's retarded. There is no way around it. If I have one dynamic memory allocation plus release per error, than your system is broken. Period.
>>
>>57346105
Can you try reading the whole post next time you fucking retard?
>>
>>57346102
Ecommerce stuff using interfaces to other platforms with real-time communication. Includes several big market places: eBay, Amazon, Paypal (as PSP), and several more.
>>
>>57346045
>Here's the thing about exceptions: there is zero cost unless one is thrown
No.
It bloats your executable size with a bunch of tables.
>>
>>57346113
Why should I? One fallacy in your code is enough. If an error happens, and you have to spend more than 100 cycles to process it, you have failed. Utterly. No excuses.
>>
>>57346130
that is like, web developing level
>>
>>57346153
>100 cycles to process it
In that particular example that I gave - fix'd.
>>
>>57346151
>using C++ on embedded in the first place

>>57346153
>this error shouldn't happen 99.99% of the time but let's introduce constant overhead anyways so that we don't waste 100 cycles when it really does happen
>>
>>57342139
Is cygwin not an option?
like, other than some (mostly) minor weirdness, it's pretty much made me not really care about not having Linux installed on the machine I'm typing on

install cygwin, install a wm, go develop the same as you would on a Linux box

>>57342302
no
good names will solve your problem, every time

>>57344935
>For instance, you might have an int describing a column, then you prefix your variable name with 'col'. This way you don't confuse it with a row. This is sensible.
Huh.
That doesn't even sound like Hungarian, that's just reasonable naming.
>>
>>57346161
Wow, are you retarded.

The entire inner logic is written in C, of course. Also the communication. Because, guess what, scalability is important.

Wow, are you retarded. Wow. I am amazed you managed to actually survive up to this point, so fucking useless you appear to me right now.
>>
>>57346009
Exceptions should be EXCEPTIONAL
ie, something you don't expect.

user gives bad input? use a status code.
data from your database is unusable? that's not right, throw an exception.

The idea is that error codes should be handled in a manner which can be used to continue the program. Exceptions should be something that tells you something's very wrong and to end the program.

Who cares if you're allocating 4kb on the heap when your program is going to end 53ms from now?
>>
>>57346194
Share link of your projects anon, or your company site.
>>
>>57346105
Kek, is that really the cost for exceptions in c++? Why would anyone use this terrible garbage.
>>
>>57346186
>this error shouldn't happen 99.99% of the time but let's introduce constant overhead anyways so that we don't waste 100 cycles when it really does happen

Constant overhead? We are talking about a jump here. A fucking jump. If something failed, jump to exit. That is the best the C++ compiler can provide, too. If something failed, jump to create-completely-unnecesarry-exception-object.

Wow. I am in a thread full of idiots. I didn't even realize that.
>>
>>57346029
>>57346065
I'm not even suggesting any particular organizational structure, all I'm saying is that 50K is relatively small for a real world code base with more than one person working on it full time. I'd classify that as a medium-small.

A quick google shows Firefox at ~10 million LOC, Chrome at ~5 million, for example. They're not shitty code bases, it's largely inherent complexity that comes with solving a real world problem.

FWIW i agree you don't always need an IDE (I usually don't use one personally) I'm just sayin
>>
File: shiteater.png (38KB, 578x712px) Image search: [Google]
shiteater.png
38KB, 578x712px
>>57346221
How about no?

>>57346229
Because people are retarded and will eat shit even if you tell them it's shit.
>>
I had to maintain 2 variables while traversing a tree: an integer and node in Java. To do this I made a one-length array with a reference to an integer and one with a reference to a node and passed the arrays into the recursive function, updating element [0] as needed.

Now I've got the function working I'd like to refactor it into whatever's best practice. Seems kinda cludgy to generate an array and rely on side-effects of a recursive function to update it. What should I be doing instead?
>>
>>57346230
You really are retarded. It may seem minimal if you're talking about an isolated instance, but there is no runtime cost for an exception not occuring. Absolutely none.

To put it a way your retard brain will understand - is having to pay a dollar a day better than MAYBE having to pay 100 dollars a year? Of course, as you up the frequency of the potential payments of $100, the $1/day option seems more attractive.
>>
>>57346257
And I said that the 50.000 LOC codebase is my own private codebase that I am working on alone in my spare time. I have 50KLOC under my fingertips right now.
>>
>>57346297
w-well you're a fag then
>>
>>57345948
>atom
point and laugh
>>
File: 1472774910996.png (21KB, 420x420px) Image search: [Google]
1472774910996.png
21KB, 420x420px
>anti-exception tard writes code so shitty he can't fathom the possibility of an error occurring truly being an edge case
>>
>>57346297
You said you are working in some company, so if you writing something at home, that is not your project.
That is their project, because they own you.
>>
File: smug.jpg (44KB, 540x559px) Image search: [Google]
smug.jpg
44KB, 540x559px
>>57346230
It really is zero cost unless an exception is thrown. There isn't even a conditional jump instruction. You need to read up.

When an exception is thrown, THEN it begins the process of walking up the stack and checking for exception handlers, which can be expensive, but this code *never executes* unless an exception is thrown.
>>
>>57346286
>You really are retarded. It may seem minimal if you're talking about an isolated instance, but there is no runtime cost for an exception not occuring. Absolutely none.
And if it occurs for a small, trivial error - have you ever read from a socket, and there suddenly was no memory left, and you thought to yourself: "Now I need an exception to tell the caller function to give me some more memory additionally to what I already had!"? - then overloaded error handling is OK?

Do you have any idea how many trivial things can go wrong that don't fucking REQUIRE new/delete faggotry? OOM was one example. Another would be "cannot find object in data set". Trivial stuff. But suddenly we want to make our error paths big.

No. I have a better idea: learn how to fucking code, catch your damn error conditions in a language that doesn't suck ass, or endure being called a retard by people who know more about scalability than you'll ever forget.
>>
>>57346338
OK, I am done talking with retards for today.

So long, suckers.
>>
>>57346230
>a jump
wrong, but there's actually an instruction that occurs every single function call and every single error check has 2 instructions.
mov eax, <retval>
....
cmp eax, <some_error_code>
je error_occured


It doesn't sound like much, but imagine some performance critical code:
while(true)
{
int retval = do_some_processing();
if(retval != OK) break;
}

every single loop in that now has 3 additional instructions that must be executed. Loop 10 million times a second on a 3Ghz machine and you have an overhead of 30 million cycles (~10ms).

Now compare that to:
try
{
while(true)
{
int retval = do_some_processing();
}
}
catch(exception& e)
{

}

And the same number of loops, you waste 0 extra cycles. The only thing is that when an exception occurs, you're down ~200ms.
>>
NEXT THREAD:

>>57346388
>>57346388
>>57346388
>>
>>57346363
Wait but writing exception handlers to the stack is not a zero-cost operation
>>
>>57346455
I'll address this in the next thread.
>>
>>57342339
Nice segfault faggot
>>
>>57342052
https://www.mediafire.com/folder/mcoahtucqx177/Programming_Books

Thank me later
>>
>>57347041
>This folder is currently set to private.

Are you even trying?
Thread posts: 348
Thread images: 46


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