/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Last thread:

Attached: 1492863307737.png (1280x720, 588K)

Other urls found in this thread:

dis.tinychan.org/read/prog/1406427616
github.com/mum4k/termdash)
youtu.be/kPRA0W1kECg
youtu.be/S6Wx_J4Mk7U
youtube.com/watch?v=S9AjQTVXT1o
twitter.com/NSFWRedditGif

Reposting this because I still haven't found a solution.

How can I make something like pic related with python's pyplot library?

I'm not trying to create a map but I would like to plot multiple curves and have a color gradient associated to them (I also already have a constant value associated for each curve so the gradient is already "made").

Basically what I'd like to make is the following :

-Have maybe 20 curves.
-each curve has a constant value associated to it, curve one has like 10 then curve 2 has 9 (it decreases)
-I would like to fill in between each curve with a color that's also decreasing in intensity and related to the constant value associated with the curve.

I know there is a function with pyplot called "fill_between" but I don't know how to make a smooth gradient (like in the pic).

Attached: 5ef2ce685b9b8ab888d7953adfdfd3651527037275_full.png (518x352, 20K)

you're all very cute

Attached: 1453577364718.jpg (1920x3272, 2.01M)

tried contourf?

Fourth for regular expressions

Attached: 1531276652363.jpg (687x847, 234K)

kys, pedo scum
you too, fag

anime website

pedo website

Pedo website

Started working on a web browser with no external dependencies

Wtf will I learn from SICP?

Magic.

Attached: 1553623206716.jpg (1280x720, 407K)

>16 years old
>pedo
lel, sure, amerilard.

NES emulator in HolyC

Attached: TempleNES.webm (1152x720, 988K)

dis.tinychan.org/read/prog/1406427616

In C++ it is possible to define a function that can only be used in a function call expression - and whose address cannot be taken except inside that function.
struct Foo
{
friend
void foo(Foo)
{}
};

void bar()
{
// This works
foo(Foo{});
// This does not work
&foo;
}

What geometrically are you referring to when you say curve, like a function?

Pyplot has a pretty robust drawing library so you might be able to do just do it with lower level functionality (possibly)

nice

>friend keyword
Looking forward to the "enemy" keyword in C++23

doing gods work templeos user

How can I use contour for multiple curves?

I know that contourf is supposed to be used for X,Y,Z data but in this case I have multiple Ys (a Y array for each curve).

Yes exactly. I've got a function (or rather multiple functions very close to each other) and I'd like to fill the space between each function (like in pic related) with colours but from a gradient.

Pic related is what I'm trying to achieve. But instead of the disgusting colours in that picture, I need a gradient. I need the colours to go from a black to white with some other lighter colours in between. I already have an array with numbers corresponding to each function/curve but I don't know how to use it

Attached: Deepin Capture-écran_zone de sélection _20190407154550.png (1375x757, 192K)

Building out a backend to a dashcam app. The backend is written in go and has a lot of useful CLI commands. (to start server, dump data, etc etc.)

A terminal UI like this (github.com/mum4k/termdash) would be perfect for a lot of the UI stuff I want to do but would still be out of the terminal which is easier then webshit. I'm considering looking trying it out.

templeos is deprecated now, we moved to serenityos

If they all sort of fall into one another entirely, couldn't you generate the raw lines from that function as a series of points, the two bordering lines (incremented in the same x direction) reverse one and slap it on the end of the other, and you have hopefully a clean polygon. Then style based on whatever constant you like.

I have experience dealing with raw geometries in pyplot, its not awful desu, but this may not be the most elegant solution admittedly.

I don't get it.
Are you saying that I could consider all the functions as one entity? I have no idea how I can do this.

How much time do you guys with jobs have to work on personal projects? I'm starting work tomorrow and pursuing a masters degree at the same time, so time will become extremely limited.

I'm in a noob level Java course. One of my linked list homework questions is this:

>Imagine a Node structure that, instead of containing one pointer to another Node, it had two pointers to other Nodes. What would the structure look like if you created several Nodes of this type and linked them together?

Mfw.

Attached: 1443815923279.jpg (385x383, 18K)

that's extremely vague. Is it talking about a binary tree? A doubly linked list? A (trimmed down) skip list?

Doubly linked list I think.

god I wish I was smart enough to make these

It is possible to name this function in expressions other than function calls if you redeclare the function outside of the friend definition.
struct Foo
{
friend
void foo(Foo)
{}
};

void foo(Foo);

void bar()
{
// This works again
&foo;
}
If you want to make sure that this function continues to only be usable as a function call, you need to make sure it is impossible to redeclare this function.
You may think you could include a private type in the signature for foo, you may be able to achieve this. But as a friend, any names usable inside Foo will be available when you redeclare foo.

At the same time, it may yet be possible to obtain a type which cannot be named again...

2/?

>can't take the address of a function
But why? I'm very serious on the question here, why would you want a feature to prevent someone from taking the address?

In C, no, there is literally no way to stop someone from taking an address of a function, because _why_. I have literally never heard of such a thing for any language.

shaders

Attached: 1545765144636.webm (803x625, 2M)

struct myfun {
myfun* operator&() = delete;
int operator()(int x) {
return x;
}
};
myfun foo;
void bar() {
int y = foo(1);
void* x = &foo;
}

you could maybe do it like this, idk if that's what you want

struct Foo {
void operator()(Foo) {}
}

It's a quirk of how name lookup works with regard to friend declarations. You may well call it a bug.

i am noob with programming can someone explain this to me?

>The merge-sort algorithm divides an n-element sequence to be sorted into two subsequences of n/2 elements each, sorts the sequences recursively and combines them to produce the final sorted sequence.

i can understand this working if n is some exponent of 2, but how does this work if n is an odd number or is not an exponent of 2. isn't merge sort also used to sort arrays with odd numbered elements? like how would merge sort handle the sequence [2,1,3,5,4]?

Attached: 1501108062252.jpg (800x450, 44K)

More details? OpenGL? what is it we are looking at? it looks like constant-value lines for something modeled by differential equations

Attached: UnlawfulPaleGnat.webm (900x456, 214K)

I didn't understand anything

Attached: 2mstpo.jpg (205x246, 8K)

You'll round up one array size (left or right: it doesn't matter) and round down the other.

>not including monkey sort, the objectively best sorting algorith

glsl yeah, just 4 simplex maps mixed together then drawing only one "layer" of it

how do you merge back sequences of unequal length? like

2 1 3 5 4
|
[2 1] [3 5] [4]
|
[2] [1] [3] [5] [4]
|
??? what after this step

youtu.be/kPRA0W1kECg

Does no one on the internet use F#?
I can't even find answer to very basic questions.

How do I include a C# library in an F# project?
I created a new solution, added an F# console application and a C# class library, and added the C# project as a reference in the F# project.
But Open MyProject still gives me "The namespace or module 'My Project' is not defined."
What gives?

>her language is single dispatch
youtu.be/S6Wx_J4Mk7U

Attached: 1534194805849.jpg (900x900, 79K)

I am guessing they are talking about a binary tree.

Exactly the same way as they were before they were split. When you implement the merge step, you'll find it comes naturally.

How can I pass http requests over TOR with java? In all the http libs I have found they either don't have a socks5 proxy or it just doesn't work. I'm running TOR as a service on linux.

Attached: lainpeeking.jpg (1520x1080, 74K)

Did they never hear of overloaded functions?

Nevermind, it just decided to start working all of a sudden.

Static dispatch is not dynamic dispatch. Comparing function overloading to multimethods is asinine.

Use a local HTTP proxy like privoxy which will do the socks5 part of it.

t. literal brainlet
You can't use overloaded functions for those special types you defined inside generic code in single dispatch languages, because anything inside the function doesn't know about the special type of your input arguments

Just watch the talk

How hard is it to make your own interpreted shit language from assembly like how C was made?

ackshually assembly itself is an interpreted shit language made from platform specific machine code

how do I split a 50 GB csv into at least one gigabyte several files?

does the split function loads the entire file first or it just load every chunk?

I fucking did it.
I have this array where each value corresponds to the "priority" of each curve that I'm plotting.
Using this bad boy

norm = Normalize(vmin=min_priority_value, vmax=max_priority_value)
plt.fill_between(x,y1,y2,color=cm.hot(norm(priority_array[priority_index])))


I get exactly what I want.
It doesn't create a gradient or anything but it lets you use a color map with your own custom values (max and min and everything in fucking between). Here I'm using hot but it could be anything.
Of course with this method, the more curves you plot, the prettier it comes out.

what IDE is out there that isn't broken or unusable?

Watch majority of it, he's slow to get to the point. At 45 minutes in he gets to comparing it and just says "well you can't do this generically" and complains that the function doesn't know the type which is insane. The type is known at function call. His own function requires typing and availability of the overloaded functions. I'm actually pissed I listened to you shitters.

I agree that he doesn't do a very good job at explaining it, but you're wrong.
>The type is known at function call.
It's not. Only the general type is known, which isn't what you want.
>His own function requires typing and availability of the overloaded functions.
Sorry, I'm not good at parsing written garbage. Yes, to do something with X by means of Y you generally need X in the first place.

split -b 1G [the file you want to split] [the desired prefix of the split files]

Something like project Euler but for string manipulation / parsing?

Attached: 1553138120319.jpg (1600x1272, 97K)

ok, how do I make this file usable for Keras?

Attached: pol csv.png (1400x868, 141K)

>split function
What language
And probably not

I just did it with ubuntu split function.

Look up lexical analysis I guess. I know the term "edit distance" is for comparing stuff for autocorrecting / spellchecking

You could try and implement a C preprocessor, or look up Perl exercises. I bet Perl has a lot because it's one of the most feature-rich regex implementations.

Assuming constant immediate, which is fastest?
_mm256_bsrli_epi128(r, 1);
_mm256_srli_epi16(r, 8);
_mm256_srli_epi32(r, 8);
_mm256_srli_epi64(r, 8);

Anybody here who has any sense with data manipulation?

I have an n-dimensional set of data, where n varies, wherein most points can be expected to lie somewhat near a 1-dimensional line because certain values will all be correlated together, and others will be close to an expected baseline. Let's assume the "correlation" is linear (unless there's an easy way to extend a solution to work with non-linear relashionships).
Now, in some cases an "independent" value might veer off the baseline, and/or one (or more) of the "correlated" values might end up way out of whack from what you'd expect based on the values of the other "correlated" variables, and I want to identify and isolate these outlier-type cases.
I don't necessarily know which variable is correlated or not. I could add that information, but it'd be inconvenient.

One thought I had was to add this information to one variable which I know is pretty much always going to be among the "correlated" set, and then divide everything by it. Given the linear relationship, this should "squash" the line into a point, "squashing" the distribution from a fuzzy cylinder-type thing into a fuzzy spherical thing. Then I just calculate the mean, and use the distance from the center to identify the outliers. Some of the individual variables might have fucked up distributions from the scaling, but since I essentially (made an effort to hopefully have) eliminated the "correlation", each variable should in theory be more or less independent, and I can consider them all independently using IQR or something.

Does any of this make any sense? Is there perhaps a known better way to solve my problem?

Please post more of these.

Attached: 1554131017821.png (946x887, 171K)

what a qt

print("This is a really long line of text that will " +
"Appear on multiple lines in the source code file.")

Sup ni/g/s Just started out & chose Python to begin with. Gonna finish this book & hopefully learn some basic stuff from this. Wish me luck anons

I'm procrastinating again bros

Attached: 1513982655694.jpg (526x701, 86K)

get in line

print("This is a really long line of text that will "
"Appear on multiple lines in the source code file.")

not today mothercukers NOT TODAY,

I have a list and I'm motherfuking doing it

I'm about to finish a project bros

Attached: 1512776068246.png (1200x999, 2.21M)

Thanks user! That also worked.
The book said use a + @ the end.. But that isn't necessary I suppose.. Thanks for training me not to write bloatware

Attached: sqlg_mysqldialect_validation.png (1882x806, 117K)

how do I use pandas to load a csv and just append a certain column to a single list array variable in python

Attached: 1553475994654.jpg (657x527, 40K)

youtube.com/watch?v=S9AjQTVXT1o

i once made a program to play compute shaders as screensaver.

Attached: 1543018222646.png (1679x1032, 899K)

Moar

latency for these are still unknown

idk python but I can assume you can just get the index of each column in an iteration over the csv, and then a simple if statement to push to the array

Lmao look at those procrastinators
I have a deadline tomorrow and I'm ALREADY working on it!

pls grant me motivation

does anyone use focalin here to program? It helps me some but not as much as my beloved adderall or vyvanse. fucking doctor and insurance won't give me it until I try focalin first

>get tested for adhd, procrastination is a key trait.
>go to doctor
>get script
>motivation

be careful though user, addiction is a slippery slope. make sure you eat healthy and exercise. I need ro run 2 miles today but I'm procrastinating the hell out of that because all I want to do is sit at my computer and program....fuck I don't even want to walk my dog, poor little doggie, I'll wake her in a little

I think I might visit the doc this week but I don't know. I can't even be bothered to do any work at my job, it's absolutely embarrassing and stressful
you think I might have a case to get prescribed something?

YES, the doctors love how you can't even be bothered to do work at your job, this is very important say how it's affecting your career.

thats what worked for me

but stims are a double edged sword user, be careful, it may fix some problems but it opens up doors to new ones you never knew even existed.

I think getting shit doneand maybe crashing and being somewhat depressed for a couple hours is far more important than getting very little done, risking your job, and risking your potential.

I know I'm fucking healthy but armchair psychology dictates that I apparently have ADHD and depression and probably schizophrenia or whatever. The most I actually have is probably asperger's, so I seriously just need to fucking work on my discipline and willpower.

It's tempting to just read up on symptoms and go to a shrink to get a bunch of pills prescribed. Regardless of whether they help or not, it might be fun. But it's also probably gonna be very unhealthy for my psychology in the long term

I also highly suggest deleting all social media, and limiting how much youtube/tv/video games you watch/play

it's a long road but I'm working on it

I'm already depressed and angry at work so sure, no problem
don't have any social media, can't even be bothered to play video games, only visit this hellhole
as long as they allow me to continue working out I'm okay

fuck yall who said I couldn't do it on windows. I am doing it, it's almost time to start writing code

Attached: so boring.png (1048x573, 130K)

did anyone actually try writing something for serenity?

Look up independent component analysis and principle component analysis

Of course you can code on windows. The languages aren't the problem, the problem is when you start using other people's libraries, windows is then an afterthought, and everything is made with unix in mind. Some libraries may not work properly on windows, and you'll run into loads of dumb issues because of it.

no