May 7, 2008

A moment of clarity

Most people, myself included, can be deluded into thinking that all the great discoveries happened long ago.   That, for the most part, we have everything figured out.

I suggest you read this article about memresistors.

Fact: This technology was theorized 30+ years ago, but not demonstrated until April 30th of this year.

Fact: One of the fundamental principles of electronic circuit theory was wrong.  As  wrong as claiming that Force == Mass * Velocity, instead of Force == Mass * Acceleration.

Fact: The evidence that this principle was incorrect was here all along, but buried and shoved aside as ‘hysteresis’

What, in your lives, is being ignored because it doesn’t fit theory?   Maybe you should be focusing on what theory doesn’t explain, instead of what it does.

Oh, and as an aside - this new technology is yet another recent innovation that will make computers faster, smaller and better.  I have friends who claimed 10 years ago that we were already at the theoretical limits of computing and solar conversion efficiency and so forth.      But the world didn’t listen to them, kept innovating, and now-a-days it seems like we can’t go a month without some exciting new advancement in technology.

May 1, 2008

Next Year’s Programming Language

I haven’t seen this language before, but I’m certain as soon as we have a web framework for it, it will go mainstream.

Fair warning: The name is a swear word.

Next stop:   BF on Frails!

Ruby and Python are both wrong

RUBY IS WRONG

PYTHON IS WRONG

April 15, 2008

Selenium RC Cookbook, Part 1

(This cookbook assumes you know the basics about how to get started with Selenium RC. These examples are also in Java, but should be pretty much consistent for any language)

Finding text in a certain place on the page:

Use XPath, treating the HTML of your page as well-formed XML.

browser.getText("//div[@id='content']/table/*/tr[2]/td[1]")

(In English: at any level of depth, find the div where the id=”content”. Then find the table element under that, and then give us the text of the first cell of the second row.)

Finding text anywhere on the page

browser.isTextPresent("Your Text Here");

Get the text of a URL link

Assuming you have text like: <a href=”…” > your link text here </a>, you could consider:

browser.getText("//a[@href='...']");

Note the consistency with the other example above - anytime you have an opening and closing <element> </element> tag, you can use getText() and XPath to find it.

Get the href of a URL link

Again, assuming you have text like: <a href=”my_link_here” > your link text here </a>, you could consider:

browser.getAttribute("//a[1]/@href");

which would return: my_link_here

Note the slight differences with getText() above, but the idea is generally the same.

How do I find what’s in my Select menu?

String[] options = browser.getSelectOptions("//form//select");

This would return an array of the option text from the only <select> element inside the only <form> element.

If you had more than one form, or more than one select:

String[] options = browser.getSelectOptions("//form[1]//select[1]");

This would return the options listed in the first select of the first form on the page.

April 11, 2008

Visit the Wayback Machine

From April, 2006 - Cedric Beust explains “Why Ruby on Rails won’t become mainstream

Personally, I think he turned out dead wrong on this.  If the AARP is building a large-scale software project in Ruby-on-Rails, with the ongoing back-and-forth between Django and Rails, and the various efforts to “port” rails to other languages, I think it is hands-down a mainstream contender.

April 10, 2008

BFD!

If Test-First Development (TFD) is a specialized subset of Test-Driven Development (TDD), then surely the equivalent specialized subset of Behavior-Driven Development is Behavior-First Development.

Today I had my first experience in developing BFD.

I know what you’re thinking:  BFD.

But it’s a BFD to me.  Using a rather exotic concoction of DBUnit, HSQLDB, Selenium, Cargo and EasyB, I was able to write a story  to describe some new functionality for a web application, and run that story as a test (via EasyB/Groovy), before I wrote any of the code to implement the functionality.

Other ingredients in this concoction:  Tomcat, Ant, Junit, Struts2, Spring, Cobertura and four or five different logging frameworks.

Observations:

  •  It is difficult to see what is going on when your story fails - the story failure is often fairly far away from the  code failure.
  • DBUnit throws multiple exceptions as part of normal operating procedure.  That is a crime against humanity.

Latest Cool Tool

I’m sure everyone else in the world found and mastered  XPath Checker long ago, but for those of you who haven’t, it is a fantastic Add-on for Firefox that lets you practice XPath expressions on real, live web pages.

Why would you want to do that? 

If you want to write Functional webapp tests via Selenium, a good, solid working knowledge of XPath is essentially mandatory for all but the most trivial of tests.

What about Selenium IDE? 

The Selenium IDE is incredibly helpful for navigating your pages, but it is not help at all with testing the content on those pages.

In other words, if you want to register a new user, add four things to your cart, visit your recommendations page and then check out, Selenium IDE will properly structure your clicks and everything else.

But if you want to find out if your checkout page lists your four items, and you need to be specific about where on the page  those items show up, you have to use XPath with Selenium to get to the correct table, div, what-have-you.

Enter XPath Checker.  During your Selenium IDE-driven  recording session, control-click on the page, and experiment with the correct XPath query to get to the cell/row/etc you want to see.

April 4, 2008

Recent Impressions

Hudson

Good Continuous Integration tool. Nice charts, easy to use, fairly flexible out of the box.   A _lot_ less setup work than CruiseControl.  And the plugin system is well done, and pretty nifty.

Struts2

An incoherent mess.  Documentation is spotty, uses a lot of contrived toy examples that blow up on anything more complex than hello world.  Documentation is also simply wrong in some cases (for example, the ‘var’ attribute on the iterator tag is not valid according to the TLD).  Namespaces are nice in theory, but frustrating in practice.   I can’t get the wildcard action management to work reliably, although this may just be pilot error.

Good things: 

The integration with Spring is nice, and I haven’t seen a web framework yet that is more friendly to unit testing.  When it works properly, the wildcarding is very nice.   The Action.execute() model is useful, and easy in concept.

March 24, 2008

Best Practices

An oldy, but a goody, one that I haven’t seen before.

One comment I saw recently was “it means ‘practices of the best’” - as in “the things that the best software developers/consultants do”.

I don’t find that argument particularly persuasive.  For several reasons:

  1. No one knows who the very “best” software developer is.
  2. No one even knows who the very best software developer is, in a particular practice area.
  3. Even if we could magically discern who the best software developer was, it is very likely that:
  • Her approach would be highly tuned to the specific company/organization she was with
  • She would have a hard time elaborating and generalizing her approach without diluting its effectiveness
  • Others would point at this poor developer and say “She is only an expert on Y in situation X, but we are in situation Z”

So while I think it is an interesting concept (practices of the best), I can’t acept that interpretation as being any more valid than “the best way to solve this problem”.

Stelligent

To keep everyone in the loop, I’ve taken a job at Stelligent, which is an agile consulting company in Reston, VA.   They have a neat focus on infrastructure instead of process, and since that’s where many of my philosophical struggles with Agile are, I’m excited at the prospect of sharing what I have learned, and learning some new ways to solve some of the sticky wickets of Agile development.

Also, my boss, Andy Glover, is an avid triathlete, which gives us something to talk about at lunch.

Versioning a Hudson job configuration

Let’s say you’re using Hudson as your build/Continuous Integration tool. And let’s assume you have some jobs running inside Hudson that you want to keep running, even if the build machine blows up. You probably want to maintain:

  • Hudson itself
  • All the plugins
  • The overall configuration
  • The per-job configuration

Naturally, then, your thoughts should turn to “How do I put the Hudson configuration into source control?” Here’s what you do:

  1. Make sure your builds are configured and working to your satisfaction, in a directory that I will from now on refer to as HUDSON_HOME.
  2. Copy the entire HUDSON_HOME directory tree to a temporary location called “versioned_build”
    1. In the versioned_build directory, you’ll find the jobs directory, and under that, a directory for each job.
    2. Inside each job directory, you’ll find configuration .xml files and other miscellaneous files, and you’ll find two subdirectories:
      • workspace
      • builds
    3. Empty those two subdirectories of all files, but do not delete the subdirectories.
  3. Repeat this “clean out” process for each job.
  4. import the entire “versioned_build” directory tree into source management.

Now, you have your Hudson configuration in source control. You can start it up, and assuming HUDSON_HOME is set right (see below), you should see your dashboard, and your jobs listed, and properly configured.

Issues

  • You may have to manually kick off your jobs to “prime the pump”
  • Your build number will not start at 0 unless you do not archive the nextBuildNumber file
  • Your HUDSON_HOME environment variable may be incorrect for your machine (see below)

HUDSON_HOME Portability

For ease of checkout and maintenance, I like the following directory setup:

$HUDSON_HOME/

  • hudson/
    • hudson.war
  • jobs/
    • Your Hudson Jobs Here
  • plugins/
    • Your Hudson Plugins Here

Using this configuration, you can create a file in $HUDSON_HOME called, say, hudson.sh, which would look a little something like this:


#!/bin/sh

export HUDSON_HOME=.

export CVS_RSH=/usr/bin/ssh

java -jar hudson/hudson.war



Using this structure, and that hudson.sh script (I presume you can do something similar in Windows) gives you the following benefits:

  1. Your entire Hudson system, including the Hudson war file and the launcher script are all maintained as part of the repository.
  2. You don’t have to set HUDSON_HOME whenever you check the system out of source control - it’s already set by default to the current directory. As long as you run hudson.sh in its own directory, you’ll get the correct value for HUDSON_HOME

Learn from my mistakes!

  • Unless you absolutely must, don’t tell Hudson where to find Ant or the JDK. If they’re on your path, Hudson will find them on its own. If you set them for your build machine, chances are that on the checkout machine they won’t be in exactly the same place
March 17, 2008

More on CruiseControl Dashboard

It took me about an hour and a half to get the dashboard configured properly.  Here’s what I had to do:

  1. I had to copy all of the cruisecontrol jars and all tornei poker on lineworld pokerpoker italiagame on line pokerdownload live pokerstrip poker livesrtip poker gratisgiochi cartepoker scaricabili gratistexas holdem calculator,texas holdem,poker texas holdemtexas holdem italiastreap pokerpoker in tourseven card stud onlinegiochi on line pokergiocare texas holdem online,poker texas holdem online,texas holdem onlineparty poker bonus,poker con bonus,poker bonusstreet poker onlinesexi poker onlinesexy poker onlinehow to play pokergioco carte pokerpoker carte gratistornei di poker gratisonline poker gameparty poker bonuscraps in lineavirtual gamblingscaricare casino gratisonline casino gamesbonus dei casinogioco keno gratiscasino on line roulette,roulette on line,giochi on line roulettegiochi keno inlineagiochi casino pcsistemi roulettecasino tropezgioco craps in lineawww giochi casinoblog casino onlinekeno inlineacasino poker gratisbest casino onlineautomatic video pokercasino tropez bonus codegiochi video pokerroulette strategyrisposte eurobarre casino on netvincere casino onlinelista casino online of the xml-related jars (saxon, jdom, xerces, xml*) into the WEB-INF/lib directory of the dashboard war
  2. I had to update WEB-INF/web.xml and add a context-param to specify the location of the config-xml file.

Note: You might think that you can give it the correct filename at the web interface, but that never worked for me, no matter how I tried to tweak it.

At the end of the day, cruisecontrol requires a great deal of by-hand tweaking to get it to work for your project.  That’s not necessarily the end of the world, but it is a little disconcerting, since the documentation isn’t really clear about how you do this setup, where and so forth.

CruiseControl….

Well, I’m having a bit of an adventure with CruiseControl.  Some tips, perhaps just for myself:

  1. You have to check your project out of source control into the appropriate checkout directory under the cruisecontrol/ build directory before CruiseControl proper will consider building it.
  2. You have to merge unit test results in by hand
  3. You have to set up your dashboard by hand, and (at least as of today) you have to find the missing classes that it needs and include them

More later…

Groovy: no such property: X for class Y

Having taken up the task of learning Groovy, I stumbled early, as I tried to figure out how to integrate groovy-based unit tests with my java code. I had a java class called ContactScreen, and I wrote a groovy test case:

class ContactScreenTest extends GroovyTestCase {
    void testStandardEmailScreen() {
       screen = ContactHelper.getStandardContactScreen( Contact.EMAIL )
       assertTrue( screen instanceof AnyDayEmailScreen )
    }
}

Which failed when I tried to run it via Eclipse, giving the following error:

testStandardEmailScreen(ContactScreenTest)groovy.lang.MissingPropertyException: No such property: screen for class: ContactScreenTest

I stared at that error for a long time, wondering what the heck it meant. I mean, I’ve seen all sorts of example groovy scripts that don’t require definitions. In fact, the code I was modeling mine after used this very format. What is going on?

Finally, I turned to the groovy user group to help debug my groovy test case. Here’s what I found:

  1. The code I was looking at, circa 2004, is now victim to a fairly significant shift in language specification. In other words, it won’t compile anymore.
  2. The rules for declaring variables is different for scripts versus classes. In other words, if you are just running a script, you don’t need to declare variables. If you are building a class, you have to declare the members of the class via def.

So the working code looks like this:

class ContactScreenTest extends GroovyTestCase {
 void testStandardEmailScreen() {
 	def screen = ContactHelper.getStandardContactScreen( Contact.EMAIL )
 	assertTrue( screen instanceof AnyDayEmailScreen )
 }
}
March 11, 2008

Battlestar Galactica -> April 4th

The final season of BG starts April 4th.  Visiting the Battlestar G. page at Scifi gives you the opportunity for an 8-minute recap of the story so far, and an interesting picture at the bottom, with fairly disturbing implications if taken literally.

But should we take it literally?  What was the intent of the artist?     For all we know, it’s just a joke, and not to be taken seriously.  Maybe its deliberately deceptive, to lead you astray.  Maybe it’s just a cool picture, with no real meaning at all.  Most people look at a design and make snap judgments about what it means, and how to interpret what they see.     Be careful what you draw from pictures like this, because it may not lead you where you need to go.

Without being able to have a conversation with the artist/visionary/designer, it’s not really possible to know.    And that has implications in software development as well.

February 25, 2008

On the market

Having gotten the Sunlight Foundation over the hump technologically with their Sunlight Media Services platform/product, it’s time to start looking for my next great success.

If anyone out there is looking for some project help, or some support/ideas on improving infrastructure, leveraging new technologies or development environments, I’m happy to start a conversation.

January 9, 2008

Rails Rant

Every technology needs a good slap in the face once in a while.   While most of this rant from Zed Shaw is insipid, there are some very good points.   Especially regarding the people and ideas that are worthy of respect, and some commentary on the potential issues with large-scale agile consulting shops.

Anyways, one doesn’t have to admire someone to admit they make some good points.

January 4, 2008

Historic Pleo Video Conference

December 6, 2007

Giving Thanks

You know how sometimes you forget to do something, and then you forget that you forgot, and then you feel bad that you forgot and it just seems awkward…

Well, I wrote this just before Thanksgiving. Since it’s still the holiday season, it’s still worth saying:

  • I want to thank Pamela Slim, and J Timothy King for helping inspire me to try something new
  • I want to thank Tyler Cowen and Alex Tabarrok from Marginal Revolution for providing the economic justification to try something new
  • I want to thank all the good people at the Sunlight Foundation for helping introduce me to non-profits, the inner workings of democracy and most of all, their interesting points of view.
  • I want to thank my wife and kids for putting up with selling the house and moving and all the strange new things that come along with it.
  • I want to thank all my wife’s friends for being incredibly helpful and supportive when she was trying to get the house ready.
November 5, 2007

Carnival of the Agilists

After a brief hiatus, the Carnival is back, thanks to Mark Levison.