Iomega ix-200: Monitoring RAID resyncing status

When the Dashboard webapp is showing ‘verifying data protection configuration’ you can get a more detailed status from the box if you ssh into and ‘cat /proc/mdstat’ – you’ll see something like this:

Personalities : [linear] [raid0] [raid1] [raid6] [raid5] [raid4]
md1 : active raid1 sda2[0] sdb2[1]
974722192 blocks super 1.0 [2/2] [UU]
[====>…………….] resync = 21.3% (208528384/974722192) finish=340.8min speed=37457K/sec

md0 : active raid1 sda1[0] sdb1[1]
2040128 blocks [2/2] [UU]

unused devices: <none>

Coding around lack of trim() in IE’s Javascript support

IE8 doesn’t support trim() on Strings (Firefox and other browsers do). To workaround this, you can perform the same operation using some regex on a String:

example.replace(/^s+|s+$/g, '')

… this matches one or more spaces anchored at the start of the line, or one or more spaces anchored at the end of the line, replaces with ”, and then globally replaces to do both.

Extracting cookies using Javascript

Cookies in the current page can be extract using Javascript using ‘document.cookies’ which returns a ‘;’ separated String of all the current cookie values.

You can parse the values with some script like this:

function getCookie(name) {
    var result = '';
    var cookies = document.cookie.split(';');
    for ( var i = 0; i < cookies.length; i++) {
        //alert(cookies[i]);
        var cookie = cookies[i].split('=');
        if (cookie[0].replace(/^s+|s+$/g, '') == name)
            result = cookie[1];
    }
    return result;
}

Fixing Twitter Bootstrap rendering issues in Internet Explorer

Internet Explorer’s interpretation of CSS compared with all the other browsers sometimes bewilders me. To get Twitter Bootstrap to render at all like the other browsers, apparently it’s important that you have to specify the doctype, otherwise it seems to render layout related CSS all over the place. Just include this at the top of your source:

<!DOCTYPE HTML>

I found this as an answer to this post on StackOverflow.