Friday, December 28, 2007

Dynamic Languages and Increasing the Quality of Software and Velocity in the Software Development Lifecycle

This last semester in my Systems Analysis and Design graduate class, we were assigned to present the results of a brief research project. We were to decide the topic and then provide a written paper and presentation.

My project was entitled Dynamic Languages and Increasing the Quality of Software and Velocity in the Software Development Lifecycle. Within this project I attempted to see if the current literature showed empirical evidence that dynamic languages, particularly Ruby and Groovy, shorted the development lifecycle and increased the quality of the software application.

Click here for the paper from the project.

Thursday, December 27, 2007

General Unification Theorem Proof Concerning Functional Dependencies in Relational Databases

For a problem that was to be solved in my database systems graduate class this last semester, we were asked to prove a theorem by Hugh Darwen that is known as the General Unification Theorem concerning Functional Dependencies within Relational Databases.

Click here to see the proof.

Tuesday, October 16, 2007

Selenium IDE HTML Compare Pattern

I was needing to test sorting for a web-based application UI this last week. What I needed to do was check that a listbox control’s account numbers were sorted in ascending order. What quickly emerged was a pattern of steps when using Selenium IDE HTML scripts to compare values.

First, get the string values to compare. Then, compare the values. You may need to parse the value as a float via the JavaScript parseFloat() function if working with decimals such as currency. If you use the eval() function (see below), you are good on comparing numbers such as integers. Finally, verify the expected outcome of the comparison.

As stated above the first thing is to get the values to compare:

<!-- get the first account number in the listcontrol -->
<tr>
            <td>storeEval</td>
            <td>var Account1 = ""; var
accountOptionList =
selenium.browserbot.getCurrentWindow().document.getElementsByName('accountList');Account1
= accountOptionList.item(0)[1].value</td>
            <td>Account1</td>
</tr>

<!-- get the second account number in the listcontrol -->
<tr>
            <td>storeEval</td>
            <td>var Account2 = ""; var
accountOptionList =
selenium.browserbot.getCurrentWindow().document.getElementsByName('accountList');Account1
= accountOptionList.item(0)[2].value</td>
            <td>Account2</td>
</tr>

Next, compare the values and place the comparison value into a variable:

<tr>
            <td>storeEval</td>
            <td>var isLess = false; isLess =
eval(${Account1} &lt; ${ Account2});</td>
            <td>isLess</td>
</tr>

Finally, verify that the comparison value evaluated as expected (that
the first numeric value is less than the second if sorted correctly):

<tr>
            <td>verifyExpression</td>
            <td>${isLess}</td>
            <td>true</td>
</tr>

Monday, October 15, 2007

JQuery Demos

Considering that most JavaScript development deals with Document Object Model (DOM) Element collections, JQuery provides a framework that results in cleaner and more concise code.

For the documentation go here. I have some basic demos here that cover very basic AJAX and drag and drop functionality.

Sunday, October 14, 2007

JavaScript Functions in Selenium IDE HTML Tests

I wanted to run a JavaScript function in my Selenium IDE HTML test. Specifically, I wanted to remove any currency symbols and commas from currency values. Here is the best way that I have found to do it.

First, declare the JavaScript function.

<tr>
<td>storeEval</td>
<td>
function(input) {var output =""; output = input.replace",","");
return output.replace("$","");}
</td>
<td>replaceText</td>
</tr>

To call the replaceText function do something like this:


<tr>
<td>storeEval</td>
<td>var parsedTotal = 0; parsedTotal =
parseFloat(storedVars['replaceText']('${Amount}')).toFixed(2);
</td>
<td>parsedTotal</td>
</tr>

Now I can use the parsedTotal value later in the test:

<tr>
<td>verifyExpression</td>
<td>${parsedTotal}</td>
<td>SomeValueHere</td>
</tr>

Saturday, October 13, 2007

Adobe's Integrated Runtime - Heavenly

Back in August I attended an event sponsored by Adobe that highlighted their new AIR (Adobe Integrated Runtime) product. The new runtime looks great but what was of particular interest at this event was the venue in which the event was held.

It was at the Bell Event Centre at the Verdin Bell & Clock Museum in downtown Cincinnati. The museum is an old church. What was cool was the majestic atmosphere that the building provided for Adobe’s informative outing. Moreover, as I sat there listening to the content of the presentation and looking up at the interior structure of the church, I could not resist the irony of the situation given the evangelism (of glad tidings for all developers) that was taking place.

Ryan Stewart giving the keynote

As the faithful, seekers of inspiration, and the skeptical gathered the Adobe AIR clergy (team) was prepared to deliver a message of hope. The sermons (presentations) consisted of building an AIR application with Adobe Flex, HTML and JavaScript, and utilizing JavaScript frameworks in AIR applications.

The content was inspiring (informative) and Adobe’s integrated runtime shows much promise (potential). In addition to the miraculous (cool) features such as ability for JavaScript developers to utilize ActionScript objects via script bridging, the sermons (presentations) contained the occasional rebuke (pokes) at Microsoft for their heretical ways (.Net platform), at which the congregation (those in attendance) responded with various utterances of “amen” (chuckles and head nods).

Although I left the service (event) unconverted from my agnosticism (the belief that no one technology can meet every business need), I was inspired to look to the holy city (Adobe) for more revelation (documentation) to see how AIR could potentially be the way (an answer to a business need).

Confession: You know I have to admit that I had fun with this one.

HTML ListBox Quick Item Select JavaScript

It has been awhile given that I have been busy at work and also started a graduate business informatics program. Anywho, a customer recently requested a way to select an HTML Listbox control and key in an account number and have that number be selected as they were entering the perspective number.

A coworker and I came up with the following. The referenced JavaScript file is here.

The trick here was utilizing the onkeyup event. The entered text is appended to a string that is compared to the listbox content. If there is a match, it is added to an array of matched items. On each onkeyup event, the first matched element in the array is selected in the listbox control. If the listbox loses focus, then entered string is set to an empty string.

Wednesday, August 01, 2007

Polyglot Programming?

Neal Ford argues for understanding and utilizing various languages based on business need. a.k.a. Use the right tool for the job!

When discussing using multiple languages many would say, "That's crazy talk!" However, Ford points out that we are already polyglot programming. We are using Java, XML, SQL, and JavaScript. Moreover, the learning of different languages help us think more broad about business problems.

Will have more coming on dynamic languages such as Groovy, which runs on the JVM. In a recent post I show a test drive of pre-alpha release of IronRuby (Ruby on the .Net CLR).

If we can dispel the delusion that learning about computers should be an activity of fiddling with array indexes and worrying whether X is an integer or a real number, we can begin to focus on programming as a source of ideas.
Harold Abelson

Sunday, July 29, 2007

Test Drive with IronRuby and System.Windows.Forms

Per Scott Guthrie’s blog I was inspired to take a look at IronRuby. Even though it is in pre-alpha, I could not resist given the appeal of Ruby with the rich libraries available in the .Net framework.

After building the IronRuby solution, I took the rbx.exe, along with the related assemblies, and dropped them into a new folder. Here is a look at the folder content.




I then created a file named example.ir.




Next, I ran the IronRuby exe with the new file.




This resulted in the window below.




After clicking the Click Me button:




On a side note, the shot above of the example.ir file is from Notepad2. The syntax highlighting, even with an .ir extension, is from changing the custom scheme in Notepad2. Look at a previous post to see how to change the schemes for syntax highlighting. If you want a build of Notepad2 with Ruby syntax highlighting, go to Scott Hanselman's blog for the build and source code.

Saturday, June 23, 2007

Notepad 2 for MXML and ActionScript 3

I was looking for a way to get color coding, for my favorite lightweight code editor for Windows, Notepad2, for Flex 2’s MXML files when I came upon Josh Tynjala’s blog entry on how to enable color coding support for ActionScript 3 files.

Since MXML files are XML they can use the same color coding syntax information. Here’s what you need to do to enable support for MXML files (or any other file type for that matter).

  1. Click on the View menu and choose Customize Schemes….
  2. Choose the XML Document type.
  3. In the input that contains xml;xsl;svg;xul;xsd;xslt;axl;rdf;vcproj;manifest, add ;mxml to the end. Note the semi-colon.
  4. Open an *.mxml file to see the wonderful color coding.

Friday, June 15, 2007

CAPTCHA (a.k.a Are you man or machine?) to reCAPTCHA

We have all been to sites where we have to type in a word or phrase that demonstrates that we are not a spider or spam bot but a human attempting to access a page or purchase an item. When you look at the word or phrase it looks like a warped rendering with distorted letters. The program that provides the fuzzy looking words is called CAPTCHA. According to recaptcha.net, “The term CAPTCHA (for Completely Automated Turing Test To Tell Computers and Humans Apart) was coined in 2000 by Luis von Ahn, Manuel Blum, Nicholas Hopper and John Langford of Carnegie Mellon University. At the time, they developed the first CAPTCHA to be used by Yahoo.”

I always understood the funky phrase or word was to stop Optical Character Recognition systems from deciphering them, submitting the words back, and falsely validating itself to as a human being. While it does that, recaptcha.net wants to use that few seconds of human effort of typing in the words into a textbox for noble purposes.

About 60 million CAPTCHAs are solved by humans around the world every day. In each case, roughly ten seconds of human time are being spent. Individually, that's not a lot of time, but in aggregate these little puzzles consume more than 150,000 hours of work each day. What if we could make positive use of this human effort? reCAPTCHA does exactly that by channeling the effort spent solving CAPTCHAs online into "reading" books.

reCAPTCHA improves the process of digitizing books by sending words that cannot be read by computers to the Web in the form of CAPTCHAs for humans to decipher. More specifically, each word that cannot be read correctly by OCR is placed on an image and used as a CAPTCHA. This is possible because most OCR programs alert you when a word cannot be read correctly.

To help with this go to http://recaptcha.net/learnmore.html. Moreover there is an API at http://recaptcha.net/apidocs/captcha/.

Hey, in about 30 seconds I helped digitized five words!

Wednesday, May 09, 2007

The Selenium storEval Method in Action

I was creating Selenium tests for the module on a J2EE app at work and noted that the requirements wanted the beginning and end dates in the search text boxes to be the current date. I then thought, "Hmmm, these tests will be run on various dates. How can I get the current date to validate that the current date, in a specified format, is entered into the beginning and end date textbox entries for a search query?"

A little digging on the OpenQA site in the reference for Selenium and I found the storEval method. According to the reference this method, "Gets the result of evaluating the specified JavaScript snippet. The snippet may have multiple lines, but only the result of the last line will be returned." That was just what I needed.

Here is where the method is used in the test that is stored in an HTML file:

<tr>
<td>storeEval</td>
<td>var d = new Date(); var mday = d.getDate();
var mmonth = d.getMonth() + 1; var myear; if (navigator.appName == 'Microsoft
Internet Explorer') {myear = d.getYear();} else {myear = d.getYear() + 1900;}
if (mday.toString().length == 1) { mday = '0' + mday; } if
(mmonth.toString().length == 1) { mmonth = '0' + mmonth; } todaysDate = mmonth
+ '/' + mday + '/' + myear;</td>
<td>todaysDate</td>
</tr>
<tr>

Note that the todaysDate variable above is passed the formatted current date. I then use it later in the test to assert that this is what is entered into the beginning and end date text boxes.

<tr>
<td>verifyValue</td>
<td>searchBeginDate</td>
<td>${todaysDate}</td>
</tr>
<tr>
<td>verifyValue</td>
<td>searchEndDate</td>
<td>${todaysDate}</td>
</tr>

Wednesday, April 18, 2007

Selenium IDE with an XPath Locator

We are beginning to use the Selenium IDE at work to do some UI based testing. One thing that I wanted to test is the sorting of columns in a table.

Here is how I did it.

Tuesday, April 10, 2007

Dreaming in Code Book Review

Just finished Scott Rosenberg's book entitled, Dreaming in Code. The subtitle: Two Dozen Programmers, Three Years, 4,732 Bugs, and One Quest for Transcendent Software summarizes this interesting work.

Unlike other tech related books this was composed by a journalist that kept the book moving and informative, all the while viewing software development from an entertaining, fresh perspective.

I highly recommend this book for not only software developers, but for those who work with them. Project managers, software testers, program managers and the like will benefit from the view point of a man who watched the unfolding of the Chandler open source project for a three year period.

As the book details, software is hard:
Why is good software so hard to make? Since no one seems to have a definitive answer even now, at the start of the twenty-first century, fifty years deep into the computer era, I offer, by way of exploration, the tale of the making of one piece of software -- a story about a group of people setting their shoulders once more to the boulder of code and heaving it up the hill, stymied by obstacles old and new, struggling to make something useful and rich and lasting.

Saturday, March 24, 2007

Ubuntu Desktop in Microsoft's Virtual PC 2007

I pulled down Microsoft's VPC 2007, which is free, a few weeks ago and have been using it on my Windows XP workstation and laptop. I even have a VPC machine with Vista and Office 2007.

I setup the VPC machine with Vista and then created a copy of the VPC to test drive. This enables me to play with it, and even break it with no issues. If I mess it up I just make another copy of my master VPC and go at it again. This is great for development and testing.

I even got the Ubuntu Desktop on a VPC machine thanks to a blog post from Arcane entitled Installing Ubuntu 6.10 on Virtual PC 2007 Step by Step.

Saturday, February 10, 2007

OpenID - open, decentralized, free

I was listening to Scott Hanselman's podcast where he featured OpenID - an open, decentralized, free framework for user-centric digital identity.

In a previous show he discussed identity and Microsoft's CardSpace and in this podcast, mentioned that Microsoft is collaborating with OpenID.

All I can say is get your's today!! Open, decentralized, free--why not!

Sunday, February 04, 2007

NSpec: .Net's Behavior Driven Development Tool

I had stated in a previous post about the advantageous of Behavior Driven Development with Ruby and RSpec. Here I am looking at NSpec, an open source tool from Tigris.

Go here to find out more about NSpec.