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.

jubilationtcornpone , in Infinite Loop

Project A: Has 6 different implementations of the same complex business logic.

Project B: Has one implementation of the complex business logic… But it’s ALL in one function with 17 arguments and 1288 lines of code.

“The toast always lands the buttered side down.”

QuazarOmega ,

Project B is just called neural network

CanadaPlus ,

Actually, I bet you could implement that in less. You should be able to legibly get several weights in one line.

QuazarOmega ,

You have my interest! (Mainly because I don’t know the first thing about implementing neutral networks)

CanadaPlus , (edited )

At the simplest, it takes in a vector of floating-point numbers, multiplies them with other similar vectors (the “weights”), sums each one, applies a RELU* the the result, and then uses those values as a vector for another layer with it’s own weights (or gives output). The magic is in the weights.

This operation is a simple matrix-by-vector product followed by pairwise RELU, if you know what that means.

In Haskell, something like:

layer layerInput layerWeights = map relu $ map sum $ map (zipWith (*) layerInput) layerWeights

foldl layer modelInput modelWeights

Where modelWeights is [[[Float]]], and so layer has type [Float] -> [[Float]] -> [Float].

  • RELU: if i>0 then i else 0. It could also be another nonlinear function, but RELU is obviously fast and works about as well as anything else. There’s interesting theoretical work on certain really weird functions, though.

Less simple, it might have a set pattern of zero weights which can be ignored, allowing fast implementation with a bunch of smaller vectors, or have pairwise multiplication steps, like in the Transformer. Aaand that’s about it, all the rest is stuff that was figured out by trail and error like encoding, and the math behind how to train the weights. Now you know.

Assuming you use hex values for 32-bit weights, you could write a line with 4 no problem:

wgt35 = [0x1234FCAB, 0x1234FCAB, 0x1234FCAB, 0x1234FCAB];

And, you can sometimes get away with half-precision floats.

QuazarOmega ,

That’s cool, though honestly I haven’t fully understood, but that’s probably because I don’t know Haskell, that line looked like complete gibberish to me lol. At least I think I got the gist of things on a high level, I’m always curious to understand but never dare to dive deep (holds self from making deep learning joke). Much appriciated btw!

CanadaPlus ,

Yeah, maybe somebody can translate for you. I considered using something else, but it was already long and I didn’t feel like writing out multiple loops.

No worries. It’s neat how much such a comparatively simple concept can do, with enough data to work from. Circa-2010 I thought it would never work, lol.

QuazarOmega ,

Ikr! It still sounds so incredible to me

TheFerrango ,

Only 1288 lines? Can I raise you a 6000+ lines stored procedure that calls to multiple different sql functions that each implements a slightly different variation of the same logic?

Miaou ,

Are there triggers in the sql database? It’s too easy otherwise

TheFerrango ,

There are on delete triggers to fix circular dependencies when deleting rows, triggers on update and triggers on row creation!

MajorHavoc ,
martinb ,

Feels like my old job.

Buttons , in The AI plugins in my IDE right now
@Buttons@programming.dev avatar

There was a research paper that took a variety of weaker LLMs and randomly asked each one to generate the next word, and it actually turned out really well.

Evilschnuff , in The AI plugins in my IDE right now

How is jetbrains AI integration into their IDEs? I assume not perfect since you have more than one system.

RustyNova ,

I don’t personally have it, but I am using webstorm 2024.1 beta that has line generation. This is simply tab to complete the generated line, escape to remove the gen and focus on intellisence.

I won’t lie, the line gen is crap. I’d rather use my self hosted RefactAI docker but the plugin isn’t compatible for 2024.1 yet

EvokerKing ,

The conversational part is really good though. I love that it has access to my code without having to paste it so I can just say “on line 274” or something. It’s apparently not good at generating code but if you were using it for that you should learn how to code. But it’s really good at fixing errors and issues.

RustyNova ,

I don’t use chat, as it never really have been more than a digital rubber ducky for me.

And it’s not really generating lots of code. Most of the time it’s just generating constructors/factory functions, or something easy like summing a vector of integers.

My philosophy is that my brain comes first, if the AI did what I was thinking of, then press tab. I ain’t debugging a AI made function for two hours when I can make it in an hour

kassuro ,

It’s the same way for me. I don’t know if my work is this trivial or I’m just “good enough” at it, but it takes me much longer to prompt the chat to get what I want than it takes me to just write it myself.

I honestly kinda feel like I’m using this ai stuff wrong, but outside of generating some basic unit tests and a little better auto complete it feels kinda useless in my day to day work.

RustyNova ,

Yeah. It’s really just “”“smarter”“” auto complete. Quite good at pattern completion like simple constructors or switch cases with one change.

I get the same feeling of using it wrong, but I mostly think it’s AI bros chilling the tech too much. Or that I am a boomer

kassuro ,

Well I hope it’s ai bros haha.

I kinda feel sad about this whole ai tooling. For me programming was always more like art. But this gets lost now with all the ai stuff.

I sound like an old man yelling at clouds.

Buttons , in Bug Fixing
@Buttons@programming.dev avatar

If that doesn’t work, sometimes your computer just needs a rest. Take the rest of the day off and try it again tomorrow.

PoolloverNathan , in Bug Fixing

One of my old programs produces a broken build unless you then compile it again.

mindbleach ,

Some code has bugs.

Some code has ghosts.

lauha , in Sleep() at home

I can relate. We have breaks ate work too.

Aceticon , in Bug Fixing

Well, duh! You need to use the right incantations!

DeepGradientAscent ,
@DeepGradientAscent@programming.dev avatar

All praise the Omnissiah, so on, and so forth.

TurboHarbinger ,

Something something motive force.

Pantrygheist , in Bug Fixing

That’s step zero: rule out black magic

DragonTypeWyvern ,

That feeling when it is, in fact, computer ghosts.

embed_me ,
@embed_me@programming.dev avatar

Those damn cosmic rays flipping my bits

blanketswithsmallpox ,

Please tell me you look skyward, shake your fist and yell damn you!!!

CanadaPlus ,

I wonder if there’s an available OS that parity checks every operation, analogous to what’s planned for Quantum computers.

Danitos ,

Unrelated, but the other day I read that the main computer for core calculation in Fukushima’s nuclear plant used to run a very old CPU with 4 cores. All calculations are done in each core, and the result must be exactly the same. If one of them was different, they knew there was a bit flip, and can discard that one calculation for that one core.

CanadaPlus , (edited )

Interesting. I wonder why they didn’t just move it to somewhere with less radiation? And clearly, they have another more trustworthy machine doing the checking somehow. A self-correcting OS would have to parity check it’s parity checks somehow, which I’m sure is possible, but would be kind of novel.

In a really ugly environment, you might have to abandon semiconductors entirely, and go back to vacuum as the magical medium, since it’s radiation proof (false vacuum apocalypse aside). You could make a nuvistor integrated “chip” which could do the same stuff; the biggest challenge would be maintaining enough emissions from the tiny and quickly-cooling cathodes.

xor , in Bug Fixing

could be a race condition

vamputer ,
@vamputer@infosec.pub avatar

Hmm…you may be right. I’ll get my Hispanic friend to run it and see if he gets the same result.

aiden ,

It works on my machine

gaston1592 ,

ok, then we ship your machine.

DeepGradientAscent ,
@DeepGradientAscent@programming.dev avatar

I, too, enjoy containers.

rimjob_rainer , in GTA 5 Java Coffee shop

Why does someone come up with java code for an in-game coffeeshop and then make an obvious mistake? Or is that on purpose and they are trolling?

DirkMcCallahan , in Bug Fixing

I often do this, but I always hit Ctrl-S before running it again. Shamefully, this probably works about 10% of the time. Does that technically count as changing nothing?

LazaroFilm ,
@LazaroFilm@lemmy.world avatar

That and a make clean can work wonders.

dependencyinjection ,

Autosave on focus loss dude.

KingBoo , in Bug Fixing

Me: “Hmm… No… No the code is good, it’s the compiler that’s wrong.”

runs again

runswithjedi ,

deleted_by_author

  • Loading...
  • Isoprenoid ,

    It’ll be done soon, then I can go home. TGIF, am I right?

    MajorHavoc , (edited )

    Yeah. And I can send a quick email to update the team after I get home from my 45 minute commute, then log off and go to the cottage in that cell signal dead spot by the lake.

    nieceandtows , in Bug Fixing

    Just had that happen to me today. Setup logging statements and reran the job, and it ran successfully.

    TurtleTourParty ,

    I’ve had that happen, the logging statements stopped a race condition. After I removed them it came back…

    Hupf ,

    Thank you for playing Wing Commander!

    Aria , in Bug Fixing

    Somehow higher than 0% success rate.

    Peafield , in Bug Fixing

    The first is a surprise; the second is testing.

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