/dpt/ - Daily Programming Thread

old thread: What are you working on, Sup Forums?

Other urls found in this thread:

gitgud.tv/watch/?u=4452
ocw.mit.edu/courses/mathematics/18-06-linear-algebra-spring-2010/video-lectures/
reddit.com/r/programming/comments/4jr509/42fr_the_free_computer_science_school_is_opening/
mitpress.mit.edu/sicp/full-text/book/book.html
twitter.com/NSFWRedditImage

Systems programming is such garbage, if only there was some kind of type that could make it great again

how to be a good programmer:
dont listen to /dpt/ (excluding this post)

What books for a beginner programmer to learn?

a webtorrent livestreaming site

working on lowering latency a bit

gitgud.tv/watch/?u=4452

Not really programming. But what's a good book for people who just wanted to learn Linear Algebra?

You're looking for the dynamic type.

unironically this book
i'm a UW Seattle Comp.sci/EE graduate currently making 165k in Seattle. (23 yo) they taught us programming with this book. very comprehensive while being beginner-friendly

>applied to 370 companies
>no replies
>change name on resume to a girl's name
>get 10 phone calls that same week

Why haven't you played the game yet, Sup Forums?

fuck off today is international wymyn day

fuck them

yes you do fuck wamen

Still working on my webgl physics engine. On to my fourth cup of coffee and it's about time to wrap it up for the night. Had a nice day/evening. Haters gonna hate.

Don't know about books, but this course is dope. All lectures recorded and materials available.

ocw.mit.edu/courses/mathematics/18-06-linear-algebra-spring-2010/video-lectures/

>collision detection with complex concave shapes
>fluid physics
Impressive!

>What are you working on, Sup Forums?
Passing through a PCIe device that's attached to a remote root complex to Qemu. Using mediated device driver API (mdev) and some proprietary stuff for setting up mappings across the NTB.

I've managed to make it work for PIO, DMA and interrupts for an NVMe disk and a GbE ethernet card, and it works for both Linux and Windows as a VM guest OS.

I'm trying to pass through a remote Nvidia GPU to Windows guest, but it appears to be accessing some legacy VGA region on the device which I haven't added any support for.

Something is also a bit shady when I pass through multiple devices, which I need to look more into.

Pic related, it's the remote NVMe disk showing up inside the VM. It's a shitty m2 disk, which is why the performance is so bad, but I'm also doing interrupts in a retarded fashion right now, so that may also impact performance somewhat.

T-thanks. It does handle concave and self-intersecting geometry, but has nothing to do with fluids. Then again I can't tell if you're being sarcastic or not.

Oh, you mean it's just cubes passing through eachother and sinking through the floor?

Haha no, I'm just spawning a bunch of objects in random positions as "terrain" and then colliding stuff with said terrain

That's a pretty impressive outcome for random positions

Beyond /dpt/, Sup Forums in general gives awful advice. Everyone is larping as a programmer round these parts.

What are you talking about user?
How can one set of random placements be more impressive than another?

I don't think I've ever had my random positions come out like a proper spiral. Your random number generator is shit. Work on it.

Oh sorry I'm not the person who made this random placement of cubes.
>proper spiral
That'd be something. But it'd take quite a bit work to discover a pattern in this mess of cubes.

If I have a Wirless node network in the configuration of pic related, and each node has its own clock, how do I synchronize them all to have the same or as similar clocks as possible?

The user can only set the clock on gateway node A, and the yellow lines between nodes represent 2 way communication of data(including clock data), and each node's clock can be read or written to by that node.

Hello Sup Forums,

I have this program here that reads in height weight and hba1c levels from a .txt file on the left and prints out the averages and min max values to the .txt on the right. The code on the left is the function where the operations are preformed to find averages, min and max.

The min and max readings are correct but the averages are completely fucked. I've been trying to figure this out for over an hour now and im clueless, any guesses?

It appears to be dividing the sum of bmi's by four instead of three

>What are you working on
Imaginary ASM language compiler and a cpu emulator that runs the code. In pure C, only 4 or 5 standard C functions authorized. Kill me

>update
that's a big function

>only 4 or 5 standard C functions authorized
Why?

should I try splitting it up into smaller ones?

You may just spout garbage for all /dpt/ knows, desu.

Also
>reddit spacing
>windows
>nvidia
>SSDs
Is this Sup Forums botnet bingo?

probably

friendly reminder that try OOP only uses static function objects for class methods

>Ebola 0.1.0

>try
true

school wants us to code everything from scratch. I coded my own printf, own calloc, memset, etc... It's pretty awesome but sometimes it pisses me off. I'm allowed to use malloc, free, write, read, open, close and that's it

The Art of Unix Programming

But the goal is to program a compiler and an interpreter, right? Rewriting libc seems like a waste of time

Well, there's a thing called intuition. Now, intuition, what it does, is it recognizes patterns. In an algorithm that generates manifolds at random positions in an increasingly large volume of generation, patterns recognizable by intuition are increasingly rare. You showed us a picture of a generated pattern recognizable by intuition -- as a spiral, namely. The fitness of the picture to the template of that pattern, when compared to the rarity of the occasion that patterns recognizable by intuition would be generated as opposed to patterns perceived only as noise, when compared in turn to the large volume in which the shapes could be generated, is surprising.

So you are rewriting standard c libraries like stdio?

Damn that sounds tough. We had a c programming module last sem and most of my classmates got lost somewhere around singly linked lists.

rewriting libc is our school year's goal. The asm thingy is one of our projects. Well, it's a waste of time after 6 months of C. But honestly, when I learned C in september for the first time, it really helped me to write everything from scratch because you really get to know how everything works under the hood. But yeah, I think it would be fair to authorize them in march, we already know how to write C. Anyway this school's fucking dumb, I'm only here for the diploma and because it's a famous school in my country

Why the hell would they start with Java?

Are you doing this open or closed? I'm interested in webGL myself and looking for a pet project. If you have this publicly available somewhere I'd love to fork it and do a few PRs.

not libraries. only functions. We are authorized to include standard library headers in our programs. So I can use defines like NULL, EOF, etc... but if you use an unauthorized function, it is considered as cheating, and it's a bot that checks our school projects so there's no way to get around that.

what the fuck. So what exactly are they trying to teach you guys in this class?

Understanding how some of the popular and more intricate functions work is fine, I guess, but making you write even the most basic and rudimentary shit yourself just seems like a complete waste of time.

wut.
they make you rewrite the compiler from scratch but then don't give a fuck if you just copy paste the existing libraries over?
i dont understand, the libraries are the interesting part right there. the rest is just super simple gruntwork

well, here comes the funniest part of the story. Our school doesn't have teachers nor classes. It's basically a giant building with empty rooms. You just do your projects.All the projects are given on pdf files, checked by a script, and you're fucking graded by a robot too. Yeah you heard me right, it's a bot that decides whether or not you're going to validate your semesters. And the best part is that it's one of the most expensive schools of the country. The boss is probabily the biggest jew of the entire world.

once again, during the very early days, it was really cool to understand how to code a printf, it made me understand arrays, parsing etc...

you're allowed to include .h files, you're not allowed to used any function aside the authorized ones. nothing hard to understand. You can only use the defines, macros and typedefs

>well, here comes the funniest part of the story. Our school doesn't have teachers nor classes. It's basically a giant building with empty rooms. You just do your projects.All the projects are given on pdf files, checked by a script, and you're fucking graded by a robot too. Yeah you heard me right, it's a bot that decides whether or not you're going to validate your semesters. And the best part is that it's one of the most expensive schools of the country. The boss is probabily the biggest jew of the entire world
what kind of dystopian hellhole is this

Epitech?

kek yes

Sounds like a good racket IMHO.
>get some bottom bitch code monkeys to collect some PDFs, write some exercises and create some checker scripts
>get """accredited""" via money/favors/connections
>charge out the wazoo to create the impression of quality
>dumb fucks will actually pay you and your country is sufficiently corrupt to keep the gravy train going (see USA, ITT tech)

Why didn't you go to university? Much cheaper

Companies will hire you much easier and you'll get paid a lot more by doing Epitech. I do it for the money, nothing else.

What the fuck are you doing at epitech, join 42.

But you just called it "one of the most expensive schools in the country". I feel like it doesn't make that much financial sense.

So French companies actually prefer bootcampers?
>42
How accepted is it by the state/industry?
I'm reading some things from a 1yo thread that don't inspire a lot of confidence.

Especially since the former staff founded a free as in beer fork of that school with billionaire bucks.

>thread
reddit.com/r/programming/comments/4jr509/42fr_the_free_computer_science_school_is_opening/

At least as much as epitech, maybe more since it's merit based.
The US campus is a trainwreck compared to the Paris one, muricans don't apply because they believe it's a scam (it actually isn't).

My parents pay for the school. When I said "I do it for the money", I was refering to the future high paying jobs the school will enable me to do.

42 is god tier desu. the problem is, you don't get a israel-approved diploma, so you don't get the same jobs.

>Computer science school
Holy shit the delusion. It's just code monkey crap.

At least you're not formed to be a webshit.

>webschool factory

>tensorflow keeps running out of memory on aws
I'm going to be broke at this rate

I finally got it!
Sadly it's not in English and it's the first edition, that's still fine for reading in the bus compared to my little smartphone screen.
It's bigger than what i thought, 4 chapters remaining, so much fun!

Accidentally wrote
[spoiler]#define TOL 1e-4;[/spoiler]
Took some time to recognize that

now it's overfitting

>mitpress.mit.edu/sicp/full-text/book/book.html
user, just

Please help me /dpt/,

I'm in a Computer Science degree and the intro C++ classes are kicking my ass. I got a D in the first course, and schools consider D as passing so I'm in the second course not knowing what I'm doing. Are there any books or videos for brainlets I can look at?

I was in the military as an IT, but I don't want to go back to sysadmin, I want to work on security or AI.

He wanted it printed so as to not read it on his phone.

dumb frogposter
dumb frogposter

can someone recommend me good programming socks?
i dont know what to look for

just program

noice
i'll read that one day or another
i'm sure

pls no bully

fuck you dumb frogposter i do what i want

Because garbage collection is a pain in the ass

Its great at teaching large abstract concepts like OOP, which most places use and is easy to imagine

Students can then drill down into pointers, memory management etc if they want

Dont get me wrong, I think pointers are very crucial to learn early on. It leads to most people not "getting" that stuff like while, for, etc are in reality also just methods of control flow- they take parameters like everything else.


Its like teaching shop class with changing tires and spark plugs before doing things like brake lines and carburetor cleaning

I'm making a Fortran program that reads some values from the user and saves them into a text file.
The problem is that if I want to save the file into a directory that does not exist, the write command fails to write the file. How should I check if the directory exists and create it if it doesn't?

You need to check if the directory exists, and create it if it doesn't.

On my Carmack impression

Can someone explain this to me ? I am using powershell.

$fullname=$firstname+$lastname
Echo $fullname
The output is :
Jimmy Jones

But...


$fullname=""+$firstname+$lastname
Echo $fullname

The output is :
Jimmy Jones

I find this weird

Ask lots of stupid questions so you can get good answers.

I fucked up

The first example is supposed to show
Jimmy
Jones

To output take 2 lines

You wont.
t. I'm you.

Just say the name of your school already so we know not to recommend it to friends!

Who /type theory/ here? What's some good introductory material to CoC?

You want me to introduce you to my CoC?

Let me worship your gigantic CoC Maki-chan.
B-But yeah please do introduce me. I am quite new to type theory stuff so I feel quite lost.

I'm writing my own parser for the .obj file format in C. My purpose is basic 3D visualization.
I admit I'm having a tough time, specially because I can't decide on a data structure to use.

Fuck you

do you get pi types?

I've been working on a program that uses MPI and I've stumbled on something that has baffled me.
I commented out a printf statement but it still prints, and now the program always prints that statement even now that it's completely deleted.

I've been having a lot of memory errors, but I didn't think that they could actually corrupt my code.
It started after I implemented MPI abort in my program in a brainlet move because I didn't want to synchronize the termination of all the processes. Could that have something to do with it?

The actually printf statement isn't anything big and my program responds to all other changes made to the code and works correctly otherwise, but this is just confusing the hell out of me.

Yes, but how? As far as I know the open command does not have that option.
open (newunit=iUnitNum, file=sFileNameStr, iostat=iFileStat, status='new')

if (iFileStat /= 0) then
print *, 'Error opening file.'
deallocate(sFileName)
else
print *, 'File opened'
end if

What' the issue? Aren't obj. files just collections of three three-tuples and a vector?

How to deal with file validation properly?
I have a program that convert a text file to a intermediate binary file before feed into another program
the second program didn't do any validation because the intermediate file have same specification (it's basically an array dump)
But how to detect whether the write process is completed and the binary file is not corrupted?

I know that I can use some kind of hash to verify the binary but does that mean making another file as hash file?

No, to be honest I have not started on dependent typing yet as I am unsure where to start from and what resources to use. The reason for my interest in CoC is that I heard that it's a simple yet powerful type theory.

>3D visualization
>C
You really hate yourself, huh?
>.obj parser
>3D visualization
This is either retarded or I'm missing a link here

(cont) However I do understand simple things like Curry-Howard as well as things like unification/backward-chaining in first order logic.

>I commented out a printf statement but it still prints, and now the program always prints that statement even now that it's completely deleted.
Have you ruled out stale build artifacts somewhere?
Do it caveman style - re-clone to a different directory, ensure no source-derived files were checked in, rebuild from scratch, ensure your fresh build can't be tainted by older builds, etc.