Archive for the ‘Tools’ Category

Support the JQuery Project

JQuery logo

Adopting JQuery was one of the smartest technology decisions we made.

Gordon and I faced a lot of technology choices when we began work on Infovark. One of the best decisions we made was using the JQuery JavaScript framework.

Today marks the official release of JQuery 1.4. This new version brings several performance improvements, greater support for JSON, Ajax, and HTML 5, and many other improvements.

What are you waiting for? Go get it.

Share the love

All this programming goodness comes free, but the JQuery Project is asking for contributions to support the effort.

Since the Infovark coffers are a bit thin at the moment, I made a personal donation to the JQuery Project. To celebrate the release of JQuery 1.4, for the next 14 days any donation over $20 will receive a free JavaScript ebook. The details are on the donate page.

I gave the JQuery Project $30. Considering the amount of time it’s saved me, it was a small amount, but I figure every bit helps.

If you’ve found JQuery valuable, consider giving something back to the community. And if you haven’t, you owe it to yourself to check out the latest release with its improved API documentation.

Getting Up to Speed on Windows Installer

In our past jobs, Gordon and I worked as part of larger technical teams. As developers, we never had to worry about the installation routine. It’s a highly specialized area of software development. We had people to do that job for us.

Fortunately I’d had a little experience working with InstallShield but that mainly involved stepped through the wizard and trying not to adjust settings that I didn’t understand. (Which meant most of the settings.)

Working on Infovark, we’ve had to absorb a crash course on Windows Installer. Windows Installer is the official Microsoft sanctioned technology for deploying applications to Windows. If you want to get the compatibility logo on your product, you must use Windows Installer or a tool that generates Windows Installer compatible .MSI files.

Windows Installer has been around for a long time, going back to at least 1998. Version 1.0 shipped with Office 2000. In the time since, it’s gone through many changes and revisions. If you didn’t “grow up” with the technology over the years, it’s a daunting challenge to get up to speed.

We figured our best bet was to pick a software package to help us build our MSI files. But since we didn’t know Windows Installer very well, it was hard to evaluate which one to use.

The best place I found for information about Windows Installer and setup and deployment tools is InstallSite. Finding my way around was a bit tricky, but there’s lots of good information there.

I also found an awesome series of articles written by Robert Flaming about UAC and Windows Installer. There are a few stray articles not included in his table of contents: UAC in MSI.

The series describes the slow evolution of User Account Control and per-user settings from Windows 95 to the present. This helps put all the hacks and kludges in context.

This long history is what makes creating good software installation routines on Windows difficult, especially if you want to support multiple versions of the operating system. The differences between Windows XP and Windows Vista are particularly large.

So if you’re planning to deploy your software to the desktop, make sure to include a lot of time in your development budget for research, testing and troubleshooting. It’s harder than you think.

Visual Studio 2008 and the CopyLocal setting

Though the Microsoft marketing drums have begun beating to the rhythm of Visual Studio 2010, most of us workaday code monkeys are still using Visual Studio 2008. And while VS 2008 is a great IDE for development — especially once you add ReSharper — it has a few configuration quirks that drive me up the wall.

Most of these quirks are hidden from the typical developer and only appear once you try to package and deploy your software. It’s the dreaded Works on My Machine syndrome.

And if there’s one Visual Studio build configuration setting that causes me to scream in anguish, it’s the CopyLocal property.

Feel my pain

When you add a reference to another .dll in Visual Studio 2008, some default settings get applied.

The CopyLocal setting on the reference properties panel.

The CopyLocal setting on the reference properties panel.

Here’s how the settings look after I added log4net to one of my projects. As you can see, the CopyLocal setting is set to True. Or is it?

If you move your solution to your build server, you might be surprised to find that CopyLocal isn’t actually copying the .dll. I was certainly surprised to find that my builds failing for inexplicable reasons.

It took me a while to figure out that Visual Studio 2008 is a dirty liar when it comes to CopyLocal. Let’s have a look at our .csproj file, shall we? You can load the XML in the .csproj file by following these directions.

Ah, there’s the contents of our csproj file. And there’s our reference to log4net, but…

Where's the CopyLocal setting?

Where's the CopyLocal setting?

The CopyLocal setting isn’t there! Within the log4net reference, we should see an XML element called Private. It should look like this:

  1. <Private>True</Private>

But it’s clearly not there. Uh oh.

And because it’s not there, it might work on your machine but not on other machines. Even though the Visual Studio IDE represents CopyLocal as a Boolean value, it’s actually a ternary value. Where Booleans have two states, usually represented as True/False, Yes/No, or 1/0 pairs, ternary logic has three states:

  • True
  • False
  • Um… uh… Other?

Yikes! That’s a classic interface failure mode.

It turns out that the default for the CopyLocal setting is… something not quite True and not quite False. If you read the documentation for how to set the CopyLocal property, it mentions the weird logic Visual Studio uses to determine what the “default” should be. Argh.

Manual repairs

To fix the problem, we reload our project in Visual Studio again. Then we toggle the CopyLocal setting from “not quite True, exactly” to “False” and then back to “totally, literally True”.

With apologies to the Violent Femmes, when I say CopyLocal, you best CopyLocal, motherf***er!!!

And now it’s really, truly TRUE. Honest. Take a look at our .csproj file now.

This is how CopyLocal=True ought to look.

This is how CopyLocal=True ought to look.

And there it is, the CopyLocal setting. The way it should be. The way it should have been all along.

Conclusion

I don’t know whether Visual Studio 2010 fixes this problem. I haven’t looked at the VS 2010 Beta release to find out. I’m too busy manually editing all my .csproj files to get our Infovark builds working. But I really, really, really hope that the folks at Microsoft have done something to address the problem.

Here’s the simple interface design rule: If it isn’t a Boolean setting, it shouldn’t look like a Boolean setting.

Unless of course, you want to make the pages of The Daily WTF.

Tools: Firebird Maestro

I didn’t set out to buy a SQL IDE three months ago, but I bought Firebird Maestro from the SQL Maestro group anyway.

What I was looking for

What I was actually looking for was an equivalent to Red Gate‘s SQL Packager for the Firebird database. SQL Packager is a useful application that makes it easy to package and deploy database schema upgrades. Sadly, all of Red Gate’s tools are for Microsoft SQL Server only.

My next step was to look through the list of admin tools on the Firebird website. And while there’s a huge selection of tools available for Firebird, I couldn’t find anything that would help me deploy schema and data upgrades. It was a bit surprising, actually, since one of Firebird’s strengths is how easy it is to embed inside other software applications. (If I’ve missed an application that can do this, please let me know!)

What I found instead

During the course of my investigations, I downloaded several different tools for managing Firebird. I’m a fan of the fast and free FlameRobin, but it’s still in development and doesn’t do everything I need. Sometimes a full-featured IDE is required, and I found two that fit the profile.

The first was SQL Studio from EMS Database Management Solutions. I appreciated their customer support and the breadth of features. But ultimately, I decided upon Firebird Maestro. The differences between the two IDEs were small, but Firebird Maestro had a better tool for producing database diagrams. Since Infovark has developers working halfway around the world from each other, having a good database diagram to reference is a must. Firebird Maestro also had a simple wizard for scripting out the schema and data into a single file. We put this text file into Subversion so that we have our database structure under version control.

Firebird Maestro

Firebird Maestro

It won’t help me deploy an update, but I’ve had to do that sort of thing by hand before, and I suppose I can do it again. But sometimes when you look for something you find something else just as good.

Tools: Add In Express

If you’ve ever tried to write Add-ins for Microsoft Office, you know that it can be a pretty intimidating task. Sure the splash screens might look the same, but underneath, Office is a whole collection of different versions of different products, and this becomes really apparent when you look under the hood at the various API interfaces.

There have been several attempts by Microsoft to add consistency to the way that solutions are developed on the office platform (with Visual Studio Tools for Office being the latest, and probably best entry), but when it comes down to it, to deploy anything really useful, you have to resort to learning 4 different versions of 5 different object models. 

Or do you? As you fumble your way through looking for sample code to make your life easier, there’s a high probability that you’ll end up on the Add-in Express site. When I first came across these guys, I checked out their claim that their product, Add-in Express, allows you to “Make office programming fast, comfortable and trouble-free”. I snorted. 

“C’mon. Nothing can do that…” I then hit the back button and clicked some link to Experts-Exchange and auto-scrolled all the way to the bottom. You can’t believe everything you read on the Internet, right?

Much later, Dean found another positive review for the Add-In Express guys on StackOverflow, and as we were about to begin a new iteration of our Office add-ins, he suggested that we should give them a try. I spoke to Andrei about getting a demonstration license, and installed the toolkit to build the next version of our Outlook Add-in. Within 2 days, I was converted. Add-in Express is a remarkable piece of software.

It’s different, but it works

Using Add-in Express is weird, but then, writing Office Add-ins is weird, so I guess that makes sense. Rather than have a traditional WYSIWYG designer, there is a canvas that allows you to add big icon-like controls, and then you set those controls’ properties through various properties dialogs. You handle events, write module level code, add references and any control you like. 

The Add-In Express Designer in Visual Studio

The Add-In Express Designer in Visual Studio

When you’ve configured these things to your liking, you simply register the add-in from the build menu, and then start your target office application. Your add-in is configured for you. If you want to debug it, you just attach to the process, and step through your code.  It has dramatically improved the reliability, speed and most importantly development time for our MS Office integration.

Add-in Express also adds a setup project to your solution, and builds you the MSI as you go. When you want to deploy your add-In, you simply run the MSI on the target machine. 

Support from the Add-in Express guys via their forum was prompt and very helpful. It became patently clear to me that these guys have already fallen into, and successfully gotten out of, all of the traps, potholes and tricks that are awaiting you in the mysterious world of Office Development. If you are planning on doing some serious Office Integration, this kind of knowledge is invaluable. Highly recommended.

JQuery Turns 3

When we began work on the Infovark user interface, we decided to base it on HTML and JavaScript. Both Gordon and I are very comfortable with web development, so it was a natural choice. We also felt this would give us the most flexibility to run on different platforms with different screen sizes. For better or worse, HTML and JavaScript have together become the lingua franca of interactive design.

Both have their drawbacks, of course. HTML and JavaScript have evolved over time. They each have quirks, particularly with regard to the Document Object Model (DOM). Fortunately there are a wide variety of JavaScript libraries that help programmers working with HTML and JavaScript.

We love JQuery

After doing a little research, we settled on on JQuery. JQuery makes us love JavaScript again. It’s a simple, small library that works across all major browsers. It deals with all the inconsistencies that emerge from the last decade of tinkering with web standards. Most importantly, it helps us get things done.

Microsoft has decided that they love JQuery, too. John Resig, the progenitor of the JQuery project, announced in September that jQuery will be distributed with Visual Studio. Two prominent Microsoft bloggers, Scott Guthrie and Scott Hanselman, also discussed the news.

It keeps getting better

Momentum around the project continues to build. The JQuery blog just posted news about the JQuery 1.3 release and the JQuery Foundation. Most exciting of all (from our perspective as developers) is the release of revamped JQuery API documentation.

Congratulations to the JQuery team! It’s come a long way in three short years.

Been Caught Stealing

Jeremy Miller writes, “if you’re writing ADO.Net code by hand, you’re stealing from your employer or client,” in his How to Design your Data Connectivity Strategy post last month on CodeBetter.com.

Guilty as charged

When we first started laying the groundwork for Infovark, we assumed that our back end would be a full-fledged Enterprise Content Management system. It was only later, once we realized that Infovark required a separate object persistence layer on the client side, that we began thinking about data storage.

Now, there were dozens of object-relational mapping tools available. From our perspective, though, they all shared a common flaw: We didn’t know how to use any of them.

Old dogs avoiding new tricks

Gordon and I got started in web development back in the “classic ASP” days. We knew how to work with ADO.NET. We had battled with object-relational impedance before, and had the scars to prove it.

So after gazing longingly at ActiveRecord and NHibernate, we decided to roll our own data access layer.

Months later, after much refactoring, we finally have a reasonably solid platform on which to build our application. It’s something we might have had in the first six weeks, had we done our homework.

But Infovark is an unusual project. We were having to learn many, many new things at the start. The thought of adding to the pile of books to read and websites to scan… especially when it was something we actually knew how to do…

What can we say? We fell prey to temptation. We promise we won’t do it again. It’s the straight and narrow from now on.

Tools: Beyond Compare 3

With my roots in maintenance programming, I’ve used a wide assortment of programming tools. Maintaining legacy code is not much fun. Anything that makes it easier gets added to my personal collection of productivity applications. I make a point of learning them inside and out.

I carry the tools with me from project to project. I recommend them to coworkers. I’ll use them even if my employer provides alternate tools for free. I’ll complain loudly if the company I work for won’t allow me to use them — for policy reasons, consistency reasons, or security reasons. (Most of my bosses eventually concede the point. After all, they’re interfering with my ability to get things done, which is presumably why they hired me.)

Beyond Compare by Scooter Software is one of those tools. It’s the best file comparison tool I’ve ever used. And not just me – It’s also earned praise from other programmers.

When I heard that version 3 was soon to be released, I was both excited and a bit nervous. What new features would they add? Were they going to break any behavior I relied on?

The website lists the new features, but the best new feature is the polished user interface, which makes it easier to move blocks of text and make inline edits to files.

File Comparison in Beyond Compare 3

File Comparison in Beyond Compare 3

And no, they didn’t mess up anything in the process.

I played with the beta for several weeks, and recently bought the full version. If you’re not using it already, you should try it.

It Doesn’t Get Better Than This

Our latest revision got high marks from our source control tools.

We are totally 1337.

Tools: ReSharper 4.0

We just finished our trial period for ReSharper from JetBrains. We’re buying licenses right now. It’s become indispensable to us. It’s that good.

ReSharper is like pair programming for introverts. It’s like a real-time FxCop, offering refactorings and best practices advice while you type.

Gordon had used ReSharper in its 2.0 days. I’d heard many positive things about ReSharper, but hadn’t tried it myself. The recently released 4.0 version offers support for C# 3.5, including the var keyword, object and collection initializers, and lambda expressions. Check out the in-depth review by Simon Hart if you want more details. Or just try it yourself.