HNHacker News
TopNewBestAskShowJobs

zxw

8 karma · joined December 1, 2010

submissionscomments
zxw··on Opera moves to WebKit
10+ years here too. Recently forced to switch because it's gotten so bad. Maybe if they aren't working the render engine they will have more time to work on performance.
zxw··on Simple Helper to Extract Values from a String
Looks really nice, very readable. However, I want a python version!
zxw··on Tangle is a JavaScript library for creating reactive documents.
This is pretty cool but it needs to have a more distinctive style. Maybe the same as it is but green.
zxw··on Google buys 1,000 patents from IBM to defend Android
1023 = 0b1111111111
zxw··on How we found the file that was used to Hack RSA
It's common for the free detectable version of popular trojans to be used as the advertisement for the paid undetectable one.

Looking at the poison ivy website they have a customer portal, so presumably this is how they did it.

There are also methods to pay without leaving a paper trail back to you (pre-paid cards I think).

Edit: It's also possible to modify detectable executables to make them undetectable if you don't want to pay. Virus scanners for the most part work by reading a few bytes from an executable at a particular point, hashing those bytes and if they match a known virus, report it as one. By finding those parts of the executable (there are often multiple signatures, and different vendors will have different signatures too) and modifying them slightly, the resultant hash will be different and the executable undetected.

zxw··on Why I hate the Kindle
You can get the Kindle DX if you want a larger screen. I have one and am very happy with it.

http://www.amazon.com/dp/B002GYWHSQ/

zxw··on Ten Ways to Check if an Integer Is a Power Of Two in C
Yeh it's fairly slow going. I'm at 3,706,382,752 and am going to call it a day. Looks like the code works properly.
zxw··on Ten Ways to Check if an Integer Is a Power Of Two in C
Here is the code from the first test.[0] It increments a variable and prints a message if their is an inconsistency. I left it running till it reached 1,351,773,471 and didn't come up with any inconsistencies.

I then modified the test[1] to look for inconsistencies where they were most likely to be found, ie ±1 of 2n. I reached n being 1024 before python complained about a 'Result too large'.

[0] http://paste.pound-python.org/show/10067/

[1] http://paste.pound-python.org/show/10068/

Edit: just reread about the 1 in 2 billion chance, I'll leave the first test running longer to make sure.

zxw··on Ten Ways to Check if an Integer Is a Power Of Two in C
I'm not doing power == int(power) though which is what he warns against. I haven't done a lot of testing however as far I can tell it's working.

    >>> is_power_of_two(2 ** 31 - 1)
    False
    >>> is_power_of_two(2 ** 31)
    True
    >>> is_power_of_two(2 ** 31 + 1)
    False

    >>> is_power_of_two(2 ** 548 - 1)
    False
    >>> is_power_of_two(2 ** 548)
    True
    >>> is_power_of_two(2 ** 548 + 1)
    False
zxw··on Ten Ways to Check if an Integer Is a Power Of Two in C
Is there a reason this won't work? It's the most 'readable' way I could come up with.

    #(python code)
    def is_power_of_two(n):
        import math

        if n <= 0:
            return False

        power = round(math.log(n, 2))
        return 2 ** power == n