/dpt/ - Daily Programming Thread

Old thread got hotpockets. What are you working on?

Old thread: Old old thread:

Other urls found in this thread:

en.wikipedia.org/wiki/Recursive_descent_parser#C_implementation
45.32.80.36/board.cgi
ispc.github.io/
youtube.com/watch?v=wjYlw_VtPtw
en.wikipedia.org/wiki/Merge_sort
twitter.com/NSFWRedditVideo

If youre goal is to get an entry level programming job, would php be the easiest way to go?

>Old thread got hotpockets.
What? Why?

>What are you working on?
Benchmarking util for measuring bw and latency of GPU to GPU RDMA

implementing spreadsheet in webapp

pretty pointless, but whell

>What? Why?
Probably the 3D in the OP image.

>youre
Yeah I meant your. I'm not brain dead I swear.

If you have some self respect at least start with python (+django if you wanna make webdev)

I'd almost consider webdeb to be only tangentially related to programming at this point. Should probably give a look if you want to get into that part of computers.

>What are you working on?
Program automation in memesnake.

dependent
types

Can somebody explain this code to me?
I don't get it at all.
en.wikipedia.org/wiki/Recursive_descent_parser#C_implementation

What specific part do you want explained first?

So webdev is the easiest avenue for entry level?

I reworked my database fetching code on my C commentboard so I no longer have to drag the entire database into memory when displaying content!

45.32.80.36/board.cgi
todo: view posts by pages, with offsets

The purpose of accept() and expect() for instance.

wait, hold on, hscurses's newWin says it returns an IO Window
and a Window is pic related
does that mean I have to do pointers
wtf, I don't even know C
what am I supposed to use here, senpai

The input to the parser is a stream of tokens. You call accept() to check whether the next item in the input is a certain kind of token, so you can decide what to do next. The expect() function is a wrapper around accept(), with the semantics of "this MUST match, or this isn't a valid parse and we have to quit."

I wouldn't call it the "easiest" since it's got its own subset of challenges but it's not like CS where you need a degree because of the type of thinking involved (hence one reason why it's not really respected 'round these parts).

post a screenshot of your programming environment (ide, terminal, code, etc)

>learning haskell before C

Try again.

pointers r hard

they're just comonadic arrays

I listened to you fags and learned C before C#.

I'm glad I did this, despite how long it took.

I want to make one useful program with it to put in my portfolio before I move onto C#. Recommendations?
Something that will use a lot of aspects of the language.

Say I have a vector of pointers to objects.

std::vector vector;

And I have multiple classes with object as a member and I want my vector to hold pointers to members of instances of those classes. For instance:

vector.push_back(&classInstance.member);
vector.push_back(&class2Instance.member);
vector.push_back(&class3Instance.member);

Would there be any reason why this would only work for some classes and not others? I'm really scratching my head here. The members are all public.

a compiler

...

I'd rather suck a dick

>alright guise, give me something to program that that will use a lot of aspects of the language.
>do a compiler
>fuck no, I'd rather suck a dick

that's why you'll never do anything worth in this life

thanks for playing.

ok senpai

>that colour scheme

fag

IO motherfucker, do you know what it even is? And no you won't have to touch pointers beyond passing them around, it's just internals of the C ffi basically. Also how's ChType doing?

why do people use dark backgrounds? I can't even read that shit

no them, but what kind of difference does color make
>fag
yeah i agree

Game engine for Ludum Dare at the weekend

>nano
Learn a better editor.

It's quite readable.
You're just a junkie who can't handle bright lights.

>what difference does colour make
Are you blind and using braille?

Are you blind, on a laptop, or just have a shit monitor? I need dark backgrounds or I want to gouge my eyes out.

Threw some shitty old code up there because almost everything I'm writing right now has personal info.

I want to write a http router.

It basically comes down to using a tree structure but now is the question:

Should I use a radix tree or a patricia tree? Are the performance benefits of the patricia tree so big that it's worth the more complicated model?

well it's hard to bring a desktop on campus

Black background + neon text = eye rape.

The contrast is jarring.

See for a much better dark theme.

i jus put the char in a string and use wAddStr, much easier that way

The real eye-rape is black text on a white background. I need to write custom stylesheets for websites that do this (like Wikipedia)

Typical monochrome vi.

This.

how do u have autocompletion?

No arguments here; white background + black text is even worse.

I'm not sure why you're writing custom sheets. Stylish has dark styles for almost all websites.

Pic related for comparison of a muted dark theme vs. an eye-rape dark theme.

If you are going to use a terminal with a black background and bright text, using red text color seems to work fine for me.
Still appeals to my preferences and doesn't go harder to town on me for color contrast than an sjw on a bad day.

The eye rape dark theme though is more useful if, per say, I am using my laptop and coding on a train, and don't want to waste battery through increasing the screen brightness.
The high contrast allows things like syntax elements to still be easily readable with the screen barely being lit, though that may play into the fact it rapes your eyes are regular brightness in the first place.

>If you are going to use a terminal with a black background and bright text
Why would you?

I can't think of a single situation in which you would be forced to do this.

95% of all the posts in these threads are people bikeshedding about "what's the best editor", "how can you use that color scheme", indentation types and variable/function naming cases. It's pathetic.

last thread was arguing about mathematicians

My explanation as to why I would be doing this was in my follow up message.
It has to do with screen brightness and battery consumption when I'm coding while traveling.

I use company-mode with the irony and irony-company backends. It uses clang so it works pretty well. I run it in a Gentoo VM because the Windows compatibility is pretty shit.

>per say
>coding
>into the fact it rapes your eyes are regular

>programming on a fucking train

Which European shithole do you reside in? Going to take a stab and guess Germany.

But I really like nano tho.

I'm not sure what you're trying to say with this post.
Gray on gray looks awful and is an eyesore.

>What if we insert code into our config files
>And allow executing functions from shared libs

http {
upstream database {
postgres_server [::1] dbname=user user=user;
}

location / {
postgres_pass database;
rds_json on;
default_type application/json;
set_by_lua_block $num { return 20 }
postgres_query HEAD GET "SELECT * FROM table WHERE id=${num}";
}
}


But apart from that is developing with lua_ngx really a breeze. Pic related, a small Chinese cartoon scrapper/archiver/backup.

what does it actually do?

Not same user but isn't this something a little difficult for anyone who doesn't have years of C experience? How long would this take a novice to write? A year?

Okay, those were typos, but my point is that high contrast does have its uses.

Though to make myself clear, I hold more a preference towards muted dark themes such as those found in Visual Studio and Android Studio.

Also, do you realize how fucking boring it is to be on a train in Nordic Europe.
Especially Finland, holy shit, constant conifers with the occasional summer home for six fucking hours.

You should understand why I would pass the time programming.

>how boring
>you're on a comfy train with internet and enough room to use a laptop

fuck you

>learning x86 assembly
>mfw floats are actually 80 bits wide if you use the FPU

Why does not language support this? Why does no language explicitly support SIMD shit without instrinsics?

I don't typically use the internet on a train.
Don't have a reason to unless I just give up debugging something on my own.

Also the boredom from scenery is because I tend to be someone who studies my surroundings, so yeah.

Good day sir.

>C
>useful program that can be done with almost no C experience

user...

Music
Books
Movies
Anime

user, I drive six hours within my state regularly, and I'm happy enough with just music.

I can't imagine trying to get anything productive done in any of my major codebases while traveling.

wriiting a compiler usually takes the following steps (and others not mentioned):

>Parsing:
>Lexical Analysys
>Abstract Analysis

>Semantic Analysis
>Code generation

you should probably take a few months, its not expected from you to write a full-blown compiler, just a simple one, to understand the underlying concepts

In my college, you have to write one for the Compilers course, (the course is 3-4 months)

If you want a fun time, try writing your own printf() that supports printing floats and doubles. Float -> string is fucking rocket science

can you give me an example?

Why are you glad you learned C first?

I'd rather not. Binary representations of floats hurt my brain.

>mfw bias
>mfw omitting the leading zero

What the fuck is this shit?

It really just comes down to if I have some idea, problem or algorithm issue bugging me.

If so I'm more inclined to program when traveling.

Otherwise I listen to music, write in my engineering notebook (book for my schematics, thoughts and other ideas), or read a book.

because i can't see sharp

the japanese professor in my math class was talking about a problem and said "Now we know A is equivalent to B, but here is the more difficult question... is B equivalent to A?" and all the black guys in their corner said "no". is it possible black people are unintelligent?
posting 3dpd is a bannable offense

You can POST a query like {"title":"re: zero","method":"search","offset":0} and the server generates a response from the scrapped data.

Had the idea long ago when nyaa had occasional downtimes. Since the switch to cloudflare that's redundant of course.
In uni they teach you everything about databases but never make you actually use one, so still a nice experience.

If A == B, why would B != A?

Oh come on, IEEE754 is not that hard. We did this on pen&paper in class.

Oh shit ahoviewer RIP.

Anyway, I'll get going.
Thanks for the chat Sup Forums.

no, what if you're important to the discussion?

Why should I bother is cumbersome shit that has already been solved for me?

>Why does no language explicitly support SIMD shit without instrinsics?

Because
>muh portability

For some reason, programmers seem to think we live in a universe where 99.999999% of all relevant code doesn't run on x86-64 and think we should cater to other platforms.

Check out ispc.github.io/ for a compiler that isn't written by retards.

I'm not, at least not now.

I just had an argument with somebody over background vs. screen contrast which somehow morphed into how best to spend time on a European transit train.

Believe me, this isn't prime time material.

he was trolling to see what retards would say "no"

Javascript.
youtube.com/watch?v=wjYlw_VtPtw

God damn it, another typo.
* background vs. TEXT contrast
*facepalm*

wtf, how do I box in my newWin?

Anyway I need to leave.
Sup Forums board has a way of keeping you hooked.

farewell

see you in 10 minutes

I'm thinking about writing a C++ esque language for my bachelor thesis that is designed around x86, especially later editions like bit manipulation and AVX. Something like this:

float80 f = 1/2; //uses the fpu
float32 g = 66*0.3 //uses scalar sse

SSE:float32 v = {0.1, 0.2, 0.3};
SSE:float32 s = {5, 10, 12};
auto result = v * s; //single instruction

meant to reply to

Can someone explain merge sort to me?

shart in mart

en.wikipedia.org/wiki/Merge_sort

Given two separate lists A and B ordered from least to greatest, construct a list C by repeatedly comparing the least value of A to the least value of B, removing the lesser value, and appending it onto C. When one list is exhausted, append the remaining items in the other list onto C in order. The list C is then also a sorted list.

a non symmetric relation?

Can you stop spamming this every fucking thread you autistic son of a cunt?

>Can you stop spamming this every fucking thread you autistic son of a cunt?
triggered, americuck?

Just ignore it.

She's going to call you a butthurt American now because you responded negatively.

you have to understand recursion first. then understand that the first item in a sorted list is the smallest, so to combine 2 sorted lists you just compare the first items and take the smallest, then compare the first 2 again etc. comparing 1 item per list is more efficient than comparing both entire lists against each other every time

I am at work,
So can't copypaste from a laptop I am usually doing.

How could I generalize this Java code any further?