Saturday, February 16, 2008

Book Review: Mastering Regular Expressions

I just finished the Jeffrey Friedl's Mastering Regular Expressions. My previous regexp education has been driven by the necessity to scan a log file or search or replace a snippet in a source tree -- that is, haphazard. Friedl's book really is worthy of its title and it should carry The Definitive Guide as its subtitle.

Friedl is a Regexp Master and reading this book is really an excellent way to improve your understanding of the theory, implementation, and application of regular expressions.

As a practical result of this book, I have noticed I am more confident in applying regexps in my text editors (UltraEdit and IntelliJ IDEA) for both search and replace -- particularly for "captured groups." This is useful for taking code and turning it into documentation that non-programmers can read.

Saturday, February 09, 2008

Create Fixed-Width Files Easily

If you need to create fixed-width files, you may be interested in a fixed-width recordset builder I wrote for Groovy. It lets you create a set of fixed-width records with the following sort of code:
def builder = new FixedWidthRecordSetBuilder()
builder.TestData(){
record1(){
field1(startPosition : 0, width : 5, content : short_content)
field2(startPosition : 5, width : 10, content : long_content)
}
record2(){
field1(startPosition : 0, width : 5, content : short_content.reverse())
field2(startPosition : 5, width : 10, content : long_content.reverse())
}
}

builder.records.each { record ->
println record.formattedContent //or to a file
}

You can get the goods from my svn repository:
You can log in with the user guest. The user does not have a password.

The Groovy website has more on the general topic of builders in Groovy.

Enjoy!

Tuesday, February 05, 2008

Grails 1.0 has been released

Grails 1.0 has been released! For details, see the release notes.

Grails is a convention-based web/enterprise application development framework that lets developers write in Groovy, but use all of the great existing Java infrastructure libraries like Spring and Hibernate.

I am using Groovy and Grails wherever I can and I love it -- I'm very productive. I also love that Grails 1.0 has a fix for the bug I encountered with 1.0-RC3.

Many thanks to Graeme Rocher and the Grails team.

Monday, January 07, 2008

Book Review: Agile Development With SCRUM

There's been a lot of press in the software industry over the past few years about Agile development processes. SCRUM has been one of the most talked-about (hyped?) processes and has possibly the most ardent supporters. Ken Schwaber and Mike Beedle's 2001 book Agile Development with SCRUM (ADwS) is the definitive book on SCRUM by the guys who invented it. My conclusion:

Believe the hype.

I've been putting off this review while searching for an approach to describe just how much I enjoyed and agreed with the software development process described by ADwS. As an engineer with training in control systems, probabilities, and statistics, I really connected with the controls-based approach SCRUM uses to eliminate estimation error. As a software developer, I relish the idea of being able to work toward one set of achievable goals for a month before switching directions. As a manager of software projects, I like the idea of having something releasable to my customers every month.

If you're interested in learning more about the SCRUM software development process, I suggest reading Chapter 2 of ADwS and checking out the Control Chaos website. I'm sending these links on to my project manager now...

I also need to purchase a copy of ADwS so that I can read/review it yearly along with Peopleware and The Pragmatic Programmer.

Tuesday, January 01, 2008

Happy New Year!

Happy New Year everybody!

I wish you a year of happiness, health and jalapeƱo poppers.

If you're looking for some help (e.g. gentle reminding) with your New Year's resolutions, take a look at 43things.com.

Friday, December 14, 2007

My Niece, Jacquelyn Kaye

My niece, Jacquelyn Kaye was born today:


Vital Stats:
  • Time of Arrival: 3:20PM 12/14/2007
  • Weight: 6lbs 9oz
  • Length: 20in
And yes, that's her real hair -- no wig, no extensions. Jacquelyn and Jessica are doing very well (so is Matt). Labor and delivery went very well and very quickly -- something like 2.5 hours. Maybe Jacquelyn will be a sprinter.

Sunday, December 09, 2007

Smokin Recipes!

Thanks to everyone who was able to make it out to the house last weekend. Since there's been a lot of interest in the BBQ Beans and Kailua Pork, I thought I'd post the recipes:

The BBQU.net site has a ton of great recipes, including the one I use for BBQ Beans. If you want to "watch and learn," the chef has a show on the KAET "Create!" channel that shows just how easy smoking and grilling is. I follow the BBQ beans recipe closely except that I use 1/4lb of bacon where the recipe calls for a pound. If you cook the beans in the oven, I recommend some liquid smoke. I can also vouch for the Macaroni and Cheese and Tennessee Pork Loin recipes. I think you can get away with making and using only about 1/4 of the rub the pork loin recipe calls for. However, the rub is nice to keep around -- I actually used some tonight.

For the pork, I consulted Google's first three results for "kailua pork" and came up with this:
  • Boneless Country Style Short Ribs aka Boston Butt
  • Sea Salt and Black Pepper, to taste
  • Chicken Stock / Broth
  • Liquid Smoke (optional if smoking -- I used a little)
1. Combine above in a foil lasagna pan. The broth is there to keep the pork moist and to add a bit of salt. The broth doesn't need to completely cover the pork, but it should cover at least 3/4 of it.
2. Smoke / roast for ~5 hours. Add a beer (mmm...Fat Tire) around 3 hours or so and half of another one at 4 hours. The tenderness makes huge progress starting at about 4 hours -- I was kinda concerned 3 and a half hours into it because it wasn't as tender as I thought it should be, but everything turned out great.
4. I used mesquite chips for the smoke. Interestingly, there are a lot of mesquite trees in Hawaii which is why I used the mesquite instead of hickory, though I can't imagine mesquite trees are native to Hawaii.

I do all my grilling and smoking in a New Braunfels smoker I've had for 6 years.

Saturday, November 24, 2007

Automatic Picture Manipulation with The GIMP

We like sepia-tone pictures, especially for romantic stuff like weddings. In case you ever have a thousand or even ten pictures you'd like to see in sepia, try this script for The GIMP instead of pointing and clicking:

(define (batch-old-photo pattern)
(let* ((filelist (cadr (file-glob pattern 1))))
(while (not (null? filelist))
(let* ((filename (car filelist))
(image (car (gimp-file-load RUN-NONINTERACTIVE
filename filename)))
(drawable (car (gimp-image-get-active-layer image))))
(script-fu-old-photo
image
drawable
TRUE
0
TRUE
FALSE
FALSE)
(set! drawable (car (gimp-image-get-active-layer image)))
(gimp-file-save RUN-NONINTERACTIVE
image drawable filename filename)
(gimp-image-delete image))
(set! filelist (cdr filelist)))))

You can use this script by:
  1. save everything between the parentheses above in a file named ~/.gimp-2.2/scripts/batch-old-photo.scm
  2. copy the files you'd like to convert to sepia to a new directory. WARNING: this script modifies the files it's reading, so make sure you've made copies or your originals will be gone
  3. change into that directory and execute:
gimp -i -b '(batch-old-photo "*.jpg")' -b '(gimp-quit 0)'

For more on the basics of scripting The GIMP, see their tutorial.

Enjoy your new old-timey photos.

Tuesday, November 20, 2007

Care to search for integers that sum?

I spent the better part of yesterday pondering how to efficiently search a sorted array of integers to see if a pair of integers within the array sum to given integer.

i.e., given the numbers 1, 2, 3, 5, 8, 13 -- does any pair of them add up to 8 (yes: 3+5), 13 (yes: 5+8), or 17 (no)?

There's several ways to solve this problem, but the trick is to do it in linear time (only visit each number in the array once) and linear space (don't make any copies of the numbers in the array).

After giving it the old college try, I searched for the proper algorithm and found it.

Here's the resulting Java:

public class IntsForSumJava {

public static boolean doIntsForSumExist(int[] inputs, int target_sum) {
int start_idx = 0;
int end_idx = inputs.length - 1;
boolean found_target = false;
int iterations = 0;

while (!found_target) {
iterations++;
int start = inputs[start_idx];
int end = inputs[end_idx];
if (end == (target_sum - start)) {
found_target = true;
} else if (end > (target_sum - start)) {
end_idx--;
if (end_idx > end_idx) {
break;
}
}
}
System.out.println("iterations: " + iterations);
return found_target;
}

public static void main(String[] args) {
int[] inputs = {1, 2, 3, 5, 8, 13};
int target_sum = 0;
System.out.println("found target (" + target_sum + "): " +
IntsForSumJava.doIntsForSumExist(inputs, target_sum));
target_sum = 8;
System.out.println("found target (" + target_sum + "): " +
IntsForSumJava.doIntsForSumExist(inputs, target_sum));
target_sum = 13;
System.out.println("found target (" + target_sum + "): " +
IntsForSumJava.doIntsForSumExist(inputs, target_sum));
target_sum = 17;
System.out.println("found target (" + target_sum + "): " +
IntsForSumJava.doIntsForSumExist(inputs, target_sum));
}
}

Just in case you were wondering...

Happy searching.

Sunday, November 18, 2007

Just Married!

We did it. Jen and I tied the knot November 3 in Maui.


The ceremony and reception went great -- even capped off with a fantastic fireworks display (courtesy of some pharma company). Thanks so much to everyone who attended or wished us well.

Oh, we took some pictures.

I'll have more later on our activities in Maui, Kauai, and Oahu.

Saturday, October 20, 2007

Reddit is the new Slashdot

The programming section at Reddit is is the new Slashdot.

It's a total nerd-time sink.

Slashdot celebrated its 10th anniversary this week and I think Reddit is less than 2 years old, so it remains to be seen if Reddit will be around for the long haul. However, programming.reddit.com definitely reminds me of the Slashdot early days -- sans flame-fest.

Friday, September 14, 2007

SCO is dead!

Well, they are not quite dead yet, but they've filed for Chapter 11 bankruptcy protection -- possibly in order to stave off a judgment in their lawsuit with Novell. Doesn't sound desperate to me, either.

SCO is the company that falsely claimed that Linux developers had included SCO Intellectual Property without permission into the Linux operating system. They made a bunch of very bold and factually inaccurate claims resulting in lawsuits against IBM, Novell, RedHat, and even a few of their own customers (they sued them!).

Turns out that was a bad idea. Oh well, such is the life of a Microsoft pawn.

What is it, you'd say, you do here?

Sometimes I get asked what it is I "do." Well, here's what I currently do, explained on Science Friday. MP3 audio is also available from the Science Friday podcast.

The connect the dots picture in the first link is a graph. I'm currently helping develop a system that draws such pictures using financial data for much the same purposes as described in the interview.

Sunday, September 02, 2007

Daring Cuisine - Haggis

Mike Myers claimed that "most Scottish cuisine is based on a dare" in So I Married an Axe Murderer, but I have to say I like haggis, at least in small portions. It's a bit like what many Americans would identify as "hash," though spicier and not as mushy. The spice is of the "Spiced Cider" variety as opposed to the Jalapeno variety.

I should have known that 5 million Scots wouldn't be wrong.

Tuesday, August 21, 2007

Thursday, August 09, 2007

I'm not dead!

Hey everyone, I'm not dead; I've just been really busy. I finished up (like software is ever finished) at Avnet a few weeks ago and jumped right into my new job at Wells Fargo. Best perk of WF has to be the sunlight -- my "cube plot" is a room with windows. Natural light! Huzzah!

I attended the Desert Software Symposium, which was a Java/Agile/Dynamic-Languages-on-the-JVM SuperNerd-fest. It was absolutely worth the price of admission and will attend again next year, I'm sure.

P.S. a "cube plot" is a small cube farm

Friday, June 29, 2007

Squatters' Rights in AZ?

We love our new house and it appears we're not alone. Three uninvited, though very welcome, gnomes have set up camp in our backyard.

They brought their landscaping tools, so I think we'll let them stay. I just hope they haven't gained any squatters rights due to their improvement of the property.




I think this guy's the leader.

















Have at those oleander leaves, buddy!


















I'm not sure where you got that apple, but I probably wouldn't eat it.



Thanks Jeff and Tina!

Wednesday, June 20, 2007

We've Moved!

We moved into our new house this past weekend. We love it. Many thanks to Glenn and Sue and Jordan, Wes and Tara, Matt and Jessica, and Michael -- who toiled away in the hot sun and kitchen to help us move our stuff in just one day.

Thursday, May 31, 2007

Microsoft, Software Patents, Concavity

Fortune recently ran an article, Microsoft takes on the free world, announcing that Microsoft was going to be asserting its patent rights against patrons of free and open source software (FOSS). The article starts off all gloom and doom for FOSS, but ends up pretty well-balanced.

However, Fortune senior editor Roger Parloff and I are diametrically opposed when it comes to our conclusions. Mr. Parloff refers to Microsoft's claim that FOSS software infringes on 235 Microsoft patents as "a breathtaking number."

My reaction to this number is: 235? That's it? Microsoft examined their patent portfolio and could only find 235 patents that might be infringed upon by the entire corpus of FOSS?!

That's embarassing.

Microsoft has dominated desktop computing for over 15 years. I'd expect them to have a lot more than 235 patents to trot out considering they are claiming infringement in the Operating System and GUIs (Windows), Office Productivity (Office), and E-mail (Outlook) software. I expect they've kept some in reserve as backup ammunition for the ones that get invalidated or circumvented, but it doesn't seem to even be the right order of magnitude for the industry to be concerned.

The fact of the matter is that Microsoft has not been a leading innovator in computing. They aren't even close to holding the good cards in this game. IBM is -- and IBM likes FOSS. IBM was granted the most US patents in 2006 with a total of 3,651. They have been granted the most US patents on an annual basis for 14 years in a row. Microsoft did not make the top ten last year, though HP, Hitachi, Toshiba, and Intel did. Each of these companies makes significant use of FOSS in products or solutions. Microsoft appears to hold between 5000 and 7000 patents total.

Microsoft's announcement is starting to look like a good bit of Fear, Uncertainty, and Doubt (FUD). Ironically, FUD was invented, though not patented, by IBM back when they were trying to crush Amdahl.

The real bad news [for Microsoft and its shareholders] in this story is that it appears Microsoft plans to profit from their patents by:
Smith [Microsoft's general counsel] was not to be deterred. Since the GPL covered only distributors of Linux, nothing stopped Smith from seeking royalties directly from end users - many of which are Fortune 500 companies. He would have to proceed carefully, however, because most of those users were also major Microsoft customers.

Microsoft is going to seek royalties from their own customers when those customers use certain free or open source software. And what will Microsoft do when a customer doesn't want to pay up?
  • Will Microsoft not sell them Microsoft products? Is this an anti-trust violation due to Microsoft's monopoly status?
  • Will Microsoft sue that customer to enjoin them from using the "infringing" software?
  • Will they just move on to the next customer / sucker?
How long will it take for CIOs and Chief Counsels of Microsoft "customers" to start comparing notes about the deals they got? When will they band together and strike back?

I think this "strategy" indicates that Microsoft's shareholder value curve just hit an inflection point and is now concave down after being flat for the last 7 years. If Microsoft continues this course, the best they can hope for is a repeat of SCO's performance, which is not ending well for SCO. Note that SCO is widely considered as a proxy for Microsoft in the FOSS community. The worst thing that could happen for Microsoft and everyone else is for "patent Armageddon" to be unleashed. Microsoft's Smith knows this is a possibility:
"The only real solution that [the free-software] folks have to offer," Smith says, "is that they first burn down the bridge, and then they burn down the patent system. That to me is not a goal that's likely to be achieved, and not a goal that should be achieved."

Not surprisingly, I disagree with Smith. Microsoft will lose quickly, and authoritatively as patent arsenals 10-100x the size of Microsoft's arsenal are unleashed upon it. The downside for the existing leaders of the software industry is that patent Armageddon would inject massive instability as the concept of software patents gets sorted out. Long-term I suspect this might be a good thing as the USPTO is granting many software patents for derivative, obvious, and non-novel work, but it's sure to cause massive blood-letting in the short-term.

Now, I've got to get back to coding my FOSS project. :)

Saturday, May 12, 2007

New Addition to the Family

We (and by we, I mean I) have made a new addition to our family. Please welcome Jeeves. Jeeves is our new bellhop-dog. Not only does Jeeves welcome visitors instead of barking at them, he gladly holds keys and leashes in a most convenient spot next to the front door. We're also teaching him how to take people's coats. This is not going so well, but fortunately for us, this does not come up very often in Phoenix.

If you are interested in a bellhop-dog, check out Bombay Co.