Better HN
topnewbestaskshowjobs
Log inSign up

zeroimpl

621 karma · joined Jan 11, 2018 (8y ago) · 450 submissions

Submissions

comment 7y ago · link · parent

I learnt plenty in my CS courses. I just don’t use most of them, and most of the skills I do use I didn’t learn there. That does not mean it was a waste of time - knowing the theory behind various data structures, algorithms, and circuitry make programming more satisfying for me.

comment 7y ago · link · parent

There’s a lot of numbers between 0 and 100...

comment 7y ago · link · parent

Is there an <input type=“scrollbar”/>?

Also, input does not necessarily mean text entry. We have <input type=“checkbox”/> and <input type=“button”/> among others.

comment 7y ago · link · parent

The “security” of an algorithm is not defined as the duration of time required by a computer to brute force it. Much more important is how safe it is against other known or anticipated attacks.

comment 7y ago · link · parent

And if your app has any kind of online component, there's probably an HTTP request hitting your server whenever the user launches the app. So even without explicit telemetry in the app, you can easily get decent data from your web server's logs.

comment 7y ago · link · parent

You can do that all online with most cards. It's also likely extremely rare that your card number is stolen this way (it's never happened to me as far as I'm aware).

comment 7y ago · link · parent

I look it at the opposite. As a user, the only thing Paypal protects is your credit card info. Your personal information (name and address) gets passed on to the merchant regardless. There's zero risk to us consumers for stolen credit card numbers, so why would I care about that? Instead, Paypal costs more for the merchants, and I'd prefer the merchant stays in business so I'll use their preferred payment system. Plus, why do I want Paypal keeping their own record of everything I purchase? Thus I only use Paypal when there are no other options.

comment 7y ago · link · parent

But it does, because HTTPS can ensure you always get up to date data. They have a solution involving timestamps for HTTP, but that is still clearly less secure than the guarantee from HTTPS.

comment 7y ago · link · parent

They could also improve the download client to fix this.

For example, if the download client uses the byte-range HTTP requests to download files in chunks, there is nothing stopping it from randomly requesting some additional bytes from the server. Then the attacker would have a very weak probability estimate of what was actually downloaded.

comment 7y ago · link · parent

In PostgreSQL, if you specify a decimal literal, it is assumed to be type NUMERIC (arbitrary precision) by default, as opposed to FLOAT or DOUBLE PRECISION.

If you stored your values in table rows as DOUBLE PRECISION, you would of course get the wrong answer.

comment 7y ago · link · parent

The string representation is for display purposes/information exchange only. I'm sure most implementations would internally store the data in a 16-byte form (eg the C implementation uses __uint128_t), where the data is essentially a 128-bit number.

Given that, inventing a new character set seems pointless, since you'd compare the data using 128-bit binary operations already anyways (as opposed to lexicographical string comparisons). Which leads to the question - how is ULID different from UUID in practice?

comment 7y ago · link · parent

I think this commenting only makes sense if the design is atypical. Probably 90% of the code I write is following design patterns already used throughout the code base.

comment 7y ago · link · parent

Changing your password for a google account seems to involve going to myaccount.google.com (which is not the domain your login is associated with) - so clearly this needs to support redirects to different subdomains.

comment 8y ago · link · parent

Not everybody agrees on the best way to draw text (some people like it blurry, others like it higher contrast), so I think the target users may matter to some level. It also varies by OS, and the OS even have options to let users influence it in some way.

Have you also noticed how even color rendering varies by browser? This is less intuitive...

comment 8y ago · link · parent

I tried your SQL in the demo, and it came out like this:

    SELECT
        field,
        other_field
    FROM
        TABLE
    WHERE
        some_thing IN (
            SELECT
                id
            FROM
                other_table)
            AND other_field IS NOT NULL
I'd have expected the last line to have one less indentation level...

comment 8y ago · link · parent

Agreed. Having to support both the iPhone SE and the iPhone X aspect ratio is really difficult since they are on opposite extremes. I'm quite pleased with the removal of this size configuration - hopefully in about 2 years we won't need to keep supporting it.

comment 8y ago · link · parent

Thanks. I didn't read it carefully enough the first time but I see that mentioned now.

comment 8y ago · link · parent

Did the mice which had access to food 24/7 eat more overall than the mice with restricted food access?

If so, then the study seems useless because the results can entirely be explained as excessive eating leads to health problems.

I don't see anything in the article saying how they controlled for quantity of food consumed.

comment 8y ago · link · parent

I recalling seeing these referred to as modp (positive) and mods (symmetric) back in University. This seems to be the clearest way to distinguish them. I didn't realize different popular programming languages used different versions for the % operator...

The case of a negative denominator doesn't seem to make sense when talking about modulo in an algebraic sense. I don't think you can have a Ring with a negative dimension. So I've never even thought about what % would do with a negative denominator (RHS). If I was using % with an unknown denominator as input, I could just as easily end up with it being 0 which would be a bad thing, so I think it's fair to say I always require it to be positive.

comment 8y ago · link · parent

Right - would be great if more languages supported that, specifically Javascript.

comment 8y ago · link · parent

This suggests the only safe portable way to represent hex is one of these? [1234567890abcdefABCDEF] or [\dabcdefABCDEF] That sucks. Fortunately I don't use C, but I'm worried about this finding its way into other languages...

comment 8y ago · link · parent

The base HTML/javascript coming from the itty.bitty server does not make it smaller. As a matter of fact, it appears that the javascript provided by itty.bitty simply decompresses the URL fragment and then converts it into a data-URI and passes that to an iframe.

So it is smaller than a data URI - but only because it is compressed.

comment 8y ago · link · parent

You just add quotes around $dir. Bash understands the quotes properly/recursively.

    parent_dir = "$(basename "$dir")"

comment 8y ago · link · parent

While this syntax looks decent to me, I'm curious why they didn't go with a heredoc approach, e.g.:

    String s = <<<TEXT
    <html> 
        <body>
            contents
        </body>
    </html>
    TEXT

comment 8y ago · link · parent

Yes unless the websites are using a CDN with shared IP addresses. I wonder what % of the web that covers nowadays.

comment 8y ago · link · parent

Nope but I will next time. This is quite clever. It's likely equivalent to using arbitrary precision numbers but probably performs a lot better.

comment 8y ago · link · parent

I've run into this problem when keeping a single large (100000+) list sorted. In my case it was very important not to change the sort value on rows that didn't need to.

I had considered most of the solutions listed in the article except for the true fraction method. I believe that solution was explored by the author as they thought floating points were somehow solving a problem that couldn't be solved by integers. I settled on an approach that is essentially Solution 2 but using integers instead, each time bisecting the other two integers. The important aspect is that when inserting at the head or tail of the list, you bisect between MININT (-2^63) or MAXINT (2^63-1) respectively.

comment 8y ago · link · parent

As far as I can tell, there's really no advantage to using floating point/fractions at all. I've used an integer-based solution for this very problem in the past.

You can apply the same logic of finding the midpoint between two integers using very simple integer math, store the result as an integer, and get high performance. Just don't start by populating your list with small numbers, the first number would be 0 and the second one would be the midpoint between 0 and either MAXINT or MININT depending on if it came before or after. This ought to have all the advantages of approach 3 (True Fractions) with none of the disadvantages. I'd create a function integer_intermediate just like the rational_intermediate function documented in the article too.

The problem with floating points is that the available precision is highly variable. Sure you can bisect between 0 and 1 many times, but what about between 1000 and 1001? Those 10 bits are lost.

comment 8y ago · link · parent

Seriously. Would be great if somebody could just declare a new mime-type such as "text/html5" that could be used to activate modern html rendering in email clients and would be shipped alongside the existing "text/html" and "text/plain" components. Eventually when enough email clients support this, we could stop generating the legacy html emails and only include text/html5 and text/plain mime types in emails.

comment 8y ago · link · parent

You don't need to keep a master list of IP addresses up to date, you only have to test an IP when a request for a cert comes in from that IP.
1
1112131415