There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

programmer_humor

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

jtk , in Happy New Year Coders.
@jtk@lemmy.sdf.org avatar

Happy Yesterday++ Day!

lseif ,

so every day ?

jtk ,
@jtk@lemmy.sdf.org avatar
Hector_McG , in 4 billion if statements

I first saw this joke back in the days of 8-bit home microcomputers. Of course then it only needed 256 lines of code, and took up about 8k of your precious, precious RAM.

arc , in Happy New Year Coders.

I actually got off my arse and did some productive programming over the Christmas break. Spent too long vegetating in front of the computer watching YouTube vids or playing games.

floofloof , in Happy New Year Coders.

Oh, those are arms. I thought the moustache was a bit too stylish for the character.

Primarily0617 , in no.. just no

if you don't believe that adding more structure to the absolute maniacal catastrophe that is sql is a good thing then i'm going to start to have doubts about your authenticity as a human being

GBU_28 ,

Huh? Sql is one of the most powerful, action packed (as in you can move lots of shit with few commands) languages out there.

It’s transferable and ubiquitous.

Primarily0617 ,

powerful isn't the same as well-structured

it was written to be a language that anybody could read or write as well as english, which just like every other time that's been tried, results in a language that's exactly as anal about grammar as C or Python except now it's impossible to remember what that structure is because adding anything to the language to make that easier is forbidden

when you write a language where its designers were so keen for it to remain human readable that they made deleting all rows in a table the default action, i don't think "well structured" can be used to describe it

GBU_28 ,

Disagree, the difference between “week structured” and needing to know the rules of the verbs is pretty big, to me.

QuazarOmega , (edited )

Me trying to remember on whose output data having, count, sum, etc. work

Once you know functions you would have no reason to go back.
I propose we make SQL into this:


<span style="color:#323232;">const MAX_AMOUNT = 42, MIN_BATCHES = 2
</span><span style="color:#323232;">
</span><span style="color:#323232;">database
</span><span style="color:#323232;">    .from(table)
</span><span style="color:#323232;">    .where(
</span><span style="color:#323232;">        (amount) => amount < MAX_AMOUNT,
</span><span style="color:#323232;">        table.field3
</span><span style="color:#323232;">    )
</span><span style="color:#323232;">    .select(table.field1, table.field3)
</span><span style="color:#323232;">    .group_by(table.field1)
</span><span style="color:#323232;">    .having(
</span><span style="color:#323232;">        (id) => count(id) >MIN_BATCHES
</span><span style="color:#323232;">        table.field0
</span><span style="color:#323232;">    )
</span>

(Sorry for any glaring mistakes, I’m too lazy right now to know what I’m doing)

…and I bet I just reinvented the wheel, maybe some JavaScript ORM?

xep ,
QuazarOmega , (edited )

Thanks for the suggestion! It looks interesting, not quite what I expected looking at that file*, but that may very well be better

Edit: other examples seem a bit more similar to mine, cool!

rubythulhu ,

most languages have some first or third party lib that implements a query builder

expr , (edited )

Because you never learned SQL properly, from the sound of it.

Also, ORMs produce trash queries and are never expressive enough.

QuazarOmega ,

Because you never learned SQL properly, from the sound of it.

You might be right, though, to be fair, I also keep forgetting syntax of stuff when I don’t use it very often (read SQL (._.`))

Also, ORMa produce trash queries and are never expressive enough.

I meant to say that I would like the raw SQL syntax to be more similar to other programming languages to avoid needing to switch between thinking about different flows of logic

emptyother ,
@emptyother@programming.dev avatar

ORMs produce good queries if you know what you do. Which requires proper knowledge of SQL, unfortunately.

drathvedro ,

No. The arrow function in where eliminates any possibility of using indexes. And how do you propose to deal with logical expressions without resorting to shit like .orWhereNot() and callback hell? And, most importantly, what about joins?

cupcakezealot ,
@cupcakezealot@lemmy.blahaj.zone avatar

but sql doesn’t need to be structured that’s what abstraction layers and models are for

Lem453 ,

SQL is literally structured query language

expr ,

SQL is incredibly structured. It’s also a very good language, and developers need to stop piling on junk on top of it and producing terrible queries. Learn the damn language. It’s not that hard

takeda , in 10 months later bill revisits his spaghetti code. forgets absolutely everything and refuses to elaborate. this wouldn't have happened if Bill forgot to comment on his code

I’m Bill I don’t comment my code (except complex parts), instead I try to make code clear, including using proper variable and function names and try to keep functions short. I don’t think I ever got lost in my own code in my 20+ years of experience. Even got complements about it.

The programming language is meant for humans to read/write, if you need to put comments to understand your code then your code sucks.

suodrazah ,

Use comments to describe the philisophy of the code, the why. And any non obvious extended relationships. Risk. Etc.

Comments on function are typically a waste of space.

NuXCOM_90Percent ,

Commenting is an art. Too much and it is outright misleading after the first hotfix. Too little and only the original developer can maintain it

But uncommented code is a dick move. And, more importantly, it means you can’t punt bug fixes to the intern

krellor ,

When writing basic business code, structuring the code well and having good naming standards means you shouldn't need a ton of comments, but you should still have some. Plus, using structured function content blocks gives you intellisense in some languages and IDEs, which is important for code reuse in teams.

However, when I was doing scientific programming I'd have comments for almost every line at times where I put the mathematical formula and operations the line represents. Implementing a convolution neutral network with parameters to dynamically scale the layers or MPI stochastic simulations is much different than writing CRUD functions or basic business logic.

robdor ,

I think that makes you Phil, not Bill. Thanks for the good work you do Phil.

ILikeBoobies ,

Comments are there to make your ctrl + f’s faster

kameecoding , in Happy New Year Coders.

That’s kinda sad though.

PixxlMan ,

Nah programming is awesome 😎

The guy only looks unhappy on the outside, inside he’s pleased to be programming lol

CanadaPlus ,

Yes. Normally, the format shows when he realises he has to debug and collapses on the keyboard, but not this time.

xor , in Good luck web devs

a great prank for computer labs… just rotate everything by 0.5 degrees…

Rin ,

Yeah, keep adding 0.5 deg every minute or so.

Zangoose OP ,

Add a randomizer that has a chance of resetting it back to normal every now and then for maximum chaos

Reptorian , in no.. just no

I kind of like it. I can understand where it start and end.

doppelgangmember , in Happy New Year Coders.

Bro what a lie

What birthday gifts ???

embed_me , in Happy New Year Coders.
@embed_me@programming.dev avatar

What is it on New year’s? Beer with?

funkajunk ,
@funkajunk@lemm.ee avatar

3 pixels.

brennesel ,

Here is the original source with better resolution.

Looks like a can of Tuborg beer.

CrypticCoffee , in This is what being a Redditor does to your life

Become a professional, then you’ll commit every time you make a small bit of functionality. If you’re doing massive changes like this, you haven’t broken something after multiple days of code enough. When you do that and you have no idea what you broke it with and when, it conditions you towards small iterable chunks.

narc0tic_bird ,

This. Instead of making commits time-based (for example once per hour or once per day), make them purpose-based (say, add a database migration in one commit, and change the color of a button in another one). This also makes it easy to cherry-pick or otherwise backport specific changes to different program versions gor example.

Awkwardparticle ,

I learned this the hard way, I forgot to commit for a single day and got burned really bad when my regression tests failed and I could not trace the issue(it is called source control for a reason). I declared it was more efficient to revert back to the last commit than spend time fixing broken code that I had no fucking clue where it was and the only thing I had to go by was that it happened between two commits with a whole work day between.

wulrus ,

I work a lot with the local history of the IDE, where I can also set labels to a current state. In addition, it creates its own labels like last time all tests were green etc.

Still, in one of my last project that really lived TDD, they made a good point that I should just push as often as I label, since that also triggers all sorts of other tests which I usually don’t run locally, or not as often.

I had “rearrange code” checked once for a commit, and fortunately, it had automatically saved the exact state before that.

syd , in Good luck web devs
@syd@lemy.lol avatar

I won’t try implement something like this even my boss forces me.

muzzle , (edited )

No one does this kind of stuff because someone asked them to do it. This is the kind of useless, insane stuff you do for the lulz, or because someone dared you.

Kolanaki , in Good luck web devs
@Kolanaki@yiffit.net avatar

How many minor operating systems support it? 🤔

backhdlp ,
@backhdlp@lemmy.blahaj.zone avatar

I’m assuming most that can run Xorg.

jol ,

There’s ReactOS and BSD off the top of my head.

lynx , in Good luck web devs

How can you do fractional rotation? Does it only work with x11 or is it also supported in wayland?

Chewy7324 ,

Rotating the display by a custom angle is possible through xrandr on X.org.

There’s no Wayland protocol for custom angle rotation, and I don’t expect anyone to create a protocol extension without a use-case.

My wild guess: Theoretically it should be possible for a compositor to support similar custom rotation, as applications simply draw to their surface (window), without knowing how and where it is displayed on the viewport (display).

But it might require quite a bit of work, depending on the project, so I don’t expect to ever see custom rotation on anything besides smaller/niche compositors.

[1] unix.stackexchange.com/…/rotate-a-display-by-cust…

nintendiator ,

There’s no Wayland protocol for custom angle rotation, and I don’t expect anyone to create a protocol extension without a use-case.

Puh-lease. It’s Wayland; the devs fully and honestly expect every app developer (eg.: calc, Libreoffice, notepad.exe) to implement custom angle rotation on their own.

Vilian ,

in wayland the compositor is king they can do mhatever they want with the screen

m.youtube.com/watch?v=ZBLLC5fOy98&list=PLb7YRKEhW…

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines