/dpt/ - Daily Programming Thread

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

Attached: iyuiw062b1s11.png (500x656, 159K)

Other urls found in this thread:

common-lisp.net/lisp-companies
twitter.com/paulg/status/1118808090466574336?lang=en
dlang.org/blog/2017/08/23/d-as-a-better-c/
dlang.org/phobos/std_container_array.html
github.com/kostya/benchmarks/
michaelscodingspot.com/5-techniques-to-avoid-memory-leaks-by-events-in-c-net-you-should-know/
blogs.zynaptiq.com/bernsee/repo/smbPitchShift.cpp
github.com/JorenSix/TarsosDSP/blob/master/src/examples/be/tarsos/dsp/example/PitchShiftingExample.java
stackoverflow.com/questions/1980640/is-it-a-good-idea-to-incorporate-a-reference-count-into-every-database-table
twitter.com/NSFWRedditGif

cool crab

Well, you're right, I should have said "No one uses Common Lisp anymore" since it was the language Graham used.

crab thread?

Attached: hi guys.jpg (1600x1071, 293K)

Please use an anime image next time.

Attached: 1557168359873.png (700x823, 428K)

common-lisp.net/lisp-companies

Feel better?

Attached: anime.jpg (184x184, 12K)

Where da animes at?
Fuck this I'm leaving

Attached: active.png (815x198, 19K)

Do you have a point?

based
boycott non-anime threads

Yeah, most of them are dead.

What is this thread even good for?
You call everyone a retard except yourself.
You don't appreciate what other people try.
If asked for advice you reply with stupid memes.

Attached: 1553204690718.png (400x400, 10K)

>some = most
Are those mental gymnastics hard to do?

Well they tried to mark the active ones as of 2018, and they came up with 5.

What's some ways to modulate audio output from files programmatically in Java/Android?

Attached: D8bgTs0VUAEaKbR.png (355x355, 148K)

Even Paul Graham recommends Clojure.
twitter.com/paulg/status/1118808090466574336?lang=en

I need some help with manipulating the project folder i am working on.
i have a repo like this root/project
but I want to project into root/specific folder/project
How do I do this?

oh, i am using git and github

Shut up, you retard. My advice is top-tier.

Attached: 1557391869098.jpg (200x250, 19K)

who cares

CommonLisplets are forever btfo.

This is how I write my sepples too

Just move it, and git add everything, then commit. It can handles moves/renames.

>What is this thread even good for?
>stupid memes.

bascringe
/dpt/ is perfect

Shitposting

stop shitposting your stupid memes in /dpt/ retards

Every time I think I understand the logic behind it, I realize that I don't?

Is there a good build system for C?

Meson.

GNU Make

Neat.

D with betterC

>dlang.org/blog/2017/08/23/d-as-a-better-c/
my pp hard

Fuck off, you disgusting necrophiliac.

What are you, a necrophile?

I honestly prefer @nogc with dlang.org/phobos/std_container_array.html though. As you lose some nice things with betterC

Why no D on benchmarksgame?

I have a game and I want to train an AI to be great at it using ML like all the cool kids.
What's a good place to start for learning this type of stuff?

github.com/kostya/benchmarks/

Both D programmers are too busy shilling for the language.

Fuck emacs.

Attached: enters thread.jpg (848x865, 131K)

Nim has 1.0 RC1!
Who else is excited?

That's a weird image of Maki

Literally nobody.

>Nim
>Who else is excited?
I'll reply to you, not because I'm interested in or excited by Nim, but because otherwise nobody ever will

i want soul-less wagies out.

I would try to find an applicable book.

sounds pretty exciting, user

i love you

Attached: for anon.jpg (731x656, 524K)

I'm not.

kino

anime website

Yes, that's what I was asking

How can events cause memory leak in C#? Arent they just function pointers?

If you use lambdas as event handlers(like most people do). At least that's what I assume.

no, they're closures which capture scope. and those captures can be pretty large.

Carefully, diligently, methodically, haphazardly

I'm writing a wss server with Boost.Beast, and it compiles pretty fast with gcc on my shitty Debian laptop but somehow 15x as slow on my W10 desktop with mingw-gcc. Same makefile and everything. What could be the problem?

>no, they're closures which capture scope. and those captures can be pretty large.
Why though?

But in all seriousness, I would pay anyone who can give useful advice about pitch shifting audio files in real time in java $8 of Bitcoin if they post an address along with the advice.

Just look up literally any FFT pitch shift algorithm, they were written long before you were born.

If the closure uses variables from an object then the object won't be collected until the event handler is collected. If the object is heavy this can cause an issue.

Did you try searching for "java pitch shifting" yet?
No payment necessary.

You gotta admire the effort and care put into the stdlib but Nim is a stupid language

Attached: anime crab in swimsuit.jpg (844x480, 72K)

michaelscodingspot.com/5-techniques-to-avoid-memory-leaks-by-events-in-c-net-you-should-know/

Hey man, I don't use Nim either, but be a little nicer about something people put a lot of hard work into.

>Nim is a stupid language
why?

Thanks

I kinda need to see an example in code form, I have found text tutorials, but not with example code which defeats the purpose of it being a language specific explanation.

Was Turing a jew?
what's up with that thesis of his making it impossible to have good things...

>having to worry about leaks in a gc lang
the absolute fucking state

not a jew but he was an ill homo

No he was a fag

Why?

what's so stupid about it?

blogs.zynaptiq.com/bernsee/repo/smbPitchShift.cpp
Try something like this maybe

Do my object classes become bloated if I split my constructor over multiple methods that are only called in said constructor? In other words, I have a bunch of methods that are only called in the constructor. Do these take up memory at all, or is C# (in this case) smart enough to not keep references to them after you created the object?
Would it be better to have a 2 page long constructor instead? Or would creating a separate class with static methods be a better idea? Or finally, is this completely fine?

Example (close to what's happening in my code) to clear up what I mean:
You get a text file that you need to parse. The text file is full of a bunch of shit that needs to be put in numerous separate lists resulting in lots of lines of code. Therefore you write a separate method for every single list you need to parse in order to keep the constructor clean. However, you now fear that these methods taht are never used otherwise are bloating up your object.

why would you initialize the parsing in the constructor

Hope he's reading this

It's the third search result for "java pitch shifting". Am I being trolled?
github.com/JorenSix/TarsosDSP/blob/master/src/examples/be/tarsos/dsp/example/PitchShiftingExample.java

Methods don't take up memory in an object.

>but be a little nicer about something people put a lot of hard work into.
Wasting a bunch of hours on something doesn't make you entitled to compliments

The irony is that GC memory leaks are caused by dangling references - the exact same thing that causes memoryleaks in non-GC languages.
You lose tons of control to save 3 seconds of work of adding a smart destructor

I just need the data from the file. I don't have a separate parser if that's what you're saying I should do. The class in question becomes interactable data defined by whatever is described in the text file. It's not static data, and I never need to write it, only read. So there's no real point to writing a separate parser (is what I assume). But in the end, that's kinda what I'm asking.

I feel like I can use this, thanks.

>The irony is that GC memory leaks are caused by dangling references - the exact same thing that causes memoryleaks in non-GC languages.
how a reference to unallocated memory is a leak?

lol you're welcome

With a GC, a memory leak is caused when an object that will never be used again remains reachable. Without a GC, memory leaks include both that and objects becoming unreachable without being freed.

Is there a way to have a foreign key constraint without the parent (referenced) being unique?

I have two tables:
CREATE TABLE a(
id INTEGER PRIMARY KEY,
data BLOB,
ref INTEGER REFERENCES b DEFERRABLE INITIALLY DEFERRED,
);

CREATE TABLE b(
id INTEGER PRIMARY KEY REFERENCES a(ref) DEFERRABLE INITIALLY DEFERRED,
data BLOB,
);

I want that for all rows in b, their ID has to be the ref of at least one row in a. But the parent key must be unique. How do I do this?

Attached: 1538429621707.gif (220x101, 5K)

clang main.c -std=c99

You don't need to compliment them. I don't personally see a need for Nim, but I wouldn't summarily write it off as "stupid."

I'm not the same person

If the parent ID is a PK it's gonna be unique anyway, or am I misunderstanding something?

Never mind.
stackoverflow.com/questions/1980640/is-it-a-good-idea-to-incorporate-a-reference-count-into-every-database-table
I can just use a trigger to delete all orphans each time someone deletes a row in a.
What's the cleanest way to get a trigger to delete a file?
I'm thinking either the query returns a list of files I should delete, or the trigger inserts the list into some other table that's then checked right after running the query that could trigger the trigger.
id is unique, but ref isn't. But I solved that particular problem.

It sounds like you're trying to create a many-to-many relationship. For example, if you were trying to model the programing languages used by diffrent people, each person might use many languages and each language might be used by many people. The typical way to do that is with a join table.

create table person (
id integer primary key,
text name
);

create table language (
id integer primary key,
text name
);

create table person_to_language (
id integer primary key,
person_id integer,
language_id integer
);

This is a dumb question, but shouldn't this be the actual goal? I'd imagine the preprocessor should be good enough on its own to handle includes in a sane manner, likewise with the linker.
Are people making things more complicated than they need to be?

No, one-to-many. One person can use one language, but one language can be used by many persons. When the last person to use the language is deleted, the language should go too.
And when it does, a file should be deleted (see )

I can also bind a C function with sqlite_create_function. Would that be a good idea?

For small projects, it's 100% fine. For bigger projects, it might be a bit annoying to have to wait for the compiler. Especially in C++, where an hour to compile is not unheard of.

>The executable size is 23,068 bytes.
>Translate it to D: The executable size is the same, 23,068 bytes.
I hope the 23KB of runtime is justified.