How to quickly lock your computer

This is a really quick blog post but when someone at work told me this shortcut, I thought yeah baby this is going to save me loads of time even if it is just 20 seconds a day.

The quick way to lock your computer is

Windows Logo key and L

go on try it now

This prompted me to have a quick google and see what else this windows key did, the Windows logo and D to show the desktop is pretty good.  This is the page I got the information below from.

Press To
Windows logo key Display or hide the Start menu
Windows logo key+L Lock the computer
Windows logo key+BREAK Display the System Properties dialog box
Windows logo key+D Show the desktop
Windows logo key+M Minimize all windows
Windows logo key+SHIFT+M Restore minimized windows
Windows logo key+E Open My Computer
Windows logo key+F Search for a file or folder
CTRL+Windows logo key+F Search for computers
Windows logo key+F1 Display Windows Help
Windows logo key+R Open the Run dialog box
Windows logo key+U Open Utility Manager
Application key Display the Shortcut menu for the selected item

CRM 2011 – Javascript Date Difference Code

The excellent Pogo69 blog, which is an excellent resource for CRM developers has a blog post with a nice piece of Javascript to find the difference between two dates using Javascript.

He mentions that he is starting to build a Javascript library, which thanks to CRM 2011 we can now do because you can use the same Javascript file in many forms.

I am surprised that Microsoft haven’t already created some general Javascript libraries for everyone to use, surely their developers would have already done something like that or at least created enough Javascript to make one.

if (typeof DateLib == 'undefined') {
	DateLib = {};
}

DateLib.Diff = function (from, to) {
	return to - from;
}
DateLib.DiffMinutes = function (from, to) {
	return DateLib.Diff(from, to) / (1000 * 60);
}
DateLib.DiffParts = function (from, to) {
	var diff = DateLib.DiffMinutes(from, to);

	var parts = new Object();

	parts.Days = Math.floor(diff / (60 * 24));
	diff -= (parts.Days * 60 * 24);
	parts.Hours = Math.floor(diff / 60);
	diff -= (parts.Hours * 60);
	parts.Minutes = Math.floor(diff);

	parts.Display =
			(parts.Days > 0 ? parts.Days + " days, " : "") +
			(parts.Hours > 0 ? parts.Hours + " hrs, " : "") +
			(parts.Minutes + " mins");

	return parts;
}