[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: 313
Thread images: 24

File: prog.jpg (105KB, 473x496px) Image search: [Google]
prog.jpg
105KB, 473x496px
Old thread: >>2343140
What are you working on, /g/?
>>
A Rust interpreter for Scheme
>>
>>62349370
Old thread: >>62343140
>>
File: include.jpg (102KB, 1920x1080px) Image search: [Google]
include.jpg
102KB, 1920x1080px
#include <blade.h>
>>
Learning to make gui's with python
>>
>>62349370
thanks for anime image
>>
>>62349396
Why would such a thing be included?
Especially that deep?
>>
Why didn't Richie try to solve the namespace problem? Fucking noob.
>>
>>62349476
wat
>>
>>62349508
Dennis Richie when he designed C.
>>
>>62349514
C doesn't care about scope, or types or anything else that might make programming easier.
>>
>>62349370
Hey /g/ not a regular browser but I'd love insight from regulars here.

If I have a teenager that seems to like the idea of coding what resources are there to get him on the right track? Are there some languages that are "better" than others? In terms of ROI on learning them and so forth.

Thanks for any insight.
>>
>>62349579
just get him to learn python or something, it's brainlet friendly and easy to hack together something that works
>>
>>62349597
python is like basic in terms of dijkstra's criticism of the latter
>>
>>62349538
>or types
So it's B?
>>
>people want better C
Literally just C with better standard library, like define the fucking API for threading and add compiler flag for platforms that supports it. Now do
the same for utf8, directories and file paths, basic data structures.
Maybe smarter compiler like, recursive macros and maybe some kind of modules instead of headers.
Saner types without the _t ending so every faggot doesn't have to rename uint32_t to u32.
>Solutions proposed
GC
Uglier syntax than ATS
Name mangling
nonstandard ABI
Anything but what people want from C
>>
>>62349626
C has a type system, it's just shitty and weak
>>
File: 1421164417027.png (342KB, 714x738px) Image search: [Google]
1421164417027.png
342KB, 714x738px
Employed Haskell programmer here
>>
File: perl.jpg (21KB, 516x690px) Image search: [Google]
perl.jpg
21KB, 516x690px
I could use some help guys.
I have some perl code that decides whether to show you the usage screen (--help) or to continue running but it throws an annoying warning:
>Use of uninitialized value $ARGV[0] in string eq
Looking at the code, is there a better way to be doing this?

sub task {
my $self = shift;

if($ARGV[0] eq 'fetch') {
$self->fetch;
}
else {
$self->usage;
}

return;
}

There has to be a smarter way to check if the user has typed
feed.pl fetch --resort blahblah
>>
>>62349664
I'll have 2 number nine...
>>
Vice video
https://www.youtube.com/watch?v=8dMFJpEGNLQ

Thought?

Alos, how does one get in to AI field?
>>
i made an irc like thingydoo

give it a go: ircs://2hu-ch.org/overchan
>>
>>62349719
Assuming that you're using Linux, check out https://perldoc.perl.org/Getopt/Long.html
>>
File: 655e7618dca57ad7346c86adb392724d.jpg (733KB, 850x1188px) Image search: [Google]
655e7618dca57ad7346c86adb392724d.jpg
733KB, 850x1188px
>>62349664
Employed Java programmer here
>>
>>62349739
Take Andrew Ng's Machine Learning course on Coursera. If you want a good understanding of neural networks (which have become the center of modern machine learning), you should know how to differentiate functions of multiple variables and matrix-vector multiplication. It's not necessary to know these things before taking the course, but it helps.
>>
>>62349664
>tfw employed C programmer
Living the dream tbqhwy
>>
>>62349778
enjoy it while it lasts. programming will become easier and easier until you don't have a job, because a biologist, or a physicist, or whatever else, can program the same as you
>>
>>62349764
Yes and yes, I have been using getopt for the options (--help and --resort) up until the point but the problem is fetch isn't an option it's a command and it takes no input, throwing it in with these optional flags seems like a step in the wrong direction:
    GetOptions(
'resort=s' => \$resort_value,
'help' => \$self->{'help'}
);

Or am I just very very confused? I'll go through the getopt man pages again though, thanks.
>>
>>62349895
>biologist
>physicist
>spending their time writing code and debugging instead of directly working on their field
right
>>
>>62349895
You think so?
I reckon there will be a place for software engineers for a while longer, plus being able to do shit yourself saves on labour costs if you want to start a business.
>>
>>62349895
Mending cars is also easy, but nobody wants to do it themselves.
>>
>>62349579
Python or Ruby is a good, JavaScript works too but you'd have to learn HTML and CSS
>>
>>62349370
its been 2 years now and im still burnt out

i can no longer get my self to program, it was the only skill i had, programmed for over 10 years, but im so depressed due to it.

Sometimes i feel like doing a project, but then my body seems to shut down and i cant get myself to work on anything.

I always see the hurdles ahead , and the massive weight of having to go through thousands of lines of code, which makes me hesitant to work on anything. All I feel is pain and suffering when I think of code.

I feel regret and anguish when I think that i spent 10 years of my life on a skill that amounted to nothing. I've also can't stand the direction where IT is going. It used to be innovative and exciting, but now its all about survellience and politics. Im full of regret, i feel so much anger when i think that i might end up homeless even though i tried so hard. There isnt a place and there are no jobs for a depressed programmer like me.

so i try to not think about it, i convinced myself to get rid of this skill, i can't help but hate programming and i picked up buddhism instead. its really the only thing that brings me calmness to my mind, and I love to read buddhist texts and research its history. Im convinced programming and a lot of other activites we do is pointless in the long run. I hope this can be a lesson to someone, you sohulnd't try so hard to be something, All you have to do is keep doing whats close to you and what you are familiar with not being swayed by others. This life is really not as important as you think and should be lived pleasantly. I think I went too far trying to become a programmer,I wasn't meant to be one and I should stop trying so hard.
>>
>>62349931
>>spending their time writing code and debugging instead of directly working on their field
>enter requirements into a box
>click some buttons
>code is automatically generated
>no code monkeys required
>>
>>62349985
it's not though. it's time consuming and requires technical knowledge and resources. you can't honestly think that writing java apps will make you indispensable for decades to come. there may still be some programmers, but just as there's still some farmers
>>
>>62350133
look man, sometimes its best not to think about the future too hard, bad for the soul.
>>
>>62349476
What namespace problem?
>>
>>62350151
true, we'll probably have a living stipend by then anyways
>>
>>62350154
don't start this shit again
>>
>>62350193
People are and have been doing multi million line codebases in C just fine.
So I ask again. What namespace problem?
>>
How into multithread optimizing? I haven't touched it yet.

Don't compilers already automatically spread the load evenly?
>>
>>62350214
Do you mean creating more execution contexts or optimizing an already existing multithreaded codebase?
>>
>>62350060
Do you really think ditching programming entirely is the way to go? Instead of thinking black and white, you could try programming only during the weekends. Never overdo things.
About Buddhism, how do I start with it? I've seriously thought about picking it up. The main reason is to relieve some mental stress.
>>
>>62350211
The one where if one faggot make library and prefixes his shit with stuff_ and other faggot makes library and uses same prefix as the first one and there's name collision and you need to use both libraries you are fucked.
>>
>>62350214
>Don't compilers already automatically spread the load evenly?
No, the compiler has nothing to do with it. The operating system might do that at runtime.
>>
>>62350284
Threads aren't necessarily system threads
>>
>>62350277
This problem exists with any namespace solution that I can think of though, not just using prefixes but C++ or any other language's actual namespaces.
>>
>>62350277
Literally never happens.
And how would namespaces even solve that problem?
>>
>>62350284
I see, but wouldn't true optimizing mean you need to manually define which thread runs what part of the code?
>>
>>62350313
>from foo import bar as baz
Python fixes this elegantly.
>>
>>62350113
If something like that exists they themselves will become obsolete
>>
>>62350343
So from which foo are you importing?
The problem was with two libraries named under a foo prefix/namespace.
>>
>>62350334
Yes, you can set processor affinity via some system calls, like SetThreadAffinityMask() or pthread_setaffinity_np(). Many programs do this.
>>
>>62349719
 $ARGV[0] 
is the name of the program, not the first argument on the cmd line
>>
>>62349661
Pls respond to my post >>62348826
>>
>>62350493
Are you sure?
print $ARGV[0];
outputs fetch when the user uses the fetch option.
>>
I want to edit some rather large csv files (1000+ rows). What is the best way to do this on Linux? Don't really want to install a whole office suite for this.
>>
>>62349719
i think you need to pass the @ARGV array onto the subroutine?
>>
>>62350724
Write your own program. It's CSV so it cannot be that hard.
>>
>>62350901
man perlvar

>Perl identifiers that begin with digits, control characters, or punctuation characters are exempt from the effects of the "package" declaration and are always
>forced to be in package "main"; they are also exempt from "strict 'vars'" errors. A few other names are also exempt in these ways:

> ENV STDIN
> INC STDOUT
> ARGV STDERR
> ARGVOUT
> SIG
>>
>>62349664
i love this pasta
>>
>>62350724
It depends, what kind of edit do you need to do?
>>
How can anyone be autistic enough to actually enjoy coding? Fuck this shit is mindnumbingly boring.
>>
http://google.github.io/styleguide/cppguide.html#Names_and_Order_of_Includes
>dir2/foo2.h.
>C system files.
>C++ system files.
>Other libraries' .h files.
>Your project's .h files.

what the actual fuck lads? why not:
>dir2/foo2.h.
>Your project's .h files.
>Other libraries' .h files.
>C++ system files.
>C system files.
>>
>>62351237
it's not so much the coding itself as the results you get out of it
>>
How do I know if free() was successful?
>>
>>62351241
Use the Chromium guide
>>
>>62351263
it always succeeds as long as you use it correctly
>>
Should I keep learning rust or should I learn another programming language that isn’t rust?
>>
have a coding challenge tomorrow in ruby on domain modeling. Probably only working with a has many through, 3 classes problem. Any tips to help me prepare? I don't want to get fucked
>>
>>62351310
learn C++
>>
>>62351323
I’m too brainlet sorry senpai ;;(((
>>
>>62349719
This did the trick, still feels a bit off. If anyone has a better solution let me know, at least the warning is gone.

sub task {
my $self = shift;

if(length $ARGV[0]) {
if($ARGV[0] eq 'fetch') {
$self->fetch;
}
else {
$self->usage;
}
}
else {
$self->usage;
}

return;
}
>>
>>62351237
You think so? Try being a turner(used translate).

I'm certified to be one. When I did my internship I wanted to kill myself on the spot, I almost broke a fucking machine one time. Almost started it with key inside because I did same moving pattern over 200 times and my brain just melted. Programming is way more fun and challenging than some of the professions out there
>>
>>62349725
underrated post
>>
>>62351310
Keep learning Rust
>>
>>62351331
Did you turn pages as a profession?
>>
>>62351355
Ok I’ll have tons of fun meeting rainbow hair sjws :D
>>
>>62351329
>I’m too brainlet
In that case you should most definitely mote to C++ from Rust
>>
>>62351364
>meeting people
Get >>>/out/
>>
>>62351365
move*
>>
>>62351365
But rust looks easier than c++, desu
>>
>>62351399
Wait till you get to borrow checking and the traits part
>>
>>62351399
do you say this without trying them both?
>>
>>62351399
and I don’t have to use a bloated as fuck ide (visual studio) in order to code rust
>>
>>62351329
If you have problem with C++, you can not survive Rust 1 month
>>
>>62351422
http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/oxygenr
>>
>>62351363
n-no, what kind of a profession is that?
>>
>>62351422
Why did you think that was necessary to mention?
>>
Anyone here know a lot about SSL?

What is the main different between SSL and simply exchanging public keys, encrypting messages, sending them over TCP and decrypting with the private keys?
>>
>>62351436
Enjoy formatting for 30 seconds each time
>>
>>62351462
haven't had any problems with the newer versions of eclipse being slow
>>
>>62351415
what's wrong with traits?
>>
>>62351479
>bunch of errors
anon...this doesn't help.
we can't help you sort errors if all you give us is 'it doesnt work', and what code are you trying to compile?
>>
Got a job as a Python programmer.

Now what?
>>
>>62351437
Or do you mean turner as in athlete?
>>
>>62351484
Rust doesn't allow Higher Kinded Polymorphism as of now, you'd have to be pulling your hair any time you try to do anything remotely complex. On top of that there's BC and life time checker
>>
>>62351479
include paths
>>
>>62351515
>Internet explorer
>>
>>62351537
>he doesn't have a Windows Phone as a dedicated shitposting device
>>
>>62351424
???
>>
File: 1466901665251.png (35KB, 537x515px) Image search: [Google]
1466901665251.png
35KB, 537x515px
>>62351577
>Windows Phone
>>
My mum wants a gmail thing to auto reply when out of office, I barely edited this from a stack overflow post and it appears to work, but I'm not sure about the localization.

It appears to be using 0 for Sunday, which I assume will remain the same, but I'm not sure if the times will be in my timezone or not.

I assume google's smart enough to make it just work, but I'd like to make sure.

function autoReply() {
var interval = 5; // if the script runs every 5 minutes; change otherwise
var date = new Date();
var day = date.getDay();
var hour = date.getHours();
if ([6,0].indexOf(day) > -1 || (day == 1 && hour < 9) || (day == 5 && hour >= 17)) { // sunday == 0
var timeFrom = Math.floor(date.valueOf()/1000) - 60 * interval;
var threads = GmailApp.search('is:inbox after:' + timeFrom);
for (var i = 0; i < threads.length; i++) {
if (threads[i].isUnread()){
threads[i].reply("I am out of office. My working hours are 9-5, Monday-Friday. I'll get back to you as soon as possible.");
threads[i].markRead();
threads[i].markImportant();
}
}
}
}
>>
how do i make program that adds all number from start to finish with no numbers that include three?
>>
File: erew.jpg (121KB, 1200x926px) Image search: [Google]
erew.jpg
121KB, 1200x926px
>>62351522
Operated these types of machine.
>>
>>62351608
>anything else
>>
>>62351626
First, write a function
bool includesThree(int n)

Then, write a function that adds a list of numbers

Then, combine these two functions
>>
>>62351611
There's a bug in it. Here's the correct version:
function autoReply() {
var interval = 5; // if the script runs every 5 minutes; change otherwise
var date = new Date();
var day = date.getDay();
var hour = date.getHours();
if ([6,0].indexOf(day) > -1 || (day == 1 && hour < 9) || (day == 5 && hour >= 17)) { // sunday == 0
var timeFrom = Math.floor(date.valueOf()/1000) - 60 * interval;
var threads = GmailApp.search('is:inbox after:' + timeFrom);
for (var i = 0; i < threads.length; i++) {
if (threads[i].isUnread()){
threads[i].reply("Sucking dick for my baby boy so I can buy him Minecraft giftcards. Please try again later.");
threads[i].markRead();
threads[i].markImportant();
}
}
}
}
>>
>>62351648
Did ur mum turn the phone on for you?
>>
>>62351679
haha epic dude
some people have a decent relationship with their parents and don't mind helping them out
>>
>>62351679
/wdg/
>>
>>62351681
My grandma, actually.
She's a wise woman.
>>
What are some lucrative programming fields?
>>
>>62351688
>helping your parents out
They created you therefore they should help you out, not the other way around.
>>
>>62351630
Chingu, that's called steelworker.
But yeah, doing simple repetitive tasks drives you insane. That's why God invented dumb people to do the chores for us.
You're not making hydrogen bombs, are you? Just checking...
>>
>>62351626
keep an array of 0-1-2-4-5-6-7-8-9 and use it to construct numbers (for example 8 * 100 + 1 * 10 + 2 * 1 = 812) and add them together
>>
Assume the following C++ class:
class Foo 
{
public:
Foo();
Foo Bar();
private:
short *baz;
};

Shouldn't Bar() be allowed to perform the following?
Foo::Bar()
{
Foo f();
f.baz[0] = 0;
}

g++ states that
'short int* Foo::baz' is private within this context
.
>>
>>62351630
now you can do it for fun

https://play.google.com/store/apps/details?id=com.uigames.latheworker&hl=en
>>
>>62351823
>Foo f();
This doesn't do what you think it does.
>>
>>62351892
I was thinking the same too
>>
File: 19248024jpg.jpg (12KB, 320x237px) Image search: [Google]
19248024jpg.jpg
12KB, 320x237px
>>62351823
>Circular dependency
I'd personally kick you out of the office if I ever saw you
>>
>>62351823
Foo::Bar()
{
baz[0] = 0;
}


then call Bar from outside
>>
>>62351952
>implying there's anything inherently wrong with circular dependencies
>>
>>62352066
>implying there's anything inherently wrong with HIV
>>
>>62351952
Fun fact: Go refuses to compile if it encounters a circular dependency.
>>
>>62352066
I bet you get irrationally upset about recursion too
>>
>>62352117
Fun fact: Go refuses to compile if it encounters an abstraction
>>
File: 1430853197680.png (331KB, 474x432px) Image search: [Google]
1430853197680.png
331KB, 474x432px
>>62352121
>muh recursion
>>
>>62352117
go is not programming language, though.
Rob Pike should leave and takes his results of masturbation with him.
>>
>>62352092
>>62352121
>implying there's anything inherently wrong with circular dependencies
>unable to explain why
>muh HIV
>>
>>62352160
Rob Pike is still stuck in the Bell Labs era.
>>
>>62352200
shit, I replied to the wrong post. I meant that the guy with a complex about circular dependencies must also get upset about recursion, since it's basically the same thing
>>
>>62352200
>circular dependencies
>HIV
What's the difference?
>>
Hi /g/entoomen,

Im trying to write a simple bruteforcing program in C.
Got the basics written out, but now i want to multithread.
Not much experience with pthreads though.
Anywho, does anyone know how to loop through an array bigger than the number of hyperthreads and distribute the bruteforcing/hashing?

i.e.
pthread_t hash_threads[8]; // muh hyperthreading

for (i = 0; i < no_of_passwords; ++i) {
// distribute over limited no_of_pthreads?
}


>> TL;DR;
How to distribute more than 8 tasks over 8 pthreads?
>>
>>62352242
>unable to explain why circular dependencies are inherently bad
>m-m-muh HIV
Guess how I know you're a code monkey who follows religiously every regurgitated piece of advice given by programming "gurus".
>>
retard here: best resources for learning c++ for free?
>>
>>62352303
You still haven't answered my question, kiddo
>>
>>62352292
You can create more threads than your CPU supports...
Otherwise implement green threads, or use existing library for that.
>>
>>62352305
learncpp.com
>>
>>62352305
just fuck around until you feel you know it all
>>
Is merge sort a kind of difficult algorithm to write? Doing recursion usually fucks me up
>>
>>62352305
http://openpdf.us/Programming-Principl-0321992784.html
>>
>>62352313
Explain the difference between mindlessly trying to avoid circular dependencies and HIV, kiddo. Protip: you can't.
>>
>>62352292
Are the passwords in an array like char *passwords[]? If so, divide the number of passwords by the number of threads you're creating to evenly distribute the workload.

You can pass whatever you want to the thread to make sure it knows what it should be working on. Just make sure to distribute the workload.
>>
>>62352318
>>62352322
>>62352362
thanks for the help
>>
>>62352316
Yea you are right, but if i were to create a thread per password i would have more than thousands of threads running, probably defeats the purpose of being faster.

>>62352399
Thank you, i will try to split up the array in batches and send it to the threads.
>>
>want to use a library
>don't want to fuck around with linking
>just edit #include <something/library.h> to #include "library.c"
who /degenerate/ here?
>>
>>62352378
I'm not the one who's not employed though
>>
>>62352522
Cool. You should only have to pass each thread a pointer to its starting position in the passwords array, but the thread has to know when to stop working so you have to figure something out there.
>>
>>62352544
>unable to justify his claims
>i-i bet y-you're unemployed
Typical /g/ brainletism.
>>
>>62352571
I'm not here to babysit you kid
>>
>>62352292
Aren't you supposed to make it event driven these days?
>>
>>62352200
>>62352303
>>62352571
>t nodev
>>
>>62352142
audible kek
>>
Trying to write merge sort following the algorithms book. Never wrote much C before but have tried gdb to find the error without luck. Any help?
#include <stdio.h>

int merge(int A[], int p, int q, int r)
{
//determine the index we are slicing the array at
int first_slice_index = q - p + 1;
int second_slice_index = r-q;

//Make the subarrays
//
// Left
int L[first_slice_index+1];
for(int i = 0; i < first_slice_index + 1; i++)
{
L[i] = A[p+i-1];
}
// Right
int R[second_slice_index+1];
for(int i = 0; i < second_slice_index; i++)
{
R[i] = A[q+i];
}

//Put our sentinal values in the top of each subarray
L[first_slice_index + 1] = 100000;
R[second_slice_index + 1] = 100000;

int i = 1;
int j = 1;

for(int k = p; k <= r; k++)
{
if(L[i] <= R[j]){
A[k] = L[i];
i++;
}else{
A[k] = R[j];
j++;
}
}
return 0;
}

int merge_sort(int A[], int p, int r)
{
if(p < r)
{
int q = ((p+r)/2);
merge_sort(A,p,q);
merge_sort(A,q+1,r);
merge(A, p, q, r);
}
return 0;
}

int main(int argc, char *argv[])
{
int A[argc-1];
for(int i = 1; i < argc; i++)
{
A[i-1] = atoi(argv[i]);
printf("%d ", A[i-1]);
}
printf("\n");

int len = sizeof(A)/sizeof(A[0]);
printf("%d", len);


merge_sort(A,0,len);

for(int i = 0; i < len; i++)
{
printf("%d ", A[i]);
}
printf("\n");
}

./merge_sort 1000 100 10 1
1000 100 10 1
40 0 0 1


from what I can see with gdb it doesn't even step into merge_sort()
>>
>>62352595
Shoo, code monkey.
>>
>>62352142
It shouldn't. Only leads to countless hours of frustration. I hate when people teach shit programming in schools these days
>>
>>62352567
Ow? so i don't have to split the struct array? i can just send a few pointers to start from with a limit?

and just have to return when it finds a password or runs out of things to try ;)
>>
>>62352536
literally no-one
ever
>>
>>62352567
Ow wait now i understand what you mean, i can just send the array pointer, a few starter indexes, and limits so the threads dont overlap.
Thats what you mean right?
>>
File: Capture.png (4KB, 598x115px) Image search: [Google]
Capture.png
4KB, 598x115px
is this a typo /dpt/?
>>
I have a question about data structures.
Say you have a list of values of a fixed size, uniformly distributed (think hashes)
If you want to store these as a list, the naive approach would take HASH_BITS/8*hashes bytes, for example 300 million 256 bit hashes would take 9gb.
But if you don't care about order, you can store them as offsets. Then you only need log((2^HASH_BITS)/(hashes))/log(2) bits per hash, for example in this case 227.84 bits for a total of 8gb.
Is there any data structure for storing these even more space efficiently if you're okay with discarding their order?
>>
>>62352767
>In begin.In end
>>
>>62352694
Yes, you should not have to mess with the array. You might want to pass something like this to each thread

struct Workload {
int start;
int stop;
};


With start being the index of the starting position, and stop is the index where the thread should terminate.
>>
>>62352767
you should always use {} in while loops and all that
>>
>>62352694
>>62352755
That's what I mean yeah
>>
One of the book exercises says that I should make a function that takes a file as a parameter.
What's the point? Why wouldn't I just use file inside the function?
>>
>>62352824
so you know what file to use??
>>
>>62352767
>In begin.In end
>return begin
>>
>>62350273
>Do you really think ditching programming entirely is the way to go?
I had to it was already killing me inside and i kept on trying to find ways to profit or get something out of it.

>About Buddhism, how do I start with it? I
I would suggest starting with Theravada Buddhism and the texts Suttanipata and Dhammapada, these are the closest to true buddhism that Siddartha himself taught and its easier for people in the 21st century to relate to because its all based on rational thinking.

Westerners tend to get exposed to Tibetan Buddhism a lot since they came as refugees, but Tibetan is a merging of late medieval esoteric buddhism and tibetan folklore so its far off from what the Buddha taught.

you can then move on to Mahayana buddhism which is refutation of rational buddhism, its a little closer to christianity. its your choice which sect best suits you though.
>>
I got a job as a back-end java developer about 8 months ago. I had no programming experience before I started, so while I've learned a lot on this job I know there's a lot of things I still don't know. I've passed the java OCA exam so I've got the basics of the language down. I feel like I'm missing a lot of general programming/software design/computer science knowledge. My knowledge of internet protocols and layers is also lacking - I would have no idea where to start if trying to create a chatroom or set up an ftp server for example

Are there any books or resources anyone would recommend as 'must reads'? So far I have the Effective Java book on my list and that's it. I was maybe considering Computer Networking: A Top-Down Approach but it looks like a giant textbook and I'm not sure how useful it would be
>>
>>62352790
>>62352806
Thank you so much, that i didn't think of this myself.
>>
>>62352785
i pick this excerpt from advanced c++ primer. Is this syntactically correct
>>
>>62350273
don't be a buddhist
>>
>>62353093
No, it's supposed to be a comma.
>>
>>62353132
ok thanks bro dont kno wot i'd do without you dude
>>
>>62353093
>In begin.In end
What does it mean?
>>
>>62353174
yw
>>
>>62352797
>ou should always use {} in while loops and all that
WRONG
>>
>>62353269
He's right. Fuck off.
>>
>>62353285
he's wrong, though.
>>
File: 1483042407061.gif (4MB, 422x418px) Image search: [Google]
1483042407061.gif
4MB, 422x418px
>>62353285
>>
>>62353297
I even wrap switch cases with brackets
>>
>>62353337
Why are you posting that brainlet manchild?
>>
File: 1482178372365.gif (96KB, 248x203px) Image search: [Google]
1482178372365.gif
96KB, 248x203px
https://www.youtube.com/watch?v=QicgfPt_k6M
>>
>>62350277

If the library used a prefix identical to the languages standard namespaces, or is not unique enough that it collides with an existing namespace then I wouldn't use it. Also this has happened a grand total of 0 times since computing has existed.
>>
>>62353269
>making your code less readable
shiggy diggy
>>
File: dpt-programming-cheatsheet.jpg (586KB, 4020x1449px) Image search: [Google]
dpt-programming-cheatsheet.jpg
586KB, 4020x1449px
Take the steps necessary to become a programming master today /dpt/!
>>
>>62353458
t. somebody who has never programmer or used libraries
>>
>>62353482
I don't get the second part
>>
>>62353364
dumb frogposter
>>
>>62353482
where do the green vegetables come into play?
>>
>>62353491
Eating raw serrano peppers focuses the mind.
>>
>>62353491
green is my pepper maybe
>>
>>62350277
when is that ever a real issue? and it would happen in other languages too
>>
>>62353485

t. someone who has never typed before
>>
>>62353506
See >>62353512
>>
>>62353285
>>62353467
I bet you'd write stuff like this too
if (things) {
dostuff();
} else {
dootherstuff();
}

instead of
if (sruff)
dostuff();
else
dootherstuff();
>>
File: 29u.jpg (55KB, 600x389px) Image search: [Google]
29u.jpg
55KB, 600x389px
>>62353337
>>
>>62353527
>Not putting your else on a newline
>>
>>62353485
t. someone who can't into build systems
>>
>>62353527
>if (sruff)
>dostuff();
>else
>dootherstuff();
woah we got a 1337 c0de master here
>>
>>62353527
Yes. I actually prefer this to that edgy shit you got going on the bottom.
>>
>>62353527
I bet you write shit like
arr[i++]
arr[++i]
*arr++
*++arr

because you think it's clever.
>>
>>62353540
this: >>62353540

if(things) {
doStuff();
}
else {
doOtherStuff();
}
>>
Hackerrank or leetcode or interviewbit? Do you guys grind anything?
>>
>>62353563
(if things (dostuff) (do-other-stuff))
Curlybrace cucks BTFO.
>>
>>62353600
lisp is unreadable
how are you even supposed to tell what constructs do what when they all look identical
>>
>>62353600
things (do-stuff) (do-other-stuff)
>>
>>62353640
curlybrace is unreadable
how are you even supposed to tell what constructs do with all that visual noise
>>
>>62353640
>lisp is unreadable
what
WAHT
>>
>>62353527
goto fail;
>>
>>62353562
>
//these are fine
arr[i++]
arr[++i]
//these are not
*arr++
*++arr
>>
>>62353659
>visual clues
ftfy
>>
>>62353269
>>62353527
The top is the sane thing to do. If you're doing the bottom, don't use newlines at least.
if (cond) dostuff();
else dootherstuff();

That's okay, but with newlines you might think there's a brace and add a new statement and then get unexpected side effects instead of compiler warnings.
>>
>>62351436
I love this joke
>>
>>62353734
No, that's fucking horrible. Increment your variables before using them in the array, you're edging dangerously close to undefined behavior with the top 2.
>>
>ask for embeddable scripting language recommendations
>get one that sounds promising
>check its github repo
>version 0.1
>last updated 5 months ago
Why can't programmers ever finish anything?
>>
>>62353527
things ? doStuff() : doOtherStuff();
things && doStuff();
>>
>>62353876
just use guile scheme
>>
>>62353898
that's an extension language not a language designed for embedding, isn't it?
>>
>>62353734
>//these are fine
You're fired
>>
>>62353743
>useless noise is a visual cue
Nope.
>>
File: guido.jpg (62KB, 750x819px) Image search: [Google]
guido.jpg
62KB, 750x819px
>using braces at all
>>
>>62354027
python uses braces when calling functions and for tuples
>>
>>62354027
Significant white space is a horrible horrible meme.
>>
>>62354098
Being up front about significant whitespace is better than trying to hide it like Javascript or Go or something.
>>
>>62354155
not really because go or js are not programming languages.
>>
You can passively consume hundreds of articles and podcasts and learn far less than shipping one side project a year.
>>
    case '-':
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':

Is there a cleaner way to do this?
>>
File: fug.jpg (9KB, 211x246px) Image search: [Google]
fug.jpg
9KB, 211x246px
I need help vir/g/ins
I'm currently programming a game for school in C# that I have to send in 2 hours and I can't find a way to pass a string without reference or linkage to the string's variable.
I just want the text in my new string.

Do you guys have a solution for that ?
I can't find anything on stack overflow or I'm retarded
>>
>>62354245
the fuck do you mean
>>
>>62354231
tell us what language you're using when asking things like this please
>>
>>62354269
C of course.
>>
File: 1494432716297.jpg (204KB, 900x973px) Image search: [Google]
1494432716297.jpg
204KB, 900x973px
>>62354207
Shut up! I'm just writing the spec for the project in my mind before I commit to it
>>
>>62354231
if
else if
if
else if
if
else if
if
else if
if
else if
if
else if
if
else if
if
else if
else
>>
>>62354268
I mean that in my new temporary string variable I want to pass the letters of another string variable.

However I don't want to create a link between thos two variables
>>
How do I copy an SQLite database in use? Can I just do cp database.db backup.db? Should I dump it and then put it into a new database? What's the recommended way?
>>
>>62354276
see about doing it within interger ranges, and using those intergers as chars.
>>
>>62350379
Not them but foo could be a shallow name e.g. a file. Bar is the component which has a conflicting name.
>>
>>62354231
What are you trying to do?
'0' to '9' you can iterate over, if it helps.
>>
File: programming socks.png (338KB, 1140x813px) Image search: [Google]
programming socks.png
338KB, 1140x813px
What color of programming socks is best for 64-bit ARM Assembly?
>>
>>62354327
red for the raspberry pi ^_^
>>
>>62354327
ones that match your color scheme in your text editor
>>
Can someone help with this please the code is the same as the text book i'm learning from but it just hangs after i input a value i tried butting printf statements into the functions to see how far it gets but the weren't showing anything. the only thing which i had to change was the return in the absolutevalue function as it was supposed to be return x ;- but that was giving erros during compiling

//Fucntion to calculate the absolute value of a number
#include <stdio.h>

float absoluteValue(float x){
if (x < 0){
x = -x;
}
return x;
}

//fucntion to compute the square root

float squareRoot(float x){
const float epsilon = .00001;
float guess = 1.0;

while (absoluteValue(guess * guess - x) >= epsilon){
guess = (x / guess + guess) / 2.0;
}
return guess;
}

int main (void){
float x,sqr;
printf("Which number would the like the square root of: ");
scanf("%f ", &x);
printf("squareRoot (%f) = %f \n", x, squareRoot(x));

return 0;
}
>>
>>62354231
Put the values in an array, memchr to find the index and use that to index an array of function pointers.
>>
>>62354373
[code\][/code\]
>>
>>62354294
Can I do that in the case statement?
>>62354308
Check if a character matches [0-9\-] in C.
>>62354377
That's a horrible idea.
>>
>>62354422
i don't think you'll need a case statement? only an if i think. i'm only learning myself, but if you take the character values on the ASCII table and see if your char matches that range, you'll have what you want?
>>
What's the easiest way to make a simple GUI in Haskell?
>>
>>62354472
https://wiki.haskell.org/Applications_and_libraries/GUI_libraries
did you even try?
>>
>>62354481
Last time I tried, half of them didn't work with the latest GHC or had nonexistant documentation. I would like to hear opinions from people with some experience, hence asking here.
>>
>>62353828
kys jetbrains shill
>>
>>62354422
>That's a horrible idea.
Why do you think so?
>>
>>62354550
>Haskell
>documentation
I love it but documentation and Haskell don't go together. Not him btw
>>
>>62351263
Write your own implementation just to be sure
>>
File: Capture.png (30KB, 558x438px) Image search: [Google]
Capture.png
30KB, 558x438px
lmfao

it's not even better than eclipse

at best it's a baby duck syndrome situation if you happen to prefer it
>>
https://archive.rebeccablacktech.com/g/thread/62340482

C# and intellij shills BTFO
>>
>>62354472
If you're into FRP you can use wx widgets with reactive banana

Or you can use gtk bindings (possibly with glade). See https://github.com/Fuuzetsu/tsuntsun/blob/master/src/Main.hs for a simple example. See readme for how it looks.
>>
Kurva anyádat ánon
>>
>>62354867
C# is worse than Java because it stinks of sepples too
>>
>>62354769
>subscription for desktop software that doesn't need a remote service
is there no end to this jewing?
>>
Which utility library to use with C for general stuff:
Glib
qlibc
apr
klib, doesn't really cover enough
libmowgli, suggested by suckless, not sure how portable
tbox
something else...
>>
>>62354988
None of them. This is C, not C++.
>>
>>62355016
fuck off dumb sepples poster.
>>
>>62351626
bool containsThree(int n)
{
if (n == 3) return true;

n = n < 0 ? -n : n;

while (n > 0)
{
if (n % 10 == 3) return true;
n = n / 10;
}

return false;
}

int addNumbersThatDontContainThree(const std::vector<int>& numbers)
{
int ret = 0;

for (size_t i = 0; i < numbers.size(); i++)
ret += !containsThree(numbers[i]) ? numbers[i] : 0;

return ret;
}
>>
>>62354988
back to your webshit
>>
On the bright side, this weeklong programming assignment only took about 5 hours.

On the dark side, this code is really, really fucking janky. It WORKS, but HELL if it's not a fucking mess.
>>
File: 1504556005069.png (408KB, 634x640px) Image search: [Google]
1504556005069.png
408KB, 634x640px
What's bloat and what's not?
>>
>>62355451
Have you felt an intense aversion to fuzzing the code inputs on the very high likelihood that your logic is actually shit and it will crash when your instructor grades it?
>>
>>62354373
Can someone plox help
>>
>>62355479
OOP is bloat
FP is not
>>
>>62355451
source or didn't happen
>>
>>62355594
I probably can't post the source until after the project is handed in on Thursday, unfortunately. If I remember then I'll post it. It DOES involve doing a binary search on a single item to check if two items are equal, though, which struck me as retarded but I was too lazy to code it any other way.
>>
>>62355553
this
scanf("%f ", &x);

needs to be this
scanf("%f", &x);
>>
>>62355727
Sugoi, thankyou senpai
>>
What is the best way to learn to write good c code? It is hard to find the right resources as a beginner.

t. noob
>>
>>62355902
I've got a decent ebook i can put it on mega if you'd like
>>
>>62355902
write code then show us when you're done
>>
>>62354231
Yes:

    switch (thing) {
case '-':
break;

case '0'...'9':
break;

default:
break;
}
>>
>>62355910
yes please, or give name.
K&R is nice to learn all the elements of the language, but I feel like I'm not sure if my code is terrible or not, even after reading it
>>
>>62355955
Programming in C 4th edition By Stephen Kochan

https://mega.nz/#!8eZgSYbC

It's a book for complete beginners though so might not be for you
>>
>>62355571
>6 GB/s garbage collectors
>>
can someone here explain in full detail what exactly and how sql and python go tegother?
>>
>>62356010
!Zz0F0HIMhon47k2GRw7n2agef2PNyPoc1SqwgRgI9w0
>>
>>62354769
>paying for a glorified text editor
just git gud anon
>>
>>62356027
yes, it collects the 6GB/s source code of OOP almost instantly
>>
>>62356031
the same way any language + sql go together
you use your programming language to create the thing the user sees, the "program"
it may be a phone app, a website, a game, etc

you fetch and store all the data for the program in a database using sql
>>
>>62356010
Seconding this, great book
>>
>>62356086
I've been going through it and i've learnt more in 5 days than my 2 years from cs at college
>>
>>62356110
don't exaggerate anon
>>
>>62356198
This is uk college not university
>>
>>62356198
I don't think you understand just how slow classroom education can be.
It has to move at the rate of the slowest student.
>>
>>62355479
Everything is bloat
>>
>>62356212
>It has to
Why?
>>
>>62356031
there are several ways to do sql things from python
most basic is to just so system(psql [args)
second most basic is to use somethign that lets you send raw queries like mydatabase.query("SELECT ...")
most complex and most often used in industry is an orm that lets you do stuff like myobject.save(mydatabase)
>>
>>62356240
Tuition $$$$
>>
>>62354988
define "general stuff"
>>
File: college grade inflation.png (2MB, 880x624px) Image search: [Google]
college grade inflation.png
2MB, 880x624px
>>62356240
Because otherwise you would fail too many students and they'll drop out and they won't pay tutition anymore.
>>
>>62356257
>>62356262
But everyone else paying tuition will be pissed off if the classes are uselessly slow, surely?
>>
>>62356290
Yes, but everyone is used to it.
The stuff you learn in a 4-5 year program in order to earn a bachelor's degree can be boiled down to 1-2 years if you were a very motivated self-taught.
Not every course of study is easy to learn yourself (eg. medicine, chemistry), but computer science and mathematics require no special facilities and everyone has a goddamn computer now.
>>
The following code
short Foo::operator[](const unsigned int index) const { return bar[index]; }

results in
error: no match for ‘operator[]’ (operand types are ‘const Foo’ and ‘int’)

when I try to compile a file where I use
Foo f; short s = f[1];


Why?
>>
>>62356260
directory handling. String encoding. Basic data structures. Threading and sockets.
>>
>>62356429
>>>/g/wdg
>>
>>62356448
>>>/b/
>>
>>62356409
without seeing the complete context for your code it is hard to say
pastebin it or something
>>
>>62356409
a complete example on ideone.com would help
>>
>>62356476
>>62356522
Nvm, I found the problem. I hadn't included Foo.h.
>>
>tfw 2 dumb for ASM
help me lads, any online resources to using MiniIDE?
>>
>>62356863
Disassemble C programs and compare the result to the original C
>>
>>62356863
asm is a lot easier than a high level language
you only need to know a handful of instructions to do everything
knowing more just makes it possible to optimize or simplify the code
>>
New thread:

>>62356950
>>62356950
>>62356950
>>
>>62356927
>>62356946
problem is i dont even know where to start, and lots of link provided are dead.
lds #STACK
jsr initgb
ldd #welcome
jsr [printf, PCr]
newgm jsr playGame
bra newgm
swi
init gb

look at this shit i dont even know the syntax (i have programmed DE112 board before)
Thread posts: 313
Thread images: 24


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