Vertical Scollbar Jumping

Ever noticed how in some sites when a non-full width design is used, the design jumps slightly when the page is shorter than the full screen? This is because in Firefox, the vertical scrollbar tucks itself away when it is not needed i.e. the page is shorter than the screen display. This doesn’t happen in IE.

The result is a s lightly jarring effect but luckily there is a simple fix…

In your CSS statements, either in your style sheet or in the HEAD section of the page, add the statement:

html {height:100%;margin-bottom:1px;}

What this basically does is fool the browser into thinking that the page is filling the screen vertically so it will show the scroll bar. The result is that the design no longer shifts as the vertical scrollbar is always displayed.

In the words of the tic-tac advert, neat huh? 😉

How to Shrink MS SQL Server 2005 Log Files

Now any sysadmin know that MS SQL server can generate whopper log files for the databases especially if there are a large number of transactions taking place. It’s simple enough to shrink the logs periodically but I wanted to find a way to safely automate this.

A quick Google turned up this very informative post by Roni Schuetz. In essence it will loop through all of the DB logs and shrink them back to “normal” size:

DBName nvarchar(128),
DBLogicalName nvarchar(128)
SELECT DBName, DBLogicalName
FROM sys.databases db join sys.master_files mf
on db.database_id = mf.database_id
WHERE not in ('master', 'tempdb', 'model', 'msdb',
'distribution') AND type_desc LIKE 'log'

DECLARE @VarDBLogicalName nvarchar(128)
DECLARE @VarDBName nvarchar(128)
DECLARE @VarRowCount int

SELECT top 1 @VarDBName = DBName, @VarDBLogicalName = DBLogicalName
FROM #TDatabases
SET @VarRowCount = @@rowcount
WHILE @VarRowCount <> 0
EXEC(' use ' + @VarDBName + ' backup log '+ @VarDBName + ' with no_log
dbcc shrinkfile(''' + @VarDBLogicalName + ''', TRUNCATEONLY) WITH
FROM #TDatabases
WHERE DBName = @VarDBName
SELECT top 1 @VarDBName = DBName, @VarDBLogicalName =
FROM #TDatabases
SET @VarRowCount = @@ROWCOUNT
DROP TABLE #TDatabases

Now you can also automate this process by savin the above script into a SQL file and then creating a BAT file to run this command:

osql -E -i shrinkalldatabases.sql -o result.txt

where shinkalldatabases.sql is the above SQL script.

Set it to run once a week and Bob’s your Uncle. And yes I do have an Uncle Bob…