« July 2005 | Main | September 2005 »

Wednesday, August 31, 2005

Fourmilab on Generator Power; UPS Sensitivity Settings

gen_2005-08-31.jpg
Due to maintenance on the high-tension lines which feed the quarter megawatt Fourmilab electrical substation, the power grid feed was cut for eight hours today. To ride out the interruption, ENSA provided a diesel generator and scheduled a cut-over to and from it with at most a 15 minute outage during the transition. As 15 minutes is uncomfortably close to the battery capacity of the most heavily loaded UPS here, I negotiated a five minute "best effort" transition and decided to use this as a test of the graceful system shutdown mechanism if it came to that which, happily, it didn't.

After the transition to generator power, several of the UPSes began to flip back and forth between mains and battery power several times per minute. After a little ratiocination, I observed that this only affected UPSes installed on or before approximately 1998. All APC SmartUPS units have a "sensitivity" setting on the back panel; I set the sensitivity of the older units to the minimum value and they were subsequently happy with the generator power. None of the newer UPS units had any problems at all running on the generator, and the transition from the generator back to grid power was smooth; the UPSes easily rode out the short interruption.

Power from the generator doesn't meet the Swiss precision of that which normally issues from our power outlets. Here's what the UPS reported on the generator:

MAXLINEV : 241.9 Volts
MINLINEV : 234.7 Volts
OUTPUTV  : 234.7 Volts
LINEFREQ : 53.2 Hz
This is what we're used to seeing when on the grid:
MAXLINEV : 240.4 Volts
MINLINEV : 233.2 Volts
OUTPUTV  : 233.2 Volts
LINEFREQ : 50.0 Hz
After the transition back to grid power, I reset all the older UPSes to high sensitivity; they've run that way for years with no problems, so there's no reason to change now.

Posted at 23:09 Permalink

Saturday, August 27, 2005

Reading List: No Second Place Winner

Jordan, Bill [William Henry]. No Second Place Winner. Concord, NH: Police Bookshelf, [1965] 1989. ISBN 0-936279-09-5.
This thin (114 page) book is one of the all-time classics of gunfighting, written by a man whose long career in the U.S. Border Patrol in an era when the U.S. actually defended its southern border schooled him in the essentials of bringing armed hostilities to an end as quickly and effectively as possible while minimising risk to the lawman. Although there are few pages and many pictures, in a way that's part of the message: there's nothing particularly complicated about winning a gunfight; it's a matter of skill acquired by patient practice until one can perform reliably under the enormous stress of a life-or-death situation. All of the refinements and complexity of "combat shooting" competitions are a fine game, the author argues, but have little to do with real-world situations where a peace officer has no alternative to employing deadly force.

The author stresses repeatedly that one shouldn't attempt to learn the fast draw or double action hip shooting techniques he teaches before having completely mastered single action aimed fire at bullseye targets, and advocates extensive dry-fire practice and training with wax or plastic primer-only practice loads before attempting the fast draw with live ammunition, "unless you wish to develop the three-toed limp of the typical Hollywood 'gunslinger'" (p. 61). Jordan considers the double action revolver the only suitable weapon for a law officer, but remember that this book was written forty years ago, before the advent of today's light and reliable semiautomatics with effective factory combat loads. Still, the focus is on delivering the first shot to the malefactor's centre of gravity before he pulls the trigger, so magazine capacity and speedy reloading aren't as high priorities as they may be with today's increasingly militarised police.

This book is out of print, but used copies are readily available.

Posted at 17:56 Permalink

Friday, August 26, 2005

Biblical Number Theory Puzzle

What is the largest prime number in the Bible? Where does it appear?

For the answer, click below:

From Unsolved Problems in Number Theory 3rd. ed. by Richard K. Guy.

Posted at 18:32 Permalink

Wednesday, August 24, 2005

Reading List: Gray Lensman

Smith, Edward E. Gray Lensman. Baltimore: Old Earth Books, [1939-1940, 1951] 1998. ISBN 1-882968-12-3.
This is the fourth volume of the Lensman series, following Triplanetary, First Lensman, and Galactic Patrol. Gray Lensman ran in serial form in Astounding Science Fiction from October 1939 through January 1940. This book is a facsimile of the illustrated 1951 Fantasy Press edition, which was revised somewhat from the original magazine serial.

Gray Lensman is one of the most glittering nuggets of the Golden Age of science fiction. In this story, Doc Smith completely redefined the standard for thinking big and created an arena for the conflict between civilisation and chaos that's larger than a galaxy. This single novel has more leaps of the imagination than some other authors content themselves with in their entire careers. Here we encounter the "primary projector": a weapon which can only be used when no enemy can possibly survive or others observe because the mere knowledge that it exists may compromise its secret (this, in a story written more that a decade before the first hydrogen bomb); the "negasphere": an object which, while described as based on antimatter, is remarkably similar to a black hole (first described by J.R. Oppenheimer and H. Snyder in 1939, the same year the serial began to run in Astounding); the hyper-spatial tube (like a traversable wormhole); the Grand Fleet (composed of one million combat units); the Z9M9Z Directrix command ship, with its "tank" display 700 feet wide by 80 feet thick able to show the tactical situation in an entire galaxy at once; directed planetary impact weapons; a multi-galactic crime syndicate; insects and worms as allies of the good guys; organ regeneration; and more. Once you've experienced the Doc Smith universe, the Star Wars Empire may feel small and antiquated.

This edition contains two Forewords: the author's original, intended to bring readers who haven't read the earlier books up to speed, and a snarky postmodern excretion by John Clute which is best skipped. If you're reading the Lensman series for the first time (this is my fourth), it's best to start either at the beginning with Triplanetary, or with Galactic Patrol, which was written first and stands on its own, not depending on any of the material introduced in the first two "prequel" volumes.

Posted at 22:31 Permalink

Friday, August 19, 2005

Reading List: The Lando Calrissian Adventures

Smith, L. Neil. The Lando Calrissian Adventures. New York: Del Rey, [1983] 1994. ISBN 0-345-39110-1.
This volume collects together the three Lando Calrissian short novels: Lando Calrissian and the Mindharp of Sharu, Lando Calrissian and the Flamewind of Oseon, and Lando Calrissian and the StarCave of ThonBoka, originally published separately in 1983 and now out of print (but readily available second-hand). All three novels together are just 409 mass market paperback pages. I wouldn't usually bother with an item of Star Wars merchandising, but as these yarns were written by one of my favourite science fiction authors, exalted cosmic libertarian L. Neil Smith, I was curious to see what he'd make of a character created by the Lucas organisation. It's pretty good, especially as a gentle introduction for younger readers who might be more inclined to read a story with a Star Wars hook than the more purely libertarian (although no more difficult to read) The Probability Broach (now available in a comic book edition!) or Pallas.

The three novels, which form a continuous story arc and are best read in order, are set in the period after Lando has won the Millennium Falcon in a card game but before he encounters Han Solo and loses the ship to him the same way. Lando is the only character in the Star Wars canon who appears here; if the name of the protagonist and ship were changed, one would scarcely guess the setting was the Star Wars universe, although parts of the "back-story" are filled in here and there, such as how a self-described interstellar gambler and con artiste came to be an expert starship pilot, why the steerable quad-guns on the Falcon "recoil" when they fire like World War II ack-ack guns, and how Lando laid his hands on enough money to "buy an entire city" (p. 408).

Lando's companion in all the adventures is the droid Vuffi Raa, also won in a card game, who is a full-fledged character and far more intriguing than any of the droids in the Star Wars movies. Unlike the stilted and mechanical robots of the films, Vuffi Raa is a highly dextrous starfish-like creature, whose five fractal-branching tentacles can detach and work independently, and who has human-level intelligence, a mysterious past (uncovered as the story progresses), and ethical conflicts between his built-in pacifism and moral obligation to his friends when they are threatened. (The cover art is hideous; Vuffi Raa, an elegant and lithe creature in the story, is shown as something like a squared-off R2-D2 with steel dreadlocks.) Now that computer graphics permits bringing to film any character the mind can imagine, Vuffi Raa would make a marvelous addition to a movie: for once, a robot fully as capable as a human without being even remotely humanoid.

The first novel is more or less straightforward storytelling, while the second and third put somewhat more of a libertarian edge on things. StarCave of ThonBoka does an excellent job of demonstrating how a large organisation built on fear and coercion, regardless how formidably armed, is vulnerable to those who think and act for themselves. This is a theme which fits perfectly with the Star Wars movies which occur in this era, but cannot be more than hinted at within the constraints of a screenplay.

Posted at 23:36 Permalink

Wednesday, August 17, 2005

Rube Goldberg-Like Burglar Alarm Patent from 1912

Rube Goldberg's talents were broad and profound. After graduating from the University of California in Berkeley with a degree in mining engineering, he worked in the San Francisco Chief Engineer's office before quitting in 1904 to launch his cartooning career drawing sports cartoons for the San Francisco Chronicle for the weekly sum of US$8. He went on to draw more than fifty different comic strips and series of panels, performed in vaudeville in New York, created his own animated cartoons (such a perfectionist was he that he drew every frame himself), wrote short stories and articles which were published in national magazines such as The Saturday Evening Post and Collier's, worked on two Hollywood movies and even appeared in Paramount's Artists and Models, and wrote a number of popular songs and a play. In his fifth decade he began drawing editorial cartoons, for which he won the Pulitzer Prize in 1948. At the age of eighty, he began a new career as a sculptor, and sold more than three hundred works.

Of all this huge, varied, and celebrated lifework, that most associated with its creator, which landed his name in The Oxford English Dictionary, are the fanciful inventions, where absurdly complicated and improbable machines are devised to accomplish everyday tasks. His first invention cartoon was published in 1914, and they are still being re-published today.

Amazingly, in 1912, two years before Rube Goldberg's first invention cartoon, one Arnold Zukor of New York City obtained United States Patent (1,046,533) for an invention deserving of the as-yet-uncoined term, "Rube Goldbergian". This contraption, composed of a mere 58 parts, is a burglar alarm which, when a masked miscreant attempts to stealthily open the door or window to purloin the purse of a peacefully sleeping victim, sets in motion a multitude of cogs, levers, springs, cams, and other apparatus with the ultimate result of spraying water on the head of the sleeper, so as to awake even those prone to sleep through the noise of a bell or whistle.

The invention was so unique that it fairly zipped through the patent office, being filed on July 22, 1912 and issuing on December 10 of the same year. You can look up this patent on the U.S. Patent and Trademark Office Web site, but patents issued before 1976 are available only in image form, with the images delivered as very large black and white bitmap scans in TIFF format, which often require fiddling with browser plugins to view, and may display infelicitously on small screens. Since patent documents are in the public domain, I have taken the liberty of creating a Web version of this patent with smoothly scaled grey-scale images suitable for viewing online.

Posted at 20:48 Permalink

Monday, August 15, 2005

Earth and Moon Viewer: Stateless Version Posted

The overhaul of dynamic Web resources at Fourmilab was completed today by the posting of an updated version of Earth and Moon Viewer which generates its embedded images in "stateless" mode, which permits requests to be routed by the load balancer to any machine in the server farm without the need for session persistence. Stateless versions of Solar System Live and Your Sky were posted earlier, and served to test the mechanism before it was deployed in the more complicated and frequently accessed Earth and Moon Viewer. The dynamically-generated HTML produced in response to requests is now XHTML 1.0 (transitional) compliant; static HTML files associated with the application were upgraded to XHTML 1.0 last April.

Posted at 23:35 Permalink

Saturday, August 13, 2005

Strike Out: Questions and Quibbles Addendum

I've posted a revision of the Strike Out document which addresses several issues raised by those who survived reading the original screed. I'll add further discussion to this section as it evolves.

Posted at 02:26 Permalink

Thursday, August 11, 2005

Reading List: Mathematicians in Love

Rucker, Rudy. Mathematicians in Love. Unpublished manuscript, 2005-07-28. New York: Tor, 2006. ISBN 0-7653-1584-X.
I read this book in manuscript form; the manuscript was dated 2005-07-28. Now that Tor have issued a hardcover edition, I've added its ISBN to this item. Notes and excerpts are available on Rudy's Weblog.

Posted at 21:10 Permalink

Tuesday, August 9, 2005

Reading List: The Vast Left Wing Conspiracy

York, Byron. The Vast Left Wing Conspiracy. New York: Crown Forum, 2005. ISBN 1-4000-8238-2.
The 2004 presidential election in the United States was heralded as the coming of age of "new media": Internet-based activism such as MoveOn, targeted voter contact like America Coming Together, political Weblogs, the Air America talk radio network, and politically-motivated films such as Michael Moore's Fahrenheit 9/11 and Robert Greenwald's Uncovered and Outfoxed. Yet, in the end, despite impressive (in fact unprecedented) fund-raising, membership numbers, and audience figures, the thoroughly conventional Bush campaign won the election, performing better in essentially every way compared to the 2000 results. This book explores what went wrong with the "new politics" revolution, and contains lessons that go well beyond the domain of politics and the borders of the United States.

The many-to-many mass medium which is the Internet provides a means for those with common interests to find one another, organise, and communicate unconstrained by time and distance. MoveOn, for example, managed so sign up 2.5 million members, and this huge number and giddy rate of growth persuaded those involved that they had tapped into a majority which could be mobilised to not only win, but as one of the MoveOn founders said not long before the election, "Yeah, we're going to win by a landslide" (p. 45). But while 2.5 million members is an impressive number, it is quite small compared to the approximately 120 million people who voted in the presidential election. That electorate is made up of about 15 million hard-core liberals and about the same number of uncompromising conservatives. The remaining 90 million are about evenly divided in leaning one direction or another, but are open to persuasion.

The Internet and the other new media appear to have provided a way for committed believers to connect with one another, ending up in an echo chamber where they came to believe that everybody shared their views. The approximately USD 200 million that went into these efforts was spent, in effect, preaching to the choir--reaching people whose minds were already made up. Outreach to swing voters was ineffective because if you're in a community which believes that anybody who disagrees is insane or brainwashed, it's difficult to persuade the undecided. Also, the closed communication loop of believers pushes rhetoric to the extremes, which alienates those in the middle.

Although the innovations in the 2004 campaign had negligible electoral success, they did shift the political landscape away from traditional party organisations to an auxiliary media-savvy network funded by wealthy donors. The consequences of this will doubtless influence U.S. politics in the future. The author, White House correspondent for National Review, writes from a conservative standpoint but had excellent access to the organisations about which he writes in the run-up to the election and provides an inside view of the new politics in the making. You have to take the author's research on faith, however, as there is not a single source citation in the book. The book's title was inspired by a 2001 Slate article, "Wanted: A Vast Left-Wing Conspiracy"; there is no suggestion of the existence of a conspiracy in a legal sense.

Posted at 00:03 Permalink

Saturday, August 6, 2005

Floating Point Benchmark: Ada 95 Benchmark Added

I have completed an Ada 95 implementation of the floating point benchmark (the original trigonometry-intense fbench, not the FFT-based ffbench) and added results from the GNAT/GCC 3.4.4 Ada compiler to the language performance comparison section of the fbench document. Here is the relative performance table with Ada included.

Language Relative
Time
Details
C 1 GCC 3.2.3 -O3, Linux
Visual Basic .NET 0.866 All optimisations, Windows XP
FORTRAN 1.008 GNU Fortran (g77) 3.2.3 -O3, Linux
Java 1.121 Sun JDK 1.5.0_04-b05, Linux
Visual Basic 6 1.132 All optimisations, Windows XP
Ada 1.401 GNAT/GCC 3.4.4 -O3, Linux
Python 17.6 Python 2.3.3 -OO, Linux
Perl 23.6 Perl v5.8.0, Linux
JavaScript 27.6
39.1
46.9
Opera 8.0, Linux
Internet Explorer 6.0.2900, Windows XP
Mozilla Firefox 1.0.6, Linux
QBasic 148.3 MS-DOS QBasic 1.1, Windows XP Console

Apart from the general remarks about benchmarking and the specific disclaimers in the last item about the language benchmarks, note that while I have tried to port the benchmark in as close as possible to my comprehension of the "Ada way", this is my first nontrivial Ada program, so it is entirely possible I have inadvertently done something which adversely affects performance. Ada experts are invited to review the source code included in the fbench archive and experiment with performance tweaks, both on GNAT/GCC and other Ada development environments; please report any interesting results with the Feedback button and I'll pass them on here.

Posted at 22:48 Permalink

Friday, August 5, 2005

Mozilla Firefox: JavaScript "Unresponsive" Timeouts and about:config

In the process of running the recent multi-language floating point benchmarks, I wanted to time JavaScript execution in several Web browsers with (presumably) different implementations of the language. The floating point benchmark is usually run with the iteration count set so the overall benchmark runs for about five minutes; that minimises start-up and end effects and averages out jitter and other inconsistencies in timing. (Reported results are based on at least five runs after outliers have been discarded.)

I had no difficulty running the benchmark for five minutes in the Opera browser (which also ended up delivering the best JavaScript performance), but when I tried the same test with Mozilla Firefox, I discovered that after about five seconds, the benchmark stops and the following perversely worded alert pops up: "A script on this page is causing mozilla to run slowly. If it continues to run, your computer may become unresponsive. Do you want to abort the script?", accompanied by "OK" and "Cancel" buttons. Note that the "OK" button cancels the execution of the script, while "Cancel" says it's OK to let the script continue. If you do click "Cancel", after another five seconds the alert pops up again ad infinitum or until the JavaScript program stops running.

The reason for this appears to be that in Firefox the same thread runs the graphical user interface and JavaScript, so while a JavaScript program is executing, menus and buttons do not work, and even window repaint does not occur. A hostile Web page could, then, hang a user's browser simply by invoking a JavaScript infinite loop when the page loaded. Popping up the alert allows the user to cancel a runaway JavaScript program, whether hostile or inadvertent, without having to kill the browser. All right, given how intimately JavaScript's interaction with the browser can be, it is genuinely difficult to run it in a separate thread, and detecting whether a program is in an infinite loop is not only "difficult" (as I read on a weblog while researching this issue), it's stone impossible, and there's no question that an annoying alert beats having to manually kill and restart the browser. Still, to me, a five second timeout on script execution seems, while perhaps consonant with the attention span of the video game generation, a tad short. It certainly is irritating when you're trying to run JavaScript benchmarks.

I poked around in the various configuration panels and found no way to change it, so I put on my special X-ray Googles and discovered a whole page of configuration settings I'd never encountered before! To display it, simply type "about:config" in the Firefox URL bar et voilĂ  hundreds of settings you can twiddle to customise Firefox to your whim. Factory default settings are in normal type, and any that have been altered appear in bold. Among these is the rather stealthily named "dom.max_script_run_time" with a default of 5--this is the JavaScript timeout setting, and you can set it to any number of seconds you prefer by double clicking the item and entering the desired value. After changing this setting, you must close all Firefox windows and restart Firefox for it to take effect.

With more than 800 settings on this page, there is much to explore and the potential to eliminate some of the residual irritation due to infelicitous Firefox defaults.

Posted at 01:25 Permalink

Thursday, August 4, 2005

Floating Point Benchmark: Comparing Languages

I have used my floating point benchmark, based on an optical design ray tracing program I wrote almost a quarter of a century ago, to measure the performance of computers and C language implementations ever since the days of the IBM PC/AT. Unlike many benchmarks in the early days of personal computing, it uses double precision floating point and trigonometric functions heavily, and it checks the answers, which has proved embarrassing to a number of compiler vendors over the years. The algorithm is well-understood (it's based on James H. Wyld's classic chapter on ray tracing in Amateur Telescope Making), and has been confirmed to produce results identical to the 11th decimal place on three different double precision floating point formats: IBM 360/370, VAX, and IEEE 754. As Moore's Law and compiler optimisation technology have progressed over the last two decades, current timings on the benchmark are more than five orders of magnitude faster than those of the first machines on which it was run--with identical results. The benchmark is a small, simple program which is easy to port even to less-than-standard language implementations and, in case problems arise, relatively easy to debug. During the 1980s, the benchmark proved uncannily accurate in predicting how fast AutoCAD would regenerate large drawings, and was used by Autodesk to test compilers and evaluate the suitability of different machines as AutoCAD platforms.

The reference implementation of the benchmark is in C, and it has primarily been used to test C implementations, but FORTRAN and Microsoft BASIC versions have been available almost since inception. Jim White ("mathimagics"--approach with extreme caution, known to be in possession of weapons of math instruction) recently ported the benchmark to Java, Microsoft Visual BASIC 6, and Scilab (a free MATLAB-like scientific software package) and kindly contributed them for others to use. His work motivated me to dust off another project from my infinite "to do" list, and I've added ports of the benchmark to Perl, Python, and JavaScript to the distribution as well, which may now be downloaded from the main benchmark page.

Having all these different language implementations (which produce identical results) invites comparison among languages, so I've spent the last couple of days running benchmarks, all on the same machine, with the following results. I've set the run time of the C implementation to 1, and expressed the run time of the other languages relative to that: a relative time of 5 means that language runs the benchmark five times more slowly than the C version. Now obviously, if you're doing heavy-duty number-crunching in a scripting language like Perl, Python, or JavaScript, you're in a state of sin, but it's interesting to know just how bad (or tolerable) the hit is, since it may make sense to do modest numerical work directly in a script rather than add all the complexity of (for example), writing a module in a compiled language. The performance figures for Visual BASIC and Java may surprise you; they surprised me.

Language Relative
Time
Details
C 1 GCC 3.2.3 -O3, Linux
Visual Basic .NET 0.866 All optimisations, Windows XP
FORTRAN 1.008 GNU Fortran (g77) 3.2.3 -O3, Linux
Java 1.121 Sun JDK 1.5.0_04-b05, Linux
Visual Basic 6 1.132 All optimisations, Windows XP
Python 17.6 Python 2.3.3 -OO, Linux
Perl 23.6 Perl v5.8.0, Linux
JavaScript 27.6
39.1
46.9
Opera 8.0, Linux
Internet Explorer 6.0.2900, Windows XP
Mozilla Firefox 1.0.6, Linux
QBasic 148.3 MS-DOS QBasic 1.1, Windows XP Console

For additional details, including the complete history of results on various machines, please see the fbench page. There is something about benchmarking which invites debate and acrimony, so let me state that I have no inclination to participate in the former nor indulge in or be the target of the latter. While I have taken care in running the benchmarks and am confident the results are repeatable within 2% on my machine with my programming environment, results on other systems, or from "benchmark tweaking" of the various programs may produce quite different results. In any case, the relative speed numbers are representative only of a program of this kind, and are meaningless for comparing other kinds of tasks (for example, I/O intensive work or text processing).

Posted at 02:32 Permalink

Tuesday, August 2, 2005

Reading List: Back to the Klondike

Barks, Carl. Back to the Klondike. Prescott, AZ: Gladstone, [1953] 1987. ISBN 0-944599-02-8.
When this comic was originally published in 1953, the editors considered Barks's rendition of the barroom fight and Scrooge McDuck's argument with his old flame Glittering Goldie a bit too violent for the intended audience and cut those panels from the first edition. They are restored here, except for four lost panels which have been replaced by a half-page pencil drawing of the fight scene by Barks, inked and coloured in his style for this edition. Ironically, this is one of the first Scrooge comics which shows the heart of gold (hey, he can afford it!) inside the prickly skinflint.

Posted at 21:19 Permalink