Capturing Music Streams

Is there a way that I can save down the music I’m listening too from an Internet stream?

If you use WinAmp, you can use a tool called Streamripper that will save the music down even when you’re not listening.

I do this when I know I’m going to be traveling. I’ll start this up the night before and stream some music to disk and transfer it to my iPod.

Once I’ve listened to the stream, I usually just delete the music to make room for more, random music.

Enjoy.

Creating a CD/DVD from an ISO File

I want to create a CD / DVD from an ISO image file but the burning software that came with my computer (e.g. Roxio, etc.) doesn’t do it unless I "upgrade" and pay money to do it. How can I burn these ISO files for free?

Download the Microsoft Windows Server 2003 Resource Kit Tools and run the command line tool CDBURN.EXE or DVDBURN.exe.

You’ll need to make the files are in your file path.

Creating ISO Files From CDs and DVDs

I want to create an ISO image file from my CD or DVD but the burning software that came with my computer (e.g. Roxio, etc.) doesn’t do it unless I "upgrade" and pay money to do it. How can I do this without upgrading?

There is a wonderful shell extension for XP and Vista created by Alex Feinman. You can find the application here:

http://isorecorder.alexfeinman.com/isorecorder.htm

Just download the version for you computer, install it, put a CD or DVD in the drive, right click the drive and choose "Create image from CD". He has instructions here.

You can also right click on an ISO image and write it to a CD/DVD. It can’t get any easier (and cheaper . . . it’s free) than this.

Oh, and don’t forget to donate some cash. This is a slick tool and he deserves a few bucks. I donated a few.

Snooping in .NET Libraries

How do I view the source code for some .NET libraries that I have but I don’t have the source code?

I’ve recently started a new job with a software development company that has a substantial amount of source code and a huge class library. I’m trying to get my arms around it and I’ve found that loading the hundreds of projects in Visual Studio can be very time consuming.

So, I downloaded Lutz Roeder’s .NET Reflector. It is a wonderful tool for the browsing into .NET libraries and you don’t need the source code to do it.

Here’s a screen shot:image

This program will let you click around in the disassembled code and on the various types. You can learn a class library quickly by exploring like this. You get a good peek "under the hood" so you can have a good feeling for how things are put together.

Keep in mind though that the disassembled code may have some name mangling. That’s OK. If you have the real source code, you can open the project and then take a look. I think using this tool is much quicker than using VisualStudio to find things sometimes.

There’s no substitute for knowing exactly what a class library does because you’ve seen the code first hand. Download this utility and give it a whirl.

Let me know what you think.

FileBots — Quick, File Processing Tools

FileBots transform files quickly, on-the-fly from the comfort of your very own Windows Explorer.

Occasionally, I’ll need to transform text files that I’m working. This will usually happen when I’m porting over old, ASP-based applications to ASP.NET or converting from VB.NET to C#—that sort of thing.

Recently, I was converting over an old site that had HTML in all uppercase. This used to be the standard. But, as you know, XHTML requires everything to be in lower case.

To solve the problem, I really didn’t need anything fancy. I wasn’t trying to create anything perfect. No need to employ DOMs or YACC and such. I just wanted to crank out something real quick that would convert the majority of the HTML as I needed it. There’s probably even a plugin to VS for this but I didn’t look. If you find one, let me know. VS doesn’t do this for me that I could find.

So, to make my life easier with as little effort as possible, I created a console app (.EXE) that takes the first argument as the name of the file. In the console application, I just load the file, do the processing and then save the file with a ".actionTaken" extension. Done! I call these little applications FileBots.

Let’s look at at a FileBot a little closer. Here’s the Main() routine from a recent FileBot that I created that lowercases the elements and attributes in an HTML file:

static void Main(string[] args)
{
    if (args.Length == 1)
    {
        File.WriteAllText(args[0] + ".lower", LowerCaseHtml(LowerCaseAttributes(File.ReadAllText(args[0]))));
        Process np = new Process();
        np.EnableRaisingEvents = false;
        np.StartInfo.Arguments = args[0] + ".lower";
        np.StartInfo.FileName = "notepad.exe";
        np.Start();
        np.Close();

    }
    else
    {
        Console.WriteLine("Usage:");
        Console.WriteLine("");
        Console.WriteLine(" ConvertUpperHTMLToLowerHTML.exe filename");
        Console.WriteLine("");
        Console.WriteLine("Outputs filename.lower");
    }
}

Example 1: C# Main for a FileBot

Pretty straight forward, yes?

"Yeah, but you just created a console application! How is that going to make things easier for me?" you might say. Well, here’s the sweet part about Windows. Drop this .EXE in to your SendTo folder located here:

C:\Documents and Settings\LoginName\SendTo

Now, when you right-click on a file, you’ll see that the .EXE shows up in the Send To menu as a valid option. When you choose the program from the menu, the Windows explorer executes the application with– you guessed it–the file name as the first argument!

In the example above, you’ll notice that in just one line of code, I read the file, process it and write it back down. I don’t even bother with error handling. No need.

In the code that follows, I start notepad.exe and pass the output filename to it. You don’t have to open the file in notepad. You can do whatever you want including not doing anything.

This is really useful I think. Take it one step further. You can select the previous output filename and then send it to another FileBot until you get the final results you’re looking for. This is similar to the UNIX and MS-DOS pipe without having to go to a command console and chain them together.

The key is, when developing, don’t try to over engineer your scaffolding code. Be smart. Use the OS and the development environments to help you move quickly. And, I sure as heck had a lot more fun creating the above than searching and replacing HTML in hundreds of files. Take a second every now and then to add a tool to your chest. It pays off in the long run.

Now, go make some FileBots!

Update All Fields in Word Documents

Automatically update every field element (e.G., Table of Contents, Document Fields, Computed fields, etc.) in a Microsoft Word Document in one motion.

In the business analysis, tech-lead part of my job, I tend to create Word documents that can be used in a "template" way. For example, if I have revision numbers, dates, company names, document titles, etc., I’ll create document fields and place them in the document instead of the actual value. This way, if I want to recycle the document for a different situation, I only need to modify a few key fields and update the document.

However, Word doesn’t give you a way to update all the fields at once. You have to highlight the entire document and then update the various components separately. This includes visiting each set of headers and footers if you happened to use a field like a document title in them.

So, to make life easier for me, I created this little macro that will visit everything in the document and update it. Here’s the source code:

Sub UpdateAllFields()
Dim oStory As Range
Dim oField As Field
  For Each oStory In ActiveDocument.StoryRanges
    For Each oField In oStory.Fields
      oField.Update
    Next oField
  Next oStory
End Sub

Just copy this snippet into your base, Normal.dot. Then, tie the macro to a button on a command bar and you have a one click "Update All" widget!

The next time you want to change something about a document, all you have to do is choose "File Properties", change the field on the custom tab, return to the document and click your snazzy "Update All" button. Presto, new document with different titles, customer names and numbers! With this macro, you’ll be cranking out documents faster than anyone . . .