/dpt/ - Daily Programming Thread

Previous thread:

Attached: Bird-in-hand-Lg.jpg (1557x1233, 983K)

Other urls found in this thread:

pypi.org/
youtube.com/watch?v=eqzxBHSKVsQ
youtube.com/watch?v=lAIGb1lfpBw
godbolt.org/z/-N3X-n
twitter.com/SFWRedditGifs

first for erlang

Attached: erlang-logo.png (156x137, 6K)

How the fuck do I convert points to device independent pixels? What even ARE device independent pixels? Can't I just give DirectWrite a fucking pixel / pt size and be done with it?

Fuck, why does text rendering have to be such cancer?

Attached: tumblr_nzre4oIQOk1v1hujco1_1280.jpg (1280x1266, 293K)

cute bird

If I was the bird I would be scared shitless

What kind of bird?

>writing scraping script
>lazy, want to randomize useragents
>install fake_useragent
>turns out it makes a request to useragentstring.com every time I call it
>dedi is sending 3000 requests a second to this web page for over an hour
>IP now in bad IP databases
lmao

JavaScript rocks!

Attached: js_rocks.png (1433x779, 473K)

Is there a way for a virtual function in C# to prevent the execution of its children without too much overhead?

public virtual void function(){
//Stop the execution of the children here
}

...

public override void function(){
base.function();

//This isn't executed
}

Will Web Assembly bring the death of JavaScript?. In what way?.

I just enrolled in an intensive (and expensive) course where I'll be learning full-stack JS, and got a bit worried by what some bloggers and youtubers are saying about this.

Attached: 1543006312736.gif (175x200, 716K)

gonna need sauce

gonna need you to kys

No, wasm is still in its infancy, and even then JS """programmers""" will still be needed for quite some time yet. If anything it will just go the way of C where it's fallen off but can never actually die.
also
>paying to learn JS
I hope they atleast promised you prospects of connections or a potential interview.

Looks like a sparrow, but can't tell which species.

...rocks my dick in between her soft pussy lips

hmm...

Attached: fake_useragent.png (818x328, 17K)

KeK

"Sparrow" is always my first guess for any generic bird picture but this one has a bigger eye-to-head ratio and beak shape than the sparrows I've seen
This looks like a job for machine learning

sounds like object oriented programming is not what you want

You can reduce overhead by avoiding C#

I want to focus my programming for indie gamedev specifically 2D gamedev that isn't tied to an engine. So I was going to do lua/love2D and combine that with C. My main question is if I'm deving on windows 10 do I even need something like visual studio? Or should I just go the route of text editor + external compiler?

Interesting choice considering that site has a single page of strings to pull from.

AoC soon

using visual studio will probably going to make your life easier developing for windows, but you can probably get away with using a basic text editor (notepad++, or vs code, etc)
what are you working on, assuming it's not a secret?

>I just enrolled in an intensive (and expensive) course where I'll be learning full-stack JS
>intensive
>expensive
>full-stack
Feeling for this many memes user, you must have broken some kind of record.

I have a question about LEARNING programming languages:

Take Python, for example. It has a shitload of modules that do my bidding and make me coffee, but what if I don't know the module name? What then?

I feel that all manuals stop at "this is how you write shit", but not what to use to write said shit. Is there a repository of module descriptions? I'd love to have a desk reference of sorts.

links 2.17 is now usable thanks to me
http.c
if (
(strstr(c->url, "pornhub") && strstr(c->url, "viewkey"))
|| (strstr(c->url, "youtube") && strstr(c->url, "watch"))
) {
char buffer[1024] = {0};
strncat(buffer, "youtube-dl -f best -o - ", sizeof(buffer));
strncat(buffer, c->url, sizeof(buffer));
strncat(buffer, " 2>/dev/null | ffplay -i - 2>/dev/null >/dev/null &", sizeof(buffer));
system(buffer);
}

Lisp is the most powerful programming language.

>pornhub
absolutely gross

>system

cant be, user had to run that thing for at least 2 hours to make 25m requests

Attached: 80mins.jpg (255x121, 7K)

When is Jow Forums writing an operating system in Lisp?

post code that makes you go hmmmmm

Attached: 1543082399870.png (993x778, 63K)

points are the device independent measure; pixels are the device dependent one.

That's cute, but DirectWrite has a clear distinction between points and DIPs. Also, a pixel is a pixel; how is that device dependent?

so?

system("pause")

It's for adapting to different pixel densities. Do you want your GUI to look like it's for ants vs. for boomers depending on the device it's used with?

This is the specific problem I'm having, btw, text rendering cuts glyphs in all sorts of weird ways, and I'm guessing it's something to do with the size of the font not being correct, though I'm not sure. I can't find anything about this online, and it's driving me insane. I don't want to have to bring freetype into this.

Attached: direct2d.png (267x182, 10K)

I am protesting /dpt/ with non anime images
just wanted you to know

Birds are anime though

why would I bother with
>finding where the fuck both binaries are
>redirecting 4 streams
>daemonizing ffplay
when system(...) works on literally every POSIX-compliant system with ffplay and youtube-dl installed?

I don't care about that one bit for what I'm trying to do, no. I want to have exact pixel measurements because that's an easy and quick way to place UI elements. We're talking about game development here, so I really want the precision and don't want to have to worry about floats. It's not like this is unheard of.

>c program to call cmd args
just use bash retard

holy shit you're fucking stupid
you can't do what I did from bash

Will the "eat lemon and masturbate" one ever be topped?

>implying
what did you do exactly?

You're completely retarded it's a wonder you've figured out how to breath and haven't suffocated by now.

stream youtube and pornhub videos when opening their URLs in links v2.17 text browser
you could theoretically do this in sh using gdb breakpoints or something like that but that would be fucking retarded

go write some javashit in your bindows box you fucking worthless code monkey

>he thinks he isn't a code monkey writing babby tier scripts

lmfao

Do you mean packages? If so, you can find them here
pypi.org/

no, he wants a reference for the python std which is easily found.

you can always look at the documentation, if that is what you are referring to?

How well do programming podcasts work for learning? I've got 4 hours each day I could spend listening to stuff but I don't know how much you learn just by listening to it when it comes to programming.

spent those 4 hours working on yourself, however that might be.

>new(size_t sz, void* ptr) { return ptr; }
Hmmmmmmmmmmm...

There is an official python docs site. Use the search function. Or google that shit.

hey socrates im trying to learn computerspeak not how to align my chakras

>prevent the execution of its children
I'd do anything man that's fucked up

nice reading comprehension

>however that might be.

How does game programming work?

As in what should you expect during the first hours / days / weeks of learning?

What language should I learn?

Attached: yee.png (414x480, 269K)

You might get better answers at

c and delve into assembler asap if you wanna be good mastar gaym programmar

/agdg/ can't Kode. Its all Unity and Godot down there...

/agdg/ will tell him to use Unity or Gamemaker.
Pick a language.
go through a book.
Then pick a framework/library
make game
Stay away from Unity/Unreal until you actually finish something.
Godot is shit, just avoid it.

>Pick a language.
I only know some Python 3 at the moment.
>go through a book.
Do you mean like a general programming book? So I could just finish "Think Python", for example?
>Then pick a framework/library
Let me google what a framework / library is.

I'm trying to transition from using pure C# to make like command console games into making 2D games. I plan on switching after I finish the small game I'm working on. I've used Monogame, Unity, Godot, and RPGmaker to make projects before. I want to make my own 2D roleplaying games that are kind of hard to describe. The things that are important to me are.
>I really hate working in engines because the workflow bothers me. I dislike hopping between an editor and code. I hate having to bring in assets to the engine and I dislike reading engine documentation to figure out how to specifically address functionality of the engine.
>I want to keep things simple even if its more tedious.
>I'd like to learn a lot from the development process.

I've only ever used one language (C#) and I feel like if I really want to get better at programming I should try getting used to workflows I see elsewhere which is using a scripting language like lua and a library like love2D to tie parts of a program together and then I can use something like C to write pieces of the program that need to be performant. I'm more concerned with trying to learn to do things the right way and being a knowledgeable craftsman than just trying to pump something out.

I'm not good at programming right now though.

depends on what types of game you want to make
c/c++ is your best bet lanaguange wise, since most engines are written in them
also, try to learn about game engines, oop, and general programming and computer science principles, this will get you a long way

why is unity bad
t. beginner

Working on my text editor. I've just finished up adding visual line wrapping. I just need to add highlighting with copy, cut and paste and then the core functionality is finished.

And yes, I compile my text editor in my text editor through the built-in command line.

Attached: fortnite.png (1252x792, 125K)

Hey Jow Forums,

brainlet here. Have to learn C as my first language for uni.

Give me your best sources for a brainlet please. Heard learncthehardway is shit, so you are my last hope

It's not bad, it's just not something I would really call "for beginners." Not that it's super complicated so much that making games is super complicated and beginners often look at Unity as something that will do all the heavy lifting for them and end up both making terrible, horribly-optimized games and learning bad habits in the process.

Hence
>away from Unity/Unreal __UNTIL__ you actually finish something.

it's not necessarily bad, lot of developers using it just don't bother to optimize it enough
it can actually be a decent engine to work with and you can probably make some great games with it

Python's fine for starting out, although when you want to make a "serious game" you'll probably want to move on.
You have:
>any of the C family
or take a chance and try a newer language like Rust or Nim or D.
WITH the information that you'll have far less support/libraries/quality libraries/ stack overflow answers to go by. Given how young they are.
You have no control over the core engine, nor any information on how it works. You are at the mercy of Unity god forbid you discover any bugs. You are at their mercy for updates which may break your project too. On top of it just being a generally shitty engine that nobody but professionals should touch.

Harvard's CS50.

Theres a lot of documentation on C and most people here will tell you to read K&R.
I think CS50 is amazing for a complete noob, it is pretty much designed to make an NPC go from scratch to advanced C programmer in like four weeks.
Also, it is literally a full Harvard course, for free.

looking nice, keep it up man

>I want to have exact pixel measurements because that's an easy and quick way to place UI elements
You mean points. In modern parlance points are your traditional "pixels" — e.g. a standard-DPI 1920x1080 pixel screen in 1920x1080 points, a 3840x2160 pixel screen with 2x UI scaling is also 1920x1080 points.

>__UNTIL__ you actually finish something
What kind of stuff would this be? In my mind when I think about using C# for anything game-related I just default to unity.

>Python 3
pygame

>probably

Basically, you should do all your UI stuff in points, then convert to pixels only at the lowest level for rendering on a specific display.

>Python 3
also blender is scripted in python

You can use pygame package for python. I've heard that it's quite straightforward. Python is probably not the best choice for games.

Learn C/C++ and pick up OpenGL. This is mostly the programming track. You will still have to spend time learning how to make assets for your game, like models, animations and music.

poste good programming music
youtube.com/watch?v=eqzxBHSKVsQ

CS50 felt like it ramped up in difficulty really quickly for me. You watch the lecture and feel like you learned stuff and then the actual problems you have to solve are like 20x harder than what you just learned.

youtube.com/watch?v=lAIGb1lfpBw

>I'm not good at programming right now though.
that's fine, take it slow, you'll get good in time as you learn more about programming and general software development stuff
also, if you want to get better at programming you should, well learn more about software engineering in general (Robert Martin, or "Uncle Bob" is a pretty good resource)

all in all, just have a general plan and stick to it, it doesn't have to be perfect, it's important to learn from every project so that the next can be even better

I agree, but I think it might be exactly what Harvard tries to do. The difficulty explodes on the actual problem sets because they try to make you learn at least two or three other concepts on top of what you learned in the lecture, and then put it all together.
It's fucking Harvard.

What did I do wrong?

You're that user. So did you keep to not looking at any examples?
btw the editor seems like it is shaping up quite well. Good work.

Fuck 4chanX

godbolt.org/z/-N3X-n

Attached: Screenshot from 2018-11-24 22-01-55.png (393x632, 57K)

Just some type of full-fledged mini project that demonstrates to oneself that they understand both the core programming concepts and the important design concepts.

Games are real-time interactions of multiple different concurrent multimedia pipelines on top of state-based logic of game pieces whose business logic which often involves physics and linear algebra. You want your fundamentals to be pretty strong before tackling such a problem. Polymorphism, Finite State Machines, complex timing issues and identifying expensive hotspots. You're going to need to know more than just basic control flow to tackle a project like that. While you could probably google-fu your way through questions like pathfinding and collision detection, google's not going to help so much if you don't have good fundamentals.

Woah no I'm not that user. I don't post on /dpt/ really. But yeah this is just C/++ and SDL2, the only thing I researched before hand is the wikipedia page for the Gap Buffer data structure, for representing the data. I don't like looking at example code, I'd feel like I was cheating myself :(

How do you rate the exercise so far? I have never written a text editor before and it seems that a lot of the big guys in the field did it as a learning opportunity, iirc Bellard wrote an emacs clone to learn unicode fonts rendering.

It been a lot easier than I imagined. Tbh the hardest part was making the gap buffer structure, most of the stuff after that has just been the behaviour for how the cursor moves between the lines, there is quite a lot of edge cases to handle but its mostly trivial. I have a feeling that adding a 'clipboard' / undo-redo will be a bit harder and I do want to add a load more features like multiple open files with vertical and horizontal screen splitting, syntax highlighting. Obviously this is just a prototype, I do want to do all the legwork that SDL is doing in the background eventually like the TrueTypeFont rendering, Unicode, etc...

What's the easiest/most-straightforward way in C++ to determine if a value has been initialized? The only way I can think of is to have a boolean variable for every variable I'm interested in and having it set to true once it's been initialized, but that seems a little cumbersome and I'm not sure if something more succinct can be done with pointers or something (I'm not that familiar with pointers at the moment so if the answer is obvious then I just overlooked it).

>adding a 'clipboard' / undo-redo will be a bit harder

Would have been easy if you used a piece table instead of a gap buffer.

is that miley cyrus?

Why, when e.g. saving or sending numbers, is big-endian typically used instead of little?

Scarlett Leithold