Bytes and Bites of Internet
Archive for March, 2011
Watermarked textbox in Silverlight
Mar 30th
If you have worked with ASP.NET then you probably already familiar with Watermark control, which is available as a part of Ajax Control toolkit on Codeplex. I think it is one of the greatest tool to have as a control because, it lets you set a text in textbox as a watermark. It gives a little edge to your web application. I think same can be told for Silverlight application.
But few days back when I was practicing my Silverlight skills with ScottGu’s tutorial, at one point he was creating watermarked textbox and from his explanation it looked like Silverlight has built in watermark feature !! But I was surprised to see that there is nothing like that ?? Even though that tutorial was originally written for Silverlight 2 and I am using Silverlight 4 this options is still not implemented. Actually at MSDN you can find a page for this option, but funny thing is this feature is supported in only Silverlight 4 and they are advising to not to use it in Silverlight 4 !!! I was like WTF, you can use but you can’t use ?
PAE … is it enabled ??
Mar 22nd
Last week I was asked by my boss that how do we know that if production server has PAE enabled ?? Since we are using Windows Server 2003 x86 with about 16Gb Ram, we’ve always assumed that we have it enabled because in task manager we can find that OS actually “see” all 16Gb ram. But what is the proof of it ??
Before I tell you how did we find the answer, few things about PAE and 32-bit OS. As we know that 32-bit OSes are bound to max limit of 4Gb RAM. Which means that even if we have more than 4Gb ram, OS will not actually use it since it can’t map that memory with registers (2^32 = 4294967296). The answer to this limitation is use of PAE switch which actually makes OS to behave as a 36-bit system so now it has additional 4 bit which can be used to map more ram (2^36 = 68719476736). But these “extra” mapping requires to use a portion of ram as well, hence for some applications the performance is not as good as compared to 64-bit OS which has practically no limit (2^64 = 18446744073709551616) as of today, SQL Server is one of that applications (but that discussion is for some other time). So, in short using PAE we can actually enable our OS to use more that 4Gb ram.
Ok, so back to discussion… how do we know for sure that PAE is enabled in our OS ? There are few ways to answer this question. First method is to just check for Boot.ini file and see if it has /PAE. Your boot.ini file will look something like this (beware of that it may have different entries.)
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(2)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="Windows Server 2003, Enterprise" /fastdetect /PAE
Solving MsiGetProductInfo failed to retrieve ProductVersion for package with Product Code = ‘{8BDD006D-D5F0-4AAA-BA13-65995063EC44}’. Error code: 1608
Mar 9th
Today I got call from one of my friend for help in installing SQL Server 2008 R2. Apparently, he somehow cancelled the installation at very beginning of process for some reason and then every single attempt to install it again failed with really weird error. To resolve this problem, we removed registry entries leftover, removed any and every temp files and folders created by SQL Server installation but nothing helped. All the time we get this strange error,
MsiGetProductInfo failed to retrieve ProductVersion for package with Product Code = ‘{8BDD006D-D5F0-4AAA-BA13-65995063EC44}’. Error code: 1608
With little hope I fired up firefox and search google with this string. With little surprise, we were not the only ones who are getting this error. And there were numerous blogs and solutions about it. Though none seem to have explanation why we are getting this error but all seem to suggest one common solution.
All we needed to do is to reverse the GUID and simply search of it in registry. In our case it was D600DDB8 (just the first part), and we searched registry with that parameter and deleted all the entries we encountered (Ofcourse we took backup of registry before deleting anything as removing wrong entry could be fatal in Windows). I think we deleted about 2-3 entries and then restarted the installation.
Simple Backup Solution for SQL Server Express
Mar 5th
So last week I was asked by one of our developers, if I can help them in setting up some sort of automated backup system which actually takes backup of database to a shared network drive at given time and also we need to retain past X day’s (or 3 day’s) backup copy just in case if we want to rollback. And the database instance was SQL Server 2008 Express !! yes, we are developing our product which is using SQL Server as a database but for client to not to have license of server, we are using express edition of SQL Server. Even though they have SQL Agent, they can’t actually be used unless you have one of PAID version of SQL Server is installed !!!
Actually having SQL Agent is not crucial as it is by function just a scheduled task in Windows with batch functionality that is useful for SQL Server (atleast I think like that)… So, to compensate for lack of SQL Agent we can combine SQLCMD, Windows Batch File and Task Scheduler to get the job done. Though it sounds way too complex, it is actually dead simple.
First I googled for instruction on how can I create VB script which will actually delete files from specific location and with specific timestamp. And I found this VB script from SQL Server Central (but not sure). I honestly can’t recall the original source of the script. But the script is something like following, it is very simple and concise. User just need to set path of file (in my case backup location) and # of days (in my case 3). So this script will simply delete EVERYTHING in that defined folder that is older than # of days we have defined !!