Police Logs

Last night I was in the police station getting data for the police logs. As I sat there in the lobby perusing the logs, some girl came in and approached the dispatch desk.

“Hi, I don’t know what to do… This has never happened before. I think my car was towed.”

A few minutes go by, and the dispatcher concludes, “Ma’am, we didn’t tow your car.”

She told him exactly where she’d parked, so he pulled it up on the camera and zoomed in. (The zoom on those cameras is ridiculous!) “I was right next to that Jeep,” she said. Sure enough, her car wasn’t there.

She called to get information on activating Lo-jack in her car.  The dispatcher called local tow yards to confirm that no one had towed the car without telling him. One  by one, they came back negative.

I was sitting there, intrigued. Part of me didn’t believe that a car had just been stolen on campus. But the other part of me was irritated that the dispatcher was was lallygagging around instead of putting out a BOLO for the recently-stolen car.

Finally, he radioed to one of the officers who was patrolling the parking lot, and asked him to look for the car. About ten seconds later, he radioed back. “I’m sitting right in front of it.” He turned on his lights so they could see where he was on camera.

He was maybe four cars down from where she said she’d parked.

I tried to refrain from cracking up. And as I soon realized that it’s exactly what everyone else in the station was trying to do.

(As an added bonus, she freely admitted that she was illegally parked in a handicapped spot and had no parking permit, although they seemed to distracted with the hunt for her lost car to issue her a citation.)

A Plea to Phone Makers

Make ringers “polite.” If a phone ‘rings out’ (e.g., rings non-stop until voicemail kicks in), switch to silent mode automatically.

Yes, this has flaws, like missing multiple calls because you missed one call.

But sit here with my as my suitemate’s phone rings time and time again, with a really irritating ringtone while he’s gone, and hold back the tears long enough to tell me that this feature isn’t necessary.

If nothing else, come up with a universal, unobtrusive means of switching a phone to silent. My Treo’s got a slide on the top, and I think all phones should have something like that. Every time I try to use someone else’s phone I end up getting into strange menus or, more often than seems statistically probable, ending up inside a web browser. So I’m pretty averse to opening up people’s phones and changing settings. I could cope with sliding a hard switch on the outside, though.

Seriously, please implement this. I’m begging.

Malus Fide

I’ve always like the idea of rewarding douchebaggery with more douchebaggery. And one bit of douchebaggery that really bugs me is that, running a webserver, it’s always getting requests for pages that have never existed. What’s going on is that people are probing for common vulnerabilities. I don’t have a /phpmyadmin, but I get multiple requests a day for it. (I do have PHPMyAdmin, but it’s up to date, secure, and at an obscure URL.) Same goes for awstats.

What I’ve always wanted to do is respond to these requests with complete garbage. Unending garbage. My long-time dream was to link a page to /dev/random, a “file” in Linux that’s just, well, random. (It’s actually a device, a software random number generator.) The problem is that linking it is full of problems, and, when you finally get it working, you’ll realize that it’s smart enough to view it as a device and not a file.

So I took the lazy route and just created a 500MB file. You use dd to copy data from a disk, with /dev/urandom as the input and a file with a .html extension as output. I had it read 500 “blocks” of 1MB. Granted, this is a total waste of disk space, but right now I have some spare space.

Of course, I was left with a few resources I was concerned about: namely, RAM, CPU time, and network activity. I use thttpd for this idiotic venture, which lets me throttle network activity. I’ve got it at 16 KB/sec right now. (Which is an effective 128 kbps.) This ensures that if it gets hit a lot it won’t put me over my (1,000 GB!) bandwidth allocation.

Apparently, though, this throttling solves the problem: at first glance, it looks like it’s smart enough to just read 16KB chunks of the file and send them out, as opposed to trying to read it into memory, which would kill me on CPU time and RAM. So the net result is relatively minimal resource utilization.

Currently, it’s just sitting there at an obscure URL. But my eventual plan is to setup a /awstats and a /phpmyadmin and a /admin and a /drupal and have them all throw a redirect to this file.

The other bonus is that, at 16KB/sec, if a human gets there, they can just hit “stop” in their browser long before a crash is imminent. But, if it works as intended, infected systems looking to spread their worms/viruses won’t be smart enough to think, “This is complete gibberish and I’ve been downloading it for 30 minutes now” and will derail their attempts at propagating.

It’s not in motion yet, though… But I’ll keep you posted.

Filesystems

On my continuing obsession with squeezing every bit of performance out of this system… They say that Linux filesystems don’t get fragmented. I never understood this. It’s apparently smarter about where files are placed. But still, frag-proof? If it was that easy, other filesystems would have figured it out long ago too. I figured that the explanation was just over my head. In reality, the “explanation” is that it’s a myth.

oxygen bin # fragck.pl /home 2.19458018658374% non contiguous files, 1.03385162150155 average fragments. oxygen bin # fragck.pl /var/log 56.3218390804598% non contiguous files, 28.9425287356322 average fragments. oxygen bin # fragck.pl /var/www/ 1.45061443222766% non contiguous files, 1.05527580153377 average fragments. oxygen bin # fragck.pl /etc 2.18023255813953% non contiguous files, 1.05450581395349 average fragments. oxygen bin # fragck.pl /var/lib/mysql/ 16.5424739195231% non contiguous files, 2.93740685543964 average fragments.

The results kind of make sense: /var/log is full of files where you’re constantly appending a line or two to various files, so it only stands to reason that, if the filesystem isn’t very careful, fragmentation would build up. The other one is /var/lib/mysql, where MySQL stores its data. It’s the same deal as /var/log, really, in that it’s continually adding files.

/var/log/messages, the system log file, is in 75 pieces. Its backup, messages.1.gz,was in 68.

Realistically the performance hit is negligible. It’s not like a core system file is in hundreds of pieces. (Like, say, the paging file!) /bin has very low fragmentation. Log files can be fragmented an not impact anything. (Except my OCD.) Although I am concerned about MySQL’s data stores building up fragmentation. In theory I can bring the database down and shuffle the files around, but it’s probably best left alone right now.

Fortunately, there’s hope… By moving a file to another partition, you cause it to move physical locations. Something like mv messages /tmp/ramdisk && mv /tmp/ramdisk/messages . will cause the file to be rewritten. (Granted, this particular command was an awful idea: syslog-ng keeps /var/log/messages open, and doesn’t like it when the file randomly disappears. The fact that it was only gone for a split-second doesn’t change the fact that the files location has changed.) Although don’t get too excited about this: for some reason, fragmentation sometimes ends up worse! access_log was in 60 pieces. Now it’s in 76.

I’ve also heard it said that some fragmentation isn’t necessarily a bad thing: a few files close together on the disk with light fragmentation is better than frag-free files on opposite ends of the disk. But that doesn’t satisfy my OCD. I guess the moral of the story is to not muck around too much with things. Or, “if it ain’t broke, don’t fix it!”

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?

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.

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.

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.