lftp rocks!

I’ve known that lftp was a more advanced ftp client than ftp for years. I’ve not used it very often though because I move about platforms so often that I’m never sure whether it will be available. Getting dependent on non-standard features can be frustrating.

I just got an email from my backup service saying that I’ve overflowed my quote. I was just scrabbling about for a way to grab an entire directory listing so that I could analyze the situation when I realised that lftp has a ‘du‘ command built in. How cool is that? 😀

Finding out the public key of a .net assembly

Ever been stuck trying to find the public token to put in your Web.Config? You can use the sn.exe signing tool to display the token. All you then want to do is uppercase the token to be consistent with what Visual Studio would write.

sn -Tp assembly.dll

This will display the public key and the public key token. The token is what you want for the Web.Config. With the token and the version and culture information you can see by looking at the properties of the assembly you have everything you need for the assemblies section.

Finding the developer tools

Tools like sn.exe for signing programs and mt for including manifests always seem to be tucked away in awkward places that take a while to find. Here’s a simple batch file for finding them on an english box installed in a fairly standard way. It checks for the Windows SDK then looks for Visual Studio. That way it normally finds what you are trying to run.

I find this particularly useful because it means that I can use regular machines to build my program without having Visual Studio installed. That way I can have backup machines and a build server without needing lots of copies of Visual Studio. The SDK is fairly heavy weight but it seems more appropriate on some machines.

@echo off
set PROGDIR=%ProgramFiles%\Microsoft SDKs\Windows\v6.0\Bin
IF EXIST "%PROGDIR%" goto :build
set PROGDIR=%ProgramFiles%\Microsoft Visual Studio 8\SDK\v2.0\bin
set PROG=shift
"%PROGDIR%\%1" %2 %3 %4 %5 %6 %7 %8 %9

Figuring out what’s listening

A trick I learned a long time ago for linux and other *nix systems is to use fuser to check what’s listening. It’s actually a more generic file based command but most versions also allow you to check out sockets too. The standard syntax is fuser -v 81/tcp. That will display a list of the processes listening to the port.

It’s actually a part of the lsof list of open files functionality generally useful on *nix.