" /> UrlBlogGrey: February 2006 Archives

« January 2006 | Main | March 2006 »

February 28, 2006

iTunes Transport Protocol for Internet Radio

Earlier today, I started up iTunes to listen to the KCRW Internet radio station while at work. The music played fine, even though all Internet-bound traffic on my employer's network is restricted to HTTP(S). I ran Ethereal for a minute to capture some of my network traffic to find out what protocol iTunes was using, and was surprised to see that it uses the Hyper-Text Transport Protocol (HTTP). HTTP is most often used for web browsing, not streaming audio.

It's interesting that HTTP is used since it relies on TCP, which implies guaranteed delivery of all packets even if the connection can't keep up with the transmission. Most Voice-Over-IP applications use UDP instead of TCP because UDP is a much less "chatty" protocol although it does not guarantee delivery.

Come to think of it, one of my favorite parts of iTunes radio stations is the quality of their sound. This could very well be attributed to the use of TCP. I wonder how many other internet radio services use TCP instead of UDP, too?

February 25, 2006

Working with Java New I/O (NIO)

A project I've been working on lately has involved restricting access to a registry file that might be used by concurrent Java processes. There is a distinction between threads and processes: multiple threads function within the scope of a single process, and multiple processes function within a single computer. Concurrent access to a resource by threads can be limited with Java's synchronization features. But limiting concurrent access by processes has, until Java 1.4, been unavailable.

Java runtime environments (JREs) version 1.4 or better feature an addition to the API called "New I/O", or NIO. Developers can use NIO to restrict access to a file not just by other Java processes, but by any native processes running on the computer. It is significant that Sun has taken advantage of the file locking facilities on each operating system (Windows, Mac, Solaris, etc.) to make NIO work. Because operating systems differ in their features and behavior, it is worth noting that the file locking features in NIO may function a bit differently across operating systems.

NIO features a concept called "Channels" which offer the ability to lock an entire file, or even portions of a file. Channels do not provide any support for restricting access to a locked file by concurrent threads; rather, this must be handled by the developer using thread synchronization.

Based on my experiences, NIO offers some very powerful block I/O and file locking features, but takes a while to understand within the broad scope of the Java language. Hopefully more tutorials and supporting documentation will be provided in the near future so that new and seasoned Java developers can take advantage of its many features.

February 18, 2006

NdisWrapper and Network Adapters on Linux

I've got a spare PC (Pentium 4 3.0GHz) sitting in the closet that I'm eager to find a use for. It is a memento from when I worked from home on the 3D Marketing start-up in 2003. Shortly afterwards, I became a Mac convert and shunned all thing PC. But that doesn't mean the PC won't make a good Linux box!

I'd like to put it in a closet somewhere in the house because, like most PC tower cases, it makes a noticeable amount of noise. This isn't so with our Powerbook G4 or Mac Mini - just silence. So, the only wire running to the PC should be the power cable. I'd like to use a wireless adapter to connect the Linux box to our wireless network. The network is secured using WPA2, which is worth noting because not all wireless adapters and drivers support WPA2.

We recently began using a Netgear FA120 wired Ethernet adapter to connect our Tivo to our home network, which made available our D-Link DWL-G122 USB wireless adapter. I'm thinking that the DWL-G122 will be a good fit for the Linux PC. But there is the issue of drivers...

NdisWrapper is an Open Source project aimed at producing a Linux-compatible interface to proprietary network drivers designed to be used with Microsoft's Network Driver Interface Specification (NDIS). Basically, this means you can use a Windows network driver in Linux. Sounds sweet, if it works. It is unfortunate that the closed-source policies of most hardware designers forces end-users to pull stunts like this.

I still need to install Fedora Core 4 on the PC, and only then will I be able to determine if the DWL-G122 wireless adapter will work. You can Google this type of problem for hours; but in my experience, I've found so much contradictory and incomplete information about Linux configuration issues that it is best just to experiment with the issue oneself. Plus, the risk of damaging the hardware or data-loss are virtually zero.

February 15, 2006

MySpace Formatting Hell

I recently added my profile to the MySpace website after having heard about the site through every media outlet in existence. It's a lot like Friendster...a lot. But one of the distinguishing characteristics is that it allows members to customize the appearance of their profile pages to include music, photos, and HTML styles (background images, fonts, colors, etc.) Unfortunately, the majority of the profile pages employing custom styles are completely unusable. It's like browsing the web in 1997 all over again - blinking text, backgrounds that obscure text, and fonts that are impossible to read. I think it is funny how people will shun usability in the pursuit of a "unique" design.

I really thought that the web-at-large had moved beyond the use of horrible user interfaces through the spread of blogs which focus more on the content than the delivery mechanism. It is as though the teenagers or "young people" using MySpace are using a different World Wide Web than Internet veterans like myself. Sort of like the range of printed material aimed at different generations: comic books, novels, newspapers, etc. Does this mean I'm getting old?

February 10, 2006

tcpdump and pcap

I'm currently researching different packet capture utilities available for Documentum's supported platforms to aid us in diagnosing customer problems. I'm familiar with the Ethereal program, which offers a nice graphical interface capable of capturing, displaying, and reporting on captured traffic. However, installing Ethereal on some platforms can be difficult. For instance, Mac OS X requires Fink to run Ethereal. Installing additional programs such as Fink might not be acceptable in our customer's high-security environments. This is why using existing tools is highly desirable.

There are two tools available on most UNIX-based systems (including Mac OS X) effective at capturing and recording network traffic. They are 'tcpdump' and 'pcap'. Pcap stands for "Packet Capture", and is responsible for interfacing with the network adapter to sniff Ethernet traffic. Tcpdump can use pcap to capture traffic and report the information to a file or the console. The tcpdump file format is recognized by Ethereal, so customers using tcpdump can supply us with the dump file which we can then analyze in Ethereal. The network traffic can reveal many critical details explaining why the product is not working as desired.

February 8, 2006

Puh-Programming on Puh-PICs

My Microchip PICKit2 microcontroller programmer arrived yesterday, much to my glee. Actually, it arrived in Oakland via FedEx on Monday, but for some reason Microchip requested that the recipient (me) sign for the $50 package. As if I'd actually be at home at 1:30P on a Monday. So, last night I drove to the Oakland FedEx hub through the slightly scary 98th Avenue neighborhood. Shipping hubs are not always in the best neighborhoods, in my experience. Well, except for the Monterey hub located in the sunny and welcoming Ryan Ranch business park. Ahh...

So, I connected the programmer and demonstration board to the USB port on the Mac Mini and attempted to power the device and see some magic happen. Nothing. The ‘pik2’ program reported that the device could not be found or something. After consulting the documentation I learned that this is commonly associated with the older firmware (mine was 1.0.1). Oh, and you need a PC to upgrade the firmware.

This morning I used my corporate Dell laptop to upgrade the firmware and, yes, lights did flash. Magic happened. I can't wait to experiment with the demo board this weekend. There are a lot of fun microcontroller projects on the Make blog that I'd like to try out. A good beginner project would be the oh-so-80's chasing LEDs made famous by the television show "Night Rider". Maybe Natalie and I can do a little collabo where she designs a garment using her new sewing machine and I deck it out with LEDs. For Phig.

February 7, 2006

Byte Space in the IPV4 Header

I listened to an interesting "Security Now!" podcast while driving to work this morning. The program covered the technical fundamentals of the Internet with a focus on packets and the role they play in Internet traffic and routing.

The paradigm-shift which made the Internet possible was to start thinking in terms of packets instead of circuits. Prior to the Internet, all communications (voice & data) links were made using dedicated circuits. There was a dedicated wire path between your phone and the party you were calling. It belonged to you, and nobody else. This proved inefficient because much of the bandwidth of that dedicated circuit was wasted on empty pauses, and was overkill for the low-bandwidth requirements of voice communications. So, the packet was introduced as a routable piece of information that did not require a dedicated link between the two parties; rather, the packet containing the source and destination information and relied on intermediate nodes to ensure its safe and expedient arrival. This is directly analogous to the postal service, where the sender and recipient information is emblazoned on the envelope and an amorphous infrastructure is used to route the envelope to its destination.

The most amazing aspect of Internet Protocol Version 4 (IPV4) is that it was designed in the mid-1980's before anyone knew that it would be used by devices ranging from million-dollar servers to fifty-dollar mobile phones. The creators of the Internet envisioned networks on a national or regional level (i.e. US Internet, Canada Internet, etc.), not the global, singular network that it is today. The physical span of the Internet (global) introduces a lot of intermediate nodes, of which there is a maximum of 255 ((2^8)-1) in IPV4. This limitation is like saying that your envelope may pass through a maximum of 255 postal offices on its way before it is deemed non-routable and returned to the sender. The reasons why 255 nodes are acceptable can likely be explained through statistical analysis, but the reasons for 255 being chosen are simply circumstantial: 255 is the number of permutations of an 8-bit byte, which is the space allocated for the Time-To-Live (TTL) component of a packet. One fewer byte would have meant an intermediate node maximum of 127. The number of nodes decreases by half for each bit removed from the TTL component.

In all, I am just amazed at the effectiveness and scalability of IPV4. It is a wonderful example of the use of real-world analogies and simple design to produce a technology that is scalable, efficient, and practical.

February 6, 2006

Wild and Crazy!

One of my favorite things about living in a large city is the accessibility of great (and sometimes not-so-great) live music. Last Saturday, Natalie and I spontaneously decided to go to a live show at the Bottom of the Hill club in San Francisco. The last time I was there was for the San Francisco Pop Fest in 1999, but that's another story.

We dared to take my car, despite its recent sputtering/timing/non-cooperative tendencies (to be taken care of this week) so that Natalie could be wild and crazy while I played the part of the "responsible boyfriend". There were four bands on the bill (in order of appearance): Lemon Sun, Hijack the Disco, Tartufi, and Scissors for Lefty. We agreed that Lemon Sun had a very energetic performance that was reminiscent of Interpol. Hijack the Disco consisted of two guitarists and a drummer. Their musical compositions were very good, but they were desperately in need of a singer/lyricist because their lyrics were awful. The last band we heard was Tartufi, which was very good. Interestingly, all three bands had guitar strings break and subsequently delayed the performance. That's a pretty amateur thing to have happen during a show.

The crowd was interesting to observe, too. There was an older Persian woman belly dancing to Lemon Sun, which was...unexpected. Oh, and the usual suspects were there, too: couple that talks throughout the entire set, couple that is making out throughout the entire set, and unusually tall-guy who blocks people's view.

We had a really good time going out as it was a refreshing departure from our recent schedule of wake-up, work, and sleep. Oh, and it made for a great lazy day on Sunday while we participated in the All-American activity of watching the Super Bowl. Go SeaPhig's!

February 3, 2006

Mac OS X Tips, and SSH Key Managment

I happened upon a personal webpage containing links to a lot of useful Mac tips and tools. One of the tools mentioned was SSHKeychain, which is an Open Source tool intended to provide SSH agent and tunneling functionality. It is also integrated with the OS X Keychain, which means that your password-protected private key can be loaded using just your Keychain master password. This is a really nice feature set that I haven't seen offered in any other product. I intend to download the SSHKeychain progam when I get home, and possibly even get involved in the development of the program.

Wikipedia Graffiti

I listened to NPR's Technology podcast this morning while driving to work. There were a couple of interesting stories, one of which addressed the use of the Wikipedia online encyclopedia by American politicians to present themselves in a favorable light. Some politicians or their staff have edited entries to remove records of questionable activities (i.e. campaign contributions, divorce, etc.) There have also been cases of "edit wars" where Internet users repeatedly modify each other’s entries in the Wikipedia to reflect their personal views on a subject.

What really caught my attention was the stance of the Wikipedia founders - to allow this selective editing to continue. The Wikipedia is backed by a version control system that records the identity (IP address) and content of every post to the system. By looking at the IP addresses of Wikipedia contributors, it can easily be determined how many of the changes are originating from government networks. Also, it provides an interesting perspective on the social interaction taking part on the Wikipedia pages. The NPR reporter likened it to writing graffiti on the bathroom wall at school; however, this "wall" knows the identity and actions of every person who has every written on it. I think that the false impression of anonymity encourages people to contribute inaccurate or biased content to the Wikipedia. If they ever realize that their identities are completely known, the online encyclopedia or forum may cease to be a magnet for candid commentary.