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 How do magnets work?
I would refine your explanation a bit--you were 90% there but you got the direction of the magnetic force wrong, and the way I learned it involved special relativity. So when you are sitting on an electron in one wire and you see the protons zipping backwards in the other wire and the electrons twice as fast as that, the phenomenon of "length contraction" (http://en.wikipedia.org/wiki/Length_contraction) occurs because all these particles are moving close to the speed of light. Since from your reference frame the electrons are moving faster than the protons, they are length contracted to a greater degree, so they appear to have a higher charge density than the protons. Therefore the repulsive electric force between your electron and the charge density of the electrons is greater than the attractive force between your electron and the charge density of the protons, so your electron is repelled (and we observe this as the magnetic force).

Laughable ASCII diagram (just note that within each wire, the opposite charges are intermingled, not separated like shown):

          Lab reference frame     Reference frame of e- on wire 1           
                                               V
              - - - - - - - ==>          -  -  -  -  - 
  wire 1      +  +  +  +  +          <== + + + + + + +

          <== - - - - - - -        <==== -------------
  wire 2      +  +  +  +  +          <== + + + + + + +

                                  charge density of e-'s in other 
                                  wire is greater than that of p+'s
So, two wires with current in opposite directions repel each other, not attract. You can do the above exercise with the currents in the same direction to see that relativity would then postulate that the protons in the other wire have greater apparent charge density than the electrons, causing a net attractive electric force observed as magnetism.
pak··on The best of $user on HN, with eBook export
I commend you for using <map> to link the markers to the items. Image maps... wow that takes me back to 1999. I can't believe people still remember how to use them. Of course you can't do any rollover effects with them, but otherwise it seems like a pretty quick and effective solution for the interface you wanted to make. When I first saw this I thought the Google Chart API had maybe changed to add JavaScript-based interactions.
pak··on Redditor Explains Why Apple Continue Making Frail Power Cables
How do you explain the same split occuring on the Magsafe connectors? Those are designed to pop right out if you yank them by the cord, so very little strain is going to be put on the wire sleeve. I've seen a lot of Magsafes split in the exact way depicted in the picture.
pak··on Let's make the web faster: PHP performance tips by Google
This. There is no excuse not to teach PDO from the getgo to newcomers, and I've seen some pretty neat little ORMs built on top of it.
pak··on Let's make the web faster: PHP performance tips by Google
The problem, like with all bad code examples, is that people copy and paste it without thinking and don't look back if it runs, so here we are in 2011 with SQLi holes in literally every other website.

Either write a complete, secure example or don't write an example at all. Like a colleague of mine said, putting incomplete code samples on the Internet is like handing out loaded Glocks to children; expect feet and heads to be blown off. I wouldn't even write a toy example with mysql_query anymore because the number of footnotes required (that people would ignore) would fill a page.

pak··on Tennessee Makes it Illegal To Share Your Netflix Password
This is unfortunately the rule, not the exception. If you ever have checked out any of these laws that go before a US legislature they are generally hundreds of pages long and a very dry read. Even the legislator that is sponsoring the bill likely has not read the whole thing in detail, but only the summary prepared by his team of aides, and has relied on many other people to write up his drafted law. Probably the only people that read and can understand these new laws in full are prosecutors and other lawyers.
pak··on Stopping Screenlock Smudge Attacks On Android
I don't understand the point of your post. You do a great job of calculating the strength of the Android pattern lock screen and then explain why that's totally irrelevant because of the 20 invalid entries hardlock. You could have just put that first, and saved yourself the tldr, but then you mention a few improbable hypotheticals for no discernable reason. Am I missing something?
pak··on Newegg stores your password in plaintext
People with direct experience with the elements of the OP (Newegg's security or lack thereof) voicing their fully-informed opinions. Maybe a Newegg CSR or security admin. Everybody else is just piling bullshit on top of more bullshit, because we really don't know anything beyond the alleged experience of one customer with a blag.

It was said better in another recent comment thread (I forget where): HN comments these days are full of people trying to sound like experts when they have no idea what they are talking about. I post about twice per day, max, and I think that's already more than I deserve to be able to say. Maybe that's what could be enforced here, so that people would really think hard before wasting a comment on hypothetical asides or repeating the same thing ten other people said.

pak··on Doctors and dentists tell patients, "all your review are belong to us"
"Most doctors don't give a damn" if someone dies?

Perhaps you had a bad experience with a physician, but please don't generalize that to the entire profession. That's a ridiculous, inflammatory starting position.

pak··on Top Colleges, Largely for the Elite
Isn't plutocracy even farther in the wrong direction? His point is that colleges are trying to reward the poor, not the wealthy, but are failing to do so. Maybe "ptochocracy" or "egalitarianism"?
pak··on Newegg stores your password in plaintext
This comment stream is a great example of HN going downhill. It's literally ten threads of the same half-informed claims with half-informed stock counterarguments.

We have the: completely unverifiable reversible encryption defense, followed by the complaint that reversible is just as bad, followed by every manner of hypothetical baloney. Then we have the dismissive password generator users, followed by the complaint that this is an irrelevant solution. And of course the smattering of people wanting to publicly shame sites that store in plaintext, like more than 0.01% of the Internet will ever care.

tldr, you no longer have to read these comments, screw the karma this will cost me.

pak··on Newegg stores your password in plaintext
Um, what. I most certainly have checked out of Newegg without re-entering my card number. Even if they store the numbers off premises for PCI certification reasons, if a Newegg password lets someone log in and buy a hundred flat screens on my account, that sounds like financial harm to me.
pak··on Is graphene a miracle material?
I think GP might be thinking of a third major concern of motorcycle gear, which is abrasion resistance so that when you are sliding, the asphalt doesn't sandpaper your flesh to the bone (road rash). Pedestrian jeans/jackets disappear in less than 0.5 seconds when you are sliding on asphalt after a 60mph crash; most crashes at that speed have you tumbling on the ground for a good 6 seconds. That means unless you are wearing good gear, your skin is likely to be scraped off to the bone. I don't know much about graphene, but it might be a good material for abrasion resistance, if it is suited for withstanding tearing, cuts, and shear forces like the elephant-on-pencil example in the article claims.
pak··on Webkit Hardware acceleration bleeding into subsequent elements. How to fix it
Fonts in Ubuntu can be absolutely unpredictable when it comes rendering time. I remember an install of msttcore-fonts that I thought would allow me to see sites built with Verdana, Tahoma, etc. similarly to Chrome on a windows box. Not even close, and I'm talking about the kerning, not even the subpixel quality.

IIRC as sibsib said windows takes major liberties with the kerning to keep its core fonts on the pixel grid, and if msttcore-fonts are hinted, they sure don't come out at all similar to the windows versions.

pak··on JQuery 1.6.1 released...
Yes, this was the correct move. jQuery is for thinking less and doing more; the prop/attr distinction is both a painful code change and a needless complication for the sort of purposes that jQuery is used for.
pak··on JQuery 1.6 released
Question: When would you ever want the .attr("value")=="initial" in real code? How often is it that you want the original value encoded in the HTML as opposed to the current value of the element as entered by the user?

This is part of why I think .prop vs .attr is a regression. It makes me think twice before I use either--even if this is closer to how the DOM actually behaves, the point of jQuery used to be that it could hide those inane details from me.

pak··on JQuery 1.6 released
This should be linked to or listed directly in the OP.

Really, most people reading the changelog care about "how do I make my existing code work with this"--and the details listed are conceptual, but not all practically relevant.

pak··on Osama bin Laden Is Dead
Yep, that's exactly how obit departments at major media outlets operate.

http://en.wikipedia.org/wiki/Obituary#Media

pak··on Forking with the Edit Button
Yes, I did see that, and it wasn't clear to me whether that will be an intuitive step to non-git users or not. I haven't used the feature yet.
pak··on Your personal corkboard
What's with having to drag to pan? Is there some reason you decided to not use native scrolling?
pak··on Forking with the Edit Button
Github is really doing an excellent job of presenting the power of git via a web interface. So now they've condensed the process of fork, change, recommit (and possibly pull request?) to one Edit button. Imagine a new workflow for wikis, where github's patchset approval and merge process is used to allow other people to fix a page in a controlled manner, and you don't need git to do this--just a github account and a web browser.
pak··on Interview with a cracker
Because you wouldn't expect one to?
pak··on Gawker's Traffic Numbers Are Worse Than Anyone Anticipated
What's broken traffic for me to the Gawker-hosted Kotaku is that Steam doesn't correctly redirect links from its feed of game-related articles to the hashbang targets, so I wind up at the Gawker homepage and wonder WTF is going on.

That was probably the only reason I ever visited Kotaku, and now I know better than to even try clicking.

pak··on Is Sugar Toxic?
I'm not sure if you're being sarcastic and pointing out that anything is "toxic" in high quantities. In case you aren't, or for people that did not catch it, 29g/kg is about 2.4kg of sugar for the average 80kg male, which comes out to about 12.5 cups or 3 liters. It should be obvious to most people that filling a two-liter bottle with pure granulated sugar and consuming it in one sitting would have severe health consequences (if you can even manage to get it all down).

What's probably toxic about it at this dosage is that it cannot be eliminated by your kidneys or stored in your liver quickly enough, so it accumulates in the blood and shifts the osmolality causing neurological symptoms, osmotic diuresis and cardiac arrhythmia.

pak··on "Diff for HN": Update and highlight changes
Want to package this up into a Chrome extension (maybe as a userscript)? Then people could run it without clicking on a bookmarklet.
pak··on Google indexes Stack Overflow at a rate of 10 requests per second
There are services in Webmaster Tools for pushing sitemaps, no? Which would not be quite sufficient for this--Google still has to scrape the respective pages in the sitemap--but it's about as close as you are going to get.
pak··on Flowdock releases mobile UX implemented with jQuery Mobile
I want this to hit the main branch before it goes beta:

http://jquerymobile.com/test/experiments/scrollview/

Without it, you can't have static header and footer bars (the fading ones currently implemented by the framework are crap compared to Sencha and GMail's nice navbars).

I noticed that Khan Academy's mobile app (http://khanapp.com) uses the exerimental ScrollView component with jQuery Mobile. I'm currently trying to get it working myself, with somewhat mixed results (expect to do quite a bit of hackery).

pak··on How html5-boilerplate helped drastically improving our website performance
You do not measure "website performance" without doing many repeated (better yet, interleaved) trials! These statistics are meaningless without standard deviations (at the very least). I could perform two one-off trials and conclude that unplugging my keyboard improves the "performance" of your website by X% because there happened to be a fluctuation in network conditions.
pak··on "Aristo" for jQuery UI
I believe this is an issue with jQuery UI, not this theme in particular. I remember that to get QuickFuse working on the iPad, we made a shim that wrapped the jQuery UI draggable so that it responded to touchstart, touchmove etc. events. jQuery Mobile is more suitable for these widgets if you are making a mobile-optimized app, though.
pak··on "Aristo" for jQuery UI
Solid, goes to show the power of the jQuery UI theming framework. This uses even less images and more CSS3 than the last CSS3 implementation of Aristo, which wasn't built for jQuery UI:

http://dtrejo.github.com/aristo/

Specifically, this one uses inner shadows to generate things like the slider bars without background-image, and most everything else is CSS3 gradients.

The blog post calls jQuery UI's default themes goofy--I won't contest they look dated, but you can get from there to near-Aristo quality by 1) decreasing the border-radius in ThemeRoller to 3px or 2px 2) only using handsome gradient backgrounds and 3) adding some more CSS rules to just add some inner glow, box-shadow and text-shadow on the better browsers. In fact, ThemeRoller could be fairly easily updated to support such things from within the graphical designer.

For example, this app editor interface is pretty much all vanilla jQuery UI, with only the slightest of enhancements in a separate file so themes could potentially be swapped out underneath:

http://quickfuseapps.com/app/edit

← PreviousPage 14 of 26Next →