/dpt/ - Daily Programming Thread

New thread

prior thread:

Attached: 1543212211527.jpg (1280x1264, 103K)

Other urls found in this thread:

github.com/angrave/SystemProgramming/wiki/C-Programming,-Part-1:-Introduction
booksdescr.org/item/index.php?md5=C23382C0455C0709F70A432F867BCF79
pastebin.com/SKjryYYn
twitter.com/SFWRedditImages

javascript sucks

I want to make a PC app for my dad. Using this app, every user can register his cars and the date when he paid hix taxes for each car, and the app will e-mail or notify the user in some way when his documents are about to expire and he would need to repay the taxes. I'm a beginner, first year of college ( we study C in college + I studied Python in my free time, know OOP principles and stuff). Can you guys tell me what I need to learn and use for this kind of project? I don't know what i would need to use to notify the user, and how I would go about storing the data. Also, any general tips about this project would be very welcome. Thanks!

Attached: TSTBaQ7.jpg (1462x2046, 121K)

cursed rustdev akarin edition
rip microsounds

Attached: Untitled5.png (1280x720, 1024K)

I am working on making the assets in my game a separate component, and any other thing that uses an asset will look at a pointer. My word choice is bad so I apologize if I am confusing.

texture_t *assetTextureMake ( uint8_t flag, char *file, int w, int h )
{
texture_t *txr = TextureAvail ();

switch ( flag )
{
// Flag 0 - Load Texture by Image
case 0:
if ( !assetTextureLoad ( txr, file ) )
printf ( "ERROR: Problem loading image to texture!\n" );
break;
// Flag 1 - Create Texture by Size
case 1:
// assetTextureNew ( txr, w, h );
break;
default:
break;
}

return txr;
}

static texture_t *TextureAvail ( void )
{
if ( COUNT_TEXTURES == 0 )
return &A_TEXTURE[0];

texture_t *txr = NULL;

int i;
for ( i=0; i

Anons, I need to cram for my exam tomorrow. What are some materials I can use to quickly learn arrays and strings for C? Youtube videos, books, etc, it doesn't matter to me.

Attached: 1548277908801.png (1000x1500, 1.23M)

Oh and we only go up to 1 and 2D arrays and I'm allowed to have a half page of notes.

I'd love it if the based OS developer could weigh in on the 3D interface discussion. I know he likes a retro look but...

Attached: 1553203572936.jpg (1200x1200, 1.16M)

Both OOP "every game object is an instance of this base class" and ECS "every game object is a row in this database" are dumb. Stop trying to treat every game object equally, and things become much more simple.

Working on my operating system's GUI library. Today I've added a frame class that other widgets can inherit and get access to a couple of nice '90s style shadings.
It's curious how every time I do a little polishing on the user interface stuff, it refills my motivation to work on everything else.

Attached: Screenshot at 2019-03-28 18-24-46.png (1920x1080, 780K)

An intranet application with Python/Django would be an option.

Having a generic game object or entity class to inherit from is helpful
But using a combination of inheritence and components where appropriate is best

No, it's not.

Hi! I do like the retro look (as I was literally just posting about) but the 3D node interface made for that kickstarter failure did have an interesting feel to it for sure. :)
Maybe it could be an interesting way to visualize memory usage, if you could make one node for each object in your program, show links between them, and then have the size of the node be proportional to its allocation size.

the seething brainlet is back I see

Anything that will get the fucking job done. It's up to you to choose the exact technologies. There are plenty of options. Only you know the exact requirements.

Should it be a GUI desktop app? Should it be a web app used via browser? Should it be a command line tool (maybe dad knows his cmd.exe/bash lol).

Stop being a retard, just use one of languages you already know and find an appropriate framework/set of libraries to help implementing your app.

Let's say you want to make a web app with Python. Use fucking Django then, it's as easy as it can get.

BASED

Attached: 1553423746287.jpg (540x389, 49K)

It's /dpt/ etiquette to keep your stupid arguments in the previous thread instead of shitting up the new thread.

What's the proper way of learning programming?
I went through pic related in a week and then started reading K&R but i don't feel like i'm doing it the right way, and the installgentoo wiki has resources but no explicit order for going through them.

Attached: 31LSfDuyzfL._SX334_BO1,204,203,200_.jpg (336x499, 11K)

texture_t *assetTextureMake (uint8_t flag, char *file, int w, int h)
{
texture_t *txr = TextureAvail();

if (!flag) {
if ( !assetTextureLoad ( txr, file ) )
printf ( "ERROR: Problem loading image to texture!\n" );
} else if (flag == 1) {
// assetTextureNew ( txr, w, h );
}
return txr;
}

static texture_t *TextureAvail()
{
if (!COUNT_TEXTURE)
return &A_TEXTURE[0];

texture_t *txr = NULL;

for (int i = 0; i < MAX_TEXTURES; i++) {
if ( !A_TEXTURE[i].image ) {
txr = &A_TEXTURE[i];
break;
}
}

return txr;
}

seriously please help. The book assigned in my class is awful and I can only find pajeet youtubers.

Attached: Ive+tried+a+lot+of+different+alcohol+since+my+parents+_239467f88262669b3a5534283e84283c.jpg (680x578, 48K)

>UNIX directory structure
Why?

Have you tried programming?

I know im newfagging here but what anime is this

Is there an easier tutorial for asp core than the docs?
Theres a bunch of buzzwords here and there i dont understand

github.com/angrave/SystemProgramming/wiki/C-Programming,-Part-1:-Introduction

github.com/angrave/SystemProgramming/wiki/C-Programming,-Part-1:-Introduction

github.com/angrave/SystemProgramming/wiki/C-Programming,-Part-1:-Introduction

>/dpt/ etiquette

it's been so long i've actually forgotten
something hime

>Maybe it could be an interesting way to visualize memory usage, if you could make one node for each object in your program, show links between them, and then have the size of the node be proportional to its allocation size.

That'd be pretty fucking cool. Every pointer could be a link to another node. We'd end up with cool visuals. A linked list would be a linear list of nodes, but an array could be rendered with all elements as a single contiguous block. Picture formats: a small header node pointing at a big ass pixel array node. It'd be a lot easier to understand data structures.

Attached: 1551932803282.png (376x328, 167K)

If I have a giant, constant-size array (say the size of the Oxford dictionary which apparently has 301,100 entries), is looping through the entire thing to print each word O(1)? It will never be updated to add/remove words.

If not, if I wrote a single print statement for each word (all 301,100 of them), wouldn't it be O(301,100)=O(1)?

Attached: 1515531269535.png (207x243, 14K)

yes

probably based on Minix, or even worse, just yet another Linux distro. Something like that, nothing's been written from scratch there, i highly doubt that

i think you're missing the point of big O notation

The "print all words in array" algorithm is O(n). In your case the n just happens to be constant.

Himegoto.

After having to port a non-Java program to several different machines I’m starting to see why Java’s portability is so valuable.

Thanks user. Would you happen to know of more? That guide only has a very tiny section devoted to arrays.

It's a Unix-like system aiming for a high degree of POSIX compatibility. Partly because it's nice to be able to just compile random 3rd party apps, but also because I just like the Unixy feel. Not everyone does, but I do :)

No Minix or Linux involved. It's all from scatch, from bootloader to button drawing.

thanks guys for arguing about ecs. I dont really understand anything cause i am retarded but i am making simple 2d game engine. Simple aabb collision and response. It is already working great actually but i might be add line,circle or corvex shapes in the future so i want it to be organized. Trying to make it something like box2d. I might be even using ecs without knowing it. Simply i have world class to update physics, gravity and aabb box arraylist and method for deleting boxes then i have aabb class that have position and velocity vectors width,height etc. entity class which is abstract class that has sprite, aabb box which going to present moving object and render/update methods. Lastly i have player class which extends entity.

but it would be really nice to have simple code example for java ^_^ so i can understand better.

Attached: 1553708644873.jpg (1153x1200, 233K)

Your project is pretty much the only reason I still browse /dpt/'s.

I don't like global menu bars, but other than that I really like the UI you've created for your system. Reminds me a lot of the things I used to do 15-20 years ago, back when I wrote stuff for Windows 9x/2K/XP. I spent an enormous amount of time aligning controls, hand-tuning everything and ensuring things were pixel-perfect. Makes me feel nostalgic, because you can't really do any of that kind of UI stuff in "modern" systems anymore.

Keep up the good work!

Attached: 1313181346414.png (510x546, 12K)

What language?

it does but I can't stop using it.

Any recommendations for books related to Design Patterns/System architecture?

Attached: 1550958600824.jpg (900x1558, 203K)

I typically have an Entity class which has a Renderable component for drawing shit and a Physics component for physics, and you can extend Player from that Entity
components are good for swapping out behaviours and breaking up your code

Thanks user! I will keep at it :)

The pixel fiddling is a ton of fun. I used to do a lot of Visual Basic as a kid back in the late 90s and I fondly remember trying to ape various little UI quirks from Office 97 and IE4. Just a great time.

Attached: vb5pro-4.png (468x441, 15K)

The JVM can be useful but Java itself is such a clusterfuck that it's easier to just use another language that runs on it.

Bumping this. Please help.

Attached: Hitagi-Senjougahara-monogatari-series-39837626-1920-1080.png (1920x1080, 364K)

java portability isn't as simple as it has been marketed to be. i've had to port a great deal of java applications from windows to linux at work. i've learned that anything that depends on native libraries (ie. about 50% of everything written in java) will need to be screwed with extensively to get it running. the main difference between java and c/c++ is that c/c++ is more likely to actually be tested on the various platforms that it claims to support. java has created a false sense of portability that leads devs to become cocksure and creates massive headaches in practice.

I like the cat file icon.

the ones with the animals drawn on them.
If you get bored you can grab a pencil and copy the cover.

booksdescr.org/item/index.php?md5=C23382C0455C0709F70A432F867BCF79

I'm trying to commit as fast as you but I can only do one or two commits per day. I know algorithms but I'm bad at deciding what to commit, where to break up functions, the wording of comments, naming things...

Speed will come with experience. Don't try to go faster for the sake of going faster. Just focus on getting things right, or close enough to right that you're happy with them for the time being.
Accumulate good habits slowly and you will eventually have fast, good habits. :)

Attached: 1552667081455.jpg (1080x1078, 146K)

Thanks user. It's a semi-accurate drawing of my cat.

Attached: filetype-image.png (32x32, 5K)

it's O(n), one for each item n in the array
direct access is O(1), once for one item

lol, i know that cat.

Attached: come_on_now.jpg (1500x1003, 188K)

Attached: 1548618804569.jpg (610x610, 61K)

Wholesome OS dev

It's O(n) where n = array length in theory, but O(n - (Time saved by clever compiler/hardware tricks)) in reality. Big O notation doesn't generally get along well with profilers. If you really want things to run quickly you'll have to use a good profiler and binutils and practice with assembly.

I’d split it into two functions, one to load from a file, the other to create by image. Also, file should be const so you can specify string literals without warnings, and it makes it clear that the function doesn’t alter file:
texture_t *assetTextureFromFile( const char* filename);
texture_t * assetTextureBySize( int width, int height);

You should also check to make sure txr isn’t null.

please no more

Attached: 1543155430973.jpg (536x534, 73K)

Stop bumping. You can’t cram C effectively. There is A LOT of info on C strings, arrays, and pointers. You are applying the same level of effort to doing a simple google search that you’ve applied to your class. That’s what got you in this position in the first place,

stop

That's just gross, ladies

Attached: 51206-full.png (460x620, 372K)

ok but only because it's the last one I have

Attached: 1531249902733.png (500x684, 292K)

YAMEROO

Attached: 1549425159455.png (538x538, 492K)

I’m always blown away by your progress... and a little more disappointed in myself for wasting time shit posting.

can anyone help?

Attached: 508b3a47f81fb3010778a00594f9c0d09e1c7beb.jpg (600x646, 246K)

Poorly indented code. You got what you deserve.

#rekt

esketit dude

So I just got back from my day job of writing absolutely horrible react code and today I got into an argument with someone at work. I sort of pointed out during the argument that she doesn't do much.

Usually there is the standard engineering department with it's code monkeys, product owners, qa and so - and then the standard departments that keep the company running smoothly which are some variation of devops, then ux design, then office management and the executive assistants, then HR - but then there are the people that don't really fit into any of these categories;

'engineering enablement specialist'
'site culture management'

These people go to every meeting, send weird emails that everyone ignores with recommended reading lists, have really strong opinions about processes that they don't participate in like agile or technical mentoring and seem to be at the front of the room in any townhall style gathering with a million questions.

The fuck Jow Forums? Does anyone know what these people are supposed to do?

Attached: eK7jAlQ.jpg (680x535, 80K)

Thanks user.
And don't worry about it too much. Everyone here wastes a lot of time shitposting, myself included. Just don't let it cut into the time you want to spend on other things and it'll be okay.

Attached: rgUFYiE.jpg (500x332, 16K)

kek it's messy because i keep having to change stuff i got no idea why it doesn't work

i'll tell you what they don't do
post cute pictures of satanichia on /dpt/

Attached: satanichia-mcdowell-kurumizawa-gabriel-dropout-55.3.jpg (210x240, 19K)

>rustdev
Rust is dead, even Steve Crabmeat switched to ADA

They are supposed to earn more than you despite doing less work that directly impacts the bottom line. They do prevent sexism, racism, homophobia, and islamaphobia while empowering individuals that have the correct views.
Out of curiosity, do they ever take the time to actually sit down and talk to the engineers instead of at them? Do they even bother to try to get a rough understanding of the engineers’ work flow? Making workflow recommendations to a team you don’t work with... huh
I guess they could reduce the organization’s liability for some workplace conflicts?

No, it's messy because you didn't bother to make it good.
Why would anyone help you if you don't bother?

Execute a query that will always complete, like
SELECT 2 + 2;
[\code]
Personally, I think your troubleshooting steps are what’s troubled.

okay i'm gonna have to get eclipse setup on my pc, my teacher wouldn't help with the problem because we aren't supposed to be doing databases this year

They are the checkbox employee. They don't do anything. They are there only because someone thought there should be one.

Tried forcing myself to program on electron, fuck's sake. Three hours of programming down the drain right there. Had things working and I don't know what I touched, it all fell apart. Thanks, JS.

They don't have enough visibility of the engineering teams they support to offer any meaningful support at all. The engineering teams have their own channels to remove blockers and maintain velocity.

It doesn't seem that they have an interest in empowering individual teams. Every statement is directed toward the engineering department as a whole.

Sometimes, when business owner (or CEO, or other highly positioned management) wants to improve things but don't have enough business ideas, they hire all kinds of "consultants". And those "consultants" strive to be "important" to the company. To be "important" they have to participate in whatever you are doing — being useful is not that necessary.

I was a professional bullshiter like one of those for a while — but programming paid better, so I left the clueless business owner alone and stopped to respond his calls & emails.

Why doesn't open-source pay? How can we address this?

Attached: Screen Shot 2019-03-28 at 11.59.28-fullpage.png (998x1752, 235K)

open source isn't useful
open source projects that are useful are swimming in money

easy, just stop working on it if nobody pays you for it. if a company won't even pay 10$ a month to keep a developer working on the software they depend on, then that company deserves to eat shit when their stack starts rotting away.

>implying big corp is going to pay on some shitty website

Is OOP a cute?

*cunt

> Why doesn't open-source pay?
It does, but not by the straight "money-into-your-pocket-for-a-code" scheme. Writing free software means you'll get a free publicity, you will be recognized as a developer and may be hired just because of that. If you start a company, making at least some of your tools free means there will be more specialists who know your stack. Don't count on them making all the work for you, though.
And of course, just like with any art, don't write free software because it'll make you money, write it because you want to. It's like a business, money will come later if you can pick them up.

>And of course, just like with any art, don't write free software because it'll make you money, write it because you want to. It's like a business, money will come later if you can pick them up.
imagine actually being _this_ delusional, i can't even
user how old are you?

parroting a meme like this is considered harmful tbqh

>open source projects that are useful are swimming in money
Yes, but it's still disproportional to the SV cancer like Whatsapp, etc. Basically, anything with users, regardless of actual merit or value, is worth much more than actual technology.
For example, Nginx (the company that overseas the project) was acquired for 670 million, which is peanuts compared to what less technical programs and services get sold for.

>work for free because you want to
>programming is like art

Attached: 1427559573124.jpg (300x300, 35K)

Hey /dpt/. Could you rate my code? Would you hire me?

pastebin.com/SKjryYYn

>Writing free software means you'll get a free publicity
Fat fucking chance. Maybe 1 in 10 people who make free software get recognition in the field.

>And of course, just like with any art, don't write free software because it'll make you money
Nigga, who the fuck would ever code here if it didn't make them money? Maybe 1 in 20 people in this thread would actually bother learning more than just the basics you'd get taught in a 101 class.

the post was about open-source not paying, it didn't specify where exactly. i can only assume if the dev is e-begging for 10$ a month on patreon then he's not getting paid elsewhere.

First, what does it do?
>tfw reading foreign code is like reading a foreign language to me

Lol, just do it for exposure bro.

Go ask /gd/ how good that works.