Posts in the Meta category

Leaving Quora

Quora recently changed the site in some heinous ways. They removed the details from all questions, because they're trying to make sure that there's only one "canonical question" you can search for an answer to.

Quora Logo

Unfortunately this destroys nuance - after all, there's only so much detail you can put into 250 characters.

So in response, I'm going to start migrating all of my question answers on Quora to my blog. It's going to take a while, but hey, more content for the blog.

(more...)

Site Theme Changing - Please Ignore Any Bad Visuals :)

Changing the site theme... This may take a minute to work out the bugs, so please ignore any issues you may see. Working on it!

If I don't get it done soon, I may temporarily move back to the old theme :)

Update!

All done! Well, there's some tweaking that still needs to happen, but the site theme is all in and done and dusted. (I've never written a Wordpress theme before, and while this is still a hacked up version of the twentyten theme, it's quite quite different at this point. Salut! :)

(more...)

On hold right now...

The blog is kind of on hold right now ... too much work, too little time. I'll be back soon as soon as things are a little less insane. :)

(more...)

Fixing Byte-Order-Mark issues with Wordpress on IIS

One common problem – it seems – with Wordpress just plain acting funky on IIS is that occasionally, byte-order-marks get inserted into the UTF-8 PHP documents that make up the Wordpress code.

Sometimes these come in as part of templates and plugins, other times they just magically* appear.

If you’ve got Visual C# (or Visual C# express), here’s a little nugget of code you can use to strip them out. No warranties. No expressed suitability for a given purpose. Just free code I wrote. Free, crappy, one-off, single-purpose code. But it works. Compile it up, and run it, and watch it go.

I recommend running it in two passes:

  • Generate a list of files to check using DIR /S *.* /B /A-D > out.cmd
  • Modify that list to call BOMFix on each file (e.g. BOMFix c:\myfile\app.php ). Make a note of which files have a BOM mark
  • Run it again, with /F as the second argument (e.g. BOMFix c:\myfile\app.php /F ). This will strip the BOM from the files.
  • Throw your files back up onto the server.

And for your viewing pleasure, here’s the code:

using System;
using System.IO;

namespace BOMFix
{
    class Program
    {
        static void Main( string[] args )
        {
            if ( args.Length == 0 )
                return;

            bool bHasBom = FileHasBOM( args[ 0 ] );

            if ( bHasBom )
            {
                Console.Out.WriteLine( "{0} has a BOM", args[ 0 ] );
                if ( args.Length == 2 && (args[1] == "/F" || 
                     args[1] == "/f") )
                {
                   StripBOM( args[0] );
                   Console.Out.WriteLine( "Removed BOM from {0}",
                                           args[ 0 ] );
                }
            }
        }

        const long READSIZE = 8192;

        public static bool FileHasBOM( string path )
        {
            FileStream s = new FileStream( path, FileMode.Open,
                                FileAccess.Read, FileShare.Read );
            long fileLen = s.Length;
            if ( fileLen < 3 )
                return false;

            byte[] file = new byte[ 3 ];
            s.Read( file, 0, 3 );
            s.Close();


            return ( file[ 0 ] == 0xEF && file[ 1 ] == 0xBB &&
                     file[ 2 ] == 0xBF );
        }

        public static void StripBOM( string path )
        {
            FileStream s = new FileStream( path, FileMode.Open,
                               FileAccess.Read, FileShare.Read );
            s.Seek( 3, SeekOrigin.Begin );
            long readleft = s.Length - s.Position;
            byte[] buffer = new byte[ READSIZE ];

            string tempFileName = Path.GetTempFileName();
            FileStream outStream = new FileStream( tempFileName,
                FileMode.Truncate, FileAccess.Write, FileShare.None,
                8192, FileOptions.SequentialScan );
            
            while ( readleft > 0 )
            {
                int chunkSize = (int)Math.Min( READSIZE, readleft );
                if ( s.Read( buffer, 0, chunkSize ) != chunkSize )
                {
                    throw new Exception( "Not enough data! File error?" );
                }

                outStream.Write( buffer, 0, chunkSize );

                readleft -= chunkSize;
            }

            outStream.Flush();
            outStream.Close();

            s.Close();

            File.Replace( tempFileName, path, null );
        }
    }
}

*Yes, I know, not actually magically… but no-one seems to have root-caused it.

(more...)

The Blog Moves (Again)

Well, finally, I think I've got this up and running again. Of course, to do it, I had to move to arvixe.com for my hosting (away from GoDaddy, whose inability to properly host multiple sites on IIS means that it's time to say GoodByeDaddy).

Now that the blog's working again, I need to do a bit of work to get the style back to something I like... and then... hopefully it'll all be nice and tickety-boo.

(I can't believe I just said "tickety-boo").

Anyway, a few other changes:

  • My lovely significant other - Darci Morales - has her own blog at justdarci.com now. Hopefully she'll post something on it, or I'll need to end up turning it into a resume/portfolio site or something. She is available for consulting work btw ;-)
  • My homepage is finally moving from earthlink.net, where its been sitting since about 1998 when I moved to Seattle. (Before that it was on a variety of other sites, and it's one of the oldest continuously running pages on the web; the first version went up in 1993 IIRC). It'll save me money ($21.95 for 10Mb of hosting, plus dialup access per month. Woooooh! 1998 prices are awesome. I'm not sure I can imagine anything having an 10Mb!!! quota any more but now you know... And Arvixe has theoretically unlimited space). Anyway, it's now up on http://simoncooke.com
  • Finally, the bastard who has been sitting on the simoncooke.com domain name let it go. :) ThankyouverymuchI'llhavethat.

More sites, more stuff to follow. But with a bit of luck I might actually be able to get everything up and running this time - without fighting web hosting issues.

I still have paid up until December 2012 for my GoDaddy hosting though. Wonder what I should put there.

Anyway... the Blog is Back! Hello again! It's been too long!

(more...)