HNHacker News
TopNewBestAskShowJobs

beeforpork

1,293 karma · joined April 6, 2015

submissionscomments
beeforpork··on Accents, Dialects, and Discrimination
“a language where nobody knows how to conjugate the verbs.”

   minä nauran   - ich lache  - I    laugh
   sinä naurat   - Du  lachst - you  laugh
   me   nauramme - wir lachen - we   laugh
   te   nauratte - ihr lacht  - you  laugh
   he   nauravat - sie lachen - they laugh
   hän  nauraa   - sie lacht  - she  laughs(!)
To speakers of other languages than English, this is a weird way of insulting an English dialect.
beeforpork··on How C++ Resolves a Function Call
Well, I think they should rather react like this: "Wow, so Walter gets so much money because he writes much less convoluted code than what I would have come up with."
beeforpork··on No Us Without You: elifdef and elifndef
Oh, yes, I miss that, too!
beeforpork··on I bought 300 emoji domain names from Kazakhstan and built an email service
It has emoji domains, but disallows emoji accounts. Weird. I cannot have @.kz.

This is probably disrupted by HN. I mean I cannot have [thumbsup]@[thumbsup].kz.

beeforpork··on Based Cooking
Bad advice not only for beginners, but also for any dough recipe, because amounts often need to be exact for a dough to work properly. In this case, cooking really is a science experiment.

Also, I do not like 'salt to taste', particularly for raw egg or raw meat mixtures. Just tell me the amount of salt, whynot?

beeforpork··on Show HN: Relocate.me – get your next tech job abroad
Is there also 'dontrelocate.me' for my next remote tech job abroad?
beeforpork··on Git's list of banned C functions
Been a while, eh?

It should be strncpy(a,b,(size_t)-1)!

beeforpork··on Don’t blindly prefer emplace_back to push_back
Actually, I am not so happy with clang-tidy: its first advice was spot-in, yes. But it should have thrown the exact same advice after the student incorrectly applied the first advised patch (by not removing the 'Widget(...)' constructor call).
beeforpork··on Finland Had Patent-Free Covid-19 Vaccine 9 Months Ago–Still Went with Big Pharma
Since this felt like a highly non-credible story to me (because how on earth would this not get funding for a Phase 3 study?), I searched for some corroboration, preferably from a few months ago. And there is some:

https://yle.fi/uutiset/osasto/news/finnish-developed_open-so...

https://www.helsinkitimes.fi/finland/finland-news/domestic/1...

beeforpork··on 0 A.D. Alpha 24: Xšayāršā
> “Xšayāršā” (pronounced: Khsha-ya-ṛsha)

Wow, that's helpful.

Seriously, IPA and a translation and/or explanation would be greatly appreciated.

Edit: 'IPA': not the beer, but 'International Phonetic Alphabet'

beeforpork··on Lalboard – A 3D-printed keyboard inspired by the DataHand
Of all the colours available for 3D printing, dark brown was chosen? It is not pretty(tm).

But the shape is gorgeous!

beeforpork··on Lobster shell patterns make concrete stronger
A criss-cross pattern is now called biomimicry?

The following article has pictures and a video:

  https://www.theconstructionindex.co.uk/news/view/lobster-shells-inspire-stronger-3d-printed-concrete
This is the normal top/bot pattern for 3D printing, right? I don't think it was copied from lobsters.

Or am I missing something? Or is this totally misrepresented?

beeforpork··on That XOR Trick (2020)
No, not really, because you just need the lower half bits of the multiplication result, i.e., the size you need for your numbers. You do need to care about overflow: the /2 operation must not remove an upper bit from those lower bits. But you can easily do that before *: either n or n+1 is even. Divide the even number by two, then multiply by the odd one and keep only the lower bits. These lower bits are all you need, because the missing number is representable in it: subtracting may use wrap-around, but still, the remaining bits will be the missing number.
beeforpork··on That XOR Trick (2020)
Hmm, I would have used + and -, I suppose. The sum of 1..n is (n*(n+1))/2. Subtract from that all numbers in the array and what is left is the missing number.
beeforpork··on I Regret Quitting Astrophysics
You can definitely go back -- academia loves people with industry experience. Few people go back because they typically earn less money in academic jobs. So you now have something academia loves, and there is little competition of other people having that kind of experience.
beeforpork··on Estimated 1.56B face masks will have entered oceans in 2020
Obviously even simple cloth masks help: notice how they get wet when you wear them? That moisture is your exhaled water droplets, the carriers of virusses, that don't end up in other people's faces!

Also, do you think surgeons wear masks for fashion reasons?

The mask discussion is absurd. A totally minor inconvenience vs. decreased virus exhaling, how can this be a topic for discussion?

beeforpork··on Tech elites leaving San Francisco threaten Silicon Valley's supremacy
To me, 'supremacy' sounds scary -- not positive at all. Too much misuse of all kinds of perceived supremacy.
beeforpork··on What is your favorite C programming trick? (2009)
This!

I just wanted to post it, but you already did. :-)

beeforpork··on If Graphene Batteries Do Everything Scientists Say, They Could Be a Gamechanger
Overused phrases alert! Game changing is everywhere!

https://www.youtube.com/watch?v=q3RhWuXFixU

https://www.politico.eu/article/are-monoclonal-antibodies-th...

https://www.bbc.com/news/world-asia-india-54338864

beeforpork··on Vitamin D improves survival in Covid-19 elderly patients
However fishy this study may be, eating some herring is definitely not bad. It's delicious! So: good idea, thank you, I'll get some for the week end.
beeforpork··on On Learning Chess as an Adult – From 650 to 1750 in Two Years
A long while back, I dedicated my time to Tetris (on Gameboy). I surely spent less time on that than would have been necessary for chess, but it is amazing to see what progress is possible. I could play level 9[heart] without an end (in infinite play mode) or up to high 3 (6 rows of waste on bottom). When moving a brick to the left or right edge, the gameboy would make a long beep instead of individual blips. No idea how I could move my fingers that fast.

It is fun. For chess in contrast to Tetris, there is even a good chance for it to stay fun -- Tetris is a bit too simplistic for that, I think.

beeforpork··on Open Source does not mean “Includes Free Support”
The intro conversation criticises the wrong thing, I think.

A bug report is good. I always want to know about bugs in my stuff, and if someone else points out that there is a bug, that is great. Letting people pay for reporting bugs is bad.

Now, fixing that bug is a different story, and that's what this should focus on. Bug fixing should not be taken for grated.

beeforpork··on Design Note: Implicit Semicolons (2017)
In my opinion, a little redundancy is good to avoid rockets falling out of the sky, so I vote for a layout rule plus redundant semicolons. The semicolon is hardwired in many programmers hands anyway. I don't think it should be a design goal to get rid of it. Instead, the compiler's/interpreter's job is to help the programmer to avoid bugs, and with a little syntactic redundancy, the parser can already help out with a few syntax errors. I love gcc's -Werror=misleading-indentation.
beeforpork··on How to count every language in India (2018)
The notion of an 'old language' is weird. What does that even mean? Why is Bo one of the oldest languages? Is Greek old? Is English old? Is Lithuanian old? Is Tamil old? Korean? Chinese (which one?)? Any language? If your answer is 'yes', then (a) please explain what you mean, and (b) rest assured that it is not the same language today as when it was 'young' (whatever that means) -- 'young X' is probably a different language than 'old X', but what does that mean for 'X'? I don't get it.

Such a weird notion. It seems to me that 'old' for a language is often used to imply that it is 'important' (culturally? presumably yes.), which feels, well, not racist, but maybe 'linguist' -- OK, that word is already occupied... Even fighting exists about which language is 'oldest' -- could you please make up the rules of the game before playing?

Anyway -- this is just me not understanding what people mean.

beeforpork··on MCS-48: The quest for 16-bit division on the 8-bit CPU which can’t divide
This is the same code in MCS48 assembly. Or so I hope.

  ; INPUT:  r1:r0  celsius * 10
  ; OUTPUT: r3:r2  fahrenheit * 10

  MOV A, r0
  ADD A, r0
  MOV r2, A
  MOV r4, A
  MOV A, r1
  RLC A
  MOV r3, A
  MOV r5, A
  MOV A, r4
  ADD A, r4
  XCH A, r5
  RLC A
  MOV r4, A
  MOV A, r2
  ADD A, r5
  XCH A, r3
  ADDC A, r4
  MOV r2, A
  MOV A, r5
  ADD A, r5
  XCH A, r4
  RLC A
  MOV r5, A
  MOV A, r3
  ADD A, r4
  XCH A, r2
  ADDC A, r5
  MOV r3, A
  MOV A, r1
  ADD A, r1
  MOV A, r1
  RRC A
  MOV r5, A
  MOV A, r0
  RRC A
  MOV r4, A
  MOV A, r5
  ADD A, r5
  MOV A, r5
  RRC A
  XCH A, r4
  RRC A
  MOV r5, A
  MOV A, r2
  ADD A, r5
  XCH A, r3
  ADDC A, r4
  MOV r2, A
  MOV A, r4
  ADD A, r4
  MOV A, r4
  RRC A
  XCH A, r5
  RRC A
  MOV r4, A
  MOV A, r3
  ADD A, r4
  XCH A, r2
  ADDC A, r5
  MOV r3, A
  MOV A, r5
  ADD A, r5
  MOV A, r5
  RRC A
  XCH A, r4
  RRC A
  MOV r5, A
  MOV A, r4
  ADD A, r4
  MOV A, r4
  RRC A
  XCH A, r5
  RRC A
  MOV r4, A
  MOV A, r2
  ADD A, r4
  XCH A, r3
  ADDC A, r5
  ADD A, 10
  MOV r2, A
  ADD A, r2
  MOV A, r2
  RRC A
  XCH A, r3
  RRC A
  MOV r2, A
  MOV A, r3
  ADD A, r3
  MOV A, r3
  RRC A
  XCH A, r2
  RRC A
  MOV r3, A
  MOV A, r2
  ADD A, r2
  MOV A, r2
  RRC A
  XCH A, r3
  RRC A
  MOV r2, A
beeforpork··on MCS-48: The quest for 16-bit division on the 8-bit CPU which can’t divide
But you do have CPL -- that does not help? Anyway, without subtraction, you could do the very same with one additional add:

  int16_t celsius2fahrenheit(int16_t c)
  {
    int16_t f = 0;
    f += c << 1;
    f += c << 2;
    f += c << 3;
    f += c >> 2;
    f += c >> 3;
    f += c >> 5;
    f += 320 * 8;
    f >>= 3;
    return f;
  }
beeforpork··on MCS-48: The quest for 16-bit division on the 8-bit CPU which can’t divide
OK, I understand. The approach works even better if you multiply by 10:

  int16_t celsius2fahrenheit10(int16_t c)
  {
    int16_t f = 0;
    f += c << 4;
    f -= c;
    f -= c >> 1;
    f -= c >> 3;
    f += c >> 5;
    f += 320 * 8;
    f >>= 3;
    return f;
  }
This is really accurate:

  C=0    (int 0)    F=32   (int: 320,  exact: 32)
  C=15.3 (int 153)  F=59.5 (int: 595,  exact: 59.54)
  C=37   (int 370)  F=98.6 (int: 986,  exact: 98.6)
  C=100  (int 1000) F=212  (int: 2120, exact: 212)
beeforpork··on MCS-48: The quest for 16-bit division on the 8-bit CPU which can’t divide
IIRC, the DS18B10 (like its cousins) does not return celsius multiplied by 10 (i.e., not '153' for 15.3°C), but returns a 7 bit integer celsius value plus a sign plus a few fractional bits -- by default 1 (i.e, a +-7.1 bit format), but maybe this device has a few more bits in a secondary register -- I remember using one that had four sub-celsius bits, i.e., would output 1/16 celsius steps (a +-7.4 bit value). In any case, not a value multiplied by 10, but a celsius unit with binary fractional bits.

Am I wrong? Looking for DS18B10 data sheet always gives me the DS18S20. Hmm, dunno.

Anyway, assuming a sign + 7 bits integer + 4 bits fractional format, you can calculate inside 16 bit signed without overflow with a 3-bit shifted 9/5 constant without overflowing, up to beyond 100°C. With a bit of shifting, the following is quite accurate:

  int16_t celsius2fahrenheit(int16_t c)
  {
    int16_t f = 0;
    f += c << 4;
    f -= c;
    f -= c >> 1;
    f -= c >> 3;
    f += c >> 5;
    f += 32 << 7;
    f >>= 3;
    return f;
  }
Accuracy:

  C=0    (int: 0),    F=32      (exact: 32,    int: 512)
  C=15.3 (int: 244),  F=59.4375 (exact: 59.54, int: 951)
  C=37   (int: 592),  F=98.625  (exact: 98.6,  int: 1578)
  C=100  (int: 1600), F=212.062 (exact: 212,   int: 3393)
beeforpork··on St. Matthew Island is said to be the most remote place in Alaska
That is also the last habitat of Lord Howe Island stick insect:

https://en.wikipedia.org/wiki/Dryococelus_australis

beeforpork··on In the Turkish locale, "INFO".lower() != "info"
My genius idea was once to use toupper() to normalise paths on Windows, which are case-insensitive. One day, a customer from Azerbaijan reported that my application failed to access a file in C:\WİNDOWS\...
← PreviousPage 11 of 15Next →