Wednesday, December 31, 2008

Attenborough interview


Ed Yong has an interesting interview with Sir David Attenborough, which worth a read if you enjoy his nature documentaries (and what discerning mind doesn't?).

The version of the Planet Earth documentary series available through Netflix here in the US differs from the version aired here by the Discovery Channel in 2007. The Netflix version has Attenborough narrating, and although the lines are probably identical to those said by Sigourney Weaver in the Discovery Channel version, the Attenborough version seems much serious and informative to me.

Nevertheless, on rewatching it I still consider Planet Earth to inferior to Attenborough's "Life" series of documentaries, or the Blue Planet series made by the people who later did Planet Earth. Planet Earth, despite some great footage, never seems to me to have the same level of focus or information content of these other series. The rapid changes in shots and scenes in Planet Earth make it seem like it was put together by someone with an attention deficit disorder, or that it was aimed at an audience whose attention span is measured in tens of seconds. But perhaps their is a niche for a wildlife documentary aimed at non-documentary watchers?

Anyway, Attenborough never ceases to amaze me. At the release of this years "Life in Cold Blood" series he was 82 years old and was still jaunting around the world into all sorts of inhostipatable environments. This year he is behind one of the BBC's Darwin "The Genius of Evolution" season (marking the 200th anniversary of the birth of Charles Darwin).

Monday, December 29, 2008

More Mac installing...

Spent some of the day setting up the new work Macbook. Firefox 3 instead of Safari. iTerm as an alternative to the Terminal. More importantly. I installed Xcode 3.1.2 from the Apple Developer Connection, gfortran direct from GNU itself, fink 0.9.0 from http://www.finkproject.org/, and then a whole bunch of fink packages installed tetex using FinkCommander.

For now I've decided against installing MacTex, despite it being a more up-to-date Texlive-based tex/latex distrbution than fink's tetex.

It looks like getting scipy installed will take some work (or at least more work than installing it on Fedora, "yum -y install scipy python-matplotlib ipython"), as its not available by default in fink.

Anyway, the most important set of software installation is now over with compilers on the system and access to installable unix tools through fink, so I should be able to continue at a more relaxed pace while starting to do actual work (at the very least, paper writing) on the laptop.

Sunday, December 28, 2008

Progress on setting the Mac up properly...

Enabled a root account:

In versions prior to 10.5 this could be done with NetInfo (part of the Apps/Utilities folder). Now this is done graphically using Directory Manager (not System Preferences/Accounts, as you might have assumed). Selected Edit->Enable Root User and enter a password.

Set up the locate database for the the locate command:

Become root or use sudo to execute the following command:
/usr/libexec/locate.updatedb

Ignore the warning about this being a security risk. Control over which directories to scan should be set in /etc/locate_rc, although Apple does not provide one by default. TODO: By default the locate database is only updated once a week. This should be changed to once a day. See the /etc/periodic/weekly directory.

Setting a fixed machine name:

The main ComputerName can be set/reset in System Preferences/Sharing. However this is not the same as the node name as you'd see executing "uname -n". As far I can determine the best way to set the machine name(s) is to use "scutil --set" to set the ComputerName, LocalHostName and HostName.

scutil --set ComputerName azathoth
scutil --set LocalHostName azathoth
scutil --set HostName azathoth

These changes are retained between successive boots of the machine.

Making Terminal and X11 appear by default in the dock:

Start either app the normal way from Finder. Their icon will appear in the dock. Right-click on their icon (if you have set up right click, otherwise control-click on the icon) and select "Keep in Dock" and/or "Open at Login".

Switch off xterm beeping:

Failure!

xset b off doesn't seem to work by default as /usr/X11/bin is not in the default path. Doing /usr/X11/bin/xset b off does work within the invoking xterm, but so far I have failed in preventing beeps on an automatic and system-wide basis.

Trying to create a user-specific .xinitrc, even one that invokes quartz-wm, does not work for me. In most cases X doesn't even start successfully, and if it does then the xterm it starts still invokes the bell. I am beginning to suspect that I may have to set it to use visual bell. Copying the system xinitrc from/usr/X11/lib/X11/xinitrc and modifying that doesn't seem to work either.

Focus Follows Mouse:

It appears to be impossible to get full focus follows mouse behaviour under OSX, which is incredibly backwards. However a very limited form of it is possible just for Terminal windows (and possibly xterms) by executing the following in a Terminal:

defaults write com.apple.Terminal FocusFollowsMouse -string yes

This works (after a small delay) in giving limited FFM in just the Terminal.

For xterms the following is claimed to work:

defaults write com.apple.x11 wm_ffm true

But this does not appear to work on my Macbook, with or without a -bool between the wm_ffm and the true. As I don't really intend to use a vanilla xterm for real work anyway I'm hoping this (and the copy/paste difficulties between X11 and OSX) limitation won't end up driving me crazy.

Friday, December 26, 2008

OS X, Fedora 10, KDE 4.1.2, XFCE

Still playing around with the new Macbook and OS X 10.5.6, getting used to the odd Mac key and the associated keyboard shortcuts.

Overall I'm quite impressed at the speed and slickness of the basic OS, as much as I try to avoid being impressed with eye-candy. The lack of "focus follows mouse" is a major pain, and copy/paste seems broken or tricky between X11 and non-X11 apps. The Terminal program is OK, less fancy than I was expecting based on word-of-mouth, although nicer than the lowest-common-denominator of the basic X11 xterm.

I was going to say the OS X Terminal is less capable than the KDE Konsole, but then I was rudely reminded last week that the KDE4 Konsole is less capable, and less configurable, than the KDE3 Konsole. Currently I'd say the OS X Terminal and KDE4's Konsole appear pretty comparable in capability and available configuration options at present.

I've complained before about KDE4 on Fedora 9, but had noted some progress and had hoped the version Fedora 10 shipped with would be further improved. Last week I upgraded my work back-up machine to Fedora 10, largely as a test, and experienced many of the same problems...

The Konsole no longer has a login shell "--ls" command line option. Transparency is still not available. Add an application laucher to the Plasma-based panel and dare to change the "Icon Settings" and its icon will be replaced with a question mark. Worse still, the changes you've made to the panel launcher have been propagated back to the main KDE menu, so don't make a mistake! As for trying to move icons around on the panel... it didn't appear to be possible at all (no right click, "Move" option anymore) and its seems other are as confused by this as I am, although here is the non-intuitive way to do it.

And its slowwwww. The price we pay for KDE trying to implement desktop graphical effects similar to OSX, I suppose.

Any, sick of the fuss, I ditched KDE4 on the Fedora 10 machine and switched to XFCE, and managed to quickly configure my desktop into looking something like KDE3.5 with nicely transparent terminals in less time that it took me to get the KDE4 Konsole to use a login shell.

One step forward and one step backwards, I suppose... Ah well.

Saturday, December 20, 2008

Bérubé reviews Sokal's "BEYOND THE HOAX: Science, Philosophy and Culture"

Michael Bérubé has an interesting review, dare we say critique, at the American Scientist of Alan Sokal's latest book "BEYOND THE HOAX: Science, Philosophy and Culture" (Amazon.com link)

Here is a snippet of the review to whet your appetite:
When some people hear the term Western science, they think first of Hiroshima, Agent Orange and the Union Carbide plant in Bhopal—and not, say, of the discovery of neutrino oscillation. This mordant skepticism about the benefits of Western science is then underlined by a dogmatic conviction that the Enlightenment was little more than a stalking horse for imperialism. As for why postmodern intellectuals would champion “local knowledges” and the “heterogeneity of language games” against the universalist aspirations of the Enlightenment, my sense is that when academic leftists in the humanities speak glowingly about “local knowledges,” they’re thinking of all the warm and fuzzy feelings we lefties have about “the local”—from our local independent bookstore to our local independent food co-op. These are good things by every measure (local and universal), but they seem to have obscured the fact that many of the world’s “local knowledges” are parochial, reactionary and/or theocratic. Likewise, the defense of the “heterogeneity of language games” has proceeded as if it is the moral equivalent of a defense of species diversity—when, in fact, it is morally neutral, agnostic with regard to the question of whether the language games of charlatans or fascists should be preserved alongside the language games of the indigenous peoples of the Americas.
However, while there is much that is good about Sokal's book, it is not all good. Bérubé does a good job of explaining to lay-people like me where Sokal (and Sam Harris, before him) has gone wrong.

[Update 12/26/08: Hopefully have corrected the weird font problems.]

Friday, December 19, 2008

New Macbook! (and Fallout 3)

My new work laptop arrived yesterday - a 13" 2.4 GHz Macbook. This is my first Mac ever, something of an experiment for me, so lets hope it goes well. So far I'm quite pleased with it, especially now that I've worked out how to right click using the touch pad and found how to add a terminal to the dock.

My old Lenovo Thinkpad X60, dual boot Fedora 8 and Windows XP, was (and still is) a good software development machine but was imperfect at its primary role of conference/travel laptop. On Windows the separate Lenovo and Windows wifi managers would often conflict with one another, although it worked once you'd found and killed one or the other. I'd bought the thing based on the fact that people at ThinkWiki had the wireless hardware working under Linux, but for whatever reason it would only work intermittently and often would disconnect from a wireless network it had managed to connect to. It even did this when I swapped the Intel a/b/g wireless internal card for an Atheros-based one that was supposed to work even better under linux. I spent a lot of time getting into old-school kernel patching and micro-code nonsense, before giving up trying to make wireless work robustly under linux. This was a pain at conferences, where wired ethernet connections are rarely provided.

And I never got sound working under Linux - a failure that rankles me considering I managed to hack sound into working on linux on every laptop I've ever had until the Thinkpad came along two years ago.

I'd originally chosen a dual-boot Windows/Linux combo (as opposed to pure Linux, which is what I did on previous laptops) because conferences had stopped letting you hook your own laptop up to the projector to give your presentation (which used to work fine under linux with OpenOffice for me and still does for departmental Seminars, apart from one memorable incident at a conference in the Canary Islands...).

Now all conferences have adopted a policy of transferring all talks to one of two-conference computers, usually one Windows and one Mac. This initially lead to font problems with talks saved in powerpoint format from OpenOffice Impress, although installing and using Microsoft web fonts under linux solves that problem. I added Windows to the Thinkpad X60 so I can load the ppt in powerpoint to check it. All good so far. This is almost foolproof, except when conference organizers put your powerpoint talk from a XP machine onto a Mac running powerpoint (or vice versa), at which point all hell breaks loose. This has happened to me only a few times, but it happens to some poor soul at every conference I go to.

So, sick of powerpoint's inability to work properly on both XP and Mac, and having to reboot out of a working environment (linux) to get into XP to check the presentation, I have decided to do all future talks in Keynote. Hence the Mac. And once I've unixified the Mac I should be able to do some decent work on the thing at the same time, no rebooting required. Wish me luck.

PS: Fallout 3 did not disappoint. An awesome game, with only minor flaws of an overly-low level cap and a rather abrupt termination to the main quest.

Friday, December 12, 2008

Unix Semaphores - A finite resource!

One of the things about unix-like operating systems is that you never learn them all - there is always something more that you didn't know about that some other unix-user will tell you about that you'd never heard of but is cool and/or useful nonetheless.

I've been using *nixes pretty much full time since 1994, and sys-adminning my own Linux boxes since 1996, and yet yesterday I learned something completely new.I was messing around stress-testing some Message Passing parallel code using MPICH on a shared memory system (couldn't be bother to mess around with going across the network and set up ssh keys for a simple test, OK), only to discover after some weird errors, that the ch_shmem system of MPICH relies on System V-style inter process communication, which in terms uses semaphores, of which each user is only allocated a small number (32 arrays or something silly). Interestingly, nothing else on my system appears to be using semaphores or message arrays.

If MPI crashes while running it fails to clean up the semaphore(s), and if you do this too many times you end up not being able to run anything that relies on semaphores, which causes much confusion if you didn't know about this stuff. Hence you need to run ipcs -s to see your semaphores (hopefully none, if your MPI program has finished running), and ipcrm -s to delete any improperly terminated semaphores. I'd never heard of these commands before, but they solved my problems.

Tuesday, December 2, 2008

dd, python, google charts and amazon cloud computing

The latest RedHat magazine has a neat little article mixing dd, python, the Google Charts API and virtual machines with Amazon's version of cloud computing - the aim is a pretty pedestrian rough benchmark of disk I/O, but as a mix of computing metaphors (classic *nix command line, modern interpreted language, Web 2.0, virtualization) it is noteworthy.

The National Resources Defense Council's flawed game console study

The SciAm blog from November 28th uncritically highlights a claim by the National Resources Defense Council that
video game systems are huge energy wasters, mostly because people (read: kids) tend to leave them on even when they're not using them.
[...]

Sony PlayStation 3 (which uses 150 Watts of energy) and Microsoft Xbox 360 (which uses 119 Watts) are the biggest offenders, while the Nintendo Wii draws less than 20 Watts, according to the NRDC report. The PlayStation 3 and Xbox 360 each if left on all the time [emphasis mine], consume more than 1,000 kilowatt-hours each year—equal to the annual energy use of two new refrigerators. The PlayStation 3, which can also be used as a high-definition video player, uses five times the power of a stand-alone Sony Blu-ray player to show the same movie.
There are a number of things about this report (PDF), or at least the popular reporting of it, that I consider flawed.
  1. As we've discussed twice before now [1, 2], the energy used to produce an electronic device is a non-negligible fraction of its total lifetime energy usage (the study I linked to before claims that production of a personal computer [which game consoles effectively are] accounts for ~80% of the total energy usage over its entire lifetime). Focusing solely on energy efficiency in use is a flawed metric to assess the net cost to the climate.
  2. The report chooses to highlight the energy cost associated with leaving the devices on all the time, with no power saving options selected. This is a maximum cost, but is it at all a realistic scenario? Their figure 1 shows that, according to their own calculations, the net energy use by users who switch their consoles off after use is typically ~10% of leaving it on all the time. Any Xbox 360 user knows that heat associated with use can lead to the Red Ring of Death - I certainly don't leave my Xbox on when I'm not using it. Their summary and the news reports all focus on the worst case scenario, without mentioning the equally plausible or more plausible scenario. Of course, one can't make a big fuss about game consoles being bad for the environment under the conscientious user scenario, can we?
  3. Any technologically savvy computer user knows that there is a difference between peak energy usage and idle energy usage. The report quotes power uses when active and idle in Table 3 (e.g. an average of 119 W for an Xbox 360 when active, 118 W when Idle). Unfortunately they redefine "Idle" when gaming to mean a game is running, but the user is not touching the controller - this is simply not realistic. Even if we assume people leave their consoles on all the time they certainly don't have games loaded and paused 24/7 365 days a year - I certainly don't. Any Xbox 360 user also is aware of the annoying whine associated with a spinning disk, which no one would put up with 24/7. Yet the NRDC study deliberately rejects manufacturers Idle power usage numbers (i.e. no disk inserted, no game running, what I consider to be a realistic scenario and akin to standard personal computer Idle power ratings) and states on p26 that "Some video game console manufacturers define Idle mode as a state during which there is no game disc inserted in the console. We believe that users are more likely to leave game discs in their consoles when they are left in Idle mode (a user who takes the time to eject the game disc would more likely just power down the console completely rather than leave it running) and have defined this mode accordingly."
  4. They did not themselves assess usage patterns - in Chapter 5 they quote a Nielsen Group study that finds that "on average, users who account for close to 75 percent of all playing time have their consoles on for an average of 5 hours and 45 minutes per day." This implies that the per console there is 7 hours 40 minutes play time per day. The NRDC study has footnote (p26) associated with the previous quote questioning the Nielsen numbers: "Nielsen’s statistics can be difficult to interpret because the time in Active mode reflects an average across only the days when the console was turned on, rather than a true daily average reflecting use across the entire time metered. It is likely, however, that many heavy users often have the console on every day. For all of these reasons, we built upon the information available and the following assumptions to complete the energy analysis. ... Many users are assumed to leave their video game consoles on when they are finished with a game, even when they go to sleep at night." [emphasis mine]. On p27 they absurdly claim that a Lawrence Berkely National Laboratory study of 60% of their computers being on overnight and over weekends somehow justifies their assumptions about game consoles. This is idiotic - a national laboratory where many computers are workstations that effectively have to be on 24/7 has nothing to do with home entertainment usage by children and young adults. My work machines are on 24/7 365, as they need to be, for example either they're running programs or I need access to the disks from home. My Xbox 360 is only on when I'm using it. Hidden in Endote 1 (p28) is the nugget of information that "Due to the absence of any studies, we based our calculations on the assumption that 50 percent of users leave their device on when they are finished playing a game or watching a movie."
  5. Items 2 and 3 raise very serious concerns in my mind about how the NRDC assessed (a) the fraction of users who leave their consoles on all the time, and (b) the net energy usage. It is obvious that if either of these aspects of the study is flawed then its conclusions are totally untrustworthy. In fact, both aspects are deeply flawed.
Item 4 suggests that the NRDC did not use the Nielsen numbers (I must say I'd consider the Nielsen numbers to be suspiciously high, personally) at all, but simply assumed that 50% of all users leave their consoles on all the time. Note the phrasing of the quote in Item 4: first they assume that "heavy users" leave their consoles on all the time. Then they move from that to assuming all users leave their consoles on. As far as I can tell they did not measure actual power usage. Rather they took their (inaccurately high) "Idle" power numbers and multiplied up by the hours in a year and the number of consoles, and then multiplied by their made-up 50% figure. Assumption after assumption, and all unwarranted.

In summary I think its pretty clear that this study is fundamentally flawed. All assumptions appear to have been made to in order to achieve the result they want, and evidence to the contrary (realistic Idle power ratings using, estimated usage times from Nielsen) has been rejected without justification. The Endnote mentioned above is telling: although this is supposedly a study of the energy cost associated with console use they have no data of actual console usage, and rather than actually trying to find out they simply assume 50% of all consoles are left on all the time. If you're going to do a study why not actually try to find out as accurately as you can the numbers you need? Never mind the issue of the end-to-end energy usage (of personal computers, at least) being dominated by manufacture, not actual use.

I'd suspect that who ever wrote this "study" (deliberate use of sarcastic quotation marks) does not own a game console of their own, and has no training in hypothesis testing or scientific quantitative analysis. The lack of analytical skill or scientific rigor in this study astounds me.

This report reflects very badly on the NRDC and the Ecos consulting group who performed it. This feeds into the "computer games are bad and are making our children bad" narrative our sensationalist media loves to feed to us. Environmental groups should not resort to bogus studies in order to make the case for conserving - doing so weakens the cause and gives ammunition to the denialists and polluters. It also pisses off your potential allies, who don't want to associate with bumblers.

Furthermore, it ignores the big picture. Even if we accepted this flawed study, how significant is this energy waste compared to TVs, lights or other electronics being left on, or cars being idled in the morning to warm up? A decent study would place the numbers in context. This study would never pass any form of peer review - its terrible. I'm also annoyed at SciAm adopting the parroting-the-press-release school of journalism.

Finally the focus on consoles is blatantly a PR gimmick from the NRDC, timed for the holidays so they can get some media attention while picking on a group (gamers) that it is socially acceptable to pick on.

Energy conservation and reducing resource waste is not about consoles, it has to extend to all areas of life. Water, electricity, gas, food stuffs. If you haven't taught your child to turn off the light when he leaves the room then why expect him to turn off the TV, computer, or game console. Its about personal responsibility.
Without that a million studies, flawed or accurate, won't make an iota of a difference.

Monday, December 1, 2008

Electronic waste and Apple

Just when I'm thinking about replacing(*) my old work laptop (a Lenovo X60) for one of the new Apple Macbooks, Greenpeace trashes Apple for its inaccurate claims regarding how green its laptops are (Daily Tech article, Greenpeace report on Apple [PDF]).

As I've noted before there is much more to being green than just energy efficiency, so in this respect Apple's claims about being green are disingenuous at the very least.

However, if you take time to look at the Greenpeace ratings and their change over time its clear that of the main laptop manufactures are all pretty in the same general area - the electronics manufacturers scoring more highly tend to be more related to consumer electronics and cell-phones. And the real bad guys are Microsoft and Nintendo.

(*) Supplementing is perhaps a more accurate description, rather than replacing. The X60 is still a great ultraportable laptop that I do a lot of real work on, but for conferences and travel I'm hoping a Mac may be more practical.