Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 536 537 [538] 539 540 ... 775

Author Topic: Things that made you mildly upset today thread  (Read 840396 times)

Egan_BW

  • Bay Watcher
  • technical difficulties
    • View Profile
Re: Things that made you mildly upset today thread
« Reply #8055 on: August 17, 2020, 10:44:28 pm »

Logged
Insatiable consumption. Ceaseless motion. Unstoppable destruction.

Rolan7

  • Bay Watcher
  • [GUE'VESA][BONECARN]
    • View Profile
Re: Things that made you mildly upset today thread
« Reply #8056 on: August 17, 2020, 10:50:30 pm »

(For future reference:  That XKCD launched mid-discussion.  Not only is there is an XKCD for everything - sometimes it arrives just as you need it.)
Logged
She/they
No justice: no peace.
Quote from: Fallen London, one Unthinkable Hope
This one didn't want to be who they was. On the Surface – it was a dull, unconsidered sadness. But everything changed. Which implied everything could change.

Egan_BW

  • Bay Watcher
  • technical difficulties
    • View Profile
Re: Things that made you mildly upset today thread
« Reply #8057 on: August 17, 2020, 10:55:26 pm »

I think it came out some hours before, but close enough. They usually upload a while after noon for me, and as far as I can tell the comment which started this discussion was posted at 8:16 pm.
Logged
Insatiable consumption. Ceaseless motion. Unstoppable destruction.

Reelya

  • Bay Watcher
    • View Profile
Re: Things that made you mildly upset today thread
« Reply #8058 on: August 17, 2020, 11:16:21 pm »

The canonical example is LeftPad in JavaScript, which is used to pads zeroes on the left of a number. The maintainer got upset and yanked it out, broke half the internet.

The lesson there is don't be lazy and rely on a "library" for what can be done in 1-2 lines of code. One video looking at this pointed out some "libraries" used by people are nothing more than a wrapper to a single function call to another library.

Excarebating how dumb things have become apparently the person who then jumped into maintain LeftPad massively bloated it. He turned a 2-3 line function into this:

https://github.com/left-pad/left-pad/blob/master/index.js

Code: [Select]
function leftPad (str, len, ch) {
  // convert `str` to a `string`
  str = str + '';
  // `len` is the `pad`'s length now
  len = len - str.length;
  // doesn't need to pad
  if (len <= 0) return str;
  // `ch` defaults to `' '`
  if (!ch && ch !== 0) ch = ' ';
  // convert `ch` to a `string` cuz it could be a number
  ch = ch + '';
  // cache common use cases
  if (ch === ' ' && len < 10) return cache[len] + str;
  // `pad` starts with an empty string
  var pad = '';
  // loop
  while (true) {
    // add `ch` to `pad` if `len` is odd
    if (len & 1) pad += ch;
    // divide `len` by 2, ditch the remainder
    len >>= 1;
    // "double" the `ch` so this operation count grows logarithmically on `len`
    // each time `ch` is "doubled", the `len` would need to be "doubled" too
    // similar to finding a value in binary search tree, hence O(log(n))
    if (len) ch += ch;
    // `len` is 0, exit the loop
    else break;
  }
  // pad `str`!
  return pad + str;
}

According to at least one video I saw, not only did he massively complexify it, he somehow managed to break some edge-cases not fix them. Almost all these comments are not helpful in the least, too. Who would have thought that "len >>= 1" divides len by 2 and drops the remainder? Anyone who needs that comment shouldn't be playing with the code.

Seriously, if something only needs 2-3 lines of code, write it yourself and avoid idiot maintainers breaking your stuff.

For anyone wondering, this is my version of padding that does the same as the above code for 99.9% of likely needs:

Code: [Select]
function Pad(num, size, padValue)
{
    var s = num+"";
    while (s.length < size) s = padValue + s;
    return s;
}
« Last Edit: August 17, 2020, 11:22:25 pm by Reelya »
Logged

Yoink

  • Bay Watcher
  • OKAY, FINE.
    • View Profile
Re: Things that made you mildly upset today thread
« Reply #8059 on: August 17, 2020, 11:19:19 pm »

Honestly I kinda want to move to Linux next time I buy/get/make a computer.   
Logged
Booze is Life for Yoink

To deprive him of Drink is to steal divinity from God.
you need to reconsider your life
If there's any cause worth dying for, it's memes.

Reelya

  • Bay Watcher
    • View Profile
Re: Things that made you mildly upset today thread
« Reply #8060 on: August 17, 2020, 11:23:10 pm »

Code: [Select]
function Pad(num, size, padValue)
{
    var s = num+"";
    while (s.length < size) s = padValue + s;
    return s;
}

This is the one I actually use.

Note that the while loop won't start if the original string already exceeds the desired length, so you don't even need to check for that. It's absolutely brain-melting that you'd check for that.
« Last Edit: August 17, 2020, 11:27:11 pm by Reelya »
Logged

Rolan7

  • Bay Watcher
  • [GUE'VESA][BONECARN]
    • View Profile
Re: Things that made you mildly upset today thread
« Reply #8061 on: August 17, 2020, 11:24:52 pm »

The canonical example is LeftPad in JavaScript, which is used to pads zeroes on the left of a number. The maintainer got upset and yanked it out, broke half the internet.
Holy shit I really ought to have heard about that!

Also, the Python 2 to Python 3 pain was fucken real.
Logged
She/they
No justice: no peace.
Quote from: Fallen London, one Unthinkable Hope
This one didn't want to be who they was. On the Surface – it was a dull, unconsidered sadness. But everything changed. Which implied everything could change.

Reelya

  • Bay Watcher
    • View Profile
Re: Things that made you mildly upset today thread
« Reply #8062 on: August 17, 2020, 11:32:22 pm »

https://qz.com/646467/how-one-programmer-broke-the-internet-by-deleting-a-tiny-piece-of-code/

You can see the original version that worked fine for decades here before getting pulled and compare that to the "new and improved" version by the new maintainer. BTW it was already overly complex since it only does the same, mostly, as my 3 line version.

And the idea that a bit of code that keeps half the internet working should be "improved" is really dangerous in itself. Leave well enough alone, don't do anything that changes how it works, even if you think it's "better".
« Last Edit: August 17, 2020, 11:38:07 pm by Reelya »
Logged

McTraveller

  • Bay Watcher
  • This text isn't very personal.
    • View Profile
Re: Things that made you mildly upset today thread
« Reply #8063 on: August 18, 2020, 06:41:17 am »

My lament isn't against the concept of continuous software development. My lament is that we have very little choice. Especially with Windows, and increasingly with Apple, you cannot easily refuse updates.  If the updates were limited to under-the-hood things, I would not mind so much.  Except when those changes suddenly cause tools on which I depend to stop working, then I have to stop doing my "real" work to fix my tools.  It's productivity-killing.

But for the love of all, don't. break. my. workflow!  And in full rant mode - for the love of all, get all your UX people to read the decades-old UX research.  Teams is a good example - why is the "hang up" button the bright colored, easy to target button, where the "accept call" button is the same color as two other buttons, making it easy to hit "hang up" by accident.

The implicit assertion behind "move fast and break things" is that it's ok to break things which is really, in many industries, NOT OK.
Logged

Rolan7

  • Bay Watcher
  • [GUE'VESA][BONECARN]
    • View Profile
Re: Things that made you mildly upset today thread
« Reply #8064 on: August 18, 2020, 11:30:28 am »

I just love when Microsoft bought Skype and remade it to have more bevels and no push-to-talk
really sums up the company
Logged
She/they
No justice: no peace.
Quote from: Fallen London, one Unthinkable Hope
This one didn't want to be who they was. On the Surface – it was a dull, unconsidered sadness. But everything changed. Which implied everything could change.

Eric Blank

  • Bay Watcher
  • *Remain calm*
    • View Profile
Re: Things that made you mildly upset today thread
« Reply #8065 on: August 18, 2020, 02:50:50 pm »

It's 80°f throughout our facility, hotter here in the kitchen. These are the end times
Logged
I make Spellcrafts!
I have no idea where anything is. I have no idea what anything does. This is not merely a madhouse designed by a madman, but a madhouse designed by many madmen, each with an intense hatred for the previous madman's unique flavour of madness.

Frumple

  • Bay Watcher
  • The Prettiest Kyuuki
    • View Profile
Re: Things that made you mildly upset today thread
« Reply #8066 on: August 18, 2020, 05:35:23 pm »

Pretty sure it's just a Tuesday. Which are like the end times, I guess, but not quote actually them, yet.

Though yeah, somewhere around that point is when I'd just be going home or whatever. There's not much useful to be done when you're being cooked.
Logged
Ask not!
What your country can hump for you.
Ask!
What you can hump for your country.

Jopax

  • Bay Watcher
  • Cat on a hat
    • View Profile
Re: Things that made you mildly upset today thread
« Reply #8067 on: August 19, 2020, 09:53:47 am »

A new batch of models arrived, can't really build them yet because I haven't finished the previous two (and there's only so much space to safely store a half finished thing and all its sprues), and I can't finish those two properly until the paints (at this point almost two months late) arrive :V

But that's beside the point, what was mildly upsetting was getting a round of nagging from my mom about how I spend money only on toys and useless things, that it should be spent on something useful like education. Now lets ignore the fact that I've been buying educational stuff like books and courses (and that most of it can't really be seen because it's digital), lets just focus on how I dare spend a tenth of my paycheck every 3-4 months to finance a hobby that I've always wanted to pursue (and finally can because I have the money if not the time to do so consistently).
If there's one thing that can piss me off in a matter of minutes is people telling me how to spend my free time and money, especially when my free time is as limited as it is and I'm already extremely frugal with my expenses :I
Logged
"my batteries are low and it's getting dark"
AS - IG

MetalSlimeHunt

  • Bay Watcher
  • Gerrymander Commander
    • View Profile
Re: Things that made you mildly upset today thread
« Reply #8068 on: August 19, 2020, 04:37:33 pm »

This has been a very unpleasant week.
This has been a very unpleasant month.
Logged
Quote from: Thomas Paine
To argue with a man who has renounced the use and authority of reason, and whose philosophy consists in holding humanity in contempt, is like administering medicine to the dead, or endeavoring to convert an atheist by scripture.
Quote
No Gods, No Masters.

Naturegirl1999

  • Bay Watcher
  • Thank you TamerVirus for the avatar switcher
    • View Profile
Re: Things that made you mildly upset today thread
« Reply #8069 on: August 19, 2020, 04:45:32 pm »

This has been a very unpleasant week.
This has been a very unpleasant month.
This has been a very unpleasant year so far
Logged
Pages: 1 ... 536 537 [538] 539 540 ... 775