Wednesday, January 30, 2008

Last Night's Austin Java User's Group


book

Last night Ernest Hill gave an excellent introduction to the SCALA language. It continues the recent trend of all objects, even lowly integers, are real objects.
Eitan Suez talked about his recent work with jmatter.org. One idea was to create a "browser" environment for jmatter applications. A user would download a 25Meg file containing all the libraries for a jmatter app, and then only have to download the 100K or so for all the other jmatter applications they would run. I liked the idea.
Eitan also talked about his new open source project css4swing which allows java Swing applications to use css rules to define the look of an application.
I always enjoy hearing Eitan speak since he so often has curious, interesting, and big ideas.
I also won the very cool Google Toolkit book.

Tuesday, January 29, 2008

LifeHack: Perfect Exercise Setup

Here's my perfect exercise setup: An elliptical rider with a heart monitor set in front of a TiVo. Now when I want to watch TV I go to my rider and exercise while watching while keeping my heart rate above 125.
I can breeze through an hour workout and really enjoy it.

Friday, January 18, 2008

Austin on Rails Meeting

This last Austin on Rails meeting highlighted the latest version of Sun's NetBeans IDE. Gregg Sporar gave a good overview of all the new Ruby and Rails features in NetBeans. I am very impressed with Sun's commitment to Ruby and Rails. My favorite feature was the ability to convert javaStyleCamelCaseVariables names to their equivalent, java_style_camel_case_variables ruby style automatically.
The ability to switch easily between model,view, and controls looked very helpful.

Monday, January 14, 2008

Interesting difference between ie and firefox/opera regarding location.href

Recently here at inotech we ran into some oddities regarding javascript in different browsers. This test page shows the issue:


<body>
<h2>Test of ampersands </h2>
<script language="JavaScript" type="text/javascript" ><!--
location.href="http://www.myhost.org/cgi-bin/SimpleFormAction.pl?cat=felix&amp;dog=fido";
//--></script>
</body>

Note the the "&" in the location.href value have been escaped already to "&amp;".

In Internet Explorer the following is echoed back from the form:

cat = felix
dog = fido

But in Firefox and IE we get,

cat = felix
amp;dog = fido

IE converts the "&amp;" to just "&", although I think Firefox/Opera are doing the right thing not to escape the amp. No charge for this tip today, but be careful in how you specify the ampersand in your hrefs.

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