/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?
Previous thread:

Attached: file.png (225x225, 35K)

Other urls found in this thread:

developer.mozilla.org/en-US/
github.com/denizyuret/Knet.jl
cabinetmagazine.org/issues/1/i_moglen_1.php
github.com/FluxML/Flux.jl
twitter.com/NSFWRedditImage

Please use an anime picture next time, thanks.

C# and haskell second

reverse polish lisp for third

what do you think of Mathematica?

I'm gonna beat you dweebs up

Learning about exception handling.

slow af and very confusing 0/10

i = * ( long * ) &y; // evil floating point bit level hacking
i = 0x5f3759df - ( i >> 1 ); // what the fuck?

ur mums arse with that bo'ol o lube

this

Attached: 1467570941060.jpg (1521x1076, 517K)

If I return a vector, does copy elison only apply to the elements of the outer vector somehow? I'm seeing unexpectedly large performance drains by the = operator when profiling a segment of code that takes such a return value

It applies to the actual thing being returned, which should chain to any internal variables if the type was set up correctly. You should be able to assume stuff in the standard library has been set up this way. Care to share your code?

I have a background process that's constantly running, doing it's own thing. However, sometimes I'd like to be able to override this, that is, be able to send commands to this background thread from another program I could write (a simple console app would suffice); both programs for now are running on the same PC. What would be the most simple way to manage something like this in .NET? Not expecting spoonfeeding, just looking for some pointers as to the best way to do this that isn't something absurd like having the background/server program look for commands written to a file every n seconds. Is there a name/method for cross thread communication like this that I could look up?

Attached: curious.jpg (4032x3024, 1.04M)

>Care to share your code?
Pic related.

As you can see, it's actually vector, but the latter is allocated on the heap and has a move operator, so the same thing should apply.

Hmm, does it matter that it is a const vector where I return it:
const auto v = //...

Attached: asdad.png (750x323, 21K)

If you're writing it for windows, you'll want to look at .NET WCF for interprocess communication.

Create a listen socket and poll it in a different thread? That'd be the most general way.

Does your MatrixXd class have a move constructor or move assignment operator? I think the latter's what std::vector would use.

Attached: InvSqrt.webm (650x950, 904K)

frikkin nerds, hahaha. Pathetic.

>What are you working on, Sup Forums?
Working on a ecommerce site in python.

Attached: 1497505717048.jpg (3000x3305, 462K)

>he doesn't like anime
lol nerd

Nth for org mode

Neat, I knew somebody set out to investigate this divinely inspired constant and found a more precise number, but it ended up being slower and less accurate overall.

Ah. The latter.

I think I figured out what's happening. Copies are being generated in the for-loop when I push back blocks onto activations (should've posted that part as well). For some reason the time required to do this is showing up in the calling function instead, probably because copy elison is in fact happening. Anyway, compared to a simplied version of this function that only returns the last element of activation and does not generate these additional copies, the numbers add up. So it seems to be working as expected.

+1 for C++ is a nice language

I am retarded. I can't get my reverse Polish notation calculator to handle negative number input and the subtraction operator.

Should I move on or just fucking quit trying to program?

Attached: k&r.png (792x1023, 104K)

rest, sleep on it, and try again later

Cool project idea, this other user has best advice.

Attached: 1520651715715.png (3840x2160, 1.61M)

Yeah, I just realized what I said wasn't accurate anyways, because IIRC std::vector doesn't reallocate storage for moves so it doesn't need to call constructors/assign for the storage type.

cough

Found this fork of ldc called Calypso that allows for some damn easy interface of C/C++ code. It's nice because I don't have to write bindings at all.

Attached: Screenshot_2018-03-20_18-51-44.png (331x228, 18K)

I'm trying to write a useful dapp

everybody seems to think dapps are memes

well, they kinda are, because they are stupid difficult.

pic related is a cumulative adjacency matrix. when was the last time you needed an adjacency matrix

basically it says that the worst case lag in the dapp is 1200ms (m3) if you want to broadcast a message across the entire planet in a network of 1000 people.

this is what I'm working on.

i think it needs more wd-40.

Attached: ad_dim_m3.png (276x252, 10K)

use − for minus and - for negative

here is a different finger table algorithm.

brighter spots mean more overcoverage.

not that anyone cares.

Attached: ad_div2_m3.png (276x252, 11K)

you need about 100% less blockchain meme

is £400/day a meme?
my bank account says otherwise

cryptards must fuck off back to and leave us in peace

I'm sorry brother, but I went full blockchain

here's another algorithm that takes half the memory but can increase the lag by up to 150%.

Attached: ad_div10_m5.png (276x252, 14K)

but that's literally
void main()
{
import core.stdc.stdio: printf;
"hello\n".printf;
}

in regular d

IDGAF about money, buf I want to honest to god make a better world.

i know i know, but that's the only thing that keeps my from sudokuing.

if that was the case I imagine you could afford a better trip.

Attached: ad_div7_m4.png (276x252, 15K)

if this doesn't go here then i'm sorry but, does anyone know how i could manipulate the size of replies & post previews on Sup Forums using css? where should i look / research / learn if i'm wanting to do that

>ecommerce site in python

lmao

...

inspect element -> fuck around with css -> refer to developer.mozilla.org/en-US/

Well yeah, but if you have any other C library you can't be assed to write the bindings for, it's great

Why would you want to use plain C though?
You could have much better and shorter code in D.
lazy shit like that is what's ruining software.

Dumbass.

Because there might be a C or C++ library D doesn't have a good alternative to?

That OP image is programming-related and keeps the Mozilla shills from sneaking in

D has sepples interop though.

I don't have any frens

Attached: 1520948926001-b.jpg (1024x576, 83K)

Yes I know, but the whole advantage of Calypso is to avoid writing the bindings which is a task in and of itself, even with dstep. You just import header files and use them directly

Any decent FOSS libraries for C++ GUI development on Windows?

>You just import header files and use them directly
which is trash, stop being lazy and just port it to a better language.

>is £400/day a meme?
when it's cryptoshit, yes.
>my mom says otherwise
ftfy

D combines the memory locality of system malloc with the determinism of garbage collection.

exactly, so port your C/++ lib and have a better life free of the C menace.

Julia is one nice language to plot Julia sets with.

Attached: julia.jpg (2560x1920, 3.45M)

How many of you here are studying or have studied Computer Science at a university? I'm assuming most posters here are self-taught.

>>Not understanding that this was sarcasm and that both properties are bad.

then use @nogc or -betterC and write your own allocator.

I am but I already knew how to program

I have a folder with multiple CSV files. I need to copy them all to a single, new csv file. How would you do this in the language of your choice without loading all the files to memory? The files are quite large.

>the C menace
Damn it C, why do you always do what I tell you? You're a menace!
I never graduated high school. I used to skip class to work on Half-Life mods with my friends. Eventually the school got tired of dealing with us and we all get expelled.

Qt

Should I learn a language before starting college or nah?

>I never graduated high school. I used to skip class to work on Half-Life mods with my friends. Eventually the school got tired of dealing with us and we all get expelled.
My nigga. I hated school as well.

Why don't they make WD-40 cologne? That shit has the nicest smell.

I am just getting started with Python , not sure if I should learn Julia.

I would use something like cat. That's exactly what it was made for.

>How would you do this in the language of your choice without loading all the files to memory?
Line by line or 4096 bytes buffer or w/e.

is there a pastebin anywhere of those programming challenges from a few months back?

one for example was something like "take an image, randomly choose a position, shape, and colour, draw it, and iterate until it closer resembles the original" or something like that; you'd basically end up with an almost hand painted looking version of the original.

haskell is ideal for shit like this: you can write the program as if you were reading the entire file into memory, and then the laziness will process it byte-by-byte. conduit-csv is perfect for this

Lol'd

if you don't need to do any processing on them, just use a shell script

What do you want to do with it?

If you're learning Python with the intent of building Django websites, stick to Python. If you just want a simple first language to learn, stick to Python or a top 10 most popular language for now. If you're learning Python because of Numpy & numerical stuff, learn Julia instead.

If you're learning Python for machine learning, I'd say it can go either way with Python being more mature in number of libraries and tutorials in the short term, but Julia having more potential and being way better suited for making new ML libraries.

>If you're learning Python because of Numpy & numerical stuff, learn Julia instead.

explain pls

can you pip install keras on julia?

Julia is write high performance computing and had built-in linear algebra libs,

Julia had deep learning toolkit
github.com/denizyuret/Knet.jl

How do I move up from beginner to intermediate/advanced? I want to start doing cool shit with programming. Any tips/tutorials?

I find it difficult to stick with a project for more than a week or so. Feels nearly impossible to build and 'ship' any notable software alone.

Attached: STOP RIGHT THERE.png (1440x1440, 827K)

agree

helps to have a cheerleader for your project

>Password generator with options
>Easy
Does this exclude gathering entropy? Getting shit actually randomly generated is fucking hard.

roll im so bored lads

C#/dotnet core, cuz I'm a corporate sellout, and a sucker for garbage collection and the illusion of open source.

>In 1979, when I was working at IBM, I wrote an internal memo lambasting the Apple Lisa, which was Apple’s first attempt to adapt Xerox PARC technology, the graphical user interface, into a desktop PC. I was then working on the development of APL2, a nested array, algorithmic, symbolic language, and I was committed to the idea that what we were doing with computers was making languages that were better than natural languages for procedural thought. The idea was to do for whole ranges of human thinking what mathematics has been doing for thousands of years in the quantitative arrangement of knowledge, and to help people think in more precise and clear ways. What I saw in the Xerox PARC technology was the caveman interface, you point and you grunt. A massive winding down, regressing away from language, in order to address the technological nervousness of the user. Users wanted to be infantilized, to return to a pre-linguistic condition in the using of computers, and the Xerox PARC technology’s primary advantage was that it allowed users to address computers in a pre-linguistic way. This was to my mind a terribly socially retrograde thing to do, and I have not changed my mind about that. I lost that war in the early 1980s, went to law school, got a history PHD, did other things, because the fundamental turn in the technology - which we see represented in its most technologically degenerate form, which is Windows, the really crippled version. I mean, I use Xwindows every day on my free-software PCs; I have nothing against a windowing environment, but it’s a windowing environment which is network transparent and which is based around the fact that inside every window there’s some dialogue to have with some linguistic entity.
cabinetmagazine.org/issues/1/i_moglen_1.php

Does anyone know where I can find more info on Eben Moglin's view of a good programming language? Most of his work seems to be more political than technical.

Attached: eben6.jpg (187x271, 18K)

Oh, and I like unnecessarly complex type hierarchies. Abstract generics ftw.

If you dont theyll fill your head with jewish tricks designed to confuse the goyim like everything is a class

Please kill yourself, thanks.

Please kill yourself, thanks.

Do a ton of real projects like on The only way to become better is to learn how useful software is produced by doing big projects. Also, start reading the source and/or blogs for projects that you think are cool.

4chanx has a custom CSS feature.
If you're just using Sup Forums as is I'm not sure what the approach is.
is where web people hang out.

Julia is better than Python at ML since it can build entire ML frameworks in just julia like this, with no C/C++ component whatsoever. Flux.jl is the first big ML library to do this and is higher-level than pretty much anything you'd find in Python, though it's still a bit immature compared to the bigger frameworks, and needs some nightly features if you want it to use the fancier GPU backend.

Otherwise, Tensorflow/Knet/MXnet etc have perfectly usable Julia bindings. But full-Julia architectures like flux are the future imho.

Intended to add this link to flux.jl after the "this" in my previous post:

github.com/FluxML/Flux.jl

This is probably a retarded question but in C is there a better way to iterate over every row and then every column in a 2D array without duplicating nested loops like this:

char arr[width][height];

// rows
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
...
}
}

// columns
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
...
}
}

>exactly
How stupid can you be? That malloc locality claim should trigger the sarcasm flag for anyone.

Arrays in C are row major. Look up what that means. The consequence is that it is faster to loop over the columns (height here) before rows.

No you have to index the array for both dimensions. There's no for each or anything like that.
One way of dealing with having to write arr[x][y] everywhere is to take a pointer to the location at the top of the inner loop and dereferencing it everywhere instead of risking a fuck up.

Alright man, thanks for the advice. Any instereting/fun project that you recommend in particular?

If I had a nickel for every time a D fag said to just write your own allocator...

And implementing the allocator isn't even the problem. The problem is that they don't understand that you're sacrificing the entire standard library in doing so.