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.

devilish666 , in My wife was unimpressed by Vim

Maybe your wife is either VSCode or Atom gang

gravitas_deficiency , in What are variables and semicolons for actually?

Now do it without using commas

TadoTheRustacean OP ,

Challenge accepted! If I won’t procrastinate from this procrastinating, tomorrow will be a version 2 without commas!

TadoTheRustacean OP ,
gravitas_deficiency ,
python , in Hilarious

I’ll do you one better

function* sorry() { yield “I’m sorry”; }

Call sorry.next().value as many times as you need to baby, hell you can even use it in a for-of loop because Generator functions are Iterable. I fucking love JavaScript

brian ,

lol that doesn’t work either tho. it yields the string once and then is done. you still need a loop inside

python ,

You’re right! That’s actually a really cool point about Generator functions too, them having while(true) loops is very unproblematic :D

I’m correcting myself to:

function* sorry() { while(true){ yield “I’m sorry”; } }

FuryMaker , in New language

Obligatory XKCD:

xkcd.com/927/

jollyrogue , in Rebase Supremacy

git rebase is only for terrorists. 🥸

Also for me when I’ve been drinking and committed some really stupid shit into the repo. No one needs to know what I really think of my team members.

7heo ,

Yeah totally merge everything, people like a good spaghetti salad.

Scrollone ,

spaghetti salad

Found the German :D

deegeese , in Floating point Maths

Also 1-1 ≠ 0

Turun ,

Are you sure? I’ve never seen that inequality before.

Edit: and at least python agrees with me


<span style="color:#323232;">print(0.1 + 0.2)  # 0.300...0004
</span><span style="color:#323232;">print(1.0-1.0)  # 0.0
</span>
h3ndrik ,

I think it’s equal zero in this case. I’d have to look up the IEEE specification to make sure. AFAIK it’s just not guaranteed for any numbers and depends on the floating point implementation. A general rule of thumb for programmers is not to use ‘equal’ with floating point numbers.

Turun ,

The example is wrong, because they used 1.0.

But in general x-x does not have to equal 0, that is true. I’m pretty sure Nan and infinity would yield not 0.0, but Nan instead.

And if you reach x with two different calculations, e.g. x1 = a - b - c and x2 = a - c - b it is certainly not guaranteed that x1 - x2 == 0.0

mokus ,

This is correct. Additionally, if x is NaN, then x ≠ x.

FizzyOrange ,

It does. x-x == 0 is true unless x is NaN or infinity.

SpaceNoodle ,

Positive or negative zero?

tatterdemalion , in Review Please
@tatterdemalion@programming.dev avatar

This does seem like a potential issue if the PR is itself implementing more than one vertical slice of a feature. Then it could have been smaller and there might be wasted effort.

If the patches are small and well-organized then this isn’t necessarily a bad thing. It will take more than one day to review it, but it clearly took much more time to write it.

Blamemeta ,

True, but at the same time its very possible to go too small. A bunch of one line code reviews can really slow progress easily.

tatterdemalion ,
@tatterdemalion@programming.dev avatar

Right but it’s pretty rare that a tiny PR actually accomplishes a valuable user story.

So my point is just that lines of code is mostly irrelevant as long as it’s organized well and does no more than necessary to accomplish the agreed upon goal.

magic_lobster_party ,

Stuffing multiple tasks into one PR is often bad.

  • It’s harder to review. As a reviewer it’s difficult to know which code change is related to which task.
  • It’s harder to verify. Did you really test every change you made?
  • You might end up with a “hostage” situation. There might be a few code changes in the PR that looks good and is really wanted, but other code changes in the same PR of lower quality. As a reviewer, should you just let these lower quality code changes slide so you can bring in the code change you really want? Probably not, but you’re going to let it slide either way.
jjjalljs ,

You might end up with a “hostage” situation.

Reminds me of a guy I used to work with.

He’d have like a pretty normal PR to do something like change a field to be read only in some API. But then snuck into the pr there’d also be something like “change application to run locally different than prod for entirely selfish reasons” or “lower global coverage requirements” or “disable type checking in this whole folder”

magic_lobster_party ,

I also worked with a guy like that. Impossible to predict what he was going to do in his next PR. Always a nightmare to review. Also exhausting to argue with, so let some things slide because I was so done dealing with his bs.

jjjalljs ,

This guy was also difficult to argue with. He was always professional, which I guess is worth something.

One time he tried to remove all the types from a bunch of code “because they were all going to change later.” I refused to allow this. We went back and forth in the comments for hours. I think eventually the lead or boss got involved. Thankfully people sided with me.

His “later” project that was allegedly going to change all the things was rejected by the team. The code in question is still used and properly typed a year later.

perviouslyiner , in Whoa there buddy, calm down

One possible countermeasure being en.wikipedia.org/wiki/Deniable_encryption

CosmicTurtle ,

There was an encryption system a few years ago that offered this out of the box.

I can’t remember the name of it but there was a huge vulnerability and basically made the software unusable.

Crypt box or something like that.

perviouslyiner ,

The prominent one was called Marutukku - and the developer turned out to be someone who might actually need the feature.

MentalEdge ,
@MentalEdge@sopuli.xyz avatar

I know veracrypt has a form of this. You can set up two different keys, and depending on which one you use, you decrypt different data.

So you can encrypt your stuff, and if anyone ever compels you to reveal the key, you can give the wrong key, keeping what you wanted secured, secure.

mojofrododojo , (edited )

won’t they know there are files they haven’t decrypted?

if it could hide or delete the remaining files encrypted that would be nifty.

milicent_bystandr ,

Full disk (/partition) encryption means you don’t know what files there are until you decrypt. Additionally for that sort of encryption scenario you fill the partition with random data first so you can’t tell files from empty space (unless the attacker can watch the drive over time).

Ookami38 ,

If you set it up correctly, this is essentially what it does. You have a disc that is, say, 1tb. It’s encrypted, so without a key, it’s just a bunch of random noise. 2 keys decrypt different vaults, but they each have access to the full space. The files with the proper key get revealed, but the rest just looks like noise still, no way to tell if it’s empty space or if it’s a bunch of files.

This does have an interesting effect. Since both drives share the same space, you can overfill one, and it’ll start overwriting data from the second. Say you have a 1tb drive, and 2 vaults with 400gb spent. If you then go try to write like, 300gb of data to one vault, it’ll allow you to do so, by overwriting 200gb of what the drive thinks is empty space, but is actually encrypted by another key.

018118055 ,

As referred in other comment, the counter counter is to just keep beating to get further keys/hidden data.

Ookami38 ,

Game theory would lead you, as the tortured, to realize that they’re just going to beat you until death to extract any keys you may or may not have, so the proper answer is to give them 1 and no more. You’re dead anyway, may as well actually protect what you thought was worth protecting. Giving 1 key that opens a dummy vault may get the torturers to stop at you, thinking this lead is a dead one.

018118055 ,

Probably best to avoid systems with known deniable encryption methods, and keep your dummy data there. Then hide your secrets e.g. in deleted space on a drive, in the cloud, or a well-hidden micro-sd card. All have risks, maybe it’s best of all to not keep your secrets with you, and make sure they can’t be associated with you.

Enoril , (edited ) in Aaargh....my eyes......my eyes......

I don’t see the benefit of this long naming convention…

It still allow bug to exist… like the fact that, with this code, the player can still play with 0 Hp.

Should have been better to put a “if(health <= 0)” instead of “< 0”

nikscha ,

Came scrolling for this ^^

joshfaulkner ,

I asked this question on this post on a different instance, but would there be issues being that the code compares a float to integer zero “0”?

BombOmOm , (edited )
@BombOmOm@lemmy.world avatar

Since the health is a float, yeah, it can create issues. A health of 0.000000001 is greater than zero, but that would almost assuredly be displayed to the user as simply 0, causing player confusion. The easiest solution is to have health and damage always be integers. A less great solution is to use a non-floating point decimal format. If such doesn’t exist in your language, you can emulate one by having health and damage both always be integers, but move the decimal point over, say two points, when displaying it to the user.

mindbleach ,

Kreed rule.

stockRot ,

It sounds like the only concern you have with code is its bugginess, which is short sights. This is unfortunately better documented code than stuff I’ve seen in production. Obviously no one should do this, but let’s not act like there’s no benefit

Enoril ,

Indeed, you can achieve a better result with less verbose naming convention. And choose better variable name to make it obvious than 0 Hp is death. While i don’t like having too verbose variable name (as it impacts the readability and quick understanding of the function), i’m not against that for the function name… without going too far of course!

Best is too have proper datamodeling of the object manipulated on top of some classic basic comments. Good interface contract is also a minimum. Best is to have full datamodeling of all the services, objects, in and out interactions between them, etc.

Documentation is a mandatory piece of the code delivery (with tests being the other important part) far too much forgotten if you don’t enforce it on your teams.

umbrella , in Gamedev is Easy
@umbrella@lemmy.ml avatar

if only those dumb game devs knew

ill send them this code just to be sure

breadsmasher , in Exam Answer
@breadsmasher@lemmy.world avatar

does it give reference to what language this is in?

x = string length of “Monday” => 6

passed my gcse?

Draconic_NEO , in CSS
@Draconic_NEO@programming.dev avatar

Totally agree with this. I was trying to do CSS theming on my personal website on SDF to try and make it look nicer but I gave up and just went without it because it never worked right. It’s a crappy website anyway with a lot of problems (doesn’t have correct margins so on anything outside specific resolutions it looks wonky).

zinderic , in Tattoo Idea

No place like 127.0.0.1.

roddy ,

::1

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

If they have a degree in engineering, then they are an engineer.

captainlezbian ,

Yeah, it’s weird to me as an engineer that when I’m on Lemmy people use that word to mean programmer. Nah, I work in a factory and had to learn thermodynamics

prime_number_314159 ,

In my mind, the line is that an engineer is someone that can commit a crime by doing their job incompetently. If the only things at risk are your job and your pride, that’s a different thing.

“I program all day, so there’s a lot of trial and error. My friend is a negligent civil engineer, so there’s a lot of error and trial.”

captainlezbian ,

Ooh the EEs will haaaaaate that lol. I generally disagree with that statement but I also totally see it.

merc ,

If you’re an electrical engineer who works in a nuclear power plant and your incompetence leads to a meltdown, you’re going to go on trial. Possibly also if you’re doing software engineering for the control systems of that power plant.

If you’re a software engineer who works on Lemmy, not so much.

MajorSauce ,

Same here in Quebec (but I don’t know if it’s a Canada thing), the title of engineer is reserved to folks who completed an engineering degree.

EncryptKeeper ,

It’s always been weird to me as someone who isn’t an engineer in degree or title why those with degrees in engineering think people shouldn’t use an accurately descriptive word like engineer when it’s perfectly appropriate just because it’s a little to close to the title of their licensed profession.

Engineer is a verb, to devise or contrive something. Simply, to design a construct. A programmer by definition engineers a program and is therefore by the rules of the English language, an engineer.

They may not be a Licensed Professional Engineer, but an Engineer they remain.

brlemworld ,

What if you have a degree in engineering but you are a surgeon?

Socsa ,

I’d assume you would also have a degree in surgery

DaleGribble88 ,
@DaleGribble88@programming.dev avatar

Do you… do you do rocket surgery?

merc ,

What if it’s a degree in a field of engineering that’s not related to software or hardware?

AstridWipenaugh ,

A doctor of musical theory is still entitled Dr.

merc ,

But, we’re not talking about formal titles. We’re talking about job titles. I’ve never heard of someone called “Engineer Jones”, just “Mr. Jones who is an Engineer”.

If you’re a doctor of musical theory but you work in human resources as a clerk and someone asks you for your job title, you don’t say “Doctor Clerk”, you say “Clerk”.

So, if you’re trained as a Civil Engineer but you changed careers and are now writing javascript, are you a Software Engineer, whereas someone with a Computer Science degree can’t claim that title?

Pulptastic ,

I draw the line at using just “Engineer”. The word Engineer has baggage, it means something pretty specific already. If you engineer something other than physical structures you should list what that something is, like Software Engineer or Network Engineer.

Train Engineer is a bit confusing because they also have historical claim to “Engineer” but no longer have the same electrical and mechanical education afaik. Correct me if I’m wrong!

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

Employed

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