dans.blog


The miscellaneous ramblings and thoughts of Dan G. Switzer, II

Dynamic Template Plug-in for Windows Live Writer

I've been using Windows Live Writer for posting all my blogs. Overall it's a terrific program. It's got a very simple, easy to use interface and it drastically eases the process of blogging.

However, the one complaint I've had with the program is there's no easy way to "add" common HTML tags that you commonly use to the interface. I use the <samp> tag quite frequently when showing inline sample code and for variable names (although I suppose I should use the <var> tag instead.) To use these tags I've had to drop to the HTML Code view and manually add the tags. This is a pain to do—especially on longer posts where I need to add the tag frequently.

To solve my dilemma, I've been periodically searching for a Live Writer Plug-in that might allow me to add some custom HTML snippets. Well today I just happened to stumble on a great little plug-in called Dynamic Template Plugin for Windows Live Writer.

You can use this plug-in for doing something as inserting static text or for modifying the selected text. The real power comes from the fact that the plug-in allows you to use C# code snippets. You can even have the template prompt you for input.

To get you started, here are a couple of templates I just wrote to help me out with a few tasks:

more…


My poor Nik-Niks...

[UPDATED: Friday, February 15, 2008 at 9:24:01 AM]

My black Lab, Nikki, has been suffering from rear knee problems since she was about 18 months old (she just turned 4 last month.) She's ruptured the canine cruciate ligaments in both her hind leg. That's like us having torn ACLs in both knees. While she's had the problems for a while, she normally gets by without too much problem—most people would have no clue she had problems with both her rear legs. For the most part, we had been able to manage the nikki.operationdiscomfort using Deramaxx (which is a joint supplement.)

Last Thursday I noticed she was having a bad day, I could tell her knees were bothering her because she was limping and trying to avoid putting weight on them. She just progressively started getting worse over the weekend. She was barely moving and was no where near her normal energetic self.

On Sunday my wife noticed she was also not putting weight on her front left leg—which she was also having uncontrollable spasms that lasted for over 24 hours (massaging the leg would give temporary relief.)

On Monday morning I took her to the vet to see what we could do to relief her of the pain a little and to get a diagnoses on the front leg. The vet determined she either has a muscle or ligament injury that's either a sprain or a strain (without an MRI it would be impossible to know.) The vet also felt that Nikki has probably ruptured her MCL as well as her CaCL.

We've known that the knee problems would degenerate over time, but we were hoping it wouldn't get this bad. No one wants to see their dog in constant pain. It was quite clear to us that Nikki needed surgery if she was to have any type of quality of life.

more…


The nightmares of getting images from the Mac OS X clipboard using Java

One thing I rarely ever do in Java is program anything that requires a desktop UI. If I'm doing any Java programming, it's generally server-side related. Recently that changed when I began working on a Java applet that allows users to upload images (screenshots) in their clipboards directly to the server.

Building the basic applet was pretty straightforward. Even signing the applet (so you can actually query the operating systems clipboard) is pretty straightforward—made even easier once I created an ANT build script.

The applet was progressing nicely, well that's until I tested things on the Mac.

more…


jQuery fadeToggle() plug-in

Karl Swedberg posted this 3 line nugget to the jQuery mailing list this morning and I thought it was worth of blogging. It uses a technique I was previously unaware and that's the animate() method allows for toggling of opacity. This might be a commonly known feature, but I rarely use the animate() method directly—which is probably why I wasn't aware of the feature.

Anyway, here's Karl's code:

jQuery.fn.fadeToggle = function(speed, easing, callback) {
    return this.animate({opacity: 'toggle'}, speed, easing, callback);
};

This creates a simple jQuery plug-in that you can now use like:

// attach the onclick event to each anchor tag with a class of "div-toggle"
$("a.div-toggle").click(function () {
    // fade-in/out the element with the id of "my-div"
    $("#my-div").fadeToggle();
    // return false to prevent the anchor tag from following the href rule
    return false;
});

You can also pass in arguments to control the speed, easing effect or the callback to run after the fading is complete. If you want to use the callback argument without using the speed or easing arguments, just pass those arguments a value of null.


SVN post-commit for Windows

As I mentioned early I've been working on a SVN post-commit script. We've got a SVN repository that will be modified by several remote developers and I really need to keep an eye on this repository and I need to closely monitor changes to this repository.

There are two major functions that I needed in my post-commit script:

  1. I needed to update the working copy on my server
  2. I needed to e-mail the changes to myself, so I know when developers are making changes

There are an abundant of examples showing off how to do this in various *nix flavors, but I couldn't find any good Windows-based solutions that didn't require Perl to be installed on the server. That led me to create the following post-commit.bat script.

more…


SendEmail is a great little SMTP Windows command line tool

I've been working on a Subversion post-commit hook that will send me an e-mail when a user checks in some code to a repository. In order to send an e-mail from the post-commit script I needed a command line tool that would let me send an SMTP message from my batch file.

Fortunately for me, I stumbled upon SendEmail by Brandon Zehm.

This program is chock-full of features and is the perfect companion for Subversion for Windows installations. I can also see this being an extremely useful general debugging tool as it as you can create some really complex e-mail scripts.

SendEmail is actually a Perl program but has been compiled into a native Windows executable. You can download the Windows executable in two flavors—with or without TLS support.


Debugging Subversion Repository Hooks in Windows

I've been working on a post-commit hook for our Subversion install and was running in to a number of issues. The post-commit.bat file would run fine from command line, but I just could get things to work as I expected from SVN. After much debugging and scouring Google for answers, I've found a few tips that will hopefully help you to troubleshoot your own SVN repository hooks.

1) Subversion executes all hook programs with an empty environment

This was the biggest issue I was running in to, because I was expecting the my script to be able to find any programs in my %PATH% statement. That's the main reason my scripts were working fine from command line, but were breaking when executing from my SVN hook.

more…


Microsoft proposes to buy Yahoo! for $44.6 billion...

There are always tons of rumors about Microsoft buying Company X, but it looks like Microsoft is officially wanting to acquire Yahoo! They've been really trying to build some market share with their Live initiative and it looks like they're really serious about becoming a major portal player.

Quite frankly, it doesn't surprise me that Yahoo! was looking at selling. Most companies to some "spring cleaning" by trim staff before being acquired. I saw it happen when I worked for Midwest Micro and I've seen it happen at just about every other large company I've witness sell their business.