/dpt/ - Daily Programming Thread

Fuck off to edition

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

Other urls found in this thread:

css-tricks.com/tales-of-a-non-unicorn-a-story-about-the-trouble-with-job-titles-and-descriptions/
cs.nott.ac.uk/~pszgmh/monparsing.pdf
haskellbook.com/
github.com/simonmichael/haskell-atom-setup
github.com/i-tu/Hasklig
github.com/OllieReynolds/Simulation/blob/master/cs_particle_physics.glsl
twitter.com/NSFWRedditVideo

Writing a text editor for emacs

Who's that tranny, OP?

ICFP 2016 CONTEST

This shit is hard.

css-tricks.com/tales-of-a-non-unicorn-a-story-about-the-trouble-with-job-titles-and-descriptions/

kys, thx

I'm gonna repeat my question:

How do I know when I should use a try catch? Most of the time when I write code (which admittedly, is not a lot. Two somewhat complex web applications) and I think there might be a problem I normally write some checks but never a try catch. Then there's some problems that I don't foresee that could've used some additional checks or a try catch to handle it but I didn't think of it for whatever reason.

I also don't know when to use a custom exception. Are these things that come with more experience?

1) When your boss tells you to
2) When you're dealing with someone else's throwing code

Fuck me.

Kids these days expect to get a programming job without being able to write code.

this

...

>hungry for more
>not topcoder there

pls

>The whole fixbuzz thing is a huge joke. I have never used the or heard of PHP’s modulous operator before or since I failed the fizzbuzz test.

>I’m also learning that if you have mastered all the skills listed in the description then why would you be interested in their company? You’d be at Google or something.

wew

>FizzBuzz does have its place, but definitely not for the average web developer. If they wanted someone who did serious backend engineering, then it would be a decent way to see how someone steps through logic, but very few web dev jobs really need anyone who does that.

I'm fucking dying

Did anything ever come of that ren'py mode for Emacs from awhile back?

>go to programming job interview
>don't know how to program
every time this makes me so mad
more angry than whenver I see
1
2
3 4

Been working on a NES game. Going pretty well so far, just needs sound. Pretty simple concept, but I have a repro guy who's going to make carts.

he wasn't alone.

This got posted in an IRC I was in a while ago and it drove me nuts.

WAHHH, THEY WANTED A JAVASCRIPT DEVELOPER FAMILIAR WITH OBJECT ORIENTED DEVELOPMENT WHICH WAS MENTIONED IN THE FUCKING AD BUT I DECIDED TO GLOSS OVER.

Also, if all she knows is jQuery and had to google how to do something as simple as FizzBuzz then she absolutely is what she said she was afraid of here:

"In my impostor-prone state, I felt called out as a just-good-at-Googling-and-maybe-jQuery developer. I was embarrassed."

The problem with impostor syndrome is that it lets incompetent morons feel like they're not incompetent morons but rather insecure geniuses.

>good-at-Googling
hate this meme
being able to use Google doesn't make you good at it

Are you jewish?

what do you mean? I got a Google-cert.

Employers always value that in a resume

Maybe...

Do you visit /o/? Sup Forums is great too. /e/cchi not so great. /n/ is somewhat good.

The comments are even more ridiculous
>The point being even if you can go on stack exchange and find a solution these peoples expectations are that you are able to explain, down to the semicolon, what the code does.
Like no shit you can find it on stack exchange, but its not the point. You're only proving that they should take the random on stack exchange over yourself.

and of course
>BTW – I’m a physics/math grad and unless you’ve taken some abstract algebra recently, you will be totally loss.
Where do these people graduate from? some "physics" grad is legitimately calling fizzbuzz abstract?

Why are you interested in whether I'm Jewish?

Why would you ever make a member variable of a class private instead of protected?

it's just a pure coincidence

Why should I learn Java?

>Why would you ever make a member variable of a class protected instead of private?

So I need a C compiler for my virtual architecture, what parser/lexer generator should I use?
I do not want to spend too much time on the compiler, i want to focus on the machine itself, and an operating system for it.

>inb4 LLVM backend
Yeah nah, after reading the documentation for that I've come to the conclusion that just writing my own compiler with a parser/lexer generator as a frontend is way faster than writing an LLVM backend.
Optimization isn't a concern.

>After spending a few hours coming up with something that semi-worked, I found the solution on StackOverflow and, in my honesty, linked to it in the code.
>After spending a few hours

Because there are variables that subclasses do not need free access to.

>parser/lexer generator should I use?
Lex and yacc

Also bonus points if the generator can generate C++ code.

class MyOOPClass {
public:
int getX() const;
int setX(int);
private: int x;
}

MyOOPClass X;
int& x = *((int*)(&x));

Parsec or similar

cs.nott.ac.uk/~pszgmh/monparsing.pdf

Are there any good general cases where recursion is hands down better than iteration?

Are there any good general cases where iteration is hands down better than recursion?

None, because you can convert recursion to iteration in every possible case by storing each different list of inputs in a stack.

>be me
>check githib repo
>.editorconfig
>.gitignore
>.travis.yml
>package.JSON

what the hell is all this shit?

Iteration is very simple to implement with recursion, in many ways it's more natural than recursion with iteration

Pretty much anything with a sizable number of runs, iteration uses a lot less memory, doesn't it?

Not vs an optimised tail recursive function, or recursion via goto

That recursion too is implemented with iteration deep down.

Oh okay, thank you.

No, it's implemented with goto, which is neither more like iteration or recursion

That's a really stupid response.

No. Iteration is what a processor does best, and most of the time recursion is optimized into a loop by the compiler.

Should you default to protected then unless that's the case?

>>.editorconfig
The owner uploaded their editor config settings to try to force everyone to use the same style who contributes
>>.gitignore
tells git what files to ignore, like build output files (also the editor config could be listed if the maintainer didn't want it being added to source control)
>>.travis.yml
I think this is some online build tool, not sure -> I only see if used on javascript shit
>>package.JSON
This is package files for a project, it tells a package manager what libraries and resources to download. I assume it's some javascript shit in this case as well.

You should always have the most encapsulation possible. Unless your subclasses needs the variable to be visible (eg. for computation in a method) it shouldn't have access to it.

You don't know if someone will want to extend that class in the future, or if you will want to.
There is literally no reason to follow that methodology.

On an unrelated note, pic related is from my professor. She's a women in STEM.

Are there any good tutorials on using flex with bison?

>tfw devs arbitrarily name their libraries/frameworks so they can be a meme
What the hell is this?

Why would you ever make a variable private or protected?

I'm LMAOing @ your life, javalet

> If we don't block access to data, pajeets won't know what to do with it and start overwriting them with cuckporn torrents

you should encapsulate a bullet into your skull

-t. Python

Fuck me lad.

>hey, let's let people add subclasses to things that break if subclasses are added, what could go wrong?

did you suggest to her

return isFull() || connectFourAnywhere();

or are you just going to keep it to yourself

I want to be able to select only a limited number of posts from a table, but each post might have multiple pieces of media.
What would you guys suggest as the best way to do this?

Here was my last setup:
>posts table
>media table
>select posts at a LIMIT and OFFSET
>Then selected all media with those ids associated to them
>Finally, used PHP to concatenate them in a foreach loop before echoing the posts
>>posts were echoed once the id changed

Is this the best way? I feel there's something rather inefficient about this.
OTHER THAN NOT USING PHP AND MYSQL, is there anything to improve here? Or is this ACTUALLY how it would normally be done?

I suppose it's possible she's using it to teach if-statements.

oh yeah, here's where I feel the inefficiency might also have been. I was concatenating the post ids, and making a long query of 'thisID OR thatID OR theOtherID OR [...]'

>java
information hiding is in every language. If you don't write good, robust interfaces your library will just end up being a mess, and when you change it, all the programs using your library will either have to stay on a deprecated API or be torn down and made anew.

>encapsulation is only for variables
of course i'm talking to a literal cs dropout who only writes fizzbuzz

Is anyone here not a NEET?

I can't decide to whether give all hardware resources to the OS in my exokernel with the exokernel doing only prevention of access violations etc or omit doing controlling of resources and just let the OS fuck systems shit up?

You can use IN (...) instead of a big disjunction.

I took early retirement to shitpost on Sup Forums

>Why would you ever make a variable private or protected?
I'd only make a member private or protected if it's value shouldn't be set directly; i.e. if it's calculated from other values, and this calculation may be accessed more than once between each change in those values.

Elementary example:

Rectangle class with length and width. I'd store the area in a member variable privately. When you want to get the area of the rectangle, it will check if length or width have been changed since the last calculation. If they have, calculate the new value assign the area variable the new area and return it. if they haven't, just return area.
Or even better, just set the new area value any time width and height are changed.
Depends on the case I guess.

Obviously this is retarded for this example, but for any process that is expensive to do, I think this is a good idea, so you're not doing the same calculation on the same values for no reason.

proud of you, user! Keep up the good work!

>>Java
I know it's a huge meme, I hate it too.

hmmmm ok. Yeah, I totally forgot about that one.

Anything else that can be improved there?
really appreciate it already. thanks

Just starting to learn Haskell
I'm using LYAH but looking for other methods.

Does anyone have any advice other than kys

What editor/plugins are you using?

I'm still in college, and before going away for the summer I had both a shit job for several months AND THEN a consulting position for about 2 months.

Planning on looking for some consulting things when I get back while my website is still new, as well.
I don't mind working mostly from home

Python users would extend Bool if they could.

data Bool = True | False | Perhaps | Sometimes | LemmeCheckAgain (IO Bool)

I am learning through this
haskellbook.com/

definitely an in depth book and has been good so far

doing it on Windows with haskell platform 8 install

Thinking Functionally with Haskell is the best resource. I really didn't find LYAH very helpful.

Not sure, would help to see your whole query. I'm going to bed but some other user may be able to help.

Significant frame rate increase by ensuring batched draw calls of intersecting polygons don't share the same Z axis value, when using an orthographic projection. Moral of the story: Don't confuse the rasterisation process.

Don't use LYAH.

You making a 2D game user?

uh I'm just reading for theory right now, I don't have anything set up yet

can you recommend a gnu-Linux compatible editor?

I don't like vim or emacs, I'd like one with a mouse interactive GUI that I dont have to spend a month memorizing key combos in order to use effectively.

There was something similar to Atom a while ago but I can't remember the name. It might have had lime in the name?

>this coming from data Bool = True | False | Undefined

yes you can use atom
github.com/simonmichael/haskell-atom-setup

good because you can have ligatures setup

I'm pretty sure Atom works on Linux, and I'd recommend it
There are a bunch of good plugins
Autocomplete, something like intellisense, hlint & type inspection will massively improve your productivity

Have you tried vim properly?

If not, set aside an hour or so, and try going through vimtutor.

Which plugin gives those ligatures?
I've only got one that does:

::, ->, , forall

We don't talk about that.

This post makes my head hurt

Just a simple Newtonian gravity simulation. I recently moved all the CPU physics logic to an OpenGL compute shader as well! It's crazy going from being able to render 1024 particles at 60fps to 32768 at 60fps with plenty of time to spare for regular CPU computation.

well, the old query was about 3 revisions ago. I've started completely remaking the tables.

but, just generally, is the setup, otherwise, good?
still keep media and posts separate and run as 2 queries for the page?

I'll keep looking a bit more. I was originally hoping I might be able to somehow use the group by, but I can't think of a way that might actually work, because I'd need an array from BOTH the posts table AND the media table for each post, and I'm not sure how/if you can limit by a number of different IDs as opposed to number of records.
is there a way to do that?

Finishing wrapping xcb-ewmh in Rust so I can finish my Lumen port and release it.

That shit is huge.

rolling

not a plugin, but font
github.com/i-tu/Hasklig

just put this within atom-text-editor block in atom stylesheet to enable ligatures for the font
atom-text-editor {
text-rendering: optimizeLegibility;
}

I don't really know desu, I'm just slightly familiar with SQL.

You can do physics in a shader? Dafuq?

not really and honestly Haskell is already presenting itself as mind-bendingly difficult, at least in the way that it's being taught to me, and I'd rather not worry about having to mess around with my wm again because I'm using a really comfy/lazy keybind setup that uses multiple base keys and would conflict with vim
Maybe I'm just making excuses to be a pussy tho

It's a bit shit, but I just wanted to get it working:

github.com/OllieReynolds/Simulation/blob/master/cs_particle_physics.glsl

So you would make area the return value of getArea() and don't have a self.area.

It's that simple.

I don't see how python makes it hard to write good libraries.

alright. I can't find anything about using GROUP BY that way on other sites, anyway...

I'll just stick with this. I can always optimize the queries at a later point. Just get them working now.

I was just kinda concerned about whether the tables should be split or as one, but this probably makes the most sense, really.

I'll stick with it for now.