Hacker Newsnew | past | comments | ask | show | jobs | submit | more planede's commentslogin

Yes, that's the philosophy around the declaration syntax.

The declaration of the pointer ip,

  int *ip;
is intended as a mnemonic; it says that the expression *ip is an int. The syntax of the declaration for a variable mimics the syntax of expressions in which the variable might appear. This reasoning applies to function declarations as well.

K&R C


  return '⊥'
what's this?


An error condition. I decided to do away with it and take a small hit on the error by assuming the chances of the trimmed set being equal to the threshold are very small and that the error condition is effectively doing nothing.

I also changed the logic from == to >= to trigger unfailingly, and pass in the "window"/threshold to allow my code to work without internal awareness of the length of the iterable:

    from random import random

    def estimate_uniques(iterable, window_size=100):
        p = 1
        seen = set()

        for i in iterable:
            if i not in seen:
                seen.add(i)
            if random() > p:
                seen.remove(i)
            if len(seen) >= window_size:
                seen = {s for s in seen if random() < 0.5}
                p /= 2
        return int(len(seen) / p)
I also didn't like the possible "set thrashing" when an item is removed and re-added for high values of p, so I inverted the logic. This should work fine for any iterable.


In some symbolic logic classes, that character "bottom" represents "false" ad flipped "top" means true.

Don't know what they're getting at in the code, though.


>In some symbolic logic classes, that character "bottom" represents "false"

That's unfortunate, because in the study of computer programming languages, it means "undefined" (raise an error).


Not always. It is also the uninhabited bottom type.


My point is that there is a difference between a Python function's returning false and the function's raising an error, and sometimes the difference really matters, so it would be regrettable if logic teachers actually did use ⊥ to mean false because programming-language theorists use it to mean something whose only reasonable translation in the domain of practical programming is to raise an error.

I have no idea what your point is.


Once again proving the need for comments in code. Especially for comments that are more useful than "initialize parameters"


An easy way to identify who copies code without understanding it.


You can just replace it with something like: print ('Invalid thresh or something')


This however looks scary so an innocent copy/paste programmer wouldn't touch it.


Well of course, I assume that's what my ISP is using.


Telekom Germany?


I don't mean to boast, but on a good day, I get up to 4Mbps with Telekom. Welcome to the world of tomorrow!


Has to be, it would explain my experience.


Could just as well be NBNco in Australia


Rogers in Canada?


I believe Rogers are running DOCSIS-over-Sewage, the competing cable standard.


Sewer are properly buried, Rogers cables are just thrown around with maybe a bit of dirt on top of it was a good day. I redid a wall in my backyard last year that is close to a Rogers box, I removed ~15 old cut cables from the ground.


Nawh, they're using ATM over finches. Those squeaks and chirps you hear outside are actually your packets.


I’m surprised they didn’t stick with the standard RFC 2549

https://www.rfc-editor.org/rfc/rfc2549


Latency and packet loss. And finches take less feed.


Man if there's one thing I can credit bell for, is that they really pushed for fiber. Before we had bell fibe here (for a shockingly reasonable price) in Montreal, we were stuck with absolute trash DOCSIS for so long. Every time the revisions increased ,the speeds would be nominally faster but in reality came with trash stability and peak time performance.

I'm sure DOCSIS is great for what it is, and in fact it's extremely impressive what it can do with existing cable lines, but the second biggest player here (Videotron) basically milked it dry. Again it's weird to praise them but Bell invested in wiring up the entire city and suburbs and I can get 3gbps symmetrical GPON FTTH for the price that 150mbps used to go for not even 3 years ago. I blame DOCSIS in a way because it made players with existing lines extremely complacent


Well, camera placement matters in the obvious way: it has to be on the finish "line". Where "line" is really a plane extending vertically from the line drawn on the surface.

I vaguely remember an article about a bike race photo finish that showed that this is not a given and reverse engineered where the camera was pointing (based on background) and who the likely winner was.

edit: found it https://www.tglyn.ch/blog/amstel_gold/


Great link that.

But in the end, if I am not mistaken the UCI rules state that the photo finish line is the final arbiter, not the paint on the ground. I don't think this is a great injustice - it's a sport and the rules are arbitrary to a great extent (e.g. male riders 180 cm to 189.9 cm tall must use a smaller bike than those 190 cm and taller in time trials - which sucks for those 189.9 cm tall).


MicroG has a LineageOS distribution, they build for all the supported devices by upstream Lineage: https://lineage.microg.org/

That should cover at least the notification side. If I can't bank on a mostly open-source mobile OS than I would rather just not bank on mobile at all. Banking on stock ROM is not an option for me.


In the latest lineage (21), you can directly install microg as lineage os now directly allows signature spoofing (only for microg and related apps).


I recently learned that too. Does that survive OTA updates?


Google Play is not installed by default, you need to additionally flash it before first booting it.


I think the idea is that email scraper bots typically don't bother downloading images referenced by <img> tags.


> BTW. Use the AddressSanitizer. Please! The toolchain improved the usage and safety of the language so much.

In general I agree with the sentiment, use AddressSanitizer in testing/debugging. However it's not meant to be a hardening option, AFAIK, so I advise against using it in production (along with other sanitizers), even if you can live with the performance hit.


Yep.

Theoretically it is possible but libasan is not intended for linking or shipping in production. Also stuff like LeakSanitizer[1] actually cannot [1] be used with GDB.

While shipping debug symbols is something I recommend and has no side-effects aside from mere file-size (debug symbols are only loaded when used).

Usual exceptions apply as you encounter them.

[1] https://github.com/google/sanitizers/issues/857


It's obviously a lossy compression then.


That's what TAI is for. Too bad nobody got the memo and everybody stores and communicates UTC, including computer clocks, UNIX time and NTP.

There will be no more leap seconds after 2035, AFAIK.


Sure. So my argument is that everything should use TAI, and local time zones should be an offset from TAI, not UTC (because local times are primarily for humans, and humans don't care about extremely slow time zone drift that leap seconds are designed to prevent). Then we can abolish UTC entirely since it serves no purpose.


The problem isn't really about handling local time. UTC is an offset from TAI and time zones are offsets from UTC, it's overall really just an offset from TAI. Coordinating the TAI-UTC offset is not any worse than coordinating time zone offsets.

The complications are around clocks, UNIX timestamp and NTP, where a steadily and monotonously increasing number would make the most sense, and that's not UTC.


Good news, the 2038 Unixtime mess should give some impetus on cleaning this all up before then.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: