HNHacker News
TopNewBestAskShowJobs

ianb

515 karma · joined February 17, 2008

Hi, I'm Ian Bicking. I'm an open source programmer. Working at Mozilla. In the interest of clarity I switched my main user account to ianbicking

My main project these days: https://togetherjs.com

My homepage: http://ianbicking.org

Blog: http://ianbicking.org/blog/

Projects: http://ianbicking.org/projects.html

A lot of Python in the past, mostly Javascript now.

submissionscomments
ianb··on John Carmack's Comment on Hardware Ray Tracing
"For example, all surfaces that are shaded with interpolated normal will have an unnatural shadow discontinuity at the silhouette edges with single shadow ray traces."

For some reason I really want to understand what this sentence means. I don't know why it jumped out at me, maybe because it seems both accessible and arcane, I want some path to even just tour the arcane concerns of someone so deep into a (this) particular domain.

ianb··on How Japanese Kids Learn To Multiply
Another approach: http://en.wikipedia.org/wiki/Grid_method_multiplication

Of course it's all multiplication, and all essentially the same thing. I find the grid method the least notation-focused of at least these three, and so I think more accessible to assimilation. Maybe I'm biased, I didn't learn multiplication this way but found myself naturally doing it like this in my head and then was pleasantly surprised to find it had a name. It's also amenable to estimation.

ianb··on Beefing up the Python Shell to build apps faster and DRYer
I think doctest and a UI around the doctest concept (there have been a couple) is a better approach. There was one whose name I can't remember – r...something. Unfortunately it used wxWindows, and was a pain to install... native UIs suck.

But with a Doctest model you just develop a script, and if you change something rerun the script, starting where you left off (assuming the script reruns – if it doesn't then you probably want to start where it fails). You can extend the script without reloading still, but changing the past requires starting over... but it's just CPU cycles, assuming you aren't doing something computationally expensive. But even if so, you could have a kind of cross-session Pickling memoize function if you don't want to recalculate things.

These reloading tricks are fragile and break in weird ways, like it won't fix badly initialized data, or classes that can't be upgraded because of state changes. It leads ultimately to a distrust of the environment, until you throw your hands up and go back to the old restart-frequently model like everyone else. Recursive reloading certainly isn't new, but it's never satisfying.

ianb··on Gerrymandering and a cure - shortest splitline algorithm
> Splitlines are very likely to cut through urban areas. Since the urban/rural distinction is meaningful in American politics, this has interesting consequences.

Thinking about it more, in a place like New Mexico (and there are many similar states) this means rural voters will be systematically disenfranchised, as they the state ends up being divided into regions around the central city, and in each region the urban area is larger than the rural area. If combined the rural area could be at least a seat of its own, even if more overall seats went to urban/metro districts.

Well... thinking about it, it could also go the other way, depending on what the overall rural/urban divide is – if there is a larger but dispersed non-metro population then it could be the urban population that is lost in the rural population. This might actually be the case in someplace like New Mexico or Idaho.

New Mexico's actual congressional districts look very reasonable: http://en.wikipedia.org/wiki/New_Mexicos_congressional_distr...

ianb··on Gerrymandering and a cure - shortest splitline algorithm
In the case of a lot of states with one major city, the algorithm basically just splits that main city, for instance New Mexico: http://rangevoting.org/Splitline2009/nm.png – when the city is big enough to have a couple districts of its own it's not as bad, like: http://rangevoting.org/Splitline2009/mn.png

I'm kind of unimpressed. There are mechanisms to remove partisanship and political gerrymandering without making the whole thing into an algorithm.

ianb··on Gerrymandering and a cure - shortest splitline algorithm
I don't see how instant run-off voting would change much of anything, unless perhaps you got rid of the endorsement process at the same time so that people of the same party could more easily run against each other.
ianb··on It's like JSON. but fast and small.
Well, with Python it doesn't seem particularly fast. I put together a small test: http://svn.colorstudy.com/home/ianb/msgpack_json_comparison....

It uses some random JSON data I found. msgpack is more compact (87% of the JSON representation), though not dramatically so.

json encode: 5.54msec simplejson encode: 8.27msec msgpack encode: 11.4msec json decode: 16.4msec simplejson decode: 4.06msec msgpack decode: 2.84msec

I'm confused about why json is faster at encoding and simplejson is faster at decoding. simplejson is fastest when you combine encoding and decoding.

ianb··on Requests, Python HTTP for Humans, reached v1.0
Where does this happen? I'm not seeing it: https://gist.github.com/4329831 – the exception seems to come through just fine?
ianb··on Infographic: United States of Subsidies
It's not clear to me if Texas is taking anyone else's money – from what I can tell some Texans (and Texan companies) have to pay higher taxes because other Texas companies are receiving these tax benefits.
ianb··on Infographic: United States of Subsidies
Minnesota (low on this list) implemented something like this, where when an area gets a particularly large tax windfall like from a corporate campus, a portion of that goes into a general fund. So if a location wants to give away some portion of tax revenue in order to lure a company from somewhere else in the state, it's not a big win for anyone. I think it's worked...? I don't know what other states do.
ianb··on APIs that will transform the Web in 2013
It doesn't look anything like Java. There's a class statement, but it's not something dramatic, just some syntax around normal JS prototype patterns. The JS2 proposals years back started to look a lot more like Java, but those never went anywhere.
ianb··on APIs that will transform the Web in 2013
Mozilla's Prism/WebRunner/Chromeless are all basically defunct, and Chrome Apps aren't really the same as those anyway. Chrome Apps and Firefox OS Apps are basically the same – and in both cases it's adding some extra APIs that web pages can't normally get access too, and an optional packaging format, and a little application-related metadata. Firefox Apps are a bit more cross-platform, as they look a bit more like native apps on normal desktop systems and on Android.
ianb··on APIs that will transform the Web in 2013
I think WebRTC is going to be more of a 2014 technology – it's still pretty raw as a technology, and even more so as implements, going into 2013.
ianb··on A Minimum Tax for the Wealthy
Now we're demanding that progressivity must balance the budget too? This is car salesman accounting, muddling unrelated choices together to distract from individual choices that can be rationally considered.

You keep giving these pundit talking points – the talking points of pundits have been rehashed enough, we shouldn't be using them here, it's not a productive form of discussion. Are we men or are we pundits? I, sir, am a man! ;)

ianb··on A Minimum Tax for the Wealthy
I'd kind of dismissed the idea of a consumption/sales tax as terribly regressive, but it doesn't have to be, and lately I've been wondering what the distribution might look like. To make a sales tax more progressive, you might in effect say that the first $20,000 you spend is tax-free. If you have a 10% tax, then you just give every individual $2,000 cash (and ignore that some people spend less than $20,000 – that's the sort of loophole that can never grow very large).

Given a system like that I'd be curious what the numbers might really look like. How high a tax would we need? What would the actual tax burden look like for different amounts of cash-back? Could we replicate something similar to the progressivity we have now?

But there's still distortions. Consider high Shipping & Handling fees – these are often done because S&H is considered a service, and so sales tax is not levied on that portion of the cost. But a $0.01 book with $7 S&H is clearly bullshit. But who is there to call the seller on that bullshit? Why are goods taxed but not services? I've never been clear on that.

ianb··on A Minimum Tax for the Wealthy
I offered a thought experiment, and using the example of "giving $1,000" is easier to think about than "not taking $1,000". As a thought experiment they are equivalent, with respect to the question: who utilizes resources most efficiently?

By introducing variability of how much the government takes total it adds another question that is being used to persistently distract from the question of progressivity. When people say "the wealthy should bear a larger portion of the burden" a typical response is "we should be spending less on government!" – which is no response at all, just a distraction.

You said: "The notion that taxation should be predicated on whether the government or the person can 'better use' the person's money is damn scary." – which is EXACTLY what I was pointedly NOT asking. The degree of progressivity in a system does not determine whether a person or the government has the person's money, but WHICH people have how much money.

ianb··on A Minimum Tax for the Wealthy
The whole point of my post is that progressive taxation is a question of which individuals pay what, not whether money stays with individuals or goes to the government. You appear to be caught up in the framing of political rhetoric.
ianb··on A Minimum Tax for the Wealthy
This response has become the standard (non sequitur) response to proposals for progressive taxation, but it doesn't engage at all with the argument being made.

The degree to which taxes are progressive doesn't determine the total tax collected, or the amount the government expends, it determines how that burden is applied to people. What we should really be comparing is: does an individual allocate their first $100,000 of income with any different efficiency than their second, third, or fifteenth $100k of income? If you give $1000 to a person who makes $50,000 a year, and $1000 to someone who makes $1,000,000 a year, who will allocate that money better? I think most of us would feel intuitively that the person making $50,000 would use it "better", but there's fair arguments to the contrary as well (including figuring out what "better" means). But only when you ask that question are you asking about progressive taxation, not just tax burden as a whole.

ianb··on Twisted History of Python Packaging
If you have a "simple" package, i.e., Python-only, and no namespace fanciness, find a setup.py from a package you use, copy it, scan and rewrite it, and you are probably good to go.

Just avoid:

- Namespace packages. This is where you have one package that provides, say, mypackageset.thing1, and another package that provides mypackageset.thing2. If you really want to have a "brand" with many packages in it, just name it mypackageset_thing1 and save yourself a headache.

- If you have important non-.py files (e.g., templates) in your package, you'll have to learn package_data (http://docs.python.org/2/distutils/setupscript.html#installi...) and maybe MANIFEST.in. These are annoying, and you won't notice when you install from a checkout or with "pip install -e". You might need to study up more on this thing in particular (or just poke around until it works).

- Some people use requirements.txt instead of install_requires inside setup.py now. I often use both – but with install_requires just for the absolute minimum of what might be required.

ianb··on Why an Airline That Travelers Love Is Failing
I find SJC quite nice when it's convenient to my destination. I suppose it's not nearly as luxurious-feeling, but it's so much more relaxed. I went through OAK just once, and was surprised how much of a dump it was. Reminded me of Midway before it was renovated/rebuilt. But I'd still choose it over SFO.
ianb··on Why an Airline That Travelers Love Is Failing
Is it a good idea to be headquartered in San Francisco? That's halfway between EVERYWHERE, and the vast uninhabited expanse of the Pacific. Most airlines have hubs inland.

(Maybe I'm just bitter because I'll probably never take a Virgin flight due to their route layout. Also I hate SFO.)

ianb··on Markdown: The Spec - it's coming and it's full of personalities
Looking at the site, it seems like MMD is Yet Another Markdown Implementation. Which is a good reason to participate, and they might have some particularly good things to contribute (like a test suite), but it's not itself "standard Markdown". And even the test suite probably is overly specific and needs to be reviewed. For instance, it seems unlikely that balanced quotes would become a required feature (or at least to do so would require discussion).
ianb··on Free Online Education Is Now Illegal in Minnesota
Coursera doesn't care if you break their Terms Of Service in this regard, so I see no reason they would put up any restriction. Their interpretation is that you can spend up to 49% of your studying time in Minnesota, probably including offline studying which might plausibly happen out of state. They are basically inviting Minnesotans to ignore the law (as we all should!)
ianb··on Free Online Education Is Now Illegal in Minnesota
It's not the "free" part that is causing the problem – the law is that anyone offering courses has to register and pay a fee to the state, which might seem reasonable for an institution charging tuition. It becomes absurd when they ask that an institution like Coursera ask permission of the state and pay a fee to provide free classes that lead to no degree.
ianb··on The State of JavaScript - Brendan Eich
Eval sure, but the way that type coercion works in Javascript is an error. Boxing in Javascript is an error. You can figure them out, you can code around them, but they are bad and can't be justified. All coercion isn't bad, but some is.

Have you seen code that uses .valueOf() for anything good or useful? new String()?

ianb··on Doctest.js: a humane Javascript test framework
FWIW, doctest.js briefly supported CoffeeScript, back when the format was essentially language-neutral:

    $ makeRequest({
    >   url: 'http://example.com/endpoint',
    >   data: 'foo',
    >   success: Spy('makeRequest', {wait: true}),
    > });
    makeRequest(...)
The example and output was parsed essentially by regexes. That was kind of okay, but I'm much happier with the new comment-based format. But that depends on parsing the language itself, so it's nontrivial to add other languages (before I only had to replace eval).

Still, supporting CoffeeScript shouldn't be a big task, it would just require abstracting out some of the parsing, and having a way to select the language (probably just another CSS class on elements, and/or the page body). The only parsing doctest really cars about is chunking the text by comment.

In regards to abbreviated examples: you can write your test in one big chunk, and I like to do this when I'm really testing and not explaining – doctest.js is not intended to just be a documentation tool. But if you are composing docs, then doctest will only test things that are explicitly marked to be tested. It's not as strict as Python's doctest, because it's using essentially invisible information to determine what's a test (a CSS class). You can also have it test things that aren't visible in the docs themselves, but are necessary to create a usable environment for the tests.

Of course a lot of things, like makeRequest, are only interesting if you handle the async aspect of the code. Spy() is handy for testing, but will look peculiar in documentation. It occurs to me that for documentation you might want:

    makeRequest({
      url: 'http://example.com/endpoint',
      data: 'foo',
      success: function () {
        print('I got a response:', this.status);
      },
    });
    // (later) => I got a response: 200
Where "(later)" tells the test runner to wait for at least something to be printed out.
ianb··on Doctest.js: a humane Javascript test framework
With doctest.js potentially the HTML docs/examples are runnable tests, and you wouldn't have to generate both (or the difference would just be whether you included doctest.js)

If you could just do:

```javascript;commenttest print(capitalize('some words')); // => Some Words ```

and if javascript;commenttest got translated into <pre class="commenttest">, then you'd be good to go right now, without any special support from doctest. I believe if the element is syntax highlighted that doctest will just ignore (and wipe) that highlighting, but it depends on the details, I've never personally tried it. If you could add multiple classes you could use javascript;commenttest.hidden for setup code that you want to run as part of the tests, but doesn't add to the narrative. (There's a class that makes setup blocks compact, but I suppose I could extend it to do hidden blocks too: http://doctestjs.org/reference.html#compact)

I don't think there's an advantage for doctest to parse the Markdown directly, as opposed to parsing what is rendered. And extracting just the code also seems unnecessary, as it is helpful to see the context of any failures.

ianb··on Bill Nye warns: Creation views threaten US science
This is a good critique of the form of Bill Nye's anti-creationist screed: http://jasonlefkowitz.net/2012/08/bill-nye-demonstrates-how-...

The form of his argument only encourages the conflict. He clearly feels contempt towards creationists, and even towards those who sympathize with them. As soon as you've shown contempt you've given up on convincing anyone of anything, and are just cheering on your side.

A serious attempt at promoting evolution would emphasize how you can resolve the tension between the theory of evolution and a strong belief in Christianity and The Bible. (There's no reason to pretend this is a general issue, it's a Christian issue: http://en.wikipedia.org/wiki/Level_of_support_for_evolution#...)

I'm not a Christian, so I can't write something more authentic than what Bill Nye might (though I damn well could write something less offensive). But I can imagine what the intellectual tensions are. I made an attempt (https://plus.google.com/104537541227697934010/posts/TnMt9Wgf...), something like:

To convince someone of evolution, as a Christian, I'd want to emphasize a reverence for the world as God created it, that He teaches us through the world around us, and that learning from and of that world could never be in contradiction with His word, in the Bible or as shown to us through our faith. The world is full of contradictory messages and lessons, we can't always expect to decide that one is right and another is wrong.

I'd want to probe how the person has chosen to resolve the tension between Bible-as-fact and Bible-as-historical-document. For example, the Bible in many places talks freely and without condemnation about slavery, and clearly this does not fit with a modern understanding of Christian morality. I would hope that the person has seriously considered this problem and come to a resolution. I would hope to find a way to fit evolution, and ongoing scientific discovery in general, into that intellectual template.

Some Creationists might claim, for instance, that something as complicated as the eye could not be made through the incremental changes of evolution – it had to be designed. But this is a terribly limited notion of God. Could not God create a mechanism that would lead to the design of His choosing? Is there a mechanism so complicated that He could not conceive of it and create it?

There is a story of creation in the Bible. It is not a recipe of how to create a world. It is a message given to us to explain the world, a world that we cannot ever fully know. We've found tensions in that story. Consider for instance dinosaur fossils. Some people have considered this and read Genesis, and decided that dinosaurs must have lived in the Garden Of Eden, or been wiped out by the Great Flood. Does the Bible say this? No. There is more in the world than is in the Bible. Does the Bible talk of electricity, or about germs? No. Would we try to create a Biblical basis for this phenomena? No. The Bible covers the entirety of the creation of the Earth in one chapter, would we expect it to be comprehensive? It is our burden to resolve the world we see with the Bible as written. Some decide to ignore the world. This is a lazy approach, God did not give us the world in all its fullness just for us to ignore it.

ianb··on CoffeeScript: less typing, bad readability
In my experience I would find myself frequently falling back to explicit brackets and more traditional Javascript syntax when I wasn't sure how to construct the statement. Which was okay (I wasn't stumped), but it happened fairly often. Your multiple line example (without "function") is the kind of thing I wouldn't be able to create on my own – both the indentation and comma have to be in just the right place, and the rules that govern that are not very clear. Or rather, it seems to be the one thing that works given a bunch of rules that are interacting in that particular situation. And each time I'd get something like that wrong it'd probably compile, but then I'd have to read the generated source to see what I'd actually done.
ianb··on U.S. Taxpayers Are Gouged on Mass Transit Costs
How do private companies arrange infrastructure-sized projects? Oil companies seem to have substantial arrangements like these. Railroads maintain a lot of infrastructure privately. I'm guessing these companies don't get gouged like the government, but they really have all the same issues, like internal corruption, the bid process, change orders, competing interests in the company, etc.
← PreviousPage 3 of 8Next →