/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Previous thread:

Attached: 1522252203870.jpg (380x380, 14K)

Other urls found in this thread:

ime.unicamp.br/~dias/Intoduction to Statistical Learning.pdf
stackoverflow.com/questions/22865622/atoi-vs-atol-vs-strtol-vs-strtoul-vs-sscanf
twitter.com/NSFWRedditGif

trying to make a curve with a set of points in 3d

Attached: 6d9d119db2b0508c04da1ec30809b7fa19f67e0297f8ac05b534b0db141c3db2.jpg (600x238, 21K)

Creating a image tagger and viewer in c++ wxWidgets

Attached: SnapCrab_ImageTag_2018-8-15_23-47-41_No-00.png (1002x632, 345K)

Anyone here read The Little Schemer?

currently reading the O'Reilly series on Machine Learning with Python. First time doing anything like this and have only just begun but it's just so interesting I can't stop even though I'm a total scrub.

Look this too
ime.unicamp.br/~dias/Intoduction to Statistical Learning.pdf

Usually O'Reilly books avoid theory and begin practical how to do in X.

Didn't know this book. Thanks.

trying to make a videogame in ++ with SDL2. Its an rpg where you dwell deeper into a randomly generated. dungeon map its kind off like darkest dungeon except you are on your own and im planing on having 25+ rooms per level. The problem is i dont have any artwork for the heroes or backgrounds and i am shit at pixel art.

Just spent an hour trying to figure out why I was getting 0 as a result from atoi of a strtok in a parsing function.

There was an l instead of a 1 somewhere in the input file.

Attached: 1451627349723.jpg (258x245, 79K)

>What are you working on, Jow Forums?
exterminating the jews like pic related.

thank you for using an anime image

have you learned your lesson?

if (something)
{
if (something)
{
if (something)
{
if (something)
{

}
}
}
}

is a bit easier to read than typical lisp which would look something like
(if (something)
(if (something)
(if (something)
(if (something)))))

Due to your eyes being able to somewhat quickly discern the vertical symmetry.
Granted parens are shit and it's much easier with indent syntax.
if something
if something
if something
if something

and of course Jow Forums fucks my formatting up.

Don't use meme fonts

This is only a problem because idiomatic Lisp usually bunches up all its closing parens on a single line rather than giving each its own line like block braces typically do in C. It's much easier to count them in this case.

Anyway just use Haskell you don't get nesting problems like this. I don't see why needing parens for every function application is useful, there aren't that many variadic functions or special forms.

>python
>meme learning
shill elsewhere, Raj

Teaching myself C

Spend an hour trying to figure out how to return a String. Good times.

start writing your own engine user

Attached: 2Q==.jpg (200x200, 7K)

working on it.

That was me last week.
Now I'm already feeling like a pro, passing around void pointers to void pointers like it's nothing.

Attached: 1432611331186.jpg (1024x1113, 110K)

dumb frogposter

Use ascii. Wait, that's dwarf fortress.

What's your endgame?

>be me working at a company with a lot of C projects
>shit needs to be C89 compliant, can't find any fucking reason for it in current year
>everything we use has a C99 compliant compiler
>can't even use proper comments
>start working on a codebase consisting of different "modules" written by different people
>3 different booleans defined
>conversion functions between booleans
>check the implementations just in case
>none of them does anything special other than being an implementation of a simple boolean type
>2 of them is the exact same define with different names
>I try to find a repo hosting our own utility library or something, so this can be avoided in the future
>can't find it
>I realize it doesn't exist

Is this the absolute state of C programmers? Are these the people writing software for your car/plane?

A language that is able to interpret 1 and 0 as the respective boolean value, is this good or bad language design?

i played dwarf fortress a little i think it would be kind off fitting for my game.
only i have no clue how to go work with ascii characters do i make like a library and import it?

you mean like Agda?

user you don't understand.
C can compile on EVERYTHING so everyone needs to use it.
We have to keep supporting decade old hardware because reasons!

just use a dedicated bool type mane

Writing netcode for an /agdg/ board game

1/0 implicit bool is shit.

bump

well yes, and don't use strtok and atoi

i think you mean 0 and not 0

I love that guy's voice and his accent.

implicit conversions in general are bad

Pointing out any difficulty when using C will just get you called a noob in daily autism thread. Clearly, having higher barrier to entry due to completely fixable language design deficiencies is a fucking plus to these people.

you don't want to use a language with 0 implicit casts/conversions. You'd be wasting your time writing A LOT of boilerplate.

prove it

You assume there's a conversion going on at all. if sentence can be defined as "takes first branch if expression doesn't evaluate to 0, else second". And bool is simply an alias to integer values. In this case, there's no conversion going on (i.e. weak typing).

Rust has no implicit conversions and it's impossible to use

with what sort of example?
go look at your favorite language's compiler, and see how much shit happens behind the scenes.
anything with lists/ranges would be a nightmare though. Especially in FPs which already do a lot of magic without you realizing.
I see your mind-set, but it's not realistic.

You are wrong. It has type conversions into trait objects and slices.

My favorite language is OCaml.

dont know that language, but in c or c++ you can do if(1) or even if(2)

I ran into a bug in c++ where i had a function that returned a bool, but i meant to use it as an int. For instance, int i = foo(...) returned only 0 and 1, this bug slipped past me and prob wont be the last time.

The function was of type bool instead of int. I'm suprised the compiler said nothing about it.

something like this function:
bool foo(...) { return true }

void blablabla()
{
int i = foo(); //automatic casting but what if it's not intended?
}


im new to c++ so maybe its just something to get used to i dunno

>OCaml
And you hate implicit conversions?
oh boy.

Shill my dick, penisbreath
thanks, friend!

!. Construct the plane
2. Construct bisector
3. Cross of the two bisectors is your middle point
4. Calculate distance from muiddle to one three points
5. embed the circle on the plane back into 3d

Hey Jow Forumsuys, we're trying to build a community around #Jow Forumsdpt where we're sharing our projects and collaborating. We're hanging out on #Jow Forumsdpt on Rizon if you want to chat with us

kill yourself.

"No"

>Shalom! How is life, family circumstances and everything? Ahh that's nice.

nice. what filter do you use for scaling the image?

Working on this

>functional style is more common in Java
>C++ and C# are less functional oriented than Java's streams (aka Java gone bonkers)
>any of those three being functional at all
Imagine being this retarded on the internets

MATLAB

why does the swedish jew dude look like a lesbian

Attached: 1482779320342.png (3340x3176, 205K)

I'm trying to create really simple HUD-style 2D graphics and animations for an android AR app. Would LibGDX be the easiest and quickest way? Can't use unity.

/agdg/ told me i should write my game engine from scratch

i can't program so they told me to go to /dpt/

after lurking /dpt/ for a few threads i gather that i should be writing my game in pure assembly on gentoo or i'm a noob

well clearly i have a long way to go but.... what can i say?. i'm kinda excited

Attached: RICK3b.png (400x579, 335K)

Nice (not) 4 year old meme

>after lurking /dpt/ for a few threads i gather that i should be writing my game in pure assembly on gentoo or i'm a noob

Attached: 1502750749341.jpg (383x472, 41K)

I've made a way to 'zip' together two (or more) class objects in java and produce a new object with properties made up of an amalgam of the input objects.

Right now, I am implementing it into the color setting values of the objects.

Don't listen to them.
The only language you need is python

I put in tags that are filtered on the backend until a user first enters them manually on the frontend.
For instance, if you are looking for food menus, "Asian" is a suggested tag, but not "Chinese" or "Oriental", until you first enter those. At that point, I know you're not offended by those if you're looking for them and they're more specific.
jej

What if I type in "Gooky-Chink food"

If the heuristics work out, so will the search.
Now I just need to implement a standard (racist) ai to parse terms into more specific tags, automatically.

lad i am good with pixel art if you intrested

based Cherno poster

>dad loves functional programming, especially Haskell
>has an admin account on the home computer
>trying to do some javascript for university
>every morning I wake up to type signatures added to my code
>derives Monad, Functor, and Applicative instances of my classes while I'm sleeping
>wake up to comments littered throughout such as "hey champ, in Haskell this is simply 'length . head . group . sort' :)"
How do I get him to stop being an fp bully, I can't stand it anymore!

Attached: 1490462981191.jpg (5000x3606, 2.77M)

void show_bytes(char* values, int len) {
for (int i = 0; i < len; i++) {
printf(" %.2x", values[i]);
};
printf("\n");
}

void show_int(int val) {
show_bytes((char *) &val, sizeof(int));
}

Why does this print the int value? My understanding is that &val gets the address of the int, (char *) &val casts the address to characters so I guess you get the address as a string, and then val[0] I assumed would just print the first character of the address, but it prints the actual int... how?

fug

void show_bytes(char* values, int len) {
for (int i = 0; i < len; i++) {
printf(" %.2x", values[i]);
};
printf("\n");
}

void show_int(int val) {
show_bytes((char *) &val, sizeof(int));
}


Why does this print the int value? My understanding is that &val gets the address of the int, (char *) &val casts the address to characters so I guess you get the address as a string, and then val[0] I assumed would just print the first character of the address, but it prints the actual int... how?

making a little game with libgdx.
feels good.

oh i got it... (char *) &val just converts a pointer to a char pointer, and then we just display the value at that address i guess

I have to read it for a class next year.

How do I deal with having no fucking idea how to even approach a problem if I want to learn and not just copy paste from stack overflow?

Attached: whatev.gif (500x281, 1.93M)

OK, I'm fucking retarded, can someone explain this to me. I'm trying to learn deep learning, specifically CNN:s, but all resources I've found so far are either meme-tier pop-sci, or purely theoretical.

Anyhow, what the fuck is a neuron/unit? I've heard it described both as a function applied element-wise to the input tensor, but also as one of the axis of the input tensor.

As far as I understand it we have an input tensor that passes through a layer. This layer is essentially just another tensor, combined with an activation function, meaning we can transform our input tensor into a different output tensor, using both the layer's tensor, as well as the activation function. Repeat until we reach the output tensor, compare with our loss function and backpropagate.

However, where does the idea of "units/neurons" come in? Images such as pic related makes it seem like we are passing copies of our tensor to multiple copies of the tensor in the hidden layer, but that makes no sense. Pls help.

Attached: 0_0mia7BQKjUAuXeqZ.jpg (791x388, 68K)

Not him, what tools do you use to create the pixel art?

Does the time cost of a single dynamic allocation depend on the size of the newly allocated block?
My guess, based on looking up how sbrk is invoked, is that it doesn't, but I'm not sure.

What do you use instead of atoi?

strtol.

stackoverflow.com/questions/22865622/atoi-vs-atol-vs-strtol-vs-strtoul-vs-sscanf

C doesn't idiomatically use booleans, they should have just returned an int.

Do you understand the concept of a computational graph? If so, a neuron is a node in it.

It depends on your implementation. Perhaps you can write some code to investigate it?

You need to use the flags -Wall -Wextra -pedantic to catch a lot of errors in C and C++. Also, in C++11 you should use
int i {foo()};

for better type safety.

C was a mistake.

what the hecc is this retarded syntax

Idris or Haskell on OpenBSD is okay for game development too. Just don't use toddler babby languages like C/C#/C++.

Attached: Untitled.png (1399x1600, 3.66M)

when do i use
var foo = function() {...}

versus
function foo(params) {...}

SDL supports fonts. You can even map them to textures and accelerate them.

I want my python program to have autologin functionality. I know that saving a cleartext password in a file is not a good idea. Can I encrypt it in any way? I don't want to type that password every time I use the script (it is a password for some site).

It does not have be _that_ secure. Just that other people cannot see the password if they would use my PC.

A neuron is a single node in an artificial neural network.

>Anyhow, what the fuck is a neuron/unit? I've heard it described both as a function applied element-wise to the input tensor, but also as one of the axis of the input tensor.
It's not a function applied element wise to the input, but it can be a function that takes input from every element. There is an associated weight with each node from the previous layer, and a bias.
Each neuron calculates the cross product of it's weights with the corresponding outputs from the previous layer, subtracts the bias from this, and then uses some kind of activation function to turn this value into one it outputs into the next layer.

Depending on how your NN is setup, different neurons can take input from different parts of the input. If the weight for an index is 0, the neuron will not take input from that index.

A neuron is a specific index in a layer, which you describe as "essentially just another tensor". This is a tensor made up of tensors. Simplest case, it will be a matrix, with n neuron rows, and the values in each row vector are the weights for that neuron.

I'm suspicious, this is weird.

I worked at a company where most/all of the code was C89 compliant because it was developed for like 30 different hardware/software platforms (from late 80s stuff to cell phones over the decades)

>literally had to compile a linked library in C89 mode, because C99 broke syntax rules

>proper comments
Our company had single line, multi-line, and single-line multi-line which would be removed when sent to outside the company.

>modules written by different people
Ours was different modules, but no, any person could work on what needed to be worked on (minus experience/knowledge).

>3 different booleans
Maybe one guy had his own booleans? We didn't use them intentionally.

>repo hosting our own utility library
How do you think code is organized and tracked? It's not all github and shit

I'm the same as the first post. This is what I want to do but in 3d, starting with an empty array of vertices. I alredy have an algo to build a cylinder but not the curve. halp pls. Any tips?

Attached: 0026781_aluminium-tube-50mm-dia-90-degree-bend.jpg (800x800, 20K)

>The only language you need is python

Attached: you.png (657x539, 110K)

>bug
You know an int can handle a 0 or a 1, or a zero and not-zero-value. How was that a bug? I would not expect one to every use bit operations on bools except not or and, and either way they'd produce values compatible with bool. Sure, the data size may be expanded (is a bool a char size or int size?) and/or give you slightly performance degradation. If it did an assignment of i back into an array of bools (dear god why) you would get a warning on smaller-data-type stuff.

>js
eww

Second form will let you use the function anywhere inside the scope it's def'd in.
First form will do the same, but only after the function definition. You won't be able to call the func beforehand.

pssh Gentoo.... Real Programmers use Linux From Scratch

The only language you need is lisp.