Tuesday, December 26, 2006

The Little Drummer Boy

It struck me this Christmas that the author of "The Little Drummer Boy" wasn't a parent. Can you image this conversation two thousand years ago:
"Mary, doesn't Jesus look so peaceful sleeping?"
"He sure does Joseph."
"Hey, whose that at the stable door?"
"Hey cool, the boy going to do a drum solo for Jesus."

Friday, December 22, 2006

The Joy of ReSharper

After hearing friends rave about ReSharper, I finally took the plunge, and it's wonderful.
Use the IntelliJ key bindings.

Some of my favorite features:
  1. Cntl-n: find type. This takes you directly to the object of your desire. ReSharper (RS) does the google-suggest thing of giving you a dwindling list of all the objects possible based on your current key strokes.
  2. Cntl-Shift-N: Go to a file anywhere in the directory structure.
  3. RS gives advice on code. For example:
    textWriter.Write("\r\n
    Date:"+DateTime.Now.ToString()); 
  4.  Ctl-Alt-v:  Add a variable to the left of an expression - if you don't have a ";". For example:
    new StringBuilder()
    [Ctl-Alt-v]
    var stringBuilder = new StringBuilder(); 
  5. RS said the "ToString()" was redundant and (this is the best part), offered to automatically correct it for me (OK, deleting a string is not all that helpful, but some of the other advice is a little tedious to implement. I especially like the offer to use the string.format option on long concatenated strings mixed in with variables. You can turn off specific suggestions like "the 'this' prefix is redundant".
  6. Real Refactoring. VS2005 comes with a few refactoring options, but typically not the ones I need. RS has a cornucopia of refactoring methods. Maybe the jetbrains developers actually read
    book

    by Fowler, unlike some other IDE teams.
    One of my favorites is "Encapsulate Field..." which adds the getter and setters for a field.

Thursday, December 21, 2006

The Failure of Sanctions

I'm intrigued by the continuing use of sanctions in the modern world. Sanctions seem to be a popular way to impose some sort of punishment on evil states. But do sanctions actually work?
The US imposed sanctions on Japan to prevent oil and steel entering Japan in response to Japan's occupation of Manchuria in the 1940s. The sanctions failed to free Manchuria from occupation and dragged the US into WWII. The sanctions on Cuba have forced them to abandon their communist ideology - oh wait, after decades it hasn't. In 433BC Athenians imposed sanctions on Megara for farming sacred land. The sanctions eventually dragged Athens into the disastrous Pelopennisian War with Sparta, which it finally lost after decades of debilitating warfare. The historical record of using sanctions for political purposes is a dismal failure.

In addition to virus scans, will we have RIAA scans?

About 80% of the computing power of my computer goes to scanning for viruses (yes, I use Windows at work). Will it be too long before we are all required to have an RIAA scanner that constantly scans our hard drives and incoming email for copyrighted material? With those new quad-core machines we can devote one (or maybe two) to scan from viruses, one from RIAA infringement and we'll still have one left for doing our job.

Thursday, December 14, 2006

Seven Things You'll Love about Ruby

I don't know if you got the memo yet, but next year you'll be programming in Ruby. Here's just a few of the little things you will love about Ruby:

  1. Simple programs are simple
    If you are like me, I have a stable of code snippets and little utility classes. When I start a new java program I mentally think about which old program is similiar to the new one (e.g., ok I need a program that reads a file, takes input from the user, and writes out some proccessed data to an output file). I modify the old one to create a new program. I found I don't do that with Ruby.
    For example, just to do a hello world in C#,

    using System;
    public class HelloWorld
    {
    public static void Main(string[] args) {
    Console.Write("Hello World!");
    }
    }

    In Ruby:

    puts "Hello World!"


  2. Open Classes:
    You can add methods to existing library classes. For example, in C# 2.0, Microsoft added the very helpful string function, IsNullOrEmpty() which replaces the unwieldly construct: if(mystring != null && mystring != ""). In Ruby you don't have to wait for the mavens in Redmond to decide you need a new string function, you can add it yourself.

    class String
    def NullOrEmpty?
    (self == nil || self == "")
    end
    end
    puts "test".NullOrEmpty?
    puts "".NullOrEmpty?


  3. Handy, time saving methods
    I'm amazed at how long I've done awkward constructs in Java and C# without even thinking a better way could be found. For example, in Java:

    if( x < 7 && x > 12 ) { ... }

    In Ruby:

    if x.between?(7,12) do ...

    Ruby is littered with helpful real world utilities for getting your job done.

  4. Methods can have variable number of arguments
    This can be quite time saving and reduce your lines of code.
    The following are all good calls to add():

    add 1
    add 1 3 5
    add 1 3 5 7



  5. Functions can return more than one value

    Yes, we could return a small array or structure with our multiply values, but why not just return multiple values:



    average,total = joke.getAverageRatingAndCount
    ...
    def getAverageRatingAndCount
    record = Rating.find_by_sql(["select count(*) as count,avg(rating) as average from ratings WHERE joke_id = ?",id]);
    return record[0].average.to_f , record[0].count.to_i
    end


  6. Parallel Assignment
    You can swap the values in variables without the use of an temp variable. Remember your first programming class: Swap the values in "i" and "j"? You had to use a "t" variable to store one of the values first. Not needed in Ruby.

    i = 0
    j = 1
    puts "i = #{i}, j=#{j}"
    i,j = j,i
    puts "i = #{i}, j=#{j}"

    Which produces:

    i = 0, j=1
    i = 1, j=0


  7. Ranges
    Ranges are real objects

    puts (1..10).each{|i| p i}

    Prints the numbers 1 to 10 without the syntax for(i=0;i<10;i++)

    (1..10) === 2 # this returns true because 2 is in range

    The Range object just does the right thing in its context which can reduce your lines of code and make code more readable.



These are little things, some of the big things you'll love in Ruby are Blocks and generating methods on the fly from code. More on those later.

Tuesday, December 12, 2006

A Disappointing Austin Dot Net User's Group


The XBox racing game pumped up the 75 people attending yesterday's .Net meeting. The wireless controllers were passed around the room. (Afterwards someone asked "Where are the controllers?" to which the answer was "EBay!".)
The new Microsoft developer Evangelist, Caleb, presented on the new ASP.Net AJAX component (nee Atlas). Caleb went over the basics and then showed a demo of using VisualStudio 2005 for developing applications. What happened was a parable of development with Microsoft tools. He built the application and it failed because of a JavaScript error - a class was not properly scoped. So Caleb had to go under the covers of the code that VS generated and try to fix what was wrong. That sounded so familiar to me. Too often the cool WYSIWYG tools of Microsoft take you 90% of the way, and then leave you dangling. The tools demo so well, but in actual development, they leave many things lacking. So as developers we end up having to know all the plumbing underneath applications anyway. This is in addition to how to build applications with the graphical tools.
I really liked Caleb and he'll be good for our area - too bad he doesn't have better tools to demo.

Other tidbits from the night:
75% of the attendees programmed in C#, the rest VB.
ASP.NET AJAX has hooks to transfer data using JSON in addition to SOAP for speed.
Browsers (IE?) use only 2 connections to a domain. To speed downloads put images in diff sub domains.
Fiddlertool.com is some tool for doing HTTP debugging like Firefox's Tamper.
Devtoolbar is available for IE (like Firefox's Developer Toolbar) at Microsoft's site.

Wednesday, December 06, 2006

Connecting to a Remote SQLExpress

SQLExpress is both a blessing and a curse. It's nice to have a free alternative to SQLServer for development, but we all have to learn a new set of utilities to administer SQLExpress. When I first tried to connect to an instance of SQLExpress on a virtual machine with this:

C:\home\mfincher>osql -Usa -P"MyPassword" -S "MyServer\SqlExpress"
-d master -Q"SELECT DISTINCT name FROM SYSDATABASES"

The result was:

[DBNETLIB]SQL Server does not exist or access denied.
[DBNETLIB]ConnectionOpen (Connect()).

The solution took three steps to remove the default locked-down settings:
1. Select "Start/Programs/Microsoft SQL Server 2005/Configuration Tools/SQL Server Configuration Manager"
Select "SQL Server 2005 Network Configuration/Protocols for SQLEXPRESS" in the left pane. In the right pane, enable "Named Pipes" and "TCP/IP".
2. Select "Start/Settings/Control Panel/Services" panel.
Right click on "SQL Server Browser". In the "General" tab set "Startup type:" to be "Automatic".
In the Services panel make sure the "SQL Server (SQLEXRESS)" service is running.
3. In "Microsoft SQL Server Management Studio Express" (see previous post on how to get), right click on the machine instance (the top item) and select "Connections". The check the box labeled "Allow remote connections to this server".

It's thrilling to see Microsoft take such pains to have a more secure system by default, but it would be nice to have a single, obvious checkbox to allow the system to talk with the rest of the world.

Austin Java User's Group Christmas Meeting

pic
pic
The Austin JUG met last night at the Sun offices here in Austin. Sun supplied the pizza and drinks for the 60 attenders. Gregg Sporar gave the technotiser showing three different integrated profilers - YouKit, Ecliplse tptp, and the built in profiler for NetBeans.
pic

Angela Caicedo gave the main course about Sunspots - Sun's Small Programmable Object Technology (SPOT). She demoed small sensor devices the size of a deck of cards wirelessly talking with each other and exchanging data. The technology looked very interesting, but felt immature. These new devices are produced and ready for sale to the public, except for legal issues. I wonder if that's the future of technology here in the States - great products ready for release, but held up over some patent. Can you image Windows Vista ready to ship on January 31st, but being held up by some patent issue? It could happen, talk with our friends at Blackberry.

Something else struck me at the meeting - most of the attendees were middle-age, very few younger people. Are there not many people going into programming as a career here or are they just out partying and not interested in learning more, or are they all at the Ruby rallies? What do you think?

Tuesday, December 05, 2006

All the world's population could fit in a Texas County


I was talking this morning with a friend at work and he mentioned some of the shrill prophets of overpopulation. What most people don't know is that the entire 6 billion members of this race we call human, could all fit in an average sized Texas county.
The math: Shackelford county is roughly 20 miles by 30 miles square so the area in square feet is
(20 miles * 5280 feet/mile) * (30 miles * 5280 feet/mile) = 16,727,040,000 feet^2, or almost 17 billion square feet. With 6 billion people on our lovely planet that works out to about 2.7 square/feet per person just in this one county. It would be crowded, but Texas has 253 counties to go.

Friday, December 01, 2006

Regular Expressions to the Rescue of Testing

Recently I wrote about the problem of maintaining lots of xml test files. Here at IniTech we have 15 major test groups in my current project, each with a config file containing about ten descriptions of test components. This morning I needed to add three new attributes to each of the roughly 150 test components. Like most IDE since the 80s, Visual Studio 2005 has regular expression replacement. I needed to add jobNumber, localJobNumber, and nickName attributes with the value being a varient of the 'name' attribute.
<Survey name='USM1' groupName='US Malls' priority='4' status='1' cellLimiter='100'
surveyLimiter='100' dateStart='2004-01-07T09:30:00' dateEnd='2006-01-28T16:30:00'
exclusions='0' cluster='Cluster1' allSurveysExclusion='-1' surveyType='AdHoc'
excludeSurveyType='' excludeSurveyTypeDays='-1' >
becomes
<Survey name='USM1' groupName='US Malls' priority='4' status='1' cellLimiter='100'
surveyLimiter='100' dateStart='2004-01-07T09:30:00' dateEnd='2006-01-28T16:30:00'
exclusions='0' cluster='Cluster1' allSurveysExclusion='-1' surveyType='AdHoc'
excludeSurveyType='' excludeSurveyTypeDays='-1' jobNumber='JN-USM1'
localJobNumber='LJN-USM1' nickName='Nick-USM1' >
This handy little regex replaced them all with the highest level of quality assurance:
Find What:
 \<Survey name='{[a-zA-Z0-9]+}'{[^>]+}{\>}
Replace With:
 \<Survey name='\1'\2 jobNumber='JN-\1' localJobNumber='LJN-\1' nickName='Nick-\1' >

Note that the value of the "name" attribute is gathered into the '\1' variable because its description is surrounded with curly braces.

Wednesday, November 29, 2006

A good trend in movie making will accelerate with digital projectors


movie

Recently our family went to see "Facing the Giants" and really enjoyed it. The acting was uneven, but overall a very toucing movie. The movie is particularly interesting because it shows the trend to smaller budget grass roots films. "Facing the Giants" was made for only $100,000 but has done extremely well at the box office due to word of mouth.
This trend toward the masses being able to make films will accelerate drastically once digital projectors are common in theatres. Without the cost of printing the actual film, anyone with a digital camera and a Mac could make a movie, and with enough buzz get it into theatres.

Transfer to Dreamhost complete

Recently I switched hosting companies to dreamhost.com for cost reasons. I can get a terabyte of bandwidth per month for only $10, pretty amazing. If you enter my promo code, "mitchfincher" when signing up, they will waive the $50 setup fee so you can start for only $10 and cancel anytime. The only downside is the reliability is not as great as some other hosting companies. I've had two short outages in the last few months, but for $10 its been a great deal. Also they are Ruby on Rails ready.
dreamhost

Four ways to play with SqlExpress

You can connect to a SqlExpress instance in many ways.

1. My friend Frank showed me how to use Query Analyzer with SqlExpress.
Select "Start / Sql Server 2005 / Configuration Tools / Sql Configuration Manager "
Then drill down in "SQL Server 2005 Network Configuration" and select "Protocols for SQLEXPRESS" and enable "Named Pipes" and "TCP/IP" by right clicking and selecting "enable".
Now restart the Sql Express service (aka "SQL Server (SQLEXPRESS)").
Open Query Analyzer and add the sql server instance "yourboxname\SQLEXPRESS"

2. You can also download the free SqlExpress tool from: http://msdn.microsoft.com/vstudio/express/sql/
by clicking on the link to "SQL Server Management Studio".

3.To connect to SqlExpress inside Visual Studio 2005, select "View / Server Explorer". Right click on "Data Connections" and add "yourboxname\SqlExpress".

4. To connect through the command line osql program
osql -S"mymachinename\sqlexpress" -Usa -P"mypassword" -Q"CREATE DATABASE SD20"

Tuesday, November 28, 2006

Best thing happened to me this month...

phone
Best thing happened to me this month was my cell phone died. I was forced to upgrade to a wonderful TMobile MDA (which stands for "Mitch's Digital Assistant"). The MDA replaces two and half devices of mine - old phone, old IPAQ, half my camera.

opera

This morning my friend Frank showed me the Opera browser for it. It's amazing, wonderful. Now I can't live without it; couldn't think of going back to the pre-installed pre-cambrian IE browser. The cool thing is you can read a page like slashdot.com into one tabbed window while downloading links from that page into other tabs to read later - no more waiting for further pages to download, they download in the background.

Sometimes it's a happy thing when devices die.

Thursday, November 23, 2006

Lessons from History

If we learn anything from history, it's that we don't learn anything from history.Nevertheless, I think the following quote bears on our current national state in the US:

"We have considered ourselves of too much importance in the scale of nations. It has led us into great errors. Instead of yielding to circumstances which human power cannot control, we have imagined that our own destiny and that of other nations was in our hands, to be regulated as we thought proper."

spoken by Virgina Federalist Daniel Sheffey on the eve of the war of 1812 from
The War of 1812 A Forgotten Conflict by Donald Hickey p300
Click to read reviews of The War of 1812 A Forgotten Conflict


(Remember that in the War of 1812, the White House is burned and the USA is fortunate to get a stalemate from the war).

I meet with a bunch of other guys about once a month to have dinner and discuss a historic event. This month's topic is the Mexican-American War. If you're in Austin on Tuesday Novemeber 28th come by and join us. Email me for more info, my email addresses is on www.fincher.org

Tuesday, November 21, 2006

Edible cotton breakthrough may help feed the world

Great new creation from my old Ala Mater, Texas A&M at New Scientist.
The cotton plant provides a wonderful fiber for our lives, but it's poisonous seed protein is under utilitzed as cattle feed. Keerti Rathore has manipulated the genome of cotton to remove this poison. Now farmers from developing countries can earn cash for the fiber and use the seed to feed their families.
This is just a hint of the wonderful, fantastic, and dreadful fruits of the new science of the genome. The biotech revolution of the next 20 years will make the computer revolution of the last twenty years look like a child's toy. The revolution is coming, let's prepare for it and not squash its promise of filling the bellies of the world's hungry children.

Monday, November 20, 2006

A couple of web site picks

www.catsthatlooklikehitler.com made me laugh. The name says it all. I like the idea of having a whole community evolve to discuss the ethics of it all. Very web2.0.

For laughs try the humor section of http://www.stumbleupon.com. StumbleUpon is a great idea and a lot of fun.

Saturday, November 18, 2006

First Rails Application

I was two chapters into the "Agile Web Development with Rails" book and thought, "Why not create a web site?"
Hence the birth of www.CleanJokesForKids.com. It's not pretty and needs lots of stuff, but its there now. Kids can type in their favorite joke and rate other kids jokes. You can see the jokes filtered by the funniest, latest, or worst.

I've been very impressed with how Rails speeds development.

Friday, November 10, 2006

Late Night with Ruby version of wget

I'm trying to recover all my email from a web mail hosting site that doesn't support pop3 without a fee. I've tried a few of the obvious ideas and nothing worked. I finally found that the url listed in the 'view' mode has a direct url to the message. I don't have wget on my windows box and didn't want to download a version so I thought, "How hard could a subset of wget be to write in Ruby to download all my email?" Answer: Not hard.
This will get a particular page and print to the screen:
require 'open-uri'
open('http://www.fincher.org/Misc/Pennies'){ |f| print f.read }


This will read a file of urls and print all to the screen:
#Reads first argument as file containing urls and prints them
#usage: ruby wget.rb wget.txt
require 'open-uri'
IO.foreach(ARGV[0]) { |line| open(line){ |f| print f.read } }

Monday, November 06, 2006

Structure of Photosynthesis revealed

A potentially important breakthrough in energy production was announced by lbl labs today.
Researchers have discovered the structure of how plants convert sunlight into usable energy.


If we could manufacture these structures and place them in water-filled panels, sunlight could be directly converted to hydrogen. This would short-circuit the bio-fuels path by going directly to hydrogen instead of cultivating crops. This would be more efficient and require no fertilizer or cultivation. An added bonus is that the hydrogen gas can be stored and used when needed, unlike solar cells.

Thursday, November 02, 2006

Austin Innotech 2006

I went to Austin InnoTech today and here are the jumbled mess of notes taken on my cell phone.

Soyring from IBM speculated that the Paper Industry might be threaten by Organic Light Emitting Diode "newspapers". These are printed once and then updated daily from an embedded chip.

The Baby Boomers retiring and there are not enough replacements for all the high tech workers.

Labor arbitrage in India and China coming to an end as labour cost there are rising.

Starbucks pays more for health care than for coffee beans.
We need a single standard for health care records that are kept by the patients to avoid misdiagnoses from doctors without the complete health picture.

David Smith vp Technology Futures
The average cell phone is replaced every 11 months.
1/2 of our economy comes from industries just l0 yrs old.
More people read newspapers online now than the carbon based ones.
We are leaving age of physics entering age of biology.

Sarnoff's law N
Metcalfe is law N-squared
Reed's law 2N

In 2001 the US spent more on tort litigation than on R&D.
Most Companies make tech decisions by looking in the rearview mirror

Kert Peterson on Scrum.
Scrum is a project management frame work not a software methodology.


Scrum 4O% turnover is common in an organisation transmuting to Scrum. People are held accountable daily and some don't like that.


Vista preview by Kevin Remde
A funny thing happened during Kevin's preview of Vista - a popup window appeared and informed us that it was checking his digital rights for playing a video in the background.

Vista's Search tools can search new tag words of documents. In the properties dialog box is a field for attaching tags to a document. This looks interesting, but I don't know how many people will have the patience to enter these.
I liked the ability to go back to previous versions of a document.
Vista can use a USB memory stick as virtual memory, which kinda makes sense since it could be faster than a disk drive.
Finally, low priority background tasks will be given lower priority for I/O, making the experience better for the user.
Vista has hard drive failure detection like John Gibson's SpinWrite.

Overall I was impressed with the demo of Vista - it's catching up to the Mac in so many ways. But like many Microsoft projects it's dissappointing in how little they have progressed.

Thursday, October 26, 2006

Smaller, faster and easier

I loved this quote this morning from InternetNews.com:

In a recent blog posting Mozilla CTO and creator of the JavaScript language Brendan Eich wrote that the goal for Mozilla 2.0 is to make the codebase smaller, faster and easier to approach and maintain.


Would that all our software releases would be smaller and cleaner than their predecessors. This would take enormous discipline of constant refactoring.

Tuesday, October 17, 2006

Experience with IE7 and "Mobile Favorites"

I recently installed the latest IE7 build. One interesting omission in the latest RC is the lack of support for downloading "Mobile Favorites". I use IE for two things - synching my IPAQ and doing my timesheet. Now it doesn't sync my IPAQ and our company's timesheet program doesn't work with IE7 yet.
I have found a work-around for the synching of "Mobile Favorites".
1. Go to your web page you want to sync.
2. Hit the "Mobile Favorites" icon.
3. Create a new Mobile Favorite". Click "yes" to replace the old one.
4. Wait while the browser crashes.
5. Et Viola. Most of the web page will be downloaded to your machine and your Windows Mobile device can sync with them.
6. Repeat this process for each Mobile Favorite.

Those sneaky malware writers

"Patch Tuesday" comes the second Tuesday of the month when Microsoft releases patches for windows to combat malware. An interesting phenomena is growing. The malware writers wait until "Patch Tuesday" and release their wares on the unsuspecting public on the same day, confident in the knowledge that their handiwork will have a full 30 days to pillage the internet. In the old days, virus writers were just motivated by testosterone, but now it's all about making money. Money is to be made by creating 'bot armies to extort money from businesses; by flooding the user with ads; or installing keyloggers to capture financial data.

It's puzzling that Microsoft does not release fixes more often than monthly.
Thankfully with Vista, "the most secure operating system ever released by Microsoft" we won't have this problem.
(cough, cough).

Tuesday, October 10, 2006

Last Night's Austin .Net Meeting

Last night Stephen Balkum and Eric Heater presented an overview of a high capacity, high availability web site built with .Net 1.1.
They emphasized buying products over building if you don't have the time or money to create what you really want. They recommended the following tools:
ToolDescription
Akamaicaching of static files, like gifs
epsilon email sending and racking. epsilon works with mail hosting companies to make sure their email is not locked as spam
Gemini for issue tracking
Seleniumpure JavaScript implementation of GUI esting inside a browser
psexec from sysinternals for remote execution of windows commands.
LinkSleuth for link testing (free)
System.Managemnet.ManagementScopenamespace in .Net for application health monitoring
Camtasia for creating a web demo.

To me the most interesting was the demo of Selenium, which I've heard much about, but this was the first time I'd seen it.
Selenium IDE for Firefox for creating Selenium scripts from http://openqa.org/.

At one point Eric asked how many people use Firefox. About 80% of the attendees raised their hands.
Eric repeat the adage, "If it's a pain, do it all the time", as he talked about their build and deploy system.

Friday, October 06, 2006

EEStor, a way out of oil imports?

EEStor is a startup working on a supercapacitor to replace batteries. If they, or one of their competitors can really deliver a low cost, reusable, dense energy storage device, the world will no longer need vast seas of oil.
What is their product? The device stores electricity directly in a capacitor instead of converting it chemically like our current car batteries. The capacitor has no moving parts and will last longer than the car. Plug-in electric cars don't work today because of the high cost of batteries, the limited range of the vehicles and a long recharge time.
EEStor is rumored to have solved all of these. The cost of their device will be reasonable, have nine times the energy density of lead-acid batteries, be half the weight and charge in minutes. The cost of electricity would be equivalent to 45 cents per gallon for gasoline.
Why is a better "battery" important? Most of the oil imported into the US is used for transportation. If we could gradually replace most of our gas burning cars and trucks with electric ones, we wouldn't need nearly as much imported oil. All that money could stay in the US.
We can create electricity from many different sources including wind, solar, coal and nuclear. Cars could be recharged at night when demand for electricity is low and many power plants are idle. (In the distant future, cars could even be used as a buffer in our electrical grid, taking in power late at night and supplying electricity during the peak hours from 2-4pm.)

Many startups have made outrageous claims, so I'm skeptical. I few things give me less cautious. The reputable VC firm Kleiner Perkins Caufield & Byers are backing of EEStor. Also the firm itself is very quiet and not making any wild claims or asking for investors. I'm hoping that EEStor can pull this off.

Now, if OPEC would only cooperate by keeping oil prices high for a few more years to make sure funding continues for new technologies like this, we can kick our oil habit and oil will go back to 20 dollars a barrel.

Saturday, September 30, 2006

How much is too much unit testing?

I'm a big believer in unit tests. In my current project we have over 400 unit tests. We even sneak some integration tests into our nunit code. Many of our tests read data from an xml file containing a few objects distilled into xml. The tests rehydrate the objects, invoke a method in our application and pass in those objects. The application returns a string or xml object and we check inside the xml data file to see if it is correct. It's quite tidy.
But with some many tests adding a new feature can be work. Recently while adding a new feature I implemented it in such a way as to have a minimal impact on our test files. Bad, very bad. Should I change 150 xml files, adding in new parameters, or implement the new feature in a way that doesn't change the test files?
I chickened out and did the wrong thing. In the end, like most "shortcuts" it took more time. I went back and wrote a little ruby program to go through the 150 xml files and programatically add new xml attributes with their varying values (name of the file plus occurance in the file, eg, attr="Test5.xml:3").

I learned a few things from the experience:
1. Always do the right thing, even if it takes longer and you are really pressed for time.
2. Unit tests are great and wonderful, but they come with a price. You can have too many tests which can slow you down.

Does my project have too many unit tests? I don't think so, but I'm less sure of that than I use to be. My project partner thinks we have too many, but I still think the tests ensure quality, but the tests come with a higher price than I realized.

Wednesday, September 27, 2006

Last Night's Java User's Group Meeting

About 45 people attended the meeting focused on rapid development with open source tools.
Jean George from OpenSky extolled the virtues of XMLC for software development. Open Sky developed a stack of software components to create software including Spring, ireports, Jasper for reporting and Acegi for security.
Jean said to do any modern work you have to master HTML, CSS, and JavaScript.
He also liked Postgres much better than MySQL. But his best line was about PHP programmers, "You can't get rid of them, they're like fireants, you keep stomping on them and they keep coming."
One thing that did strike me about the direction of software development: our systems are more declarative and use convention over configuration. With that in mind it matters less whether the glue holding the frameworks together is Java or C#.

Tuesday, September 26, 2006

New Windows Unpatched Exploit

Microsoft plans to fix a buffer overflow in its Vector Markup Language (VML) dll on October 10th. In the meantime your IE browser and some email readers are vunerable to attack. To fix the problem run this command on your machine and reboot:

regsvr32 -u "%ProgramFiles%\Common Files\Microsoft Shared\VGX\vgx.dll"

This unregisters the VML renderer, which is sparsely used today. To reregister the dll after October 10th,

regsvr32 "%ProgramFiles%\Common Files\Microsoft Shared\VGX\vgx.dll"

Don't take my word for it though, read Microsoft's note here.

Wednesday, September 20, 2006

Apache Redirects For URLs with spaces

I had an external web site link to one of my pages, but a space was accidentally appended to the link, eg.,
"<a href="http://www.fincher.org/Misc/Pennies/(space)">Pennies</a>".

My error.log file was filling up with 404 errors. The easy solution was to do an apache redirect, but it was a little tricky because of the space. I tried putting in the "%20" at the end, but apache liked simple double quotes to define the trailing space. The line in the .htaccess looked like this:



Redirect "/Misc/Pennies/ " http://www.fincher.org/Misc/Pennies

Friday, September 15, 2006

Vista could create 50,000 EU jobs

A Microsoft funded study has concluded that Vista will create 50,000 jobs in Europe.
O Pelease!
This is just spin to help with Microsoft's ongoin legal troubles in Europe.
Besides, new jobs are not necessarily a good thing. A toxic waste spill in Europe could create 50,000 new well paying jobs in Europe. We could hire 50,000 painters in Europe to paint all the houses yellow, but after all the money is spent, will we be better off?

The real economic issue is whether Vista will improve the *productivity* of Europe.
Vast amounts of money will be spent training and finding new bugs, but really are we more productive? I doubt it. I've yet to see any features to really make us more productive with the exception of WinFS. Oh, I forgot. WinFS is not in Vista is it?

Besides, I still don't get what Microsoft gains by producing Vista. Most people just buy the OS on a new computer. Microsoft won't gain any new sales. Why didn't Microsoft just save all those billions and billions of dollars. They could have just improved XP for a few million. Microsoft might even lose money since Vista requires more expensive hardware leading to fewer machine sales and fewer OS sales.

Wednesday, September 13, 2006

Twilight of Patterns / "Day Coder"

Patterns were all the rage a decade ago and we all learned patterns like Visitor, Factory, and Abstract Factory patterns. Some patterns like Visitor are rendered trivial with higher level languages like Lisp. I wrote a mapcar function this morning in elisp and it finally dawned on me that patterns really are just kludges stuck into a language. I understand better what people have been saying, "Patterns are really weaknesses in a language."
Hopefully as languages like Java and C# become higher level we will have less patterns to learn - or we can switch to Ruby, Lisp, or Smalltalk - and perhaps no patterns in Ruby++.

I did learn a good buzzword today: "Day coder", a programmer with no real passion for the profession, they just work for the money.

Monday, September 04, 2006

Digital Video Recorders Compared

In our humble home we have three different types of Digital Video Recorders (DVRs).
Below are some random comments on the tradeoffs with each:

Windows Media Center: Good user interface for selecting programs. Schedule information is free and the software is reliable. The software to burn a show to DVD is decent software, although clunky on the Sony using Click2DVD.
Fastforward is totally useless. I try to skip commercials, but once past them the WMC player doesn't stop for minutes, so I have to rewind, but have the same problem of overshooting on the other end. I don't use FF or RW anymore, although the pause/start button works superbly. Using WMC for watching TV concurrently with doing any actual work on the computer is frustratingly awkward due to cpu cycles being shared. Score: 2/5.

TimeWarner/Scientific Atlanta cable box: Good user interface for watching TV. I was immediately able to change channels. Watching the current channel in the corner is userful as I search for more fodder. That being said, the interface is horrible in every other respect. I could not learn how to record a series given a title. Selecting a known title to record in the future is incredibly tedious. I was looking for "Driving Through History", but the interface only offered to jump me to the "D"s. Do you know how many digital tv shows in the next two weeks start with "D". Lots.
I had to read the manual to program the remote to control the tv, took about 20 minutes (half a dozen codes were listed for my brand of tv)
If you ever wondered what an assmebly langauge programmer from the 1960's would produce for a user interface for watching tv, look no farther. The TimeWarner cable DVR is awful. Score: 1/5.

TiVo: Tivo is sweetness and light. From the first time I turned it on, TiVo has worked flawlessly. I was able to select my TV brand from an online list. Recording shows and series is effortless. The GUI just works like you think it should.
I love the "TiVo Recommends" section. I love being able to control TiVo recordings from anywhere in the world via the internet. I don't love the monthly fee, but I'd rather pay them than use the much cheaper TimeWarner box. Score: 5/5.

Freedom is ...

A popular bumper sticker here is "Freedom is the distance between Church and State.", but it doesn't attribute the phrase to anyone. I just forgot if it was Stalin, Mao, or Pol Pot?

Saturday, September 02, 2006

New StarTrek Makeover / CGI

Reports are that the ooolllddd Star Trek series is getting a makeover with enhansed CGI effects. Apparently the cheesy background will get a digital makeover along with all the spaceshots. What StarTrek *really* needs is not CGI, but CGA. CGA is this new technology using the latest in AI technology and graphics cards. CGA stands for Computer Generated Acting. It takes old video and actually injects real emotions into the actors ("He's dead Jim") to make the shows watchable.

Check out the trailer (sans CGA):

Monday, August 21, 2006

NHibernate at the Austin .Net User's Group

About 55 people listened as Weston M. Binford III and Reddy Rajanala presented NHibernate at our .Net User's Group.

WestonNHIbernate
They recommended two books:




Click to read reviews or buy Hibernate In Action

Hibernate In Action by Christian Bauer and Gavin King

Click to read reviews or buy Hibernate Quickly

Hibernate Quickly
by Patrick Peak Nick Heudecker


Weston recommended winmerge and the iesi collections especially sets .
What's with the lack of an ordered set in .Net anyway?

Thursday, August 17, 2006

VS2003, Perforce, and Web Projects

At work we are converting our source control from pvcs to Perforce. The transition has not been smooth. I tested Perforce before our purchase and a web project worked fine. But web projects are very sensitive. Perforce even states they don't support web projects integration with Visual Studio.
We kept getting errors like

One or more of the project's destination paths are invalid. To open this solution, you must specify valid paths for each project. The error returned was "The Web at already contains a project. You need to choose another location for your Web project.

and

Visual Studio 2003 already contains a project. You need to choose another location for your Web project.

The best we can tell the steps to integrating a web project in Visual Studio 2003 and Perforce are as follows:

Check all the web project code directly into Perforce not using Visual Studio.
Create a virtual directory in IIS manually. Under the tab "Virtual Directory" remove the application.
In Visual Studio create a blank solution. Select "File/Source Control/Open From Source Control".
The perforce dialog box appears. Select the right attributes on the first panel and select "OK". On the second dialog box select your csproj file. If the moon is in the right phase and fortune smiles on you, the next dialog will have your web site url correct. If the proposed web site has "_1" appended, abandon all hope; somethings wrong. If the proposed web site url is correct, contine and life looks good.

We get an oddity where sometimes when adding the second web project Visual Studio will create an entire new .sln file for us and not add the second project into the current solution.

Well, all that being said, we are moving soon to VS2005 and all these problems will be solved. Right?

Wednesday, August 16, 2006

Converting Web Projects from VS2003 to VS2005

As we all slowly move from .Net 1.1 to 2.0 and from VS2003 to VS2005 you should consider NOT upgrading your web projects to the default "Web Site Project" in VS2003, but instead to the recently released "Web Application Project".
The default "Web Site Project" is very different from the 2003 web project. Files are no longer stored in a tidy dll, but spread all over the place. This makes unit testing very difficult.

Many developers hated the new project type so Scott Guthrie's team released on May 8th 2006 a new project type, "Web Application Project" more like the VS2003 project. Scott has a nice introduction here and the official microsoft docs are here

Monday, August 14, 2006

Upgrading an Asp.Net application from Windows 2000 to 2003 Server

Today we upgraded our main application from Windows 2000 to Windows 2003. One of the problems was the more restrictive settings of IIS in Windows 2003. Our problem was that IIS would no longer serve .dtd documents. We had to explicitly tell IIS that .dtd and .ent files were ok to process.
Here's how to do it:

Open IIS Management Console
Right Click on your virtual directory
Select "Properties"
Select "HTTP Headers"
Select "MIME types"
Select "New..."
Set the extension to ".dtd"
and application to "application/octet-stream"

Thursday, August 10, 2006

parrot

The Parrot project has interesting possibilities. Parrot is a virtual machine specification like java and .Net bytecode to be used for Perl6. Parrot's difference is that it is being designed to implement any language. Java's bytecode has difficulties with untyped objects which makes a Ruby implementation difficult. .Net's bytecode is more robust, but still has issues. The designers of Parrot are testing different langauges like Forth to make sure the language has all the operators needed to support most known languages.

An interesting possibility is to have browsers interpret Parrot code so we can write any language and have it interpreted by the browser instead of just javascript.

Now if we could just get an open source spec for denser DVDs and bypass the whole HD-DVD and Blu-Ray war.

Saturday, July 29, 2006

First YouTube Video

My daughter and I made our first YouTube video this morning to go along with our CoinStacking.com website.




The possiblilities at YouTube are so enormous. A friend of mine showed me her friend's page where she is teaching Japanese via short videos. Besides lots of humourous videos, the vistas are open for teaching.

Thursday, July 27, 2006

Why is Microsoft software so bad?

About twenty times a day I ask myself the same question over and over: "Why is Microsoft software so bad?" I mean, it's horrible. For example, this message pops up on my screen occasionally, "A program is trying to access your email folder. Would you like to grant it permission?". My first thought is naturally, "Which program?", but the warning is too coy to answer that. Finally I realize it's my IPAQ trying to sync and grant permission. But didn't it ever occur to anyone at Microsoft that users might want to grant some applications permission and not others?

Another example - Visual Studio has so little clue about software. VS 2003 can't even take you to the correct overloaded method. VS2005 is better, but good grief it's been 3 years (21 in internet years) and they "give" us this? Refactoring is included, but very limited. VS 2005 is a great editor - if this was 1999. Why did't Microsoft just buy IntelliJ?

I waste so much time each day from bad error messages and a outdated IDE.

So why is this? Why is Microsoft software so bad?

Email Obfuscation

Ok, for a long time I just included my email as something like "mitch[at]fincher[dot]org". Which works fairly well, but people wishing to email have to translate that to the real address and mail spammer could tweak their searching just a little to get the address.

I ran into a friend and he suggested using javascript to hide email address. This is not the strongest method, but it is easy. Mail spammer have to increase their technology quite a bit to run the javascript, not that they can't do it, but it's a lot more work and computing time. Here is a snippet:


<script type="text/javascript"><!--
var name = "fincherdotorg";
var domain = "gmail.com";
document.write('<a href=\"mailto:' + name + '@' + domain + '?subject=Note%20from%20website\">');
document.write(name + '@' + domain + '</a>');
// --></script>

Tuesday, July 18, 2006

No Fluff, Just Stuff Conference 2006

Last weekend I attended the No Fluff, Just Stuff Conference which has traditionally been Java-centric, but this year was pleasantly Ruby-friendly.

Jay Zimmerman, Founder of NFJS and mystery woman:


2006-07-26-JayZimmerman.jpg

My thoughts on Ruby on Rails


I remember seeing J2EE for the first time and thinking: "This is way complicated."
I remember seeing .Net for the first time thinking: "This is a lot like J2EE."
Seeing Ruby On Rails for the first time I thought: "This is way, way cool." I was very impressed that testability is baked into the very DNA of RoR. I liked the way all projects had the same directory structure, so you can understand a new project quickly. I like how in Ruby projects everything is Ruby, you don't have to learn (n)ant, and then different xml config files. The config files are Ruby, not some XML syntax.



2006-07-26-DaveThomasNFJS.jpg

Dave Thomas did a great keynote speech. He compared methodologies to the Cargo Cults in New Guinea. Basically saying that we ape some process that worked well in the past, but don't really think about if it's appropriate for us today.


Bruce Tate did a demonstration of Test-First programming that was very impressive. Using the Test-First process, the audience created a Tic-Tac-Toe program that was remarkably simpler than would have been done with a classic UML design.

Some other tidbits:
The Spring Framework came from real developers solving their own problems which is a key to its success.
"Type Declarations are Programming Chains."
Many Design Patterns just go away in Ruby.

Friday, July 14, 2006

Austin Ruby Coders Meeting Last Night

At Arctan (Austin Ruby Coders Texas Area Network) last night Eric Mahurin gave an overview of the Grammar project. Eric has created a very slick lex/parser. Interestingly the grammar *is* Ruby. Like Rake, it is not some other syntax you need to learn, but it is just Ruby.
Another intesting tidbit was Eric's use of class recursion.

Class Grammar

Class Element < Grammar
...

This allows classes defined in "Grammar" to use all the class methods.

Monday, July 10, 2006

New Blog Hosting

My website was hacked over the weekend. The vandals got in via my php blog site I was hosting. After installing, patching, patching, upgrading, purging - did I say patching - I decided to ditch hosting the site with all its vulnerabilities and go with an online blogging source.
To view my old blogs from 2002-2006 visit www.fincher.org.