Finding Browser Window Height

Here is a nice script, part of a larger section on getting window size/positions and scroll data out of various browsers.  This page really has a lot of good information.

function alertSize() {
    var myWidth = 0, myHeight = 0;
    if( typeof( window.innerWidth ) == 'number' ) {
        //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
    } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
        //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
    } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
    }
    window.alert( 'Width = ' + myWidth );
    window.alert( 'Height = ' + myHeight );
}
Advertisements

Resetting Domain Admin Passwords

I have been researching ways to reset a domain admin password for a client who forgot what they typed in when they set the password.

Most password crackers work only on local accounts, not for anything on a domain.  It seems like the way to go about this is to reset the local admin account, then login using Directory Service Recovery Mode to reset the domain admin account.

Here are some of the articles I have been reading:

http://www.jms1.net/nt-unlock.shtml  <– this idiot won’t let you view his pages if you are running IE, so use firebox, but again, that’s just stupid

http://www.nobodix.org/seb/win2003_adminpass.html

http://home.eunet.no/~pnordahl/ntpasswd/

http://www.loginrecovery.com/about.html

http://www.petri.co.il/reset_domain_admin_password_in_windows_server_2003_ad.htm

 

University of Chicago Academic Calendar

I find myself frequently trying to find the dates on this calendar, and I can never find any links to this site.

http://academic-calendar.uchicago.edu/future/index.html

It has all the dates of academic interest (days off, starting and ending days of each quater).

This quater I am planning on taking Bioinformatics.

I saw a presentation on Bioinformatics at Fermi Lab.  They have searching programs to look at, I believe, the genome sequence, to find similar patterns.  Pretty interesting.

Hopefully the course will be good too!

Using window.onload without overwriting existing onload event handlers

When you are creating reusable javascript files, there are times when you want to tap into the window.onload event, which is fired when the window has finished loading the content.

The problem here, is that you can’t have multiple event handlers for the same event.

So if you have a page that uses 2 scripts which both use the window.onload event, then which ever is loaded last will win, and the other script will never catch the event.

Well one way you can deal with this problem is to write your window.onload (or other events for that matter) using this type of a pattern:

    //-- see if there is already something on the onload
    var tempFunc = window.onload;
    //-- create our event handler
    window.onload = function(){
        //-- if tempFunc is a function, try to call it
        if (typeof (tempFunc) == "function"){
            try{
                tempFunc();
            } catch(e){} //--- if it errors, don't let it crash our script
        }
     //-- Call your onload function here
    }

This way, you can have several function that all utilize the onload event, and none of them have to know about each other.

 

Getting Real

Here is the online version (free) of 37Signals.com book on development: Getting Real.

I think they have basically an agile approach to not only software development but business as well.

Like almost all development methodologies, I think some of their ideas are pretty valid, unless they aren’t.

For example, some of the things I hear a lot from the sort of XP / Agile development styles are things like:

 “Get your app out as soon as possible, even if it isn’t fully debugged or fully complete.  Let your users tell you what features need to be added, rather than spending the time guessing what they want”

and

“2 rules of performance optimization. 1) Don’t.  2) Not yet!”

 

1) If you get your app out, and you start spending you time getting people to use it, and it sucks, then you have actively made people who had no opinion of your product now have a negative opinion.  If you fix the bugs and add features later, they will just remember that they tried it, and it sucked.

2) You can always add performance optimization later, except what about when need to rewrite 2 months of work because you were too lazy to spend an extra 4 hours during the design phase to build in some ability to scale?