/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Last thread:

Attached: 1549376805918.jpg (624x875, 245K)

Other urls found in this thread:

gitgud.io
docs.oracle.com/javase/tutorial/java/IandI/hidevariables.html
twitter.com/NSFWRedditVideo

first for subscribe to pewdiepie

nth for Nim!

Translating my Haskell program to C after sucking miles of cock. Next I’m going to change my programming socks and maybe learn APL because I’m gay AND a shitskin.

Attached: 1552342057661.jpg (425x564, 40K)

Why does Jow Forums always post the shittiest OP pictures?

Thinking about adding POD structs to my dynamic language, they would work as follows:
struct Foo = (a, b)
let foo = Foo()
foo.a = 1 // OK
foo.b = 1 // OK
foo.c = 1 // Runtime error

Essentially a hashtable with fixed keys.

your data constructor should take values i think

>runtime error
if this was compile time, a perfect hash table would be nice and fast

That's a good idea, but I'm not sure how would I make some values optional at the time of construction, maybe I could use named arguments a'la Python, where you could so something like:
struct Foo = (a, b)
let foo = Foo(b=2)
foo.a // null
foo.b // number 2

>Jow Forums
as opposed to the /dpt/ images on /ck/?

Remove null so you won't have this problem.

why are you making a language

I guess that's true, I could just ensure that the values are always initialized, I'll have to think about it some more before I get to implementing it.

Partially for fun, partially because I like some parts of Lua and Python but I also hate a lot of things about them, so I'm building a language on top of Python runtime, basically inspiring myself by both while trying to address my issues with these languages. Eventually I'd like to use it as my goto choice for scripts, running on top of Python I could easily make module interop with Python's modules so I wouldn't sacrifice any libraries.

>a scripting language ontop of Python
would that be the slowest language ever made?

It would definitely be not fast, but at the same time, I could port my standard library to Lua and write my language => Lua compiler to run via LuaJIT, which is quite fast. Obviously at that point I'd be sacrificing third party libraries available from Python interop but you could make a concise choice for that for when you do tasks that need to compute things fast. I'm not sure though, I'm just toying around. For now it can only do simple things and I'm now just collecting my thoughts before I move on so that I know what I actually want to do.

Lewd

But that's not a /dpt/ image. There are a bunch of actual OP images that have been used over the years, then every so often you get these degenerates coming in and hijacking every thread on Jow Forums to spam shitty images.

Working on meh music recommendation system still. We ended up optimizing our neo4j code instead of switching to a different graph db. I think we are one of the first people to implement the Bolt protocol in Rust. Once it finishes inserting, we'll probably start mirroring important fields in Elasticsearch, and start playing around with Phoenix.

To give an overview of the data we've collected from bandcamp so far, we have 1 million users, ~3mil albums, and 30mil transactions (user-[:OWNS]-album). About 66GB of data. Once we get the important fields in neo4j mirrored in elasticsearch, we'll probably download tags.

Attached: sworlySample.png (1140x674, 140K)

Fuck off.

sorry, we'll use the yuki backflip image next time.

Attached: unflip.jpg (1074x1149, 296K)

Protip: Compiling shit is real fucking fast. JIT compilation only has a strength as a dynamic runtime binding, languages like Python that are never actually checked until the code attempts to execute are fucking retarded. Do not emulate it. Build on top of it if you must, but please enforce proper *compile time* type checking.

>*compile time* type checking.
he said it's a dynamic language

Can it perform the Sieve of Eratosthenes in 4 lines of code at C tier speed?
primes max = i 0 j 0 l 0 t 0:
:: l @m *[t] max 8
?? [i 2 max] !:l[i 8] 1
?? [i 2 max] ?? [j *[t] i 2 max i] !:l[j 8] 0
l

Dynamic languages still have compile time type checking buddy. JIT compilation units obviously don't, but the rest of the program you've written that can be statically analyzed should have those checks in place. Just because part of your program will have to have runtime checks doesn't mean you should rely exclusively on them, because that's fucking stupid.

>in 4 lines of code at C tier speed?
Obviously not.

>Dynamic languages still have compile time type checking buddy
most of them don't
what's a dynamic language without dynamic typing

This one is pretty good and old too.

Attached: feet.png (934x1000, 265K)

Trying to wrap my head around how to actually implement an rb-tree

Is Kotlin completely interchangeable with Java?
If I try to build a Spring Boot server using Kotlin, will it eventually turn into extra headache?

theres literally no reason to use pozlin

Is he going to het banned like Pepe on here now?

I still want to know what a stylesmith is.

>stylesmith
who or what is this?

My gradually typed language has something similar.
I think the emphasis on open classes in languages like Ruby is a weakness.

is quicklisp actually protected against MITM now?

My laptop is about ded, and I wanna get something to run linux to learn programming. I'll probably get an XPS 13 or some thinkpad, but how important is RAM?

I'm just fiddling in python now, but I'm slowly learning C++ as well, and I wanna do VMs and shit too.

Will 8GB be enough to run a few VMs for server stuff, or will it chug without 16GB? (Or will they soon chug? Since these newfangled small laptops don't seem to have upgradeable RAM)

Attached: baka.jpg (853x480, 276K)

I think you got the wrong thread buddy, the computer building thread is two blocks down

Does it have package signing?

i don't think it did

Screenshot this and post on reddit "I did my part!"

Not to say no, but you have 2 options when you don't have package signing from the devs and they both rely on X.509 certs.
>It's entirely centralized in a single place and you're depending on TLS for authentication.
or
>Each package has a hash and the hash is distributed by a "secure" channel(likely TLS).
It's not likely to happen but the 50 "trusted" CA certs you have on your system can each sign a phony cert to MITM you.

fucking cringe

Fuck off retard

For about 3 days there was an autist that did nothing but post mock /dpt/ threads with a completely irrelevant image designed to piss people off.

Like an image of the 2007 animated film "Surf's Up" as the OP image.

The threads were exactly the same save the image. But it ruined everything.
People were constantly debating whether to create a new one and you'd get 50 posts in before it just got abandoned. And then the new thread would also be made by him.

He literally never got tired of it. Atleast for 3 days.
I don't want to rustle him. Just accept a non-anime image.

Guys, what is getEmployee function supposed to be?

Attached: file.png (1471x420, 126K)

>For about 3 days there was an autist that did nothing but post mock /dpt/ threads with a completely irrelevant image designed to piss people off.
Oh no! This is horrible, how did you ever survive such an experience?

[insert umaru reddit dpt]

Attached: 1551317394633.gif (500x398, 996K)

it doesn't matter, that's the point. it's just an example.
>assumes the existence of a function called getEmployee

I don't understand why it's a pointer

I didn't give a shit about the image, it just completely de-railed the thread

Half the posts were about the one guy and the posts that were actually about programming were ignored because everyone was just waiting for the actual thread to be made

He managed to completely dismantle /dpt/ for the span of about 72 hours. I'm glad he stopped because I don't know what could be done to stop it except for banning people that post off-topic images.
I'd prefer to stop talking about this before anyone else gets any ideas.

it's literally just a function that returns a pointer, what is there not to understand you brainlet

dumb umaruposter

because getEmployee returns a pointer

The umaru OP with the reddit links went on for a long time, not every thread but like every 4th thread for like almost a year. Your 3 day shitpost thing is small time.

Attached: 1549553265661.png (356x350, 113K)

stupid umaruposter

I'm trying to find a programming job but I don't have anything on github yet to show to potential employers.

Problem is that I haven't done any intermediate to large projects. I only have a couple of websites and some scripts which are 100-200 lines of code. Should I just put those on github or try to come up with something larger?

>Boobs
dropped

>every python library worth using is just a thinly wrapped C++ library
>documentation is all in C++

If I knew C++ why the fuck would I be using python?

Attached: 1543459234533.png (499x322, 28K)

can you list some, i don't remember seeing c++ docs

brainlet from the previous thread, still having a rough time with this moving average interface. I should probably go to bed, but if anyone wants to lend a hand, I would welcome it.

This what I have. Basically been dicking around half asleep.

#include
#include
#include


// Interface for moving average


typedef struct __mavg_ctx__ {
double *arr;
double sum;
size_t frame;
} mavg_ctx;


void mavg_init(mavg_ctx *ctx, size_t wsize) {

ctx->arr = calloc(wsize, sizeof(double));
ctx->frame = wsize;
assert(ctx->arr != NULL);
}


void mavg_update(mavg_ctx *ctx, const double *data, size_t dlen) {


for (int i=0; iframe; i++) {
ctx->arr[i] = *(data + i);
ctx->sum += ctx->arr[i];
}

}


int main(int argc, char *argv[]) {

mavg_ctx ctx;
size_t wframe = 3;

int dlen = 6;
double sample_data[] = {2, 5, 4, 6, 8, 7};

mavg_init(&ctx, wframe);
mavg_update(&ctx, sample_data, dlen);

for (int i=0; i

Attached: nerves.jpg (2048x1536, 335K)

What do people usually do in the catch block of a function in C++? The compiler is warning me that I'm not returning anything if it goes to catch, which is fair I guess, but I don't know what to return if the main part of the function fails.

so don't handle the exception, or return an optional instead

Not him, but PyQt5's documentation is pretty much all stubs referring you to the Qt documentation

ctx->sum is used uninitialized.

If you don't have anything sensible to put in a catch block don't write one

Yeah you're probably right, I won't catch anything then. Thanks

Also, should I use github, gitlab or bitbucket?

fucking HATE animal shitters

most animals are shitters

Suck some dick.

Hi, i am trying to learn about maschinelearing with anaconda but pycharm is behing a bitch.... again.
Maybe i am just to stupied.
Can someone recommend a IDE that sucks less dick ?

vscock

VS Communism for windows and Mousepad for Linux distros

I can´t beleve i fell for that... i will see myself out :-)

not that important. what really does matter is the technical interview.

GitGud
gitgud.io

Attached: GitGud_Front.png (700x700, 53K)

is she naked?

Go be gay somewhere else.

qtcreatorfag here
how bad is vscode for c/c++ nowadays?

8gb is fine if you don't use gui in the VMs or if you use docker to run the server stuff.
t. someone with 8gb ram

that is none of your business

who cares about business

It is shit compared to QtCreator.

return new Employee();

I'm not sure there is anything better than QtCreator. It's absolutely the shit. I've written over 40'000 lines in it over the last 6 months. Never been this productive in my life.

Template names can not only occur after a :: but also after a -> or . in a class member access. You need to insert the keyword there too:

this->template f(); // call a function template


I don't get it. When does one use template keyword after . or ->?

When the type of the left hand side of the operator is a template parameter, therefore the right hand side is a dependent name. This is only necessary when you explicitly give parameters to the member function template.
struct Foo
{
template
void bar()
{}
};

void baz()
{
Foo f;
f.bar();
}

template
void qux()
{
T f;
// not okay
// f.bar();

// okay
f.bar();
// okay
f.template bar();
}

public class Main {
public static void main(String[] args) {
Pet dog = new Dog();
Pet cat = new Cat();
System.out.println(dog.printName());
System.out.println(cat.printName());
}
}

public class Pet {
private String name = "PET";
}

public class Dog extends Pet {
private String name = "DOG";
}

public class Cat extends Pet {
private String name = "CAT";
}

Why do both print PET? Shouldnt they inherint the printName function but use their own String since it hides The String from Pet?

I was asked to create a survey that generates a PDF report once it's completed.
This is what I got so far.
However, some of the later survey questions have more complicated answers than yes or no and I can't figure out how to make it display a choice of answers rather than a text box.
Also I don't know how to add a question mark at the end of the Template Tokens.

Attached: 1552672013564.png (748x876, 73K)

forgot this in PET

public String printName() {
return this.name;
}

Instance variables don't override. Only methods can be overriden.

but
docs.oracle.com/javase/tutorial/java/IandI/hidevariables.html

Or am I misunderstanding something?

Shadowing isn't the same as overriding.

So I have to override the printName() Method in every class that inherits from Pet?
Sorry but this vocabulary with hiding, overriding and shadowing is very confusing.

Hiding is the same as shadowing.
Take this code.
public class Pet {
private String name = "PET";
public String printName() {
return this.name;
}
}
this.name always refers to the name that is defined within Pet. Declaring another variable called name in the subclasses creates another variable, it does not replace the original.

Methods in subclasses with the same signature override the method in the base class with that signature. The original method is replaced, and so are all usages of it in code.

What do you guys do be better at programming when you can't program? Were having stage 4 loadshedding again, which means an average of about 6h of no electricity during the day. I spend this time mostly sleeping, phone posting, and reading ebooks, but it feels like so much wasted time.

anime

Attached: unknown (2).png (195x150, 49K)

Read books about big programs. I liked "The Design and Implementation of the 4.4 BSD Operating System" for example.

JavaScript for the first time, coming from PHP, drop some knowledge please