/dpt/ - Daily Programming Thread

Old thread: What are you working on Sup Forums?

Other urls found in this thread:

learnyouahaskell.com/chapters
docs.oracle.com/javase/tutorial/
twitter.com/NSFWRedditVideo

LEGITIMATE THREAD

Doing some Code Wars challenges in Python

Hey /dpt/, what is the hardest hobby project you have ever written?

>Sup Forums posters think extensible records are impossible

THIS

you're the one spamming

fuck off and die

How do I convert a set of booleons to a binary and then to an integer in C?

CHIP-8 emulator in C+SDL1 (no Image/Mixer)

Assembler and Compiler for custom chip8 language written in Python

int foo = (bool3

>to a binary
There's a binary type?
>to an integer
I'm assuming c99 since otherwise this isn't a question.
switch (boolean)
case true:
return 1;
case false:
return 0;

>a set of booleans
>convert to an integer
What are you even talking about?

int bool3 = 356;
Boom code broken.

First of all, why do you need to do that?

>using a 2^32-valued type to store a 2-valued type
Absolutely disgusting

I'm terrible at doing output shit in Haskell, can someone help me?

Basically I have a list of pairs of strings :: [(String,String)] and I want to print in the following format:

String1
|= String2
String3
|= String4

etc. The above example would apply to a list [(String1, String2), (String3, String4)]

I want to work in the space tech sector

What language would I need to learn? What's generally used for programming drones and satellites?

Guess what! That's how it works in C and ~every language~.

stdbool is just an enum, which is syntactic sugar for ints anyway.

are you fucking retarded

#include

I dunno, when I write in C89 I tend to just use chars

Go try shoving 356 into a boolean in Haskell.

I want to use 8 buttons to input a number

>even suggesting using int, a possible 32-bit data type, when char is considered a numerable and is 8-bit
Full retard

>stdbool is just an enum
kid...

Using crystal to solve some basic eulerproject problems.

I hope spoj will support Crystal someday though.

Okay, so you want a map from button to {pressed, not pressed}. Not a set of booleans, which could only have 4 possible values.

In C, what type do these bit-shifts coerce the value to? Not that it would matter to the guy's question considering it'll only be 1 or 0, but I am curious

unsigned int, 99% sure, otherwise signed int

Lots of different languages are used because it's hard or impossible to upgrade satellites.

The most important part of writing for space tech is to develop the ability to write immaculate fucking code. You can learn a language on the job.

Ints are either faster or the char is word aligned, meaning it's an int in terms of impact.

>he doesn't know about word alignment

Meme language that uses integer types behind the scene.

It's a very nice and fancy enum but it's still an enum.

Then why not use the buttons to input to a string and then convert said string to an integer?

...

Use a char data type

Each button will xor that value with a bit-shifted 1 value

Ex:
number in 8-bit: 10110010
press left-most button: 10110010 ^ 10000000 -> 00110010
press 3rd-button from the right: 00110010 ^ 00000100 -> 00110110

Chars are 1/4 the size though

I wrote a vietnam war teaching simulator with an inbuilt 2d tactical turn based strategy game

uchar maybe?

And exactly what errors am I making?

>get out of college with a BS in CS
>loved SQL
>wanna do database shit
>look up database entry level positions
>damn near everyone has 5+ work experience

am I just retarded when I search this shit on google? I type "entry level database positions" and linkedin, indeed, and monster come up with Amazon database positions requiring 5+ years of experience.

how do people get into databases? I wanna do Software Engineering and SQL shit but damn son all that work experience though.

bools in C evaluate to 0 or 1, no other values

they're not enums

you can get 5+ year experience jobs if you really know your shit. but maybe try to get a junior full stack job and spend all your extra time on db stuff.

You do it alongsize something else

I do plenty SQL as a python/django dev

>Lots of different languages are used because it's hard or impossible to upgrade satellites.

they should just use erlang, stupid spacedevs

also chars and bools can be packed like in a struct or an array

>they're not enums
nice meme

so go for an entry software engineering positon? that should build my work experience and alongside it I work on SQL shit?

or should I aim for a software engineering position that has a qualification needing SQL?

wouldn't that convert 1010 to one thousand ten instead of ten?

no

if you're using based windows 7 open up calc.exe and set it to programmer mode and play around with it

bit-shifts are bit-shifts ie they work in base 2, not 10

I'd say entry level full-stack web dev, because as a web dev you get full access to a db (likely MySQL, maybe PostGres) and can copy it and fuck around with it all you like.

would it be possible to just read the Boolean values into a char array of 0s and 1s and then loop through the char array and summing into an integer variable?

no then you're just getting the count, so (1,0,1) would be indistinguishable from (0,1,1)

>I'd say entry level full-stack web dev

see I have developed a website using PHP, MySQL and all the backend shit works fine but /wdg/ completely shit on my html.

#include
int main() {
printf("%i\n",sizeof(1==1));
}

On my system that's a 4.

bootstrap homie

oh and JQuery

well if the char array for the Boolean value is in order from the 0th position to nth then when looping through the char array you base the exponent on the iterator value.

so if you have (1,0,1) output would be:
2^0+0+2^2
and (0,1,1)
0+2^1+2^2

I used bootstrap. I just suck at getting the html tags correct and have old code that when I first developed were good but are now archaic and need to be fixed.

There are few html tags you need to use or remember when coming up with professional design, or actually, what specifically did they say was wrong?

sure then it's equivalent to but more extensible to any number of bools since it's an array

git gud

>bit-shifts
is that what the

He probably did his layout with tables. Or used cancerous tags. Or inlined his javascript or CSS.

what I learned from /wdg/ is this:

plan like a motherfucker and git gud at tags felt like shit after /wdg/ basically said my website will blow up any minute

yes

is right shift, so (2 >> 1) is 1

Yes. Not to sound condescending, but what did you think it meant?

>Or inlined his javascript or CSS

I did both. I am planning on fixing it but fuck me I am terrified of breaking it.

copy it to a separate folder

if you fuck up, you still have the original code

>I did both.
The fuck homie, it's 2016, what kinda tutorials are making you inline it?

Fuck, this reminds me how much I hate W3Schools documentation and would rather see MDN. How do I force MDN to the top, without having to type mdn at the end of my searches?

I just took a college course. much of it was on databases, MVC framework, Jquery, php, input validation, SQL injection, etc

there was stuff on good practice in HTML but I skipped that day and god damn I do regret it.

can someone explain what this does?

Who is this Jason everyones talking about?

>there was stuff on good practice in HTML but I skipped that day

bool3 * 4
+ bool2 * 2
+ bool1 * 1

I've heard he structures your data nicely

see | is bitwise OR, it's like a boolean OR but it applies to all bits, so like (1 | 1) is 1, (0 | 1) is 1

Is it true that most programmers are actually qt traps?

no kys

xD epik Sup Forumsro

No it's not

But it is true that wearing a skirt and cute stockings increases your programming ability

kys

so the int starts as 00000000
if bool1 = 1 then the int is 00000001 =1
and if bool2 =2 then the int is 00000011 =3 and so on?

don't knock it til you try it

Can attest to this. My roommate in college who was the best programmer I knew there wore a skirt sometimes.

i have and i don't see the point, they're comfy but it gets old fast, you get used to it

rubbing lingerie against your dick to jerk off is another story

Yes

bools (from stdbool.h) only evaluate to 0 or 1

if bool1 = 1 and bool2 = 1 then (bool2

Same, went to a silicon valley conference and they provided cute frilly skirts during the creative programming hours

It's useful for that too

thanks senpai

[spoiler]thought

>appendage
uwotfam?

learnyouahaskell.com/chapters
Y/N?
If no, rec a better resource

like 1 | 2 = 12

i thought that was the proper term

docs.oracle.com/javase/tutorial/

Concatenation, which is usually not done with |

Good joke

nice meme

mapM_ (\(f, s) -> putStrLn f >> putStr "|= " >> putStrLn s) [("test", "output"), ("Please", "respond")]

The people here are dunces, mate.

including the hasklelers

But they're my dunces

Haskellers are at least not content to wallow in shit like most programmers.

tiling window manager

An LMC interpreter

C# fags, I have a question: what are the best resources (books pref) about WPF?

This is what Ive been working on for the past few days. Im very proud that it worked out. Probably my favorite thing Ive ever made.