HNHacker News
TopNewBestAskShowJobs

tomtomtom777

737 karma · joined November 19, 2014

submissionscomments
tomtomtom777··on Ask HN: What is the most beautiful piece of code you've ever read?
You seem to be referring to the arguably beautiful effect of code.

Are you seriously praising this monstrosity of preprocessor macros, integers used as magic booleans and compiler specific builtins as beautiful code??

tomtomtom777··on What ORMs have taught me: just learn SQL (2014)
What you are saying exactly highlights what the author is missing: That if your application has some logic, you will eventually have to map your database rows to your in memory typed structures.

It sucks. Sometimes it sucks less if you map your queries as well, sometimes it sucks less if you stick to SQL and only map your results, sometimes it sucks so much you're better off with a no-sql solution.

But when using a relational database, ORM isn't optional.

tomtomtom777··on The cost of parsing JSON
> It would be ridiculous to have a short encoding for `mov rN, #imm` where the immediate has to be in the range 0-7.

Such instruction didn't exist but I wouldn't call it ridiculous. It would actually be quite useful as setting a register to 3 is far more common than setting a register to 7911.

tomtomtom777··on Fossil fuel divestment has ‘zero’ climate impact, says Bill Gates
It's an interesting perspective and one pursued by the initiative:

https://follow-this.org/en/

They offer shares of Shell in an attempt to transition the company to green energy.

tomtomtom777··on Police Shut Down a 3k-Person Game of Hide-and-Seek at IKEA
This would work much better and is actually a great variant I play with my family (although 3k is still a bit crowded). One hides, everyone seeks, if you find, you join hiding.

This has some neat extra elements, such as tactics ("I think I found them but I first need to misdirect and lose these guys"), gymnastics ("Found, so how am I going to fit my big ass into this tiny, already overcrowded spot"), and most importantly shared shadenfreude ("How are we supposed to hold our laughs if the last seeker just strolls by with all of us packed here?").

Highly recommended

tomtomtom777··on What if you couldn’t program with loops?
In this list of loop-special-languages, XQuery also deserves an honorable mention.

With the sequence being the root datatype, it makes loops rather implicit. You can write

    declare function local:formatName($person) {
      xs:concat($person/@firstName, " ", $person/@lastName)
    };
and it will format the name of zero, one or many persons.

Working with XQuery makes you think differently about iteration and shows how much plumbing we normally use for it.

tomtomtom777··on One Program Written in Python, Go, and Rust
> Not really, you should be comparing the idiomatic ways in each language.

> And if Python is more of a "batteries included / easily installable" language, then that's how you should use it.

This isn't python specific. "Idiomatic" Rust would also be to import the crate that does image comparison.

It just happens to be that for this particular problem a python library was found, but no rust crate. This isn't all that common.

tomtomtom777··on Ask HN: Why do new(ish) programming languages eschew OOP features?
> OO can be abused to produce bad designs, of course, but that's not an indictment of its syntax.

It is.

The strength of a language isn't just in what allows you to do, but also in what it limits you to do.

OO in the style of C++/C#/Java is extremely flexible in terms of code organization. This means that most codebases eventually grow towards a mess of different styles and inconsistent design patterns. One guy's abstraction is the next guy's unnecessary plumbing. Teams often have to manage consistency of style and structure through out-of-code agreements.

The advantage of paradigms like procedural or functional programming as well as trait based "OO", is that there is generally an obvious way to structure something. Two different programmers working on the same problem, are likely to produce similarly structured code. The result is that different programmers will adopt much easier to different codebases.

tomtomtom777··on Average Global Temperatures since 1850
Stop buying stuff without thought.

I know that a lot of people feel helpless because it's the big corporations that are emitting, but companies only emit CO2 if consumers pay them to do so.

Buying everything consciously, whether its food, appliances, housing, or a ticket to some performance, will make the world better.

tomtomtom777··on The Rise and Fall of Visual Basic
> The main attraction to VB really was the easy-to-use graphical widgets which was exposed to the programmer via an abstraction called "windows forms".

This could be but it is worth noting that this style of development wasn't unique to VB. Turbo Pascal and later Delphi pioneered this style of development in the same era as VB, each with their own inventions in an arms race towards easy-to-use.

tomtomtom777··on Show HN: Oya – New projects set up lightning fast
I still don't really see how this makes hacking harder. An attacker needs to replace the information presented to the user in order to download the software. For instance, the "download" link, or the paragraph describing the download/checksum procedure.

This always originates from one spot for one user. You can spread among users, but you can not spread a single html snippet over machines in a way that a hacker couldn't replace the "root" html snippet.

tomtomtom777··on Show HN: Oya – New projects set up lightning fast
Agreed. There could be better solutions than the current reliance on X.509 certificates and TLS, for example a blockchain solution like you propose.

But the fact that these solutions do not exist or at least aren't commonplace, makes the criticism to Oya in this regard rather awkward. They are doing what everybody does for their downloads: Relying on the certificate chain.

tomtomtom777··on Show HN: Oya – New projects set up lightning fast
> If you host the file in one place and the website in a different place it's harder for an attacker to change both the file and the website that reports the checksum, ...

That is not a practical solution at all. What do users find if they enter the "download" page? A link to an external site containing the checksum? Wouldn't an attacker just replace (or remove!) the link?

The reality of today's identity management is TLS and certificates. If your website is https://oya.sh, then obviously any attacker who has access to the web server can direct clients to their malware downloads. No extra servers will help against that.

tomtomtom777··on Inheritance versus Composition
Isn't abstraction a tenet of every programming paradigm?
tomtomtom777··on Nokia phones sent identifiable data to Chinese server
In this case, it's not click bait that is winning.

> Nokia phones sent identifiable data to Chinese server

isn't click bait, but simply much more clear and to the point than

> Ask HN: HMD Global (Nokia) is acting shady Any recourse?

tomtomtom777··on The Apple II Source Code for the LOGO Language Found
Yes. I meant to the "8-bit character encoding" but I think it's clear from the context.
tomtomtom777··on The Apple II Source Code for the LOGO Language Found
Apple II did use ASCII. But ASCII defines 128 code-points. The other 128 code-points are specific to the character encoding or "codepage".

They don't like Apple's "idiot" character encoding (which is custom, Apple II specific), so they throw away the top bit with the AND leaving only ASCII characters.

tomtomtom777··on If you want to save the world, veganism isn’t the answer
They make 75 tonnes of meat per year on 3500 acre.

Unless I am missing something, this is really not helping the world. This would amount to something like 0.05 million calories/acre/year.

If I compare that to others (http://www.waldeneffect.org/blog/Calories_per_acre_for_vario...) this doesn't seem like a realistic way to feed the global population.

tomtomtom777··on Design errors Satoshi made
Not really.

The problem is that with twice as many sigops, you would also have to hash ~twice as much for each sigop. Hence O(n*m). A problem known "quadratic hashing".

This is solved by using a different way to hash the signatures that doesn't require full recalculation on each input.

In Bitcoin Cash it is fixed for all transactions; in Bitcoin it is only fixed for SegWit transactions so an attacker could still do this, by not using segwits.

tomtomtom777··on Design errors Satoshi made
He does. Early versions allowed you to spend anybody else's money by using this script as "signature".

Spending money involves prepending the input script to the output script, then executing and checking the result.

Normally the output script is something like "[pubkey] OP_CHECKSIG" (for the old P2PK), and the only input script to cause the combination to succeed would be the valid signature, such that "[sig] [pubkey] OP_CHECKSIG" succeeds.

With "OP_TRUE OP_RETURN" instead of [sig] it would also succeed as OP_RETURN would stop execution.

This was fixed by ensuring OP_RETURN stops execution AND fails the script.

tomtomtom777··on First UTXO Commitment on Bitcoin Cash Testnet Explained
> This leaves the BTC utxo set unmanageable and unpredictable.

Although this is true, I don't think this eliminates the possibility of such UTXO commitment. It is iteratively updated every block and doesn't care about predictability.

The code as written could be easily merged into BTC as well.

The only small difference would be in backtracking: When we have full node that uses fast syncing we could implement that they retrieve older blocks until they are satisfied (either by assumevalid or some accumulated work), and verify from that point. They can simply apply the commitment backwards.

On Bitcoin Cash, this would require block propagation that includes the TxOuts being spent by the block.

This is a bit more difficult on Bitcoin to the difference in sighashing: these TxOuts aren't directly committed transactions that spend them.

tomtomtom777··on First UTXO Commitment on Bitcoin Cash Testnet Explained
Bitcoin Core, since 0.14 doesn't use checkpoints. It uses "assumevalid" which assumes the signatures of transactions are valid.

> "block history data is worthless because full nodes don't validate it"

Please don't misquote people.

tomtomtom777··on First UTXO Commitment on Bitcoin Cash Testnet Explained
No, they don't.

Please check the code.

Please check the discussion:

https://www.reddit.com/r/Bitcoin/comments/5yf0ex/trust_assum...

Please check the news:

https://bitcoinmagazine.com/articles/bitcoin-core-0140-relea...

Or just run your own node: bitcoind --help and see what it says.

tomtomtom777··on First UTXO Commitment on Bitcoin Cash Testnet Explained
It is correct. Here is the default assumevalid on mainnet Bitcoin:

https://github.com/bitcoin/bitcoin/blob/11adab39e6019935aa3a...

> Anyway, you see this "full nodes don't validate the blockchain" nonsense a lot from altcoins that think they've found a neat-o way to get faster/cheaper transactions.

I am not saying "full nodes don't validate the blockchain". I am explaining that full nodes (on both Bitcoin as well as Bitcoin Cash) don't validate historical blocks. This would take way too much time, and as I explain in the article doesn't really reduce trust in the software.

Here is the mechanism by which the Bitcoin Core implementation uses "assumevalid":

https://github.com/bitcoin/bitcoin/blob/7f4db9a7c3549a36e45d...

tomtomtom777··on Bitcoin Fork Monitor
It isn't that simple yet.

SegWit2X, which is about to activate is a compromise that gives both Segwit (improving off-chain) and a slight increase.

There is however uncertainty among big blockers about the increase as it is three months later, so it could still fail resulting in SegWit only.

The Bitcoin Cash (ABC) fork is addressing this by forking non-SegWit and bigger blocks, though its support is rather uncertain at this point.

tomtomtom777··on Bitcoin Fork Monitor
You are correct, but as it seems almost certain at this point that SegWit2X (btc1) will reach its threshold in time, we can simplify.

SegWit2x rejects non-SegWit blocks. So with the majority it has it can't cause a fork in the chain (until the HF 3 months later), and neither will BIP148.

So with the rather safe assumption SegWit2X reaches its threshold in the next few days, the only expected fork in the chain by August will be Bitcoin Cash (Bitcoin ABC/BU/big blocks) on one chain and Segwit on the other.

tomtomtom777··on Fast Bitcoin block validation without UTXO-index
Live comparison with Bitcoin Core is available at https://bitcrust.org/results
tomtomtom777··on Ask HN: Why does 'View Source' issue a new HTTP request?
> So, the browser should load the HTML page into a part of memory that can be discarded by the OS if the OS needs more memory. Actually I think it is strange that no such memory API exists in Unix.

It is more tricky then you would think to determine what "needed" memory means. Does the OS need disk cache? Or the content of memory mapped files?

It's not unlikely that you currently have some process active which has memory mapped a huge file. Does it need the content? Who knows.

tomtomtom777··on George Hotz Is Giving Away Self-Driving Software
I find its absence much more unprofessional.

Commits are an essential ingredient in a modern codebase to describe why each line of the code is there.

I don't want to go back to blocks being commented out and code intertwined with comments like /* 6-dec-2016 tomtomtom: moved from other_function() to fix latency */

tomtomtom777··on George Hotz Is Giving Away Self-Driving Software
> Someone else in this thread commented that the repo linked in the article isn't the right one and apparently this is where the code resides https://github.com/commaai/openpilot

Hmm. Sorry, but no.

I am not going to let my car being driven by dynamically typed code without any tests.

Frankly, it looks like a hobby project that has grown a bit messy over time.

← PreviousPage 6 of 7Next →