Grand Central

I signed up for an account with Grand Central. It’s a limited beta, but they eventually had a slot for me.

Essentially, I give out my GrandCentral number, which rings in multiple locations. (Currently, my cell phone and my school desk phone.) But it treats calls more like e-mail: I can set up ‘rules’ on what calls get through and what calls don’t. There’s voicemail which I can listen to via the Web.

I have a few invites, if anyone is interested.

Getting Familiar with the CLI

As long as you’re doing lots of work in Linux, there are some more things you’ll want to get used to. I spent a lot of time in the command line. (It’s kind of hard to avoid when you’re working on a headless server.) These tips are useless if you don’t have a basic familiarity, but for people with a relatively basic knowledge, here are tips that might come in handy:

Very often in less, I want to jump to the end of a file and work my way up. I can hit space over and over. One day I thought I was clever, when I realized it would tell you how many lines were in the file, and I began telling it jump to line 123 by typing :123 within less. But it turns out it’s even easier. G takes you to the last line. g takes you to the first line. There are many more handy tips here.

Of course, I spent even more time in vi. Search and replace is handy. But keep in mind that the :s/old/new command will only work on one occurrence. You can append a g, ending up with :s/old/new/g, but it’s only going to work on one line. This is usually not desirable. You can specify a line range. Generally, though, you want the whole file. $ denotes the end of the file, so you can do it as “1,$,” denoting “From line 1 to the end of the file.” But it’s even easier: % means “the whole file.” So I end up with…. :%s/old/new/g to replace all “old” with “new”. And if this isn’t what you want, press u to undo. The “G” trick to jump to the end works in vi, too. Turns out you can replace :wq with ZZ, which is essentially the same.

I’ve known about the uniq command for quite some time: its goal is to weed out duplicate lines. This is handy far more often than you might imagine: say you strung a ton of commands together to pull out a list of all e-mail addresses that your mailserver has rejected. There are bound to be many, many duplicates, because apparently bumttwagnerfor@domain is commonly-spammed (?!).

But uniq has a peculiar quirk that I missed. They call it a feature, although I’m not sure I agree. It’s for filtering out sequential duplicate lines. If the duplicate lines aren’t in order, it will merrily pass them on. I suppose there may be scenarios when this is desirable, although I’m at a loss to think of any. In a nutshell, whenever you want uniq, you probably want to run it through sort first. grep something /var/log/messages | sort | uniq, for example, will pull out all lines with “something” in them, but omit all duplicates.

And note that use of grep. For some reason people seem to think that echo filename | grep search_pattern is the way to do it… There’s no reason for echo. Just do grep search_pattern filename.

Fun with Shell Commands

I’m now running a mailserver, and I was trying to set up Mailman to handle a mailing list. I was having some odd behavior causing Mailman to barf up a fatal error, so I used a trailing monitor on the log file with tail -f.

In the course of doing that, I noticed several hosts connect attempting to deliver mail (presumably spam) to “bumttwagnerfor@domain…”, a bizarre address that definitely doesn’t exist.

It’s not a big deal, because the mail’s just bouncing. But it got irritating watching them all in the log file.

I wanted to ban them. It turns out that Linux makes this easy: there’s a hosts.deny file, and anyone in it is banned from connecting. I already have a script that watches for repeat failed login attempts on ssh and bans them. (And I have something like 200 IPs banned, although I suspect that it’s not purging them appropriately.)

All the log entries are in a common format, and look like this:

Oct 8 05:41:31 oxygen postfix/smtpd[23212]: NOQUEUE: reject: RCPT from unknown[62.233.163.250]: 550 5.1.1 : Recipient address rejected: User unknown in local recipient table; from= to= proto=ESMTP helo=<250.248/30.163.233.62.in-addr.arpa>

We can see (actually, guess, in my case) that the IP is the 10th ‘column’ (using a ‘space’ as a delimiter). So we can begin a rudimentary script to print out just that:

# grep bumttwagnerfor /var/log/messages  | awk '{ print $10}' | head
unknown[211.49.17.175]:
81.202.185.36.dyn.user.ono.com[81.202.185.36]:
host-89-228-234-224.kalisz.mm.pl[89.228.234.224]:
LSt-Amand-152-32-14-78.w82-127.abo.wanadoo.fr[82.127.29.78]:

But there’s an obvious problem: the hostname is rammed up against the IP. I want to just ban the IP, and strip out the hostname. The correct way is to write a lengthy regular expression to match just whatever’s between the [ and ]. (Note that you can’t just write a regular expression to match IPs: the very first one has an IP in its hostname, for example, which would throw you off.)

The quick and easy solution is to replace the [ with a space and the ] with a space, which gives you “hostname IP “. And then you use awk again to print it:

grep bumttwagnerfor /var/log/messages | awk '{ print $10}' | sed "s/[/ /g" | sed "s/]/ /g" | awk '{print $2}'

This is a pretty ugly command. Just the way I like it. 😉

But we’re not quite done! The format for hosts.deny is “Service: Address.” We’re just getting addresses here. I want the output to be something like ALL: 1.2.3.4 for each entry. (If they’re spamming me, I don’t want to allow them access to any other services.)

When it’s all said and done, here’s the command:

grep bumttwagnerfor /var/log/messages | awk '{ print $10}' | sed "s/[/ /g" | sed "s/]/ /g" | awk '{print "ALL", $2}'

You can just append a >> hosts.deny to deny them right away, or parse it through head or less to review first.

And viola. 440 IPs banned.

Seriously, though. wtf is going on? 440 different people have tried spamming this address that has definitely never existed.

Unwritten Rule of the Internet

All questions asked must receive a bunch of completely pointless answers.

Most recent example: I discussed how my camera was massively overexposing pictures. I explained that I shot in aperture-priority mode, meaning that I set the camera’s aperture and the camera will select an appropriate shutter speed. Shooting a bright white sign in direct sunlight, with an f/4.5 aperture, it selected a 1/45 second shutter speed. This was wildly inaccurate. I also walked through a, “You might think what I first thought” thing where I debunked a few of the answers I knew I’d get: that I’d maybe shot at ISO1600 or something, and that I had maybe switched to Manual mode by accident. I explained that neither was the case. I also explained that I ended up switching over to full-manual mode, where I got some great shots, so that it seems to be a problem with metering.

A few people gave helpful answers. But I also got a lot of replies like, “Your shutter speed was far too low. It should have been 1/1,000th of a second.” (Thanks, Sherlock. Do you understand aperture-priority?) Someone else suggests that I was maybe in manual mode by accident. Despite having already stated that I wasn’t, I explained that I had last been doing night exposures, so manual mode was set for a 30-second exposure. “I’d definitely have noticed,” I explained. Another helpful person suggested that I could have just switched to manual mode and set an appropriate shutter speed myself.  Thanks for not answering the question of what was wrong and not even reading the whole thing, where I mention that I did just that in the end.

And I started a huge argument in another thread by pondering aloud why no one ever made a zoom lens faster than f/2.8. I wondered if it was some physical limit that I didn’t understand. People are now talking about how on the 5D you can use ISO6400 which offsets the need for a fast lens, and arguing over whether or not an f/2.0 zoom for a non-35mm body is the same as if it were for a 35mm body, and whether f/2 really means f/4. And then someone argues about, “What is ISO, really?”

Seriously, be careful about asking questions on the Internet. Most of the answers you get probably won’t answer your question at all.

Software or Hardware?

For a long time I collected Motorola radios. I soon realized a “trick” — a lot of them had the same ‘guts’ and just had different software controlling them. If you cut the little “stopper” off of the channel knob on the channel knob and changed 2 bytes in the firmware, you had a 16-channel radio.

The higher-end radios were even more seriously software-dependent. The price of a radio could go up hundreds of dollars (thousands when new) depending on the features it has. But it turns out that the whole series had the same hardware, and various features were loaded via software. (This was actually publicly-known.) Soon, people realized how to suck the software out of one radio and drop it into another radio, and suddenly most hobbyist-owned radios had just about every feature possible.

I’m getting out of the radio trade, though. I began by getting a lot of two Canon digital SLRs off of eBay. The two cameras were very similar: both, in fact, had the same sensor. I kept the 10D, which was bigger and had a solid-metal casing, and sold the 300D, which was smaller and had a silly silver plastic case. Mine has a bunch of features that the 300D didn’t: ISO3200, the ability to control flash brightness, and a whole mess of “Custom Functions” that let you fine-tune things, to name a few.

It turns out that I was more right than I realized about them being closely related, though. There’s a firmware hack that brings a lot of the 10D functionality to the 300D. (All the ones I mentioned and then some!) Of course some features are missing: you can’t select autofocus points, for example.

But it’s interesting to learn that model differentiation via ‘crippling’ features in software is more prevalent than I’d once believed.

Wung Fah

We looked into the cost of hiring a coach bus for the day. $1,300.

Multiply that by 5 and you can buy a used coach bus. (Granted, they’re easily $200,000 new, but there are a ton of used ones, and they’re the type of things that are usually driven until 1,000,000 miles or so.)

Assume 200 miles. (This is actually way, way more than we need.) 8 miles to the gallon. (You may do better.) $3/gallon. That’s $75 in fuel.

Assume you pay the driver very well: $20 an hour, and that we have the bus for 8 hours. (He surely makes less, and we don’t need 8 hours.) $160 in labor.

I want to start my own bus company. (More for being hired out for the day than anything than being a Greyhound / Fung Wah, though.) I think I could do it for a lot less.

Buy something like this, spruce up the interior (carpeting?), and re-install the seats, and you’ve got one heck of a bus with 750,000 miles of life left. And, apparently, 100 gallons of fuel already in it…  $10-15,000 buys a nice, complete bus.

$750 a day… Assuming $20,000 fixed costs, you break even after 26 days. You have variable costs (fuel, labor, insurance), too, but really, I think that if you could book the bus regularly, you’d do well.

Oh, and there are lots of little “extras” you could do. Replace those huge old TVs with a few LCDs. Probably under $1,000 total cost if you do it yourself? And, in lieu of showing a movie / TV, you could always do an airplane-style display of where you are or something… Or show ads! No direct value, but I think it’d raise the perceived “value” of the bus.

You could invest your profits into a budget limo service. You compete in the taxi market, not the limo market. If I had the choice in riding in a 12-year-old limo (after removing the garbage from the floor?!) or riding in a taxi, I’d pick the limo. Although I wager most of the costs there are variable costs: labor, insurance, maintenance (probably big on a really old American car?), etc. But really, you’re paying less than it’d cost to buy a used taxi. And this one is even less!

Stupid, Stupid!

In Windows, often I’ll open something from the web, edit it, hit save, and then close it.

And then I have no clue where it is, because it saves it to a “Temp” directory.

Worst of all, because you open it from the web and not disk, it doesn’t how up in “Recent Documents.”

There are several ways this problem can be fixed. But no one has. It’s been a problem for years, too. And I can’t stand it!

Technology

Two thoughts…

(1)  As someone who’s done a lot of work with SQL and web interfaces, today’s XKCD is hilarious.

(2) We’re currently trying to send out a fax. There are two of us, both tech-savvy, trying to figure it out. And we just have n0 clue. The screen says “WAITING TO DIAL 02%.” Kind of like, “PC LOAD LETTER” — what the @#$# does that mean? (I get the “Waiting to dial,” but 2% waiting?

A Plea to Camera Makers

Dear camera makers,

Canon’s 1Ds Mark III is 21 megapixels. Please, acknowledge that Canon has won on the megapixel front, and move on. My camera’s resolution is 6 megapixels, and I have a flawless 20×30″ print from it. 21 megapixels is too many for most uses. Going further is wasteful.

Nikon has the right idea, though: improve things other than resolution. My camera maxes out at ISO3200, and the pictures are very bad there. Sometimes, though, ISO3200 isn’t enough. In a dimly-lit room, there are times when ISO3200 still gives me 1/8 of a second or slower shutter speeds. My lens is pretty slow, with f/3.5 as its widest, but even using something like Canon’s 50mm f/1.2 lens, I might not be able to get a useful shutter speed.

Nikon’s D3 goes up to ISO25,600. The images are practically useless at that point. But at least they’re trying. To you camera makers, I present a challenge: top them. I want to be able to shoot at ISO25600 (“25K?”) and get clean images. Can you do it? I bet you can, especially if you quit trying to one-up unnecessarily large resolutions.

Oh, and give us innovative new features, too. Or let us write our own apps! Why isn’t there “aperture bracketing?” Say I’m not sure whether f/4 is enough depth of field. Why can’t I take the picture at f/4, f/5.6, and f/8 and decide afterwards?

Why, on a camera body that cost $2,000 new, is there no “intervalometer” to let me, say, automatically take a picture every 5 seconds? I can buy a $150 accessory to do it, but is it really that hard to make it a software feature?

HDR photography is all the rage. Why not have an “HDR Composite” feature, that will meter for the darkest region, meter for the brightest region, and automatically bracket across the whole range? (Bracketing is not at all new, but it’s “dumb” bracketing — I can do +1/-1 or +2/-2. What if I want to go from +3 to -5 in 16 steps?)

Why do no cameras have an embedded GPS? It’s not the most useful feature, sure, but it’s cool. Make it a “module” people can upgrade to. I’d be awfully tempted to buy it.

It’s slowly becoming a reality, but why not have a USB2 port and let me plug in accessories? Currently USB2 ports are just for copying images to your computer. Why can’t I stick my thumb drive in and record to that? Or my external hard drive? And why can’t I just copy pictures over to my external hard drive right from the camera? Why do I need a computer?

Why are the LCDs on back such low-resolution? Play with an iPhone for a while, at 160ppi, and then look at any camera’s LCD. It looks like comparative crap. That LCD is important, too: I’m trying to see how my image out. Why would you give me a piece of crap for that? I’m yet to see a camera with an interface that doesn’t look like it predates Y2K, either. Again, play with the iPhone. It just looks cool. Don’t overdo it, but would it kill you to at least make the interface on your cameras look nice?

Some really high-end lenses have an IS/OS feature — basically, the lenses compensate for minor shake through the use of a gyro. This feature gets rave reviews from anyone able to afford the $2,000 lenses. Why not build an IS sensor into your camera instead, so that, regardless of lens, your sensor stabilizes for minor shake?

Please, camera makers of the world, quit it with megapixels. Let’s go for some innovation.

Car Cleaning

Having spent at least a month in the parking garage, my trip home was a clear cry for help from my filthy car. And if you’re going to do it, you might as well do it well.

I found some stuff called Krud Kutter. It’s a strong cleaning product. So I used lots of it. There were a few spots (like my gas cap) that had lots of caked-on dirt. I also used it on the base of the car, which had gotten quite dirty. As had, not shockingly, some parts under the hood, and my wheels. I’m telling you, wheels are the secret to having your car clean.

I first sprayed it where needed, and then let it sit while I went and got the hose set up. About five minutes later, I hosed off the car. Already, it was looking much better.

Turtle Wax apparently makes a car wash solution that’s supposed to leave a ‘hard wax shell.’ I don’t believe that, because I cleaned my windows with it too, and there’s definitely no hard wax shell on my windows. Of course, while scrubbing the car clean, you’ve got to re-apply the Krud Kutter and scrub the dirty parts, which suddenly looked much cleaner.

When all was said and done, you dry it off with a Calfironia water blade. It makes quick work of drying your car. (If you don’t dry the car, you’ll get water spots everywhere and it’ll end up looking worse.)

Take a break to let everything dry completely, including the tires. (Actually, I cheated and used another cloth during this time to scrub the wheels with Krud Kutter and a rough sponge again: using the same cloth you’re cleaning the car with is just asking for trouble.)

With everything dry, there are some more steps:

  • Re-apply Rain-X to the windows. I find that you just need to do front and rear, the front side windows, and the mirrors.
  • Since it’d been a long time, I used a clear-coat safe polish. It was supposed to be a wax, too, but I was using it for the polish qualities. (In theory, a polish is slightly abrasive, so you’ll end up with a much shinier finish, and the extremely thin scratches that had been built up disappeared.)
  • As I waited for that to dry, I used Armor-All on the tires. It makes much more of a difference than I expected the first time. Over time your tires turn a dull gray, and your wheels go from silver to, well, dull gray too. Having just gotten the wheels shiny, the tires still looked their dull gray. After applying the Armor-All, they looked pretty much brand-new. But they don’t have that ridiculous shiny look that the tire-shine sprays do.
  • With that done, I now had the tell-tale white haze all over my car from the polish/wax. I took a cloth and wiped the car down. (Hint: for an SUV, you’ll really want more than one cloth.) It’s important to note that the car has to be spotlessly dry, or you’re wasting your time wiping it down: any moisture will just smear the white haze around and make it look even worse. It’s not a fatal mistake, you can wipe it down when again when it dries. It’s just a colossal waste of your time. The key is to dry your car prior to polishing/waxing, but there’ll inevitably be some little bits of moisture anyway: so you just get them as you’re waxing. You’re supposed to apply it with a damp cloth anyway.
  • You always follow up a polish with a wax. I’m a big fan of this wax, which smells so good that I want to bathe in it. Let that dry and then wipe the haze off.
  • Here’s a secret: when you’re done waxing the car and you need to wait a few minutes for it to dry, wax your wheels. No, really. Not only will they shine more, but it’ll make it harder for brake dust and tar and the like to stick to them. Even having scrubbed them super-clean, I do them last, to make sure any dirt on them doesn’t get transferred to my car, where it may scratch the paint.
  • While waiting in between steps, you can apply Armor-All to other plastic/rubber surfaces. (In my case, some trim around the engine, a plastic cover on the rear bumper, the rear windshield wiper, and the ‘knobs’ on my roof rack.)

You don’t want to go too crazy, but it’s worth mentioning that you can clean your engine, as long as you know what not to mess with. (E.g., I wouldn’t spray the battery with a hose, and I avoid certain things that don’t look like they should get wet; overall, an engine’s pretty well suited to getting hosed down. Just make sure it’s cool, or you risk enormous problems!) I’ve cleaned the engine before, so it wasn’t that dirty, but a little Krud Kutter in strategic places got it looking much better, and then Armor-All on some hoses and plastic covers that looked like they could use it. Just use common-sense when doing this: components that are greased probably shouldn’t be sprayed with a degreaser, for example, and steer clear of things like filters, although they’re covered most of the time anyway. While I’m in the engine, I give it a basic once-over: I’m no mechanic, but it’s simple to see if the liquid reservoirs need refilling. I just had to top off my windshield washer fluid, which I just did with water.

It makes sense to me to clean the inside of the car at the same time. I usually do it afterwards, as I usually end up standing inside the car to reach the roof. The steps here are pretty common sense: pick up garbage, vacuum, clean the windows, dust, and wipe down with Armor-All where appropriate. Oh, and make sure the clock is accurate. That’s a pet peeve of mine. Follow the advice on the Armor-All bottle and don’t apply it to your steering wheel or pedals, because they’ll become slippery.