Categories
Uncategorized

Multi-Processor Computing in 1924

My friend Miss Fipi Lele, who provides me with a lot of pictures for my blogs, pointed me to this photo on Shorpy, “The 100-Year-Old Photo Blog”. It depicts “multi-processor computing”, circa 1924:

Old-school computing room (preview size)
Click the photo to see it on its original site, Shorpy, at full size.

The caption for the photo at Shorpy is:

November 24, 1924. Washington, D.C. “Bonus Bureau, Computing Division. Many clerks figure the amount of the bonus each veteran is entitled to.”

Before the age of electronic computers, the term computer referred to someone whose profession was performing mathematical calculations by hand.

Here’s what Wikipedia has to say about the profession’s origins (see the entry Human Computer):

The approach was taken for astronomical and other complex calculations. Perhaps the first example of organized human computing was by the Frenchman Alexis Claude Clairaut (1713–1765), when he divided the computation to determine timing of the return of Halley’s Comet with two colleagues, Joseph-Jérôme Le Lepart and Nicole-Reine Étable. For some men being a computer was a temporary position until they moved on to greater advancements. For women the occupation was generally closed, but this changed in the late nineteenth century with Edward Charles Pickering. His group was at times termed “Pickering’s Harem.” Many of the women astronomers from this era are computers with possibly the best known being Henrietta Swan Leavitt. Florence Cushman was one of the Harvard University computers from 1888 onward. Among her best known works for him was A Catalogue of 16,300 Stars Observed with the 12-inch Meridian Photometer. She also worked with Annie Jump Cannon. That said as a female computer she normally earned half of what a male counterpart would.

The Indian mathematician Radhanath Sikdar was employed as a “computer” for the Great Trigonometric Survey of India in 1840. It was he who first identified and calculated the height of the world’s highest mountain, later called Mount Everest.

Categories
Uncategorized

Zero Punctuation’s Bang-On Review of “Too Human”

Some of my coworkers at b5 were all hot-and-bothered about the demo for the XBox 360 game Too Human, so I decided to download it and give it a try. I played it and was generally less than impressed with both the gameplay and especially the storyline (like Assassin’s Creed, the story’s a rather clumsy mish-mash of swords-and-sorcery and sci-fi genres).

Ben “Yahtzee” Croshaw, the fast-trash-talking host of the excellent videogame review show Zero Punctuation agrees with me. He panned the game in his trademark fashion:

Categories
Uncategorized

Better, Funnier Videos Featuring Bill Gates and Celebrities

“Was this ad supposed to be funny?” is the question that a lot of techies are asking after having seen the first of the new series of Microsoft ads featuring Bill Gates and Jerry Seinfeld. The ad, which sets up both the tone for future commercials and the Bill/Jerry dynamic, could’ve been lifted straight from any number of Seinfeld episodes. In fact, the “Churro? No thanks” exchange is practically a repeat of the “Snapple? No.” exchanges in the episodes The Virgin and The Visa.

It’s a real shame that the ad turned out this way because there’s prior work with Bill and celebrities that is funny and gives Microsoft a warmer, fuzzier image. Here are two of the most notable ones…

Bill and John Heder in a Napoleon Dynamite Spoof

This video was shown at Microsoft’s 2005 Professional Developers Conference, and unlike the ad with Seinfeld, it makes good use of the source material and the guest star, and better still, it’s actually funny. They could’ve easily repurposed this ad or called Jon Heder to shoot some more:

Bill Gates’ Last Day

This one’s not as funny or as clever as the Napoleon Dynamiteone, but it’s still amusing and cute: it’s a video shown at the Consumer Electronics Show earlier this year that purports to be a documentary of Bill’s last full day at Microsoft. This one features a boatload of celebrities: Bono, Hillary Clinton, Bob Costas, Al Gore, Barack Obama, George Clooney, Jay-Z, Matthew McConaughey, Jon Stewart, Steven Spielberg and Brian Williams.


We’ll have to wait ands see if the next Gates/Seinfeld ad is any better, or at least generates more than a mild chuckle. They’ve got nowhere to go but up…

Categories
Uncategorized

Seinfeld/Gates Microsoft Ad: Who are the Ad Wizards Who Came Up With This One?

At last, the first Microsoft commercial featuring Jerry Seinfeld and Bill Gates! Its humor follows the Seinfeld formula with one difference: Jerry plays the Kramer-esque role while Bill plays the “Seinfeld” part.

The ad runs for 1 minute and 30 seconds, the first minute of which is devoted to Jerry helping Bill shop for discount shoes. Microsoft or what they promise for the future isn’t mentioned until the 1:02 mark, and the big revelation is that they’re going to make computers moist and chewy like cake. The commercial ends with Bill shaking the junk in his trunk, followed by three cards: “The Future”, “Delicious”, and finally the Windows logo.

My guess is that the purpose of this commercial is to set the tone and flavor of the Gates/Seinfeld relationship for the ones to follow, which presumably will have a little more substance.

Categories
Uncategorized

Enumerating Enumerable: A Cute Trick for Explaining inject / reduce / fold

Enumerating Enumerable

The next method I’m going to cover in Enumerating Enumerable — the series of articles in which I try to do a better job of documenting Ruby’s Enumerable module than Ruby-Doc.org does — is inject, a.k.a. reduce. Not only is it one of the trickiest methods to explain, it’s also one of the cornerstones of functional programming. I thought that I’d take a little time to explain what the function does.

inject

The term inject comes from Smalltalk and isn’t terribly descriptive. I remember reading the documentation for it and being all confused until I saw some examples. I then realized that I’d seen this function before, but under two different names.

reduce

The Second-Best Accordion Picture Ever
Burning Man 1999: gratuitous nudity and even more gratuitous accordion!

The second name by which I encountered this function is reduce, and it was at Burning Man 1999. I was to start a new job the week after Burning Man, and I had to learn at least some basic Python by then. So along with my camping gear, accordion and a kilo of candy for barter, I also brought my laptop (a 233Mhz Toshiba Sattelite with a whopping 96MB of RAM) and O’Reilly’s Learning Python and noodled during the downtime (early morning and afternoon) on Python 1.6. When I got to covering the reduce function, I was confused until I saw some examples, after which I realized that I’d seen that function before, but under a different name.

(You may have also heard of reduce through Google’s much-vaunted MapReduce programming model.)

fold

The first name by which I encountered this function is fold, or more specifically, “fold left” or “foldl”, and it was at the “Programming Paradigms” course I took at Crazy Go Nuts University. “Programming Paradigms” was a second-year course and had the reputation of being the most difficult course in the computer science curriculum. The intended purpose of this course was to provide students with an introduction to functional programming (these days, they use Haskell and Prolog, back then, it was Miranda). Its actual effect was to make most of the students swear off functional programming for the rest of their lives.

In spite of the trauma from this course, I ended up remembering a lot from it that I was able to apply, first to Python and now to Ruby. One of these things is a cute little trick for cememnting in your mind what fold does.

What Ruby-doc.org Says

Before I cover that cute little trick, let’s take a look at what Ruby-doc.org’s documentation has to say about Enumerable‘s inject method.

One thing you’ll find at Ruby-doc.org is that as of Ruby 1.8.7 and later, inject gained a synonym: the more familiar term reduce.

As for the description of the inject/reduce method, I don’t find it terribly helpful:

Combines all elements of enum by applying a binary operation, specified by a block or a symbol that names a method or operator.

If you specify a block, then for each element in enum<i> the block is passed an accumulator value (<i>memo) and the element. If you specify a symbol instead, then each element in the collection will be passed to the named method of memo. In either case, the result becomes the new value for memo. At the end of the iteration, the final value of memo is the return value fo the method.

If you do not explicitly specify an initial value for memo, then uses the first element of collection is used as the initial value of memo.

(Yes, those stray <i> tags are part of the text of the description for inject. Hopefully they’ll fix that soon.)

This confusing text becomes a little clearer with some examples. The most typical example of inject/reduce/fold in action is the classic “compute the sum of the numbers in this range or array” problem. There are a number of approaches you can take in Ruby, all of which use inject/reduce:

(1..8).reduce(:+)
=> 36

(1..8).reduce {|sum, number| sum += number}
=> 36

(1..8).reduce(0) {|sum, number| sum += number}
=> 36

The reduce method takes some kind of operation and applies it across the enumerable to yield a single result. In this case, the operation is addition.

Explaining how that operation is applied is a little trickier, but I do just that in the next section.

Demonstrating inject / reduce / fold With a Piece of Paper and Literal Folding

To explain what’s happening in the code above, I’m going to do use a piece of paper. I’ve folded it into 8 even sections and then numbered each section, as shown in the photo below:

Think of the paper as the range (1..8). We’re now going to compute the sum of the numbers in this range, step by step, using a literal fold — that is, by folding the paper. I’m going to start folding from the left side of the paper, and when I do, I’m going to add the numbers that I’m folding into each other.

In the first fold, I’m folding the number 1 onto the number 2. Adding these two numbers yields 3, which I write on the back of the fold:

For the second fold, I fold the first number 3 onto the second number 3. The sum of these two numbers is 6, and I write that on the back of the resulting fold:

I fold again: this time, it’s the number 6 onto the number 4, the sum of which is 10. I write that number down on the resulting fold:

Next, I fold 10 onto 5, yielding the number 15:

I then fold 15 onto 6, which gives me 21:

Next comes 21 folded onto 7, which makes for a sum of 28:

And finally, 28 folded onto 8, which gives us a final total of 36.

And there you have it: a paper-based explanation of inject/reduce/fold, as well as why I often refer to the operation as “folding”.

Categories
Uncategorized

Google Chrome is Now Available for Download!

Downloading Google Chrome

I’m downloading Google Chrome as I write this. More later.

Categories
Uncategorized

Enumerating Enumerable: Enumerable#include?

Enumerating Enumerable

Welcome to the eighteenth installment of Enumerating Enumerable!

In this series of articles, I’m going through the methods in Ruby’s Enumerable in alphabetical order, explaining what each does and providing examples. This is my attempt to make better documentation for Ruby’s Enumerable module than Ruby-Doc.org’s.

In this article, I cover the include? method.

In case you missed any of the previous articles, they’re listed and linked below:

  1. all?
  2. any?
  3. collect / map
  4. count
  5. cycle
  6. detect / find
  7. drop
  8. drop_while
  9. each_cons
  10. each_slice
  11. each_with_index
  12. entries / to_a
  13. find_all / select
  14. find_index
  15. first
  16. grep
  17. group_by

Enumerable#include? Quick Summary

Graphic representation of the "include?" method in Ruby's "Enumerable" module.

In the simplest possible terms Does the collection contain an item equal to this one?
Ruby version 1.8 and 1.9
Expects An argument containing the item to search for in the collection.
Returns
  • true if there is at least one item in the collection that is equal (using the == operator) to the argument.
  • false if no item in the collection is equal (using the == operator) to the argument.
RubyDoc.org’s entry Enumerable#include?

Enumerable#include? and Arrays

When used on an array, include? iterates through it, comparing items in the array with the argument using the == operator. If any of these comparisons has a result of true, include? returns true. If you think of arrays as sets, you can think of include? as a set membership test.

Examples

# Here's a list of words (if they seem unfamiliar, go read
# http://en.wikipedia.org/wiki/Zoom_schwartz_profigliano)
words = ["zoom", "schwartz", "profigliano", "butterman"]
=> ["zoom", "schwartz", "profigliano", "butterman"]

# Is "profigliano" in our list of words?
words.include? "profigliano"
=> true

# How about "kwyjibo"?
words.include? "kwyjibo"
=> false

Enumerable#include? and Hashes

include?, when used with a hash, behaves differently than you might expect. You might think that include? would return true if given a two-element array argument that matched an item in the hash, where the first element matched the key and the second element matched the corresponding value.

However, that is not the case. Instead, include? returns true if there is a key in the hash that is equivalent to the given argument when compared with the == operator. In other words, include?, when used with a hash, answers the question “Is there an item in this hash with this key?”

Examples

values = {"zoom" => 1, "schwartz" => 5, "profigliano" => 10, "butterman" => 25}
=> {"zoom"=>1, "schwartz"=>5, "profigliano"=>10, "butterman"=>25}

values.include? "schwartz"
=> true

values.include? ["schwartz", 5]
=> false

values.include? "kwyjibo"
=> false