HackerTrans
TopNewTrendsCommentsPastAskShowJobs

Okx

no profile record

comments

Okx
·4 bulan yang lalu·discuss
maybe it would be a little better to use ints rather than longs, as Java lists can't be bigger than the int max value anyways. Saves you a cache line or two.
Okx
·4 bulan yang lalu·discuss
The code:

  public int parseOrDefault(String value, int defaultValue) {
      if (value == null || value.isBlank()) return defaultValue;
      for (int i = 0; i < value.length(); i++) {
          char c = value.charAt(i);
          if (i == 0 && c == '-') continue;
          if (!Character.isDigit(c)) return defaultValue;
      }
      return Integer.parseInt(value);
  }
Is probably worse than Integer.parseInt alone, since it can still throw NumberFormatExceptions for values that overflow (which is no longer handled!). Would maybe fix that. Unfortunately this is a major flaw in the Java standard library; parsing numbers shouldn't throw expensive exceptions.
Okx
·6 bulan yang lalu·discuss
this comment is pretty obviously written by AI
Okx
·9 bulan yang lalu·discuss
Unfortunately, Wikipedia doesn't seem interested in this. Their revenue is more than enough be able to invest and sustain the site forever, but they just increase expenses on non-core outgoings https://en.wikipedia.org/wiki/WP:CANCER
Okx
·tahun lalu·discuss
Yes, last time I checked, Zig's comptime was 20x slower than interpreted Python. Parsing a non-trivial JSON file at comptime is excrutiatingly slow and can take minutes.
Okx
·tahun lalu·discuss


    You’ve got a monopoly on lemonade because you pay all the grocery stores to be the default lemonade.

    So we’re going to force you sell your car.
I don't think this is an accurate anaology. It's more like, you own the vast majority of grocery stores, and you make lemonade, and you force all the other grocery stores to only sell your lemonade.

To put it another way, the problem is not so much that Google shouldn't be paying to be the default search engine, but that it shouldn't own both the browser and the search engine.

I think this harkens back to the anti-trust court case, United States v. Paramount Pictures, where the court ruled that the film studios cannot hold monopolies over the movie theatres, and that theatres must remain independent.

Similarly, browsers and search engines being independent is good for competition because the internet is too important to let a single company dictate how it is used.
Okx
·tahun lalu·discuss
> The above code is simple and correct

Unfortunately not:

Using notifyAll and wait in Java is tricky to do correctly, you'd have a much easier chance using concurrency primitives that wrap these functions, like CountDownLatch[1] for one offs, or Condition[2].

System.currentTimeMillis is also not guaranteed to be monotonic, and System.nanoTime should be used instead. This would of course be obviated if a better concurrency primitive were to be used.

[1] https://docs.oracle.com/en/java/javase/21/docs/api/java.base...

[2] https://docs.oracle.com/en/java/javase/21/docs/api/java.base...
Okx
·tahun lalu·discuss
soma fm has some good online radio stations: https://somafm.com/ (and shows you the track and artist)
Okx
·2 tahun yang lalu·discuss
GnuCash and KDE Money always seemed very similar to me. Why should I use GnuCash over KDE money?
Okx
·2 tahun yang lalu·discuss
> You can use GraalPy with GraalVM JDK, Oracle JDK, or OpenJDK

https://www.graalvm.org/latest/reference-manual/python/
Okx
·2 tahun yang lalu·discuss
No wonder he heard from his brother that the Border Patrol were always hiring; they seemingly make it impossible to get hired.