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

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: 312
Thread images: 53

File: mokou_sicp.png (174KB, 392x462px) Image search: [Google]
mokou_sicp.png
174KB, 392x462px
What are you working on, /g/?

Old thread: >>60059636
>>
Java is better in it's domain than C++ or C#.
>>
>60067026
That's literally wrong: https://doc.rust-lang.org/std/primitive.slice.html#method.get_unchecked
>>
File: 1457639633993.png (641KB, 636x616px) Image search: [Google]
1457639633993.png
641KB, 636x616px
Employed System F programmer reporting in
>>
>>60067079
it doesn't count if you're the only employee, desu.
>>
This is the worst general on /g/
not the topic, just the general atmosphere and the people

good day
>>
File: 1484589609241.jpg (50KB, 806x617px) Image search: [Google]
1484589609241.jpg
50KB, 806x617px
>>60067098
I'm actually not.
>>
Should I learn x86 assembly?
>>
is a bachelor degree in cs worthless?
>>
>>60067109
What else do you come to 4chan for other than autistic shit posting?

I don't fit in anywhere else :]
>>
File: dpt kaguya.jpg (579KB, 1280x1115px) Image search: [Google]
dpt kaguya.jpg
579KB, 1280x1115px
The reason Rust is being pushed so hard is because social justice warriors have found great difficulty penetrating the communities of open source system coders who use C and/or C++.

The "safety" features give advantages to lobotomised Feminist studies "coders" who are trying to "disrupt" these communities while breaking the knee caps of everyone else who knows what they are doing.

Literally nothing in Rust actually solves problems that haven't already been solved by RAII in C++ and even some GC/stack/heap techniques in the arguably superior but slower D compiler.

The advocates are all social justice warriors and this is their "long march through the development communities". They are employing critical theory against their main targets C and C++, by criticising everything it is and does and demonising its users. They've held back their "cis het white male" jargonism for now, but once they have established a foot hold "killer app", expect them to go wild with it. Just read through the big throbbing CoC they've erected on their main website.

Rust is kill. Don't touch it, spit on all its advocates.
>>
>>60067124
Learn ARM or Risc-V or MIPS or 68k or some other RISC assembly instead, unless you're actually planning on using x86 assembly.

Once you grok one assembly, the others are all pretty much the same, except RISC is way easier because there just isn't as much to know.

Modern x86 was never really meant for humans to write, but rather for compiler implementation. armv7 was getting that way, but they cut a lot of fat out with armv8.

That said, it's probably better to learn an older assembly, meant to be written by humans, on an emulator, than a modern one.

I'm just now picking up Risc-V, we'll see how that goes. I've read it's pretty similar to MIPS, so maybe human-grok-able.
>>
>>60067161
>one autist made a pasta to counter other autist's pasta
That's why I like this site.
>>
>>60067199
It's autistic to post here.
>>
>>60067196
thanks for the quality reply.

I used to program microcontrollers (8bit AVRs and 8051) in assembly, maybe time to dust those old platforms.
>>
>>60067196
knowing x86 assembly can at least help in reverse engineering, the only really useful thing assembly gives you
>>
I feel like every program one may need on their computer or smartphone are already made. So I can't begin to a project, am not productive at all. Give me some advice
>>
>>60067124
>>60067196
I agree, to add to this RISC assembly is more pragmatic to learn being that it has more direct applicability in the real world at this point over x86. What I mean by this is that there are many more reasons to program assembly on an embedded platform these days than on an x86 unless it's some minute optimization. If you're going to write in a language that is so completely tied to hardware, you might as well be doing so because you wish to interact with the hardware directly.

get a raspberry pi and arduino and go to town :-D
>>
Friendly reminder that there is literally no way in C to recover when malloc returns a NULL pointer.
>>
>>60067196
>Learn ARM or Risc-V or MIPS or 68k or some other RISC assembly instead
Which one of these is the "better designed" one? Should I just learn ARM if I have a raspberry pi?
>>
>>60067271
>implies lack of bounds checking in the code
sounds like a shitty programmer not C's fault
>>
>>60067254
find a popular app on an app store, and clone it, but remove all metrics, tracking, and advertising.

I do this for fun. Also by clone, I obviously mean implement its functions yourself, not steal its code or some shit pajeet.
>>
>>60067273
ARM and Risc are one in the same, ARM stands for Advanced Risc Machine. When you learn RISC you are learning the instruction set for ARM essentially
>>
>>60067042
nth for the greatest language ranking
>1 AS3
>2 C
>3 C++
>>
>>60067271
No way in C to recover what?
>>
>>60067271
Initialize an error handler at the start of the program, and then call from a malloc wrapper than calls the error handler when null is detected.
At that point, you can pause execution and try again or dump everything to disk and hope you can fail gracefully.
>>
>>60067273
>Should I just learn ARM if I have a raspberry pi?

If you want to learn ARM assembly, forget about the pie, cubieboard, banana pi and other ARM boards with desktop-computer capabilities. Especially not the raspi that doesn't work without closed sores crapware. There are plenty of simpler (arudino-like) ARM boards for as low as 10-15 bucks, get one of those. You can start with directly messing with the chip memory, leds, simple outputs etc.
>>
>>60067042
I need help, guys. I'm working on a shell in C++ and there's two things I can't figure out how to do: piping and user variables (e.g. replace $VAR with 5 if they declare that VAR = 5)
>>
>>60067254
I wish this was true, more often than not i have to make my own stuff for a very specific niche need
>>
>>60067277
great idea. thanks
>>
>>60067303
he won't respond to this because it was bait by someone who can't even program.
>>
>>60067277
>not steal its code or some shit pajeet
If >>60067254 needs marching orders to be productive, he's already pajeet-tier. Dollars to doughnuts he'll end up churning out enterprise CRUD garbage, assuming he doesn't get bored and drop programming in favor of accountancy or something.
>>
the time is now
https://doc.rust-lang.org/book/
http://rustbyexample.com/

* not for the brainlets *
https://doc.rust-lang.org/nomicon/
>>
void add(Dictionary dict, char *str)
{
Dictionary temp = dict->next;

while(temp != NULL)
{
if(strcmp(str, temp->word) == 0)
{
temp->count+=1;
return;
}

else if(temp->next != NULL)
{
if(strcmp(str, temp->next->word) > 0)
{
Word* new_temp = (Word*)malloc(sizeof(Word));
new_temp->count = 1;
new_temp->word = strdup(str);

new_temp->next = temp->next;
temp->next = new_temp;

return;
}
}
else if(temp->next == NULL)
{
Word* new_temp = (Word*)malloc(sizeof(Word));

new_temp->count = 1;
new_temp->word = strdup(str);
new_temp->next = NULL;
temp->next = new_temp;

return;
}
temp = temp->next;
}

if(temp == NULL)
{
Word* new_temp = (Word*)malloc(sizeof(Word));

new_temp->count = 1;
new_temp->word = strdup(str);
new_temp->next = dict->next;
dict->next = new_temp;
}
}

Implementing Dictionary in C blows.
>>
>>60067351
C blows.
>>
>>60067124
>>60067269
bare metal assembly on Pi actually turned out to be a bit of a PITA. Doable, but there's so much undocumented magic. I guess if you want to do Assembly in Linux, no reason to not, but worth considering.

Arduino would be better, or just got myself one of these: https://www.sifive.com/products/hifive1/
>>
>>60067273
>better designed
Risc-V has the advantage of being from-scratch, leaving out a lot of legacy cruft. Very little real-world practical usage, though.

>I have a raspberry pi
Sure, go ahead, learn ARM then. Doesn't matter too much. Whatever you like. But most of them are also available on qemu or have dedicated emulators, so you "have" most major RISC options available to you. But nothing beats seeing your code run on a real board and interacting with the real world (like controlling music on a couple pins).

>>60067290
>ARM and Risc are the one and the same.
Nah, not quite. ARM is but one RISC ISA. Other RISCs might differ in more significant or less significant ways. Arm code just won't run on MIPS code automatically (and probably can't be auto-converted, either).

>>60067313
I second this, as I already stated elsewhere. Only reasonable if you're staying on Linux or don't mind wasting hours finding an undocumented feature on some thread somewhere not indexed by google.
>>
>>60067313
>>60067361
you're not wrong. I write on Pi's as well as Uno's, Yuns, and ESP8266's. Out of all of them the ESP8266's are probably the nicest to write for. (honestly just because they're pretty stripped down.) The Pi's have all these annoying things to account for like Physical pin numbering vs BCM pin numbering, etc--it's a bit to chew on for sure. I think the other nice thing about the Arduino's is you can leverage the serial libraries to step-by-step your assembly
>>
>>60067271
How is a malloc call that returns NULL other than a fopen that returns NULL or a time() call that returns -1?

The only difference is that memory allocation is usually required, whereas file opening/time info are often not.

But if your program needed to open a file to work, and fopen always returns NULL, you're equally as screwed as with malloc.
>>
>>60067313
>>60067361
>>60067439
>>60067445
do you guys know of any good resources out there on best practices for writing hardware interrupts in assembly/C for arduino-type uC's?
>>
File: 1489115871059.jpg (20KB, 480x451px) Image search: [Google]
1489115871059.jpg
20KB, 480x451px
>suppressing a warning causes another warning about supressing the first warning
>>
What C compiler should I use?
http://suckless.org/sucks/ says that both GCC and Clang suck, and I'm not going to switch to windows just to use Visual C++. So what options do I have?
>>
>>60067552
suckless is literally satire
don't take them seriously you retard
>>
>Thought SICP was a meme
>Finally came around to reading it
>Discovered LISP Macros
>Mind is fucking BLOWN
Is there a way to make LISP not GC? I'm in love.
>>
>>60067494
Just about everything I know about assembly and things this low level is from actually reading docs or seeing it actually done. AFAIK there aren't really any good books, tutorials, or other online resources for this kind of thing, as it's pretty fucking niche, and done by people who're also learning from the same way (and more often than not, for their job).

Maybe you'll have some luck browsing some OCW?
>>
>>60067552
gcc + gdb are great.
clang I know nothing about.
Visual C++ is a meme
>>
>>60067552
>>60067560
>GCC is the virus which has spread into nearly every Linux distribution and has added its language extensions to be not easily replacable.

lol true tho
>>
File: 1407247910482.jpg (66KB, 800x534px) Image search: [Google]
1407247910482.jpg
66KB, 800x534px
>>60067199
>That's why I like this site.
I'm loving the Rust butthurt as well. The one Rust autist got rekt in his own thread.
>>
File: 1493085779791.jpg (898KB, 1570x1876px) Image search: [Google]
1493085779791.jpg
898KB, 1570x1876px
>>60067078
>Rust
>>
>>60067595
The reason why GCC non-standard stuff has made it's way into every GNU project is because it's so damn convenient.
Nearly all of C99's additions were GNU C extensions that were given the standards committee's official blessing.
>>
>>60067560
No it's not
>>
>>60067643
yeah, GCC extensions were just a bunch of quality of life things for programmers.
>>
>>60067647
>harmful: GNU head
>use sed 10q instead
>>
>>60067445
>April
>Not using ESP32
>>
>>60067317
I forgot to mention, I also need to treat ';' like a newline character.
For example, if the user entered "pwd ; ls" it would execute pwd, then once pwd is finished it would execute ls.
>>
>>60067552
never take sucksmore.org seriously at any level. If they are serious that's why, if they are just pretending to be retarded then that's why.
>>
>>60067748
what is a lexer, read a book.
>>
>>60067777
I am already tokenizing the strings, hence why I wasn't asking for help with that fundamental task. If I couldn't do that, I would need to solve that problem long before I tried to handle piping or something.
>>
>>60067631
what font
>>
File: lang.jpg (752KB, 1540x1760px) Image search: [Google]
lang.jpg
752KB, 1540x1760px
>>60067631
please post the correct image
>>
>>60067552
they compile their stuff with GCC they just really are headstrong about 'software bloat' it's a necessary evil

>>60067560
the philosophy may be satire but their stuff is super nice. I use `tabbed -c surf -e` to browse--works amazing. DWM is my WM--it's awesome and super hackable. st is my terminal--again it's great works well with zsh. I even use ii in vim for IRC (vim is my irc client thats dope I think)
>>
>>60067570
back in the day I read ed 1 & 2 of 'Assembly Language Step By Step' and that book was excellent, just didn't know if there was anything for Risc. I figured it'd just be me looking at a ton of libs and datasheets
>>
>>60067815
just tokenize lines based on ';'? If you have a lexer written this should be a trivial addition.
>>
>>60067720
oh shit dude good looking out, I didn't know about these. I don't really check out new boards much lately
>>
>>60067552
gcc
>>
Thoughts on using github as a databse? For my blog which i expect to get hits, im just parsing the data to my blog anything wrong with this?
>>
>>60067885
that is a very bad idea. Just look at what happened to cocoapods. If you're going to do something like this at least use https://pages.github.com/ but not straight up github. jekyll i
>>
>>60067328
what kind of blue hair dye and septum piercing do I need to buy to become a fit rust developer?
>>
>>60067815
You need to look up the fork() system call and the pipe() system call. Suppose you want to pipe p1 | p2. Then, your program should create two child processes by forking and run p1 and p2. Also, you have to create a pipe using the pipe() syscall and redirect the STDOUT of p1 to one end of the pipe and STDIN of p2 to the other end of the pipe.

Redirection can be done using the dup() or dup2() syscalls.
>>
>Tfw took over project
>mfw its C
>MFW int ****x;
Why do people do this*
>>
>>60067850
Maybe my implementation is more primitive than it should be. Currently it iterates through the input string letter by letter, creating an array of strings out of a single string, replacing any space character wtih '/0'.
Tokenizing it based on ';' as well would just give me one long command which would fail to execute when it reached execvp because it would simply pass the second command on as input parameters for the first command.

I'm aware that I'm probably just a fucking idiot.
>>
>>60067950
whichever one matches your python buttplug
>>
>>60067956
one or two pointers are fine, anything past that is over kill
>>
>Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).
????????

the runtime complexity makes me think binary search, but it's two lists, not one. you can't just find the median of both lists and then average them
>>
>>60067965
wouldn't a python be closer to a dildo? just form-factor wise i mean
>>
I remember being able in QBASIC draw with subroutines like line(), point() and such.
What libraries and languages people use to draw in real life? How can I make possible saving in SVG or, let's say, PNG?
>>
Why can't I edit javascript in a [VM] tab in chrome?
>>
>>60067986
you'd know
>>
>>60067983
That's just:
(first_array[last_element] + second_array[last_element]) / (first_array_size + second_array_size)
>>
>>60067965
Kek
>>
>>60067965
but arent python buttplugs appropiating black cocks? I don't want to cause a mass triggering in the rust dev team making em unable to work for hours.
>>
>>60068043
yea yea, w.e faggot
>>
>>60068027
Woops, you wanted median, in which case just get the midpoint by dividing the size.

(Anyway remember that the input arrays are sroted.)
>>
>>60068012
is christian anime a thing?
>>
I just had a final exam. One question was this:

#include <stdio.h>

int main()
{
int a = 1;
int b = 2;
int *c = &b;
*(c + 1000) = 128;

return 0;
}


>what is wrong with this code snippet?

I was thinking an lvalue cannot contain operands but it compiles fine, why? Is the answer related to dangling pointers?
>>
>>60068049
did you just assume his gender?
>>
>>60067982
3 is okay for c-strings
>>
File: 1491491608393.gif (1MB, 200x200px) Image search: [Google]
1491491608393.gif
1MB, 200x200px
>>60068064
>be me filling out tax form
>get to gender
> see "male", "female", "faggot"
>check faggot box.
>>
>>60068063
you are asigning 128 to *(adress of b + 1000)
thats very wrong.
>>
>>60068082
lol
>>
>>60068027
that's not what medians are
>>
>>60068082
>you can't choose multiple genders
welp, i guess i'll have to curl up in a ball and cry and leave my websocket privilege checker in Rust for later.
>>
>>60068068
I was talking in terms of integer pointers, but I do agree char pointers should have up to three.
>>
>>60067631
I doubt many humans will write assembly that performs on the same level as C these days in any reasonably complex application. Compilers are capable of some crazy shit that assembler optimizations can't really match. You should really only go down to that level to bypass bugs in your compiler, which you're unlikely to ever encounter in the first place, unless you're using some obscure compiler or something.
>>
>>60068060
He wants the median of both the arrays. What he means most probably is that if you merge both the arrays, what will the median be?

Naive implementation will take O(n+m) steps to merge and then O(1) to find the median, but he wants to do it in O(log(m+n)).
>>
File: 1476742654803.jpg (17KB, 450x450px) Image search: [Google]
1476742654803.jpg
17KB, 450x450px
>>60068100
>websocket privilege checker in Rust
>>
>>60068060
i know that... i said it in the original post. you can get the median for one list by dividing by the size, but there's 2 lists
>>
what should i study up on if i want to get a job at palantir? data science, networking security, or algorithms?
>>
>>60067983
Merge two lists and get a median
>>
>>60068127
:3
>>
>>60068149
>O(log (m+n))
>>
>>60068149
merging lists would take at best O(n+m), right?
>>
How do OpenGL anons do GUI in Core Profile 3.x+? Is there any usable approach besides using VBOs (which seem fucking stupid to use for GUIs)?
>>
>>60068159
>>60068174
Fug, didn't notice. Sorry.
>>
>>60068100
>>60068127
>>60068154

>gets rekt
>starts samefagging
is this the power of python?
>>
>>60068227
>p-people c-cant b-be laughing a-at me p-pls b-be samefag
kek
>>
>>60068227
>think's we're samefagging
hey faggot i'm not that guy i'm the faggot filling out tax forms
>>
Post the gayest code you've come across, /dpt/
use std::mem::transmute as crossdress;

struct Boy;
struct Girl;

fn main() {
let Hime: Girl = unsafe { crossdress(Boy) };
}
>>
>>60068254
Fuck off, tranny
>>
>>60068245
>he samefags from mobile so it doesn't show a you
lol
>>
>>60068267
Whatever helps you restore your self-esteem :D
>>
>>60068267
Or you could just spend 0.05 seconds in MSPaint to delete the (you), you know.
>>
File: 1475853362167.png (514KB, 532x582px) Image search: [Google]
1475853362167.png
514KB, 532x582px
>>60068245
don't worry, we both know you said something funny and I laughed ;)
>>
>>60068300
You don't even need a graphics manipulation program.
Just right click the link, press Inspect, double click the text, remove (You) and press Enter.
>>
>>60068300
Even easier, you can just inspect element and delete the text
>>
>>60068309
I won't bust anyone's coping mechanisms :P
>>
Why do people even talk about (You)'s anymore? I thought that shit was removed.
>>
>>60068334
Nah, you're just shadowbanned so nobody ever responds to you
>>
>>60068334
Are (You) sure?
>>
File: Capture.png (18KB, 573x246px) Image search: [Google]
Capture.png
18KB, 573x246px
>>60068360
Yes? A reply is treated the same as any other post, but you get a notification and it changes the favicon.
>>
>>60067983
Use divide and conquer.
Suppose you have two ordered lists A[1..n] and B[1..m]

Let a be the median of A, and b be the median of B.

Now, if a > b, I claim that the median of the combined list lies in either A[1..n/2] or B[m/2..m]. So, we have reduced are problem to finding the median of two arrays of length n/2 and m/2. This hints at a logirthmic runtime.

I leave the proof of the claim and the analysis to you as an exercise, since it looks like a homework exercise, and you won't benefit in any way if I just give you the answer.
>>
>>60068377
I run 4chan with a bunch of custom CSS in the settings, idk about anybody else but I get (You)'s idk if it's because of that.
>>
>>60068245
close some fucking tabs
>>
>>60068377
>I can't believe that the majority of 4chan doesn't use whatever random plugin I personally use
>>
>>60068012
Bumping question.
>>
>>60068378
i see, thanks. it's a leet code problem
>>
>>60067552
tcc
>>
>>60068412
That's the native extension, anon.
>>
>>60068444
Btw it's a pretty classic problem and you'll get the answer if you google it (if you're not able to solve it).
>>
>>60068012
Just use Python and the Pillow library. The PIL.ImageDraw submodule will let you do exactly what you want to do.
>>
>>60068462
Don't know what to tell you then, m8. Maybe you have a virus. Delete system32 and try again.
>>
>>60068012
Depends on the language. For example HTML and JS have Canvas which is easy to get into. You can also save your result as SVG or PNG
>>
>>60068012
>>60068421
>>60068484
I second this
>>
>>60067079
>tfw no type level lambdas
>>
Redpill me on MSYS2. Why is it better than Cygwin?
>>
>>60067955
>call the pipe() system call
Well, I feel stupid. Having a system call that does precisely what I need to do simplifies things greatly. Thanks, anon.
Now I just need to figure out variable substitution.
And the whole ';' thing, but that shouldn't be too tough to figure out.
>>
>>60068012
DirectX and OpenGL both support drawing primitives like that, but I think it's intended solely for debugging.

But I mean, it's pretty trivial to do in software, which is probably more what you're thinking of. Just keep some sort of raw pixel data array in memory and write your own primitive drawing routines. That can easily be graphically displayed in realtime or converted to any arbitrary image file type using any of the billion image format libraries out there for any given language.
>>
>>60068620
Neither is good you subhuman ape, just use Linux or macOS like a normal human being and if you really want the unix goodies on Windows switch to Win10 and use the Linux subsystem.
>>
What does the following code in Java do? I'm not familiar with the language.
// this is how next is initialized (it's an array)
// private Node[] next = new Node[256];

// there's some code that places an object into next, at the index specified by a character extracted from a string
char c = key.charAt(d); // get a character at the position given by d within the string 'key', put it in c
x.next[c] = someObj; // x is an object with an array stored at next (see array details above)



Is this placing someObj at a numerical index within next through some kind of implicit coercion of the character c into an integer? Or is it adding some property denoted by c to the next array? If so, that surely defeats the purporse of declaring an array of length 256.
>>
>>60068662
in C, chars are actually integers of their ascii code. probably the same in java
>>
What's a good resource for learning C++ for someone that's around the level of pointers and structs?
>>
>>60067042
Why is mokou best?
>>
File: Qt_logo.jpg (15KB, 400x400px) Image search: [Google]
Qt_logo.jpg
15KB, 400x400px
Damn I'm trying to make a thing where you select a folder and it loads all the directories and text files into a tree hierarchy, but its kinds tough to figure out. I thought I was better at programming than I actually am.
>>
>>60068727
https://doc.rust-lang.org/book/
>>
>>60068727
A C book.
>>
>>60068744
Why would you even link to documentation when you lack basic reading comprehension skills yourself?
>>
File: 1445840063391.jpg (33KB, 625x626px) Image search: [Google]
1445840063391.jpg
33KB, 625x626px
>>60068727
>>60068744
>>60068754
look out m8-e you're being had
>>
>>60068463
i'm guessing this would be easiest to do recursively? make a base case of if there's only 1 item or less in each list, where it returns that item or the average. and the recursive case would be doing a recursive call with the list halves that are closest to each other (going by the median)?

e.g.

1,2,3,4,5 and
4,5,6,7,8

would do a recursive call with
3,4,5 and
4,5,6

->
4,5
4,5

->
5
4

-> 4.5

is that the right logic?
>>
File: 14929782116750.jpg (58KB, 604x603px) Image search: [Google]
14929782116750.jpg
58KB, 604x603px
What is the most lightweight DB one may use for machine learning?
I just study and have no experience with databases. Language is python. The textbook implements solution with SQLite. I was thinking about using maybe BerkleyDB or LevelDB.
Should I also take a look on graph databases?
>>
>>60068727
Murder Stroustrup and consume his heart to gain his knowledge.
>>
>>60068737
Qt doesn't have a file prompt built-in?
>>
>>60068794
if you're up to enforcing relation yourself you should look at a NoSQL solution, it'll generally be faster IO than a relational database. ultimately if you want to do anything meaningful in a reasonable amount of time you'll need to look at clusters (not lightweight) something Spark runs on top of would be good
>>
>>60068794
SQLite is as lightweight as it gets
>>
>>60068794
SQLite or flat file.
>>
>>60068779
Yep. Also, if the two medians are equal, you can stop right there and output that as the answer.
>>
>>60068849
cool, thanks man. i slacked in my algorithms class sophomore year relative to how i normally do. the teacher was kind of a dick 2bh. will have to read up on algorithms more
>>
File: qtproject.jpg (68KB, 1094x925px) Image search: [Google]
qtproject.jpg
68KB, 1094x925px
>>60068796
It does, and I'm using to let the user select their folder, but I'm trying to make all files and folders veiwable in the program, like how IDEs have "project explorers".

I just have to spend a lot of time reading the documentation which is no fun.
>>
>>60068838
Reading/writing a raw file concurrently from/to different lines would be PITA.
>>
Is it possible to reduce this further?
[x := (\y.xz)] doesn't make sense to me.
\xy.xz
\x.(\y.xz)
>>
>>60068958
No
>>
>>60068958
The fuck is that
>>
>>60069058
meme calculus
>>
>>60068181
Bump, still need help. Tried implementing UI rendering in shitty and weird way: creating two GL contexts and drawing UI to framebuffer of second context, then rendering that framebuffer's texture on a quad in first context, but I fucked something up and get glitches instead.
>>
File: IMG_3516.png (33KB, 512x491px) Image search: [Google]
IMG_3516.png
33KB, 512x491px
Lets say i'm extremely fluent in Java (primarily with JavaFX), and I'm average intelligence:
How long would it be for me to switch to using C# with fluidity?
>>
File: 1493132242701.jpg (162KB, 1920x1080px) Image search: [Google]
1493132242701.jpg
162KB, 1920x1080px
>>60069119
what's wrong with Java, cracker?
>>
File: desktop.webm (2MB, 1152x720px) Image search: [Google]
desktop.webm
2MB, 1152x720px
Trying to write a thing to make those /a/ reaction images. Just have to write the part that will combine the images and maybe add some scaling options and a save button.
>>
>>60069142
I want a job.
And one of my personal projects requires me to be able to have a selectable read only format-able textbox but that functionality doesnt exist in FX
>>
is the golden age of programming over?
>>
>>60069191
ye
>>
Boolean flag = true;
Integer num = 0;
while( flag == true ) {
System.out.println(num++);
...
}

why does this java code print out the value of num before incrementing it!? god java sucks so fucking much! java is the worst! goddamn pajeet
>>
>>60069119
Syntax is very similar, the jump from Java to C# wasn't hard for me and I've only got a student's experience with Java. LINQ is an entirely different beast, though.
>>
>>60069264
Because you're comparing memory addresses.
Fun fact:
Integer a = 100;
Integer b = 100;
assert(a == b);
Integer c = 1000;
Integer d = 1000;
assert(c != d);
>>
>>60069264
B8
>>
>>60069264
++n? that's the C syntax
>>
#define behaviour
>>
>>60069311
no, java just sucks. nothing wrong with my code. I'll use a real language such as C or Common Lisp. fucking objected oriented poo java
>>
File: IMG_2951.png (46KB, 1200x1000px) Image search: [Google]
IMG_2951.png
46KB, 1200x1000px
>>60069304
Cheers lad, thanks for the answer.
>>
>>60069311
Oh wait, Booleans are also pooled.
>>
How do you properly parse command line arguments? A bunch of ifs and elses?
>>
>>60069264
10/10
>>
could murrica impose sanctions on india by banning stackoverflow for them?
>>
>>60069398
you use an enterprise quality argument parser library like boost::program_options :^)
>>
I have the following strings in a file:
yyID123xxxxxx
yyID456xxxxxx
yyID127xxxxxx


How can scan every string in the file by ID[num] and create a new list for every said ID?

I can implement a new list for every new ID, but I don't know how to scan for the ID's.
Is there some substring scanning function already in existance?
>>
>>60069413
>stackoverflow
more like poooverflow right gais XDDDD
>>
>>60069398
timediff
timediff help
timediff track <title>
timediff track <datetime> <title>
timediff track periodic <datetime> <period> <title>
timediff untrack
timediff untrack <id>
timediff <datetime>
timediff <datetime> <datetime>

An example of fresh (just after installation) session:
$ timediff help
timediff - show a table of events you are tracking
timediff help - show this
timediff <datetime> - show the difference between current time and <datetime>
timediff <datetime> <datetime> - show the difference between two dates
timediff track <title> - track a current event
timediff track <datetime> <title> - track an event
timediff track periodic <datetime> <period> <title> - track a periodic event
timediff untrack - untrack everything
timediff untrack <id> - untrack one or more events
$ timediff 2017-04-24
-0001,00:00:00
$ timediff 2017-04-27 2017-04-23
+0003,00:00:00
$ timediff track I began using timediff utility
$ timediff track 2017-06-03 math exam
$ timediff track periodic year 1997-07-01 birth day
$ timediff track periodic 14 2017-05-28 meeting with Sam and Christina
$ timediff
...
$ timediff untrack 2
Untrack 'birth day'? (y/n): y
'birth day' untracked.
$ timediff
...
$ timediff untrack
Are you sure you want to untrack all events? y/n: y
All events untracked.

>>60069437
I won't touch C++ or any external library, I want this program to fit into single file.
>>
>>60069398
http://docopt.org

The unmatched handiness and elegance of well designed Domain-Specific Languages.
>>
>>60069491
Started watching the video.
>>
>>60069398
use GNU argp for maximum FOSSness.
>>
File: idris_emacs.webm (192KB, 854x174px) Image search: [Google]
idris_emacs.webm
192KB, 854x174px
>Idris creates function definition form declaration
>Idris creates branches based on args types
>Idris sees both arguments have the same length so it deduces the only two possible patterns are `[] []` and `(x : xs) (y : ys)`
>Idris automatically proves the result for the `[] []` case is []
>Idris tries to deduce what I want based on the types but fails, since it's not a full-fledged AI (yet)
This is kinda interesting way to write code.
>>
>>60069413
since they're at it, why not ban facebook in all arabian countries?
Or find another way to make silicon valley become the new Detroit ...
>>
>>60069457
>what is static linking
>>
>>60069587
I know what that is.
>>
>>60069491
>>60069525
I'm starting to like it.
>>
>>60069659
It's written in Python, but I could rewrite it in Lua.
>>
>>60068484
Will look into this.

Are there more languages and libraries?
>>
>>60069264
http://stackoverflow.com/questions/2371118/how-do-the-post-increment-i-and-pre-increment-i-operators-work-in-java
>>
File: IMG_3795.png (2MB, 1920x1080px) Image search: [Google]
IMG_3795.png
2MB, 1920x1080px
We hear you call our cousin Pajeet a "poo in loo" and a "currycel". Also you say python is better than java. You saying what you son of basterd bich?
>>
>>60069789
already posted this pic
>>
>>60069491
>command-line app
>app
Damn newspeak.
>>
>>60068794
>>60068813

I'm going to second SQLite.

Pros use PostgreSQL. If you don't want to go with a full PostgreSQL server (it's really not that hard to set up and use), then SQLite would be great for learning and student uses. Especially if your textbook uses SQLite.

If you ever need a solution other than SQLite / PostgreSQL, you'll know it, and you can learn it then.

Beyond this, SQLite/PostgreSQL will suit any other software projects you want to pursue. The other solutions might not.
>>
>>60069795
"app" is short for "application".

There is literally nothing wrong with using it.
>>
>>60069815
yeah my suggestion was probably way overkill. I'm used to having to deal with data sets that are unwieldy
>>
>>60069834
I think he spazzed out because someone used "app" instead of "program".
>>
>>60069795
App = application = socialized and small program

Kys
>>
>>60069834
>>60069858
>>60069870
App = application = I benefit from the *application* of preparation H on my chafed anus-bum-hole
>>
File: baka.png (510KB, 782x1238px) Image search: [Google]
baka.png
510KB, 782x1238px
>>
I determined that docopt is beautiful and I will rewrite it in Lua
>>
I know Pajeets use it but aside from that is there anything specifically bad about Java itself?
>>
>>60069901
Pretty ironic that the sperg complaining about "newspeak" is calling others butt hurt.
>>
>>60069958
It doesn't have unsigned integers or operator overloading.
>>
>>60069958
Yes, it is the kind of languages that pajeets would choose to use.

Absolutely attrocious, obscene OOP abomination
>>
File: the future is bright.png (1MB, 1012x760px) Image search: [Google]
the future is bright.png
1MB, 1012x760px
Can I mirror an array using a hash table for very hihg operation speed?
>>
File: Capture7.png (655KB, 1110x658px) Image search: [Google]
Capture7.png
655KB, 1110x658px
>>60069154
Okay done.
>>
>>60069958
It can't run natively (needs a VM) and it has an automated garbage collection (bad for performance critical software).
>>
>>60069961
lol i'm not that guy I actually have something very wrong with me medically.
>>
>>60069958
Lacking in functionality in a few ways so it requires the use of libraries or wrappers for some of the more complex stuff.
Also some things that would never give you issues in other languages cause exceptions to be thrown.
>>
File: 1491170167800.png (28KB, 354x286px) Image search: [Google]
1491170167800.png
28KB, 354x286px
>>60070082
pretty neat
>>
>>60069154
>>60070082
nice

>>60070176
dumb frogposter
>>
File: image.jpg (29KB, 388x461px) Image search: [Google]
image.jpg
29KB, 388x461px
>>60070176
>>60070196
Domo. Unfortunately it's unlikely anyone can use it since I seem to be the only MMA user on /g/ but it was a nice hour of programming. Maybe I'll mess around with CloudDeploy later and try to make it a web app.
>>
>>60070226
is that the entire code? mathematica seems excellent
>>
File: file.png (3MB, 1357x2072px) Image search: [Google]
file.png
3MB, 1357x2072px
>>60067830
>>
>>60069958
That it's a language that's stuck with a 30 year old view of programming.

Shit concurrency primitives (if you can even say it has that).

Algol-level abstractions (ffs fuck for loops).

Modern ideas it's picked up are gimped because of lack of foresight (functional programming and Generics isn't new -- they just didn't give a fuck about it because it wasn't selling when Java went commercial).

Its primary units of abstraction are objects and classes, pretty much everything else except standard algol-things are second class or awkward as hell to use.

It wasn't a bad language in 1998. It's time to put Java to rest. Perhaps use other JVM languages.
>>
>>60069154
>>60070082
Holy shit pls share notebook.
>>
>>60069958
You should ask yourself why you want to use Java in the first place before asking that question.
>>
File: Capture8.png (26KB, 697x537px) Image search: [Google]
Capture8.png
26KB, 697x537px
>>60070256
This is it.

I like Mathematica a lot for simple prototyping and math crap.

>>60070301
https://my.mixtape.moe/cjjbrp.nb

Be careful not to save and close with the GUI open, it takes a long time to reopen it afterwards.
>>
Post peer reviewed studies showing vim (being used as a user end text editor, rather than an automation too) improves productivity. I'll wait.
>>
So, is C the only language that /g/ officially endorses?
>>
>>60070447
>Post peer reviewed studies
a university would have to be wrought with autism from the foundation up if it was allocating time to inane things like this.

Nobody cares dude go back to gedit or whatever it is you like
>>
>>60070478
No, /g/ only endorses Japanese
>>
>>60070500
N-nani?!
>>
Just picked up "The C Programming Language", C is going to be my first language. Wish me luck anons!
>>
File: 1483885191497.jpg (465KB, 700x988px) Image search: [Google]
1483885191497.jpg
465KB, 700x988px
>>60070539
Oh i'll be your nanny
>>
>>60070546
You should start with x86 assembly or else you'll never really understand what you're doing
>>
>>60070546

Another naive beginner is corrupted by such a shit language.
>>
File: Documentsimage.jpg (33KB, 358x647px) Image search: [Google]
Documentsimage.jpg
33KB, 358x647px
>>60070405
Thank you anon. This is great.
>>
class MesList{
private:
string message;

public:
string getid(){
return message.substr(3,6);
}
};


Am I a retard for not understanding why a call to getid gives me: "Error message is private"?
Pls respond. I know it's encapsulation 101 taht's what makes it even more frustrating.
>>
>>60070574
"I think I'll make a PB&J"

"you should go out and thresh wheat for the bread, crush peanuts into oil, and preserve jams from berries in the field or you'll never really know how to make a PB&J"
>>
>>60070603
And? It's true.
>>
>>60069907
why does this exist
>>
>>60070597
Ok nevermind I truly am retarded.
>>
File: image.jpg (10KB, 249x275px) Image search: [Google]
image.jpg
10KB, 249x275px
>>60070578
>>
File: 1465417216416.jpg (260KB, 900x948px) Image search: [Google]
1465417216416.jpg
260KB, 900x948px
I'm learning the basics of C++ because it's so widely used, but every time i see a discussion about it on /g/ i see it getting mercilessly shat on

what's so bad about C++ ?
>>
File: 1491280407879.gif (1MB, 350x272px) Image search: [Google]
1491280407879.gif
1MB, 350x272px
>>60070630
I want whatever you're smoking
>>
>>60070669
>>
File: smugasuka25.jpg (219KB, 560x577px) Image search: [Google]
smugasuka25.jpg
219KB, 560x577px
>>60070575
What should I learn instead?
>>
>>60070670
It's pretty safe to do exactly the opposite of what /dpt/ says about anything related to programming.

If it's popular, useful, and/or has many jobs, then /dpt/ is going to shit on it.

If it's esoteric, unwieldy, and has few jobs, /dpt/ will laud it.
>>
File: tickle.png (39KB, 256x256px) Image search: [Google]
tickle.png
39KB, 256x256px
245th for Tcl.
>>
>>60070703
Lisp (or Scheme). Fuck syntax learn to solve problems.
>>
File: thinking.jpg (2MB, 3648x4000px) Image search: [Google]
thinking.jpg
2MB, 3648x4000px
>Why users use a certain language
>>
File: Screenshot_2017-04-25_23-06-51.png (6KB, 504x454px) Image search: [Google]
Screenshot_2017-04-25_23-06-51.png
6KB, 504x454px
I'm making a logic circuit editor.
So far I've done the loading from json file and computation of output based on given input.
Now I need to do the components using multiple simple components.
>>
Fuck! My features TODO list is growing faster than i can implement them.
>>
>>60070875
you could use this with Arrows in haskell
pretty useful
>>
File: UFO.jpg (21KB, 898x532px) Image search: [Google]
UFO.jpg
21KB, 898x532px
Look, an employed Haskell programmer!
>>
>>60070886
I'm not using Haskell for this. I'm using C++.
>>
File: Capture9.png (18KB, 682x388px) Image search: [Google]
Capture9.png
18KB, 682x388px
>>60070405
Just realized there's no reason to go through the whole texturing polygons process to show the resulting image. This runs much more smoothly.
>>
File: 1473333301996.jpg (87KB, 1366x768px) Image search: [Google]
1473333301996.jpg
87KB, 1366x768px
does anybody know where I can get an online copy of L.I.S.P my buddy got me the ANSI Common Lisp book but I've heard really good things about lisp in small pieces
>>
>>60070773
glad i happened to see someone who knows tcl before i die
>>
>>60070871
>C is a Lan Evo; better on paper than almost anything else but unreliable in the hands of all but the most diligent users
>Haskell is amazing in theory but it'll never actually be implemented

10/10
>>
>>60070871
Are those cars supposed to represent the language, or what was built using the language.

If the former, at least Assembly doesn't seem accurate.
>>
>>60070273
>Mathematica
Mah nigga
>>
>>60070933
The cars represent the values of the users of the respective languages.
>>
File: 1490255091211.jpg (8KB, 240x238px) Image search: [Google]
1490255091211.jpg
8KB, 240x238px
Where do i start learning C++, guide me dpt
>>
>>60070976
first, start by realizing that your virginity is now what we call 'immutable'
>>
>>60070995
Ok, now what
>>
>>60070963
Assembly programmers look cool but are slow, impractical, useless, and can't turn? Eh, seems about right.
>>
Does anyone know of any open source projects that need unit tests written? I am looking to practice my JavaScript test writing and would like to contribute to something instead of throwing it away.

I'd go to /wdg/ but its dead.
>>
>>60070976
I started with this http://101.lv/learn/C++/
But that was many years ago. I'm sure there must be better books around. I don't think that book even takes into account C++11.
>>
>>60070703
Whatever you want.

Really, all beginner friendly languages are shit.

I would recommend one still just to get your feet wet, but since you're going with C..

Go hardcore. Get SICP. Lisp/Scheme is a great language, and SICP is probably one of the best introductions to the big ideas in programming, and will set you way ahead of even a lot of professional programmers (especially the Javascript and webdev guys).

If you want something practical.. maybe Golang? It's not a shitty language, but it's also the eunuch of languages. Pretty much designed to be used by newbs and keep them from fucking shit up. At the same time it's also fast and supports concurrency well. While I would rather not work in Golang, if I was to start a project with newb programmers, I'd probably force Golang on them.
>>
>>60070871
Assembly
>Diy
>Impractical
>street cred

C
>Very simple
>Gotta go fast
>Dangerous

C++
>Ugly
>Practical

Haskell
>Maths

Ada
>Well engineered

Python
>Code for me please, Google?

Rust
>Restrictive
>Being touted as a savior for programming

Hmm
>>
>>60070871
C++ should be a reliant robin
>>
how shitty is my module?
https://github.com/nickwilliamsnewby/ephemGravityWrapper
>>
>>60071002
thats as far as I got with it :(
>>
>>60071196
> Really, all beginner friendly languages are shit
Have you heard of Lua? Implemented in 10000 lines of clean C, perfect for embedding and learning as a first language.

Second best would be C.
>>
Does anyone know of the existence of a compiler which is able show a "stacktrace" of a failed template instantiation? In other words, the code path to the instantiation.
>>
>>60071277
ehm, I talk about C++ if you couldn't tell
>>
>>60071290
What is failed template instantiation and how does this C++ feature help you in programming?
>>
>>60071248
Define planets, coredicts and massdicts outside of functions. There's no need to keep reinitializing them every time the functions are called since it's "static" data.
Switch to Python3 and get rid of the encoding header.
Implement a custom exception (like PlanetNotFound exception) that gets raised when passing invalid planet to the functions.
The shebang is sort of redundant if you're going to add file extension anyway, use either.
Add a brief function doc for each function that explains the parameters and return values.

2/10, you tried and it's working
>>
>>60071301
What? Are you asking me to teach you about templates?
>>
>>60071333
I know what a generic is. They should not fail at runtime.
>>
>>60071253
Haven't investigated Lua much, never really heard it advertised as a beginner-friendly language, but I guess it wouldn't be wrong.

But there's absolutely no value in learning C as a beginner. A beginner's not gonna get a C job, and any software they write for the next two years will be memory leak central, and there will just be too many frustrations.

The only reason someone should learn C is if they want to maintain legacy code or have a good reason for it, like embedded.
>>
>>60071324
Solid advice.
>>
>>60067291
Says the nigger using dropbox as version control.
>>
>>60071349
And they don't, they fail at compile time.
>>
>>60067351
>capitalised typedefs
>casting the result of malloc

That's not even nearly C.
>>
>>60071355
What about the
>C forced me to learn what's going on under the hood
argument?
>>
>>60071400
It's a good one. x86 asm forced me to learn what ABI is.
>>
>>60071349
Not at runtime. I put the "stacktrace" in quotes because of the lack of another word. What I mean is:

When the compiler fails to generate code for a template (which is called instantiation), because of some programmer error, then the compilation fails and normally you're just given some line number in some file where it happened (which could be deep within some library) and that's all. Now the problem is that it's often not easy to tell from where in your code this line was reached. I would like to know from where this line can be reached in my code.
>>
finally I understand the meaning of public static void main(String[] args).String[] args is the stuff you can write into the console with -xxxxx
>>
>>60071483
Great progress, Anon.
>>
File: 1475851455968.jpg (67KB, 456x384px) Image search: [Google]
1475851455968.jpg
67KB, 456x384px
>>60071483
>>60071502
>>
>>60071483
Congratulations on finishing your first day of "Intro to programming" course.
>>
>>60071400

Why the fuck should a programmer care?

The goal of programming is to get as far away from the machine as possible. Look at Scheme -- a Scheme programmer don't give a fuck how anything works. He's using lambda calculus that gets translated to Von Neumann codes.

It's why Python's so successful, you just need to know how to *program*, not how to make your PDP-11 derivative happy.

The only time you should worry about the details of how your computer works when you need to define its behavior in some way that doesn't exist yet, such as greater performance. And you should only go as low level as required to get the desired behavior. Sure, it's something to learn eventually, and a skill any well-rounded programmer should have. But a beginner should be focusing on how to take input and validate it, how to write a Tetris, how to architect a small game in a manner that makes it easy to maintain and extend, about MVC and design patterns. Because these are things transcendental of any language, and the language that makes it easiest for him to study these aspects of programming are the best language for him to learn.

Working with pointers, managing memory manually, all that kind of stuff is a distraction from the big ideas.
>>
>>60067053
its*
>>
>>60071572
You're the reason things like Electron exist.
>>
>>60071519
>commandline shit
>intro
Nice meme.
>>
>>60071324
>>60071359
thanks guys, made some changes based on this if you have time I would love more feedback
>>
>>60071572

This. Programming is Maths, not Electrical Engineering.
>>
why is it called throwing exceptions? is it the compiler getting mad at you and throwing it in your face?
>>
>>60071572
You know, i actually agree with you. But you're not very convincing to someone who doesn't.
>>
>>60071572
lol. try programming a driver in python, or an OS, or anything embedded.
>>
>>60071636
>The only time you should worry about the details of how your computer works when you need to define its behavior in some way that doesn't exist yet
>>
>>60071601
Wait, wat?
>>
>>60071616
In many programming languages it's called "raise".
>>
>>60071616
yes
>>
>>60071616
do you have better words for throw/catch?
>>
>>60071649
>there is no value in being able to make the stuff that runs everything else
>>
>>60067291
who is Abi and what is an ABI error?
>>
>>60071700
Abi is an Indian given name.
>>
>>60071700
Application
Binary
Interface
>>
>>60071243
I think a Fiat multipla would also be a good choice for c++
>>
>>60071655
raise/lower
>>
  new Thread();

>>60071726
>>60071726
>>60071726
Thread posts: 312
Thread images: 53


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