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.

jabjoe , in Stop using floats
@jabjoe@feddit.uk avatar

As a programmer who grew up without a FPU (Archimedes/Acorn), I have never liked float. But I thought this war had been lost a long time ago. Floats are everywhere. I’ve not done graphics for a bit, but I never saw a graphics card that took any form of fixed point. All geometry you load in is in floats. The shaders all work in floats.

Briefly ARM MCU work was non-float, but loads of those have float support now.

I mean you can tell good low level programmers because of how they feel about floats. But the battle does seam lost. There is lots of bit of technology that has taken turns I don’t like. Sometimes the market/bazaar has spoken and it’s wrong, but you still have to grudgingly go with it or everything is too difficult.

GroteStreet ,

all work in floats

We even have float16 / float8 now for low-accuracy hi-throughput work.

frezik ,

Even float4. You get +/- 0, 0.5, 1, 1.5, 2, 3, Inf, and two values for NaN.

Come to think of it, the idea of -NaN tickles me a bit. “It’s not a number, but it’s a negative not a number”.

zaphod ,

I think you got that wrong, you got +Inf, -Inf and two NaNs, but they’re both just NaN. As you wrote signed NaN makes no sense, though technically speaking they still have a sign bit.

frezik ,

Right, there’s no -NaN. There are two different values of NaN. Which is why I tried to separate that clause, but maybe it wasn’t clear enough.

AnUnusualRelic ,
@AnUnusualRelic@lemmy.world avatar

But if you throw an FPU in water, does it not sink?

It’s all lies.

calcopiritus ,

I’d have to boulder check, but I think old handheld consoles like the Gameboy or the DS use fixed-point.

jabjoe ,
@jabjoe@feddit.uk avatar

I’m pretty sure they do, but the key word there is “old”.

gandalf_der_12te ,

IMO, floats model real observations.

And since there is no precision in nature, there shouldn’t be precision in floats either.

So their odd behavior is actually entirely justified. This is why I can accept them.

jabjoe ,
@jabjoe@feddit.uk avatar

I just gave up fighting. There is no system that is going to both fast and infinitely precision.

So long ago I worked in a game middleware company. One of the most common problems was skinning in local space vs global space. We kept having customers try and have global skinning and massive worlds, then upset by geometry distortion when miles away from the origin.

swordsmanluke ,

How do y’all solve that, out of curiosity?

I’m a hobbyist game dev and when I was playing with large map generation I ended up breaking the world into a hierarchy of map sections. Tiles in a chunk were locally mapped using floats within comfortable boundaries. But when addressing portions of the map, my global coordinates included the chunk coords as an extra pair.

So an object’s location in the 2D world map might be ((122, 45), (12.522, 66.992)), where the first elements are the map chunk location and the last two are the precise “offset” coordinates within that chunk.

It wasn’t the most elegant to work with, but I was still able to generate an essentially limitless map without floating point errors poking holes in my tiling.

I’ve always been curious how that gets done in real game dev though. if you don’t mind sharing, I’d love to learn!

jabjoe ,
@jabjoe@feddit.uk avatar

That’s pretty neat. Game streaming isn’t that different. It basically loads the adjacent scene blocks ready for you to wonder in that direction. Some load in LOD (Level Of Detail) versions of the scene blocks so you can see into the distance. The further away, the lower the LOD of course. Also, you shouldn’t really keep the same origin, or you will hit the distort geometry issue. Have the origin as the centre of tha current block.

ZILtoid1991 ,

Floats make a lot of math way simpler, especially for audio, but then you run into the occasional NaN error.

jabjoe ,
@jabjoe@feddit.uk avatar

On the PS3 cell processor vector units, any NaN meant zero. Makes life easier if there is errors in the data.

nickwitha_k , in As someone not in tech, I have no idea how to refer to my tech friends' jobs

I’m a Senior Software Engineer, outside of countries where engineer is a protected title. I’m also a Beep-Boop Technician, Specialized Generalist (not Full-Stack since I have mostly succeeded in avoiding JS, until this afternoon), Problem Fixer, Technical Diplomat, Cat Herder (sometimes a tech lead), and The-Mean-Guy-That-Rejects-Commits-When-There-Are-API-Calls-Made-Without-TLS-Encryption-And-Hardcoded-Secrets (infosec likes me but always seems genuinely confused at a dev not fighting them).

LifeOfChance ,

I’m sorry, come again?

nickwitha_k ,

I’m a Senior Software Engineer, outside of countries where engineer is a protected title. I’m also a Beep-Boop Technician, Specialized Generalist (not Full-Stack since I have mostly succeeded in avoiding JS, until this afternoon), Problem Fixer, Technical Diplomat, Cat Herder (sometimes a tech lead), and The-Mean-Guy-That-Rejects-Commits-When-There-Are-API-Calls-Made-Without-TLS-Encryption-And-Hardcoded-Secrets (infosec likes me but always seems genuinely confused at a dev not fighting them).

PmMeFrogMemes ,

sounds like a cool job y’all hiring haha jk unless

nickwitha_k ,

Not on my team, unfortunately but, I’ll check. What languages/experience have you got?

PmMeFrogMemes ,

Oh man, I didn’t think that’d work haha… Kind of you to offer but I was recently promoted and wouldn’t feel right leaving now. Partially out of respect for my boss and partially because we are severely understaffed. But seriously, thanks for offering to ask around. Very generous of you to offer your help to a stranger ❤️

nickwitha_k ,

No worries. We’re all in this together <3

Theharpyeagle ,

I’m learning that I’m just enough of a front end dev to make a very ugly site. Navigating all the various CSS and JS frameworks feels like pulling teeth.

nickwitha_k ,

Having a familiarity is absolutely a great thing. The syntax isn’t alien, so, debug and guiding juniors through figuring out why their project isn’t working isn’t too terrible. The typing is probably what drives me crazy the most. It’s just bad and the standard library doesn’t seem to be equipped to handle every type that it can “support” cleanly.

AA5B ,

since I have mostly succeeded in avoiding JS, until this afternoon

Sorry to hear that. I hit the same pothole about 6 months ago. I had been so fine with avoiding JS, but the guys building our admin console broke their build and couldn’t figure out how to fix it. Even worse, then I had to write up best practices for JS

nickwitha_k ,

Yeah. Fortunately, I didn’t have to do the programming. Unfortunately, I had to guide the debug. Happy to help people learn but the language, especially in its typing, is just awful.

davetapley , in Songs about Vim
ironhydroxide , in Tattoo Idea

If it were the right hand you could’ve done /24 on the thumb

JoMomma , in Tattoo Idea

Class C warfare

null , in Touch a file in Linux

Is there a command that’s actually just for creating a new file?

ezchili ,

I guess printf “” > file

48954246 ,

Feels dangerous to run. What happens if the file already exists and has something important in it?

touch -a is probably better

gaterush ,

The other command could just be printf ‘’ >> file to not overwrite it. Or even simpler >>file and then interrupt

owsei ,

or :>>file then you don’t need to interrupt

4am ,

.“:>>” is “append null” right? Do you get a file with a single ASCII NUL or is it truly empty?

al177 ,

$ :|wc -c 0 $ touch /tmp/f; :>>/tmp/f; wc -c /tmp/f 0 /tmp/f

0x0 ,

Not really. I believe : is the “true” builtin. So it’s like running a program that exits with zero and writes nothing to stdout. The >> streams the empty stdout into the named file.

gaterush ,

that’s awesome, did not know about that handy operator!

owsei ,

Yeah!

it’s basically a noop, I use it as a placeholder when I’m writing a script, since bash doesn’t accept code blocks with no commands

Midnitte ,

I mean, nano filename will work, but there’s no mkfile that I can find…

$>filename would also work, but it’s not explicitly for creating a new file

gamma ,
@gamma@programming.dev avatar

Nope. If you open a nonexistent path and you have permissions to write to that directory, then that file is created.

tranzystorek_io ,
@tranzystorek_io@beehaw.org avatar

most shells will accept outputting from a silent command to a file, e.g. :> foo.txt (where : is the posix synonym to the true command)

dan ,
@dan@upvote.au avatar

How often do you actually need a blank file though? Usually you’d be writing something in the file.

null ,

I’m betting that’s why none ever materialized. Most tools that can manipulate a file, can also create that file first, so there’s just never been a usecase.

Right-clicking the desktop to create a new txt file in Windows feels so natural, but I can’t really think of any time you’d want to create a new file and do nothing with it in a CLI.

schnurrito ,

You might if some other program checks whether that file exists and behaves differently depending on that.

null ,

But even still, what’s a realistic usecase that would that involve needing a blank, unmodified file in that instance?

indepndnt ,

One use case is if you’re running a web server that is configured to return a “maintenance” page instead of the live site if a particular file exists. Which is actually pretty cool because then you don’t have to update the config when you need to do something or let your users get a bunch of 502 errors, you just touch maintenance and you’re good.

null ,

That’s a good one!

xigoi , in Songs about Vim
@xigoi@lemmy.sdf.org avatar

Is there any playlist that wouldn’t be improved by adding Cat by C418 at the end?

chraebsli OP ,
@chraebsli@programming.dev avatar

there aren’t.

& most people don’t even know what/ who C418 is…

stebo02 ,
@stebo02@lemmy.dbzer0.com avatar

most people don’t even know what/ who C418 is…

most people would recognise his songs though…

Gobbel2000 ,
@Gobbel2000@feddit.de avatar

Cat by C418 is literally the only piece in the list I recognize.

Cethin ,

He was that guy working on the music for that 0x10c game, right?

quylaa ,

Pour one out for 0x10c

kogasa ,
@kogasa@programming.dev avatar

Haven’t heard of 0x10c since 2012. Shame it was canceled, I love Elite and would love more games in its niche

Cethin ,

I’ve found Ostranauts recently, and it’s really fun and I feel has some of the same vibes. Not even close to the same though, being able to program your own systems that you put together. I still sometimes think about what 0x10c could have been. I’ve considered doing something similar myself, but I haven’t gotten around to it. Maybe someday something similar will exist.

Cwilliams ,

MINECRAFT!!!

match , in Songs about Vim
@match@pawb.social avatar

easy mnemonic to quit vim: imagine you’re captain Picard in the middle of typing “:3” when Q shows up

Crow ,

Or, hear me out, : because you’re doing a command, and then q for quit. Probably make it wq too, to write and quit

chraebsli OP ,
@chraebsli@programming.dev avatar

did you know there is a vim tutor for learning how to vim?

TheRedSpade ,

vimtutor, which I believe is installed with vim by default

Edit: My brain apparently inserted an extra word that made it seem like you were seeking said program. Leaving it though for those wondering in the future.

Crow ,

Yeah, but imo the best way to learn vim is to do it as you go. You only really need to know getting in and out of insert and how to write and quit. Once you’ve got that, if you wanna do something and think there’s probably a better way than moving there with the arrow keys, look it up on the Internet, remember the thing, do it a few times and you’ve learned a new thing about vim. “Surely there’s a search and replace function” yeah, is substitute with the s command. “I wanna navigate quicker within lines” use f, t and their capital versions. Combine with the quickscope plugin and you’re golden. Learn the stuff you want to use, don’t memorize commands you don’t need

kautau ,

Forgot

Escape first, because it wants to keep you inside the matrix and you need to tell it you are trying to escape

q!

Because you probably don’t want to save whatever you’ve accidentally done to that file trying to quit, and you have to add an exclamation point because unless you yell loudly at vim it won’t listen

Simon ,

That’s one too many letters. Need to use x for maximum efficiency gains.

Cethin ,

No, that doesn’t make any sense. We need something convoluted so that people don’t remember it next time it’s needed.

Cwilliams ,

Tell that to my history teacher…

Zip2 , in As someone not in tech, I have no idea how to refer to my tech friends' jobs

My boss once referred to me as “code bastard”. I’m keeping it.

dylanTheDeveloper ,
@dylanTheDeveloper@lemmy.world avatar

Scrum Lord has a air of royalty to it aswel

makingStuffForFun , in Touch a file in Linux
@makingStuffForFun@lemmy.ml avatar

As a Linux user, that is truly magical, and beautiful.

xmunk , in Touch a file in Linux

Remember to confirm consent before touching.

IsoSpandy ,

You can only touch in places where you have permission to touch.

lseif ,

sudo touch woman

sukhmel ,

Iseif is not in the sudoers file. This incident will be reported.

lseif ,

to whom, perchance?

lud ,
thecodeboss ,

Omg I hadn’t seen this one before, laughing so hard

gaael ,
snaggen , in Songs about Vim
@snaggen@programming.dev avatar

I have been a vim user for more than 20 years. I tried to quit for a couple of years, but now I have just accepted my faith.

RustyNova ,

Vim enthusiasts are just people with late stage Stockholm syndrome

RustyNova , in Touch a file in Linux

I’m way to used to doing nano file.txt that I always forget about touch.

Although most times, if I create a file, it’s to put something in it

debil ,

If you need multiple files for testing a script or such: touch file{1…5}.txt

emptiestplace ,

If you’re having a party or whatever: touch *

DannyBoy ,

I do the opposite, I forget I can just create a file with nano. I run touch then open it with nano after to edit.

emptiestplace ,

That’s weird. Stop it.

Octopus1348 ,
@Octopus1348@lemy.lol avatar

I usually do open filename because I prefer GUI text editors.

sunbeam60 , in After all, Why shouldn't i use Excel as my database?

Thing is, I can express in Excel in 2 hours what takes two weeks to develop in production. And I’m not arguing against moving things onto a production footing. But hot damn, as a prototyping tool for how to treat data, Excel and Jupyter is near flawless.

TurtleTourParty , in After all, Why shouldn't i use Excel as my database?

It’s normal on Qobuz too.

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