Wax is for snowboards, not for bicycle chains.

I’ve started commuting to work via bicycle on a fairly regular basis, instead of driving my car. It only takes an extra 15-20 minutes each way, so it’s tough for me to come up with a reason not to ride the bike. One of the few things I don’t like about the bicycle though is chain maintenance. For a while I was using Finish Line Wet Lubricant, but I kept ending up with black chain marks all over me and my clothes. In my quest for a nice clean chain I recently gave paraffin wax a try. It was a little bit of a hassle dealing with the hot wax and all, but I had high hopes after reading one online post that reported the wax was still going strong after 3 months and almost 300 miles. Well, after the wax was applied I did have a nice clean chain. Yay, no more “chainring tattoos”. But on just my second day of commuting my chain was squeaking so bad I was ready to stop at the next available gas station for some 10W-30. Phooey!

Posted in General | Leave a comment

Something to brighten any Web Developer’s day

The folks behind Ruby on Rails have taken THE step, they’re phasing out product support for IE6! I can only hope that this is followed up by a flurry of announcements from other organizations that are going to follow suit. There was a time when IE6 was a leader, but that was a long time ago. User’s have plenty of alternative options (yes, flooding the company IT staff with requests to upgrade is an option).

Posted in General | Leave a comment

Ubuntu on old hardware

I’ve got a couple of older PC’s, both were Windows 98 machines when they were new. While attempting to install some of the more recent versions of Ubuntu on these machines I encountered various errors during the install phase or on first bootup after installation. After playing around a bit and trying various boot options I found a fairly simple solution that worked on both boxes: perform the initial install using the Breezy release, then update your sources list to Dapper and run apt-get dist-upgrade to get up-to-date with a fully supported version. Dapper was an LTS release, so if you’re running the server version of Ubuntu you’ll still be able to get updates until 2010. Throw a controller card and big hard drive in a machine like this, add Ubuntu server, and you’ve got yourself one heck of a network storage device.

Posted in General | Leave a comment

Visual Studio : virtualPath cannot be null

On several occasions while working with aspx/ascx files in Visual Studio I’ve run into an issue where the IDE stopped generating and updating designer files. I would get the following warning message when I compiled:

Generation of designer file failed: Value cannot be null.
Parameter name: virtualPath

Googling the warning message gets a lot of hits related to “Generation of designer file failed” but I was unable to find anything about a virtualPath parameter. I finally found the solution today while setting some values under the “Web” tab on the properties page for my VS project. Under the “Servers” section there’s a text box with the label “Virtual Path”, and for my project it was blank! I set the value in the text box to “/” and the IDE started happily generating and updating designer files again.

Virtual Path setting under Servers section of Web properties in Visual Studio project properties file.
I assumed that an error in this setting would have caused a problem with running the project using Visual Studio’s built in development server, but it didn’t. Silly me.

Posted in General | 2 Comments

Where did the fish go?

After catching my first keeper size striped bass a few weeks ago, I’ve been back to the same spot on the Merrimack a few times and also made a trip up to Cashman Park in Newburyport. Haven’t had any more luck though. There are still some stripers around, but nothing over 20 inches. It doesn’t seem any of the other fishermen we’ve run into have been doing any better. My father-in-law saw large bass in the shallows when he was swimming at Crane’s beach a couple of days ago, but didn’t see anyone catching them. If we get the chance, we may try heading up to Joppa Flats or Plum Island and try our luck there.

Posted in General | Comments Off on Where did the fish go?

Striper Fishing On The Merrimack

My First KeeperTried fishing in the Merrimack River for the first time today, went near the Schwinn shop in Haverhill, walking distance from home. When we lived in Gloucester I went fishing for stripers a half dozen times without ever catching a keeper, but this first time out on the river I ended up bringing home a 31-inch fish. I made the catch at around 10 – 10:30 in the morning on the outgoing tide. Before catching the keeper, my father-in-law and I caught a half dozen or so schoolies. We used herring for bait. When I caught the keeper, I was down to the last piece of herring, which was pretty much just a head. My first couple casts caught on bottom debris and by the third cast there wasn’t much left on the hook. After taking the bait, the fish ran pretty much straight downriver, taking line at a rate that made me worry he’d empty the spool. Put up a fantastic fight.

Posted in Fishing | Comments Off on Striper Fishing On The Merrimack

Web Developer Toolbar for IE

I’m currently wrestling with what seems like an age old task at this point; getting a page to look the same in IE and Netscape. I was desperately wishing for an IE equivalent of the Web Developer extension for Firefox. After a bit of Googling my wish was granted. I found a beta version of Microsoft’s own Internet Explorer Developer Toolbar. It’s not quite as polished as the Firefox extension, but hey, it’s only a beta and more importantly, it does what I need it to.

Posted in General | 1 Comment

Remote Car Starter Installation

One thing I’ve really gotten used to on newer cars is keyless entry. My wife and I bought a used ’93 Toyota Previa van a few months ago and this is one of the few items that were missing from the vehicle. The van is Rachel’s vehicle for the most part, so I decided to buy her a remote car starter with keyless entry for Christmas. I’d purchased a car alarm, that included a remote starter and keyless entry, about 10 years ago from Crutchfield, but when I checked out their site, it appeared that they had cut back on their offerings in this category. I ended up buying a unit made by Bulldog that I stumbled across at Wal-Mart.

Before Christmas, I checked out Bulldog’s site and they appeared to have a fair amount of information available and they even had a vehicle-specific wiring diagram for the Previa. They also showed the option of using what they call a T-harness, which just plugs straight into your factory wire harness so you don’t have to go and start splicing wires right off the bat. They don’t seem to mention though if the T-harness includes the plugs needed for the keyless entry connections. All it says is that the T-harness can cut installation time by up to 70%. If it completely eliminated the need to splice wires, it seems like it would say so. If they had more information on exactly what connections are handled by the T-harness I might have been more inclined to get one, but I decided the heck with it, I’ve already hacked into more than my fair share of factory wiring harnesses, so in the end I proceeded without the extra T-harness.

I watched the DVD included with the install kit, which was fairly pointless. I suppose there are people out there that might be trying to install one of these things and they’ve never sliced the insulation off an electrical wire before. All the examples show a guy standing next to a car working with a loose piece of wire that isn’t connected to anything. I think the important thing to show is that to install these things under the dash of most cars, you will be standing on your head while you are slicing into key electrical connections in your vehicle. In my case, I wasn’t too badly off. The Previa sits fairly high off the ground and the space between the dash and floor is sufficient that I didn’t have to assume an inverted position in the driver seat with my feet in the air and my head stuck under the dash. One thing I think I need to pick up for jobs like this is a fluorescent drop light. It’s dark under a dashboard, it’s nearly impossible to hold a flashlight, the piece of wire you’re trying to splice, and wield a utility knife at the same time. Note that I said a fluorescent light, unless you like the smell of burnt carpet and hair.

To be continued …

Posted in Cars, General | Comments Off on Remote Car Starter Installation

Accessing session state in an ASP.NET HttpModule

An ASP.NET project I’m working on requires a password protected area of the application. When I found out about the “Forms” authentication built into ASP.NET I thought I was all set on the authentication part of my project. I soon discovered though, that the server was losing session variables, which were created on login, while the user was still logged in. I decided to remedy this by logging the user out whenever the session variables were lost. The session variables would then be re-established when the user logged back in.

ASP.NET provides the HttpModule interface that allows one to create a class that will be executed on every request to the server. I went ahead and created my HttpModule and added the appropriate entries to my Web.config file. To my dismay, I received the dreaded “object reference not set to an instance of an object” exception message every time I tried to access the session inside my module. After a bit of hair pulling, I finally figured out where I went wrong.

If you want to access session state in your HttpModule be sure to add your EventHandler to the HttpApplication’s “PreRequestHandlerExecute” event, NOT the “BeginRequest” event.

Posted in General | Comments Off on Accessing session state in an ASP.NET HttpModule

Monitoring Performance in the Windows world.

Are all the database connections in this application being closed when they should be? This is a question I asked myself today and it reminded me of a Windows XP feature I learned about in class a few years ago. If you go to Windows’ “Administrative Tools”, which can be accessed through the “Control Panel”, there is an application titled “Performance”. Double-clicking on this application opens a window with a real time graph. If you click on the “+” icon above the graph you’ll get another window with a drop-down that allows you to select from a long list of performance counter categories. I selected the “SQLServer: General Statistics” category and then was given the opportunity to add “Logins/sec”, “Logouts/sec” and “User Connections” to the graph. After selecting “User Connections” I was able to see that the application I was working with was not implicitly closing all database connections that it was opening.

As I mentioned, there is a long list of performance counter categories to select from, including “Web Service” which can be useful if you’re working with IIS. If you’re developing in .NET you can even create your own custom performance counters, for instance you might want to create a “Number of people named Bob that log-in to your website” performance counter.

Posted in General | Comments Off on Monitoring Performance in the Windows world.

Using the Expression Language in your custom tags

JSTL is great for eliminating scriptlets in your JSPs. The standard JSTL tags are designed to be general purpose, applicable and useful in many different applications. But frequently you need to create your own custom tags to meet the needs of your specifc application. To really take advantage of the JSTL you need to make your custom tags work in conjuction with the JSTL. For instance, you may want to use the ‘forEach’ tag provided by the JSTL and have your custom tag nested inside the forEach loop. Inside the loop you want to have your tag interact with the variable that is exposed by the ‘var’ attribute of the forEach tag. You can accomplish this by giving your custom tag the ability to evaluate expressions written in the JSTL’s expression language.

If you are working with JSP 2.0, the expression language is part of the servlet specification and you can find the classes for evaluating expressions in the javax.servlet.jsp.el package.

If you haven’t stepped up to JSP 2.0 yet and you’re working with JSTL 1.0 you can use the org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager class found in the Jakarta taglibs standard.jar file.

Posted in General | Comments Off on Using the Expression Language in your custom tags

Tomcat Administrator Conflict

I recently was working on a J2EE application on Tomcat that contained a sub-folder named “admin”. During most of the development process the application was not being run from the “/” root context. When the application was moved to the root context the “admin” sub-folder conflicted with the “/admin” context that Tomcat comes with by default. No problem, I just directed my browser to the “/manager” context and clicked the “remove” link for the “/admin” context. Conflict resolved. But the next day I turned my development machine back on and the conflict was back, Tomcat had re-deployed the “/admin” context! After a bit of research I found out that the entry for the “/admin” context is generated through a file called “admin.xml” in Tomcat’s webapps directory. To permanently remove the “/admin” context you can just delete the “admin.xml” file. If you want to keep the administration tool you can alter the path attribute of the context element in the admin.xml file. I was able to remove my conflict by changing the path attribute from “/admin” to “/tomcat_admin”.

Posted in General | Comments Off on Tomcat Administrator Conflict

Validating all fields on a form

The following Javascript can be used to verify that a value has been entered in all fields on a form.

function validate(form) {
    var regex = /\w+/;
    for(var i = 0; i < form.length; i++) {
        var curr_el = form.elements[i];
        if(!regex.test(curr_el.value)) {
            alert("Please fill out all fields.");
            curr_el.focus();
            return false;
        }
    }
    return true;			
}
Posted in JavaScript | Comments Off on Validating all fields on a form

Checking for empty form fields

When using JavaScript to validate form input one might be tempted to use:

if(document.form.field.value == '') {
alert("Hey, enter a value");
return false;
}

– or –

if(document.form.field.value.length == 0) {
alert("Hey you, yes you the guy who pressed enter or clicked 'Submit', enter a value");
return false;
}

The problem with these two methods is that they don’t prevent the user from just tapping the spacebar within the field to be validated.
A slightly more sophisticated approach is the following regex, which checks for the presence of alphanumeric characters.

if(document.form.field.value.match(/\w/) == null) {
alert("Please enter something in the field before you hit the submit button again");
return false;
}

Posted in General | Comments Off on Checking for empty form fields

Up and running with WordPress

Well, I’m up and running with WordPress. Credit to my friend and co-worker Yuval for getting me to start this blog. I was going to start hacking away with my rusty Perl skills and put together my own blogging application, but a month has gone by and I’ve only made it as far as a putting together a preliminary database schema. During my lunch break today I decided to take a look at WordPress’ site and couldn’t resist trying it out after seeing the “5-minute” installation instructions. I followed the instructions and BANG, after five minutes I had nothing to show but blank pages. I found several posts in the WordPress forums pertaining to the problem, but I was running out of lunch hour. Tonight, when I got home from work, I prepared to settle in for some hardcore troubleshooting. But, before I got too far into the WordPress source-code I decided to re-download the zip-file and step through the instructions one more time. Second time was the charm!

Posted in General | Comments Off on Up and running with WordPress