Saturday, December 29, 2007

A Little Story from History with No Relevance for America Today




I love a good story. Today's story is about the epic struggle between Sparta and Athens, the superpowers of ancient Greece.
The Spartans were the ultimate military machine and it's enemies never got close to their city. In the ancient world it was said that in 600 years the women of Sparta had never seen the camp fires of their enemies. Just a small detachment of the scarlet-cloaked Spartan warriors sent fear into the heart of other cities.
Sparta fought the Athenians for decades in the terrible Peloponnesian war and Sparta eventually won. Flush with victory, Sparta then installed its own form of government upon Athens and Athens' allies. Sparta even replaced the governments of its own allies with "better" forms of government.

But a funny thing happened. The other Greek city-states didn't appreciate the wisdom of Sparta. One by one they rebelled against the Sparta installed governments in bloody civil wars and reverted to their more traditional forms of governance.

Thinking that Sparta represented freedom from Athenian tyranny, Thebes had been a stanch ally of Sparta during the war. But Thebes, disillusioned with Sparta, formed an alliance of the willing, went to war against Sparta and, to the astonishment of all, won.
Sparta was destroyed oddly enough after becoming the only superpower and forcing its own form of government on others, drawing the hatred of all. I think the Greeks called this attitude "hubris".

Well, that's today's story. Sometimes we learn things from history, but today's story has no relevance for modern times, but it's a good story nonetheless.

Thursday, December 20, 2007

Renaming xml attributes in VS2005 using Regular Expressions



In our product at work we have zillions of xml test files to feed nUnit. Refactoring becomes a problem when we want to rename an attribute in all those files.
In this case I wanted to rename the "Survey" element's 'id' to 'registrarId', but not the other elements' 'id' attribute. The element name and the attribute to change must be on the same line for this to work. A tiny sliver of regular expression in the "Find and Replace" dialog did the trick:

Find What: \<Survey {.*} id=
Replace with: \<Survey \1 registrarId=


The "Find What" says find "<Survey " followed by any characters followed by " id=".
The "\1" takes the value of all the characters skipped with the {.*}.

Wednesday, December 19, 2007

Tuesday, December 11, 2007

CafePress and the Long Tail




Over the years I've gotten requests for a poster of an alternate design of the Periodic Table I created back in the early 90s. I encouraged these people (who possess excellent taste) just download the gif file, take it to Kinkos and get a poster printed. I toyed with the idea of getting a batch of 50 or so printed and selling them from my home. But the capital costs and hassle of handling the money, tubes, and postage always dissuaded me.
Enter CafePress. Now anyone can sell an image on T-Shirts, posters, coffee mugs with minimal hassle. CafePress also will press your band's awesome CDs and print that novel you wrote in college - all on demand. They make it, ship it, and handle the money. All those "Long Tail" obscure designs can now have a home. You just upload your image and they make the items to order. Check out my store at CafePress.com/MayanPeriodic and the www.MayanPeriodic.com which explains the design.
I like this new web2.0 concept of everyone can do what only a small minority could do in the past, but is this a good thing?

Saturday, December 08, 2007

Future Factories of America - It's the small things that count

bacteria
Under the title, "Nanotube-producing bacteria show manufacturing promise", EurekAlert.org tells about bacteria producing nanotubes. I think this is just the tip of the iceberg.
In the not too distant future, most of our chemical factories will be replaced with vats of genetically engineered bacteria cranking out our needs.
Today, algae are being breed/engineered to produce oil that will be converted into something like gasoline. In the future the algae will just directly produce gasoline.
Most anything chemical we need could be produced from our tiny friends. But you ask, "What about milk?". Yep. It's not inconceivable that bacteria could be engineered to produce reliable, consistent, yummy white stuff. This would reduce a plethora of greenhouse gases. Creating the feed for cows creates lots of greenhouse gases. The cows themselves emit methane, a powerful greenhouse gas.
The revolution in chemical production is coming. Grab a hot chocolate-chip cookie and glass of cold milk, and prepare to be marveled.