Science is Neat

I can’t even begin to explain–or even understand for myself–how I got to be reading up on these things, but here are some things I’ve read about recently that I think are fascinating:

  • MagLev Trains, which, instead of having wheels riding on metal rails, levitate on electromagnets. MagLev trains have reached speeds exceeding 300mph.
  • The biggest obstacle with train speed now is air drag. And when air is harshing your mellow, what else is there to do but move into a vacuum? Vactrains, which don’t actually exist in production yet, are trains running in vacuums — tunnels “evacuated” of air — eliminating air drag and are predicted to be able to move around 5,000 mph.
  • MagLev trains depend on superconducting magnets. I had assumed that superconductors were materials that were excellent conductors, which is partially correct. In actuality, superconductors have zero resistance. (Not “really small” resistance, but exactly zero resistance.) Seemingly like a lot of things that turn everything I thought I knew about science on its head, superconductors only exist when cooled to absurdly low temperatures approaching absolute zero, but this isn’t as big of a hurdle as one might assume, and they’re apparently common in scientific settings. Since they have no resistance, it’s possible to “close the loop” and have them just retain their strong magnetic charge.
  • Superfluids are the liquid equivalent of superconductors, having absolutely no viscosity. The details are way, way over my head, but superfluids can do things like climb the walls of their containers and leak out. Here’s a more approachable introduction.
  • Biochar is charcoal mixed into soil. It’s popular now because it’s a good means of ‘sequestering’ carbon rather than releasing it into the atmosphere. But, incidentally, it’s excellent for soil. It comprises one of the major components found in terra preta, extremely fertile soil found in the Amazon basin.
  • Continuing on the super- line of thinking, there are superhydrophobes, substances which are exceptionally good at causing water (and other substances) to bead off. A common example is the Lotus effect, named after the Lotus plant. Water won’t stick to Lotus leaves, but, more interestingly, nothing really does: dirt and such are suspended on the surface. When water hits the leaves, the water droplets pick up the other contaminants, leaving the plant uncannily clean. There are countless obvious uses of superhydophobicity in real life, such as clothing. (Car wax?) Sto Corporation sells Lotusan paint, which claims to biomimic the Lotus plant.
  • Aerogel is interesting, too. The nickname “solid smoke” is somewhat fitting its construction, though it’s not literally smoke. They’re the least-dense solid known, and are exceptionally good thermal and conductive insulators.

Dead Rising 2: A Mini-Review

I loved Dead Rising. Like, really loved it. So when Dead Rising 2 came out, and I saw that you could combine weapons, I decided to replace my broken Xbox with a new one just to play it.

Having had a couple days to play it, I feel compelled to review it: I hate it.

There’s lots and lots to love about it. But people play video games to have fun, not to perform laborious tasks and juggle conflicting priorities. That’s real life, and part of the reason people play video games is to get away from it for a while.

In the game, my daughter’s been bitten by a zombie, so she needs to be given Zombrex every 24 hours or she’ll turn into a zombie. (It sounds terrible, but since it’s a video game, I’ll add that just letting her die is apparently not an option.) But you can’t just walk to the convenience store and get Zombrex. It’s extremely hard to find and is usually given to you for completing a really tough mission that you’d just as soon have not done. You can only give her her daily dose between 7am and 8am, which means that if you find some and get back at 6am, you might as well put down the controller and go make yourself a sandwich (IRL), because you don’t have enough time to do anything meaningful before 7am, and God help you if you’re not back by 8.

But finding Zombrex is hard. It’s especially hard when you have other time-sensitive missions, and a crazy lady constantly texting you missions. Your quest for Zombrex means that you can’t complete a mission, but whoops, that mission was required and now you’ve lost. So you try again and focus on the mission, but whoops, now you missed giving the Zombrex and lost, too.

Right now some evil villain is looting the city, specifically the casino vaults. Why it’s my job to stop him, I’m not quite sure. I want to slay the zombies, not stop looters. The casinos, for some reason, are always packed with zombies, which makes merely walking through one a chore. But now, on top of that, I’m being shot at by an army of mercenaries hired by the evil looting villain. I eventually clobbered one of the mercenaries to death with my crowbar — no easy task when I’m also being mauled by zombies and being shot at by four other mercenaries who suddenly got grenades too. I died at least a half-dozen times first.

Once he was dead, I got his gun. But it requires manual aiming to be any good, and standing still in a swarm of zombies is pretty hard, because they’ll start to attack you too. Or, right as you’ve got your shot lined up, one of the other mercenaries will shoot you, and you’ll have to start aiming all over. Killing a mercenary requires most of the 30 rounds in the gun, which means that if you miss more than a couple shots — perhaps because you’re being shot at, or perhaps because a zombie is gnawing on your neck — you’ll have to drop the gun and somehow bludgeon him with an axe or something, which is no easy task when he and his compatriots have automatic weapons.

I finally defeated my second set of mercenaries, concluding that the game was really just not fun with crap like this. And then, an “URGENT” text message came in: there were more! This time, there’s probably more like a dozen. I’ve tried this one over and over. There are so many zombies that my health is usually seriously depleted by the time I get there. So I pack a bunch of juice and whiskey and cake (all of which are used to restore health) in place of weapons, which helps for a while, but then I don’t have enough weapons. (Oh, and speaking of health, the beer, wine, and whiskey restore health, but if you have too much, you begin vomiting uncontrollably. But all that you’ll find in the casinos is alcohol, which means that if you try to restore too much health at once, you’ll be in the middle of fighting off another mercenary when you suddenly bend over and vomit, dropping your weapon in the process.)

So Rockstar, I have no idea how you’ve done it, but you’ve managed to make a game where you get to combine weapons — like a boat paddle and chainsaws — and kill zombies with them into something tedious and irritating. I’ve stopped playing and am going to go pack up my summer clothes and move my air conditioner into storage, because that seriously sounds like more fun right now.

Productivity

This is reassuring: a good programmer might write about 10 lines of code a day in the long run. I often recognize this in my own work without believing it’s normal. Before I started doing this professionally, and before I learned that you’re supposed to think before you start writing code, I’d have guessed 500-1000 lines. Part of it’s just that good code shouldn’t really take ten thousand lines. But the other part is that programming is really much more about thinking and just slightly about actually producing code. I’ve known for a long time that “lines of code” is a horrible inaccurate measure of productivity, and yet I can’t stop counting subconsciously.

I think it’s probably normal for programmers to have days when they spend the entire day tracking down an obscure bug. You can’t reproduce it, but then after another 30 minutes of going through exception logs you figure out that it only happens in some oddball case, and finally you’re able to make it fail, though you still don’t have the first clue why. You start looking through it more closely, and start debugging in earnest. Finally, after a couple hours, you find the line of code where the weirdness is happening, though you’re still baffled about why it’s failing the way it is. And then it finally hits you what’s happening, and it’s something really trivial and kind of silly. You chuckle, make some extremely trivial change to one line of code, check it in, and then it’s 5:30 and you have a train to catch.

I still try to measure my productivity in terms of lines of code. All day and I made a minor change to one line? What a waste! But what’s hard for me to get used to is that everyone else just sees that I spent all day working hard on a difficult problem before emerging victorious. And yet my total time spent writing code was about one minute, and my total output was a trivial change to one line.

Of course we have days when we add a lot more. I added about 100 lines today, but that’s because I added some new classes and added several features that took long and floury code. But, in the game where productivity is measured by lines of code, it makes up for the days when I’ll work even harder and end up netting one line of code. Or “worse,” the days when I delete substantially more code than I add.

Photoshopped Art

I tend to be a Photoshop purist — you can use Photoshop to perform minor technical fixes. Correct white balance, enhance contrast, crop the shot a big tighter. Sometimes I think minor things are okay — in a portrait, it’s okay to clone out a cell tower in the background, or in an artistic landscape shot, it’s okay to clone out the litter. But I’ve never been fond on the ultra-tacky practice of applying random Photoshop filters and calling it art.

Consequentially, I have pretty mixed feelings about the Cutout tool. On one hand, it creates stuff that looks pretty good on its own. On the other hand, I don’t know that snapping an uninspiring photograph, applying a basic Photoshop filter and sliding a dial constitutes art. I’m pretty certain it doesn’t, in fact. But at the same time, I like these:

Nashua River

Mobilgas Sign

Fuel Efficiency

I found out a while ago that buses tend to get less than 10 miles per gallon. Initially, that seemed appalling. But I then got to thinking about the number of passengers, and figured that, in terms of efficiency and environmental impact, you should really multiply the number of passengers by the fuel efficiency. My car gets about 20MPG, but if I carpool with someone who also got 20MPG when they drove, in a strange way, we’re at 40MPG. It turns out that the term for this is “passenger miles per gallon.”

So then I wondered how different modes of transportation compared. I happened across one of Wikipedia’s many strange articles, Fuel efficiency in transportation, which told me much, much more than I wanted to know about the matter. It’s hampered by the fact that it uses many different units of measure interchangeably. (Megajoules per kilometer?!)

A bus is stated as getting 200-300 “passenger miles per gallon,” which seems pretty respectable.

CSX advertises that their trains move a ton of freight 426 (?) miles on a gallon of fuel. It turns out that this isn’t even a good number, it’s just the industry standard. A casual observer might not notice the “ton of freight” qualifier, though. The Association of American Railroads claims an industry average of 457 ton-miles per gallon, which is the unit CSX is using. (Actually, based on that, CSX is below industry average?) Strictly in terms of “distance on one mile of fuel,” trains seem to get 1-2MPG on average. A fully-loaded train, though, can carry hundreds of passengers; a Colorado rail line is stated as getting close to 500 passenger-miles per gallon.

Airplanes seem to need several gallons of fuel per mile, implying less than one mile per gallon. But multiply by the number of passengers and you can get close to 100 passenger miles per gallon. (For a full jet. A private jet carrying a handful of passengers is much lower.)

How about boats? I’ve read about bunker fuel used on ships, which is apparently literally the bottom of the barrel, a sort of sludge that needs to be heated before it’s even a liquid, and its absurdly bad environmental impact. But maybe boats are efficient?

My goodness, no. The Wikipedia article only cites the Queen Mary 2, which is perhaps not a representative sampel. But it uses one gallon of fuel to move 41.2 feet, implying about .008 MPG. (?!) It can hold 1,777 people, for 13.9 passenger-miles per gallon. That’s still appalling.

MySQL Replication – Permission Denied Errors

I spent a long time beating my head against the wall trying to solve this, so I thought I’d share it here in the hopes that it helps someone else.

I picked up a very cheap VPS to serve as a backup for various services, and decided to use it as a MySQL slave for backup purposes, and to provide secondary DNS (with a MySQL backend). Despite having no problem maintaining a kind-of-complicated cluster of MySQL boxes at work, I could not for the life of me get basic replication running. It consistently failed:

100829 15:56:56 [ERROR] Slave I/O thread: error connecting to master 'replication@127.0.0.1:7777': Error: 'Access denied for user 'replication'@'localhost' (using password: YES)'  errno: 1045  retry-time: 60  retries: 86400

(Yes, 127.0.0.1 is the master. Port 7777 is an ssh tunnel.) I tore my hair out, and repeatedly dropped and re-created the replication user. I could connect by hand. I tripled-checked credentials. It just didn’t work. Some people advised that master.info was sometimes saved with incorrect information; I blew that file away and re-issued the CHANGE MASTER command. Still nothing.

Finally, someone mentioned an oddity they discovered: with long passwords, replication just refused to connect. I’d used my favorite method of assigning passwords: “head /dev/urandom | shasum” So I changed my password to ‘password’ (just for testing!), flushed privileges on the master, changed the password with CHANGE MASTER, and started the slave again. Viola.

This wouldn’t be nearly as annoying if I could find it documented anywhere. I would argue that it’s a bug. But there it is — shorten your password. (12 characters is the limit I’ve seen put forth.)

Live Scanner Feeds

Radio Reference is a popular website for (police) scanner enthusiasts. It offers a pretty revolutionary concept: enthusiasts hook their scanners up to computers which relay the traffic to RadioReference’s servers, which host them as Shoutcast feeds. (I would also argue that the site is the best resource out there for scanner frequencies, and there are also forums that comprise what I can only assume is the world’s largest scanner-related community.)

For some inexplicable reason, I ignored the Live Feeds for a long time, until I got an iPhone and discovered an abundance of “police scanner” apps that were built on top of those feeds. The feeds are quite popular — the site’s owner posted a blog entry showing his latest AWS bill, which shows about 14TB of incoming traffic and more than 35TB outgoing traffic.

Besides being really valuable for those who simply don’t own a scanner, some of the feeds provide audio that is out of reach for most people. I could easily listen to the LAPD, for example, despite living thousands of miles away. There’s now a feed for Mass State Police in the area; I own a scanner capable of receiving them, but their signal is very weak where I live, so it’s advantageous to listen over the Internet, despite a bit of lag. Waltham has a feed of its own (well, plus Newton Fire). Someone else provides a Merrimack Police feed, which is advantageous because it’s a digital voice (P25) signal and a capable scanner will run you $500.

Boston Police are conspicuously absent, even though a lot of smaller cities have feeds. It seems that there’s considerable interest in setting one up, but to date, no one has. (I’d love to myself, but I have very poor reception here — part of the reason I want a BPD feed in the first place!)

In any event, I’d recommend checking the feeds out. You can listen in with a browser, or use one of many smartphone apps.

Special Interests

If anyone has ever doubted that special interests were out of control, here’s proof: the National Association of Broadcasters and the RIAA have proposed legislation that would require all cell phones to contain FM radios.

I’m not really sure why I would want an FM radio on my iPhone, when I have over a thousand of my favorite songs on it, or when I can just pull up Pandora and stream music tailored specifically to my tastes. This isn’t to say that having an FM radio on a cell phone wouldn’t be cool, just that making it the law seems rather absurd.

Gary Shapiro, the CEO of the Consumer Electronics Association, blasted the idea as “the height of absurdity” and said something everyone has thought about the RIAA for years: “Rather than adapt to the digital marketplace, NAB and RIAA act like buggy-whip industries that refuse to innovate and seek to impose penalties on those that do.” FM radio and the RIAA are yesterday’s news, and they don’t even seem to be aware of it.

My favorite part of the article, though, is the paraphrased argument from a NAB executive: “Most Web-based music services don’t include emergency alerts that radio stations broadcast, he said. Requiring FM receivers in mobile phones would help better inform the public about emergencies or bad weather nearby, he said.”

Without realizing it, he proves once and for all just how out of touch they are. I have the Internet in my pocket, and can be reached instantly 24/7. In the middle of a sandwich shop, I can pull a device out of my shirt pocket and check the weather radar. While waiting in line for the train, I check the news. They look around and see people connected like never before, and what they conclude is apparently, “Those poor people have no way of knowing about major emergencies. What they need is FM radio.”