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 Unicorn
Could they have possibly picked a more confusing name?

1. Unicorn for Ruby: http://unicorn.bogomips.org/

2. Green Unicorn for Python: http://gunicorn.org/

The fact that this is an HTTP request library, as opposed to a server, is what pushes this into serious troll territory. The only saving grace here is that Java programmers searching for this library might come upon one of the other two and realize what they are missing.

Edit: A Ruby and a Python library, named unicorn-rest and unicorn respectively, are built into this project. This is madness.

pak··on Ruby is too slow for programming competitions
FFI is also dead simple in Ruby.

https://github.com/ffi/ffi

It's pretty much `gem install ffi` and off you go. I've used a Ruby gem [1] that talks to a hashtable storage library via FFI and found it perfectly stable.

[1] https://github.com/jmettraux/rufus-tokyo

pak··on Ruby is too slow for programming competitions
> it is very reasonable to code that part in some fast language while delegating the bigger (and often more complex) part in a higher level language such as Ruby.

Agreed. Contrary to what lbrandy said, I've tried it, and it works very well. Writing Ruby extensions in C, or wrapping C libraries for Ruby, is really easy. Wrapping a PNG library for Ruby allowed us to draw about a trillion pixels' worth of images based on the human genome across a modest cluster of ~100 cores in a few days [1,2,3]. For reference, a terapixel image is about ~4TB of uncompressed data and ~800GB compressed, with Microsoft putting up comparable numbers for a project they ran on a fancier HPC cluster in 2010 [4]. We were heavily compressing it into PNG tiles on the fly so ours came down to ~60GB.

Regarding pointers to pointers to ints--if you keep all the data within the heap of the Ruby extension, as we did with the wrapped PNG library, then it can be stored in whatever simple data structure you want.

[1] http://chromozoom.org/?db=hg19

[2] https://github.com/rothlab/chromozoom

[3] http://bioinformatics.oxfordjournals.org/content/29/3/384.fu...

[4] http://research.microsoft.com/en-us/projects/terapixel/

pak··on Status Board
That does look pretty and awesome for business data, but do you know of anything similar that is more plugged into personal and social data sources like the OP? I wouldn't be so eager to e.g. recode a weather API that pushes specifically to Telemetry's service when there are already zillions of weather widgets and APIs out there.
pak··on Status Board
Is there any app like this already out for desktop Macs? I have an old iMac that I would love to repurpose for a status board.

I was considering throwing together a one-off webpage with a bunch of favorite sites in frames that refresh, but that wouldn't be nearly as nice to look at as an app like this with prebuilt widgets that are designed to be laid out in a fullscreen grid.

I wanted to just use Dashboard, but it is really slow (widgets seem to freeze for minutes at a time, and Web Clips randomly fail to work for no apparent reason).

pak··on Show HN: HN Store
One quick plug: the Hacker News Sidebar under Chrome WebStore hasn't been updated since 2011 and doesn't work any more. My fork of it is more up to date:

https://chrome.google.com/webstore/detail/hacker-news-sideba...

It's useful if you want to know that there's a comment thread for any given website that you are browsing.

pak··on Comcast injecting JS
> * This URL is relative, which means it will never actually reach its intended target (instead filling your web logs with this request)

It likely doesn't matter that the URL is relative. It contains a GUID to be unlikely to resemble any real URL, and it's clear enough that they are capable of deep-packet-inspecting all of your web traffic from the way this is already used, so they likely hijack any request to this URL path within their network to capture its contents, and return a 200.

I don't have Comcast so I can't verify, but it would be interesting for somebody to check whether that URL is masked for all Comcast users.

> That's right, this code causes every page served on your system to pop an AJAX request to the wrong URL every 5 seconds, as long as the tabs are open.

I can only hope that they infinitely hang requests to their special URL in the case that user is under the quota so that this is not true. But if it is true, and they are not perfect about masking the URL (edit: it seems like people below on this thread have seen requests to this URL in their server logs), this could be construed as a DDOS attack by Comcast on every owner of an HTTP server via their own customers.

pak··on Long-term research: Slow science
I normally expect the Next and Previous buttons on sites like Cracked.com that want me to generate more ad revenue with more page loads, but why five clicks for a simple article with no ads, Nature? Why can't you let me just scroll through your content, particularly when this equates to a blog post (and a Top N formatted post, to boot)?
pak··on Show HN: Hacker News Sidebar - an extension for Google Chrome
It's easy enough to sort by create_ts; updated again! The most recent thread for google.com is still pretty old. I'm kind of surprised that these multiple threads don't get automerged when the second and following people try to resubmit.
pak··on The dire state of WordPress
The author states the problem himself: Wordpress is a blogging platform that people are trying to turn into a full blown CMS.

Stop trying to do that. If you want a "real" CMS with serious content types and a more thought-out plugin system, go use Drupal (if you have to use PHP and not much time to code). If you have more bones for coding, start with Symfony like your colleagues, or Django, or RoR.

If you have even the faintest inkling that a site will mutate from a blog to something more serious, don't start with Wordpress. If your fundamental data types from day one until infinity are not pages or posts, do not start with Wordpress. You cannot make it into something it's not, even though it's getting so popular that enough people will be tempted to do so.

The reason Wordpress is still so popular is that blogging and basic website creation are still getting more popular, and Wordpress is still a great way to accomplish either of those things since it will be used exactly as intended. I don't anticipate these common needs will shift too much in the near future, and the LAMP stack is just too stable and well-supported to go anywhere, so Wordpress is gonna be around for a long time.

> It is like trying to teach a language that doesn’t have an alphabet

Chinese doesn't have an alphabet. It's used by many people and it's possible to teach to those who use alphabetic languages.

That doesn't mean everybody should learn it, or that it's a model for how a de novo language should be designed today. Use it for what it's good for: talking with Chinese people.

In general, I'd just be more careful with cultural analogies like that.

pak··on Show HN: Hacker News Sidebar - an extension for Google Chrome
I'd love to do this, but it would be particularly hacky because I need to access HN via XHR--I can't just frame it because HN sends the X-Frame-Options: DENY header (see the bottom of the blog post for details). However, I might be able to fix that by modifying HTTP headers in the extension. For now, I don't mind actually doing all my commenting/replying in a new tab, I initially meant the sidebar to be for quick scanning of what's already there.
pak··on Show HN: Hacker News Sidebar - an extension for Google Chrome
Looks like it doesn't detect that page because it got submitted without the trailing slash, and the page forcefully redirects to the slashed URL. However, that's easy to correct for, and I've updated the extension to check for both versions of such a URL. Thanks for trying it out and finding this bug! If you're still using the extension, it should auto-update soon.

Re: the little side tab could tell me implicitly that someone else submitted a story I stumble upon

That's exactly what the extension should do; if any webpage you are looking at has ever been submitted to HN, the orange tab will pop out.

pak··on Port scanning /0 using insecure embedded devices
Isn't this exactly what rtm did in 1988? The only difference is that this worm took pains to behave more nicely.

Funny to see that the proportion of relatively unsecure devices on the internet has not gone down since that time.

pak··on Google Drive Realtime API
Assuming I trust Google with all the data and all my users have Google Drive, this looks like a super easy way to make documents created in a web app editable in real time by multiple users.

I'm curious about the details though, which would be ironed out with some more detailed playground examples. Does the API handle merging of the update events on the client side, or do I have to do all that work myself from the stream of insert/removal events? Can I handle them myself if I want? Assuming I want to extend the UI of these updatable strings, so that people can see other people's cursors and such, what would I need to do? Is the client-side library extendable so it can update my UI without hammering my customizations (cursor position, formatting, embedded data transformed into HTML)? How will that scale once the document grows to a considerable size (will I be able to update only changed portions of the DOM created by a large document without doing my own complex diffing logic on the client side)?

For example, build me a basic rich text editor in this that mimicks some of the features of Docs, and show me how much extra code that takes. This code sample by itself doesn't make me confident that the above features would be simple: https://github.com/googledrive/realtime-playground/blob/mast...

It's precisely those richer features of the Google Docs experience that people crave when they say they want to add "realtime collaboration" to an app, not just .val()'ing form fields to the latest known value from the server. Right now this looks like it has the features of a backbone.js + Couch adapter (e.g., http://janmonschke.com/projects/backbone-couchdb.html) except Google sits on all my data.

pak··on Show HN: Tiled Text – a Different Approach to Editing Text
Could doctors use a gestural interface like this to write templated notes in an EMR on touch devices? Most of the notes that doctors write have repetitive structures. Hence, EMRs like Epic have come up with features like Smart Text, which expand special phrases into large templated sentences with certain bits of data prepopulated and keywords that can be toggled between values (present/absent, etc.) with the keyboard.

But the key complaint with these EMRs is that you need to type to use them, which is awkward and breaks the flow of conversation with a patient. Eye contact is important during patient interviews. Therefore, most doctors use paper and type them into the EMR later (waste of time).

A lot of people (and companies like drchrono) think that the way forward is to use tablets like the iPad mini or the Galaxy Tab, which balance the intrusiveness of the computer form factor against the ability to enter data. A pain point of tablet EMRs is text entry--but like I said, a lot of notes that doctors write have predefined structures, like code.

I think there is potentially a lot of money in elegantly solving this UI problem with a new interface like Tiled Text.

pak··on All science is anthropological at the margins
Thanks for reading! And the essay you wrote on this topic is equally interesting.

I get what you are saying, and you are right that what I am proposing is innately unscientific. What I am trying to say is that the process of making new science often has to have these flaws, because ideas in the real world are rarely evaluated on their merits alone. Ideas come from people who are fallible and have to fit their ideas into a social context. What you hold to be the ideal:

    Scientific findings must be able to rise above their origins and stand alone
is the same as what I hold to be ideal, and I also mentioned it's what my dad admires about science. But the reality is more complicated: when a fresh result comes out of a lab, people judge it by the affiliations of the authors, what journal it came from, and that person's prior ideas and assumptions, because replicating or depending on the truth of that result could be a costly mistake (millions of dollars, years of work). The sparsity of biological research in particular means that there are sometimes only a few labs in the world that can readily run experiments with any relevance to a given topic, so until enough attention is given for it to be replicated, a single result and corresponding "story" pretty much stands solely on the reputation of the authors.

So while it is absolutely correct that a scientific principle should stand on its own, and those principles are the ones we learn in the college intro courses, until a hypothesis gathers enough supporting data to become a principle (let's say it is only a few years old), the process of science at the margins is inherently social.

I didn't even get into matters of ethics and politics. For example, there are important medical principles today that were gathered through highly unethical (and regrettable) research in the early 20th century; if similar experiments were performed today, the experimenters would be vilified and the results discarded out of principle, even if it was robustly scientific with a significant impact.

pak··on TOML, Tom's Own Markup Language
Don't have time to work on it now, but it looks like you'll need to recurse while parsing arrays. Right now, only arrays of strings that don't contain commas are handled correctly.
pak··on Host webpages on Google Drive
Who types URLs or looks at them? If you write URLs in an email, print them on a business card, put them on a poster, say them in a conversation, or basically need anybody who isn't already using a web browser to go to your page, you type URLs and look at them (or hear them). Hearing is the worst offender.

- Hey there, you should check out this really cool site/post/app/thing!

- That sounds nice, where should I go?

- You go to uh.. googledrive dot com slash host slash zero capital B ehh... forget it.

There is a reason that facebook gave their users vanity URLs, and twitter user URLs are so minimalist, and people pay millions for domain names. A shorter URL is more useful and hence more valuable.

Having the option to point your own domain at the folder would be really nice, actually, and put this on the same tier as Github Pages and S3.

pak··on Dbv.php: Database version control
then... it won't work? Alternatively, you could make it group writable by yourself and whatever the webserver is running as. Or, if you are using suPHP (http://www.suphp.org/Home.html), you won't need to chmod anything.
pak··on How To Package Your Python Code
The fact that there is no good, canonical guide for doing this in Python is one of the reasons I moved away from it and toward Ruby. With Ruby I had no problems writing and forking gems using the canonical guide (http://guides.rubygems.org/make-your-own-gem/). With Python, navigating the hell that is packaging is just demoralizing when it comes time to give end users a complicated chunk of code. (Setuptools is truly "a hack on a top of a bad design", not my own words.) I hope for Python's own sake that distribute (http://packages.python.org/distribute/) catches on and people are simply shamed out of using older tools, but since Python already has a problem with getting everyone to migrate code away from old things, I'm not holding my breath.

I'm still not sure how to do certain things "right", e.g., distribute a modified version of somebody else's package with my own package. In Ruby, I can do this with bundler specifying a git repo for my own fork of the gem (and then submit a pull request for the original fork, if it's a patch that's useful upstream).

pak··on Slowloris: high-performance HTML5 UIs
ChromoZoom (http://chromozoom.org) uses web workers to offload custom track drawing to a background thread. If all the data processing were done on the main thread, the UI would stall. However, unlike this library, I don't rely on passing all the JS to an eval() on the worker thread; I have the worker and the main thread load the same code, and refer to the methods by name. This makes it easier and more organized, IMO, when dropping back to non-web-worker operation.

https://github.com/rothlab/chromozoom/blob/master/js/CustomT...

and the top 135 lines of

https://github.com/rothlab/chromozoom/blob/master/js/CustomT...

show how we do it.

pak··on The Prisoner's Dilemma: a summary, and new advances
He also has to be willing to trust that you will actually split what you win after stealing the whole pot. Otherwise, he will worry that you could dupe him and walk away with everything, and then choose to steal.
pak··on HTML 5 gets forked up
relative to the length of each user's arm

It's easy to snidely dismiss that idea, but seriously, how would you define a unit of length in an environment that is supposed to translate between multiple devices and media types? A "pixel" makes little sense when drawing on a sheet of paper or a super-high DPI screen where pixels aren't individually visible. It can't be a fixed real-world distance, because pixels would sensibly be larger at movie-screen distance than at arms' length. They basically defined it in terms of the arc-length of the picture upon your eye, which is completely reasonable to me.

pak··on All Rockstars Went to Julliard
Harvard has substantially revamped its financial aid in recent years. Families with income below $60k pay no tuition. Even going as high as $150k-$180k, the expected family contribution is lowered to about 10% of income.
pak··on Why Our Elites Stink
http://en.wikipedia.org/wiki/Jewish_quota

http://en.wikipedia.org/wiki/Numerus_clausus#Numerus_clausus...

President Lowell of Harvard tried to impose a 12% quota on Jewish admits in the early 20th century, and also attempted to exclude African American students from residing in the freshman dorms. You can find similar behavior at other universities until well after WWII ended. For example, Georgetown's first black student enrolled in 1950.

pak··on Medical devices: A ticking time-bomb
"the average error was a staggering 24 minutes"-- The average is a terrible measure of centrality for data that is unbounded at one end, because one outlier (the 42 year off clock) skews the measure disproportionately; the median would be much more appropriate to report. That's unusually sensationalist number crunching for The Economist.

I'll bet that out of the clocks that doctors actually use to decide on treatment (tallying every device is a bit unfair; if a blood pressure monitor on some cart in a closet has the wrong time of day who cares) 80% of them are within a few minutes of the right time. And at the end of the day, doctors are supposed to be able to reconcile conflicting information, it's part of their training. This is a little bit like tallying up every textbook lying around a high school and getting concerned that the average book is three editions out of date and has 142.8 errors--calm down, most of those are not in active use and have some faith in teachers to check their material.

pak··on Google's HTML5 synthesizer for Moog's 78th birthday
Nitpick--Audiotool is pretty much 100% Flash, except it also seems to load a Java applet to gain MIDI access. It would be mindblowing if it were HTML5. The UI alone (especially all the little details like the correct shadows on the knobs and the wire layout, and the zoomability) would be an incredible accomplishment to draw with HTML and <canvas>. As for the synthesis, I think Audiotool predates the Web Audio API.
pak··on Say hello to Octicons
Agreed, color is the most immediately recognizable thing about an object and this is just as bad as when Lion washed out the folder colors. It looks more minimalist/modern but is less usable. Even low-saturation colors would be nice. You could do this with font icons just by printing them in slightly different colors (like a terminal, sigh).

Edit: I could be nuts, but they are printing in slightly different colors now, whereas just an hour ago they were all gray. Somebody at github just made my day.

pak··on Say hello to Octicons
I appreciate that these will scale better than images, but I never grokked the icons in the top right corner. To me, a repository isn't much like a "book", and I still remember hunting for the "log out" link in frustration before realizing it was the door with an arrow. Since you've pretty much pegged the header at ~900px wide, I still think text links would be more usable and you have the horizontal room for it.

That being said, since it seems like you're incorporating these metaphors into other parts of the site--like I notice the book icon by the repo name now--maybe the metaphors will eventually stick. But in the meanwhile it has been a little confusing.

pak··on A High Frequency Trader's Apologia, Part 1
Why not use a random order for order fulfillment at each tick? No skewed incentives with that rule.

If that creates too many concerns over security of the RNG, then use deterministic rotating ranks. Traders may be able to predict who they will be able to beat out on the next tick, but the high ranks rotate throughout the herd, so everybody gets a fair shot at beating out others at the same price.

← PreviousPage 6 of 26Next →