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.

muntedcrocodile , in Please stop

It makes a great headless server

r1veRRR , in Please stop

I have never had a good experience with a Debian server. Every single time I had to add unstable or third party repos to get anything remotely current to run. What’s the point if you have to add unstable shit anyway?

Johanno ,

That sounds like a skill issue.

maxinstuff , in Surely "1337" is the same as 1337, right?
@maxinstuff@lemmy.world avatar

I’ll have you know all of my code is stringly typed.

Agent641 ,

All my binary code is stringy too.

conorab , in Please stop

Mentoning Iceweasel in 2024?! Where did you find this meme?! Debian stable?!

Tangent5280 ,

debian nightly release

NaoPb ,

We don’t talk about what happens in the night.

veganpizza69 , in Surely "1337" is the same as 1337, right?
@veganpizza69@lemmy.world avatar

It’s the API’s job to validate it either way. As it does that job, it may as well parse the string as an integer.

JordanZ ,

Pass in 04401…sorry 4401 is not a valid zip code. Rage.

bleistift2 OP ,

Or even funnier: It gets parsed in octal, which does yield a valid zip code. Good luck finding that.

xthexder ,
@xthexder@l.sw0.com avatar

Well shit, my zip code starts with a 9.

bleistift2 OP ,

I’m not sure if you’re getting it, so I’ll explain just in case.

In computer science a few conventions have emerged on how numbers should be interpreted, depending on how they start:

  • decimal (the usual system with digits from 0 to 9): no prefix
  • binary (digits 0 and 1): prefix 0b, so 0b1001110
  • octal (digits 0 through 7): prefix 0, so 0116
  • hexadecimal (digits 0 through 9 and then A through E): prefix 0x, so 0x8E

If your zip code starts with 9, it won’t be interpreted as octal. You’re fine.

xthexder ,
@xthexder@l.sw0.com avatar

Well, you’re right. I wasn’t getting it, but I’ve also never seen any piece of software that would treat a single leading zero as octal. That’s just a recipe for disaster, and it should use 0o116 to be unambiguous

(I am a software engineer, but was assuming you meant it was hardcoded to parse as octal, not some weird auto-detect)

docAvid ,

It’s been a long time, but I’m pretty sure C treats a leading zero as octal in source code. PHP and Node definitely do. Yes, it’s a bad convention. It’s much worse if that’s being done by a runtime function that parses user input, though. I’m pretty sure I’ve seen that somewhere in the past, but no idea where. Doesn’t seem likely to be common.

bleistift2 OP ,

PHP and Node definitely do.

Node doesn’t.


<span style="color:#323232;">> parseInt('077')
</span><span style="color:#323232;">77
</span>
  1. If the input string, with leading whitespace and possible +/- signs removed, begins with 0x or 0X (a zero, followed by lowercase or uppercase X), radix is assumed to be 16 and the rest of the string is parsed as a hexadecimal number.
  2. If the input string begins with any other value, the radix is 10 (decimal).

developer.mozilla.org/en-US/docs/Web/…/parseInt

docAvid ,

You seem to have missed the important phrase “in source code”, as well as the entire second part of my comment discussing that runtime functions that parse user input are different.

bleistift2 OP ,

You seem to have missed the important phrase “in source code”

I read that, but I thought it was a useless qualifier, because everything is source code. You probably meant “in a literal”.

bleistift2 OP ,

I’ve also never seen any piece of software that would treat a single leading zero as octal

I thought JavaScript did that, but it turns out it doesn’t. I thought Java did that, but it turns out it doesn’t. Python did it until version 2.7: docs.python.org/2.7/library/functions.html#int. C still does it: en.cppreference.com/w/c/string/byte/strtol

xthexder ,
@xthexder@l.sw0.com avatar

Interesting that strtol in C does that. I’ve always explicitly passed in base 10 or 16, but I didn’t know it would auto-detect if you passed 0. TIL.

kamen ,

Oof.

I guess this is one of the reasons that some linters now scream if you don’t provide base when parsing numbers. But then again good luck finding it if it happens internally. Still, I feel like a ZIP should be treated as a string even if it looks like a number.

bitfucker ,

Yep. Much like we don’t treat phone numbers like a number. The rule of thumb is that if you don’t do any arithmetic with it, it is not a “number” but numeric.

sukhmel , (edited )

Well, we don’t, but every electonic tables software out in the wild on the other hand…

/jYes, I know that you can force it to become text by prepending to the phone, choose an appropriate format for the cells, etc, etc The point is that this often requires meddling after the phone gets displayed as something like 3e10

raman_klogius ,

Who tf decided that a 0 prefix means base 8 in the first place? If a time machine was invented somehow I’m going to cap that man, after the guy that created JavaScript.

JackbyDev ,

Should be like 0o777 to mimic hex 0xFF

bleistift2 OP ,

I refuse to validate data that comes from the backend I specifically develop against.

Thcdenton ,
veganpizza69 , in Trying to understand JSON…
@veganpizza69@lemmy.world avatar
howrar , in Alcohol is my way to turn myself on and off again

Reminds me of this story of the wifi that only worked when it rained

predr.ag/blog/wifi-only-works-when-its-raining/

mariusafa , in Please stop

What’s wrong with having a some year old software? Does it do what you need? Yes. Then what? I have all I need on Debian. Why should I care of new updates. Security? Yes we have Debian security because of that. Look, y’all had the xyz backdoor package in your systems because it was new. Me as a Debian stable user I didn’t have to deal with it. Did I lose something by not having the latests software? No. Well maybe less crashes.

Most privative software also gets weekly updates. Does it make it better? No. You may prefer that.

Also I don’t get the point about the version numbering of Debian packages. Every team uses the versioning they want.

From my experience software that updates a lot tends to break old features a lot too.

Debian suporting freesoftware projects or other stuff doesn’t look as a relevant argument. I mean if you prefer using privative stuff and using that kind of software. Do whatever you like with your Google/Facebook/Apple friends.

But don’t come intoxicate the community with this bullshit.

bruh ,

Does it do what you need?

No

phoenixz ,

Cool, get something else, then.

yum13241 ,

Because then people file bug reports for ages old software. Ancient does not equal stable!

Draegur , in Please stop

This makes Debian look kinda good actually…

humbletightband , in Surely "1337" is the same as 1337, right?

The comment section proves that xml is far superior to json

NaoPb , in Alcohol is my way to turn myself on and off again

If you want to know my comment, that’s an idiotic question.

Wilzax , in Surely "1337" is the same as 1337, right?

Protocol Buffers are hated, but they are needed.

JackbyDev ,

Do you actually use them?

Wilzax ,

I’m a student so, yes and no?

sukhmel , (edited )

I do, but I also don’t think that’s a silver bullet, unfortunately. There’s convenience in code generation and compatibility, at least

NigelFrobisher , in Surely "1337" is the same as 1337, right?

This is String - you’ve seen it before haven’t you, Gollum?

laserm , in Coomitter be like

What tying your self worth to a commit graph looks like…

laserm , in Life is hard

Mood

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