Drinking from a Fire Hose

This morning I collected stacks of unread issues of Science and Nature and put them in a recycling bin. I have subscribed to Science since the early 1980s and to Nature since the early 1990s. I still enjoy reading both journals.

But I let both subscriptions lapse. The problem is, there is more information in each issue than I have time to read. I have wide interests, and I have am omnivorous in my ability to soak up information on a wide variety of topics. Since I have been reluctant to discard issues until I have had time to read them cover to cover, I usually let them stack up until I find a Sunday to devote to a marathon reading session in which I attempt to catch up. Those Sundays have been rarer lately, and I finally conceded that I can’t keep trying to drink from the fire hose of new scientific data.

There is one problem with my plan. Although my subscriptions expired two months ago, both Nature and Science are still sending me issues, trying to tempt me back. And it might work; I almost resubscribed to both this week.

Posted in Science | Leave a comment

Relearning PHP

The time has come for me to relearn PHP. When I last used PHP, in 2005, I was using PHP 4.4, which had pretty poor support for classes and objects. Compared to Perl, I found PHP pretty awkward.

PHP 5 is supposed to provide much better support for object orientation. Exploring the books that are now available for learning PHP, I see many touting PHP 6, although PHP 6 seems to be vapor since it still hasn’t been released. (Apparently, incorporating complete Unicode support into PHP has turned out to be too difficult.)

Anyway, I’m going to learn enough about PHP 5 to be able to create classes and objects. The first book I’ve chosen to work with is PHP in Action: Objects, Design, Agility, by Dagfinn Reiersol, Marcus Baker, and Chris Shiflett. It looks like this book will teach my how to use modern object-oriented techniques for Perl 5.

From the first chapter, I note the following topics that I plan to follow up on as I continue reading the book:

  • Agile methodologies
  • Object orientation combined with simplicity
  • Decoupling
  • Design patterns
  • Test-driven development (using PHPUnit and SimpleTest)

The authors mention two other books I plan to read when I find the time, Refactoring, by Fowler, and Test-Driven Development by Example, by Kent Beck.

Posted in Computing | Tagged | Leave a comment

Trek Valencia: A Quick Review

Here is a quick review on my new Trek Valencia,which I bought over two months ago.

The Valencia is the first modern bike I’ve owned. (I also own a 1984 Raleigh Marathon, and I owned some road bikes in the 1970s when I commuted by bicycle and toured the Oregon Coast several times.) I’m really enjoying the new technology. I love the shifters, the straight handlebars, and especially the disk brakes. The tires and frame soak up the bumps from our winter-worn streets.

I ridden the bike only 190 miles since I purchased it. I ride one or two days a week because most other days I run for exercise. I live close enough to work that I don’t need a bike to commute on the weekdays, but I ride to work when I need to go in on the occasional Saturday or Sunday. I’m trying to gradually build up my rides past 25 miles so I can do some light touring this summer, maybe to Cape Cod.

The Planet 700c hybrid fenders I bought are very light, but the front one clicks a lot, which is a little annoying. I need to figure out how to prevent that. The Blackburn EX-1 rear rack is strong and stable. I use it to carry my laptop, books, and papers in the Jandd Commuter pannier I bought; it’s really great not to have to wear a knapsack or messenger bag.

My rear derailleur began squealing after only a week, but a little WD-40 cured that. I need to buy some chain lube because the chain is already beginning to rust a little. Eventually, I want to replace the seat and pedals, which are serviceable but cheap. I think the gearing is probably not quite right for touring; the lowest gear is probably inadequate for a fully loaded bike going up a hill.

Posted in Bicycling | Comments Off

Random Shuffle Algorithms

A recent slashdot.org thread discussed how a programmer at Microsoft incorrectly implemented a random shuffle algorithm. The discussion was prompted by an article Rob Weir wrote in which he presented a comprehensive analysis of the problem and provided a correct algorithm. Along the way, he named the botched implementation the “Microsoft shuffle.”

The following points are salient:

  1. One can use Pearson’s Chi-squared test to determine if the results are non-random. In Weir’s analysis, the probability that the results were random (the probability that the null hypothesis was true) was p < 2.2e–16, given 10,000 repetitions of the algorithm.
  2. Random shuffle algorithms are so commonly used that this is often an interview question for a programmer.
  3. The Fisher-Yates shuffle is an excellent random shuffle algorithm of time complexity O(n).
  4. The programmer who implemented the Microsoft shuffle did not understand how a sorting algorithm works.

As usual with discussions on slashdot, there were quite a few posters who didn’t understand the problem and why it required an accurate solution.

Posted in Computing | 2 Comments

Anticipating My New Bicycle

Although I love bicycling, I have not done any serious bicycling for several years. In the 1970′s, I was a bicycle commuting pioneer in Portland, Oregon, riding in the morning from my home in SE Portland to classes downtown at Portland State University, then in the afternoon out Sandy Boulevard to my job on NE 82nd Avenue, and finally back home after midnight for a total distance of over 20 miles. During that time I also did some solo tours to the Oregon Coast and the occasional 80-mile ride to Corvallis to visit my friends at Oregon State University.

The closest I’ve been to serious riding since those days was 2006, while I was taking a needed rest from working, when I signed up and began training for an Adventure Cycling tour from Puget Sound to Maine. Employment found me before the trip started, and I had to cancel, putting my life-long dream of a cross-country trip on hold.

I own a used 1980′s model Raleigh road bike that I still ride occasionally, but there are many things about it that dissatisfy me. I don’t like the touring handlebars for riding in the city because I need to keep my head up to watch for cars and other bicyclists. The gearing is not well suited for climbing hills. And the shifters are on the crossbar, not on the handlebars. I have had it in mind for a few years now to buy a modern bicycle.

A year ago, when I was in Florida, I rented a Marin Kentfield for a day to ride on the bicycle path. The frame was too small, but I really enjoyed the shifters, which were mounted near the handle grips, and the range of gears seemed adequate for climbing hills. The Kentfield had straight handlebars and an upright sitting position, and it felt much more nimble and maneuverable than my Raleigh.

I spent the last year reading about the new bicycles, with the thought in mind that I wanted a commuter bike that I could also use for light touring. After dithering for a year, I went to Ace Wheelworks in Somerville yesterday to buy a new bicycle. I had in mind to try four or five models, but I was focused on the Trek Valencia as the model that had the features I desired. I was very interested in the Valencia because of a series of reviews by Bike Geek.

The salesperson at Wheelworks was helpful and patient, and he helped guide me to a decision. At first, his recommendations were cautious, and the first model he had me try was a Specialized Globe Vienna Deluxe 1. This model comes stock with fenders, rack, and light, and it was easy to ride. This model is designed for commuting up to five miles, and I could tell that it would become increasing uncomfortable on longer rides.

The second model was a Trek Soho, which has a Shimano 8-speed internally geared rear hub and belt drive. This is an ideal commuter bike because it doesn’t require the maintenance that derailleurs and a chain require. However, I didn’t think the range of gears, especially the lowest gear, would be suitable for light touring.

The third model I tried was a Trek Soho 3.0. This is a hybrid bike with a frame that was probably too small for me, but it felt zippy and nimble, with excellent brakes. I was very tempted by this model, but I would have wanted to try a larger frame size.

Finally, I tried the Trek Valencia. I like this model because it comes with disc brakes, which would be ideal for light touring, and it has fender and rack mounts. The Valencia is almost identical to the Soho 3, sharing most of the same parts, except for the disc brakes. The only model they had on the floor was the 20″ frame, which the salesperson thought would be too big for me, but that turned out to be a good size. Shifting was very smooth, and the disc brakes were very effective.

In the end, I purchased the Trek Valencia, which cost $680. I knew ahead of time that I was going to spend a couple hundred dollars on accessories. I added Planet 700c hybrid fenders, a Blackburn EX-1 rear rack, Blackburn Voyager 3.3/Mars 1.0 LED headlight and taillight combo, water bottle cage, Topeak Peak Master DX pump, and a Jandd Commuter Pannier, for a total cost of $906.73 plus sales tax.

I pick up the new bike this afternoon. Watch for reviews.

Posted in Bicycling | 1 Comment

Apple’s Tablet Computer

Yesterday Apple Inc. introduced its new tablet computer, the iPad. The best summary of the iPad that I have read is, not surprisingly, written by Adam Engst at tidbits.com. I provide here notes about the features that interest me.

The iPad is a computer for content consumers, not content creators. It is ideal for casual web browsing, watching television and movies, reading digital books, and playing games. The touted battery life of 10 hours, although undoubtedly exaggerated, is still long enough for a coast-to-coast flight. (It is not so ideal for listening to music, because I don’t have a pair of pants with pockets wide enough to hold it, unlike an iPod.)

For content creators, Apple has created new versions of its iWork suite for the creation of text-based documents (Pages), spreadsheets (Numbers), and slide presentations (Keynote). I am interested in learning how well this actually works without a keyboard and mouse.

The iPad has several shortcomings. Surprisingly, it has no camera. Other commentators have wondered whether Steve Jobs couldn’t decide where the camera should be located. The iPad really needs two cameras, one facing toward the user, for video conferencing, and one on the back for taking stills and videos.

The iPad operating system, which seems to be a variant of the iPhone OS, doesn’t allow multitasking. This is an annoyance, but I think we can anticipate that a future version of the OS will overcome this limitation.

Like the iPhone and the iPod touch, the iPad doesn’t support Adobe Flash. This means there is some material on the web that we won’t be able to view on an iPad. I’m not a big fan of Flash, because I hate how processor-intensive Flash is. If I want to bog down my old PowerBook G4, I just need to open two or three web pages with Flash animations.

I plan to buy one for use at home and to take with me when I travel. I already use my iPod touch as much as or more than my MacBook Pro when I’m at home. Other than listening to music and podcasts, I use it to check the weather, Facebook, Twitter, and email, watch movies, and read books. Movie watching and book reading will be more pleasant on the iPad. One thing I’m eager to test is whether I can read PDFs of scientific papers on an iPad.

Posted in Computing | Comments Off

That Expensive Microsoft Experience

Yesterday I finished reinstalling Vista Business on my MacBook Pro. I say finished, because the reinstallation required two days. I needed to reinstall Vista after I had updated Mac OS X to Snow Leopard (10.6), at which time I had wiped out my old Vista partition, which at 25 GB was too small.

I used Boot Camp Assistant to create a 32-GB partition and reboot my MacBook Pro from the Vista installation DVD. I installed Vista Business from the DVD and then began applying software updates. I should have counted these, but I estimate there were six separate operating system updates that I estimate required six hours to apply. The first update applied 93 individual patches to my system, and I let this run while I slept. If I remember correctly, it reported that it took 90 minutes to complete the update. Later updates updated Vista to SP1 (Service Pack 1) and SP2 (Service Pack 2). (I discovered that I couldn’t get the SP2 and later updates until I remembered to activate Vista.) One of the updates installed Internet Explorer 8; that one took a long time because I didn’t realize that it had displayed a dialog window for accepting the EULA. The problem was that the dialog was hidden under the main update window, where I couldn’t see it.

My question at this point is, why can’t Microsoft combine all these updates into a single update? Why do I have to install SP1 before I can install SP2? Why can’t SP2 contain all the changes already in SP1?

After installing Vista, I installed Office 2007 Professional, after which at least two more updates were required to bring it up to date, taking another two hours.

I want to contrast that experience to what happened last fall when I wiped clean my old PowerBook G4 and performed a fresh install of Leopard (Mac OS X 10.5). My install disk installed OS X 10.5 (which you would think would be called version 10.5.0, but Apple doesn’t begin adding the third numeric field until the first revision is released). When I ran software update, there was a single (massive) update that rolled all changes from 10.5 to 10.5.7 into a single update.

So the Microsoft Experience was six hours of time spent reinstalling Vista, and the Apple Experience was two hours of time spent reinstalling OS X 10.5. If I were doing this for a living, I would bill $75 per hour for my time — $450 for reinstalling Vista, $150 for reinstalling Leopard. The Microsoft Experience cost me an extra four hours of my time or $300 equivalent. This is the primary reason I prefer OS X over Vista — it is less expensive to install and maintain.

Note: What I really wanted to do was install Windows 7, but Apple has been slow in releasing the drivers necessary for full support. Having originally promised the new drivers by the end of 2009, Apple now provides a much more vague estimate of when the drivers will be available.

Posted in Computing | 1 Comment