Radio

I’m a long-term radio geek, and I’ve realized that the technology interests me more than actually using it. Having worked with lots and lots of radios (I realized that I have three sitting on my desk, all of which I have used in the past 30 minutes), I’ve concluded that I’d like to start a radio company. Our motto would be, “Our radios don’t suck.”

One of my radios is a ham radio, which is front-panel programmable (FPP), meaning that you can punch in frequencies on the keypad. This is pretty common with ham radios. By contrast, land-mobile radios (things that, say, a police officer would carry) very rarely have FPP capability; in fact, the FCC frowns on certifying radios with that capability, except for certain federal agencies that need to be able to reprogram their radios in the field. However, it’s often offered as a software add-on. But even using the ham radio, it’s really hard to use. Part of the problem is that the radio’s probably a decade old, and the print on the keypad has worn off. So I’m guessing at what buttons do.

There are very few radios with a graphic LCD. Dot-matrix LCDs almost seem cutting-edge in the radio world. By contrast, try to find a cell phone that doesn’t have a big color LCD on it. I have an old Garmin GPS III, and still admire that screen. I think it’s four shades of gray, and fairly high resolution. It’s a nice graphic LCD. It’s so much easier to use, and introduces stuff like the ability to “arrow” around a screen, as opposed to trying to use obscure key combinations. I’d actually love to see something like a 2″ by 2″ e-ink display (which, in addition to looking amazing, would reduce power usage), but it’d be a pain since it’s slow to redraw.

Motorola’s MDC1200 technology is practically ubiquitious in the public safety industry, transmitting a 1200 bps data burst containing a four-digit identifier. This could be so easily improved. Put a little $20 GPS chip in it, and have it transmit GPS coordinates on each transmission. (You could also include stuff like battery level, if on a portable, and information on received signal strength. The latter would be useful to run in the background and plot a map of the radio system’s reach.)

Programming is always a pain. Some of Motorola’s radios are programmed in ways that are so obscure that they border on comical. (I think the goal there is security.) I want to write an XML file for my radio. Put a USB port on the side of the radio. Let me hook it up to a computer, or just plug a thumb drive in and reprogram from that. But consider bigger problems, though. Boston PD switched to an “improved” channel lineup last year. Apparently they worked for weeks to pull radios in at the end of a shift, load up the new set of data, but leave the radios set to old configuration, until all the radios had the new programming in them. And then, at a quiet time one day, they broadcast a message telling officers how to switch to the new configuration. Over-the-air programming is possible, but it’s generally used in some specific situations. (OTACS, Motorola’s Over The Air Channel Steering, to direct a radio to switch to a particular channel, and OTAR, Over the Air Rekeying, to send new encryption keys to the radios.) Why not let the system send out bursts of programming data when the radio system is idle, loading up new programming data in the background, until they’re ready? Obviously, all of these programming things need some security constraints, but that’s trivial to implement.

I’m pretty confident that software-defined radio is going to become ubiquitous in the next decade, but no one’s really making use of it yet, except for uber-geeks in labs. APCO’s Project 25 digital voice (IMBE) has emerged as a standard in digital voice, but it’s meant to be made obsolete in the future by a “Phase II” implementation. Various other technologies have come and gone, such as Motorola’s VSELP. And there exist myriad trunking protocols for larger networks. I want to embrace SDR and use it in everything, “future-proofing” radios. (Of course companies have an incentive to not future-proof their hardware, forcing people to upgrade… But you can still make your money on selling software upgrades!)

Oh, and put an SD slot on the darn thing. Record the audio it receives, letting people play back transmissions they miss. Or host applications. (Or, permit programming!)

Intuitive

GRE, a (radio) scanner company that makes a lot of the scanners Radio Shack sells, also sells some under their own name.

This new one advertises an “Intuitive ‘Object Oriented’ User Interface Design,” which brings all the fun of OOP to a GUI. The picture of the radio reads “Press NEW to create objects,” and has three softkeys, labeled “NEW,” “EDIT,” and “GLOB.”

I’ll reserve final judgment until I play around with one, but, on the surface, this seems anything but intuitive.

Resizing Images and HTML

This post is meant for webmasters, and it addresses a startlingly common problem: images included on pages and “resized” only in HTML.

The basic tag to include an image, of course, is <img src="something.jpg">. That will include something.jpg on the page.

But say that the image is 1600×1200 pixels (2.1 megapixels: big enough to fill your screen and then some, at least for most people). This is way too big to put on your webpage. So what do people do? They do something like <img src="something.jpg" height="480" width="640"> to resize it. This is a very, very bad way of doing it.

The problem is that this shows a fundamental misunderstanding of what the height and width attributes do. They’re essentially ‘hints’ for the browser. The web browser, when it sees an image in your HTML, will download the whole image. In this case, it’ll download your 1600×1200 image, which is probably about 500kB in size. (God help us if you have a whole series of these photographs on your page.) When it sees a mismatch between the specified height and width attributes, the browser will do a very rudimentary (read: very crappy) resize. So not only are you wasting a ton of bandwidth unnecessarily (which also makes your page load very slowly), but the end product is images that look horrible.

Instead, open the image up in your editor of choice. Photoshop CS3 is wonderful, but those of us who can’t justify spending more than $500 on image editing software may prefer a free tool like Paint.NET. Resize the image to the size you desire, and include that image, newly resized, on your page.

You’ll see multiple improvements: your site will use less bandwidth, your pages will load much faster, and your images will look much better. (Also: I’d encourage you to simply omit the height and width attributes if you’re not sure what you’re doing. Writing perfect HTML, you’d set them to the image’s native dimensions, but so many people screw it up that it’s probably safest to just omit them. Every browser I’ve ever used has handled this seamlessly.)

Internet Radio

I still remain a fan of SomaFM, a network of awesome streaming music.

Two interesting things I’ve come across, though:

The first is AACPlus. The webpage makes it look like a minor little project. But it’s being used by a number of streaming stations, and it’s supported by VLC and WinAmp, among others. What makes it notable is that I’m listening to a 48 kbps stream of one of Soma’s stations right now… And it sounds better than a 128 kbps stream. You can apparently drop it to 32 kbps and drop to just slightly less than CD quality, and at 24 kbps it’s still on par with MP3 streams. It works out great: it delivers high-quality audio to me, and instantly doubles (at least) the number of listeners they can handle, since bandwidth is almost always the “limiting reactant” with streaming audio.

In other news, the RIAA is apparently having luck getting Congress to raise webcasting rates enormously again… In some instances they’ll apparently go up by more than 1,000%. If you check out the Soma site, they’re coming up short on funding every month, pleading for donations to stay online. This is the case with a lot of streaming radio sites, too. They’re barely staying online as it is. Raising their rates by a factor of ten is going to kill Internet radio.

Tweaking SQL

I was thinking last night about solid-state drives. In their current form, they’re really not that much faster in terms of throughput: a decent amount are actually even slower than ATA disks if you measure them in terms of MB/sec throughput. Where they shine (100 times faster, at least) is seek time, though. So where they’re ideally suited for in a server environment right now is something with lots of random reads, where you might find yourself jumping all over the disk. For example, a setup with lots and lots of small files scattered across the disk.

Many implementations of a database would be similar. Something like the database for this blog will have a lot of sequential reads: you’re always retrieving the most recent entries, so the reads tend to be fairly close. But there are lots of ways to slice the data that don’t result in reading neighboring rows or walking the table. (And what really matters is how it’s stored on disk, not how it’s stored in MySQL, but I’m assuming they’re one in the same.) Say I view my “Computers” category. That’s going to use reads from all over the table. Using a solid-state disk might give you a nifty boost there. So I think it’d be fun to buy a solid-state disk and use it in an SQL server. I wager you’d see a fairly notable boost in performance, especially in situations where you’re not just reading sequential rows.

But here’s the cool link of this post. I’m not sure exactly what goes on here in a technical sense, but they use solid-state drives, getting the instant seek time, but they also get incredible throughput: 1.5GB/sec is the slowest product they offer. I think there may be striping going on, but even then, with drives at 30MB/sec throughput, that’d be 50 drives. The lower-end ones look to just be machines with enormous RAM (16-128 GB), plus some provisions to make memory non-volatile. But they’ve got some bigger servers, which can handle multiple terabytes of storage on Flash, and still pull 2GB/sec of throughput, which they pretty clearly state isn’t counting stuff cached in RAM (which should be even faster).

I want one.

Closed Source

As much as I love open source software, I tend to shy away from the die-hard “OpenSource or bust” people. I use closed-source (“restricted”) drivers when need be, and they usually work better, since the vendors can optimize them.

I’m quite frustrated, though, with ATI… The closed-source fglrx drivers give good performance, but have some major problems. Namely, they just don’t work with Xen. I’ve been looking to set up some virtual machines, but I have the choice of using VMs or having video drivers…

And hibernate / software suspend has never worked. It turns out that this is also a known bug caused by using the closed-source fglrx drivers.

It turns out that the Ubuntu kernel team is aware of both of these, and trying to find ways to fix it. But the problem lies in a closed-source module, so their hands are tied.

Argh!

Web Design

I’ve redone ttwagner.com. It’s no longer a random integer between 0 and 255, but instead, a decent-looking site. I’ve integrated some of the cool things I’m hosting there as well. I came across a few interesting things I wanted to point out.

The world DNS page is incredibly intensive, and, since it’s not dynamic, there’s no sense in “generating” it each time. So I used the command wget http://localhost/blah/index.php -O index.html to “download” the output, and save it as index.html in the web directory. Viola, it serves the HTML file rather than executing the script.

But the HTML output was frankly hideous. The page was written as a, “You know, I bet I could do…” type thing, written to fill some spare time (once upon a time, I had lots of it). So I’d given no attention to outputting ‘readable’ HTML. It was valid code and all, it just didn’t have linebreaks or anything of the sort, made it a nightmare to read. But I really didn’t want to rewrite my script to clean up its output so that I could download it again….

So I installed tidy (which sometimes goes by “htmltidy,” including the name of the Gentoo package). A -m flag tells it to “modify” the file in place (as opposed to writing it to standard output). The code looks much cleaner; it’s not indented, but I can live with that!

I also found that mod_rewrite is useful in ways I hadn’t envisioned using it before. I developed everything in a subdirectory (/newmain), and then just used an htaccess override to make it “look” like the main page (at ttwagner.com/ ). This simplifies things greatly, as it would complicate my existing directory structure. (It’s imperfect: you “end up” in /newmain anyway, but my goal isn’t to “hide” that directory, just to make the main page not blank.)

I’ve also found I Like Jack Daniel’s. (Potential future employers: note the missing “that” in that sentence, which changes the meaning completely!) The site is a brilliant compendium of useful information, focusing on, well, Apache, PHP, MySQL, and gzip, generally. The “world DNS” page was quite large, so I decided to start using gzip compression. He lists a quick, simple, and surefire way to get it working. (The one downside, and it’s really a fundamental ‘flaw’ with compression in general, is that you can’t draw the page until the whole transfer is complete. This has an interesting effect as you wait for the page to load: it just sits there not doing much of anything, and then, in an instant, displays the whole page.) It may be possible to flush the ‘cache’ more often, resulting in “progressive” page loading, but this would be complicated, introduce overhead, and, if done enough to be noticeable, also defeat the point of compression. (Extreme example: Imagine taking a text file, splitting it into lots and lots of one-byte files, and then compressing each of them individually. Net compression: 0. Net overhead: massive!)

MySQL

Sun bought MySQL.

Also, Sun’s CEO {has a blog, doesn’t know how to resize images other than changing the HTML attributes}.

Remember back when they were a little below $5 a share and I said I thought they were going somewhere?

Next time I’m putting my money where my mouth is. They closed at $15.92 a share on Friday.

Of course, some are wondering whether this was a good buy. Not necessarily whether MySQL is good (it’s perhaps the most widely-used database in the world), but whether it makes sense to pay a billion dollars for it, when it’s (1) primarily an OpenSource product, and (2) going to take something like 20 years of revenues to break even. While I don’t quite buy the bit about it being a conspiracy with Oracle to kill the project, you should check out the page they link to, Sun’s list of acquisitions. It’s so bad that Sun appears to have a photograph of a dumpster with the Sun logo on it. (Okay, it’s a shipping crate. But it doesn’t make a ton of sense, and you have to grant that it looks a little bit like a dumpster.) It reminds me of when Sun bought Cobalt for $2 billion, and Cobalt went belly-up shortly thereafter. (I still think RaQs could be hot sellers today, by the way, if they were still being made. To take a company doing incredibly well and have it go belly-up in under a year takes some incredible mis-management.)

DNS Dork

The real geeks in the room already know what the root zone file is, but for those of you with lives… DNS (Domain Name Service) is the service that transforms names (blogs.n1zyy.com) into IPs (72.36.178.234). DNS is hierarchical: as a good analogy, think of there being a folder called “.com,” with entries for things like “amazon” and “n1zyy” (for amazon.com and n1zyy.com, two sites of very comparable importance.) Within the amazon ‘folder’ is a “www,” and within “n1zyy” is a “blogs,” for example. A domain name is really ‘backwards,’ then: if it were a folder on your hard drive, it would be something like C:.com.n1zyyblogs.

Of course, this is all spread out amongst many servers across the world. When you go to connect to blogs.n1zyy.com, you first need to find out how to query the .com nameservers. The root servers are the ones that give you this answer: they contain a mapping of what nameservers are responsible for each top-level domain (TLD), like .com, .org, and .uk.

So you get your answer for what nameservers process .com requests, and go to one of them, asking what nameserver is responsible for n1zyy.com. You get your answer and ask that nameserver who’s responsible for blogs.n1zyy.com, and finally get the IP your computer needs to connect to. And, for good measure, it probably gets cached, so that the next time you visit the site, you don’t have to go through the overhead of doing all those lookups again. (Of course, this all happens in the blink of an eye, behind the scenes.)

Anyway! The root zone file is the file that the root servers have, which spells out which nameservers handle which top-level domains.

Yours truly found the root zone file (it’s no big secret) and wrote a page displaying its contents, and a flag denoting the country of each of the nameservers. The one thing I don’t do is map each of the top-level domains to their respective country, since, in many cases, I don’t have the foggiest clue.

What’s interesting to note is that a lot of the data is just downright bizarre. Cuba has six nameservers for .cu. One is in Cuba, one in the Netherlands, and four are in the US. Fiji (.fj) has its first two nameservers… at berkeley.edu. American universities hosting foreign countries’ nameservers, however bizarre, isn’t new. .co (Colombia) has its first nameservers in Colombia (at a university there), but also has NYU and Columbia University (I think they did that just for the humor of Columbia hosting Colombia).

In other news, it turns out that there’s a list of country-to-ccTLD (Country-Code Top Level Domain) mappings. I’m going to work on incorporating this data… Maybe I can even pair it up with my IPGeo page with IP allocations per country…