/dpt/ - Daily Programming Thread

What are you working on?

Attached: 1526549135182.jpg (1920x1080, 414K)

Other urls found in this thread:

trends.builtwith.com/framework
benchmarksgame-team.pages.debian.net/benchmarksgame/faster/python.html
techempower.com/benchmarks/#section=data-r15&hw=ph&test=db
twitter.com/NSFWRedditVideo

Reminder that java can't even cross platform console beep

Toolkit.getDefaultToolkit().beep();
????

building my "self-taught" portfolio

Added arrays to my Lisp interpreter. Also, here's a piece of code that generates cddar-style functions to an arbitrary level:
(let [crutch (fn (n)
(if (sym (str "c" (apply str cs) "r"))
funs (single-map (fn (c) (str->sym (str "c" c "r"))) (reverse cs))]
(eval `(def ,name (compose ,@funs))))) set)
(crutch (- n 1))))))]
(crutch 3))

Thats the only thing node.js got right, async everything. Too bad they used crappy JS to make it. Async everything + event loops + message passing is a very good model for building applications that are fast and fault tolerant, which you need for big systems. Vert.x does everything node.js does but better, since there's no real equivalent to it in C# I'd use Java everytime over C# for big boy applications

trends.builtwith.com/framework

Attached: 8KTtscB.jpg (600x315, 10K)

>You only need servers for customer facing websites

No wonder you webshits are delusional, you only ever touch the tip of the iceberg

Explain pointers to a brainlet pls. I wanted to do excercises from C++ stroustrup book, and excercise is: make function that swap ints, and arguments are pointers to int. Another swap function has references to ints as arguments.
Why does that not work?? Please answer please!
#include
using namespace std;


int swaps_p(int* a, int* b) {
a*=b&;
b*=a&;

return &b;
}


int main () {

int *a;
&a=50;
int *b;
&b=60;
swaps_p(*a,*b);

return 0;
}

>vert.x
>muh responsive async design
>no equivalent in C#
Welcome to plain old ASP and the async/await world.
Man it must be tough having to install a bloated unheard of framework just to mimick adding "async" modifier to a controller in ASP

Attached: ec0c59bf33ed44f9ae05212a7f05534371a335a7_hq.gif (540x540, 1.05M)

I have a list in Python that is basically like the following:
lis = ["# section 1", "link1", "link2", "link3", "# section 2", "link4", "link5", "# section 3", "link6"]

What's the best way to group together the sections with their respective links? For example:
["# section 1", "link1", "link2", "link3"]
["# section 2", "link4", "link5"]
["# section 3", "link6"]

I need Sento to choke me with her fat thighs

>i-it must be out there somewhere!!! It is somewhere!!!
So pathetic

Replace & with a *

Only add a and b, with no *

>a framework to mimick literally just "async" keyword
javeesh BTFO

the repeating numbers are swapping with itself.

correction. with each other

Not allowed!

Attached: Amagi_brilliant_park-Isuzu_Sento_3.jpg (1024x1400, 345K)

If ASP had properly implemented async I/O it wouldn't be so fucking slow in benchmarks. Vert.x also isn't a framework

Netflix, Amazon, Google, Bosch, Siemens all have largely Java based backends

Yeah, that's pretty much it. do ... while ensures that indexes move by at least one each iteration and prevents a deadlock.

I want to choke fat Senko with my thighs!

Google is switching to Go because java was too slow for their bots and string operations and ASP is still the second most widely used web framework.
>implemented async I/O properly
Java doesn't even have async/await at all but even then they would implement it badly.
Pic is a month old comparison of server startups and operations on AWS Lambda
Try beating Python LOL or at least node.js that you are shitting on

Attached: 0_1YuoubeiC1RDxWvG.png (800x373, 72K)

>Why does that not work???
Because you have no idea what the fuck you're doing. Learn how to type correctly, indent code and then maybe I'll think about explaining basic shit that has been explained one thousand times already everywhere.

Why do I get the feel that the next OP image is a javeesh attempt to save face after getting btfo on both web and desktop?

>python is faster than go and java
ok buddy

>aws lambda
gee i wonder why in serverless JIT compiled java isn't useful
Retarded benchmark, that's like saying python is faster than java, because it does a program with return 1+1 faster

Perl 6

>Google is switching to Go
False, only for select applications. Also no generics lol.

sorry, i pasted it from vim, where intending was fine

>java isn't useful
Yup

>python is faster than java
>this is a controversial statement

Java is the Unity of programming

Banking, Big Business and HFT disagree with you

benchmarksgame-team.pages.debian.net/benchmarksgame/faster/python.html
You're delusional if you think python is faster than java

Don't burst javaboi bloated safe space!
They have no idea what django can do and how easy it is.

>legacy code
Indeed kid.

>django
techempower.com/benchmarks/#section=data-r15&hw=ph&test=db

>16%

Python babies are delusional. Learn a real language and not babbies first programming course.

>benchmarking hello world
you are stupid

You clearly don't know how server benchmarks work.
>can't win a hello world server response benchmark

I want get stepped on by a cute haskell programmer (girl . male)

Anyone got a good recommendation for a python crash course for a complete newbie? Friend needs to learn the basics over the weekend and I don't do much coding.

Legacy code is where the money is you dolt. The megacorps aren't switching to your numale language just because it offers syntactic sugar

>haskell programmer steps on you
>breaks every ribcage, and also the floor

Search for 'python tutorial' with your search engine of choice.

teaching myself with pic related, right at the beginning, but i can't get this to work

#include

/* count characters in input; 1st version*/
int main()
{
long nc;

nc = 0;
while (getchar() != EOF)
++nc;
printf("%ld\n", nc);
}


it compiles fine but when i make an input it doesnt print anything

Attached: 9780131103627.jpg (491x648, 63K)

Because it reads until the end of the file. You can close stdin with Ctrl+D on Unix. Or alternatively you can use stdin redirection through < syntax to make it read a file from your disk.

Blessed those digits. java BTFO

Attached: 2d432301ebd9b155fb3e1c49aa2be15f1230806290_full.jpg (630x330, 92K)

ha

super noob checking in

why do I keep getting this error: invalid operands to binary expression for the two printf lines near the end of this

#include
#include
#include
#include
#include

int main(int argc, string argv[])
{

if (argc != 2)
{
printf("Error: key required. \n"); // check for 2 args
return 1;
}
else
{
string k = argv[1]; // k constant command-line argument assignment.
int key = atoi(k); // str -> int conversion.

string plaintext = get_string("plaintext: ");

int plainLength = strlen(plaintext);


for (int i = 0; i < plainLength; i++)
{
printf("ciphertext: ");
int letter = plaintext[i];
if isalpha(letter)
{
if isupper(letter)
{
printf("%c", (((letter - 65) + k) % 26) + 65 ));
}
else if islower(letter)
{
printf("%c", (((letter - 97) + k) % 26 ) + 97));
}
else
{
printf("%c", letter);
}
}

}
printf(" \n");
return 0;
}
}


sorry if that's too long. I've checked the answer online and loads of people use the modulo operator exactly like I have

reminder

Attached: dont build your career on dpt aka cs undergrad general.jpg (1872x3650, 1.81M)

probably your ifs above it

if (isalpha(letter))

what are you trying to say here

>shills even for bad things because it is a feature of his favorite poo
How much of a fanboy can you be, delusional faggot?
You clearly haven't worked on anything at all. Not even legacy code.

also, your parentheses are not balanced

damn the US is truly the superiors white man country.
So many jobs for your favourite meme lang.

>Join us! W-we're fun!
It is the javalet goto when they try claiming java isn't shit (hence posted all the time)

Explain to me how legacy code which will be in need of modular rewrite to be more modern is a bad thing for employability.
But you're right, I'm not working on legacy code, but on a modern CMS, we're currently at the We're developers conference in Vienna.

thanks, both were mistakes but didn't seem to fix the problem.
the full error message is error: invalid operands to binary expression
('string' (aka 'char *') and 'int')
so I am assuming I have declared something incorrectly or forgot to, I just can't spot it (probably because I've been staring at itfor the past two hours.)

> we're currently at the We're developers conference in Vienna.
Were you invited to the post-con gay orgy?

>explain how maintaining legacy code is bad
>explain how rewriting is bad
Fucking underage GTF

int letter = plaintext[i];
if isalpha(letter)

I would have used "union class" similar to "enum class," but I have to admit "enum union" makes more sense. It's not a perfect proposal though, for example "enum union" has hidden memory overhead (although that's similar to vtables I guess). In addition, there's implicit-no-fallthrough for cases which while it makes sense _in this specific case_ is counter to how labels are used in the entire rest of C++, so I'd go for more complex syntax to allow implicit fallthrough simply to match the rest of the language.

k has string type so you can't add it to a number. you should convert argv[1] to int in the first few lines

>Legacy Code is bad
>Rewriting is bad also

You make no sense at all.

I am writing a socket client in C++ and I am wondering what the right way to make it generic is.

It is for a client server thing where I know what the in/out will be, or at least the format.
From the client side, I will construct a string and send it.
It will always be met with a reply in form of a formatted string.

Now I have all that in a class, but I am on the fence with how I should make it clean.

Right now, I have a void function pointer and a void pointer to a class in the client class.
This means the client can overwrite the values in a class using a function written for this class.
Is this just a lazy way to avoid inheriting the class into another client class?

>want to program in chapel
>it can't use libraries compiled form it
FUCK

Is there a bigger meme than self-teaching AI?

the way hacking is done in almost any movie

Ah you got it. I converted it with int key = atoi(k); but was using k instead of key in the print lines. Thanks again

All the job posting and you have no experience at all. This is the state of java fanbois

wait, i just noticed you already do. you probably meant to use key instead of k

tech plugs

uh
one, if you're going to use function pointers, use std::function instead because that works with both functions & lambdas
two, don't use void* to refer to typed objects — if you need to, *generally* that means you've probably made the design more complex than it needs to be
three, not enough info to know if you have made it too complex or not, but I suspect so because I've written an HTTP server in C++ and didn't have to do any of that

>one, if you're going to use function pointers, use std::function instead because that works with both functions & lambdas
can't lambdas be converted to function pointers using unary + operator?

>tfw working through 10 - 20 HTDP exercises per day
i'm moving on up boys
soon i'll be able to attend and not fail at hackathons when i complete this book and pick up C

Attached: 1506394215205.jpg (645x588, 57K)

Only if they're stateless. user's description here
>Right now, I have a void function pointer and a void pointer to a class in the client class.

Suggests that std::bind is appropriate.

>java.awt

Yeah non-capturing lambdas, which means it's not very useful.

>competing in hackatons
Why? You know the girl team will automatically win

this is a valid Haskell function

Attached: file.png (241x64, 6K)

/dpt/-chan, daisuki

Ask your much beloved programming literate anything

>pick up C
obsolete.

Gambatte!

Thank you for using an anime image.

Attached: when_anime_eat_pizza.webm (800x450, 2.64M)

This doesn't happen, does it?

are you sure about that?

>try to read SICP
>topology and real analysis in chapter 4 exercises
epic

>rio mare
>mushrooms
>cheese crust
>short purple hair
I'm gonna gag

I mean, there's two main reasons I'd use a lambda: skip a symbol definition if I didn't need one, and to capture some state along with the function.

Is the site broken? The results are irrelevant most of the times and.. rust has jobs??

>not using python

//this works
def ``: (Int, Int) => Int = math.min
//this does not
def ``[T T = math.min

Attached: peobt.jpg (460x282, 17K)

>using python

Attached: smugumo.png (140x135, 38K)

it took out my function names

Attached: Screen Shot 2018-05-17 at 2.53.26 PM.png (794x138, 23K)

what language is this

i'd take a guess: scala?

The numbers are all fake
Site isn't even real

scala
correct

>implying scala has generics

I am hungry :V

>What are you working on?
Stupid 2D game.

Attached: 538da56376c5709fb3bdcc187fc3f89da692cff3.webm (1280x720, 2.96M)

Bullets shouldn't stop or bounce
Player loses if hit with rock

>implying i don't know what type erasure is
>not showing an alternative language which that would work in