Holidays

  • One of my classmates is from England. He was talking the other day about how, incredibly often, people here ask him if they celebrate the 4th of July in England.
  • Cinco de Mayo is not Mexico’s day of independence. It commemorates the date of a battle. More importantly, it’s just a minor regional holiday in Mexico. It’s nothing like our 4th of July. And Mexicans don’t make a big deal out of it! It’s arguably celebrated primarily in the United States.
  • Another foreign student at school mentioned that her home country (I think it’s Portugal) celebrates Thanksgiving. That’s really pretty strange?

Undoing bad tar files

Proper ‘etiquette’ for packaging a tar file is to package it so that it extracts to a directory. But sometimes, the files are packaged by an idiot, and, when extracted, just extract the files right to whatever directory it’s in. (Which is fine, if you expect it.)

tar takes a “t” option (“t” for “list”–get it? I don’t…) to list (list?) the files in a directory. You can use it two ways:

  • Pre-emptively: tar ft file.tar will show you how it’d extract.
  • Retroactively: rm `tar ft file.tar` will list the files, and pass them as an argument to rm, deleting the mess it just made.

Focus

The other day my camera was in its “AF Hunt” mode, where it couldn’t seem to lock on focus. It’d focus past where it should be, and then turn around and focus back the other way, and just keep going. When you use the flash, it’s worse, because it’ll do a strobe flash to try to aid in focus, but it doesn’t help at all.

After a couple times of doing this, I finally got it focused, and just slid the switch on the lens from “AF” to “M,” disengaging automatic focus. It’d hold the focus that way, so it wouldn’t have to focus every time. (I was stationary, photographing something stationary, so there was no need to refocus every time.)

And then I put the camera down and bumped the lens, so the focus was off. So I just turned the focusing ring. And for the rest of the night, I left the camera in manual focus mode. I’ve found that I can do it just as quickly as the camera can focus the lens, and that’s when it works right: I don’t spin the focus back and forth ten times in a vain attempt to focus something.

Leaving it in manual focus also speeds up the shot: you press the shutter and it takes the picture instantly. There’s no waiting as it focuses.

So almost accidentally, I’ve become a fan of manual focus. Sometimes I’m lazy and want the camera to do it for me, but more often than not, I’m finding that I’d just as soon do it myself.

Geekery

One of my weird OCD concerns is that some of the scripts I host place a heavy load on the server. I want to make sure that, in busy times, they don’t weigh down things further. Here’s a neat little bit of PHP I wrote to simply have PHP abort the page load if the 1-minute load average is over 2.00:

// Check the uptime first
$fh = fopen('/proc/loadavg', 'r');
$uptime = fread($fh, '4');
fclose($fh);

if ($uptime>2) {
die("Sorry, we're too busy.");
}

Rather than die(), you might throw a redirect to a cache or something else. And I should point out that, of course, running this code does take some CPU time… And that this script doesn’t always make sense: you’re basically forcing a failure before the server itself forces the failure. The time it makes sense is in the way I’m using it — when some unimportant, tangential project requires inordinate resources and you want to make sure it doesn’t slow the server down too excessively, at the expense of the more important projects (e.g., the blogs).

YDA Conference

This weekend was the Youth Democrats of America conference in Manchester, NH. I’d toyed for months with renting a fast telephoto for the event. In hindsight, I’m glad I didn’t—most of the speakers I wanted to capture weren’t even there.

title=”IMG_1785 by n1zyy, on Flickr”>IMG_1785

Bill Clinton was the first speaker. He delivered an amazing speech, but also kicked off what would rapidly become an irritating trend—unabashed praise of Hillary. Right before Hillary was the state chair of something (Youth Democrats?), who explained that he was prohibited from endorsing a candidate. So his speech began, “Effective Monday, I resign from my post. I’m going to join the Hillary campaign.” It seemed pretty inappropriate.

Clinton, though, was a great speaker, and it’s understandable that he’d back Hillary. He talked about how excited the debates last week made him—the Democrats weren’t debating whether global warming was a myth, or whether health care was broken. They were debating the best way to fix it. I wish I had a better recall of the exact figures, but he mentioned that the US pays something like $700 billion a year more than any other nation on healthcare. He said that if we were to close our eyes, pick a country, and copy their health care system, we’d end up saving a lot of money. So he complained about the people that whine about “socialized medicine”—even if we went with a truly Socialist plan, it would save us money. But no one proposed that we become Socialists anyway.

The next morning we had a series of luncheon speakers. Most of them were pretty bad. The first one stood up there before it started pleading with us to hurry up. Like, probably every 90 seconds he’d make an announcement, alternating between asking us to get food and asking us to get food quickly and reminding us that there were two separate lines. And he’d add in “funny” comments like, “If the person in front of you is taking too long, shove them,” which really didn’t do anything but grate on our nerves. And then we had a series of speakers that no one knew that really weren’t that good. One of them I think was taking some serious drugs or something. He started of by talking about going “back to the future,” and all sorts of other things, and never really tied any of them together. And there was this joke that none of us even understood about Bush getting off an airplane carrying two pigs, but he started it off by pretending it was an actual news story. We were talking about it afterwards, and basically all admitted that we had either laughed because everyone else was and we didn’t want to seem like we got it, or, for a few people, they laughed just out of sympathy because he’d taken so long setting up for it and yet it came out making no sense.

title=”Elizabeth Edwards by n1zyy, on Flickr”>Elizabeth Edwards

They served this big elaborate lunch, but only had coffee and water. So a few of us go find a vending machine. And I guess Elizabeth Edwards was just standing outside waiting until she was called as the next speaker, so they were able to just go talk to her. “And she talked back!” they said with some surprise. They came back and told us, so a few more of us went to see her, but she was going in right as we were coming out. So instead we went to find the vending machine. After checking a bunch of likely places, I asked at the front desk. “They’re on every odd floor—so 3, 5, 7, 9, and 11,” she told me. (One might assume that the lobby is an odd floor, but it’s called “Lobby,” followed by “Mezzanine” above, and then 3. So we took the elevator up to the third floor, bought a can of Dr [sic] Pepper for $1, and went back, by which time Elizabeth Edwards was speaking.

She delivered a really good speech about Edwards. I was very impressed, and when she turned it over to questions, the first question summed it up well: “Why aren’t you running for office?” The question drew a lot of applause. She’d make an amazing First Lady, because she really knows her stuff! And then a woman asked, “My partner and I have been together for 30 years. When I say that we want to be married, how would your husband—and how would you—answer us?” (Edwards has stood out as the Democrat most opposed to same-sex marriage.)

Her answer again drew applause, when she started off with, “Well, those are two separate questions.” Her answer was actually even more impressive, as she began talking about how it’s an “evolving issue” and that she hopes John’s stance would change with time. (Now you see why people wanted her to run?)

Someone else asked for her opinion on some obscure personal attack on a politician. Her answer was basically that she thinks it’s very important that the American people grill candidates with questions, but that sometimes people don’t respect people’s personal lives. She gave the example of people obsessed with Romney’s Mormonism, and then, “And some people criticized John for continuing in spite of my illness… I think that’s inappropriate.” (Again, applause.)

The rest of that day was going to be some sort of canvassing event that none of us wanted to go to. So we instead took the time to tour the local campaign headquarters of the candidates. We were given some really vague directions, and people kept expecting me to know all the backroads around Manchester. One direction involved turning at a prison, which somehow got misinterpreted. We pulled into a prison parking lot, and everyone was walking in. I pointed this out, but they insisted that his headquarters were inside. “No, there is no way that Obama has set up his headquarters inside a prison,” I argued. Someone else suggested, “Well, as long as we’re here, let’s just go inside and check.” I finally persuaded them that it would be incredibly embarrassing to walk into a prison and ask if Obama’s headquarters were there. (Actually, it would probably get interpreted as some sort of racist joke, as opposed to sheer idiocy?)

So we continued down the road, and not a half mile later, we were at the Obama headquarters. It was actually in the middle of nowhere, but the place was huge:

title=”Obama’s Offices by n1zyy, on Flickr”>Obama's Offices

That just shows a small part of the office. It was substantially larger. Hillary’s offices weren’t as nice inside, though they were in a very plush office complex. But she wins points for largest IT infrastructure:

title=”Hillary’s Server Room by n1zyy, on Flickr”>Hillary's Server Room

N.B. that this server closet just powers this one little branch of Hillary’s many campaign offices.

At both places, the staff was more than happy to take a few minutes to show us around and talk about why they were supporting their candidate. I was really struck that all these volunteers seemed so professional.

And then we went to the Kucinich headquarters. I didn’t take any pictures inside, because it was a small place and would have been awkward. In hindsight, I really, really wish I had.

title=”Restaurant by n1zyy, on Flickr”>Restaurant

It was above this big restaurant, though, with an obvious political history. Inside we found a couple surprised volunteers. “We were in the middle of something,” one of them said, as the other jokingly added, “Inauguration planning.” “But we can talk to you for a couple minutes.” We thought it was pretty strange. One of them moved and a lighter fell out of his pocket. They both seemed pretty… mellow… as they talked to us, and were really all of the place in topics. They actually raised some good points, but the whole thing was really pretty creepy and left me liking Kucinich even less. (The quizzes I’ve taken say he’s my best match, but there’s more than just his stance on the issues that matters. If I were running for President, for example, and saw a UFO one night at home, I might think, “Gee, I’d probably look pretty crazy if I brought that up” and not mention it.) They ended up talking to us at length. At one point someone else came in, seemed surprised anyone was there, and went through these tiny little doors into some sort of oversized closet in the back room. It was amusingly creepy.

After we left, we started talking about how weird the whole thing had been. Someone asked, “Was I the only one that thought it smelled like weed?” Someone else agreed, and then we discussed them dropping a lighter, and how vague the “Oh, we were doing something, but I guess we can talk to you” thing was. And the sketchy back room.

This is not how you should be running a campaign? At all?

We ended up being pretty unimpressed with the YDA Conference, though. We had a good time and got lots done, but some of the best parts were when we skipped the official parts of it and did stuff on our own. We were initially told there’d be “Presidential speakers,” which we naively took to mean that the candidates would be there. Bill Clinton was the big one, followed by Elizabeth Edwards. Kucinich was supposed to be there but canceled. (Don’t worry, plenty of jokes about him, UFOs, and green leafy substances consumed in the back room of campaign offices have already been made to explain his absence.) Obama was never scheduled to come, it turns out, and his “speaker” was his half sister. We were going to go, but it was actually a “party” in the back room of some pub that was very overcrowded. So we left. We ended up not even sticking around today, after seeing the only interesting event of the day (Kucinich) had been canceled.

Today’s Deals

This week, Office Depot wins the award for best deals:

  • eMachines desktop and monitor combo. Athlon 3800, 1 GB RAM, 160GB disk, dual-layer CD/DVD-R, Vista Home Premium, and a 21.6″ LCD. Their website seems devoid of information on it, so I can’t figure out what I really want to know–the resolution on that monitor. But at $399.99 after rebates ($649.99 in store), it seems like a good deal any way you spin it.
  • If you’re more of a laptop person, they have a Toshiba laptop with a dual-core Athlon TK-53 (which means nothing to me), 120 GB disk, 17″ “TruBrite” widescreen monitor, and 2 GB (!) RAM. Typical dual-layer CD/DVD burner and Vista Home Premium. Integration 802.11b/g (but not a or N)…. $599.99 after rebates, $749.99 in store.
  • “Becker Traffic Assist GPS” with voice directions and a 3.5″ LCD (touchscreen). I’ve never even heard of Becker, but at $129.99 (after rebates: $199.99 in store), it seems like an incredible value.
  • 2GB CompactFlash card, $19.99 in store. I’ve been watching CF prices for a while now that I have a CF camera, and this is definitely a good deal. The problem is that I’m not sure I need a 2GB card? Same price for a 2GB SD card.
  • Epson all-in-one machine (printer/copier/scanner/fax), $44.99. Includes an LCD so you can print right from digital media. As usual, price is after rebate
  • $649.99 ($799.99 in store) for a quad-core Intel (Q6600), 2GB RAM, 400 GB hard drive.
  • $6.99 for a 1GB USB thumbdrive. Those came down in price awfully quickly!
  • $27.99 for a 4GB (!) thumbdrive.

I really wish I could justify the purchase of a new computer, because that $400 desktop system is very tempting.

ISO: The Next Frontier?

In photography, there are a few key variables in determining exposure. The first is the aperture of the lens: basically, how much light is let in. Really serious (or rich) photographers carry around very “fast” lenses–they’re enormous and let in a ton of light. Notice the huge lenses that you see on the sidelines as sporting events, for example. (Err, not the length, but the width–these things are huge in both dimensions.) Of course, these lenses (we call them “fast” lenses, or lenses with wide apertures) are very heavy, and insanely expensive: for a really good one, you’d pay at least $1,000, and that’s pocket change compared to some lenses.

Another control is ISO sensitivity. Back in the days of film, some film was more sensitive to light than others. For example, ISO100 produces great pictures, but requires a lot of light. It’s superb for outdoor pictures on a sunny day. On the other hand, if you’re getting shots indoors, you might be at something like ISO1600. The problem is that, as you increase the sensitivity, you also increase the noise. ISO1600 will get decent shots indoors, but they’ll be grainy. (This is especially bad if you’re like me and tend to try to boost details in the shadows in Photoshop.)

The two come together to control the third important variable, shutter speed. In some cases, it doesn’t matter a ton. If it’s bright and sunny, and I’m taking a picture of a building, I really couldn’t care whether it’s 1/100th of a second or 1/4,000th of a second. And, if I’m using a tripod, it’s not uncommon to have shutter speeds lasting several seconds. But the problem is that, if the shutter speed is too low, you get a lot of blur. There are two reasons–the first is that people rarely hold still. I use 1/60 as a general rule of thumb: below that and you risk some blur if people are moving a lot. This is a really rough guess: I’ve gotten great portraits at 1/8, and sometimes 1/125 isn’t fast enough.

The bigger consideration, though, is camera shake, especially with longer zoom lenses. The rule of thumb there is 1/length. For example, shooting with a telephoto 200mm lens, it’s recommended that I shoot a 1/200 of a second or faster.

Putting it all into practice… Bill Clinton was speaking tonight at an event we went to. I have a 55-200mm telephoto lens, and tended to stay right around 200mm. I stayed at ISO1600; I can go to ISO3200 but it’s very grainy so I don’t use it. Unfortunately, though, my lens can’t go wider than f/5.6 at that length, which meant that the fastest I could get shots was around 1/60th of a second. At 200mm, this really was inadequate: most of the shots came out okay because I have a steady hand, but they’re not all that sharp. Example:

title=”IMG_1795 by n1zyy, on Flickr”>IMG_1795

It’s okay, but now compare it to this picture:

title=”Autumn Colors by n1zyy, on Flickr”>Autumn Colors

Granted, the subject isn’t that interesting, but every time I see that shot I took, I think, “Wow, that’s sharp!” Not so for the Clinton photo. If you view it in larger detail (click on it), its subtle blur becomes increasingly obvious.

There was a professional photographer about ten feet away from me. She was shooting a 70-200mm lens, which is a similar length to mine. But hers is an f/2.8 lens, which lets in twice as much light as mine does. So while I was getting 1/60 shutter speeds, she could have been getting 1/120. (Hers had Image Stabilization, too, but that’s a story for another day.)

The thing is, taking telephoto portraits indoors isn’t all that rare of a thing to do. To get good shots, you need to get that shutter speed up. There are two ways to do it, as you should now know: raise ISO or get a better lens. The problem is that getting a better lens will set me back $5,000 or so. And it’s an insanely heavy lens as well.

The other option is one that, until recently, wasn’t feasible: raise ISO some more. ISO1600 is good. You can do ISO3200, but it’s decent on only a few cameras. But I really have to give Nikon credit with their D3. It’ll go to ISO25600. Check out some samples. I’ve seen some higher-res images at ISO6400, and it’s just about perfect! Its ISO6400 rivals my ISO1600. The thing is, that’s a huge increase to be able to shoot at 6400 and have a perfectly usable image. It would have helped a lot with getting better shots.

I truly hope this is the direction camera makers go in now, and that Canon and Nikon get into an “ISO war” trying to outdo each other.

The Bible

I found a script that does that sort of Markov chains mentioned. I use it in PHP.

I needed a large body of text, though. Just using someone’s blog posts, for example, just results in a lot of repetitiveness. It’s no good. For bonus points, I wanted a large body of text that sounded kind of strange no matter how it was read.

So I found the Bible. It’s doubly good because the wording is pretty archaic, so you’re use to having to carefully analyze it to divine some meaning. While a guy on a forum saying he recently spent an evening with a grain of salt comes across as nonsense, in the context of the Bible you might try to read into it. This is perfect for this script!

Here’s the page. A lot of it’s sheer nonsense, but some of it’s incredibly good. In lieu of actual verse numbers, the script picks up on the numbers and very consistently plugs in two numbers in front of text.

Some recent highlights:

22 7 And David said unto Saul, I saw gods ascending out of the land to bury with the passengers those that remain upon the face of the earth, and upon every high mountain…

The zombies are coming? To kill the living?

5 11 Woe unto them! for their day is come, the time that David was escaped from Keilah; and he forbare to go forth. 23 14 And he went through the corn fields on the sabbath days. 4 32 And they were offended in him. But Jesus stooped down, and with his mouth, and began at the same scripture, and

This is one of those ones that almost tells a ‘coherent’ story about David escaping from Keilah, running through cornfields even on the Sabbath, which offended people. But Jesus stooped down to begin scripture. I’m fairly certain that no such verse appears in the Bible, though.

22 3 And David prepared iron in abundance for God had made them rejoice with great joy

That’s not much of a party….

Of course, sometimes it seems to get in a sort of loop… Anyone who’s read the Bible will recall that it, at various times, launches into really lengthy lists of people’s names and the relations between them. So I cringe whenever it begins doing that, because sometimes it just doesn’t stop. Here’s a good illustration of that:

are honest, whatsoever things are lovely, whatsoever things are honest, whatsoever things are just, whatsoever things are pure, whatsoever things are true, whatsoever things are honest, whatsoever things are honest, whatsoever things are honest, whatsoever things are true, whatsoever things are lovely, whatsoever things are honest, whatsoever things are just, whatsoever things are pure, whatsoever things are true, whatsoever things are lovely, whatsoever things are lovely, whatsoever things are just, whatsoever things are pure, whatsoever
29 2 And he placed forces in all the coasts thereof, from two years old was Jehoash when he began to reign, and he reigned eleven years in Jerusalem.

My biblical history isn’t so hot, but I’m fairly certain that rulers had to be at least three to begin their reign.

15 6 In the morning sow thy seed, and in the water

o_O

40 4 And the glory of their strength in the tabernacles of Ham
16 59 For thus saith the Lord GOD; Behold, I will stand upon my watch, and set me in dark places, as they that must give account, that they may lay hold on bow and spear; they are cruel, and have no child, and her husband were dead, she bowed herself and travailed; for her pains came upon her.

Say what?

33 25 Wherefore say unto them, My little finger shall be thicker than my father’s loins.

Is that an actual verse? It sounds like it may have been the equivalent of a your-mom insult from the biblical era?

Anyway, go see for yourself. Just don’t expect every verse to be good.

vim Trick of the Day

:g/nbsp/d

That command sets up a “range” of all lines (hence the g for global) that match “nbsp”, and runs the command “d” (delete) on them.

I’m working with a file that was converted by a script from HTML, but had some carryovers that were whole unnecessary lines… No lines with ‘desirable’ content had the nbsp in them, just the junk ones. So we delete them all.

Kudos to this site for the inspiration.

There Goes My Hero

Watch him as he goes! It was the usual “wasting time on Wikipedia” path — I started reading about nuclear fission, and then read about Los Alamos, and then read about the supercomputers, one of which ran Plan 9, so I read about Plan 9, and then its GUI, and then the guy who wrote the GUI. And there was an allusion to someone else, Mark V. Shaney. So I read about him.

In a nutshell, it was a script a few of the Plan 9 guys wrote that would process a lengthy body of text and do some statistical analysis, and use that to spit out writing. It was AI, in a sort, but “schizophrenic” is the best way I’ve seen it described. You read it and it’s one of those things where, for a minute, it makes sense, but then it radically shifts topics or draws some sort of completely irrelevant conclusion. Kind of like a lot of people on the Internet, actually.

They had some fun with textbooks. Here‘s an example, in which the code was fed a basic arithmetic textbook:

Why do we count things in groups of five. When people learned how to count many things, they matched them against their fingers. First they counted out enough things to match the fingers of both hands. Then they put these things aside in one quart. A giant-size bottle that will hold four quarts is a three-digit number….

It starts of making good sense, but suddenly they go from counting on your fingers to putting “these things” in a quart, and is pretty incomprehensible from there.

Here’s another really funny one. You read it, and can kind of comprehend it. But the first reply summarizes it well: it suddenly shifts from constipation to understanding the 19th century, with no logical shift. I think that commenter may have been aware of what was going on. The second guy accurately nails what’s going on.

Finnegan’s Wake? This one cracks me up a lot. But you read this, and doesn’t it exactly sum up what’s wrong with Internet forums? The people just seem totally bonkers, and like they’re ranting but not really sure what they’re ranting about. He manages to talk about being good in bed and using the latest version of BSD in the same sentence. The reply is hilarious, because it’s exactly what you’d think if you didn’t know what was going on: that the “guy” posting was on some serious drugs.

This one, though, is my all-time favorite. It starts off as some religious rant, but clearly not a coherent one. But the fifth paragraph is the best paragraph ever written:

When I meet someone on a professional basis, I want them to shave their arms. While at a conference a few weeks back, I spent an interesting evening with a grain of salt. I wouldn’t take them seriously!

I’m fairly certain there are AI ‘bots’ out there that do this same thing, maybe in more coherent forms. I want to acquire one. Badly. I’ve always been interested in the ‘bounds’ of nonsense—when something kind of makes sense, you work with it. We “understand” people shaving their arms in professional settings, and we can visualize someone spending an evening with a grain of salt, and I surely wouldn’t take them seriously afterwards. But we’re making ‘sense’ out of sheer nonsense generated by a computer. How far will it go before we think, “This is complete nonsense.”