Archive for the ‘Technology’ Category

More on Leopard

October 31, 2007

If you’re interested in learning more about Leopard than I told you in my last post, head over to John Siracusa’s 17-page review at Ars Technica.

One nice tidbit from the review is that you can replace Leopard’s new reflective Dock with a more functional one by entering the following commands at your terminal:

> defaults write com.apple.dock no-glass -boolean YES

> killall Dock

This will give you the same style of dock that you’ll get if you position the dock to the left or right of your screen, even if you put the dock at the bottom. If you change your mind, and want the new shiny reflective dock back, just repeat the above commands replacing “YES” with “NO”. The changes will stick through a reboot.

Advertisement

Developing on Mac OS X 10.5 Leopard

October 27, 2007

The latest version of the Mac OS X operating system, numbered 10.5 and called “Leopard,” was released last night. I went out and bought it and upgraded the iMac that I’m writing this post on. It’s a nice upgrade, with all sorts of little features. Here’s Apple’s detailed list of features, here’s a mainstream review, and here’s the perspective of a developer.

The installation went smoothly for me. Don’t be surprised if your hard-drive is busy for a about half an hour after you first boot up; that’s Leopard’s Spotlight search program indexing your hard drive.

I want to focus on some of the new features for developers, particularly the upgrade of the Objective-C programming language to version 2.0, and the upgrade of the XCode integrated development environment to version 3.0.

Objective-C is an object-oriented version of C, dating from the early 1980’s, which is a strict super-set of C; that means ordinary C programs will compile successfully under an Objective-C compiler. That makes Objective-C sound a lot like C++, but I like Objective-C a lot more than C++. C++ takes a “Swiss army chainsaw” approach, throwing many new features into the language, while Objective-C is much more minimalist, basically extending the language just to support objects with a Smalltalk-like syntax. Objective-C is also much more dynamic than C++; much more is decided at run-time rather than compile-time. Because of that, it feels a lot closer to programming with a nice scripting language like Python or Ruby. Here’s an excellent introduction to the Objective-C language by Apple; it’s a surprisingly literate piece of technical documentation.

Objective-C is almost never used by itself, instead you use it in conjunction with a set of extensive libraries (the Cocoa libraries on Mac OS X or the GNUstep libraries on Linux or Windows). Cocoa and GNUstep derive from the NeXTStep and OpenStep libraries developed by the NeXT Computer company in the 1980’s and 1990’s. They add both fundamental features (e.g. string handling features, hash tables, that type of thing) and GUI-creation features. These libraries have been under development for 20 years, so they are extraordinarily mature. And since Apple uses Cocoa and Objective-C to develop all of its applications, including Mac OS X itself, it is clear that if you want to develop desktop applications for the Macintosh, you need to learn about them.

I actually believe that using Objective-C and GNUstep is also a very reasonable choice on Linux (or Windows), for those types of applications where you would otherwise use C++, but few people actually make that choice. In fact, I have found that GNUstep and Cocoa are compatible enough that one can pretty easily maintain code that works on all platforms if you need that.

Apple provides a very nice integrated development environment called XCode for free with Mac OS X. If you have not upgraded to Leopard, you’ll be limited to XCode 2.5, while Leopard gives you XCode 3.0. One of the nicest parts of XCode is the “Interface Builder,” which lets you build GUI’s using a GUI instead of by writing code.

With Leopard, Objective-C is being upgraded to version 2.0. Perhaps the most important new feature included is garbage collection. It’s an opt-in system, so legacy code will still work, and you can turn it off if you like allocating and releasing memory yourself, but for new code, most developers will obviously be very happy to have it. This removes one of the major warts of the Objective-C language.

0321213149.jpg

To learn more about building desktop applications for Mac OS X, I highly recommend “Cocoa Programming for Mac OS X” 2nd edition, by Aaron Hillegass. I only wish that there was a third edition that covered the new features of XCode, Objective-C and Cocoa that have appeared in Tiger and Leopard. (UPDATE: Apparently, a 3rd edition is scheduled for Spring 2008.)

If you’re interested in programming Macintosh applications, but prefer to use Ruby, Python, or Haskell instead of Objective-C, you should know about RubyCocoa, PyObjC, and HOC, which let you call the Cocoa libraries from those languages. These tools are very nice, (I’ve actually only used PyObjC personally) but you’ll still need to have some familiarity with Objective-C to understand them.

iTunes U

October 11, 2007

04_large20070905.jpg

I bought one of the new iPod Nanos last week. One of the main reasons that I wanted one was to be able to listen to and watch the video lectures available at iTunes U while walking or traveling. There’s quite a bit of interesting material available for free download. For example, I’ve been watching lectures from the weekly colloquium of the Stanford Computer Systems Laboratory.

There are also MIT courses about graduate-level Digital Communications taught by Edison and Shannon medalist David Forney, or introductory Biology by Eric Lander and Robert Weinberg, or Mathematical Methods for Engineers (look under Mathematics) by Gilbert Strang, all in video. The podcast section of iTunes Store also has many videos of entertaining 20-minute talks from the TED conferences held over the last few years.

Of course there’s all sorts of other material available; I’m just pointing out some more academic videos.

It’s somewhat annoying how difficult it is to find specifically video material; there’s much more material available only as audio, but the video material is not really specifically singled out in any way. Also, you should know that you can also watch all the material directly on your computer, but if you want to do that, you should also visit this MIT OpenCourseWare page or this Berkeley webcast page. Both of these pages have a lot of additional video courses available in formats other than the MP4 format used by the iPod.

The iPod nano is very small and light. It’s my first iPod, so I was pleasantly surprised to learn that the earbuds are actually pretty comfortable. The screen is really sharp, but it’s also really tiny, so while it’s OK to look at occasionally to see what’s going on, but I wouldn’t want to watch a long movie on it. The iPod Touch will definitely be a better option for that.

Video Conferencing Using iChat

October 10, 2007

Scientific collaboration is really difficult when you cannot talk directly with the person you’re working with. This has long made collaboration with distant colleagues cumbersome, to say the least. Fortunately, we live in the 21st century, and video conferencing technology now exists that is simple to set up, and works extremely well.

For the last few months, I have been using Apple’s video iChat software, and I can recommend it highly. It seems to have two major applications: connecting family members, and enabling business video meetings.

I have been video-conferencing with my colleague Stark Draper since he went to the University of Wisconsin earlier this summer. Video conferencing reliably works much better than phone conversations, and nearly as well as face-to-face meetings. It might seem surprising that it should be that big an improvement over phone conversations, but in fact human beings are very visual creatures, and a lot of information is conveyed by expressions and gestures. When you talk to somebody via video conference, they really seem like they’re with you in the same room.

If both you and your colleague have a recent Apple notebook or iMac with iSight camera built in, setting up iChat will be very easy; it just takes a couple minutes in all. You’ll need to sign up for a free trial .Mac account, which lets you use iChat (if you already have some other instant messaging account, like a Jabber account, you can also use that). The free trial lasts for 60 days after which you need to pay $100 if you want the full benefits of a .Mac account, but even if you don’t pay anything, you will still be able to continue to use your account for iChat. Since I wasn’t very interested in the other benefits of .Mac, that’s precisely what I did.

iChat uses the H.264 codec, which gives a very nice sharp image, although occasional video compression artifacts are noticeable (they’re interesting if you’ve worked on video compression, like me). There is also a very slight delay, which is noticeable, but not too bad. Actually setting up the video connection is trivial; it’s just a matter of knowing your partner’s .Mac account.

Other software like Skype exists for those of you with Windows or Linux. I don’t have any experience with video-conferencing with these services. If you do have such experience, and especially if you can compare with iChat, I’d be interested in your comments. Perhaps the main advantage for the Macs is just the fact that the camera is already built in.

Here’s a video that shows Steve Jobs demoing the new version of iChat that will be released with Leopard, the new version of Mac OS X coming out this month. It will give you a good idea of what a video chat is like; you might think that the reality is not so nice, but that’s essentially the quality I get with my video-conferences with Stark.

The upgrades for Leopard actually seem pretty minor to me; it will be nice to be able to share .pdf documents or presentations, but you can already basically do that by emailing the files. And I’m not too excited about the ability to distort my image or use weird back-drops. Originally, there was supposed to be a useful new feature in iChat for Leopard which enabled you to share your desk-top with your video partner, but it’s not clear whether that feature has been moved to another part of Leopard, delayed, or dropped altogether. We’ll soon find out. UPDATE: It looks like the desktop-sharing feature exists after all, which is excellent news, especially for people wanting to help out their computer-challenged friends and relations. However both sides of the chat will need to have Leopard for this to work.

Gallager’s LDPC error-correcting codes

September 28, 2007

Error-correcting codes are a technology that most people don’t think much about, if they even know they exist, but these codes work quietly in the background to enable such things as cell phones and other wireless technology, cable and satellite TV, and also the internet, including DSL, fiber-optic communications, and good old-fashioned dial-up modems. The modern communications revolution could not have begun without these codes.

So what’s the idea behind these codes? There’s a lot to say, and many textbooks have been written on the subject, so I’ll only give the briefest of introductions. [Some excellent textbooks I recommend include MacKay’s textbook which I’ve already reviewed, McEliece’s “Theory of Information and Coding”, and Lin and Costello’s “Error Control Coding.” See also this post for two forthcoming books available online.] EDIT: I’ve added some more information about LDPC decoders, with pointers to available software, in this post.

The basic idea is that we want to transmit some bits which represent some piece of text or picture or something. Unfortunately, when we transmit those bits, they need to travel through some channel (say a wire or through the air) and when they are received, the receiver only gets a noisy version of each bit. For example, each bit might be flipped independently from a 0 to a 1 or vice versa with some small probability (this is called the binary symmetric channel; many other channel models exist too).

To combat this noise, we send extra bits; so instead of sending say the 1000 bits that represent our message, we might send 2000, where the extra 1000 “check” bits have some known relationship to the original 1000. Both the transmitter and receiver agree on that relationship ahead of time; that is the “code.” Of course, all 2000 bits are now subject to the noise, so some of those extra bits could be flipped. Nevertheless, if the noise is small enough, the receiver can try to “decode” the original 1000 bits by finding the configuration of the 2000 bits which obeys all the constraints and is most probable.

In 1948, Claude Shannon proved a theorem that essentially said that if the noise in the channel was small enough, and if the number of extra bits that you were willing to send per original bit was large enough, that one could design very long codes, that if optimally decoded, would always remove all the noise and recover the transmitted message.

(By the way, it is this amazing property that codes can remove 100% of the noise that means that we can watch crystal-clear high-definition TV coming in over the airwaves, something I very much appreciate when I watch a football game these days. When advertisers talk about “digital this” or “digital that,” they really mean “error-corrected digital”.)

As an example of Shannon’s theorem, if one was willing to use one extra bit for every original bit, and the percentage of flipped bits in your binary symmetric channel was less than the Shannon limit of about 11%, his theorem tells you that codes exist that will reliably remove all the noise. However, Shannon’s proof was non-constructive; he didn’t tell us what these wonderful codes were. Shannon also proved a theorem that if the noise was higher than the “Shannon limit,” no codes exist that can reliably correct the noise.

So error-correcting coding theory deals with the problems of designing codes, and efficient encoders and decoders for those codes, that work as close to the Shannon limit as possible. Many theorists invented many interesting and useful codes and encoders and decoders over the years, but until the 1990’s, it still seemed a distant dream to most coding theorists that we would be able to find practical codes that performed near the Shannon limit.

What is very strange is that the best codes and decoders that were discovered in the 1990’s were actually a rediscovery of codes and decoders invented by Robert Gallager in the early 1960’s, for his Ph.D. thesis. Gallager’s thesis introduced “low density parity check” (LDPC) codes, and their decoding algorithm, the famous “belief propagation” decoding algorithm. His thesis also introduced many other important ideas in coding theory, including “density evolution,” simplified “bit-flipping decoders,” and analysis methods for optimal LDPC decoders. It is a truly remarkable work, that every aspiring coding theorist should read. Fortunately, it’s available online.

images.jpg

How is it possible that this work was forgotten? Well, in 1968, Robert Gallager wrote a magnificent textbook on information theory, called “Information Theory and Reliable Communication,” where he explained most of the information and coding theory known at the time, but neglected to talk about LDPC codes! I’m not sure why. Possibly he thought that he’d already covered the material in the 1963 monograph that was made from his thesis, or perhaps he didn’t think LDPC codes were practical at the time. In fact, the decoder was too complex for 1960’s technology, but Moore’s Law took care of that, although only now are LDPC codes widely replacing previously-developed codes in communications systems.

So the moral of the story is: if you write a ground-breaking Ph.D. thesis about a remarkable technology that is 30 years ahead of its time, please don’t forget to mention it in your classic textbook a few years later. Not a moral too many of us have to worry about, but still…

Talking about Probabilistic Robotics

September 23, 2007

Sebastian Thrun is a professor of computer science and electrical engineering at Stanford, and director of the Stanford Artificial Intelligence Laboratory. He was the leader of Stanford’s team which won the $2 million first prize in the 2005 DARPA Grand Challenge, which was a race of driver-less robotic cars across the desert, and also leads Stanford’s entry into the 2007 DARPA Urban Challenge.

One of the ingredients in the Stanford team’s win was their use of “probabilistic robotics,” which is an approach based on the recognition that all sensor readings and models of the world are inherently subject to uncertainty and noise. Thrun, together with Wolfram Burgard and Dieter Fox have written the definitive text on probabilistic robotics, which will be a standard for years to come. If you are seriously interested in robotics, you should read this book. (The introductory first chapter, which clearly explains the basic ideas of probabilistic robotics is available as a download here.)

The Laboratory of Intelligent Systems at the Swiss École Polytechnique Fédérale de Lausanne (EPFL) hosts the superb “Talking Robots” web-site, which consists of a series of podcast interviews with leading robotics researchers. I noticed that the latest interview is with Thrun, and liked it quite a bit; it is well worth downloading to your iPod or computer.

You can watch Thrun speaking about the DARPA Grand Challenge at this Google TechTalk.

WordPress.com

September 21, 2007

When I tell my friends about this blog, they often want to know more about how it’s constructed. So I thought I’d talk a bit about the wordpress.com software that I use, and some tips I can pass on after seven weeks of using it.

First of all, it’s important to distinguish between wordpress.org and wordpress.com. WordPress.org is an open-source project for the wordpress blogging software; you can download it, and then set it up on your own web-server (it typically costs $7/month to set things up with a web-hosting company) and you’ll have full control over everything in your blog. WordPress.com is an easier alternative; they’ll host your web-site for you for free, but you don’t get absolutely complete control over what you can do. You can learn more details about the differences here.

I chose to use wordpress.com, because their features were basically what I wanted, but I wanted to use my own domain name (nerdwisdom.com) instead of the default nerdwisdom.wordpress.com. That extra feature costs $15/year; for that price, wordpress.com pays for your registration and handles redirection transparently. I recommend this option, because it means that if you ever want to change the way you do things later (e.g. switch to wordpress.org or some other service, which is not so hard because wordpress.com lets you “export” you entire blog as an XML file) you won’t have to change the url for your blog.

A nice bonus that happened when I paid for this option was that wordpress.com walked me through the process of setting up a Google Apps account for nerdwisdom.com. This is quite nice; I actively use Google’s Page Creator application, and there are other useful features and applications including Gmail accounts with the nerdwisdom.com domain.

Building your blog on wordpress.com is done through a web browser; you won’t need to download anything, and you can work on multiple computers with multiple operating systems. I recommend that you use the Firefox browser, it is better supported than the others. You write up your posts using an editor that can display either a WYSIWYG interface or your HTML code; it’s pretty easy to use if you have any experience with HTML, and I’d guess it’s not too bad even without any such experience. WordPress.com comes with a whole lot of different “themes” for changing the look of your blog, but I’m pretty happy with the default theme.

You can buy some “upgrades” with wordpress.com that give you some more control over your stylesheet and let you store more than 50 MB of data. At the rate I’m going, I’ll need to spend $20/year for the extra storage once I’ve done this for a couple years.

There are a few important restrictions with wordpress.com. Probably the most important is that you may not run advertisements (wordpress.com says this may change in the future). If you want to run ads you probably want to either use Google’s blogger.com service or wordpress.org or maybe typepad.com. You can also run advertisements on wordpress.com (and get other benefits) if you are a “VIP” blog, but to get that service you need to pay $300/month and have in the neighborhood of 15,000+ page-views/day, which is a lot.

I experimented just a little with blogger.com, and it seemed quite clunky to me in comparison with wordpress.com, but maybe that was just because I was already used to wordpress.com. My impression from what I have read is that wordpress.com is the more powerful system. I don’t have any experience with typepad.com at all. Apparently, blogger.com and typepad.com were the first entries into this field, but wordpress.com has now surpassed typepad.com in popularity, and is the second most used blogging software, and gaining on blogger.com.

Another restriction of wordpress.com is that it will not host Javascript widgets or Java applets. I wanted to put up a Java applet for my post on simulating the Ising model in NetLogo, so I put it on a page hosted by Google Pages instead, and just linked to the page.

One nice feature of wordpress.com is that they will put your posts on their front page if they think that they are high quality. I have no idea what algorithm they’re using to make that decision, but my posts are showing up pretty often, which drives some extra traffic my way. Speaking of traffic, you can access pages which give you a lot of information about how much traffic you’re getting and where it’s coming from.

Another nice thing about wordpress.com is their FAQs and forums. I use the FAQs a lot; nearly every time I have had a question, it’s been answered there.

Now a couple of tips for people already using wordpress.com. I found that Windows and Mac OS X browsers were using different fonts for my pages (the Mac OS X fonts were smaller than I liked), but you can fix this by using the HTML code “<font size=”2”> …. </font> in all your posts. I am also a big fan of the text widgets that let you put all sorts of things in your side-bars, because you can include HTML code.

You should also make sure to turn off the very annoying Snap preview feature, which is on by default.

If you’re interested, it’s easy as pie to set up an account and give it a whirl. I’m happy with the choice I made.

Music in Computer Games and Windows on Macs

September 2, 2007

kennedycenter.jpg

For certain genres of computer games, such as grand strategy games, the music can make a huge difference in the experience. One of the reasons that Civilization IV has been such a great hit is its wonderful music, particularly composer Christopher Tin‘s beautiful menu track “Baba Yetu” and opening track “Coronation.”

This music has attracted considerable notice; the picture above, taken from Tin’s website, is of the National Symphony Orchestra and the Washington Master Chorale performing “Baba Yetu” at the Kennedy Center. Tin makes “Baba Yetu” and “Coronation” (actually remixed versions slightly different from the computer game versions) available for download at his samples page, along with other samples of his work. (To download, just right-click and “save link” instead of left-clicking.) If you’re curious, the lyrics for “Baba Yetu” are actually a version of the Lord’s Prayer in Swahili.

My son Adam really enjoys playing the historical grand strategy games produced by Paradox Entertainment (Europa Universalis II, Victoria, Crusader Kings, and right now especially Europa Universalis III.) These games also have excellent music, but there are some tracks that he prefers more than others, and the music sometimes gets too repetitive in Europa Universalis III because there’s not as many tracks as he’d like. Adam also told me would play Crusader Kings mostly for its excellent music, and he would read the “Civilopedia” in Civ IV because it would let him listen to “Baba Yetu.”

Well, to give him a little more control, we made a playlist in iTunes, and put in only the tracks he likes from the games we own, and now he’s completely set. He just turns off the game music and uses his iTunes playlist instead. Speaking of iTunes on Windows, this is a funny quote from Apple’s CEO Steve Jobs a couple months back:

And speaking of running Windows on an Intel iMac using Bootcamp, which is what we do to run Windows-only games, this is a very funny link, but it’s not really accurate. Honestly our iMac running Windows (we actually run Windows XP instead of Vista because it runs games better, and is more stable) is easily the fastest and most stable Windows machine I’ve ever seen, probably largely because it’s missing all the bloat that normally comes on a PC (and because I’m very careful about what gets installed on it.) Walt Mossberg from the Wall Street Journal also reports that an iMac running Vista is the best Vista machine he’s seen.

The Life of the Lab Biologist

September 1, 2007

As I mentioned in a previous post, I was lucky to be able to attend, as a student, the 2006 Molecular Biology of Aging summer course at the Woods Hole Marine Biology Laboratory. This three week course was intensive; part the time was spent in lectures, where many of the world’s leading experts on aging explained their research in detail (and the students were able to ask lots of questions), and the rest was spent in the lab. There was also often time to attend some of the many other stimulating talks in molecular biology or neuroscience being held elsewhere at Woods Hole. Because the subject was so far from my normal research, I took vacation time to attend; I suppose it doesn’t seem like much of a vacation, but in fact Woods Hole is incredibly stimulating, and it was one of the most memorable and refreshing vacations I’ve ever had.

We performed real experiments in the lab, as the other students were all biology post-docs and grad students who were there to learn cutting edge techniques. I was also assigned to a group, led by Dr. Meng Wang, a post-doc in Gary Ruvkun’s lab, and we learned how to perform RNA interference (RNAi) screens on the nematode worm C. Elegans.

The RNAi technique lets you suppress the transcription of any single gene in the worm’s genome. An “RNAi screen” means that you divide the population of worms that into groups organized so that each group has a different gene suppressed, and you make sure that you have a group for each gene in the genome. For each group of worms, you check whether it has some phenotype that you’re interested in (in our case it was the ability to breed at a later age than usual). That way, you can quickly find genes that are involved in the phenotype.

216878320_502fcdb4c2.jpg

The picture above is from the lab at Woods Hole. From left to right are Michael Morissette, Andrew Midzak, Serkalem Tadesse, myself, and John Cumbers. The others have finished their work, but I was slower than everybody else, so I’m guessing that I was still counting worms or something.

Biologists work incredibly long hours at the lab, often doing work that is exciting in terms of its implications, but sometimes pretty dull and repetitive in the doing; biologists are dedicated people! On the other hand, lab life seems much more social compared to the life of a computer scientist or physicist. (Although there is much more social interaction in those fields than in fields like history, as I know by observing my historian wife. I always find it ironic that humanists, who tend to be outgoing people, usually find themselves working in a much more solitary way than scientists.)

One thing I learned was that lab biology is largely a matter of learning and using “protocols,” which are basically like scientific recipes. Take a look at this amusing video, which features the highly talented John Cumbers (who was one of my lab-mates) and produced by the Brown iGEM team:

Another protocol was for “picking” worms (moving them from one petri dish to another). An adult C. Elegans is only about 1 millimeter long, so picking them up is not easy. You do it under a microscope with a special thin wire (a “picker”). You sort of try to scoop them up, but the worms run away! It’s like a video game, except not nearly as fun, really. Here’s a video showing the technique in action.

You should notice by the way that the picked worm is glowing. That’s because the worm is a mutant: a gene for a fluorescent protein has been spliced into its genome attached to another gene (daf-12) of interest. That way you can know where daf-12 is expressed in its body. (This video was submitted by user a99xel to YouTube).