HNHacker News
TopNewBestAskShowJobs

pak

4,759 karma · joined March 29, 2010

Assistant Professor at University of California, Irvine

Opinions posted here are my strictly my own, and not representative of any employer or organization that I am a part of.

https://tedpak.com

[ my public key: https://keybase.io/powerpak; my proof: https://keybase.io/powerpak/sigs/fEW8iI_3tD3E9XjbSaPJTDOtaai7TXU6j1QAezE82Xc ]

submissionscomments
pak··on Porting to Python 3: An offer for you
So, the namespacing is completely consistent, but the number of arguments between method definition and method calling is not? That breaks consistency both internally (because regular functions do have the same number of arguments) and with just about every other language I've used. Something tells me adding one little keyword that pokes into the namespace would not be the end of the world. It would, however, save me (and anyone else that has to juggle multiple languages) from several groaner bugs per day.

Guido can repeat as many times as he likes that calling an instance method is morally equivalent to passing the instance as an additional argument. It may even be implemented that way. The reality is that nobody except compiler devs actually think like that--to everyone else it's an implementation detail. It also doesn't naturally explain why it would be shoved in as the first argument as opposed to appended as the last.

And the fact that self is an idiom, and not a keyword, just feels wrong to me. If nobody would actually ever use any other word in sane code, there is no point in preserving the flexibility of doing so by defining the same word over and over again.

pak··on Porting to Python 3: An offer for you
The problem is, people have been told for so long not to care about Python 3 that it's hard to imagine what could make people actually start caring about it. Practically the only people that have even tried it are Python fanatics or compiler devs.

I understand the desire to make fundamental language changes and why it's cleaner to make Python 3 backward incompatible. I don't agree that it was the smartest thing to prevent any kind of interoperability, though. The way people could begin using Python 3 is if you could still import Python 2 modules from Python 3 code. OK, there would be some tough nuts to crack to get the interpreter to switch contexts gracefully and translate objects from one side to the other. But at least people could start using Python 3 and then begin switching things over one at a time. To ask everyone to keep running 2to3 to maintain a second codebase that nobody uses is kind of silly and unrealistic, and causes this détente where too few people care enough to make a first move.

Also, gripe here. Why the heck is def method(self, actual_first_arg, ...) still all over the place in Python 3? They had a golden opportunity to kick that bizarre holdover from when Python couldn't do OO [1], and they didn't [2]. The only solid argument Guido has against it is about decorators, and it really only applies to @classmethod and @staticmethod, which arises primarily from the stodgy way Python implements these OO features and which could have been nipped in the bud with their own language changes.

[1] http://beust.com/weblog/2008/10/28/pythons-enigmatic-self/

[2] http://neopythonic.blogspot.com/2008/10/why-explicit-self-ha...

pak··on Imagine a world where Bash supports JSON.
Wow. I was wondering how the hell TickTick.sh "extended" the bash interpreter grammar, because there is no obvious way to do that. The key is on lines 171-189:

    awk -F '``' '{\
    
      # ... jibbery awk-ese ...
    
    }' `caller 1 | cut -d ' ' -f 3` | sed "s/^/S/g;s/$/E/g" | __tick_fun_parse | bash

    exit
So what this is doing, by Jove, is using the "caller" bash builtin + "cut" to print out the filename of the currently executing script, pass that as an argument to awk, and use awk + sed + the "__tick_fun_parse" function to re-parse the script into something that can actually be executed by bash. The "exit" command then exits the current run-through of the script, because otherwise it will reach all the stuff that would normally cause a syntax error.

This is legit hax.

pak··on 17-year-old wins 100k for creating cancer-killing nanoparticle
What he means by "evolution at the cellular level" is that every cell in your body normally performs a delicate dance of differentiation, replication, and death to keep all your organ systems operational--this is why skin and bone heal after injury and your lungs don't outgrow your ribcage. It is somewhat akin to how organisms at the ecosystem level perform a dance of diversification, reproduction, and death in equilibrium with their environs.

Cancer is when certain cells in your body become "greedy" about their own survival without regard to the survival of the organism as a whole, and begin to literally compete with the rest of the cells in your body for resources. Normally there are regulatory switches that tell cells to kill themselves when they become damaged beyond the point of repair, but tumor cells have found a way to bypass these safeguards (either because of chance DNA damage at exactly the right sites, genetic susceptibility to malfunction of the safeguards, viral infection, or some combination of the above). As an example of how tumors compete with your other cells, they usually secrete growth factors to create new blood vessels feeding them at the expense of surrounding tissue.

pak··on When Will We Have Unmanned Commercial Airliners?
That was a fascinating read, although I must play devil's advocate and ask what prevents a ground crew from taking over a commercial airliner remotely in case of distress? None of what this flight crew did necessitated their physical presence onboard, only their decision-making and operation of the existing aircraft controls.
pak··on Facebook security hole allows viewing of private photos
"Move fast and break stuff" is a philosophy that is simply not compatible with "Your privacy is very important to us" (http://www.facebook.com/legal/terms) and "We take safety issues very seriously, especially with children" (http://www.facebook.com/about/privacy/minors).
pak··on I Don't Understand What Anyone Is Saying Anymore
For anybody that needs a quick and humorous guide to all the terrible tropes of Business Guy Language, check out http://unsuck-it.com/browse/ (warning, some bits may be NSFW). An indispensable dictionary for the common man.
pak··on The Future of Ground-Based Transportation Systems
Many cities (in the U.S. at least) have a metropolitan center that is almost completely flat. San Francisco, Pittsburgh, and Seattle are the most obvious exceptions, but as far as I can remember, almost all the other cities toward the top of this list (http://en.wikipedia.org/wiki/List_of_United_States_cities_by...) are really, really flat.
pak··on The Future of Ground-Based Transportation Systems
I think cars are successful for more complicated reasons than that, such as the physical and sociopolitical infrastructure invested in them, and advertising and culture. I can't speak for anywhere but the northeast US, but within every metropolitan center over here, biking would be a better form of transportation for at least half of city dwellers, 90% of the time--provided they all woke up and did it at once, regaining road-space from the taxis and the cars. Imagine New York, Toronto, or Boston with one full lane of every avenue bustling with bikes, the way you do in Amsterdam. There simply aren't enough ice patches and 40mph winds in any of those places to justify the level of car traffic. Also, anybody that currently rides the subway/bus/train or walks is already sweating and does not feel entitled to their own enclosed space.

The road to better health is paved with sweaty armpits. I for one would not mind a little workplace B.O. if it meant for happier, safer commutes and fewer billions spent treating the pandemic of heart disease and diabetes. But that's just me.

pak··on Harvard 1869 entrance exam
I was wondering this myself. I think that they were still tiling little metal blocks, according to this picture: http://www.datadeluge.com/2010/09/how-maths-was-typeset-befo...

Which makes it all the more impressive--each page took considerable craft and attention to detail.

For more information on this, you'd have to get a book like this one--I can't find anything more online: http://www.worldcat.org/title/printing-of-mathematics-aids-f...

pak··on The Future of Ground-Based Transportation Systems
Weather is usually less problematic than you'd think for short rides in most temperate climate cities. It's only raining or snowing hard a small fraction of the time. Even with snow, once the roads are plowed you can bike with caution. Medical issues--I really think more people could bike if they had the courage; there are the elderly and the disabled, but your average 30 year old would do fine on a bike, even if overweight. Never mind the health benefits. I think what holds most people back are the safety issues with cars, particularly in the suburban sprawl where bike lanes are sparse.

~20 min bike commutes shouldn't get you too sweaty unless it's above 85 outside and humid. If it does, lower the pace and catch more of the breeze! For those that need to wear business attire, you'd have to stash your wardrobe at work. But I wouldn't think a shower is a requirement for most, just a bathroom to switch clothes.

pak··on The Future of Ground-Based Transportation Systems
I'd get a cheapo used bike and lock it at the station. Bike racks/poles are everywhere; personally, I think people carrying their Inspector Gadget $2000 foldabikes on the train are overestimating the utility of taking the same bike everywhere. As for getting sweaty, this is just the last mile we're talking about--if you get worked up on a 10 minute bike ride it's time for more exercise!
pak··on Harvard 1869 entrance exam
The thing I noticed (sorry, LaTeX fan here) was how well they could typeset math and Latin all the way back in 1869! I have to say I'm impressed, and it makes me a bit sad that most of my college exams looked worse (typographically) than a paper produced over a century ago. Look at those goddamn gorgeously even margins, the ligatures, the kerning of the italics, and the protrusion of the hyphens.

Hell, this makes the SATs, with its ragged edges and sloppy Times New Roman straight out of MS Word, look like carelessly produced junk.

pak··on Brainfuck in one line of Python
Lots of people can put things on URLs under princeton.edu, or the domains of most universities. In this case, note the ~username in the URL--this is the personal page of a graduate student. Usually universities do not censor pages of their students. I do agree, though, that it would be surprising to see this on a departmental page or anything else owned by a PR team.
pak··on Brainfuck in one line of Python
Any program can be called a "one liner" if you just strip newlines and don't limit the line length.
pak··on Ted Dziuba's take on Hubot
In bash? Good luck. Your main problem is that by creating two FIFO's per plugin daemon in your design, any long-running request in a plugin will hold up other requests to that plugin. Unless you go ahead and implement an async I/O stack or threaded architecture inside each plugin. (Starting to sound more like Node.js...)

He's using chipper sarcasm to illustrate the point that rewriting things "the Unix way" may produce a great troll fork on Github, but more up-front engineering is absolutely justified if you anticipate the need to scale.

To get more to the point, Unix pipelines in shell scripts are nifty but absolutely not designed to scale in the ways that a typical networked server process does.

I happen to agree with him; if the only point of hubot was to be a campfire bot with a plugin architecture, you could probably accomplish that in 5 lines of Ruby that would never see the light of day in a production environment.

pak··on Tens of millions of HP LaserJet printers vulnerable to hacking
Brother already does this. When the printer tells you that toner is empty on a Brother laser printer, you usually have about 15-20% left. However, the printer will refuse to print anything. The solution is (no joke) to put tape over the sensor window on the cartridge, and you can get another 1000 pages or so.

http://www.fixyourownprinter.com/forums/laser/39806

Proud owner of a Brother laser printer here. My guess is that this is how they can afford to sell the printers for so cheap (usually underselling HP).

pak··on iMeme (meme generator for Mac OS X)
Then you probably aren't on Hacker News that often. http://news.ycombinator.com/item?id=3271572
pak··on Proposed NYC park would be underground in old trolley terminal
Nope, but I would doubt that it could produce as much sunlight as if there were no roof.

Even if the system were 100% efficient, if we assume that the rays from the sun are roughly parallel, you'd need as much solar dish area as the square footage of the park to pipe the same amount of light into it.

The closest thing I could find to a product is this [1] and at $8000 for a 4-foot dish, you're looking at a lot of money to harvest enough light to grow trees.

The whole idea reeks of gaga-green engineers/architects that don't understand how hard it is to grow plants; I don't think they're considering how you need to hit the tree from all angles with the light, otherwise parts of it will die. Also, lots of larger plants depend on the tracking motion of the sun to grow normally. Think about the last time you saw an indoor tree that looked like it was growing nicely: it almost certainly had a glass roof over it, because they really need that all that light to survive.

[1] http://pesn.com/2005/07/27/9600139_Fiber_Optics_Bring_Sun_In...

pak··on Proposed NYC park would be underground in old trolley terminal
Oh boy. As a worker in a building that insisted on putting trees and large plants where they don't belong, like 9 stories above ground or wedged into tight covered courtyards, this is plan for disaster. The artificial light-catching equipment just might work on sunny days--I've never seen any in action, and I'm skeptical how well the above ground part can be integrated into a busy street without looking uglier than a cell phone tower--but think of all the energy you waste on artificial light for the other days. Green project, this is not; plants require a lot of light. That's why they grow in the sun, you know, and absolutely never in a subway tunnel. And some will still die, and then you are hauling trees, soil, and landscaping equipment in and out of a constricted space all the time.

This will be a ton more expensive than the High Line, and probably a horticultural nightmare.

Plus, people go to parks to get fresh air and enjoy a view, right? Not to inhale canned fumes in the dark...

pak··on Facebook is gaslighting the web. We can fix it.
You know what's incredibly creepy? 3000 faceless people in Palo Alto know more about your distant friends than you will ever know.

Depending on how much time you spend on the site, they probably also have profiled a sizable portion of your thoughts simply by tracking clicks and pageviews.

pak··on Ebooks, you’re doing it wrong
FWIW, I don't think any publisher that uses an actual printing press uses Word to typeset books, simply because they almost certainly use the whole Adobe toolchain for prepress [1], and InDesign integrates much more nicely with this process. For example, Word has no facilities for color spaces, separation, or generating the actual plate images.

I guess they could generate PDFs from Word files with Acrobat and shoehorn them into the process, but any publisher that is actually satisfied with doing that is bonkers.

[1]: http://en.wikipedia.org/wiki/Prepress

pak··on Ebooks, you’re doing it wrong
Hmm, I had no need for the programming additions in LuaTeX; my main concern was using UTF-8 and having better integration between LaTeX and my system fonts. XeLaTeX offers a great out-of-the-box experience for using commercial, "pro" fonts, particularly on a Mac; check out the 'fontspec' package. However, I've heard the LuaTeX can do microtypography really nicely, and I haven't checked if they've made using system fonts easier, so maybe it's work a second look.

There is a beta 'microtype' package for XeTeX but it doesn't have all the features that LuaTeX has (font expansion?).

pak··on Ebooks, you’re doing it wrong
If they are subcontracting the ebook dev process to a third party, perhaps not. And also, the whole editing to typesetting process is probably a hellish mix of Word and InDesign files, which leaves no "pristine copy" to pick the structured text out of. (Imagine: edits late in the process are made to the typeset InDesign files, after the structure has been lost.) You need structured text for creating an ebook because the ebook software does its own typesetting. So to pick up all the late edits, the only choice might be to OCR the final book and re-apply the structure. Yep, it's sad.
pak··on Ebooks, you’re doing it wrong
I'm with you; I think ebooks should be distributed in some variant of XeLaTeX and rendered using its toolchain. You retain the structure and can change the size of the text, font, etc. as the user desires. It would be leaps and bounds better than the current level of typography you see on the iPad and Kindle.

The only thing I can think of is that normal people, even book-lovers, don't care. We have been trained by reading webpages so much of the time that we have low standards. But the sad thing is, ebooks generally have worse typography than your average blog post read in a typical web browser. I'm looking at you, iBooks. Jesus.

pak··on Strange line of Python
You made a great point, indirectly; a lot of the confusion from the original line of code is the crappy naming of the variables. They should have thrown in sta and stat to really amp up the Scrabble-like atmosphere.

Once you clearly distinguish the purpose of each variable with a well chosen name, as you did in your rewrite, the code suddenly lights up the room. Good variable names are important!

The linebreak to break up the three-way expression also helps to suggest the order of evaluation. For some reason, our brains do not appreciate nested ternary operators on the same line. It's the same problem as

    A==B ? C : D==E ? F : G;
If you are familiar with the left- or right-associativity of the operator, this isn't impossible to read. For instance, if you write C, you already know it's right-associative and therefore executes much like it reads from left to right. If so, it's still nicer to convey that with some line breaks:

    A==B ? C :
    D==E ? F :
           G ;
On the other hand, if you are using a language like PHP where it's left-associative, or you're not 100% positive either way, you will be shooting yourself in the foot trying to do something like that and brilliantly misleading anybody else that reads the code.
pak··on LHC May Have Found Crack in Modern Physics
> arbitrarily pick a class of data that's "at least as extreme" as what was actually seen

You are absolutely correct, in my haste to explain one misinterpretation of p-values, I stumbled into another gross oversimplification. The correct way of saying it must always involve some language about the deviation or extremity of the data being at least as great as observed.

It goes to show that proper reporting of p-value statistics takes a lawyerly craft with language; while writing the post I had to consider what the mathematical interpretation of "is a fluke" should be. I think the definition I chose is what most people will interpret it as. However, the word fluke just means "unlikely chance occurrence" on its own, so saying "there is a 1% chance the result is an unlikely chance occurrence" is uninformative if taken literally. It has to imply one of two things:

1. You are referring to the null hypothesis as the unlikely occurrence, i.e. "There is a 1% chance the null hypothesis is true [therefore making this data surprising]."

2. You are temporarily assuming it is true to make such a statement, i.e. "There is a 1% chance of seeing data at least this surprising [if the null hypothesis were true]."

Someone that does know what a p-value is might be generous and think you meant the latter, which is a correct statement. However, I think that most people hear it the first way.

The fact that p-value reporting (when properly done) involves thinking through double negatives and conditions that are easily ignored probably indicates that it's time for other measures of significance to become better accepted.

pak··on LHC May Have Found Crack in Modern Physics
"...a certainty of three sigma, so there’s about one chance in 100 the result is a fluke."

This is a very incorrect way of summarizing the result.

When will popsci writers ever get this right? Hypothesis testing cannot tell you the probability that a hypothesis is true. It also cannot tell you if the result is a "fluke." What it can tell you is the probability of seeing the data assuming the null hypothesis is true. Without knowledge of the prior probability of the hypothesis, you have no right to say anything about the probability of the result being a "fluke" or not.

This is commonly misunderstood. Perhaps I can illuminate it with an example.

Suppose I take a coin out of your pocket--a good old American quarter. I then proceed to flip it six times and egads, I get six heads. The chance that a fair coin flips the same way six times in a row is 2/(2^6), or 1/32--close to 3%. Whoo hoo, that's more than a two sigma result.

Does that mean there's only a 3% chance the coin is actually fair? NO! If you assume the coin is fair, there is a 3% chance the coin flips the same way six times in a row. There's a huge distinction in flipping the conditional. Going by the infinitesimal number of quarters in circulation that wouldn't flip fairly, we'd say before any experiment that there's an overwhelming chance the coin is truly fair. So there isn't a 3% chance the result "is a fluke," if by "is a fluke" we mean the coin really is fair AND the coin flipped in a surprising way. We KNOW the coin flipped in a surprising way, and if we know that at least 99% of quarters are fair, there's probably a near-100% chance that the data can be called a "fluke."

This is all to say, if the prior probability of your null hypothesis is high, one unlikely result should not impress. You are merely demonstrating that unlikely things happen--and with so many coins and people flipping them they should be, from time to time.

http://en.wikipedia.org/wiki/P-value#Misunderstandings

http://invasiber.org/EGarcia/papers/MatthewsFinancialTimes.h...

tldr; what the article says --> P(Fluke|Data) != P(Data|Fluke) <-- what the statistic means

pak··on 747's are big flying Unix hosts
And Ticonderoga-class warships...

http://en.wikipedia.org/wiki/USS_Yorktown_(CG-48)

pak··on Stanford computer diagnoses breast cancer more accurately than human doctor
So in answer to your question, we already have the physical and legal infrastructure to support general-purpose automated cars, and we have the technological capacity.

That is such a stretch from the four sentences before it. You are discussing 1) a prototype vehicle that is not available to consumers and requires supervision by a cadre of engineers and 2) a recent law in just one of the least populous states of the country. How about a few choice details from that article you cited:

"... with only occasional human intervention."

"Before sending the self-driving car on a road test, Google engineers [have to] drive along the route one or more times to gather data about the environment."

"...there are many challenges ahead, including improving the reliability of the cars and addressing daunting legal and liability issues."

You must have read it with unrestrained optimism. I also applaud your idealistic notion that statistics matter more than public opinion, but the country isn't run by scientists and mathematicians (that's actually a good thing in certain respects). The reality is the general public does have to support changes that affect society, like laws and the development of physical and legal infrastructure, and there are many ways of formulating reasonable policy arguments with or without statistics.

← PreviousPage 9 of 26Next →