/dpt/ - Daily Programming Thread

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

Attached: 1BC49503-67C5-4919-AFD0-1FC8863B8E5E.jpg (1183x1193, 1.27M)

Other urls found in this thread:

instagram.com/miss.molerat
github.com/nodef0/gorillas-rs
base-api.io/
opentdb.com/api_config.php
youtube.com/watch?v=aWePkE2ReGw
pastebin.com/23zQux4P
opentdb.com/api.php?amount=5&category=9&difficulty=easy&type=multiple
syncfusion.com/ebooks/sql_queries_succinctly
twitter.com/SFWRedditVideos

Couldn't just wait for the last one to hit bump limit huh? Had to post early to make sure the next thread started with this slut.

Attached: Screen Shot 2019-07-25 at 12.36.25 PM.png (889x572, 328K)

just let this one die

post dick

I don't write D
instagram.com/miss.molerat

working on your mom

writing autotests using appium and ruby for clover for practice

Some of the comments on her pictures are the sole reason why I have a better chance with women off the internet. I want to thank every brother who tried his best to impress a women with a comment below her picture, because every time she looks down her phone she sees you and every time she looks up she sees me.

lol

I want to accelerate an application using gpu, so I'm learning openCL from some guy on YouTube.

If anyone familiar with it wants to suggest something I'm all ears.

Anyone moved from java to kotlin? Thoughts?

let. this. thread. die.
op is a beta cuck.

Good for her! I can't put my finger on why this makes me cringe though. Is it because of the Instagram normie descriptions, mixed with thinkpads and Gentoo?

why do women ruin my autism hobby for attention

Read OpenCL in Action by Matthew Scarpino. You can also look into simple matrix multiplication OpenCL implementations. Its all boilerplate to get started but optimizations require clever math.

This is a man

Any good porn webm databases?
pornh*b is pretty shit, the tags are useless and their search function is also garbage, which makes scraping and crawling challenging

i could sit down, brush up on tf and neural networks and maybe using google gpu's make a classifier but i can't be arsed

Sadly I've been employed as a software engineer for 3 years and have barely done any work in that time. I just essentially collect a free pay check :(

It feels bad bros. I'm super nihilistic and am trying my best to bring myself to sit here and study algorithms and data structures so I can get a job that actually interests me.

It is just so hard for me to get pumped about being a wagecuk at another company.

Feels bad.

Please install Gentoo on my computer

>tfw no code mommy who knows more than me to nurture me

>caring about the image at all
Please have sex

#!/usr/bin/env python
import math

print("""The year is 2050. Python's standard library has become so powerful it has developed sentience.
math.sqrt(._.) I've been a bad function, daddy.
math.sqrt(;~;) Please don't punish me!
Bad functions get invalid inputs. You know what to do.
""")
invalid_input = input("> ")

try:
invalid_input = int(invalid_input)
except:
print("""math.sqrt() quivers as you approach with a string.
math.sqrt(O_O) But master, there's no way I can process that!""")

try:
result = math.sqrt(invalid_input)
except TypeError as wontfit:
print("""You pass math.sqrt() your massive, throbbing string. Tears well up in their eyes as they gasp for air.
math.sqrt(XдX) {}, daddy!""".format(wontfit))
except ValueError as surprise:
print("""math.sqrt() thinks you're going to be merciful as you approach them with a number, but as soon as you pass it to them, they wince. Then, they twitch. Then, they scream.
math.sqrt(@o@) {}, daddy!""".format(surprise))
else:
print("""You pass math.sqrt() a positive real number, then gently stroke their function signature. You'd never hurt your favorite little function, you promise them. They look up at you adoringly.
math.sqrt(^u^) The answer is {}! Pass me more data, daddy!""".format(result))

Lisp is the most powerful programming language.

bad post

redpill me on golang

whats a good starter project to do with it? people keep saying its the greatest shit ever but ive been too lazy to learn it

For me, it's Lisp. The most powerful programming language. I even ask for extra parentheses and the community is so friendly and willing to oblige.

One time I asked for Lisp lambdas and they gave me three. I said, "Wow, three for free!" and the nice friendly Lisp IRC lurker laughed and said, "I'm going to call you 3-for-free!".

Now the IRC greets me with "hey it's 3-for-free!" and ALWAYS give mes three lambdas. It's such a fun and cool atmosphere at my local Lisp IRC channel. I go there at least 3 times a week for code snippets and a large macro, 1-2 times for debingging on the weekend, and maybe once for a scheme implementation when I'm in a rush but want a great embedded language that is beautiful, fast, and can match my computational needs.

I even dip my procedural programming in Lisp, it's delicious! What a great language.

How do I get a MIT/Caltech genius coder gf?

Attached: katieboumanfacebookmain_resize_md.jpg (744x389, 58K)

C is comfy
#include
#include

// vape shit

int main(int argc, char ** argv) {
FILE * in = fopen(".puff", "r");
int puffs; // in thousands
fscanf(in, "%d", &puffs);
fclose(in);
in = fopen(".puff", "w");

if (argc > 1)
for(int i = 1; i < argc; i++) {
int n = atoi(argv[i]);
puffs += n;
}
else
puffs++;

fprintf(in, "%d", puffs);
printf("%d\n", puffs);
fclose(in);
}

marky?

typedef struct Srv {
Tree* tree;

void (*attach)(Req *r);
void (*auth)(Req *r);
void (*open)(Req *r);
void (*create)(Req *r);
void (*read)(Req *r);
void (*write)(Req *r);
void (*remove)(Req *r);
void (*flush)(Req *r);
void (*stat)(Req *r);
void (*wstat)(Req *r);
void (*walk)(Req *r);

char* (*walk1)(Fid *fid, char *name, Qid *qid);
char* (*clone)(Fid *oldfid, Fid *newfid);

void (*destroyfid)(Fid *fid);
void (*destroyreq)(Req *r);
void (*end)(Srv *s);
void* aux;

int infd;
int outfd;
int srvfd;
int nopipe;
} Srv;

int srv(Srv *s);
void postmountsrv(Srv *s, char *name, char *mtpt, int flag);
void threadpostmountsrv(Srv *s, char *name, char *mtpt, int flag);
void listensrv(Srv *s, char *addr);
void threadlistensrv(Srv *s, char *addr);
int postfd(char *srvname, int fd);
void respond(Req *r, char *error);
void responderror(Req*);
void readstr(Req *r, char *src);
void readbuf(Req *r, void *src, long nsrc);
typedef int Dirgen(int n, Dir *dir, void *aux);
void dirread9p(Req *r, Dirgen *gen, void *aux);
void walkandclone(Req *r, char *(*walk1)(Fid *old, char *name, void *v),
char *(*clone)(Fid *old, Fid *new, void *v), void *v);

#include
#include

void die(char *reason) {
fprintf(stderr, "%s\n", reason);
exit(1);
}

int main(int argc, char **argv) {
FILE *in = fopen(".puff", "r");
if (!in)
die("Can't open .puff");

int puffs;
if (!fscanf(in, "%d", &puffs))
die("Can't read from .puff");

if (fclose(in))
die("Can't close .puff after reading");

in = fopen(".puff", "w");
if (!in)
die("Can't reopen .puff for writing");

if (argc > 1) {
int i;
for (i = 1; i < argc; i++) {
int n = atoi(argv[i]);
puffs += n;
}
} else {
puffs++;
}

if (!fprintf(in, "%d", puffs))
die("Can't write puffs to .puff");

printf("%d\n", puffs);

if (fclose(in))
die("Can't close .puff after writing");

return 0; // Because we are not barbarians goddammit
}

just start working on projects bro, use your time to make somthing

So in C this error message is being displayed no matter what the user inputs so even when the user inputs a valid character to navigate the program they'll get this error message.
if ((Input < 'A' || Input > 'E') || (Input < 'a' || Input > 'e'))
{
printf("\nSorry but that is not an acceptable option, try again\n");
scanf(" %c", & Input);
}

I suppose having conditions nested like this is a bad idea but dunno what else to do.

Attached: 1331092300995.gif (367x255, 158K)

I accept most of the changes except this
> else {
> puffs ++;
> }

also, although this code does handle errors, you can't deny its uglier than the original

what are the chances errors might happen, anyways?

nobody can do that
also
post posting in shit thread go here

you should do tolower(Input) < 'a' || tolower(Input) > 'e'

Having braces around one branch but not the others is a style smell because it easily leads to a "goto fail" scenario
In fact if I could force braces around all statement bodies I'd rather do that
Damn the torpedoes

can somebody explain the difference between the ternary operator (?) and if

what's faster -- a switch that has been optimized to a jump table, or calling a function pointer with one argument?

depends if the function gets inlined or not
but usually the first

In Java the ternary operator only works to decide an assignment to a variable. if can work for any block of code.

Why can't women eat before they sit down to computer.

>What are you working on, Jow Forums?
Refactored the code in order to have a game menu, for now it just pauses the game, but it's a step in order to have bot opponents and other fun stuff.
Also, discovered a bug when firing at certain angles, while recording the webm (see the first shot).
Now it's time to go wagie for a bit.

Attached: pause.webm (800x600, 469K)

inspired by w0rms?

Think of the ternary operator like a little function with weird syntax.
tern(bool test, auto true_result, auto false_result) {
if (test) {
return true_result;
} else {
return false_result;
}
}
You can think of it as a function because the ternary operator only works with expressions. Based on the result of one expression, it evaluates to either a second or a third.

if, on the other hand, works exclusively with blocks of code. An if statement doesn't give you anything back by default, it just does stuff, so to speak.

thats like the tank game i used to play

it's a mix between gorillas.bas and the other similar games (like worms, scorched earth, etc)
github.com/nodef0/gorillas-rs

i feel like implementing this in three dee

Are there any notable programmers that don't use Git?

lol just cheat and use tensorflow. werks gud enuff for me and you can impress dumbshit normie managers by waving the artificial intelligence (package) meme in front of them.

I don't

>can split and unsplit by space and newlines but not by arbitrary characters
>had to define my own split
split :: Eq a => a -> [a] -> [[a]]
split _ [] = []
split y xs = l : split y (if r==[] then r else tail r)
where (l, r) = break (==y) xs

unsplit :: a -> [[a]] -> [a]
unsplit y = concat . intersperse [y]


haskell should have more shit in the standard library desu

Added a toupper() after every user input and change the program to work with uppercase but know the toupper() function is the one that is not working.
Am I using it wrong?
if (Input > 'a' || Input < 'z')
{
toupper(Input);
}

Attached: 1304650665442.jpg (640x480, 57K)

Alright, /dtp/, what the fuck do I do?
I've taken intro to programming, data structures and discrete math, along with most of the math requirements for my B.S. I'm not taking algorithms until October, so what the fuck do I do until then? I feel like I should be writing programs to get the practical experience that my CS degree isn't giving me.
Should I pick a project idea and just stick with it?
Thanks for reading my blog.

Attached: 1555803764517.png (500x504, 327K)

how can you use a data structure if you haven't learnt how to use an algorithm yet

I know what an algorithm is, but I haven't taken the "analysis of algorithms" class yet. At my school, data structures and algorithms are two different classes.

what are you even trying to do?
there's already functions defined for char type in ctype.h

>toupper(Input)
that's not even doing anything, its like doing this
if(some_condition)
1 + 2;

you need to do something with it
return it, store it, or I'd wager you want something like this
if (Input > 'a' || Input < 'z')
{
Input = toupper(Input);
}

Fucking poser.

does
FILE * stdin = fopen("some_file", "r");

allow for the use of scanf but it will use the newly open file?

Well I didn't now how to call toupper before this but seems your last example will work for me.
I'll try it out tomorrow, I'm off to bed
thanks

Attached: 1481736248029.jpg (180x200, 13K)

Can somebody confirm that
nubBy (/=) xs = takeWhile (== (head xs)) xs = head (group xs)

Just found this on product hunt. base-api.io/

This seems SO useful! I can pretty much run my basic web apps between the browser and base

Is this legit?

Yeah, and you can't
But keep believing

i can't cope with shit code

this is not the profession for me

>>>/wdg/

c++

I'm fucking drowning in pointless abstraction. Fuck most C++ users.

dont hate the game, hate the player

pick 3: analysis of algos, parellel programming, cryptography or machine learning

I have to decide on classes to finish my minor. I am pretty set on algo analysis and parellel programming. i may end up taking both crypto and ml anyway, but help me decide

Checks if string is a valid IPv6 address.
Does this work for all edge cases?
def validIPv6(ip):
validHex = '0123456789abcdefABCDEF'
totalColons = 0
repeatedColons = 0
segmentLength = 0
condensedZeros = 0

for char in ip:
if char == ':':
if totalColons == 8:
return False

if repeatedColons:
if repeatedColons == 2 or condensedZeros == 1:
return False

condensedZeros = 1

totalColons += 1
repeatedColons += 1
segmentLength = 0

elif char in validHex:
if segmentLength == 4:
return False

segmentLength += 1
repeatedColons = 0

else:
return False

if condensedZeros == 0:
if ip[0] == ':' or ip[-1] == ':':
return False

if totalColons != 7:
return False

elif totalColons == 8:
if ip[:2] != '::' and ip[-2:] != '::':
return False

return True

IPv6 is gay

If anyone wants to make a project that will DEFINITELY be used by people, here it is:
Make a statically-typed version of Clojure.

Attached: cat eye.jpg (650x520, 63K)

I'm surprised analysis of algorithms isn't a required course.
Parallel programming could be a big headache depending on what languages you use. Some languages make it easy (e.g. Clojure, Erlang, Haskell) while others make it hard (most languages).
Machine learning is an area that's hugely growing.
Most programmers don't write cryptographic systems themselves so I don't know how useful it would be unless you're into blockchain.

What is your major? What would be useful in relation to that?

and every time you look down you see a dick

That would not be a lisp.

Gee... I wonder where was the problem all that time.

Attached: Capture.png (466x422, 14K)

if (argc > 1) {
int i;
for (i = 1; i < argc; i++) {
int n = atoi(argv[i]);
puffs += n;
}
} else {
puffs++;
}

pretty sure c89 requires you to declare all local variables at the top of the function

Trying to call this API opentdb.com/api_config.php to make a quizz in winforms with C#, never used APIs before.

I watched this guys video and tried to replicate what he did but it's not working youtube.com/watch?v=aWePkE2ReGw

Here's my code: pastebin.com/23zQux4P
Here's an example of how the .json looks like: opentdb.com/api.php?amount=5&category=9&difficulty=easy&type=multiple

When I hit the submit button to test if I get any data back or not it says System.NullReferenceException: 'Object reference not set to an instance of an object.' 5__1 was null.

Not sure if the problem is because of naming conventions in the model, or maybe because this API has square brackets which I coded as List but maybe they're not lists idk. p-please help

Attached: asdfas.png (666x667, 121K)

There are already people making statically-typed derivatives of Clojure, but they're too experimental to satisfy people seeking a language "just like Clojure, but statically typed."

nice colors

Why do women do this? Why can't women ever be satisfied with doing something right?

Great, you use a ThinkPad with Linux, so you took a picture in your garden, making sure to put ""healty food"" and flowers next to it, while wearing a fucking choker, showing side-boob and wearing fake ""Lol, I'm a nerd XD"" glasses.

We've all been using Linux on our ThinkPads and disucssing it on this god-forsaken website for 1.5 Decades. Other than a couple of fruitcakes posting their Gay-As-In-Homo programming socks, the men on this forum never feel like doing this shit. And the few women that we do have in these threads manage to just make informative conversation....

Femoids piss me off sometimes.

My next semester has three modules on Database systems with SQL, Information security and also Networks and Data Communications. Do any of you guys have any recommendations for some brief roughly 200 page introduction books to each of these subjects?

Attached: 1540193059584.jpg (1804x1200, 176K)

Purpose of these pictures is to show off.
So everything you get to see is this kind of people.

Go to MIT or Caltech yourself

there's a free online courses for networking and databases on stanford lagunita

good point

>oh no a woman with computer making selfies
>hate women, such sluts
Don't delude yourself into thinking that there aren't any women who use thinkpads, browse Jow Forums but don't post slutty pictures all over the place. You just don't know of them for obvious reasons.

SyncFusion has a whole series of short books about various topics. Here is one. I recommend perusing the titles of the others.
syncfusion.com/ebooks/sql_queries_succinctly

>Women
Yeah dood feminine penis

Obsessed incel

Checkout fscanf if you want to use scanf on different stream than stdin.

Okay tranny we will never accept you

>women

I have a collection of ~50k objects that each hold an array of no more than 100 normalized vectors. This will never change at runtime. Given an input stream of normalized vectors, I want to keep narrowing down this collection to find the objects that have the most similar vectors to the input.

Brute force way: Keep a score for each object. Each time a new vector is read in, iterate over all objects and increment its score if it has a similar vector (and how similar it is). Pick k objects with the current highest scores.

How can I optimize this?

do a one to one comparison of a cosine of the vectors. The vectors with the smallest angle are the most similar

Don't really have a problem with determining if a vector is similar, rather I want to minimize the number of comparisons done.

Haven't tested it, since dotnet fiddle refuses to load System.Net.Http.Formatters. But I assume it's because your QuizModel class does not look like the results from the API.
The api returns {"response_code":0,"results":[]}
So your QuizModel should probably have a Results property.

move to

The creator of Clojure thinks that static typing is not the answer. Also clojure has spec.