HNHacker News
TopNewBestAskShowJobs

pmahoney

632 karma · joined December 22, 2011

submissionscomments
pmahoney··on Ruby deploys temporarily disabled
> source of all dependencies possible should be in your repository

How far do you go? Do you include libxml for building nokogiri? Heck, do you include libc and gcc for building any gem with a C extension?

Coming from Java, Maven and something like Nexus Sonatype make it easy (for certain values of "easy") to run a proxy repository. The equivalent of all "gem install <some_gem>" goes through the proxy, which continues to serve gems even if the original source goes away.

I don't particularly like the inclusion of dependencies in a repository. Is this a custom version "some guy" long gone from the company created three years ago? Can I safely upgrade it to get security fix <X>? I suppose similar questions arise no matter the source...

This is reason why you cryptographically sign your gems before publishing them. I (unfortunately) had not known this was supported by RubyGems, but it is: http://docs.rubygems.org/read/chapter/21

But I'll bet very few gems are signed. Rails does not appear to be:

  $ gem install rails -P HighSecurity
  ERROR:  While executing gem ... (Gem::Exception)
    Unsigned gem
pmahoney··on Github Ruby Styleguide
Regarding "def self.method" vs. "class << self; def method; end", one very big advantage of using the "class << self" technique (which Github discourages) is that it allows grepping for "def method" to find the location of the method definition.

Perhaps my editor is old and featureless (and Ruby's dynamic nature doesn't help), but I grep for such things multiple times per day.

pmahoney··on Astronomers puzzled over huge black hole in the middle of small galaxy
My (poor) understanding is that the "size" of a black hole refers to the size of its event horizon, which is directly related to its mass (more mass -> larger event horizon). That mass is still compacted at the center in a single point of zero (?) size.
pmahoney··on US patent chief to software patent critics: "Give it a rest already"
We got his attention.

Now I'll write two letters per week.

pmahoney··on Show HN: StatMilk - Football Stats Visualized
Football, a sport played on foot.
pmahoney··on A Dragnet for Pee-Wee
I don't know how it is in "nicer" climates, but where I am, my commuter bike has gradually accumulated various things:

- taillight which I don't bother to remove

- expensive headlight which I do remove when parked (but I leave the mounting bracket)

- pedal straps (a must, in my opinion, for safe riding in traffic; feet slipping off pedals can mean a crash)

- thorn resistant tires

- stronger wheel (I'm above-average height and not fat, but the cheapo wheels kept getting bent)

- fenders to reduce splashing in the rain

- rack to hold saddle bag

The bike itself is rather old and worth less than $100. All the accessories add up to maybe another $400. So, I do have a cheap bike, but it's still not so cheap to replace, and doing so is a rather big time commitment.

pmahoney··on Nori Lights - Bicycle Illumination System
This is really cool, and doesn't require car headlights shining on your bike like reflectors do.

When driving in my car at night, I would occasionally notice some bicycles with reflective strip around the tires. Car headlights just light them up, making it very easy to see a bike from the side. I finally found that many Schwalbe tires have this reflective strip (e.g. http://www.peterwhitecycles.com/schwalbe.asp third paragraph).

I saw a bike the other night with a half-dozen or more of those in-spoke reflectors. Very visible in headlights.

pmahoney··on Simple Helper to Extract Values from a String
Ruby (borrowed from Perl and common in many regex impls I believe) has the "x" modifier to ignore whitespace and comments in literal regexes, for example:

    str = "2012-10-04T07:20:00"

    str =~ /
        (\d{4}) # four digit year
        -
        (\d{2}) # two digit month
        -
        (\d{2}) # two digit day
        T
        (\d{2}) # two digit hour
        :
        (\d{2}) # two digit min
        :
        (\d{2}) # two digit sec
       /x
pmahoney··on To Encourage Biking, Cities Lose the Helmets
You comment and m0nty's about Specialized brand helmets meeting a stricter standard prompted me to do a little helmet research. I was a bit skeptical of the slim Bern helmets. I think simple physics demands that to stop a moving head on impact slowly enough to avoid concussion, one must use a (dorky?) a "spaceship on your head" helmet. There's no getting around that to go from velocity v to 0 without accelerating more than some threshold time requires a certain amount of space.

Now, I don't know if the thresholds chosen by ANSI or Snell or whomever will make a real difference in a crash, but Consumer Reports rated Bern helmets poorly in "impact absorption".

http://bikeportland.org/2012/05/31/nutcase-bern-helmets-rece...

pmahoney··on This white powder will kill me one day
I know that ad. I always angrily yell at the TV, "yes they're the same: equally bad!"
pmahoney··on This white powder will kill me one day
> high-fructose corn syrup (much worse than sugar)

This is controversial at best (see, for example, http://www.sciencebasedmedicine.org/index.php/the-sweetener-...). I know there's money behind corn/HFCS, but what is your source for this claim?

pmahoney··on Did Blowing Into The NES Cartridge Really Work?
The Game Genie is a mini cartridge that attaches to a game cart (to apply cheats/mods through a code-entry screen). This combo is then inserted into the NES, Game Genie-first. The combo is too long to be pushed down, and the NES door remains open while playing.

I never understood why you don't need to push "down" the Game Genie; a bare cart would never function unless pushed down...

Nevertheless, every game I had that would not work in the NES would work just fine with the Game Genie attached (and you can always choose to enter zero cheat codes). The Game Genie seemed to make everything a bit tighter. When inserted into the NES, there isn't much wiggle room, if I recall.

edit: Wikipedia says, "Therefore, the Game Genie was designed in such a way that it did not need to be depressed in order to start the game. This design put even more stress on the ZIF socket than standard game insertion, bending pins and eventually causing units to be unplayable without the Game Genie present." https://en.wikipedia.org/wiki/Game_Genie

pmahoney··on Everything that's wrong with Java in a single class
I actually really like Java logging (well, I like SLF4J and logback).

On Ruby, I'm constantly at a loss on how to do logging. Sure, in Rails there's the Rails logger available pretty much everywhere. But if I'm writing a reusable library, I can't count on that. So what do I do? Demand every user of my library configure it with a logger?

The stdlib Ruby logger also has no way to fine-tune log levels by class. In a Rails app, sometimes I want debug level, but I rarely care to see each and every SQL statement. (There tend to be hacks to monkey patch around the common cases suggesting others have been similarly frustrated.) Even if I use log4r or some other logger with more fine-grained tuning, within Rails, everything will be using the same logger object, so the typical Java method of tuning by giving each class its own logger doesn't work.

Bleh. Give me SLF4J with logback any day. When writing a reusable Java library, I really have no qualms about using SLF4J.

pmahoney··on Valve's solution for Steam Greenlight's noise: A $100 donation to Child's Play
I am a working professional with a beyond-minimum-wage salary, and my wife is a full-time student. Money is tight. I can imagine many scenarios where someone has the know-how, equipment, and time to make a game but with various expenses (education, medical, debt, etc.) that make $100 sound like a big dent in the monthly budget.
pmahoney··on The humans who outrun horses
Interesting. I have a terrier (~15 lbs). He keeps up with me for 45 minutes and seems barely tired. But if the temperature is above 75 degrees F or so, I can easily run farther and faster than he can. Right from the start I can tell he's less enthused and wants to run slower (which we do, or he stays home; I don't want to bring him anywhere near heat exhaustion).
pmahoney··on What Happens to Stolen Bicycles?
I believe that it's illegal to booby-trap one's house, and I've heard of (apocryphal?) cases of burglars suing homeowners for injuries sustained during a burglary...

I imagine such a brake-less bike would fall in that category.

pmahoney··on Move your feet
This seems to be a reasonable review of long-term injuries (specifically osteoarthritis):

http://www.jaoa.org/content/106/6/342.full

I've seen some of the studies referenced in that review, and what I gathered is that elite level running (in shoes) correlates with signs of osteoarthritis (seen in x-rays), but does not correlate with increased symptoms of osteoarthritis (runners did not report more pain than non-runners). If I recall, this was from the small study that included only Finnish elites. Other studies (the Lane study) have not found an increase in signs of osteoarthritis in non-elite (shod) runners.

Anyway, it's an interesting question.

> To say that barefooters have just as many injuries as other runners might simply be a consequence of many people transitioning too fast from inch-thick heels to barefoot.

It may indeed. I'd just like to add that I personally know shod runners who never get injured (former coach), so any hypothesis that claims "shoes lead to acute injury in all cases" is simply false. Of course, the more interesting question is what happens in "most cases".

pmahoney··on Move your feet
Would you mind expanding on the details of your running form that you think are "bad"? Did you attempt to change these immediately? Change to what? How'd it go?

In you 5k to marathon training, what sort of paces did you typically train at? Was it all a jog or did you do any speed work?

Thanks, from a curious bystander.

pmahoney··on Move your feet
What's wrong with "bad" form? The guy ran his races, maybe had fun, didn't mention injuries. What's the problem?

I say this as a barefoot runner. I've stopped caring about "running naturally" or similar nonsense. If you look at the research, things that correlate with injury are mostly doing "too much, too soon". There are a couple other things, but from this I conclude that if you do something gradually (like build from 5k to a marathon over some years), then you are minimizing your risk of injury. But if you do something non-gradually such as couch to 10K, or 10K with form A to 10K with form B, you are increasing your risk of injury.

Certain types of shoes that may or may not prod you into some "more correct" form do not correlate with lower injury rates. I don't think much research has been done on bare feet, but reading barefoot runners' forums leads me to believe injury rates are at least in the same ballpark as any other group of runners.

pmahoney··on Amazon Glacier
> Note that if the information is encrypted, you can just delete the decryption key and it is effectively deleted.

Does this satisfy the legal requirements you mention? I assume there are further requirements on what constitutes sufficient encryption?

pmahoney··on Why XSS is serious business (and why Tesco needs to pay attention)
Rails claims its CookieStore will "greatly increase the speed of the application" relative to other stores (the guide mentions a file store and a database store) [1]. The cookie is a base64 encoded hash serialization (i.e. completely reversible by the client), but "to prevent session hash tampering, a digest is calculated from the session with a server-side secret and inserted into the end of the cookie."

I've not seen or performed myself any measurements of these claims. I have seen it suggested that CookieStore is the default because it is simpler in not requiring a database table, and not for any performance benefit. Without measuring, I can only guess the difference is dwarfed by the typical page load time.

[1] http://guides.rubyonrails.org/security.html#session-storage

pmahoney··on Nvidia PR Responds To Torvalds' Harsh Words
I seem to recall at least one attempt several years ago at making an "open source" video card. Not sure if this is the one I remember, but it seems similar (from 2008):

http://www.tech.slashdot.org/story/08/05/21/2136243/Open-Sou...

pmahoney··on Change your Last.fm password
Draw a picture on a piece of paper. Sign it, write your name, arbitrary words, whatever. Hold it up to a camera.

Could something like this be made to work? Work in the sense that a variety of cameras could read the same "password"? I guess QR codes have a fair bit of redundancy built-in...

pmahoney··on We Who Value Simplicity Have Built Incomprehensible Machines
I've seen these VPRI links before. I've read through that PDF and various web pages, but I still have a poor understanding of what exactly they are doing.

Is it possible to summarize in a paragraph how they are able to achieve this LOC reduction? Is it simply that systems like Linux et. al. have been cobbled together by many hands over many years while VPRI has a single vision? Are there coding techniques I can use today in my own work? The only example I've found was a mention of some networking stack that was able to make use of a parsing engine, rather than implementing a custom networking-specific engine. This sounds like nothing more (not to trivialize this task) than choosing the correct parts to turn into reusable libraries and then reusing them.

> they don't mind small unjustified complexities

This is something I've noticed as well. Complex code of my own creation grates on my nerves until I am able to erode it and smooth it out. I get the impression that not everyone feels this way.

pmahoney··on Why should I have written ZeroMQ in C, not C++
It is possible for C programs to update themselves with zero downtime. See nginx[1], "Upgrading Executable on the Fly". The trick is that fork()'ed processes (can) inherit open sockets from their parent, even after exec()'ing a new binary. This seems a bit delicate and involves some communication during the hand-off from the old to the new, but it does work. It's also possible to kill the "new" if there were any problems and instruct the "old" to take over again.

This is not to take anything away from Erlang, which is a very interesting system.

[1] http://www.nginx.org/en/docs/control.html

pmahoney··on An Effort To Bury A Throwaway Culture One Repair At A Time
> Every time I replace running shoes I curse their irreparability and 6 month life span.

Psst, there's no scientific basis to claims that certain types of shoes reduce the rate of injury[1]. If it's above freezing and not rocky or thorny, the self-repairing waterproof soles you've had since birth will work just fine.

To drag this slightly back on topic, simply not buying stuff is another route to reducing throw-away objects. How many things do we just buy and use without thinking? I haven't been able to come up with much beyond running shoes myself. A second car for some people? Food items that are easy to make oneself from more basic ingredients?

[1] http://www.time-to-run.com/footwear/mechanisms.htm

pmahoney··on Humans hot, sweaty, natural-born runners
I'm not an expert by any means, but I've scanned the literature using what tools I have, and the impression I get is this: (sorry, I don't have all my references handy)

* Running (with shoes) is not a predictor of osteoarthritis (see http://www.jaoa.org/content/106/6/342.full). Elite athletes (running vastly more than typical recreational runners) do exhibit more signs visible in X-Rays, but do not report symptoms at a higher rate than any other group.

* Reliable predictors of acute injury are "too much, too soon", history of past injury, and, oddly, old shoes. (See http://www.time-to-run.com/footwear/mechanisms.htm). Matching the type of shoe to type of gait (as running shoes stores often attempt to do) has never been shown to reduce injury rate.

* It is possible to run with shoes and without injury. (I did it for 10 years; my old coach for 30+).

* It is possible to run barefoot on concrete and asphalt without injury. (I've done it for 5 years; others have for longer).

Those last two anecdotes don't speak to long-term injury, but I'm not terribly worried for two reasons: The first is the lack of correlation between running in shoes and osteoarthritis. The second is that the foot-achilles-knee is a spring-like appendage with vastly more play than 1/2 inch of EVA foam. Anecdotally again, I feel no pounding when running barefoot on concrete.

pmahoney··on Fuck the Android Build Process
Am I the only person in the world who likes Maven? I am a hipster Ruby on Rails dev by day (the type who should loathe Maven), but in a past job I had to use Maven, and I really like how various details about the project (name, version, dependencies) are well defined. Writing plugins isn't easy to get started, but once over the initial hurdle, it's nice to have those things specified.

Comparing to Rake, I'm currently trying to create a rake task to create a custom package (non-gem). I don't even get a project name for free. I've got to ask the user to pass in the name (or a Gemspec object perhaps).

Is the objection to the mass of XML? Or to Maven itself? I can understand the former, but I really think Maven is a well engineered system...

← PreviousPage 7 of 7