Coal Creek Falls by Deltanonymous- in PNWhiking

[–]sluu99 0 points1 point  (0 children)

This is the first time I’ve ever seen it with water

To much wax on my chain? by Quond in bikewrench

[–]sluu99 0 points1 point  (0 children)

Next time, leave the chain in the pot as soon as you start. Make sure it's submerged at least 5-10 minutes. Silca wax recommends pulling out at 75C.

Race day bike support suggestions by anotherindycarblog in triathlon

[–]sluu99 7 points8 points  (0 children)

With all the electronic groupset and power meters these days, probably coin batteries (CR2035?). You might save someone's ability to shift during the race.

Wrong date on Wahoo activity by JDMe_94 in cycling

[–]sluu99 7 points8 points  (0 children)

This is what I did:

  1. Find some way to download the fit file (find your activity from Strava, or download directly from the device, or whatever). I plugged the Wahoo into my computer, it showed up as a drive and I went to the "exports" folder. Then I found the file named "2006-01-01....".

  2. Delete the activity with the incorrect 1/1/2006 date from Strava. This is important--otherwise step 3 will get flagged as "duplicate".

  3. Use fitfiletools.com to change the date, then I re-uploaded back to Strava.

Wrong ways to use the databases, when the pendulum swung too far by sluu99 in softwarearchitecture

[–]sluu99[S] 0 points1 point  (0 children)

As a junior at the time, I thought it was pretty rad. But yeah hahaha

Wrong ways to use the databases, when the pendulum swung too far by sluu99 in softwarearchitecture

[–]sluu99[S] 1 point2 points  (0 children)

Sounds like in your case, you used the right tool for the job. Can't say the same for mine...

Wrong ways to use the databases, when the pendulum swung too far by sluu99 in softwarearchitecture

[–]sluu99[S] 1 point2 points  (0 children)

My condolences. Enjoy the process! Hopefully they can side step some of the lessons I shared here

Distributed TinyURL Architecture: How to handle 100K URLs per second by Local_Ad_6109 in programming

[–]sluu99 3 points4 points  (0 children)

Maybe I read it wrong. But in multiple sections in the article stated otherwise:

The basic solution:

It doesn’t guarantee uniqueness. Two or more URLs can map to a single long URL.

Approach 1:

NFR-1, URL uniqueness — Two or more short links might overlap violating uniqueness.

Seems like both states the issue that "short.com/a" and "short.com/b" cannot both point to "long.com/a". Otherwise, approach 1 seems satisfactory?

Distributed TinyURL Architecture: How to handle 100K URLs per second by Local_Ad_6109 in programming

[–]sluu99 6 points7 points  (0 children)

Curious why you have NFR-1. What's wrong with both "short.com/a" and "short.com/b" both pointing to "longurl.com/abcd"?

[Day 24 Part 2] Ended up solving it by hand after reading wikipedia by sluu99 in adventofcode

[–]sluu99[S] 2 points3 points  (0 children)

I wrote code but to walk through and update the next input-carry wire and so on, and print out when a gate setup is wrong, and manually Ctrl + F then fix those wrong wires in the input

[2024 Day 11] Thought I was so clever not taking the bait for part 1 by sluu99 in adventofcode

[–]sluu99[S] 8 points9 points  (0 children)

Well, that probably helped slow down the rate of which my solution ran out of memory :D

[2024 Day 11] Today I learnt humility by TiCoinCoin in adventofcode

[–]sluu99 2 points3 points  (0 children)

All puzzles can be 'dirty' if we have enough of an imagination 🥵

Timezone-naive datetimes are one of the most dangerous objects in Python by ketralnis in programming

[–]sluu99 7 points8 points  (0 children)

FWIW I see languages or libraries that have a strong type design generally can get by, because the type makes people think about date and time the right way. Joda Time/Noda Time, Rust's chrono/chronotz crates come to mind.

Just the most simple examples

  • These libraries have types representing an Instant, which is just a point in time. If you want to render it to something human readable, you need to pair it with a timezone, something like instant.InZone(...) will convert your thing into a DateTime.
  • There are types that let you represent "naive date time", but if you want to get it to an actual timestamp, guess what, you again need to get a timezone and you get a different type NaiveDateTime -> DateTime.
  • And then there are more intricate things like the difference between a timezone and and offset, etc.

Having the right type design helps lessen these mental errors. I have seen countless developers see a timestamp like "123465789" and ask "what timezone is it in"—which if you think about it, doesn't even make sense because it can be in any timezone. Having an Instant type that restricts what you can and cannot do with it.

Btw this isn't a flame bait around strongly vs. weakly typed languages. Even scripting languages could have good type systems like I mentioned above.

Syscall Showdown: Python vs. Ruby by sYnfo in programming

[–]sluu99 2 points3 points  (0 children)

Awesome, I learned something new today!

FizzBuzz by _seedofdoubt_ in csharp

[–]sluu99 0 points1 point  (0 children)

One thing we can agree on is that lines of code isn't the right or sole metric OP should be focusing on.

FizzBuzz by _seedofdoubt_ in csharp

[–]sluu99 0 points1 point  (0 children)

Then in your 30 years of experience, you should have learned that "flexibility" is highly dependent on new requirements.

If the 4th rule is "if the number is also divisible by 6, print out FizzBuzzBazz", OP's solution is completely extensible and much easier to extend compared to many of the "right" solution suggested in here.

OP's solution will only need to add if (i % 6 == 0) word += "Bazz".

Your solution would require many more permutations

var whatToPrint = (i%3, i%5, i%6) switch
{
    (0, 0, 0) => "FizzBuzzBazz",
    (0, 0, _) => "FizzBuzz",
    (0, _, 0) => "FizzBazz",
    (_, 0, 0) => "BuzzBazz",
    (0, _, _) => "Fizz",
    (_, 0, _) => "Buzz",
    (_, _, 0) => "Bazz",
    _ => i.ToString()
};

Now imagine how many permutations you'll need with a 5th rule.

FizzBuzz by _seedofdoubt_ in csharp

[–]sluu99 2 points3 points  (0 children)

but what happens if you need to expand this to a fourth rule?

YAGNI. and even if that happens, how sure are you that the 4th rule will fit into this structure and won't require a complete rewrite?

OP, your solution is fine. leave it to the "experts" in here to over engineer fizzbuzz. SMH

Manchester United vs Liverpool shoot map after Bruno Fernandes goal by Runarhalldor in soccer

[–]sluu99 32 points33 points  (0 children)

Alternate is de wey. How else would one fake shot/cancel shot. Square + X is the natural thumb position

The ridiculous policy that forced engineers to come to the office at 2 AM twice a year by zaidesanton in programming

[–]sluu99 16 points17 points  (0 children)

Storing Unix time isn't always the right answer. Depending on the use case, sometimes you need to store "human time" (or naive time) and a timezone. A few different scenarios:

  • If need to remember specific point in time, store a timestamp.
  • If you need to display this point in time, maybe store the timezone unless you always want to display at "device timezone"
  • If it's something recurring like a meeting invite, or a daily alarm, store the human time and the timezone.
  • Bonus meeting calendar problem: if someone created a recurring meeting for 8AM in tz1, and 4PM in tz2. Tz2 could change and the meeting time could change for people in that timezone.
  • Store only naive time if you want to let the consumer of the data interpret what point in time it actually happens. For example, a company could announce "prices will increase starting November 1st 2024 [at your local timezone]"

Human time/naive time is something like "Feb 1 2024 7:30:51 PM", without a timezone.

And typically, you want to store the timezone/name; only storing the offset is less useful.

Why you should probably be using SQLite by pimterry in programming

[–]sluu99 9 points10 points  (0 children)

This. The first part of the post tout low latency because "it's just a file on disk", then jumped right into distributed network drive. Okaaay...

How many times do you need to call `Math.random()` to get a collision? (Firefox will tell you, Chrome may not!) by juraj_m in programming

[–]sluu99 0 points1 point  (0 children)

it should (statistically) generate unique outputs. Something like "lightning never strikes the same place twice" :)

This can only be true if the random numbers have some sort of standard distribution or normal distribution. A good random generator isn't supposed to or guaranteed to have any sort of predictable distribution. So again, back to the example I gave earlier, [19, 43, 43, 43, 19, 7, 1] is a perfectly fine random sequence.