/dpt/ - Daily Programming Thread

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

Other urls found in this thread:

gotnews.com/mexican-judge-gonzalo-curiel/
esolangs.org/wiki/Befunge
mikescher.com/programs/view/BefunUtils
mikescher.com/blog/2/Lets_do_Befunge93
twitter.com/NSFWRedditImage

First for C#.

First for Assembly

i want practice my C
im thinking of writing a simple scheme interpreter

will this be good practice

Get fucked, low-level nerd.

*drives off in high-level language that women are attracted to*

All you people are too busy fighting over which languages are "memes" to use actual meme languages, well; not me.

I made fizzbuzz in befunge. Still learning it, but it seems fun!

55*4*01v
v35:+1:55*^
!> #^" zzuBzziF"v
>| ^ ,,,,,,,,, " zziF"v
>:5%!| ^ ,,,,, " zzuB"v
> |
v8.: <
>4*,^ ,,,,, <

pretty code
practically art

KILL YOURSELF

KILL YOURSELF

MOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOODS

gotnews.com/mexican-judge-gonzalo-curiel/

please leave

kys fag

How do I return an array? I have this matrix multiplier:

template
void mult (T (&A)[U1][V1], T (&B)[U2][V2])
{
if (V1 != U2) return void();

T output[U1][V2];

for (auto &i : output)
for (auto &j : i)
j = 0;

for (unsigned C1 = 0; C1 < U1; C1++)
for (unsigned C2 = 0; C2 < V2; C2++)
{
for (unsigned C3 = 0; C3 < V1; C3++)
output[C1][C2] += A[C1][C3]*B[C3][C2];
}

disp(output);
}

And it works fine, but all I can do is write out the array on screen. The answer is destroyed once the function ends, so I can't just pass a pointer back. What do?

(I would ask /sqt/, but nobody there can code)

...

This post better be bait.

Why is this bad practice?

a high-level programmer is still a nerd just less intelligent, lower skilled, less attractive, just all around worse

>what kinda language you want senpai?
>you know those ice cave puzzles in Pokemon Gold?
>say no more

The way I understand it, it undermines the switch cases.

Give a single good reason why you would write anything like this?

>those ice cave puzzles in Pokemon Gold
those were fucking good

are they only in gold or in silver too?

ew eewww eeeeeewwwww
the fag that wrote that should be hanged

Are you 5?

The way I read it is: Sometimes you want the result of something to depend upon the execution of gloop. Other times you don't want the result to be determined by the execution of gloop, so you jump to either arfle or barfle. It just looks clever to me.

Are you an idiot?

>trusting FP in production

I've taught myself a fair amount of C++, what should I do as a (relatively simple) project? I have finished the programming "challenges" from the book I downloaded, and while they do help me grasp specific concepts they don't really help me solidify my knowledge of the language.
Any recommendations?

Allecate the memory on the heap and return a pointer.

your mom?

LMFAO DELUSIONAL FP FAGS ON SUICIDE WATCH

>ew eewww eeeeeewwwww
>the fag that wrote that should be hanged
There's an age limit for a reason

>waaahhh he's not acting like a grown up like i am (trying to because i'm a 12 yo big boy playa)

>big boys are happy in the presence of spaghetti code
wew lad

I've once used this in a serialization procedure which takes an object and turns it into json.
It was structured like this:

string serialize(obj) {
for p in obj.properties:
serialized.append(typeHandler(p))
}
}


the typeHandler prodecure would check the type of a property and execute a serialization procedure based on it - if it's an object call serialize(), if it's a numeric value, serialize it etc.

typeHandler(prop) {
if prop.isObject() {
return serialize(prop.asObject());
} else if prop.isNumeric() {
return '"' + prop.toString() + '"';
} else if prop.isArray() {
for p in prop.asArray() {
serialized.append(typeHandler(p))
}
return serialized;
}
}


However if typeHandler encourntered an array, I could assume the type of every element within that array has the same type, therefore I only needed to determine the type once, and can then jump to the type I already determined:

typeHandler(prop, &type) {
switch(type) {
case -1: //type unknown, check types
if prop.isObject() {
type = 0
case 0:
return serialize(prop.asObject());
} else if prop.isNumeric() {
type = 1
case 1:
return '"' + prop.toString() + '"';
} else if prop.isArray() {
type = 2
case 2:
arrType = -1
for p in prop.asArray() {
serialized.append(typeHandler(p, &arrType))
}
return serialized;
}
}
}


That way I only have to check the type once, and can then use a jump table for successive calls.

the compiled code for that is gonna look horrible

That's one case where labels and goto is easier to read.

Guys. Any good sites about practicing conversion between decimal, binary, and hexadecimal?

gay

>anime
>trump-posting
delete your account

>I could assume the type of every element within that array has the same type
But this is not necessarily true by any means, certainly not according to the JSON standard.
Do you really think it's worth the negligible performance increase to omit a type check or two and also make your code incorrect?

...

based

>learn programming basics because it looked liked fun
>have a great time
>create a few useful utilities for myself
>since i'm 25+ and too late for this, it will never be a career; can't focus on it because of other "career"
>out of ideas what to do with my limited knowledge
>haven't touched programming in months, about to forget the few things i knew

Anyone else in a similar situation? Did you manage to escape it?

BTFO

what his image isn't showing is that hillary's tweet has over 200k likes and trump's reply has less less than 2k. it's over. hillary wins

>History; made.
Is Hillary's biggest running point seriously that she's a woman?
I don't care for Trump but Hillary is pathetic

Taught myself html5 and css the past month, I wanna take it further so that I can get paid to do this.
Question is do I learn Javascript or C# next?

obviously a reply is gonna have less likes than the main tweet idiot

>limited knowledge
>you will never know this feel

delete your account

yes and she even tried to spin it like she wasn't a part of the establishment just because she's a woman

SJW ultra liberals are a minority and even if you wanted a female president, maybe not go with shillary, there are more important things in politics than what kind of genitals you have

I'm voting for trump for sweet SJW and minorities tears.

I know both high and low level.

Yeah, just worked on my own little website, did a couple complicated projects involving math/ai and completed a uni course in Operating Systems (a hardcore one in C, not a babby "how to use the start menu")

Any project is good practice.

Implement a graphical application.

She's also campaigning pretty hard for all but abolishing the 2nd Amendment. For example, she wants to make it federally illegal for a father to give his gun to his son.

F1C
15x16^2 + 1x16^1 + 12x16^0
3868
// to convert to hex
3868 mod 16 = 12
3868 / 16 = 241
241 mod 16 = 1
241 / 16 = 15

// end result
3868 => 15, 1, 12
F1C

And this works for conversions to any base system, not just hex.

what about to a daughter?

Tetris
Snake
Pacman

All transfers in ownership of a gun, even in the event of the death of the original owner, would have required background checks and psychological evaluations.

What a lazy comeback. Is he even trying? Feels like he was caught off guard.

it was a joke, asspie. trump's not going to win in case you didn't notice so i hope you learn to accept whatever gun control she deems necessary. btw: delete your account

how is "delete your account" witty at all and what would be a better comeback, dipshit

The goal of writing software is not to befuddle anyone maintaining it (it could be you) it's to write a working product.

The problem is, once the product is released, management will shift the goalposts to something else, so your code ALSO has to extend to new scenarios. That code doesn't look like it extends easily.

A much easier way to write that EXACT logic, is to switch on mode, and have each case be a separate method/function. Using the stack is a bit less memory efficient, but will boil down to the same instructions to the processor, will do the same task, and will make people not hate you.

When will cute anime girls become real?

stay delusional fag

people are sick of the establishment, most bernie supporters prefer trump over shillary, trump will renegotiate the trade deals like bernie also wanted to

>girl

well according to twitter 2k agree with you while 200 million disagree. i wonder how the trump shills being paid to shitpost for him on Sup Forums will justify this

A graphical form application. For shits and giggles, make it a resume builder, then hand it in as your resume (if you don't already have work).

It's not that witty, it's just more so than trump's response.
>what would be a better comeback
I know it's you, Donnie. I'm not writing your next tweet.

either you don't know how twitter works or you're this delusional or shilling this hard

Trump. Can't. Win. How long will it take you to get it through your thick skull? You're fighting a hopeless battle. It's embarrassing. Give up

>trump's not going to win
I think that Trump would be a shit president, but what the fuck makes you say that? He has done nothing but win so far when most people said he wouldn't get even a single delegate. He is consistently popular with everyone who the "experts" say should hate him.

More republicans showed up to vote in the primaries and trump won unanimously in every state of the union.

...

Hillary. Can't. Win. How long will it take you to get it through your thick skull? You're fighting a hopeless battle. It's embarrassing. Give up

if you take the current popular polls of him head to head with clinton in every state, and give him 5% on top of that in every state, he still loses by over a hundred delegates. trump's only popular in your NEET echo chamber and the only reason he won the primary is because he spent literally hundreds of thousands of his fortune campaigning. keep circlejerking over him with your neo-nazi cumskins while you can

>oh gee a trump reply on a hillary tweet doesn't get as many likes as the hillary tweet
you're grasping at straws. you're deluded.

>cumskins

hello pajeet
must feel bad to be a shitskin

...

>the current popular polls
his popularity is growing rapidly and he's barely even begun with his change in rhetoric to combat hillary vs appealing to republicans to beat cruz and all the others

>delegates
Good thing the US election doesn't rely on delegates, then. Also, republican and democrat systems with delegates work completely differently, so it's absurd to even try to compare the two.
>hundreds of thousands campaigning
And Hillary spend literally millions from oil companies' bribes campaigning and slandering Bernie Sanders.

>neo-nazi cumskins
sure is butthurt in here

go js

This post reminds me of how incredibly attracted to 2D I used to be.
I want to be a hormonal teen once again god damn.
>Befunge is a stack-based, reflective, esoteric programming language. It differs from conventional languages in that programs are arranged on a two-dimensional grid.
Fuck that's cool.

Does anyone know a good website translator?

from russian to english

learn real programming. web dev is "easy" but you have no long term job security. learn java, or if you insist on falling for the meme, C#.

google translate if you just want to more or less read some shit for free

fiverr if you need an actual translation without spending too much

>boy
Even better.

I already know java from my bachelor's degree, but everyone seems to want html/.net abilities.

>learn java
Are you implying there's a place on earth where just knowing java will get you hired

i'm not meming i genuinly dn't know

android uses java, so anything with android development

ok well then i think you should learn C#, it's good to know multiple languages and you can go for the .net jobs as well

Doesn't this just
if((mode==0||mode==1) && gloop(a,b)){
result=arfle(a,b);
}
else{ //covers the case 2:
result = barfle(a,b);
}
return(result);

There's no default case so the only valid values are [0,2].

Is maybe the point of writing it like that that you can easily split the different cases but you wanted to use the case 0 to use gloop(a,b) to check which case you go into?

So it should be more like
switch(mode){
case 0: if(gloop(a,b)){
case 1:
result=arfle(a,b);
break;
}
else{
case 2: //maybe we want multiple of them here aswell. I'd put the case before the result= if that's not the intent
result=barfle(a,b);
break;
}
}
return (result);


Or am i misinterpreting the code?

What about converting on pen and paper?

Thanks for the advice man

Oops. first line should be :
if((mode==0&& gloop(a,b))||mode==1 ){

That's the pen and paper method.
How do you think programmers write functions?
They write them out on paper and then convert it to a function.

im actually working rihgt now. they pay me about 100$ a month for 5 hours of work/day but its okay because i live in the third world and thats like 3 times the minimum wage

im using php and i see why they say it's bad. these people dont know what the fuck they're doing. it just attracts retards

Try it out, it's a fun time waster and my favorite esolang.

esolangs.org/wiki/Befunge
mikescher.com/programs/view/BefunUtils
mikescher.com/blog/2/Lets_do_Befunge93

>php

Are you good at whatever you do? Because I'd like some contact info for later. I really like the idea of outsourcing like this.
Do you have friends who do other stuff as well? Maybe you could put me in contact with them and you get some money for that.