/dpt/ - Daily Programming Thread

previous thread: What are you working on, Jow Forums?

Attached: 1553823130496.png (850x1200, 1.49M)

Other urls found in this thread:

meta.stackoverflow.com/questions/386487/why-is-stack-overflow-trying-to-start-audio
zdnet.com/article/android-and-ios-devices-impacted-by-new-sensor-calibration-attack/
github.com/rootcoma/sdl2_opengl
factordb.com
github.com/Ganapati/RsaCtfTool
rbt.asia/g/thread/71656421/#71658086
zetcode.com/gui/qt5/
twitter.com/NSFWRedditVideo

Posting in incel thread

Attached: 15CAEE43-75BA-4FB8-ACE5-83A877357AD3.jpg (400x300, 22K)

var or mut for variable/mutable values?

Attached: 1447975059738.gif (540x810, 225K)

compiler error

!const

retard

all variables are mutable

var/const

Thanks, /dpt/

Attached: 4iRHM4V.png (900x1099, 424K)

Depends. If it's more functional, mut, if it's more imperative, var.

yw

Attached: 1531005659727.png (420x247, 53K)

if it's truly functional just dont' use mutation

I found an interesting job offer (junior java developer) that seeks candidates with 'entry level java knowledge'. Memes aside, what should an app use for me to comfortably put it on my github repo for them to be interested in me? Let's say I know nothing about Java. What should I know and use in my app to apply for such a position comfortably? Any specific data structures, libraries, or design patterns?

Something in Java that relates to what you'll be doing.

The only thing bigger than those tiddies is ghc.

Attached: 1562097223426.jpg (540x720, 86K)

Why are so many programmers conspiracy theorists? Is it because high IQ makes you less afraid of taboo ideas?

entry level java means you should still know all of vanilla java
expert knowledge is experience and frameworks

lack of sex

people who believe in conspiracy theories have low IQ

Is it normal to think about your code from work and all the ways it could fail and how to account for such errors when you get back to work

There's crossover with pattern matching and analyzing systems so I could see that being the case.

Attached: 1561844306983.png (700x700, 202K)

Ah, I see.

who /c++/ here?

Attached: 1472583698242.jpg (806x720, 80K)

Why are you incrementing a character friend?

Attached: dec_pdp-11-tan.jpg (800x1000, 96K)

tfw you realize c++ is just c because you haven't incremented it before using it

Me
It's not pretty but it pays the bills

still using it at work, maybe I can start a greenfield project in rust

I'm currently working on a programming language.
It already has basic mathematical/boolean operations, conditionals and a "while" loop.
Now I'm trying to implement variable assignment and definitions, but I never read anything on the subject and not really sure how to handle it.
What I came up with is a "let"-like command that does pic related to replace every instance of a given word (in the same block) with the respective value.
So far it works well when defining simple values, but what about defining functions, am I on the right road or should I change approach?

Attached: replacer.png (1074x195, 12K)

>look through reddit's Jow Forumslearnprogramming/ board
>find some student that has posted their C or C++ console program needing help
>download their code
>correct their code
>make their program graphical using SFML
>don't post code or even mention it to anyone
>have done this twice in the past three weeks

Sometimes when I do this I'm having fun, and other times I just remember that I am a lonely NEET that really isn't all that good at programming. I mean, right now I'm working on some guy's Conway's Game of Life instead of fixing the bug in my simple parser which I actually need for a project I actually want to complete.

Why is it so much easier to work on someone else's project? I suspect it's because I have no emotional attachment to it, but either way: I would like to pair up with a C++ programmer with an open/dirty mind to help me finish a game that a segment of /d/ would love.

Programmers know how much data companies can harvest of you with a little effort. And they also know how easy it is for companies to leak that data and how many nefarious people exist on the internet that will attempt to use it. For example my previous company spent tons of time and money trying to prevent fraudulent credit cards from being used to buy stuff.

Just look at them freak out on SO when an MS ad tries to check the audio API for fingerprinting: meta.stackoverflow.com/questions/386487/why-is-stack-overflow-trying-to-start-audio

There's no way I'm ever turning off my ad blocker.

whats yer github?

do you want to support functions as 'first class citizens' or do it more like functions are done in C? Also you'll probably want some kind of store that maps variables to values, and can be updated by program statements.

>Why is it so much easier to work on someone else's project?
No fear of having to maintain that code in the future. Also it is easier/fun to work on something new than to fix stuff you have worked on in the past.

>I would like to pair up with a C++ programmer with an open/dirty mind to help me finish a game that a segment of /d/ would love

I'm your man as long as there's no cuckshit.

>i'm making a porn game
ultimate cringe

>do you want to support functions as 'first class citizens' or do it more like functions are done in C?
Not sure what you mean, but I wanna treat them the same way as i treat variables (i.e.: to define them the same way)

P.S.: I also noticed that in my language, for whatever reason, every time a mathematical operation should give 0 or 1 as result, it always returns "False" or "True" instead. Wtf?

how can you not know how your own language works

that's pretty much what that means. if you want nested and anonymous functions you'll need to have closures though afaik.
Idk what could be causing the true/false thing, what language are you writing in? can you post the code that handles the math stuff?

Because he's writing his "language" in Python. Look at the code snippet.

0 and 1 in Python are falsy and truthy, depending how you evaluate them they will return False and True

wish i could like programming again

A nice thing I've seen from Jonathan Blow's vaporware language is that anonymous functions are defined similarly to regular functions, just without some of the signature, so refactoring into a regular function just needs to add stuff instead of moving/deleting stuff around. You might want to build anonymous functions like that:

{ ... } // Anonymous code block
[capture] { ... } // Captured code block
(i: int) -> float [capture] { ... } // Anonymous function
f :: (i: int) -> float [capture] { ... } // Named local function
f :: (i: int) -> float [capture] { ... } // Named global function

what the fuck is a captured code block
and is there any reason functions need a distinction between named and unnamed? why cant they all just be treated the same and assigned to variables?

probably to specify which variables in the surrounding scope you want to have available in your function body

why not just let you access all of them
unless this is some wierd syntax for creating a closure Im not sure I see the point

That's exactly what it is.

efficiency reasons probably (idk how much it matters). In C++ you can also specify whether you want to capture a copy or a reference iirc, so you get more control

but that doesn't make sense for static functions or regular code blocks that don't get passed around

>why not just let you access all of them
To avoid footguns while refactoring the code. Specially when you add concurrency/parallelism.

Quit your job!

Attached: ??.jpg (1280x800, 287K)

I thought JBlow was an OOP hating cnile who dissapproved of any access modifiers or encapsulation

Most of this isn't on my github, but if you have a simple console app you don't mind me tinkering with, I'll do it if you provide a code review.

It isn't cuckshit. It's parasite/mutation/corruption stuff. I can post my blurb in a /d/ thread, but honestly I haven't gotten anywhere significant on it. I don't even like to post about the concept in /d/games - I did that exactly twice, and someone sperged out both times.

What I've been trying to do is write the back end in an engine independent manner as much as possible. I know a fair amount of technical bits of C++, but I don't know any frameworks and graphical stuff. The only time I've done things with a full game is HL2 modding.

You'd be wrong. He's a cnile++ and his objection to OOP is for performance reasons ever since he swallowed the DOD-pill. One of the key features of jai is a data oriented approach to OOP.

The idea is that when refactoring a long function it is more efficient to put the code in inside separate blocks, each with it's own scope, than to put it in separate functions and call them from the main function:
function longAssFunction() {
//do something with x
//do something else with y
//do another thing with x and z
}

//normally you would do this
function something(x) { //... }
function somethingElse(y) { //... }
function anotherThing(x, z) { //... }

funtion longAssFunction() {
something(x)
somethingElse(y)
anotherThing(x, z)
}

//Jai lets you do this instead:

function longAssFunction() {
[x] { //do something }
[y] { //do something else }
[x, z] { //do another thing }
}


Which is supposedly more performant and more difficult to mess up on refactoring.

>his objection to OOP is for performance reasons ever since he swallowed the DOD-pill.
what DOD pill is that
inheritance and encapsulation doesn't give you cache misses

zdnet.com/article/android-and-ios-devices-impacted-by-new-sensor-calibration-attack/
not sure why they call this attack but pretty relevant.

Inheritance is shit. In fact, so shit, it is only second to RTTI

not sure how your non-objective feelings are relevant here

Fuck, do I have to shake my phone every time I open a website now?

Not when you have a single encapsulated object, like say, a std::vector. But when you have a simulation with lot's of dynamic dispatch, it can be a problem. For example

struct Game_Object{
virtual void update(){}
};

struct Player: Game_Object{
void update(){/*stuff*/}
};

std::vector objects;
objects.push_back(new Player);
...etc

for(auto o: objects)
o->update();

"Entity Component Systems" are the typical solution, jai has constructs for creating objects that store components in a data oriented way but with an oop interface.

>be SQL dev
>day before 2016 election
>company's database is full of foreign keys
>trump is elected
>DBA says to change all foreign keys to American keys

>factory-set sensor calibration details that any app or website can obtain without special permissions.
have people drafting this shit stopped caring about the OS and just hope nobody notices they don't give a shit anymore?

dynamic dispatch itself doesnt give you cache misses, it does encourage you to store more pointers than you otherwise might but again, that's up to you, it doesn't dictate your memory layout
I know on stream he said he isn't a fan of the ECS system or DOD or whatever you want to call it but I don't know what he favours instead

rip programming socks thread

C++ dynamic dispatch mandates at least one level of indirection.

yeah but the indirection isn't a memory cache miss which is what all the DOD autism is about

literally impossible

Attached: euler003.jpg (897x603, 67K)

:c

>indirection isn't a memory cache miss

Attached: 1487881739407.jpg (473x356, 13K)

it's an instruction cache miss, which is a different thing, and much less expensive

I am late but here is the repo. Thanks for the kind words. github.com/rootcoma/sdl2_opengl

But Mysql is Swedish so its foreign keys are not from shithole countries.

Dynamic Programming

Right, you can use all sort of custom allocators and such in C++ but not without giving up OOP syntax. In jai, for example, you could have this:

Body :: struct{
density: float;
position: float[3];
...etc
}

Player :: struct{
Gen_Index body = custom_body_allocator.new();
use (this: player*)->Body*{
return &custom_body_allocator.get(this->body);
}
}


And then you can have the exact same syntax as if Player had inherited Body
Player player;
player.density = 9;


While also being cache efficient when you only need the Body component of objects.
for body in custom_body_allocator{
/*stuff*/
}

Wow Jai is even worse than sepples

that's horrifying

Nice analysis. I like that view.

No, you need to access the object through a pointer. Whether it's one or two levels of indirection to get to the actual code is implementation dependent (whether the vtable is stored per object or per class).

I JUST WANT THE FUCKING VEC3 STOP FUCKING WITH ME.

you dont need to access the object through a pointer, you might need to access the vtable through a pointer though

That's not such a big number user you could probably factor it pretty quick. People have factored up to what, like 1024 bit RSA keys?

Reminder that SoA is for SIMD, not cache. CPUs can already prefetch accesses that are non-contiguous but strided (as is the case with AoS).

To be precise, it's one or two data misses and one instruction miss (worst case). If you aren't accessing the object through a pointer or reference, its class is known statically and so there's no dynamic dispatch (or even necessarily an instruction miss since the method could be inlined).

if you're not accessing it through a pointer (or reference) you're not doing dynamic dispatch

I ran into that weird sepples thing with template aliases again. In certain cases GCC & Clang treat fully-instantiated template aliases to more complex templates as different types than the fully-instantiated complex template. I've researched it a bit and it's due to an ambiguity in the standard. Unfortunately as you can see the 'certain situations' differ slightly between the two compilers.

Attached: Screen Shot 2019-07-04 at 4.40.24 PM copy.png (1278x1628, 393K)

Not sure how often you are searching for primes but this site is nice factordb.com
Not sure if anyone is interested in attacks on RSA keys, including you user. But there are some cool attacks like the wiener attack. This module has a large amount of RSA attacks. github.com/Ganapati/RsaCtfTool

… and this is the solution.

Attached: Screen Shot 2019-07-04 at 4.45.43 PM.png (1162x518, 110K)

bruh what

I can't help you with c++ standard intricacies, but you just look at tits and vagine all day? How does that affect you? I guess its like having posters of babes up on the wall.

>solution
Oh, nice work, user! heca cool!

>vagine
I just realized I made a very large assumption here

Sorry, I haven't figured out a minimal reproducible example yet.

>I guess its like having posters of babes up on the wall.
Yeah kinda like that I guess. Also it's not all day, I do have a job (where obviously that's not my terminal wallpaper). And don't worry you were correct.

What's her name?

Attached: 1562168583001.jpg (640x480, 43K)

does C++ not allow you to call methods on non-pointers?

if you do, it's not dynamic dispatch because the only way you can use a variable by value is if its type is statically known

>want to create gooey application
>download Qt
>install size >4 GB
Any decent alternatives?

Attached: 1541969483732.png (1024x1106, 882K)

no

WPF?

this. just add a reference to System.Xaml.dll(Windows 7+) using csc and write code using notepad.

rbt.asia/g/thread/71656421/#71658086
I dug this up an now realize it will probably be completely disregarded.
>
>Nah, but you do have to use qmake
>zetcode.com/gui/qt5/
>Here’s an excellent tutorial that’ll take you from the top, sans qtcreator

Use XCB and make your own gui widgets. Or use Win32

tk, imgui, ncurses

Attached: rip.png (820x1172, 24K)

>imgui
Never looked into that before. Looks really neat.