/dpt/ - Daily Programming Thread

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

Attached: 1564725458401.png (1920x1386, 1.54M)

Other urls found in this thread:

lmgtfy.com/?q=google.com
composingprograms.com/
en.wikipedia.org/wiki/Spatial_database
en.wikipedia.org/wiki/Space_partitioning
onlinegdb.com/SyBtOZ7Qr
twitter.com/SFWRedditImages

I want to die

Die.

I'm chicken

Okay Jow Forums, write for me a ray intersection between a ray and a sphere, algebraic solutions only

Attached: RTfigure7.jpg (287x164, 10K)

is there anyway to go to top of console in python?

What do you mean?

so if i have a lot of output to console so where it automatically scrolls down. is there anyway i can call something that makes it start from top?

>To be or not to be

Attached: IMG_20190803_092410.jpg (780x785, 127K)

any good books, tutorial for python?

lmgtfy.com/?q=google.com

i don't trust articles
i want something that Jow Forums recommends

automate the boring stuff

putting the finishing touches on some coq projects

Is there a minimum cryptocurrency rep somewhere? The current btc core is too bloated to use as a learning example. I know the theory behind it but I want to see it in practice

The curses module gives you control over that

automate the boring stuff with python

I liked "Learn Python the hard way" desu

>i don't trust articles
then you're retarded

I fucking hate that book/site. He teaches a lot of bad practises as well.

Ive heard that before every time I post it, well someone not liking it in general. That's what the desu was for ymmv

incredibly good OP

Attached: 1535150758245.png (696x984, 958K)

Isn't that example #1 in that one book

Attached: Screenshot from 2019-07-23 22-28-45.png (994x756, 114K)

probably the most hated author of all times

What's the best data structure to use for a bunch of 2d rectangles that can stack on top of each other? Basically, to work exactly like a desktop interface would work.
A "good" data structure would help me render them more efficiently and perform range/point searches on them.

composingprograms.com/

Where do you go if you want to learn how to do x thing in Java, or I want x concept explained?

en.wikipedia.org/wiki/Spatial_database

India

|
|\
|--'
|
|o
|
|

en.wikipedia.org/wiki/Space_partitioning

wat??

>implying concept of "good practices" is applicable to python

A tasteful gentleman, I see.

Attached: __flandre_scarlet_and_remilia_scarlet_touhou_drawn_by_gotoh510__bacbb155935feaf2e47184c312d266d3.jpg (1047x1117, 158K)

Welcome, Anone~ Would you like to get on with the JavaScript lesson?

Attached: 1564660633514.jpg (1500x1000, 180K)

おかえりなさい

don't rush it

I would like to get on with something else first perhaps...

Lisp is the most powerful programming language.

Ada is the most beautiful programming language.

For me, it's Malbolge.

This is a programming thread, what else would you do here other than programming and programming related discussions?

Got a Python junior dev interview on Wednesday

Attached: ice-cream-parrot.gif (35x25, 4K)

Are there any programming languages that don't shit themselves when you try do this?
if -4

because I am getting real tired of writing this
if -4

No, because there is no good reason to add such a glaring inconsistency into a language for such a trivial purpose.
A binary operator is just a binary operator.

Hang on in there, user, and stay comfy.

For assembly, 6502 is comfy.

Attached: Comfy.png (891x605, 355K)

Anything not cisc is comfy desu

just change -4 to -5 and

In most dialects of Lisp you can simply do
(if (< -4 x 3)
(print "x is greater than -4 and less than 3"))

refer to

based fucking lisp
based retard

Can someone explain why they added this monstrosity in Python?

Attached: walrus.png (400x400, 2K)

just imagine what's happening underneath

Python is a horribly designed language which made the fatal mistake of distinguishing statements and expressions, and was completely built around the idea. Except they discovered the opposite was more useful and had to hack assignment expressions back in.

What if we had a programming language that allowed for one statement per line and any other statements on that line are implied to be executed in parallel by the other cores or threads without any manual configuration?

ie:
int x = 5;
int y = x + 5; int z = x + 10; //These two statements are done at the same time
//can make use of either past that line

sounds pointless, just use a concurrency library

Because Python is a disgusting language that only realized that assigment is an expression just recently, while normal languages have been doing that since htey existed

That requires pointless configuration and limited to the API design. We shouldn't have to be restricted like this in 2019. Parallelism should be natural and built in without any effort. I shouldn't have to dig through open source libraries just to get a half assed job.

Whats that mean?

The overhead would far outweigh the benefits most of the time.

>i have 48 cores
>gotta write 48 statements on one line to use them all simultaneously

I read the quick introduction to racket, and it was really fun, but i dont really want to do the web-services follow up.
What are some other good resources for learning racket?

Attached: 1482892800302-2.jpg (2048x1152, 324K)

better than not using them at all like we do now.

This is the programming thread, you stupid fuck.
Piss off.

just use erlang fag

I want to nakadashi Remilia

This C++ code generates assembler output IDENTICAL to the C version.
Note: not using std::iostream because it adds bloat.

Attached: godboltscreenshot1.png (1366x768, 182K)

is this any surprise

>what if we made multicore code sync every
other statement

Omai wa mu shinderu

Sounds like a shittier version of green arrays. Or TIS-100

What?? RISC is bloat, and RISC-V is so orthodox it doesn't even have autoincrement or -decrement for pointers. So you could try to repair that behind the scenes with indtruction fusing but that is just a bodge and a patch over wilfully bad design.

Of course x86 is hideous but not representative for CISC. I did some assembly programming for embedded platforms, and x86 was so revolting I needed a shower afterwards. 68k is much, much nice. 6502 really missed the boat, the 65000 would have been better then what we got.

Not much now, they are all fully spent.

Attached: ComfySleep.jpg (1280x720, 114K)

Check out VHDL. It's not a programming language per se though, it's for FPGAs

I'm learning about DLL Injection and I'm trying to hook the fopen function, but I'm running to some trouble replacing the fopen address with my own function address.

Here is the code for replacing the address
auto vfTable = pointMemory(&base + impDesc->FirstThunk);
DWORD original = vfTable[n];

auto oldProtection = protectMemory(&vfTable[n], PAGE_READWRITE);
vfTable[n] = *(*fopenLogger);
protectMemory(&vfTable[n], oldProtection);


here is the code for the function I'm replacing fopen with
[spoiler][/spoiler][spoiler][/spoiler]
FILE* fopenLogger(char* filename,char* mode) {
FILE* file = fopen(filename,mode);
FILE* fileCopy = fopen("C:/Users/user/Desktop/filedump/" + *filename, "wb");
return file;
}


The error I get is that I can't assign FILE*(*) to type DWORD
My idea was to get the address of the replacing function and stored it in the table, but I'm not sure what I'm doing wrong.

Holy fuk you actually are implementing it. My guess is that string concat you have going on. what is the exact compiler error output?

>My idea was to get the address of the replacing function and stored it in the table, but I'm not sure what I'm doing wrong.
Usually you hook calls loadlibraryA and calls the function from there if I recall, or maybe store the old function pointer before overwriting it.

It's almost as if some older language was right all along, yet people refused to listen.

Attached: John_McCarthy_lisp_man.jpg (630x630, 49K)

uwu

programming

hm. i didn't know about that filter

huh? what is it

You should use `when` when there is no "else" clause to avoid people (or yourself) wondering if you forgot it.

Should this work? onlinegdb.com/SyBtOZ7Qr it outputs nothing for me

#include

int main()
{
char *str = "test";
printf("Hello World" + *str);

return 0;
}

Yeah, I had to look up how it worked in Racket.

terminal buffering, you're missing a newline or a call to fflush(stdout);

ahh it takes 2 pointers and makes a DWORD, then the DWORD is printfd

No, why the fuck would you think that works

>Holy fuk you actually are implementing it
Should I not be implementing it?
I don't get any error output from the compiler, but I do get Visual Studios( I think its an intellisense )warning
a value of type "FILE *(*)(char *filename, char *mode)" cannot be assigned to an entity of type "DWORD"


I didn't know about hooking into loadlibraryA, I chose fopen because the game I'm trying to reverse engineer calls fopen to open files and I wanted to intercept the filenames and files. But tell me more about hooking into loadlibraryA. Why would I hook into it?

This anons code example made me second guess FILE* fopenLogger(char* filename,char* mode) {
FILE* file = fopen(filename,mode);
FILE* fileCopy = fopen("C:/Users/user/Desktop/filedump/" + *filename, "wb");
return file;
}

>t. high-level language retard

>Should I not be implementing it?
I think it is awesome you are and it is correct what you are trying to do with fopen hooking from what it sounds like.

>I didn't know about hooking into loadlibraryA
I missed an r there. You can load whatever library has fopen with LoadLibraryA then call fopen from that HANDLE. Keep up the good work! Its really neat, fix that string concat though

I really want to learn about FPGA. VHDL or Verilog, how to choose?

currently cooking dinner for when my husband anone come back home!

If I can't choose a particular specific field to work with what should I choose? I got a CS degree and need something specific to focus on. I dont like one more than the other but I think just choosing one and working with it and sticking with it would be a good idea instead of wasting time thinking.
Which is a meme and which is future proof?

what about my code made you second guess yourself?

Thanks for support user. I'm not sure I understand the value of loading the library with LoadLibraryA and calling it fopen from HANDLE.

Added wind/rain to my gemu. I'll probably do the remaining graphics to remove placeholders.
Still don't know if I'll bother with multiplayer.

Attached: rain.webm (800x600, 2.81M)

unironically deep learning

Nice!

nice progress

add an airstrike