Houdini ID3 Tagger Released

Mon, 29 Sep 2008 23:05:44 GMT

Here's the first in a batch of new software I'm going to be releasing over the winter.  I'm also working on new versions of Server Pinger, the MySpace API, and some other new tools.  Give this one a shot, it still has a while to go, but it already has some useful applications.

I use it for clearing out comments from my music collection's tags and generally fixing all the ID3 tags to a standard.  Especially with Apple's Genius feature, it's important to keep your music organised.

Check out the main page for it here:  www.dojotech.com/Topics/Software/Houdini_ID3_Tagger/

  • Comments (0)
  • Pingbacks (0)


URL Rewriting in ASP.Net Without Extensions

Sat, 20 Sep 2008 21:13:56 GMT

Ever since I started looking into URL rewriting, people have had problems with getting it to work without extensions.  Some solutions require setting IIS up differently or creating additional HTTP Handlers.  The solution I propose isn't a "true" extensionless rewrite, but a bit of a hack that will give the impression of extensionless URLs.

Basically, you need to start with a URL rewrite engine.  You can easily build your own using Application events and built-in Http methods in C#, but I used Microsoft's URL rewriter MSDN example.

URL Rewriting in ASP.NET

Get that example setup and working for your site first.  You may also want to create a Form.browser file in the App_Browsers folder to fix the postback problem that occurs.  You can read more about that here on Jesse Ezell's blog.

OK, so you're up and running with the URL rewrite engine, but your links are still all pointing to something.aspx.  The problem is that without the .aspx extension, the aspnet_isapi.dll filter won't know that it should be handling the request.

The fix basically uses the default document feature in IIS to convince the ASP.Net ISAPI filter to handle the request.  Any folder that has a default.aspx page in it can be referenced simply by the folder url and IIS will pick up on the default document (default.aspx) and process the request.

So, the idea is that you are creating folders on the fly as links are created and putting a blank default.aspx file in the new folder.  The URL for that new folder doesn't have to include the default.aspx page at all.  Instead of a link like http://www.dojotech.com/Blogs/Sean/default.aspx, you simply point to http://www.dojotech.com/Blogs/Sean and IIS handles it the same way.

The bogus default.aspx doesn't event have to be a real page, it can be completely blank.  I use a little function as new links are created called MakeSlugFile.  This does the job of creating the new folder and creating a default.aspx placeholder.

    public static string MakeSlugFile(object slug)
    {
        string sskug = slug.ToString();       
        string slugPath = HttpContext.Current.Server.MapPath(sskug);       
        if (!Directory.Exists(slugPath))
        {
            Directory.CreateDirectory(slugPath);
            File.Create(slugPath + "\\Default.aspx");
        }
        else
        {
            if (!File.Exists(slugPath + "\\Default.aspx"))
                File.Create(slugPath + "\\Default.aspx");
        }

        return sskug;       
    }

Like I said, it's a hack, but it works fairly easily and you don't need to muck about with IIS.

 

  • Comments (0)
  • Pingbacks (0)


Optimised Directory Scanning in C#

Sat, 20 Sep 2008 21:13:56 GMT

I'm working on a new application to manage ID3 tags in my huge MP3 database.  Besides the actual ID3 editing, I need to make sure the scanner runs as fast as possible.  I'm testing some methods below and I'll post results later!

static public string[] GetAllFileNames(string baseDir)
    {
        // Store results in the file results list.
        List<string> fileResults = new List<string>();

        // Store a stack of our directories.
        Stack<string> directoryStack = new Stack<string>();
        directoryStack.Push(baseDir);

        // While there are directories to process and we don't have too many results
        while (directoryStack.Count > 0 && fileResults.Count < 1000)
        {
            string currentDir = directoryStack.Pop();

            // Add all files at this directory.
            foreach (string fileName in Directory.GetFiles(currentDir, "*.*"))
            {
                fileResults.Add(fileName);
            }

            // Add all directories at this directory.
            foreach (string directoryName in Directory.GetDirectories(currentDir))
            {
                directoryStack.Push(directoryName);
            }
        }
        return fileResults.ToArray();
    }

  • Comments (0)
  • Pingbacks (0)


.Net MySpace API v1.0

Sat, 20 Sep 2008 21:13:23 GMT

I've just finished work on the beginnings of a new MySpace API for .Net.  I'm writing it in C# and accomplishing most of the work via a state machine and web browser automation.  The only thing it does right now is post new blog messages.  I plan on using it to allow interBlog (from the interquire interWeb Web 2.0 suite) to sync a user's posts with their MySpace account.

If there's much interest in a full-blown API, I'll develop it further.

Download the interquire.MySpace.dll version 1.0 here

To use the API in your code:

Blog b = new Blog(txtEmail.Text, txtPassword.Text);
b.NewPost(txtSubject.Text, txtBlogText.Text);

if (b.error)
    MessageBox.Show(b.errorText);

  • Comments (5)
  • Pingbacks (2)