Wednesday 14 October 2009

Lock Folder

1) If you want to lock a folder named pocket in your C:\, whose path is C:\pocket

2) Now open the Notepad and type the following


ren pocket pocket.{21EC2020-3AEA-1069-A2DD-08002B30309D}

3) Where dark is your folder name. Save the text file as loc.bat in the same drive.

4) Open another new notepad text file and type the following


ren pocket.{21EC2020-3AEA-1069-A2DD-08002B30309D} pocket

5) Save the text file as key.bat in the same drive.

6) To lock the pocket folder, simply click the loc.bat and it will transform into control panel icon which is inaccessible.

7) To unlock the folder click the key.bat file. Thus the folder will be unlocked and the contents are accessible.

Wednesday 18 March 2009

Select Last Day of Month in SQL

SELECT (CASE MONTH(GETDATE())
WHEN 1 THEN 31
WHEN 2 THEN (CASE YEAR(GETDATE())%4 WHEN 0 THEN 29 ELSE 28 END)
WHEN 3 THEN 31
WHEN 4 THEN 30
WHEN 5 THEN 31
WHEN 6 THEN 30
WHEN 7 THEN 31
WHEN 8 THEN 31
WHEN 9 THEN 30
WHEN 10 THEN 31
WHEN 11 THEN 30
WHEN 12 THEN 31
END) AS LastDayOfMonth