Quantcast
[ 3 / biz / cgl / ck / diy / fa / g / ic / jp / lit / sci / tg / vr / vt ] [ index / top / reports / report a bug ] [ 4plebs / archived.moe / rbt ]

Due to resource constraints, /g/ and /tg/ will no longer be archived or available. Other archivers continue to archive these boards.Become a Patron!

/g/ - Technology


View post   

[ Toggle deleted replies ]
File: 105 KB, 473x496, prog.jpg [View same] [iqdb] [saucenao] [google] [report]
62349370 No.62349370 [Reply] [Original] [archived.moe] [rbt]

Old thread: >>2343140
What are you working on, /g/?

>> No.62349388

A Rust interpreter for Scheme

>> No.62349391

>>62349370
Old thread: >>62343140

>> No.62349396
File: 102 KB, 1920x1080, include.jpg [View same] [iqdb] [saucenao] [google] [report]
62349396

#include <blade.h>

>> No.62349409

Learning to make gui's with python

>> No.62349420

>>62349370
thanks for anime image

>> No.62349432

>>62349396
Why would such a thing be included?
Especially that deep?

>> No.62349476

Why didn't Richie try to solve the namespace problem? Fucking noob.

>> No.62349508

>>62349476
wat

>> No.62349514

>>62349508
Dennis Richie when he designed C.

>> No.62349538

>>62349514
C doesn't care about scope, or types or anything else that might make programming easier.

>> No.62349579

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

>> No.62349597

>>62349579
just get him to learn python or something, it's brainlet friendly and easy to hack together something that works

>> No.62349619

>>62349597
python is like basic in terms of dijkstra's criticism of the latter

>> No.62349626

>>62349538
>or types
So it's B?

>> No.62349661

>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

>> No.62349662

>>62349626
C has a type system, it's just shitty and weak

>> No.62349664
File: 342 KB, 714x738, 1421164417027.png [View same] [iqdb] [saucenao] [google] [report]
62349664

Employed Haskell programmer here

>> No.62349719
File: 21 KB, 516x690, perl.jpg [View same] [iqdb] [saucenao] [google] [report]
62349719

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

>> No.62349725

>>62349664
I'll have 2 number nine...

>> No.62349739

Vice video
https://www.youtube.com/watch?v=8dMFJpEGNLQ

Thought?

Alos, how does one get in to AI field?

>> No.62349748

i made an irc like thingydoo

give it a go: ircs://2hu-ch.org/overchan

>> No.62349764

>>62349719
Assuming that you're using Linux, check out https://perldoc.perl.org/Getopt/Long.html

>> No.62349778
File: 733 KB, 850x1188, 655e7618dca57ad7346c86adb392724d.jpg [View same] [iqdb] [saucenao] [google] [report]
62349778

>>62349664
Employed Java programmer here

>> No.62349806

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

>> No.62349890

>>62349664
>tfw employed C programmer
Living the dream tbqhwy

>> No.62349895

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

>> No.62349915

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

>> No.62349931

>>62349895
>biologist
>physicist
>spending their time writing code and debugging instead of directly working on their field
right

>> No.62349939

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

>> No.62349985

>>62349895
Mending cars is also easy, but nobody wants to do it themselves.

>> No.62350016

>>62349579
Python or Ruby is a good, JavaScript works too but you'd have to learn HTML and CSS

>> No.62350060
File: 31 KB, 308x442, 0abde8f4f969b118a52c66bf18cead3501f2872c9db572bef9d4f53a808b9dca.jpg [View same] [iqdb] [saucenao] [google] [report]
62350060

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

>> No.62350113

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

>> No.62350133

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

>> No.62350151

>>62350133
look man, sometimes its best not to think about the future too hard, bad for the soul.

>> No.62350154

>>62349476
What namespace problem?

>> No.62350172

>>62350151
true, we'll probably have a living stipend by then anyways

>> No.62350193

>>62350154
don't start this shit again

>> No.62350211

>>62350193
People are and have been doing multi million line codebases in C just fine.
So I ask again. What namespace problem?

>> No.62350214

How into multithread optimizing? I haven't touched it yet.

Don't compilers already automatically spread the load evenly?

>> No.62350239

>>62350214
Do you mean creating more execution contexts or optimizing an already existing multithreaded codebase?

>> No.62350273

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

>> No.62350277

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

>> No.62350284

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

>> No.62350296

>>62350284
Threads aren't necessarily system threads

>> No.62350313

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

>> No.62350316

>>62350277
Literally never happens.
And how would namespaces even solve that problem?

>> No.62350334

>>62350284
I see, but wouldn't true optimizing mean you need to manually define which thread runs what part of the code?

>> No.62350343

>>62350313
>from foo import bar as baz
Python fixes this elegantly.

>> No.62350348

>>62350113
If something like that exists they themselves will become obsolete

>> No.62350379

>>62350343
So from which foo are you importing?
The problem was with two libraries named under a foo prefix/namespace.

>> No.62350394

>>62350334
Yes, you can set processor affinity via some system calls, like SetThreadAffinityMask() or pthread_setaffinity_np(). Many programs do this.

>> No.62350493

>>62349719
$ARGV[0] is the name of the program, not the first argument on the cmd line

>> No.62350511

>>62349661
Pls respond to my post >>62348826

>> No.62350575

>>62350493
Are you sure? print $ARGV[0]; outputs fetch when the user uses the fetch option.

>> No.62350724

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.

>> No.62350901

>>62349719
i think you need to pass the @ARGV array onto the subroutine?

>> No.62350922

>>62350724
Write your own program. It's CSV so it cannot be that hard.

>> No.62351034

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

>> No.62351204

>>62349664
i love this pasta

>> No.62351236

>>62350724
It depends, what kind of edit do you need to do?

>> No.62351237

How can anyone be autistic enough to actually enjoy coding? Fuck this shit is mindnumbingly boring.

>> No.62351241

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.

>> No.62351256

>>62351237
it's not so much the coding itself as the results you get out of it

>> No.62351263

How do I know if free() was successful?

>> No.62351269

>>62351241
Use the Chromium guide

>> No.62351291

>>62351263
it always succeeds as long as you use it correctly

>> No.62351310

Should I keep learning rust or should I learn another programming language that isn’t rust?

>> No.62351318

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

>> No.62351323

>>62351310
learn C++

>> No.62351329

>>62351323
I’m too brainlet sorry senpai ;;(((

>> No.62351330

>>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;
}

>> No.62351331

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

>> No.62351335

>>62349725
underrated post

>> No.62351355

>>62351310
Keep learning Rust

>> No.62351363

>>62351331
Did you turn pages as a profession?

>> No.62351364

>>62351355
Ok I’ll have tons of fun meeting rainbow hair sjws :D

>> No.62351365

>>62351329
>I’m too brainlet
In that case you should most definitely mote to C++ from Rust

>> No.62351379

>>62351364
>meeting people
Get >>>/out/

>> No.62351385

>>62351365
move*

>> No.62351399

>>62351365
But rust looks easier than c++, desu

>> No.62351415

>>62351399
Wait till you get to borrow checking and the traits part

>> No.62351421

>>62351399
do you say this without trying them both?

>> No.62351422

>>62351399
and I don’t have to use a bloated as fuck ide (visual studio) in order to code rust

>> No.62351424

>>62351329
If you have problem with C++, you can not survive Rust 1 month

>> No.62351436

>>62351422
http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/oxygenr

>> No.62351437

>>62351363
n-no, what kind of a profession is that?

>> No.62351449

>>62351422
Why did you think that was necessary to mention?

>> No.62351452

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?

>> No.62351462

>>62351436
Enjoy formatting for 30 seconds each time

>> No.62351479 [DELETED] 

Trying to compile a .cpp program under macOS's cc:
>Undefined symbols for architecture x86_64:
>... [a bunch of referenced to std:: stuff]
>clang: error: linker command failed with exit code 1 (use -v to see invocation)
What does it mean?

>> No.62351483

>>62351462
haven't had any problems with the newer versions of eclipse being slow

>> No.62351484

>>62351415
what's wrong with traits?

>> No.62351514

>>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?

>> No.62351515
File: 40 KB, 500x377, C__Data_Users_DefApps_AppData_INTERNETEXPLORER_Temp_Saved Images_1497324536813.jpg [View same] [iqdb] [saucenao] [google] [report]
62351515

Got a job as a Python programmer.

Now what?

>> No.62351522

>>62351437
Or do you mean turner as in athlete?

>> No.62351525

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

>> No.62351529

>>62351479
include paths

>> No.62351537

>>62351515
>Internet explorer

>> No.62351577

>>62351537
>he doesn't have a Windows Phone as a dedicated shitposting device

>> No.62351591

>>62351424
???

>> No.62351608
File: 35 KB, 537x515, 1466901665251.png [View same] [iqdb] [saucenao] [google] [report]
62351608

>>62351577
>Windows Phone

>> No.62351611

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();
}
}
}
}

>> No.62351626

how do i make program that adds all number from start to finish with no numbers that include three?

>> No.62351630
File: 121 KB, 1200x926, erew.jpg [View same] [iqdb] [saucenao] [google] [report]
62351630

>>62351522
Operated these types of machine.

>> No.62351648
File: 639 KB, 649x611, C__Data_Users_DefApps_AppData_INTERNETEXPLORER_Temp_Saved Images_1500060630805.png [View same] [iqdb] [saucenao] [google] [report]
62351648

>>62351608
>anything else

>> No.62351665

>>62351626
First, write a function
bool includesThree(int n)

Then, write a function that adds a list of numbers

Then, combine these two functions

>> No.62351679

>>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();
}
}
}
}

>> No.62351681

>>62351648
Did ur mum turn the phone on for you?

>> No.62351688

>>62351679
haha epic dude
some people have a decent relationship with their parents and don't mind helping them out

>> No.62351695

>>62351679
/wdg/

>> No.62351730

>>62351681
My grandma, actually.
She's a wise woman.

>> No.62351735

What are some lucrative programming fields?

>> No.62351746

>>62351688
>helping your parents out
They created you therefore they should help you out, not the other way around.

>> No.62351747

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

>> No.62351752

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

>> No.62351823

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.

>> No.62351829

>>62351630
now you can do it for fun

https://play.google.com/store/apps/details?id=com.uigames.latheworker&hl=en

>> No.62351892

>>62351823
>Foo f();
This doesn't do what you think it does.

>> No.62351929

>>62351892
I was thinking the same too

>> No.62351952
File: 12 KB, 320x237, 19248024jpg.jpg [View same] [iqdb] [saucenao] [google] [report]
62351952

>>62351823
>Circular dependency
I'd personally kick you out of the office if I ever saw you

>> No.62352056

>>62351823
Foo::Bar()
{
baz[0] = 0;
}


then call Bar from outside

>> No.62352066

>>62351952
>implying there's anything inherently wrong with circular dependencies

>> No.62352092

>>62352066
>implying there's anything inherently wrong with HIV

>> No.62352117

>>62351952
Fun fact: Go refuses to compile if it encounters a circular dependency.

>> No.62352121

>>62352066
I bet you get irrationally upset about recursion too

>> No.62352142

>>62352117
Fun fact: Go refuses to compile if it encounters an abstraction

>> No.62352154
File: 331 KB, 474x432, 1430853197680.png [View same] [iqdb] [saucenao] [google] [report]
62352154

>>62352121
>muh recursion

>> No.62352160

>>62352117
go is not programming language, though.
Rob Pike should leave and takes his results of masturbation with him.

>> No.62352200

>>62352092
>>62352121
>implying there's anything inherently wrong with circular dependencies
>unable to explain why
>muh HIV

>> No.62352214

>>62352160
Rob Pike is still stuck in the Bell Labs era.

>> No.62352222

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

>> No.62352242

>>62352200
>circular dependencies
>HIV
What's the difference?

>> No.62352292

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?

>> No.62352303

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

>> No.62352305

retard here: best resources for learning c++ for free?

>> No.62352313

>>62352303
You still haven't answered my question, kiddo

>> No.62352316

>>62352292
You can create more threads than your CPU supports...
Otherwise implement green threads, or use existing library for that.

>> No.62352318

>>62352305
learncpp.com

>> No.62352322

>>62352305
just fuck around until you feel you know it all

>> No.62352329

Is merge sort a kind of difficult algorithm to write? Doing recursion usually fucks me up

>> No.62352362

>>62352305
http://openpdf.us/Programming-Principl-0321992784.html

>> No.62352378

>>62352313
Explain the difference between mindlessly trying to avoid circular dependencies and HIV, kiddo. Protip: you can't.

>> No.62352399

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

>> No.62352515

>>62352318
>>62352322
>>62352362
thanks for the help

>> No.62352522

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

>> No.62352536

>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?

>> No.62352544

>>62352378
I'm not the one who's not employed though

>> No.62352567

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

>> No.62352571

>>62352544
>unable to justify his claims
>i-i bet y-you're unemployed
Typical /g/ brainletism.

>> No.62352595

>>62352571
I'm not here to babysit you kid

>> No.62352601

>>62352292
Aren't you supposed to make it event driven these days?

>> No.62352609

>>62352200
>>62352303
>>62352571
>t nodev

>> No.62352614

>>62352142
audible kek

>> No.62352626

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()

>> No.62352636

>>62352595
Shoo, code monkey.

>> No.62352657

>>62352142
It shouldn't. Only leads to countless hours of frustration. I hate when people teach shit programming in schools these days

>> No.62352694

>>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 ;)

>> No.62352719

>>62352536
literally no-one
ever

>> No.62352755

>>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?

>> No.62352767
File: 4 KB, 598x115, Capture.png [View same] [iqdb] [saucenao] [google] [report]
62352767

is this a typo /dpt/?

>> No.62352782

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?

>> No.62352785

>>62352767
>In begin.In end

>> No.62352790

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

>> No.62352797

>>62352767
you should always use {} in while loops and all that

>> No.62352806

>>62352694
>>62352755
That's what I mean yeah

>> No.62352824

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?

>> No.62352837

>>62352824
so you know what file to use??

>> No.62352847

>>62352767
>In begin.In end
>return begin

>> No.62352859

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

>> No.62353037

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

>> No.62353082

>>62352790
>>62352806
Thank you so much, that i didn't think of this myself.

>> No.62353093

>>62352785
i pick this excerpt from advanced c++ primer. Is this syntactically correct

>> No.62353132

>>62350273
don't be a buddhist

>> No.62353171

>>62353093
No, it's supposed to be a comma.

>> No.62353174

>>62353132
ok thanks bro dont kno wot i'd do without you dude

>> No.62353186

>>62353093
>In begin.In end
What does it mean?

>> No.62353245

>>62353174
yw

>> No.62353269

>>62352797
>ou should always use {} in while loops and all that
WRONG

>> No.62353285

>>62353269
He's right. Fuck off.

>> No.62353297

>>62353285
he's wrong, though.

>> No.62353337
File: 3.78 MB, 422x418, 1483042407061.gif [View same] [iqdb] [saucenao] [google] [report]
62353337

>>62353285

>> No.62353339

>>62353297
I even wrap switch cases with brackets

>> No.62353354

>>62353337
Why are you posting that brainlet manchild?

>> No.62353364
File: 96 KB, 248x203, 1482178372365.gif [View same] [iqdb] [saucenao] [google] [report]
62353364

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

>> No.62353458

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

>> No.62353467

>>62353269
>making your code less readable
shiggy diggy

>> No.62353482
File: 586 KB, 4020x1449, dpt-programming-cheatsheet.jpg [View same] [iqdb] [saucenao] [google] [report]
62353482

Take the steps necessary to become a programming master today /dpt/!

>> No.62353485

>>62353458
t. somebody who has never programmer or used libraries

>> No.62353491

>>62353482
I don't get the second part

>> No.62353498

>>62353364
dumb frogposter

>> No.62353506

>>62353482
where do the green vegetables come into play?

>> No.62353512

>>62353491
Eating raw serrano peppers focuses the mind.

>> No.62353516

>>62353491
green is my pepper maybe

>> No.62353517

>>62350277
when is that ever a real issue? and it would happen in other languages too

>> No.62353523

>>62353485

t. someone who has never typed before

>> No.62353525

>>62353506
See >>62353512

>> No.62353527

>>62353285
>>62353467
I bet you'd write stuff like this too
if (things) {
dostuff();
} else {
dootherstuff();
}

instead of
if (sruff)
dostuff();
else
dootherstuff();

>> No.62353533
File: 55 KB, 600x389, 29u.jpg [View same] [iqdb] [saucenao] [google] [report]
62353533

>>62353337

>> No.62353540

>>62353527
>Not putting your else on a newline

>> No.62353541

>>62353485
t. someone who can't into build systems

>> No.62353544

>>62353527
>if (sruff)
>dostuff();
>else
>dootherstuff();
woah we got a 1337 c0de master here

>> No.62353557

>>62353527
Yes. I actually prefer this to that edgy shit you got going on the bottom.

>> No.62353562

>>62353527
I bet you write shit like
arr[i++]
arr[++i]
*arr++
*++arr

because you think it's clever.

>> No.62353563

>>62353540
this: >>62353540

if(things) {
doStuff();
}
else {
doOtherStuff();
}

>> No.62353591

Hackerrank or leetcode or interviewbit? Do you guys grind anything?

>> No.62353600

>>62353563
(if things (dostuff) (do-other-stuff))
Curlybrace cucks BTFO.

>> No.62353640

>>62353600
lisp is unreadable
how are you even supposed to tell what constructs do what when they all look identical

>> No.62353655

>>62353600
things (do-stuff) (do-other-stuff)

>> No.62353659

>>62353640
curlybrace is unreadable
how are you even supposed to tell what constructs do with all that visual noise

>> No.62353662

>>62353640
>lisp is unreadable
what
WAHT

>> No.62353721

>>62353527
goto fail;

>> No.62353734

>>62353562
>//these are fine
arr[i++]
arr[++i]
//these are not
*arr++
*++arr

>> No.62353743

>>62353659
>visual clues
ftfy

>> No.62353816

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

>> No.62353828

>>62351436
I love this joke

>> No.62353836 [DELETED] 

>>62353527
[/code]
| things = doStuff
| otherwise = doOtherStuff
[/code]

>> No.62353850

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

>> No.62353876

>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?

>> No.62353882

>>62353527
things ? doStuff() : doOtherStuff();
things && doStuff();

>> No.62353898

>>62353876
just use guile scheme

>> No.62353925

>>62353898
that's an extension language not a language designed for embedding, isn't it?

>> No.62353929

>>62353734
>//these are fine
You're fired

>> No.62353986

>>62353743
>useless noise is a visual cue
Nope.

>> No.62354027
File: 62 KB, 750x819, guido.jpg [View same] [iqdb] [saucenao] [google] [report]
62354027

>using braces at all

>> No.62354052

>>62354027
python uses braces when calling functions and for tuples

>> No.62354098

>>62354027
Significant white space is a horrible horrible meme.

>> No.62354155

>>62354098
Being up front about significant whitespace is better than trying to hide it like Javascript or Go or something.

>> No.62354163

>>62354155
not really because go or js are not programming languages.

>> No.62354207

You can passively consume hundreds of articles and podcasts and learn far less than shipping one side project a year.

>> No.62354231

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?

>> No.62354245
File: 9 KB, 211x246, fug.jpg [View same] [iqdb] [saucenao] [google] [report]
62354245

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

>> No.62354268

>>62354245
the fuck do you mean

>> No.62354269

>>62354231
tell us what language you're using when asking things like this please

>> No.62354276

>>62354269
C of course.

>> No.62354284
File: 204 KB, 900x973, 1494432716297.jpg [View same] [iqdb] [saucenao] [google] [report]
62354284

>>62354207
Shut up! I'm just writing the spec for the project in my mind before I commit to it

>> No.62354286

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

>> No.62354289

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

>> No.62354293

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?

>> No.62354294

>>62354276
see about doing it within interger ranges, and using those intergers as chars.

>> No.62354307

>>62350379
Not them but foo could be a shallow name e.g. a file. Bar is the component which has a conflicting name.

>> No.62354308

>>62354231
What are you trying to do?
'0' to '9' you can iterate over, if it helps.

>> No.62354327
File: 338 KB, 1140x813, programming socks.png [View same] [iqdb] [saucenao] [google] [report]
62354327

What color of programming socks is best for 64-bit ARM Assembly?

>> No.62354334

>>62354327
red for the raspberry pi ^_^

>> No.62354339

>>62354327
ones that match your color scheme in your text editor

>> No.62354373

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;
}

>> No.62354377

>>62354231
Put the values in an array, memchr to find the index and use that to index an array of function pointers.

>> No.62354389

>>62354373
[code\][/code\]

>> No.62354422

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

>> No.62354448

>>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?

>> No.62354472

What's the easiest way to make a simple GUI in Haskell?

>> No.62354481

>>62354472
https://wiki.haskell.org/Applications_and_libraries/GUI_libraries
did you even try?

>> No.62354550

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

>> No.62354622

>>62353828
kys jetbrains shill

>> No.62354657

>>62354422
>That's a horrible idea.
Why do you think so?

>> No.62354665

>>62354550
>Haskell
>documentation
I love it but documentation and Haskell don't go together. Not him btw

>> No.62354766

>>62351263
Write your own implementation just to be sure

>> No.62354769
File: 30 KB, 558x438, Capture.png [View same] [iqdb] [saucenao] [google] [report]
62354769

lmfao

it's not even better than eclipse

at best it's a baby duck syndrome situation if you happen to prefer it

>> No.62354867

https://archive.rebeccablacktech.com/g/thread/62340482

C# and intellij shills BTFO

>> No.62354884

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

>> No.62354907

Kurva anyádat ánon

>> No.62354921

>>62354867
C# is worse than Java because it stinks of sepples too

>> No.62354951

>>62354769
>subscription for desktop software that doesn't need a remote service
is there no end to this jewing?

>> No.62354988

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

>> No.62355016

>>62354988
None of them. This is C, not C++.

>> No.62355033

>>62355016
fuck off dumb sepples poster.

>> No.62355272

>>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;
}

>> No.62355363

>>62354988
back to your webshit

>> No.62355451

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.

>> No.62355479
File: 408 KB, 634x640, 1504556005069.png [View same] [iqdb] [saucenao] [google] [report]
62355479

What's bloat and what's not?

>> No.62355519

>>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?

>> No.62355553

>>62354373
Can someone plox help

>> No.62355571

>>62355479
OOP is bloat
FP is not

>> No.62355594

>>62355451
source or didn't happen

>> No.62355688

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

>> No.62355727

>>62355553
this
scanf("%f ", &x);

needs to be this
scanf("%f", &x);

>> No.62355838

>>62355727
Sugoi, thankyou senpai

>> No.62355902

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

>> No.62355910

>>62355902
I've got a decent ebook i can put it on mega if you'd like

>> No.62355914

>>62355902
write code then show us when you're done

>> No.62355949

>>62354231
Yes:

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

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

default:
break;
}

>> No.62355955

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

>> No.62356010

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

>> No.62356027

>>62355571
>6 GB/s garbage collectors

>> No.62356031

can someone here explain in full detail what exactly and how sql and python go tegother?

>> No.62356033

>>62356010
!Zz0F0HIMhon47k2GRw7n2agef2PNyPoc1SqwgRgI9w0

>> No.62356053

>>62354769
>paying for a glorified text editor
just git gud anon

>> No.62356071

>>62356027
yes, it collects the 6GB/s source code of OOP almost instantly

>> No.62356084

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

>> No.62356086

>>62356010
Seconding this, great book

>> No.62356110

>>62356086
I've been going through it and i've learnt more in 5 days than my 2 years from cs at college

>> No.62356198

>>62356110
don't exaggerate anon

>> No.62356210

>>62356198
This is uk college not university

>> No.62356212

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

>> No.62356237

>>62355479
Everything is bloat

>> No.62356240

>>62356212
>It has to
Why?

>> No.62356245

>>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)

>> No.62356257

>>62356240
Tuition $$$$

>> No.62356260

>>62354988
define "general stuff"

>> No.62356262
File: 1.57 MB, 880x624, college grade inflation.png [View same] [iqdb] [saucenao] [google] [report]
62356262

>>62356240
Because otherwise you would fail too many students and they'll drop out and they won't pay tutition anymore.

>> No.62356290

>>62356257
>>62356262
But everyone else paying tuition will be pissed off if the classes are uselessly slow, surely?

>> No.62356340

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

>> No.62356409

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?

>> No.62356429

>>62356260
directory handling. String encoding. Basic data structures. Threading and sockets.

>> No.62356448

>>62356429
>>>/g/wdg

>> No.62356470

>>62356448
>>>/b/

>> No.62356476

>>62356409
without seeing the complete context for your code it is hard to say
pastebin it or something

>> No.62356522

>>62356409
a complete example on ideone.com would help

>> No.62356575

>>62356476
>>62356522
Nvm, I found the problem. I hadn't included Foo.h.

>> No.62356863

>tfw 2 dumb for ASM
help me lads, any online resources to using MiniIDE?

>> No.62356927

>>62356863
Disassemble C programs and compare the result to the original C

>> No.62356946

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

>> No.62356977

New thread:

>>62356950
>>62356950
>>62356950

>> No.62356987

>>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)

>>
Name (leave empty)
Comment (leave empty)
Name
E-mail
Subject
Comment
Password [?]Password used for file deletion.
Captcha
Action