Tech in the 603, The Granite State Hacker

Compromise & Capitulation

There’s three different flavors of Windows Mobile in the 6.x line. Standard, Classic, and Professional.

Standard = Smart Phone, no touchscreen
Classic = PDA w/touchscreen
Professional = PDA / Phone with Touchscreen

One of the other interesting little gotchas is that the .Net Compact Framework 2.0 compiles the same for all three editions. Unfortunately, once in a while, you get a “NotSupportedException” out of the Standard edition.

A few days ago, in order to get my sudoku program published, I decided to simply avoid a problem I had with the Standard edition’s lack of a SaveFileDialog and OpenFileDialog. My avoidance manifested in a “not supported” message of my own, if the user tried to save / load a file in that environment.

Today, I capitulated… I implemented an alternative file save/load functionality which kicks in automatically when the program gets a “NotSupportedException” on the common dialogs.

It’s in 3.0.3, which I’ve re-published on PocketGear.

Tech in the 603, The Granite State Hacker

Jimmy SuDoku 3.0 Released

Those of you who have worked with me on a project in the past few years probably know of my hobby project. It’s an implementation of SuDoku. It’s made for Windows Mobile devices (cell phones, etc.), but it also runs on Windows XP (et al).

The old version, 2.5, had been published on PocketGear. This last update was published in January, 2007, just before I started with Edgewater.

I’ve been hacking at it here & there since then, but the project suffered from lots of maladies… most significantly lack of time.

So after more than a year and a half, I’m happy to finally announce Jimmy SuDoku 3.0!

3.0 has a whole new game state model, based on CLR classes rather than an XML DOM. This means the puzzle generator’s fast enough on hand-held devices that it doesn’t need a web service to do the work for it. Another side-effect of this change is a smaller run-time memory footprint, though I’m not sure by exactly how much.

I also figured out how to leverage the hardware controls on WM6.0 & 6.1 devices so that non-touchscreen devices can play, too.

Tech in the 603, The Granite State Hacker

SSIS Bug / Workaround

I ran across a “feature” (bug) in SSIS today that I figured I’d record in case I ran across it again…

Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E14. An OLE DB record is available. Source: “Microsoft SQL Native Client” Hresult: 0x80040E14 Description: “Cannot fetch a row from OLE DB provider “BULK” for linked server “(null)”.”. An OLE DB record is available. Source: “Microsoft SQL Native Client” Hresult: 0x80040E14 Description: “The OLE DB provider “BULK” for linked server “(null)” reported an error. The provider did not give any information about the error.”. An OLE DB record is available. Source: “Microsoft SQL Native Client” Hresult: 0x80040E14 Description: “Reading from DTS buffer timed out.”.

According to this MSDN forum thread, it’s a bona-fide SSIS bug (I’m running SQL Server SP2 with the latest known patches as of this date.)

So the problem is in the SQL Server Destination. Changing it out for an OLEDB Destination seems to do the trick.

Tech in the 603, The Granite State Hacker

WALL•E and Enterprise Data Landfills

“Life is nothing but imperfection and the computer likes perfection, so we spent probably 90% of our time putting in all of the imperfections, whether it’s in the design of something or just the unconscious stuff. “
-Andrew Stanton, director of Disney/Pixar’s WALL-E, in an interview on the topic of graphic detailing.

I’m enough of a sci-fi geek that I had to take my kids to see WALL*E the day it opened. I found it so entertaining that, while on vacation, I started browsing around the internet… digging for addititonal tidbits about the backstory.

I came across the quote, above, initially on Wikipedia’s Wall-E page.

The simple truth carries across all applications of contemporary computer technology. Technology tools are designed for the “general” cases, and yet, more and more often, we’re running into the imperfect, inconsistent, outlying, and exceptional cases.

To follow the thought along, perhaps 90% of what we do as software developers is about trying to get a grip on the complexities of… everything we get to touch on. I guess the remaining 10% would be akin to the root classes… the “Object” class, and the first few subordinates, for example.

Andrew Stanton’s quote reminds me of the 90-10 rule of software engineering… 90% of the code is implemented in 10% of the time. (conversely, the remaining 10% of the code is implemented in the remaining 90% of time). I tend to think of this one as a myth, but it’s fun thought.

It’s dealing with the rough fringes of our data that’s among the industry’s current challenges, but it’s not just corporate data landfills.

I recently heard a report that suggested that technology will get to the point that commercially available vehicles with an auto-pilot will be available within the next 20 or so years. What’s really the difference, to a computer, between financial data, and, say, navigational sensor data?

So to flip that idea on its head, again, and you could have more intelligent artificial agents spelunking through data warehouses… WALL-DW ? (Data Warehouse edition)

Then again, I wonder if the 80-20% rule isn’t what gets us into our binds to begin with.

Tech in the 603, The Granite State Hacker

Real Software Heroes

While scanning the channels looking for an interesting show to watch, I came across a show on the Science channel… “Moon Machines“. I couldn’t have been luckier than to see the chapter “Navigation”.    (Update: Full video online here:  http://www.dailymotion.com/video/xxxiij )

I’d heard bits about the technology that went into the Apollo missions, and how there were some of the first “modern” IC-based computers on board, but I never really thought about the implications of what they were doing. Having these computers aboard meant they had software. There wasn’t exactly COTS systems for navigating to the moon.

The episode focused quite a bit on the experience of the software development team, including some at the personal level. There were quotes like “Honey, I’m going to be in charge of developing something called ‘software’.”… (and the response: “Please don’t tell the neighbors.”)

I’ve felt pressure on projects before… stuff I was working on that represented millions of dollars in its success, and presumably millions lost in its failure. I’ve even worked on software projects where runtime production logic errors could send people to jail. I’ve never written software that human life directly depended on.

My hat is off to the folks who took up this monumental challenge for the first time in software history, and made it work. To me, that’s every championship sports victory… ever… combined.

All I can say is… wow.

They knew what a monumental victory it was, too… 40+/- years later, and the engineers they interviewed were still moved by the awe of their own accomplishment, and the personal sacrifices they made to pull it off.

As well they should be. Fantastic!!

Tech in the 603, The Granite State Hacker

SSIS: Unit Testing

I’ve spent the past couple days putting together unit tests for SSIS packages. It’s not as easy to do as it is to write unit & integration tests for, say, typical C# projects.

SSIS Data flows can be really complex. Worse, you really can’t execute portions of a single data flow separately and get meaninful results.

Further, one of the key features of SSIS is the fact that the built-in data flow toolbox items can be equated to framework functionality. There’s not so much value in unit testing the framework.

Excuses come easy, but really, unit testing in SSIS is not impossible…

So meaningful unit testing of SSIS packages really comes down to testing of Executables in a control flow, and particularly executables with a high degree of programability. The two most significant control flow executable types are Script Task executables and Data Flow executables.

Ultimately, the solution to SSIS unit testing becomes package execution automation.

There are a certain number of things you have to do before you can start writing C# to test your scripts and data flows, though. I’ll go through my experience with it, so far.

In order to automate SSIS package execution for unit testing, you must have Visual Studio 2005 (or greater) with the language of your choice installed (I chose C#).

Interestingly, while you can develop and debug SSIS in the Business Intelligence Development System (BIDS, a subset of Visual Studio), you cannot execute SSIS packages from C# without SQL Server 2005 Developer or Enterprise edition installed (“go Microsoft!”).

Another important caveat… you CAN have your unit test project in the same solution as your SSIS project. Due to over-excessive design time validation of SSIS packages, you can’t effectively execute the SSIS packages from your unit test code if you have the SSIS project loaded at the same time. I’ve found that the only way I can safely run my unit tests is to “Unload Project” on the SSIS project before attempting to execute the unit test host app. Even then, Visual Studio occassionally holds locks on files that force me to close and re-open Visual Studio in order to release them.

Anyway, I chose to use a console application as the host app. There’s some info out there on the ‘net about how to configure a .config file borrowing from dtexec.exe.config, the SSIS command line utility, but I didn’t see anything special in there that I had to include.

The only reference you need to add to your project is a ref to Microsoft.SqlServer.ManagedDTS. The core namespace you’ll need is

using Microsoft.SqlServer.Dts.Runtime;

In my first case, most of my unit testing is variations on a single input file. The package validates the input and produces three outputs: a table that contains source records which have passed validation, a flat output file that contains source records that failed validation, and a target table that contains transformed results.

What I ended up doing was creating a very small framework that allowed me to declare a test and some metadata about it. The metadata associates a group of resources that include a test input, and the three baseline outputs by a common URN. Once I have my input and baselines established, I can circumvent downloading the “real” source file, inject my test source into the process, and compare the results with my baselines.

Here’s an example Unit test of a Validation executable within my SSIS package:

[TestInfo(Name = "Unit: Validate Source, duplicated line in source", TestURN = "Dupes")]
public void ValidationUnitDupeLineTest()
{
using (Package thePackage = _dtsApp.LoadPackage(packageFilePath, this))
{
thePackage.DelayValidation = true;
DisableAllExecutables(thePackage);
EnableValidationExecutable(thePackage);
InjectBaselineSource(GetBaselineResource("Stage_1_Source_" + TestURN), thePackage.Variables["SourceFilePath"]);
thePackage.Execute(null, null, this, null, null);
string errorFilePath = thePackage.Variables["ErrorLogFilePath"].Value as string;
//throw new AbortTestingException();
AssertPackageExecutionResult(thePackage, DTSExecResult.Failure);
AssertBaselineAdjustSource(TestURN);
AssertBaselineFile(GetBaselineResourceString("Baseline_Stage1_" + TestURN), errorFilePath);
}
}

Here’s the code that does some of the SSIS Package manipulation referenced above:


#region Utilities
protected virtual void DisableAllExecutables(Package thePackage)
{
Sequence aContainer = thePackage.Executables["Adjustments, Stage 1"] as Sequence;
(aContainer.Executables["Download Source From SharePoint"] as TaskHost).Disable = true;
(aContainer.Executables["Prep Target Tables"] as TaskHost).Disable = true;
(aContainer.Executables["Validate Source Data"] as TaskHost).Disable = true;
(aContainer.Executables["Process Source Data"] as TaskHost).Disable = true;
(aContainer.Executables["Source Validation Failure Sequence"] as Sequence).Disable = true;
(aContainer.Executables["Execute Report Subscription"] as TaskHost).Disable = true;
(thePackage.Executables["Package Success Sequence"] as Sequence).Disable = true;
(thePackage.Executables["Package Failure Sequence"] as Sequence).Disable = true;
}


protected virtual void DisableDownloadExecutable(Package thePackage)
{
Sequence aContainer = thePackage.Executables["Adjustments, Stage 1"] as Sequence;
TaskHost dLScriptTask = aContainer.Executables["Download Source From SharePoint"] as TaskHost;
dLScriptTask.Disable = true;
}


protected virtual void EnableValidationExecutable(Package thePackage)
{
Sequence aContainer = thePackage.Executables["Adjustments, Stage 1"] as Sequence;
TaskHost validationFlow = aContainer.Executables["Validate Source Data"] as TaskHost;
validationFlow.Disable = false;
}

protected virtual void EnableValidationExecutable(Package thePackage)
{
Sequence aContainer = thePackage.Executables["Adjustments, Stage 1"] as Sequence;
TaskHost validationFlow = aContainer.Executables["Validate Source Data"] as TaskHost;
validationFlow.Disable = false;
}

Another really handy thing to be aware of…

IDTSEvents

I highly recommend you implement this interface and pass it into your packages. Of course, in each event handler in the interface, implement code to send reasonable information to an output stream. Notice the call to thePackage.Execute, way up in the first code snippet… the class that contains that method implements that interface, so I can manipulate (when necessary) how to handle certain events.

Interestingly, I haven’t needed to do anything fancy with that so far, but I can imagine that functionality being very important in future unit tests that I write.

Here’s a visual on all the resources… the image shows SSMS over VS, with both database tables and project resources with common URNs to relate them.

I won’t get into the details of the framework functionality, but I found it useful to be able to do things like set a flag to rebuild baseline resources from current outputs, and such.

I modeled some of my framework (very loosely) functionality on the Visual Studio Team System Edition for Testers, which we used on the TWM ISIS project.

Another interesting lesson learned: I can see that the folks who built SSIS were not avid unit testers themselves. SSIS Executables have a “Validate()” method. I encountered lots of problems when I tried to use it. Hangs, intermittent errors, all that stuff that testing should have ironed out.

Tech in the 603, The Granite State Hacker

Null Schema

I’ve been contemplating the whole “unstructured” thing for a while now, and I’ve developed some new hypotheses about it. The discussion’s been around the fact that Web 2.0 / Enterprise 2.0 generates a lot of “unstructured” data.

I’m not sure “unstructured” is really the most technically fitting word, though. It’s the word that works if you’re a technical person talking to a non-technical person.

I think the information we’re seeing in these settings is typically better structured than what we’ve seen in the past. The structures are being defined by the provider, however, sometimes on an ad-hoc basis, and can change without notice.

If you’re in the geek domain, I think “undefined” fits better. Maybe “unknowable structure”. It’s Null Schema.

I think we’ve all seen tons of this… it’s a trend towards increasing structure with less defined schema. It seems to fit with the “agile” trend.

So the other aspect of this Web 2.0 thing is that the data doesn’t have to just be of an unknowable format. It can also be communicated through a number of communications channels, at the provider’s discretion. People define conventions to ease this. Interestingly, the convened-upon channels end up providing context for the content. In turn, it adds to its structure… more null schema.

It flies in the face of our tightly defined, versioned SOA end-point contracts. XSOA? 🙂

It’s been said that SOA lives in a different problem space, but that may only be a matter of convention, moving forward.

Tech in the 603, The Granite State Hacker

My Windows Mobile PCS Phone

I just gotta say… this thing’s fantastic.

It’s my own personal mobile phone (not company issued), but I really do get some hefty mileage out of it.

It’s a Sprint Mogul 6800. Verizon has a similar unit (vx6800, I think). It’s one of many Windows Mobile 6 devices out there… touch screen, with a stylus and a slide out keyboard. It was already a little dated when I bought it, but that just meant the price wasn’t so high.

I’m just psyched because I bought this one back in September 2007, and I keep finding new uses for it.

My new assignment is in Boston. One of the rough edges of the assignment, for me, is the long commute… (1 hour minimum (if traffic’s really good)). So after doing the math, I discovered that I can pick up the Boston Express bus ride from a neighboring town.

I’m on the return trip at this moment, using my phone for internet access, and it’s really solid, EV-DO.A service. Connectivity is a USB port away.

While I’m doing that, I’m ALSO listening to 2Gb worth of music that I downloaded via subscription service from Napster using Windows Media Player Mobile.

The built in GPS was not software-enabled when I bought the phone, but a software upgrade released in January solved that. The GPS works great with the Google Maps for Pocket PC app I downloaded for free. This morning, it got me from South Station to NHP just like it got me from NYC’s Port Authority bus terminal to the AT&T store on Madison Ave a few weeks ago to see MS Surface.

So I also toy with the .NET Compact Framework, and used it some time ago to write my own Windows Mobile implementation of sudoku. (I’ve been seriously considering refactoring to mess with LINQ in the .NET CF 3.5)

The built in camera’s nice… I use it all the time when I’ve forgotten my “real” camera.

Wi-Fi is occasionally very handy… it’s great when I need network access while talking on the phone.

So is bluetooth… I appreciate being able to talk on the bluetooth headset while taking notes or looking stuff up online… or just appreciate talking hands-free.

I sync the thing with Outlook, and rely on it too heavily for meeting reminders. That comes in handy at NHP, too, where network access is… limited. (I can even get RSS updates from the Tech Mill.) It’s also integrated with Active Directory, so when I need a teammate’s contact info, I can find it online as long as I have connectivity (pretty much always).

I’ve used the voice recorder a few times. It’s been handy when I’ve needed it.

There’s a whole list of “separate” items I don’t carry because I have this thing… I don’t wear a watch. I don’t have an iPod. I don’t carry a GPS handheld, or keep one in my car. I don’t often carry around my camera. I seldom use paper to take notes, so I don’t often need a pen. This one thing covers all that stuff, and more.

Did I mention that it’s a phone? 🙂

Tech in the 603, The Granite State Hacker

Enterprise Reprogramming

I found an interview of a Satyam Senior VP listed on LinkedIn relatively interesting (link below).

This senior VP talks about how Satyam and the IT industry is responding to new challenges.

One thing that stands out to me is the statement that they are moving from services to solutions. They make the implication that they are rebuilding or reprogramming businesses at the workflow / process level. They appear to be successfully applying technology build-out as a commodity service while implementing their solutions… Sounds like they’re treating the enterprise as a sort of programmable platform, like SOA / BPM on a grand scale.

From the article:
“A solutions provider transforms business. The difference in business will happen when we change those business processes as well. That is where we are bringing in business transformation solutions — process optimisation, process reengineering, etc. “

My intuition doesn’t quite square with Satyam’s vision.

Lots of things have been pointing towards more innovation in the top layers of applications, built on a very stable technology base. To me, it still feels like there’s an unspoken motivation for that: business leadership wants IT folks to make ruggedized app dev tools and hand them over to power users (and/or process owners). Business leaders want IT to get the C# off their business processes.

All of that is sorta where I started cooking up the hypothesis of metaware from.

I’m curious to know how Satyam’s vision is really working. I guess we’ll know in a few years.

‘Moving towards IP-led revenues’

Tech in the 603, The Granite State Hacker

Functional Expression

So one more thing crossed my mind about implementing code with respect to art & science, and I had to express it…

I looked up the term “Art” in the dictionary. The first definition is:

  • the quality, production, expression, or realm, according to aesthetic principles, of what is beautiful, appealing, or of more than ordinary significance.

For me, regarding coding, it’s a matter of remembering a few points:

  1. implementation is expression
  2. significance is subjective
  3. beauty is in the eye of the beholder

So code can be expressed, fundamentally, in a bunch of ways:

  • Electronically,
  • Numerically,
  • mnemonically,
  • symbolically,
  • graphically,
  • gesturally,
  • audibly,
  • visually,
  • etc… ?

Simple, clever, elegant, seemingly natural expressions of all kinds are typically beautiful to a programmer, when they function correctly.

Of course, to me, the most beautiful implementations are implementations that elegantly express its business in a way that’s very clear to anyone familiar with the problem domain at that abstraction level, and to the target platform(s).

See also:
politechnosis: Art & Science