/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Last thread:

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

Other urls found in this thread:

pastebin.com/sA2EauU5
wiki.sei.cmu.edu/confluence/display/java/NUM03-J. Use integer types that can fully represent the possible range of unsigned data
stackoverflow.com/questions/3177338/how-is-the-linux-kernel-tested
pastebin.com/64Z9RbYv
en.wikipedia.org/wiki/First-class_citizen
fxsitecompat.com/en-CA/docs/2018/improved-javasc...
github.com/facebookincubator/idx
github.com/facebookincubator/idx/issues/55
news.ycombinator.com/item?id=19493440
nim-lang.org/araq/ownedrefs.html
twitter.com/NSFWRedditImage

first for C and tits

I was going to ask a question, but then I realized my question was retarded.

What's the best way to represent an unsigned 8-bit or 16-bit integer in Java? As far as I know, primitive byte, int, and short in Java are all signed types, and using a signed 32-bit int can't be the best way to do this.

what is the most realistically applicable language to learn if I want to go into software engineering?

C#, Java, or Javascript are good choices

not that user, but once you learn one of those languages what kind of projects would be good to make to build a portfolio that could land you a job?

something that is useful

I'm porting GCC to my operating system. I'm on day 2 of this and I'm making pretty good progress. I can now compile, link and run simple C programs :)
So far this is a really effective way to discover all kinds of bugs in a kernel and C library.

Attached: Screenshot at 2019-03-27 03-52-56.png (1920x1080, 785K)

I'm messing up but I don't feel bad about it. Truly this is the darkest timeline.

Attached: 1553554628242.jpg (714x468, 53K)

>went to a job interview for a sweatshop software place
>this was the only company that didn't reject me on the phone screen after applying to 50 companies
>interview email said to bring a laptop
>there's 40 other people there
>10 have macbooks
>20 others have poverty walmart shittops
>10 didn't bring one
>i have a thinkpad
>hiring guy comes to greet us
>1st guy with macbook gets called in
>then the next guy
>notice it's only macfags being called
>realize i'm not getting called after 3 hours of waiting
>some guys realized the same thing and walked out
>hiring guy comes out after the last macbook guy went in and tells us we're free to go

Attached: AAAAAAAAAAAAAAAAAH.jpg (750x556, 366K)

that looks like a really fun project user, what all has been involved in porting GCC so far? what kind of bugs have you run into?

For the guy asking about all valid 2 length+ wav samples, here's an example when you've got 15 possible samples:

1 8 14
1 8 15
1 9 1
1 9 2
1 9 3
1 9 4
1 9 5
1 9 6
1 9 7
1 9 8
1 9 9
1 9 10
1 9 11
1 9 12
1 9 13
1 9 14
1 9 15
1 10 1
1 10 2
1 10 3
1 10 4
1 10 5
1 10 6
1 10 7
1 10 8
1 10 9
1 10 10
1 10 11
1 10 12
1 10 13
1 10 14
1 10 15
1 11 1
1 11 2
1 11 3
1 11 4
1 11 5
1 11 6
1 11 7
1 11 8
1 11 9
1 11 10
1 11 11
1 11 12
1 11 13
1 11 14
1 11 15
1 12 1
1 12 2
1 12 3
1 12 4
1 12 5
1 12 6
1 12 7
1 12 8
1 12 9
1 12 10
1 12 11
1 12 12
1 12 13
1 12 14
1 12 15
1 13 1
1 13 2
1 13 3
1 13 4
1 13 5
1 13 6
1 13 7
1 13 8
1 13 9
1 13 10
1 13 11
1 13 12
1 13 13
1 13 14
1 13 15
1 14 1
1 14 2
1 14 3
1 14 4
1 14 5
1 14 6
1 14 7
1 14 8
1 14 9


You need to remember, though, that, in terms of "raw" count this is like 15*15*15...

pastebin.com/sA2EauU5

Save as a .cmd for windows (only) and enjoy

It's pretty fun! The main downside is the long build times of binutils and gcc after I change my libc headers.
Some problems I've had to fix:
>gcc has many global C++ constructors that need to run before main(), so I had to teach my _start to walk the _init_array
>fread() was supposed to return the number of "items" read, not the number of bytes
>fprintf() needs to support alternate forms ("%#x" specifically)
>gettimeofday() goes in sys/time.h, not time.h (and a lot of other similar things)
>gcc gets really confused about where its internal helper files are if there is no $PATH set
>exec()-family functions that don't explicitly take an environment argument need to forward the current environment to the execed process
>had to implement ungetc()
>my fclose() didn't call fflush(), causing intermediate assembly files to sometimes be too short

wiki.sei.cmu.edu/confluence/display/java/NUM03-J. Use integer types that can fully represent the possible range of unsigned data
>The only unsigned primitive integer type in Java is the 16-bit char data type; all of the other primitive integer types are signed.

That does sound fun, it sounds like an excellent way to understand libc as well. keep us up on it as you go

>language
All of them. Don't be a bitch. They're all the same shit anyway once you get past the typing systems.
Pick literally anything, get used to it, then pick literally anything else, and keep doing that until everything starts to blend together.

Attached: 51knPkTe5zL.jpg (406x500, 63K)

I built a forum in PHP while in school. Then I built an image processing server in C# after school. Eight months after graduating, I landed a job.

Are you going to submit bug reports or just say fuck em?

Well,so far every single bug has been in my kernel or in my libc, so I can't really blame anyone else :)
That said, if I should find any bugs in GCC I'll definitely report them.

Attached: zeldapape.png (1920x1080, 25K)

tell us about your OS user

How do you test an operating as you build it? With a program you just recompile it and run it, but with an OS wouldn't you have to recompile it, boot it, then run it. Seems like that would take an annoyingly long time.

do you think that people really do that?
stackoverflow.com/questions/3177338/how-is-the-linux-kernel-tested

Thanks I didn't realize user was Linus Torvalds

Ok. It's a graphical Unix-like designed to bring back the feel of computing from the late 90s / early 00s just before things started going to shit with all the oopsie woopsie """UX""" nonsense.

I have a pretty tight workflow with scripts that rebuild the entire thing if needed. Normally I'm working on a small portion of the codebase and so I only need to keep rebuilding that part. Then I just do incremental builds which work well most of the time. A full build takes ~25 sec, while an incremental build usually ~1 sec.
For booting and running I have a script for that too, I just go "./run" in my kernel directory and we boot. It takes about 6 seconds from hitting Enter until I have an interactive terminal inside my OS.
It's still an order of magnitude less painful than developing for macOS.

sounds comfy desu. the graphical environment never should have been much more than a frontend for what you can do just as well or better in the terminal. computing was better then

Thanks.

Did you see my post on the last thread? I explained it more, there. Refer to that and go from there. If you need more help, I'll be back tomorrow afternoon.

tfw you quit your shitty job and end up with a shittier job

It reminds me a lot of older Solaris, desu.

are you me

Can someone please recommend a youtube video or series I can use to learn ptrs for C? I'm trying to learn this shit for my exam. I was doing fine when it was simple shit like:

int main () {

int var = 20; /* actual variable declaration */
int *ip; /* pointer variable declaration */

ip = &var; /* store address of var in pointer variable*/

printf("Address of var variable: %x\n", &var );

/* address stored in pointer variable */
printf("Address stored in ip variable: %x\n", ip );

/* access the value using the pointer */
printf("Value of *ip variable: %d\n", *ip );

return 0;
}


But now I'm completely lost with pointer functions. Yes I'm a brainlet, I know.

i dont think so O_o

If the visuals could end up somewhere between the feels of old Solaris and Windows 2000 I'd be pretty happy

Just asking because only stuff I've found is awful pajeet youtubers.

I'm making a quiz program. Text based for now, but I am trying to implement as many features as I can.

One feature is to randomize the order of questions and thr order or the answer choices. I am proud to ssy I didn't look this up, I came up with my own algorithm. Yay. The problem is that it's WAY harder to work backwards when I'm storing the user's answers and checking for correctness. I was making great progress until now.

So do I slog through it and unwind my own mess of randomness, or should I go online and learn a proper solution? If this were to go into my own portfolio is it better to have a convoluted mess that I put together myself, or should I demonstrate best practices?

>apply to graduate/entry level software job
>gave online coding exam
>open exam
>questions are doable but still need to google for some syntax
>they don't like it if you use google while coding
>fuck that
>closes browser
>find another company

that's not even correct

Attached: 4fB765n.jpg (1022x1090, 155K)

watch Jerry Cain's lectures on YouTube

>Doesn't even know the syntax for your primary language
Stupid "coder".

I pity you user. I worked at a whole foods for a year and that was more than enough to make me hate customer service. I can't even imagine working in fast food.


I love you. Thanks!

I love you too bro, stay based using C

It wasn't my primary language that's why I needed to google

pointers are easy though it's just the address

if you want the actual value you have to dereference it

it's the opposite of the & sign

I'm curious, how prevalent are trans here?

Depends on the day. Insult Haskell and see how many people defend it if you want a daily estimate.

well haskell is cool in theory
not trans btw

Yeah as I said in: it seemed easy to me.But now that I'm trying to do these practice problems by creating pointer functions I'm completely lost. This is my first time ever learning programming so I'm completely lost but I'll get through it. If I can get through ochem I can get through this fucking C class.

well that makes one already...

just use * if you want to actually use what ever the pointer is referencing

one cool thing is making an array of pointers to structs or objects and iterating over it, lots of fun

i need to relearn data structures and algorithms, whats the best way?, should is just read CLRS start to finish? or do you have recommendations?

If you're looking for something that's easy to find, Java, JS, C#, Python.
If finding a job immediately isn't as important as having an enjoyable and fulfilling career, anything goes. Find something you like and master it.

I'm trying to create a chrome extension that communicates with a server that I own. for some requests I want the server to respond with a cookie for the browser to save but when i try to access that cookie with document.cookie it's always empty. am i being retarded or is something wrong here

My school is forcing me to learn C/C++ but I really have zero fucking interest in working full time with either of these. Should I pick up java, c#, or python?

If anyone wants to help me fix this fucking .wav file blending script (or just provide insight/ new strategy), please by my guest. This is what I have so far. It's VERY broken still. Sorry about the documentation formatting, pastebin is gay. Pls no bully, I'm learning.

pastebin.com/64Z9RbYv

I'm a fucking idiot, first line of blend should be
def blend(audio1, audio2, from_dirname, to_dirname, index, find=False, final=False):
filename = f'blended_{index}' if final else f'tempfile_{index}'

Forget java
C# and python are both very easy to learn and fun to use.
If you can learn C++ then learning C# and python will be child’s play for you

>should is just read CLRS start to finish?
yeah do that great idea

Why are you talking about coffee and the water if you join us are there little girl storm troopers I can't find any of them.
COCK FAG FAKE PHOTOSHOP IMAGE made up by A.s.s.a and BIGGLOBE magnetic declination all of them...

how is that legal

Are Regex first-class citizens in Ruby?

what would that even mean

I'm curious what you mean by "oopsie woopsie UX."
Are you referring to modern GUIs being clunky, e.g. running through interpreters, using web technologies on desktop, etc?

Ruby is gay

That they're built in and you don't have to import some function from some library to use them.

Why not contribute to an existing OS instead of starting from scratch? Plan 9 has a similar philosophy, you could steer it in your direction. Or you could write a from-scratch GUI for Dragonfly BSD and let nerds like Dillon keep pumping out drivers and filesystems while you work on the fun stuff.

Attached: dancing_terry.gif (429x592, 2.8M)

that's not what first class citizen means

use a debugger and follow it step by step, it'll probably help you bridge the gap between what you think you're doing and what is actually there.

The what does it mean?

first class in programming means that you can pass them to, and return them from functions.

In functional languages functions are first class because you can both return a function from a function and take them as an argument. Basically if something can be passed around like a value it's first class.

Regexs are just strings, so they're already just values.

But in functional languages, are functions not "already just values?"

americans don't have rights

here's a good explanation
en.wikipedia.org/wiki/First-class_citizen
>an entity which supports all the operations generally available to other entities
as says
>These operations typically include being passed as an argument, returned from a function, modified, and assigned to a variable
but in certain contexts it might mean something else, and it can be used in a relative fashion

That's because they are first class citizens in the language, so they can be treated like a value basically.
I think what you're thinking is more "are regexs part of the ruby standard library"

They're objects like everything else.

research in bioinformatics, if I do well prof says I'll get an authorship.

>bioinformatics
what kind of boomer buzzword crap is that

computational biology if you like

>just before things started going to shit with all the oopsie woopsie """UX""" nonsense
mate what do you think NeXT shit and WIMP was for

Just dropping in to say, in case any of you think you're never going to make it, this is the level of Pajeet code needed to make a cool billion:

>When Firefox tried to make the "X is undefined" JavaScript exception message user-friendlier, it broke flipkart.com. The website's JavaScript explicitly depended on the exact wording of exception messages. Simply loading the flipkart.com home page caused "X is undefined" exceptions, which it tried to parse with regular expressions. The new exception message had to be reverted. :(

>fxsitecompat.com/en-CA/docs/2018/improved-javasc...

>Why in the world was Flipkart regexing for an "X is undefined" message? That seems as brittle as possible.

>Because they were using a demo function from a JS lib that attempts to match error messages:
github.com/facebookincubator/idx

>The idx runtime function exists for the purpose of illustrating the expected behavior and is not meant to be executed. The idx function requires the use of a Babel plugin that replaces it with an implementation that does not depend on details related to browser error messages.

>github.com/facebookincubator/idx/issues/55

news.ycombinator.com/item?id=19493440

>waaah waaah internet explorer breaks some extremely poorly coded sites waaah
you asked for this. this is the future you chose. you have made your bed now lie in it.

Attached: 1548199840735.jpg (625x779, 62K)

Attached: 1548373160795.png (396x382, 173K)

I hate these meme technologies and frameworks.

Attached: jean.png (744x883, 1.13M)

>/dpt/ thinks they're superior to Indian software engineers who have studied 12 hours a day, 5 days a week for 4 years with state-of-the-art equipment at top universities
>/dpt/ doesn't realize (or is willfully ignorant of the fact that) an Indian computer science freshman will have to write a bootloader and a compiler IN THEIR FIRST SEMESTER or fail their degree
>/dpt/ considers themselves better than such engineers... and it's all because the engineers have brown skin
Inferiority-superiority complex much?

I don't get why they were using that function.

Also
>Flipkart Pvt Ltd. is an Indian e-commerce company based in Bengaluru, India.

facts don't care about your feelings rajesh
look at the code they write

so? so did I, it's not hard when the curriculum handholds you and glosses over a bunch of things as "just because" because it's a first-year course

What? Indians do not write a bootloader and compiler in their first semester. You're completely delusional.

>who have studied 12 hours a day
lol, arent indians like the second biggest cheaters in universities after the chinks?
also they probably copy paste those compilers from the previous generations

I'm 25, currently a NEET so I have a bunch of free time, not really bad at maths but not my favorite either.
I'd like to pick up some programming skills for personal use, don't really want a job behind a computer.

What should I start with? Python? Java? I'd like to know basic C and ASM at some point, the idea and skill to port programs and games between old computers could be handy and fun. Plus when I'm more skilled, to be able to contribute to open source projects that I have interest in anyways or fix my own problems, modify them for my own use.
What are the best ways to start get into it at home? Books? Videos? Online courses?

Thanks.

Attached: c04e6fccd47a8b094aef0ece6a0680e571eaf336_hq.jpg (474x553, 50K)

nim-lang.org/araq/ownedrefs.html
I like how Rust makes meme languages like D, Nim and Crystal invent their own half-baked no-GC solutions and how they fail at it, because - what a surprise - if it was that easy it would have been done a long time ago. This guy unironically proposes to disable deallocation so you couldn't get a dangling pointer, yet still keeps nil so a segfault is still possible, what a genius. Nim shills on suicide watch.

you only need to learn java if you want a soul sucking code monkey job

there are like a billion ways to learn python and they're all brainlet friendly so just pick one. then learn c sooner or later

>maths
>favorite
what are you

this

too long did not read

Attached: 1553181693710.gif (370x340, 620K)

Start with Python or C, these are good first languages, just don't stop at them. Don't waste your time on courses, just read a book and do all the exercises, that's important. Don't just read/watch stuff, it's gonna feel trivial, but without practice, you won't remember anything.

I have a function in C like this
void ParseFile(char* in, char* out, int* (*CryptFun)(char, char*))
and I call it like this
ParseFile(argv[2], argv[3], &encryptchar);
and it compiles and runs correctly but returns
warning: assignment discards qualifiers from pointer target type
anyone know why?

You're passing a char const* to a char*.