/dpt/ - Daily Programming Thread

A thread for people whose lives aren't a circus.

Attached: 1517189330181.jpg (392x309, 141K)

Other urls found in this thread:

php.net/manual/en/features.commandline.webserver.php
blog.adacore.com/using-pointers-in-spark
joblib.readthedocs.io/en/latest/
microsoft.com/en-us/research/wp-content/uploads/2016/07/history.pdf
twitter.com/NSFWRedditImage

Lisp is the most powerful programming language.

i'm writing an alternative to Jow Forums that uses sound posts instead of images. I got the html done, trying to decide what server side language to use

Machine code is the only programming language.

Lisp

PHPenis

B-b-but my life *is* a circus

So you want the already existing /dpt/ thread?

Attached: _105931484_gettyimages-1019026810.jpg (624x351, 39K)

I am literally a circus acrobat that uses adobe acrobat.
I think OP is bigoted.

a programmable circus?

op might has well of said "dpt post only if straight white male with no retardation problems"

whichever one you already know how to use.
>I don't know any
Erlang + Elixir is known to produce rock solid web servers. It's also known for being difficult.

>book authors throwing shade at other programmers
Cringe

Attached: 1.jpg (1080x299, 133K)

This actually sounds like fun. Make sure to add a feature that plays back a reply chain in order so you can listen to autists battle it out.

Oh boy, I can't wait until the entirety of Jow Forums starts posting hundreds of fart noises.

Attached: 1496863441472.jpg (600x552, 196K)

fart noises would get old within the first hour and people would move on to "man orgasming very loudly"

We would discover new kinds of white noise that day

How do you guys implement tries?
In a high level lang like JS/Python I just do it as nested objects/dicts. Is there better way?

for a prefix tree, dicts are optimal since keys don't have to be one character, and the number of branches aren't fixed.

why should I into ML?

clean syntax and functional but not to an autistic degree.

I mean Machine Learning not Meta-Language.

cirkus is a pretty good song, i dont know why fripp doesnt like it

buzzwords. keep up with them but never take them as a main interest.

what do I need to know on the topic?

That's not a /dpt/.

posting in both threads to get best results

I dont know shit about html and Im trying to make a basic ass webpage. How do I make multiple html files link to each other that keep the same setup? I'm using html and php (yes, shoot me i dont give a shit) and the webpages use php scripts for a login system. I assume an tag with href="index.php" and a simple for each page being linked to the index is enough right?

...

probably python and an ML lib for starters. you should read some papers on ML as well but I never cared enough to even look it up so I don't know of any good resources.

Using phpstorm and trying to run some php and html files locally through xampp/apache but Im getting 502 bad gateway errors when I try to run it on the browser in localhost. The files work fine in an online server. Wat do?

>run it on the browser in localhost
Need more details.

best lisp?

>shoot me i dont give a shit
Based poster.

I have my project folder saved in xampp>htdocs btw.

Attached: error.png (875x332, 20K)

Have you tried serving them with this php.net/manual/en/features.commandline.webserver.php ?

REEEEEEEEEEEEEEE

Attached: 1560032744633.png (383x412, 232K)

Common Lisp

But Racket is my langfu.

> C#
if (true) {
int x = 46;
}

int x = 34; // compile error

var y = String.format("{356}", "lol"); // 0 errors, 0 warnings

foreach (var val in arr) val += 2; // compile error
for (int i = 0; i < arr.Length; arr[i] = arr[i++] + 2) { } // works

void fn(const String s){} // compile error, no const parameter lol

Attached: 1542988408997.png (814x806, 31K)

inb4 its all just dudes screaming or orgasming and also screaming

C.
Plenty of good libraries for sound processing.
Also please when you make users upload their audio check their peak levels and adjust them automatically. Its easy to do when you're already touching the data. Doing that as post process is just expensive. The early days of Jow Forums audio webms were awful because of it. And the image embedded audio was even worse.
Enforcing alright audio quality will make or break this site.

I've got python slotted for next term. What am I in for?

>the day when autistposting becomes a thing you can share with your neighbor
brb moving my boxes to face outside the open window

doesn't const in C# mean something different from readonly?

A shit ugly slow language.

Kodi plugins

With C# you are getting handholded in exchange of being able to do things faster overall.

>in exchange of being able to do things faster overall.
Fun fact: Linq-ForEach is slower than foreach which is slower than for.
I really don't know why, but this is how it be.

foreach is slower because it first counts the object and makes some background stuff to assign it to a numerable list I would guess.

I don't really use LINQ much but that one is really a fucking hit or miss, some tasks are insanely faster with it, some a lot slower because it actually treats variable-lists like databases.

Also I was referencing being able to write code faster. I personally really like C# because compiler optimization gets performance close to C++ while not giving nearly as many headaches and meanwhile being way faster than python with only a little bit slower dev-time

[spoiler]LOL[/spoiler]

Attached: Da1deIqW4AAasvh.jpg large.jpg (524x499, 34K)

Does C# compile generics to instances/fully qualified/whatever-you-call-it at compile time or at runtime?
Does it affect performance enough that I should care?

Attached: 1564351263292.jpg (827x1087, 108K)

The CLR creates unique generic class instantiations within the VM at runtime.

linq extension methods have calling overhead, allocate a function object, do the same as foreach and apply the function each iteration.
foreach checks hasnext, calls movenext, and then copies current item or a ref to it if the container supports that.
for is implemented as a goto afaik.
linq treats everything like an enumerable(iterable dataset) not a 'database' with the exception of things like linq-to-sql which gets converted to sql commands.
feel free to attribute that speed to Ryu JIT and not roslyn which barely does any optimizations.

not him but isn't that kind of dumb? you're wasting the potential of runtime generics

it does cost some microseconds the first time but it's miles better than boxing then unboxing.
howso?

if instantiation is a no-op then you can do it infinite times, it allows things like rank n types and polymorphic recursion. I get that boxing/unboxing is a useful optimisation but why can't the compiler do that like he says? In Haskell you have specialise pragmas for this.

You can still do rank N types in C#

big if true, how do you do it?

blog.adacore.com/using-pointers-in-spark

SPARK 2019 will now have ownership rules for pointers to be more like Rust.

interface Foo { T bar(T t) }
a Foo instance is a first class object, this is equivalent to a -> a

so you could have something like this?
interface Sum { R match(Func, Func); }

when will c# support hkts though

You know a language is garbage when the SDK has opt-out telemetry

Am I the retard here?
It always colors multiple rows but never in scope of the visible scrollbar range. I have to scroll up or down to see the others.
It's the System.Windows.Controls.Datagrid
I assigned the Handler in XAML under Datagrid.Resources as

Attached: 1542505549759.png (1135x611, 37K)

I really would just have rvalue references function as rvalues. It'd make move ctors/assignment more of a pain to write, but if you're following the rule of zero you rarely write those any way. The forwarding case would be much simpler and easier to understand.

I'm writing software that uses C, but I want to use another langauge like Go. Given that they both compile down to the same binary format, is there a way I could use Go instead of C? I.e. convert the libraries and includes from C automatically to Go or something along those lines?
I'm not sure how to phrase the question really or if it's possible. I heard Go modules could be used for it but idk how.

WPF never ever does what you expect it to. Get used to it.

Why are you setting properties in code and not using two-way binding?

Because I'm new to WPF. Will change this.

I'm giving myself a cursory overview of the (108) papers by the Machine Intelligence Research Institute and maybe do a vlog summarizing and reflecting on it

Attached: darcat.jpg (250x250, 5K)

That wouldn't be getting rid of the rvalue/lvalue reference system though, it would just be a change in the semantics of rvalue references though. It would save a little bit of typing in the common case in exchange for making it easier to break things by double moving. Imagine you have some T&& foo that you want to forward, and later you decide you want to call a getter on this foo before forwarding to retrieve its internal bar before forwarding, maybe for a debug log or something. So you call const auto &bar = foo.bar(), but whoops, that function had a return by value && overload so you just gutted the bar out of your foo in the case where T&& is an rvalue reference. I think the current system is more in line with the way we usually expect things to work.

Why is the GUI handler function async? Do you just spam async for the fuck of it?

the go authors (particularly russ cox) wrote a c-to-go translator which they used to translate most of the go compiler codebase itself

search for it

the first time C++ user would "expect" this to just werk
template
void foo(T &&t);

template
void bar(T &&t)
{
foo(t);
}
treating a reference to rvalue as an lvalue is more of a corner case tbqh.

Not really sure if this is the right thread but I gotta ask.

How do i git gud at coding?

I’m doing free coding online that teaches you the absolute basics with test codes so you can try it out for yourself before you can proceed to the next lesson. I already know just enough that I don’t get confused at what I’m seeing.

But anyway, most of the time I’m able to get the correct code without actually understanding how I made it work. I know that that sometimes happen irl but fuck me it blows so much of my self-esteem, because I feel like I should understand how it worked.

Meanwhile, there’s people in the world who literally lives and breathes code that writes paragraphs in minutes and I can’t even for the life of me get a single line working for hours.

Tl;dr want to really learn coding but i’m a brainlet

I’m learning javascript btw, i dabbled in c++ and sql but i hated those.
Also, thank you for reading my blog post ;_;

Attached: FFAA72AE-743E-4941-8AF1-78F33D634F19.gif (350x206, 976K)

C# is all about async bro, it's how you write reactive event driven solutions that react reactively and asynchronously to the user bro. Every function should be async and run in its own parallel thread COM-aware apartment.

>So you call const auto &bar = foo.bar(), but whoops, that function had a return by value && overload so you just gutted the bar out of your foo
This is bad design. You should be using a function bar which takes foo by value. You should never use rvalue references outside of move constructors, move assignment, and forwarding

It's more of a corner case yes but when it happens it's more likely to cause a bug if you have implicit forwarding. If you forget to forward as in your example at worst you do one extra copy operation which isn't really that big a deal.

The best way would be to work with someone who knows better and can tell you what should be your level, answer your questions, criticize your errors.
This usually means working for an open source project.

For me, it helped to find a project that I was actually interested in. A niche game.
In the end it turned out pretty shitty due to leadership drama, but I improved my C++ quite a bit due to proper guidance.

the basic: Do a bigger project, do open source work and/or get a job where you have to do the work and are surrounded, live, by people better than you

read the practice of programming

i feel silly giving out stellar advice like this because, despite what john carmack once said, programming is a bit like a zero-sum game and more programmers = more saturation

Even cute commies get a free ride

Attached: 20190729_081452.png (500x292, 171K)

I've fallen down a rabbit hole of looking at ever more niche and esoteric programming languages looking for the holy Grail

How stupid it is to write
switch (var) {
if (a) case 1: case 2: ...
else case 3: case 4: ...
default: break;
}
instead of tons if else if else if ...?

And yes, will it even work?

Use an enum.

I do use it instead of 1 2 3, although I'm not sure whether my logic would work.

gonna be a long day

Attached: sc.png (960x794, 181K)

It's actually a logical idea, though. Internally consistent. It might work as expected in some sort of a dynamic computation graph.
A permacodelet would not offer such an explanation.

Yudkowsky is the only Jew I legitimately respect. Guy is based af.

Does any of you know of any python package that allows for batching IO operations?
I have lots of (50,000+) small images (100x100px) images that I need to process and save. The processing part is fast enough (

I agree in principle, but then again, as soon as you explicate two operations, you need to add more rules for when printing should be done.

Attached: blacked.jpg (1125x1565, 688K)

joblib?
joblib.readthedocs.io/en/latest/

not sure if it qualifies

Attached: g.png (863x750, 129K)

Are these 50,000+ small images in seperate files?
if so, why?

Because i'm pretty sure if they're seperate files you're fucked, you're going to be making a shitload of requests to the underling system APIs no matter what you do.

You should merge them all into one file, preferably by stuffing them into an archive file format but without compression, so that restoring them to individual files is easy, and go from there.

Multiprocessing with worker pool and job queue.

Anyone has relaxing books about programming?
As in, not something that goes in the nitty gritty of a programming language but like, more of something to read and less something than to remember. I was recommended "The Cathedral and the Bazaar". I want that style of book.

microsoft.com/en-us/research/wp-content/uploads/2016/07/history.pdf

Attached: bb.png (781x213, 77K)

pic not related btw., that one is from the MIRI papers

Attached: consum.jpg (698x465, 261K)

They are in separate files because I need to quickly randomly sample from them. And it's easier to manipulate list of filenames than list of RGB images. Additionally, there are relationships between the images I track using the filenames.

I was thinking about using HDF5, but iirc you can't increment the dataset without loading the entire thing into memory first. Otherwise it'd be perfect.

will android ever run python? or is it not possible?