/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Last thread:

Attached: 1517383775966.png (853x480, 187K)

Other urls found in this thread:

crowdforge.io/
github.com/adnanaziz/EPIJudge
github.com/byxor/NeverScript
twitter.com/SFWRedditVideos

If you wanna be popular on github, just pretend to be a girl

Just be yourself

>tfw no misaki chan to save me and read sicp with me
why live

Do you Double Compile for more performance, user?

Attached: 1557519071450.png (1690x1847, 2.18M)

only when i'm battle programming

Is "Cracking the Coding Interview" still a good book or is it obsolete, now that we have Leetcode?

if you are lonely, visit crowdforge.io/

With Leetcode you will be cracking the code interview.

Python is stupid. No one can tell me to indent my code. Fuck Python.

Attached: 1554607189969.jpg (311x362, 30K)

indent your code dumb frogposter

python is stupid because looking for the absence of something is harder than looking for something
even begin/end is better than whitespace

Attached: fioc.png (800x400, 101K)

Attached: [A-Flux] Battle Programmer Shirase - 03 [854E2175]-[06.18.461-07.15.852].webm (640x480, 2.65M)

>self
>self
>self
>self
>self
I like python and I hate this shit

I have alot of downtime on work and would like to do something useful with it. Figured learning programming would be cool. Anyway to learn code using only your phone? Can't bring a laptop. I have taken some courses in C and C++ but only know basic shit. Where is a good place to start?

Attached: 1555635068570.gif (652x562, 626K)

don't forget to use const

Attached: CppCon 2016 - Jason Turner “Rich Code for Tiny Computers - A Simple Commodore 64 Game in C++17”- (1280x720, 1.93M)

The python code is wrong tho. The int(num - 2) should be a num_int. They never use num_int anywhere else in the function anyways. If this were a statically typed language, you sould get a type error and potentially a warning for dead code.

could shirase hack lain?

CTCI it’s 100 pages of bullshit, 100 pages of leetcode problems and 500 pages of copy-pasted solutions that you can easily see on Github. IMO “Elements of Programming Interviews” It’s better.

Attached: book.jpg (333x499, 29K)

Why does this guy have such a faggot vibe?

in class I would bring a book and pencil and paper, and do the code exercises that way,

actually I didn't have the book I pirated it and printed out pages of it and put them in my backpack but either way

because you think he's cute

Thx will check it out.

Just get a small laptop or something.

It also includes test cases to check your answers. github.com/adnanaziz/EPIJudge

Because you're sexually attracted to him and should go back to tumblr.

Wtf? I am not "sexually attracted to him", that's ridicolous!

because he has more hair on his chin than his head

damn you BPS!

Attached: 1555489068073.jpg (853x480, 286K)

github.com/byxor/NeverScript
How do I run this? I ran go get and go install but typing "ns" into the shell does nothing

Go Go, user! You can finish that JavaScript project!

Attached: d8108e71efb04eaf974f2e3cc9c22359.jpg (1101x2048, 352K)

emacs doesn't have this problem

True, vim is for the niggest of nogs.

All my 4 years of college has boiled down to this: a shitty hacked together python program for sorting pictures of my waifu

Attached: wip.png (799x979, 246K)

I remember doing shit like that with visual basic when I was a kid. Imagine needing an education for that.

>a shitty hacked together python program for sorting pictures of my waifu
So it was worth it then

What happens if you press the wrong button by accident? Do you have to start all over from the beginning?

>he went to college to learn python
Ha, what a fag.

This, just Kode with Karlie

just find out a portable way to embed binary resources like image and font in my c program
since i want elf binaries to be completely self-contained with no file or library dependencies other than c runtime
also fixed a stupid bug in calculation of drawing wrapped text

Attached: fv.png (1174x837, 1.33M)

>90% of the instructions disappear

explain. what's the deal with const/constexpr ?

compiletime evaluation
top level const insists a variable won't mutate for the duration of the program so you can just elide all the loads and stores and substitute the values wherever you need them
at that point you can constant fold away huge swathes of code

Help me out guys what do I do for my capstone.

?

Final year uni project.

Trying to figure out a cuntingly tedious problem from a random exercise in the book I'm working through.

Making a 'book' class with normal shit, ISBN, title, author and so on. But it specifically says to validate the ISBN. It's supposed to be n-n-n-x where n is an integer and x is either a digit or a letter. The problem says specifically to store the ISBN as a string.

So how the fuck do I validate this? C++ btw. I split the string on the '-' delimiter, so I have 4 strings, and I can use std::stoi to get the integers (though I'm not entirely clear how to check, right now I'm just doing if int n1=std::stoi(isbn[0]) etc. But how do I convert the last string to a single char? I know there's the std::isalnum to check if a character is alphanumeric.

Also why the fuck is this so tedious. All the solutions I've seen online just use a struct for the ISBN but that's not what the problem said to do.

Counter Strike game-like where the map is map of your school

I have some TypeScript question for you.

type A = { a: number };
type B = { b: number };
type AorB = A | B;

const ab: AorB = { a: 10, b: 20 }; // TypeScript finds this assignment legit
console.log(ab.a); // But doesn't allow this call


The question is, why does TypeScript allow the assignment in the first place?
Is there ANYTHING you can do with such "ab" object?

think of it this way, if A and B are both true, then A || B is true. it's basically the same situation. I don't know TS but I assume you would need some way to disambiguate, which I doubt | offers. So it might well be a useless use case.

or to put it in another way, you need something that works on A, and that also works on B, that thing should work on A|B, but in this case there is probably no such thing (since it can't rely on there being an a number field or a b number field, it's basically like it had been an empty record i guess (the lowest common denominator)).

Isn't this guy from here? Tell us more about your project user

Attached: screenshot-d727005.png (1280x720, 531K)

he posts updates pretty much every day

this works
console.log((ab as any).a);

yes because you've subverted the type system (which is useful sometimes)

>mfw learning about R
This language is amazing. I've been thinking it'd be amazing if a programming language did a lot of this stuff before.

eh?
return is_int(word[0]) && is_int(word[1]) && is_int(word[2]) && is_char(word[3]);

Looking for suggestions for an ubuntu toolchain for AI experimenting.

just declare the variable as any.

>If we have a value that has a union type, we can only access members that are common to all types in the union.
So AorB = {}. The assignment is allowed because TypeScript has structural subtyping.

return is_int(word[0])
&& is_int(word[1])
&& is_int(word[2])
&& is_char(word[3]);

wtf why is it so hard to find this info when it's that simple?

think outside the box

you might want to look at repl apps for coding on the go or setup your own server and use it as a programming environment

think within the penis

what do you guys think of erlang/elixir? considering building an AI system in it

Although I still have the issue that I need to check if the last string is an alphanumeric char, but the isalnum function only works on chars not strings.

Imagine being this much of a brainlet. Is this the new candidate filter question?

I'm not working on a Javascript project! But that's anyway.
Also cute belly!

Excuse me?

I'm have question for you, how do I find collection of data for sesimic w eather and also meme collection. I want make GAN to make rare pepe and use other data for other project

Well the book I'm using hasn't really brought up any way to do that sort of thing. If it were coming through cin I could do it, but googling after istreams I couldn't really find a good way to do it with a pre-existing string.

*nods disrespectfully towards you*

Quit your job
Make video games

Attached: xna tattoo.jpg (360x480, 39K)

Got it, ty.

Hi user, yeah I'm from here :) What do you wanna know

Attached: cat2009.jpg (445x414, 36K)

he doesn't even need a brendan fraser edit

Just got shot down by my favorite lisp programmer, how are you guys doing?

Why, did you queef?

>how do I convert the last string to a single char?
C strings are character arrays, C++ std::string behaves as a character array.
char my_C_str[] = “It’ll be ok.”;
std::string my_str( my_C_str );
my_C_str[0] == my_str[0]; // true

Instead of the way you are approaching this, I would use the function isdigit() for the first three characters and isalnum() for the next.
It’s really not that tedious, user.

His coital sojourn was brief;
He came, and withdrew like a thief.
As his trouser snake left,
Though, there belched from her cleft
A most satisfactory queef.

>getting a tattoo of a dead game engine

This

Seismic weather?
Not sure what you're talking about but Japan has probably the best network for seismic monitoring anywhere in the world and has records of earthquakes and tsunamis going back literally centuries, also in the US there was a big project to make a grid of seismic monitors of some sort across the entire country (though obv far more widely spaced). Being a gov. thing you can probably find the data somewhere but I don't remember the name.

Working on a Malbolge interpreter

Attached: 1536525604778.png (674x252, 22K)

>job

That's actually my problem, for some reason I was thinking I couldn't just iterate through the characters of a std::string. If I can do that I don't need any of this splitting or tedious shit.

Rate my tattoo :)

Attached: tyashohqhqlkgzn9tvv9.jpg (680x457, 22K)

>ligatures
fuck off

wtf is a Xitpoint

I used to have a cute black girl avatar and got not support
Changed it to a white girl and got tons of replies and contributions
Programmers be racist

>cute black girl
so which was it? make up your mind

no u

Attached: 1531543059404.jpg (280x253, 14K)

fuck off GTP

You can do it!
Also, phone-posting ruins line breaks.


>Sent from my iPhone

Saw your project in Lobste.rs. I also like the bloodied knife for kill, lol.

I might try to contribute a bit once I have more time, I might try to port something like libtorrent or webkit to it.

Nice :) Yeah it got posted in a couple places yesterday and I got overrun with visitors.

You're very welcome to contribute! I like to think that the codebase is in pretty approachable shape. Let me know if you ever get into it.

>Hurr if u no liek sheboon u is raycis

Attached: 1558639205727.jpg (868x1200, 150K)

I've decided to be retarded today and initialize some structs by iterating over those structs and another struct. in 2 loops. Can't find a way around this for my algo and i'm not here to change it.
typedef struct {
int n;
char* str;
} A;

typedef struct {
A a;
int m1;
int m2;
bool flag;
} B;

A a1 = {...};
...
A a10 = {...};

B b1;
...
B b10;

A arr[10] = {a1..a10);
B brr[10] = {b1..b10};
for ... {
brr[i] = { arr[i], y, z, true/false };
}

How do i make an array of structs A and B?

i need to git gud at math

(´・ω・`)

Attached: 1558654841656.jpg (1200x800, 178K)