Wednesday, March 16, 2011

Killing IE6

I am just done watching episode 94 of Ping on channel 9 and heard that Microsoft is doing all it can to make IE6 lose its market share (loved the catchphrase – “friends don't let friends use IE6”), Its a fairly belated attempt seeing as companies like Google have already joined the armada of companies that do not support IE6. To web developers, this is definitely a great thing and means that we will decreasingly stop creating cascading style sheets that is specifically meant to run on IE6 and below and endless hours of javascript debugging.
This means no more png alpha transparency fixes, no more....

.box {
   background: #00f; /* all browsers including Mac IE */
   *background: #f00; /* IE 7 and below */
   _background/**/: #0f0; /* IE 5.0 */
   _background:/**/ #f62; /* IE 5.5 only */
   _background/**/:/**/ #f61; /* IE 6 only */
   padding: 7px;
   color: #fff;
}
nonsense in CSS!! Welcome to the beginning of a standardized Internet!! –DO I HAVE A WITNESS?

On the flipside (for Microsoft), using the latest stats, it seems the loss of IE6 market share does not translate to the gain in market share of IE7+ browsers as Google Chrome appears to be growing almost at the rate IE is losing ground. (At this point I drop my well thought of pun of the week and the only reason I wrote this post!!)
Microsoft – be careful what you wish for because it may just CHROME true.

P.S there is a website out there that does real time countdown of IE6 Market share its called IE6Countdown that complements a bunch of websites that want IE6 dead they are I Dropped IE6 , IE6 Update and IE6 No more

Tuesday, March 15, 2011

Preventing Lazy and comment-less source code checking in subversion

I come from a background of using Visual Source safe as a tool for source control and had never really needed to setup a source control infrastructure prior to my assignment in Pakistan. So when I landed the job, I quickly downloaded and installed the Collabnet build of subversion. Then decided that like any software development team worth its salt, I would have to create software coding practices and procedures and one of which was the use of source control and thus formulated rules around checking in source code such as No check ins without comments, All comments must make sense blah blah blah. Later during my analysis of the check ins I realised that my team members were going against rules and were checking in code without comments or just lazy comments like “fixed” or “done” or “checked in” at which point I came to a crossroad – do I lay down the law at them for doing this or do I find an automated way of resolving this matter and I decided the later had a more long lasting effect – plus it stretched us, which is good. So I did my research and discovered that it was not direct provided (not a config change) but was possible by using hooks.
I created a file that had a bunch of excluded words as mentioned above saved it in c:\svn\excludedwords.txt and then created a pre-commit batch file that was supposed to be run prior to committing the change(duh!). The exact filename was Pre-commit.bat that was placed in the Hooks folder on SVN
The contents of the batch file were
rem Make sure that the log message contains some text.
set REPOS=%1
set TXN=%2

"C:\svn\SVNlook.exe" log -t %TXN% %REPOS% | FindStr [a-zA-Z0-9]
IF %ERRORLEVEL% EQU 0 GOTO OK
echo Your commit has been blocked because you didn't provide a log message  1>&2
echo Please write a log message describing the purpose of your changes and 1>&2
echo then try committing again. -- Thank you 1>&2
exit 1

:OK
rem Check if comment is in list of reserved words to not be used..


the above is meant to check for empty comments and would echo out correct error messages.

"C:\svn\SVNlook.exe" log -t %TXN% %REPOS% >comment
setlocal enabledelayedexpansion
Set SEPARATOR=
set COMMENT=
for /f "delims=" %%a in (comment) do ( 
    set currentline=%%a
    set COMMENT=!COMMENT!%SEPARATOR%!currentline!
)

FIND "%COMMENT%" "c:\svn\excludedwords.txt">Null
If %ERRORLEVEL% EQU 1 goto OK2

:Fail
echo Your commit has been blocked because the single word comment you provided is not allowed 1>&2
echo Line is -%COMMENT%- 1>&2
echo Please write a proper log message describing the purpose of your changes and 1>&2
echo then try committing again. -- Thank you 1>&2
exit 1

:OK2
rem Check that the author of this commit has the rights to perform
rem the commit on the files and directories being modified.
rem commit-access-control.pl "$REPOS" "$TXN" commit-access-control.cfg || exit 1

rem All checks passed, so allow the commit.
exit 0

The above was used to check if the comment was a single word or found in my excluded list of words.

So I quietly sneaked in the change and waited for responses, I got a few moans but explained later that it was important to follow rules.