HNHacker News
TopNewBestAskShowJobs

0xABADC0DA

172 karma · joined August 2, 2011

Hellbanned for a +6 point comment.
submissionscomments
0xABADC0DA··on The Apple Boycott: People Are Spouting Nonsense about Chinese Manufacturing
Which is a better customer for the worker, an Apple making 70% profit or a Apple making only 4% profit?

An Apple only making 4% profit is going to negotiate hard to lower the production costs or look for lower-cost suppliers. An Apple making 70% profit is not going to put up as much fight when Foxconn raises their prices a little bit so they can pay the workers more.

So really it's the Dell or Microsoft making 4% profit (completely made up number) that is far worse for the workers. If we cared about the workers as opposed to some PR / ego thing then we'd go out of our way to buy Apple products and boycott Dell/MS/etc.

0xABADC0DA··on Zsh is your friend.
These are the history setopt's I have, but I don't know if they all make sense with each other though. I set it up once and haven't touched it in years.

HIST_IGNORE_DUPS # don't add multiple 'cd ..', etc in a row?

HIST_EXPIRE_DUPS_FIRST # save unique hist entries longer

HIST_VERIFY # edit recalled history before running

INC_APPEND_HISTORY # add commands to .history immediately

EXTENDED_HISTORY # save timestamp on history entries

# set a huge history... doesn't seem to affect performance at all

HISTFILE=~/.zsh_history

HISTSIZE=10000

SAVEHIST=$((HISTSIZE/2))

For the completion I setopt AUTO_REMOVE_SLASH GLOB_COMPLETE MENU_COMPLETE NO_AUTO_LIST NO_BAD_PATTERN NO_BEEP NO_LIST_AMBIGUOUS NO_LIST_BEEP NO_NOMATCH, but I'm not sure what they all do ;-P

0xABADC0DA··on Zsh is your friend.
Zsh has knobs for shared history. You can configure all terminals to have the same history at the same time, but I have it set to add history to the .zsh_history file immediately, but each shell gets it's own history. So ctrl-r in a shell lists commands entered into that shell (or preexisting when it started), and opening a new terminal starts with the shared history from all terminals. This is really the best of both worlds. Also there's a knob to only add a command if it isn't in the history, so no scrolling back over a dozen "cd .." or whatever.

Zsh has floating point math, for instance $((1.0/2)) is 0.5 instead of an error. This comes in handy sometimes in simple scripts.

Zsh is significantly faster.

Zsh autocomplete is much more advanced. Bash may have copied the pid completion and some other easy ones, but zsh has all sorts of completion hooks, for instance "svn help ch<tab>" expands to "changelist". It also runs --help and parses out GNU style help text for completing options.

Zsh completion also has optional Windows-style cycle mode, so you can do "prefix<tab><tab>"... and cycle through the matches instead of prefix<tab>a<tab><tab>b<tab>-<tab>" like in bash. I think you can actually make bash do this but it's some obscure key binding.

...basically zsh is just a bit better at everything.

{edit: oops meant to reply to grandparent}

0xABADC0DA··on Firefox 12 will finally have a New Tab Page and Home Tab
My problem with Joel here is that he's taking a good rule, not to rewrite software unnecessarily, and trying to make it universal.

Well it's not a universal rule to never scrap code. Sometimes the software is just so bad, so complicated, so wrong for the task that it must be scrapped. Large parts of Navigator, but also other things like OS 9 are examples. The original Mac OS was simply not cut out for an internet age -- like Windows 9x it couldn't be reworked to something current.

Even if Mozilla fails to keep their browser relevant, the investment is sure to pay off with a new widely respected system programming language. If you follow the reception of Rust virtually everybody seems impressed with the rationality and practicality of its design choices, explained and backed by solid engineering. Compared to the nearly universally panned golang (series of arbitrary decisions) or even Dart (decisions not backed by metrics), it's hard to imagine that Rust won't have a major impact on the industry -- that alone is worth scrapping the browser engine and rewriting from scratch.

0xABADC0DA··on Google is FUBAR
Is the state of tech blogging so, so poor or do you just not agree with the conclusions? For instance:

"It must force Chrome and Google+ down the throats of users who are simply looking for a brilliant search engine."

Google just recently started showing Chrome 'faster internet' ads to Firefox users (before it was only displayed to IE users). This blog is a bit over the top especially with claims like "[Google] search engine that’s no better than Bing", but fundamentally I think it's right on the money.

0xABADC0DA··on Working Group assembling to discuss HTTP/2.0
Not sure why everybody is so ecstatic about Spdy... it has a bunch of warts, like for instance the shared dictionary for HTTP headers that saves a couple hundred bytes over connections that may send several MiB (pointless compression, complexity). Also the whole concept of priorities, cancelled requests still filling up network buffers, etc.

A committee of experts is how a new protocol like this should be developed, and I fully expect whatever they come up with to be better designed and considered than Spdy.

0xABADC0DA··on Megaupload down, FBI Charges Seven With Online Piracy
DMAA safe harbor only applies if you are not aware of the infringing content. If you have a bunch of links to the same file and only take down one then you have no protection under DMCA and the standard 'greater-than $3k damages then go to jail' applies.

There is also a red flags test. If a reasonable person would be aware that the site is hosting files that infringe then it's not protected. And also you can't get direct financial benefit from it, you have to close accounts of repeat offenders, and some other restrictions.

Basically everybody knew Megaupload hosted warez, there were red flags, megaupload didn't take down links they knew were warez, and they made money off of it. Case closed. There may have also been legitimate use of megaupload, but they weren't covered by safe harbor and them being shut down is the law working as intended.

> you could combinatorially add random junk into the stream and circumvent that as well.

One could, like how people flip/speed up/record tv to get around youtube blocking, but it would take a lot of work and dedication to keep uploading your 500+ MiB movie rips over and over again.

0xABADC0DA··on SPDY of the Future Might Blow Your Mind Today
"I spent a fair amount of time running network traces of the Kindle Fire, and I honestly don’t know quite what they’re doing yet."

That's a problem with binary protocols. How does Spdy help the 'open web' when you can't even tell what's even going on at the network layer even after spending lots of time trying?

This blog also like every other advocating Spdy ignores that HTTP tunneling in practice provides the same benefits. And the last graph is the same as for an HTTP proxy, nothing to see there.

0xABADC0DA··on Isaacs: try/catch is an anti-pattern
> If you need to recover from bad slice indexes then your [error handler] code is broken

You bring up a good point that when resorting to value comparisons for error handling instead of type comparisons it's easy to make mistakes. The code is as far as I can tell a simplest way to handle an index out of bounds, but to also handle a 'slice out of bounds' it would need to also compare to the string value "runtime error: slice bounds out of range" -- not helping the case for error handling in Google Go.

This code strikingly shows deficiencies in Google Go non-local error handling:

- Tons of boilerplate (defer, recover, re-panic, type check, value check)

- Not scoped so can only handle an error once per function

- Have to do value tests in addition since types are very generic due to implicit interfaces

- Error values are poorly defined

- Result for higher-level caller is buried deep in the function and non-obvious

These problems extend to all non-local error handling in Google Go, not just for this specific case of array and string indexes. That the idiomatic way to 'handle' an error is to abort the program is another separate problem.

0xABADC0DA··on Isaacs: try/catch is an anti-pattern
For some context here's another error handler in Google Go:

    defer func() {
        if r := recover(); r != nil {
            if err, ok := r.(runtime.Error); ok {
                if err.String() == "runtime error: index out of range" {
                    // handle bad index
                    return
                }
            }

            panic(r)
        }
    }()
vs

    try {
    }
    catch (IndexOutOfBoundsException ex) {
        // handle bad index
    }
A language where you have to resort to string compare to handle invalid array accesses can't be use as a model for good error handling IMO.

Of course that's just the tip of an iceberg with no way for IDEs/tools to know what return is an error, no way to know at a glance if "_" was an ignored error or ignored other extra return value, plus other fundamental problems caused by implicit types.

0xABADC0DA··on At Google X, a Top-Secret Lab Dreaming Up the Future
Yeah not really. If you look at Sketchpad and the Mother Of All Demos you see the foundations and inventions of modern user interfaces, and C++ style objects were invented first in Simula.

So PARC was mostly just the industrialization of already known ideas and computer interactions.

0xABADC0DA··on I loved C. But it always fell short for me. Objective-C fixed that.
From piecing together the history I think it's clear that the real magic came from Ritchie. I doubt that Pike and Thompson in particular were ever in touch with the rest of the world.

Things like variable declarations matching the look of how variables are used ('inside out' parsing) are not simple and are responsible for the certain something that makes C work. And Unix was never beautiful, it was always a huge hack.

0xABADC0DA··on Google's new "freshness" update. Affects ~35% of searches
The preview panel is useful because Bing has it. It's like Google has set out to ape anything Bing does so the only difference is the result quality.

- Bing added a main search page background image, so Google adds one (but only if you're logged in).

- Bing changed the image search to pack images together with hover for info, so Google made theirs do the same.

- Bing added image search parameters like size, style, etc, so Google adds them too.

- Bing added preview panel, so Google added it too.

- Bing moved cache links into the preview, so Google moves cache links into the preview.

...iirc Bing did all these things and more first before Google.

0xABADC0DA··on Dart to JVM bytecode compiler
A way to show differences is to say what steps would be involved getting Dart code to run on the JVM. As far as I can tell the only real difference is type erasure, so all you'd have to do is:

1) erase types. All method parameters become Object, all variables become Object.

2) implicitly add an interface to each class for each method type ie classes with String toString(String) get an implicit interface with one method Object toString(Object).

3) implicitly cast from Object to the method-interface type in order to call methods.

That sounds pretty slow, but also not very far from Java. I doubt it would take more than a day to make a prototype .dart to .java source converter that actually worked on JVM.

0xABADC0DA··on Hey Google, I want my cache links back
I think they're trying to make their interface look exactly like Bing so the only way Microsoft can compete is by having better search results.

You guys at HN probably don't check out Bing very much, but many of the UI changes in Google were in Bing first... hover over a search result to show more info on the side, image search with just images (details when you hover), infinite scroll on image search, background image on main search page, etc.

0xABADC0DA··on Apple Announces Event on October 4th: Let's Talk iPhone
I bet the 1 on the phone is for "one more thing"; they're going to call up Steve Jobs and talk with him since he can't be there live on stage.
0xABADC0DA··on How can C Programs be so Reliable?
What you say about error handling is true enough, but it's just not the whole story.

One problem with C-style error handling is that having error handling at all levels makes it impossible to reuse code without tweaking it. Say you handle an error by printing a warning message to stderr, now you can't reuse that code in anything that doesn't want error messages printed there (maybe it doesn't want errors printed, or it needs to localize them, or it's using stderr for something else like in strace). So error handling in C kill reusability.

Another problem with C-style error handling is that the number of error types increases as you pass the buck up levels, but C doesn't have any good way to express more than one type at a time. Say one function returns true or false and another returns an error constant like errno. When one function calls the other, what do you return at the top level? You could map one to the other, but you've lost maybe important information about the error. So error handling in C kills composability.

And a third problem is documentation. With no standard error types that are known to the compiler it is rarely possible to tell the caller they forgot some error handling.

Exceptions address the first two problems, and checked exceptions the third one. A common misunderstanding of Java checked exceptions is that they force the caller to handle the error, when what they really do is force to caller to document the errors it can generate.

0xABADC0DA··on Chrome 14 released
Big fan of Firefox nightly here. It's only 5% slower than Chrome dev channel on Kracken, has a better garbage collector (fewer pauses, less overhead), is more configurable (UI, better extensions), about the same compositing, scales to any number of open tabs.
0xABADC0DA··on Google Loses Effort to Seal Records in Android Patent Lawsuit With Oracle
Dalvik is also very similar to the JVM in a number of ways. For instance the instruction set maps almost 1:1 to bytecodes:

  OP_MONITOR_ENTER vs monitorenter
  OP_INVOKE_STATIC vs invokestatic  
  OP_THROW vs athrow  
  OP_CHECK_CAST vs checkcast  
  OP_ARRAY_LENGTH vs arraylength  
  OP_NEW_ARRAY vs anewarray  
  ...
If the question is "Dalvik was designed to run code written in what language?" the answer is "Java" without any doubt. This might be important to some legal question, whether Google created it with the specific intention to not pay license fees or something, or whether they broke a license for J2SE (they use Java a lot) that prohibits them from creating incompatible versions of Java.
← PreviousPage 4 of 4