/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Old thread:

Attached: MTI2MjU5MDE4NTc3NTI4ODQy.png (1024x747, 69K)

Other urls found in this thread:

chiark.greenend.org.uk/~sgtatham/coroutines.html
pastebin.com/8qtVS6Yk
github.com/id-Software/Quake-III-Arena/blob/master/code/game/bg_lib.h
ziglang.org/
github.com/LeifW/c-repl
twitter.com/SFWRedditVideos

>Ruby on Rails
how old is this shit?

Attached: sal.png (909x962, 120K)

Attached: 1*lOEJf3tEoWCHYoWEg69A7g.jpg (1600x1832, 165K)

>challengerocket.com
kek

Attached: sal.png (1282x899, 86K)

Ok so I checked. I did install it under /home/ but when I run some Go file in it, I still get the following error if I don't use sudo.

go: disabling cache (/home/myname/.cache/go-build) due to initialization failure: open /home/myname/.cache/go-build/log.txt: permission denied

I don't get how that's possible, it's literally my own directory.

What's the difference between using the /documents folder or not? Shouldn't they both be accessible to the user?

JavaScript rocks!

Attached: js-rocks.png (1000x494, 369K)

Not only based... but also redpilled!

I just cannot wrap my head around anybody who likes js. What do you like about it compared to other languages?

ask me about Haskell, nothing too PITA to answer on phone though

not only unbased... but also bluepilled!

who is your typfu?

fingertree-chan but she's too self-conscious about her constant factors to beat out linear [] operations on small collections which are frequently the usecase at work

Are there more than 3 Haskell jobs?

Based

Cringe.

Employed Haskell programmer here

Attached: dunecat.jpg (439x392, 30K)

is it true that she's into kinky shit like polymorphic recursion

I'm surprised python gives you that much considering how stupidly easy it is to use.

cringe
Based

There were like 4 different places advertised in last week+, one of them ours...

Nope, she's pure and dedicated to monomorphism, none of that stack-destroying polyrec

Try this in Excel

=SIN(PI())

Attached: 1539442393785.jpg (850x800, 65K)

based
cringe

>excel
but Jow Forums told me not to use pure functional programming languages, especially when they use comoanads

Excel's precision for a specified number is confined to 15 significant figures so it's correct.

How useful is react native? I've written native android apps before but never tried an ios one.

It should have a switch statement for significant irrational values.

cringe
based

I like this image.

Wrong.
For what? Just to satisfy your dumb autism?
No need to kill performance for no fucking reason. Any non meme use of sine you're not going to be seeing the function values anyway.

How about an equation where sin(x) is in the denominator, instead of throwing a divide by 0 error it will give you a very large number

I am not the same person as Although you are technically correct, this is excel we're talking about, not matlab. I can't even conceive a situation where you would be calculating sinuses in excel. Actually, yes I can. I take it back, you're right.

How is this an issue?
You should be checking for division by zero beforehand anyway if you intend on handling it.
If you don't you assume it doesn't happen.

>you're right
Who?

this user

What is the best language to make an interactive map in?

Recommend me some online resource to learn erlang.
I stumbled upon learn some Erlang but it is 2009, so I am not sure if it is applicable

>1.5k+ pages
oh boy here we go

Attached: Screenshot from 2018-10-20 01-10-27.png (3252x1690, 533K)

Alice 2.4

Attached: Screenshot_2018-10-19_10-11-31.png (1366x737, 192K)

Anyone else annoyed by the syntax in the NPC memes?

Attached: 1511233051753.png (796x437, 121K)

> Jow Forums tries LARping as programmers

Attached: 1523689711004.jpg (3721x2470, 1.42M)

Attached: 1509887318116.png (1834x1200, 639K)

Why do you compare C to a retarded puppet?

Java demands you go out and impregnate some japanese women RIGHT NOW

It's frontend webdev cancer squeezing into the mobile market just like they did with backend. Only reason it exists is to enable retards who already know React.

C has most of these, just without the retarded academic names.
Show me Duff's device or chiark.greenend.org.uk/~sgtatham/coroutines.html written in Rust or whatever it is you people use. Go ahead, do it.
Also try finding an alternative to longjmp, function pointers, and inline assembly.

See

Longjmp is literally just continuations without unlimited extent
That's also how you achieve stackful coroutines
Cniles are dumb niggers, nobody is surprised

>function pointers
Every language worth its salt supports higher-order functions.

But can you put the state into a random buffer and pass this into various functions?
Can you put them into arrays?

Yes to both.

Complete Java newbie here. I'm making a shitty little JavaFX application for uni. I have a tableview with a couple of columns. These columns are for StringProperties and IntegerProperties and one column for a ListProperty. When I start the application everything shows up in the tableview just how I like it. When you edit the SimpleStringProperties and SimpleIntegerProperties (via another window) the change is automatically reflected in the tableview, but when you add or remove items from the ListProperty nothing happens. I need to manually refresh (tableview.refresh()) in order to see the change.

What am I missing here? Why is ListProperty different from StringProperty and IntegerProperty?

private ListProperty test2 = new SimpleListProperty(FXCollections.observableArrayList());

public ObservableList getTest2() { return test2.get(); }

public ListProperty test2Property() { return test2; }

public void setTest2(ObservableList test2) { this.test2.set(test2); }

Attached: 1453587368245.jpg (370x345, 64K)

Sadly I can't help since I'm still from the days of -may God forgive me for uttering these words- Swing.

Is Orcales VM Virtualbox enough to learn Linux with or should I get a cheap thinkpad and mess around with Linux there?

You should buy an Android phone.

Don't you have an old laptop laying around to put Xubuntu on?

I mean yeah but its fucking loud, too big, battery is shit doesnt even hold 1 hour and the brightness even all the way up is not enough
might aswell get an x220 or x230

Just keep it plugged it in, connect it to a monitor and use it as a linux desktop. That's what I'm doing with my old laptop.

I want something to take to university too and flex on niggers

>not running TempleOS on your Xiaomi Mi Mix

It has to be pre-2015, Objective-C is there but Swift isn't.

C is really comfy when not using malloc.

>sepples didn't even make either list

am I wasting my time learning this shit?

Too bad it's pretty much mandatory for non trivial software.

It's not even an option for embedded. At least not the shit I work on.

I never understood why brainlets find embedded autism interesting

how to get good at shader programming? all this stuff i see in the glsl sandbox is impressive and indecipherable and i have no idea how one would learn to do that

it's interesting seeing your code have physical consequences

also rugged systems are look interesting, writing realtime code is interesting, and memory and time constraints give you a sort of creative spark

Practice! (And linear algebra/trigonometry)

quake 3's game code has no malloc anywhere

practice what?

I have question regarding file descriptors in unix and c programming. Let's say I use pipe(fd), and I get file descriptor 3 and 4 for the pipe ends, 3 connects to the read end and 4 to the write end.
Now I use dup2(fd[write_end],1) to copy the descriptor of the write end(which was 4) to file descriptor 1 in my process. If I now do close(fd[write_end] will it close fd1 or fd4? or maybe both?

>he doesn't find memory trickery fun and exciting
The only flaw of C is how limited function pointers are, e.g. C11 generics could have better support for them and you should be able to memcpy() them.

What's a good Python IDE to get started?

Nice FUD you fucking faggot
pastebin.com/8qtVS6Yk

Attached: 1538999619322.jpg (235x212, 12K)

>e.g. C11 generics could have better support for them and you should be able to memcpy()
what

BTFO

q3radiant isn't quake 3's game code
common isn't quake 3's game code
LCC isn't quake 3's game code
libjpeg isn't quake 3's game code
quake 3's game code lives in the directories cgame, game and ui, and there is no malloc in any of them; indeed there can't be any mallocs in quake 3's game code because the VM interface does not implement malloc

github.com/id-Software/Quake-III-Arena/blob/master/code/game/bg_lib.h
no malloc.

clueless know-it-all

based komariposter

Say you have a function f1(a, b, c). With c11 generics, you can vary code based on the type of f1. But to vary code based on the type of a, b, or c, you need a macro maze. It's doable, and it doesn't affect the binary size, but there's no native support for it.
It's a shame.

As for memcpy: you should be able to do something like this:
void (*f2)(void) = malloc(sizeof(f1));
memcpy(f2, f1, sizeof(f1));

But it's UB, and there's no good way to get the size of a function. This stifles creativity.

Of course it's UB, for what you're doing to be make any sense every function would need to be position independent.

what's the point of using new standarts like C11 when you could just use regular C++ and avoid all the shit features.

Attached: 071.jpg (184x168, 9K)

>trying to send keyboard inputs to background windows
>trying to capture frames from a background render
I bit more than I could chew for sure

>practice what?
Practice shader programming.

i don't know where to begin, it's not like doing ye olde triangle example helps

That's true, a naive copy wouldn't work, but a third-party library could implement code to add and subtract the relevant pointers, so you'd get something like this:
void (*f2)(void) = malloc(sizeof(f1));
memcpy(f2, f1, sizeof(f1));
update_ptrs(f2, f1);

Keep in mind that position-independent code would also have to be adjusted, since the previous functions are relatively addressed too, and that breaks if you move it.
C++ includes new shit features, like million of kinds of char pointers, and removing casting for no good reason.
C99 is all you need, really. C11 is trash anyway.
We need a new C11, designed by someone who knows what they're doing.

You begin by using a graphics library that has shader support.

Fucking hell, the more I think about it, the cooler it'd be. Imagine having a library to dynamically edit your code in memory. It would be like a JIT compiler, but without the overhead of one - you'd still have the freedom.

>That's true, a naive copy wouldn't work, but a third-party library could implement code to add and subtract the relevant pointers, so you'd get something like this:
What you're doing is basically doing all the fixups a linker ordinarily does, except at runtime.
So... why don't you just dynamically link?

>removing casting for no good reason.
lolwut?

>We need a new C11, designed by someone who knows what they're doing.
Why don't you publish your proposed specification and reference compiler?
You know what you're doing, after all.

Start with fractals and fractal curves.

>We need a new C11, designed by someone who knows what they're doing.
ziglang.org/

Congratulations, this is the dumbest post in /dpt/ in a long time.

No, it's not the same thing. I can't edit code in memory, even with a dynamic linker. I can't copy it or otherwise edit it. Dynamic linking was a mistake, by the way.

I heard so, at least. You can't cast freely in C++ anymore. It's considered 'unsafe', you have to learn the 'new' static_reinterpret_const_cast>

Attached: 1514650983152.png (500x283, 24K)

I don't see how your suggestion permits you to edit code either. You've made a copy of a function, now how do you alter its behavior?

how the compiler would know the binary size of a procedure? think before posting.

You still do work with memory. Sure, it's not malloc and most likely just a reserved space you have to manually operate on with custom-written allocator, but still.

c style casting still works in c++. The c++ casting syntax is mainly for classes, although it has the added benefit over c style of being const correct.

You edit it, in memory.
That's a good point, especially if it's inlined.
Nevertheless, it's still a shame that it's UB to do something like this:
((int(*)(void))"{binary blob encoded in chinese characters]")()

You have to cast malloc, for instance. C++ doesn't allow you to do everything C does.

I remember around 2013 places around here were desperately hiring Python devs in the six figures. Now you're lucky to get $60,000. I don't get why it became so popular in data/forensic analysis tools.

Yeah, I'm asking how that looks. Just hex editing it like *(u32*) fptr = 0x12345678;?
If it were well defined to do this kind of thing, I still don't see why you wouldn't be able to do this for a dynamically loaded function. Dynamic loading already does exactly what you're asking - it reserves some unused area in the process address space, loads functions there, performs fixups to make sure all the offsets are correct, and then gives your program pointers to those functions.

I'm reminded of this C "repl" which literally just compiles C functions (read) then dynamically loads them and executes them (evaluate).
github.com/LeifW/c-repl

>You have to cast malloc
You can make a wrapper function for malloc for which this isn't necessary.