Six of one, half a dozen of the other

I just read the following in a brochure:

(Such and such) is optimized for label printing with the ability to print 2” per second in black and 10’ per minute with full color.

Unit conversion in comparisons can be used to make a stat seem better than it really is (or worse, if that’s your goal). Color printing is usually slower than B&W printing (on account of there being a lot more data/work involved), and I’m curious how much slower it is, but in this case, I think someone just messed up:

  • 10’ = 120”
  • 1 minute = 60 seconds
  • 120” per 60 seconds = 2” per second

I wonder if it was supposed to be 10” per minute instead of 10’…

Neat SQL Query

Update a table according to the results of another query (slightly simplified):

UPDATE letters AS final
   SET preview_file_id = outer.preview_file_id
  FROM (SELECT letter_id,
               (SELECT preview_file_id
                  FROM inserts AS i
                 WHERE i.insert_id = inner.insert_id) AS preview_file_id
          FROM (SELECT letter_id,
                       MIN(insert_id) AS insert_id
                  FROM letters AS l
                  JOIN letter_insert_ref USING (letter_id)
                  JOIN inserts AS inner_i USING (insert_id)
                 WHERE l.preview_file_id IS NULL
                   AND inner_i.preview_file_id IS NOT NULL
                   AND l.submitted > NOW() - '1 month'::INTERVAL
              GROUP BY letter_id) AS inner) AS outer
 WHERE final.letter_id = outer.letter_id;

Or, in something resembling English, “In the letters table, set the preview file according to the following list of recent letters and the associated preview files for the first insert of each of those letters.”

There might be a way to simplify the two sub-queries into just one using grouping, ordering, and limiting, but this worked well enough for a one-off query.

Background: I thought I no longer needed the preview_file_id field in letters, so I deprecated it recently, and stopped setting it. The API layer had a workaround, but there’s still a program that uses a database view that needs the preview_file_id to be set in letters, so I needed to revert that change and back-fill the preview_file_ids that didn’t get set. UPDATE FROM to the rescue!

(Also, if anyone has any layout suggestions on how to make complex SQL more readable, I’m all ears. I’ve been center-aligning to the keyword for years just because I haven’t found anything better.)

Vermont Income Tax Withholding Form

Vermont’s form for submitting taxes withheld has enough boxes on the “Vermont Income Tax Withheld” line for an employer to withhold $999,999,999,999.99 per quarter.

Yes, that’s one cent shy of $1 trillion in state taxes. Vermont’s overall personal income tax collections for 2008 totaled $622 million and change ($83,042 in change, but who’s counting?), a quarter of which would be $155.5 million. So, I suppose that if Vermont has one exceptionally large employer, accounting for two thirds of all salaries in Vermont, one could actually use all those boxes.

It really makes my contribution seem rather measly, though. It’ll take some growth before I’ll be contributing $100,000,000+ in state income tax on a quarterly basis, even assuming I discriminate based on geographical origin and hire all future employees from Vermont.

(“Some growth” = using loose assumptions, and ignoring scaling issues, my customer base would need to include roughly one missionary for every ten people on the planet. Give or take.)

Credit Card Forms

Back when I was looking for office space, I gained a keen interest in loading docks. One evening, I actually drove around town looking for any building with a loading dock, to see what kinds of businesses had them, where they were located in the building, and how much the truck driver would be swearing in order to try and get the trailer to fit (i.e. what kind of driveway was involved, and whether the truck had to block traffic on busy roads in order to back in). There are all sorts, and I still go out of my way to look around when I come across a new building.

The space I ended up leasing doesn’t have a loading dock, alas (it had everything else on my list, unlike other places I was considering), but at least it’s easy for trucks to get in and out (they can back in without needing to block traffic, and it’s a straight shot).

Now, I’m in the process of improving how I handle credit cards. So, once again, I’m getting geeky with my research, this time looking intently at other sites’ checkout forms, paying for and downloading a 63-page usability report on checkout design (I’m very curious how well that site’s checkout lines up with its design recommendations), and so on.

Eventually, I figure I won’t be able to look at anything remotely commercial without evaluating its pluses and minuses in terms of usability, efficiency, and customer satisfaction.

Watching a Spam Bot at Work

I started tracking error messages on one of my production sites over the weekend, wherein I get notified whenever there’s an error, rather than it just going into a log that I’ll probably never read unless someone brings it up.

It’s a good practice — usually the errors are due to little bugs that I can fix before the person has finished reading the (customized) error page letting them know that the bug is my fault and that I’ve been notified. They hit reload, everything works, and everyone’s happy.

404s are errors, too, though they’re not always my fault, so I have a different error page for those. Sometimes they are, and I can usually fix them just as quickly. Sometimes they’re the result of people mistyping links into their own sites, and I can notify them about that, or write a redirect.

And sometimes I get insight into the latest scams, viruses, and bots that are running around in the wild. Today’s the latter. I just got quite a few notifications, all at once, from a couple dozen different IP addresses (i.e. zombies), from someone who’s apparently trying to put comment spam on one of my sites. It’s fun to watch, as it’s not going to work, for three reasons:

1) There’s a captcha as a simple deterrent (which works surprisingly well, all told, though it’s not perfect).

2) There’s a moderation system — posts don’t show up until they get approved.

3) Even beyond the above two, which have eliminated all spam to date, the reason I’m absolutely 100% confident that this spammer isn’t going to be successful is because the page that all the zombie bots are trying to access doesn’t exist any more.

As Seen in a Letter

Kevin does nearly all of the proofreading now (nearly all = I proof roughly one letter a month), so there has been a definite shortage of quotable PLS Observations here lately.

However, we just got a file that opens on my computer and not his, so I got to witness this one:

[So and so] is a large animal vet.

Nicely ambiguous. I added a hyphen.

I am a quaint old innkeeper; I keep this quaint old inn.
— Hansel and Gretel and Ted and Alice.

A note to network administrators everywhere

When making changes to your network layout, be sure to update the monitoring program as well (e.g. Nagios). If you don’t, and the IPs are different enough, and you wait a while before updating the mail server on the monitoring server…

Well, let’s just say that the queued up E-Mails are still coming in half an hour later, and it’s only for the last three days of “trouble” notifications, though thankfully it’s down to a rate of about one E-Mail per second due to throttling.

Sign of the Times

I just got a call from a telemarketer claiming to specialize in corporate acquisitions, who said (in what I’m guessing was a recording) that her company has a buyer who’s potentially interested in acquiring my company.

That’s new. Most telemarketers want me to buy imprinted pens or credit card terminals. This one gets bonus points for creativity.

They got the direction wrong, though. I’m much more interested in acquiring a similar company than I am in selling mine. Global economic disaster or not, I’m still enjoying the work, and it’s still paying the bills.

Driving Challenges

Ever since before we bought our new house a couple of months ago, it was looking like the road leading up to it was going to be one of the more… let’s say interesting aspects of home ownership in this particular location. Parts of it are quite steep, including a fairly sharp kink, and it becomes a dirt road partway through.

It’s better than some of the other roads or driveways we were considering, though, and it ended up not being a deal-breaker (a conveniently-timed blizzard let me check that out before we bought). It’s maintained by the town, unlike the adventure-ridden driveways of a few houses we were looking at, and the town appears to be good at maintaining it.

Well, mud season officially started on Saturday, and my word for the road was “Wheeee!” The road has a posted limit of 6 tons for the next couple of months, but I think the town is somewhat generous. I probably would’ve posted the limit at about 50lbs, because that’s more or less all it takes to deform the road. A vehicle over six tons would probably never be seen again. Both Christine and I have all-wheel drive in our vehicles, and they’ve been getting a workout.

Today, it’s going to be even more fun, as the temperature is now right around freezing, and the road is covered by about six inches of snow, so you can’t see where the ruts are, but there’s a decent chance they’ll still be shifting underneath the snow.

Wheeeee!

One server, two ISPs

It has only taken a year and three days to get running, but I finally have an on-site server responding correctly to IP addresses on two different ISPs, at the same time, without crashing either of the routers or doing unspeakable things to their firewalls.

And as an added bonus, I even understand why it’s working, I think.

Syndicate content