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...)
#accidental scientist
This entry was posted under Meta. Bookmark the permalink.

Stupid Human Tricks Part 1: Measure Your Own White Blood Cell Count

Over the years, I’ve come up with a few little sneaky tricks that others might have missed. It’s amazing what you can figure out if you keep an eye out for things that are interesting, (or weird) and then spend a moment trying to figure it out.

You can easily measure your immune system activity by looking up at a nice blue sky. Actually to be honest, any flat area of color – even a white wall – will do if you look closely enough. (more...)

#Health, #stupid human tricks, #blue-field entoptic phenomenon, #white blood cells, #retina, #sky
This entry was posted under Science. Bookmark the permalink.

An Anatomy of a Four Day Trip to Hell… and Back Again

Our story begins on Wednesday the 4th of May. Actually, I’m not sure when it really begins… incubation periods are tricky things.

That night, my thirteen month old daughter Alexandra – Lexi for short – fell asleep surprisingly quickly. She drank her bottle, and went to sleep in my arms before she finished drinking it.

This is a little weird. I’m not used to her going to sleep that easily these days. When she was a young baby, sure. Now? Not so much.

Still, at this point, I’m willing to take whatever sleep I can get. She’s teething, getting her bicuspids in. For a while, she tricked us into thinking that we could start getting eight hours of uninterrupted sleep at a time again – you know, like before she was born. Sadly, no such luck. My little bunny had faked us out, and had spent the last week or so waking up around 2am and screaming until we carted her into bed with us.

Not that we mind, mind you. We actually like sleeping with the bunny in bed with us – it’s comforting to wake up every 30 minutes or so and know that the little lady kicking us in the ribs, or lying stretched out horizontally across the bed is .. you know… alive.

For those of you who don’t have children, apparently the BIOS update your brain gets when they’re born comes with a built in timer. For the first nine months after they’re born, a little alarm goes off once an hour which tells you “Oh shit, they might have forgotten how to breathe", and off you plod into the other room to check that your baby is still a) alive, and b) hasn’t figured out how to get out of her crib like a scene from The Great Escape. (The “forgotten how to breathe” thing isn’t quite as silly as it may sound, given that when they first pop out, both of their eyes don’t even point in the same direction).

Not that it’s a particularly useful instinct. After all, let’s face it… checking once an hour isn’t exactly going to help much if your baby has forgotten how to breathe, unless they do so right before you walk into the room. But mother nature appears to have equipped us with all kinds of weird instincts like this. It’s very odd.

So we let Lexi sleep with us. She did every night for the first three months of her life, and most nights after that, to be honest. It’s more comforting – both for us and for her. Although it’s getting a bit long in the tooth now, because she hogs the bed.

So with a little annoyance (at her waking me up at 2am), and a little trepidation (because I function really poorly without sleep), I scooped up the bunny who was wailing out a storm, and plopped her down in bed between us. Wrapped her up in my arms. Done deal.

Around 3-4am, I woke up feeling really incredibly warm. Lexi was really warm. I was warm too. I kicked the duvet covers off, thinking “Damnit, I bet someone turned up the heat again”.

… and that was all I thought about it. In retrospect, I’m left wondering if this was one of the first signs of what was to come. That, or her falling asleep ultra rapidly the night before. Or maybe it was me driving home the night before, looking up at the blue sky and noticing that my white blood cell count was higher than normal* and thinking “Oh damnit, I have a conference to organize. I hope I don’t get sick”. Or getting a tiny blip of migraine aura fortressing the week before – I’ve not gotten regular migraines since I was a kid; the last one was 6 years ago accompanied by an immediate sense of impending doom, fortressing and everything going black & white for a second.

What was to come, you might ask?

That’s a subject for the next post. For now, let’s just say if you were really in a hurry, and you were meningococcal bacteria, and you just didn’t have time to stick around and cause meningitis, you might go for the all out nuclear option known as meningococcal septicemia.

And that’s what my daughter came down with, some time between Wednesday night and Thursday afternoon.

More to come. This is where it gets fun.

Spoilers: (select between the arrows to see… don’t do it if you want to experience this as it all played out for us) > this story so far has a very happy ending. I’m writing this from Lexi’s room on the General floor of Seattle Children’s Hospital. She’s doing fine. Stable. Sitting up. Ate some Jello. She’d good <

*I’ll post more on how to take a relative measure of your own white-blood cell count with no needles later. I’ve been meaning to write something about “stupid human tricks” I’ve figured out along the way.

(more...)
#Health, #family, #lexi, #darci
Bookmark the permalink.

Happy Mother’s Day

This is a little bit of a love letter to Darci. I hope you’ll indulge me for a second for doing this in public, but there were no Mother’s Day cards in the store that quite fit the “you’re so awesome and your quick thinking and instincts saved our daughter’s life” vein. Not even the ones that play music.

Darci,
You’re freaking awesome, momma bear (to steal one of Nichole’s phrases).

I’m truly blessed to have such an amazing woman in my life. Not only smart enough to rip my arguments to shreds in areas you’ve never even studied (like theoretical physics), but strong enough to handle two days of wondering whether or not your baby daughter was going to survive without turning into a gibbering wreck.

You truly are fantastic, and amazing, and the best mother I could imagine for my child. You are awesome. Smile

I love you sweetie.

223205_10150170044250283_595500282_7237032_1227998_n[1]

… and Alexandra owes her life to your quick thinking.

(more...)
#family, #lexi, #darci, #meningococcal septicaemia, #mother's day, #best present ever
This entry was posted under Me. Bookmark the permalink.

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...)

subscribe via RSS