Tip o’ the Day

The Web Developer toolbar, which is (1) the #1 hit on Google for “Web Developer,” and (2) now compatible with Firefox 3 beta, is totally awesome. You may recall that, in the past, if you had text after a bulleted list or similar on this page, the text would suddenly be mashed together. I never took the time to fully look into it, but it always irked me.

A quick “Outline… Outline Block Level Elements” drew colored boxes around each element of the page, which was exceptionally helpful. This shows the problem: posts start off inside a <p> tag, and adding a list or similar closes the <p> tag. This would have been an easy catch, except that the list looked fine. Upon a closer review, it’s because the lists specified the same line-spacing, thus looking right. While I most likely could have solved this by staring at the code for a long time, Web Developer made it much easier to spot: the first text is inside one box, followed by the list, but the other text is floating outside, leading to a quick, “Oh, I should look at how the <div> is set up” thought, which ended up being exactly the problem. (There’s a bit of excessive space now, but that’s caused by me using PHP to inject linebreaks.)

Web Developer also includes a lot of other useful tools, including the ability to edit the HTML of the page you’re viewing, view server headers, resize non-resizeable elements frames, show page comments, change GETs to POSTs and vice-versa, and much more. Whether you do design full-time, or if you just occasionally fix things, it’s worth having. And you can’t beat the fact that it’s free.

Web Compression

I’ve alluded before to using gzip compression on webserver. HTML is very compressible, so servers moving tremendous amounts of text/HTML would see a major reduction in bandwidth. (Images and such would not see much of a benefit, as they’re already compressed.)

As an example, I downloaded the main page of Wikipedia, retrieving only the HTML and none of the supporting elements (graphics, stylesheets, external JavaScript). It’s 53,190 bytes. (This, frankly, isn’t a lot.) After running it through “gzip -9” (strongest compression), it’s 13,512 bytes, just shy of a 75% reduction in size.

There are a few problems with gzip, though:

  • Not all clients support it. Although frankly, I think most do. This isn’t a huge deal, though, as the client and server “negotiate” the content encoding, so it’ll only be used if it’s supported.
  • Not all servers support it. I don’t believe IIS supports it at all, although I could be wrong. Apache/PHP will merrily do it, but it has to be enabled, which means that lazy server admins won’t turn it on.
  • Although it really shouldn’t work that way, it looks to me as if it will ‘buffer’ the whole page then compress it, then send it. (gzip does support ‘streaming’ compression, just working in blocks.) Thus if you have a page that’s slow to load (e.g., it runs complex database queries that can’t be cached), it will appear even worse: users will get a blank page and then it will suddenly appear in front of them.
  • There’s overhead involved, so it looks like some admins keep it off due to server load. (Aside: it looks like Wikipedia compresses everything, even dynamically-generated content.)

But I’ve come across something interesting… A Hardware gzip Compression Card, apparently capable of handling 3 Gbits/second. I can’t find it for sale anywhere, nor a price mentioned, but I think it would be interesting to set up a sort of squid proxy that would sit between clients and the back-end servers, seamlessly compressing outgoing content to save bandwidth.

So I Can Close the Tab

I came across Ken Rockwell’s site the other day, and, as I perused a lot, I came across his interesting mention of the Casio EX-F1. I’ve “graduated” from integrated point-and-shoots to digital SLRs, although this camera costs more than my digital SLR and three lenses put together.

Photographically, it’s mediocre. 6 megapixels. Except you don’t buy this thing for its resolution. You crave it because:

  • 60 frames per second at 6 megapixels. (Note that most movies are shot at 24 fps.)
  • “[S]tereo HDTV movies,” although I confess that I’m not quite sure what that means.
  • Continuous shooting mode, where it’s just constantly shooting at 60fps, and, when you hit the shutter, saves the ones around that time. Thus, you can actually get shots from before you click the shutter.
  • A maximum shutter speed of 1/40,000 second. That is not a typo.
  • 60 frames per second is ridiculous. But if you can take a cut in resolution, you can go further, all the way to 1,200 frames per second at a pitiful 336×96.

Actually, 336×96 isn’t just tiny, it’s a really weird size. I’ve resized (and cropped) a random photo of mine down to 336×96:

336×96 Pixels

In conclusion… 6 megapixel camera, with a long zoom lens equivalent to 36-432mm. And it’s an HDTV video camera. And it’s got the crazy bonus of letting you use shutter speeds of 1/40,000 of a second, and capture low-res video at 1,200 frames/second. I wouldn’t carry it as my main camera (though it would probably be entirely usable for that), but I’d love one of these in my bag for video and such.

I also wonder about the “trickle-down” effect. Although really, more like the “trickle-out effect.” Nikon’s D3 will give pretty clean shots at ISO 6400, something no other camera even tries to offer. It goes up to ISO 25,600. Canon and Nikon are very close when it comes to the frames-per-second rate of their high-end digital SLRs; 7-9 frames/second. (Hint: get rid of the shutter, which is useless on a digital camera where you can just “read” the sensor for a given period of time.) Companies keep focusing on packing more and more megapixels into smaller and smaller sensors. As I’ve said before, I have a 20×30″ print from my 6-megapixel camera. (Cropped a bit, too, actually.) I only “upgraded” to my 10-megapixel XTi because the old one broke and you can’t buy a 6-megapixel SLR anymore. Maybe, just maybe, we’ve seen an end to the megapixel arms race. We exceeded the resolution you could squeeze out of film a long time ago, and now we’re giving medium format a run for its money. When I go to buy a new SLR in maybe five years, I don’t want it to be more than 10 megapixels. But I hope that it goes a lot further than 6 megapixels. And if a “prosumer” point-and-shoot camera does 60 frames per second at full resolution, all of a sudden 3 frames per second on an SLR looks pathetic. Similarly, I’m unaware of any still camera (aside from maybe weird scientific-engineered stuff) that will take a 1/40,000-second exposure, or any flash that’s capable of running at 7 frames per second.

(That said, I’m having a hard time figuring out when you’d need a 1/40,000-second exposure. I only hit my camera’s 1/2,000-second limit when I’m too lazy to stop the lens down…)

Eyedness

I mentioned in my previous post in passing about determining which was my “dominant eye,” something I’ve merrily gone 22 years without knowing I had.

Wikipedia refers to the subject as ocular dominance. Essentially, the brain “prefers” one eye over the other. Of course, this is something that ordinarily goes unnoticed, but it becomes quite important in some things, including, apparently, firing a weapon. There are two easy tests to determine your “eyedness,” as Wikipedia strangely lists as an accepted name:

  • Focus on a distant (6-10 feet is plenty) object. Hold both arms out in front of you, overlapping, and form a golf-ball-sized circle between your thumbs, viewing the image through it. And then, do one of the following:
    • Slowly pull your hands towards your face, keeping the image centered in the hole. Eventually, your hands end up in front of one eye. That’s your dominant eye.
    • Rather than pulling your hands back towards you and looking ridiculous, close one at a time. With one eye, you won’t be able to see the object: your hand covers it. (If you can see it through both, the hole through which you’re viewing it is way too big.) The eye you can see the object through is your dominant eye.
  • Or, with both eyes open and without paying too much attention, point at a distant object. (Don’t look at your finger or you’ll screw things up and have to start over.) Hold your arm steady and close one eye at a time. One finger will be pointing (more or less) right at the thing. The other is pretty far off. The one that’s accurate is your dominant eye.

Of course, I’m left wondering a few things:

  • Can you accurately use your non-dominant eye? With one eye closed, if you can align the sights of a gun with your target, isn’t it still going to be accurate? I’m trying to ‘test’ this, but doing it with a flashlight isn’t accurate enough, and I don’t have a laser pointer. Further, I feel like a total goofball sitting here squinting with one eye and shining a flashlight at the electrical socket on the other side of the room. To align the flashlight and flashlight, I do shift the flashlight a little, but in both cases, it’s being pointed in the same place; it’s just a question of the angle.
  • Can you change your dominant eye through practice or the like?
  • What are the implications in daily life of having your dominant eye be your weaker eye? Uncorrected, I’m something like 20/300 in that eye. Would my perception of scenes be better if my dominant eye was the one with better vision?
  • The Wikipedia page makes a cursory mention of the two eyes and how they’re processed by the two brain hemispheres. Does this related to being right-brained or left-brained? Is this like the spinning girl and seeing whether she spins right or left?

Photography

I’ve had yosigo in my Flickr contacts list for a while now, as I’m a fan of their work.

Check out this photo, for example. It’s a very simple photo, and any of us could have taken it. He didn’t do a ten-minute exposure with a special lens, and he didn’t use any fancy filters. Contrast hasn’t been bumped up in Photoshop. A five-year old with a camera could take this shot.

And yet, no one else did. While we’re all out there hunting down elaborate shots of obscure subjects in perfect lighting, he’s taking shots like these. Incredibly simple; that seems to be his trademark.

In learning photography, we all learned the Rule of Thirds. Never center something in the photo. Imagine a 3×3 grid, and “center” on one of those. Tell him that. He keeps taking ultra-simplistic shots, and they keep being amazing.

Perhaps most “frustrating” as a photographer, though, is that I feel that it’d be very easy to imitate his work, and yet almost impossible to maintain the “Wow” factor of his photos. If I took a photo of a plate with a piece of bread on it, it’d probably wind up in my “delete” pile.

High Voltage!

I’m actually not entirely sure how finding these videos began, but some shocking videos for your enjoyment:

  • Crazy man throws a wire on 110 kV power line” is about as accurate a title as they come. (Highly, highly not recommended!) It’s essentially the same deal as a lightning strike: one end of the wire is connected to ground, and when the wire makes contact with the 110,000V power lines, it shorts to ground.
  • This one is even more absurd? Someone provides a translation of the Russian: they’re 500kV lines, and some idiots throw barbed wire (?!) onto the lines. You can’t see them throwing the wire, though, so there’s just a tremendous explosion as 500kV rushes to ground before, most likely, vaporizing the wire.
  • This one is really bizarre to me. One description says they’re using “splicing technology,” and another explains that they’re “strengthening the lines.” Neither really gave any explanation to why there’d suddenly be a tremendous explosion and plumes of smoke from all of the insulators. It looks like they sent enough voltage on the lines to jump across the massive insulator. (Which is like a six-foot chunk of porcelain, chosen because it’s ridiculously non-conductive.) Rusty gave a good explanation: it seems that they’ve applied something-or-other on the lines, and are essentially “flash-welding” it on.
  • Substations often have “air break disconnects,” which are essentially a big, metal, mechanical arm that they can “open” to keep electricity from flowing. The design wasn’t meant to to switch “hot” loads, though. Here’s a video of them opening the disconnect on a 230kV line, which… Well, just watch. (It shorts to another wire after a few seconds.)
  • Here’s something sort of similar, except it appears that it’s more of a technical failure. It turns into somewhat of an accidental Jacob’s Ladder, before it burns itself out in a fantastic fashion.
  • This is a neat compilation of various high-voltage “problems.” I actually saw a neat explanation somewhere of what happens in the first video… Something in a high-voltage transformer there shorts to ground, but nothing upstream ever tripped a circuit breaker. The transformer is filled with oil for cooling, before finally it becomes hot enough that it boils and starts spewing ‘steam’ (boiling oil) out its ’emergency’ valves, which makes things much worse, but is actually fortunate in that it blows up the incoming voltage, leaving firefighters with a simple de-energized power grid full of burning oil to deal with. The second is another case of them opening a mechanical “air break” disconnect, apparently in a deliberate test of a 500kV system. Then we see the same clip we saw earlier, and then… The most awesome thing ever. I have absolutely no clue what goes on, but it’s the most awesome fireball ever.

Google Charts

Have you guys seen Google Charts? It’s a quirky little API I didn’t know existed until I saw a passing allusion to it. Essentially, you pass it a specially-crafted URL (essentially the definition of an API) and it will generate a PNG image.

Here’s a fairly random line graph. My labeling of the axes makes no sense, but it was nonsensical data anyway.

One of the cooler things they support is a “map” type of chart, like this US map. The URL is a bit tricky, though this one of South America is easier to understand: chco (presumably “CHart COlor”) sets the colors, with the first being the ‘default’ color. chld lists the countries, as they should map up to the colors: UYVECO is “Uruguay,” “Venezuela,” and “Colombia.”

What has me particularly interested is that I’ve recently installed code to watch connections to my NTP servers. Here’s my Texas box, a stratum 2 server in the NTP pool (pool.ntp.org). I bumped it up to list a 10 Mbps connection speed to signal that I could handle a lot more queries than the average, although it’s still nowhere near its limit. In addition to the stats you see there, it keeps a “dump file” of every single connection. (As an aside, this strikes me as inefficient and I want to write an SQL interface to keep aggregate stats… But that’s very low-priority right now.)

Further, I have some IPGeo code I played with. More than meets the eye, actually: a separate database can give a city/state in addition to the country. (It comes from the free MaxMind GeoLite City database.) Thus I could, in theory, parse the log file created, match each IP to a state, and plot that on a US map.

This reminds me that I never posted… I set up NTP on the second server Andrew and I got, where we’re intending to consolidate everything, but haven’t had time yet. It sat unused for a while, keeping exceptionally good time. So, with Andrew’s approval, I submitted it to the NTP pool. I set the bandwidth to 3 Mbps, lower than the 10 Mbps my Texas box is at.

I was somewhat surprised to see it handling significantly more NTP queries. (They’re not online, since the box isn’t running a webserver, but for those in-the-know, ~/ntp/ntp_clients_stats | less produces the same type of output seen here.) It turns out that a flaw in the IPGeo code assigning the server to the right ‘zones’ for some reason thought our server was in Brazil. Strangely, while the United States has 550 (at last count) servers in the pool, South America has 16. Thus I got a much greater share of the traffic. It’s still low: at its peak it looks like me might use 2GB of bandwidth.

So there are a few graphs I think would be interesting:

  • A line graph of the number of clients served over time. Using Google Charts would save me from having to deal with RRDTool / MRTG.
  • A map of South American countries, colored to show which of the countries are querying the server most frequently. (The same could be done for my US server, on a state-by-state basis.)

News Anchors, Awesome

Wasting time on YouTube:

  • Insane News Man” is pretty funny. Not until about the seventh time watching it did it occur that it was maybe a teleprompter problem, and the transition into his co-anchor being absent and a man being “murdered and then set on fire while celebrating his birthday” were two separate things.
  • This talkshow clip is in a foreign language (Dutch?), but I still can’t help but crack up laughing every time I watch this. You don’t need to understand what’s being said.
  • This weatherman is a classic. It’s a college station. Someone eventually interviewed him; it was his first time and the director kept distracting him by trying to give him cues, which just made things worse.
  • Off the topic of news anchors, “The worst hockey player!” is hilarious, if only because it would be me if I played hockey.
  • Worst Hockey Fight” is almost as good, although the first 20 seconds or so are worthless.
  • You might have seen this Home Shopping blooper before, but I’d never seen the full version before, which is where the hilarity lies. Long after it’s obvious that the horse picture he’s referring to is actually a butterfly / month, he continues calling it a horse, and even starts pointing out imaginary details.
  • This one, though, is even funnier, albeit much older. They’re selling “safety jumper cables” while the model shows off a poncho for no apparent reason, before the anchor very deliberately… Well, just watch.

Defaults

Fast Company has an interesting article talking about how the human race seems destined for laziness. Presented two choices, one the “default” (as in, it’ll happen if they don’t do anything), the other being far superior but requiring that they do something, most take the inferior default.

The main example is the “Save More Tomorrow,” where, in essence, most of your “raise” will be socked away into your 401(k) program, unless you request that your employer give you the money. (I assume there’s a lot more going on than them simply failing to give you your money.)

But he presents some other interesting statistics. Organ donors, for example. His example is Germany, but it’s the same deal here: you have to opt-in to being an organ donor. In Germany, 12% of people are organ donors.

Austria requires that you opt out of being an organ donor. What’s their donation rate? You could argue that it’d be close to 12%: for such a big decision, surely 88% of people don’t want to be organ donors. You could also take the other side of the coin: 88% of people were too lazy to check the box, so 88% of people would be organ donors.

But it’s a two-variable problem. In Germany (and the U.S.), the 12% is people who were willing to donate AND who cared to check the box. In Austria, you need the people who don’t want to donate AND who cared to check the box.

For this reason, 99% of Austrians are organ donors. Only 1% opposed being an organ donor AND took the time to opt out.

It’s interesting, then, to apply this to computer interfaces. How many sites, when you register, have “Sign me up for lots of spam!” checked by default? It always annoys me, but I bet they get a lot of people that way. They’re not militantly anti-spam, so they lazily leave the box checked.

When you leave a comment right now, please tell me what you think!