Monday, September 21, 2009

Tuesday, September 15, 2009

SQL DATEDIFF Function

Returns the number of date and time boundaries crossed between two dates.

SQL DATEDIFF Syntax
DATEDIFF ( DatePart , StartDate , EndDate )

DECLARE @StartDate DATETIME
DECLARE @EndDate DATETIME
SET @StartDate ='2007-06-05'
SET @EndDate ='2007-08-05'

SELECT DATEDIFF(Year, @StartDate, @EndDate) AS NewDate

Return Value = 0 Year

SELECT DATEDIFF(quarter, @StartDate, @EndDate) AS NewDate
Return Value = 1 quarter

SELECT DATEDIFF(Month, @StartDate, @EndDate) AS NewDate
Return Value = 2 Month

SELECT DATEDIFF(dayofyear,@StartDate, @EndDate) AS NewDate
Return Value = 61 day

SELECT DATEDIFF(Day, @StartDate, @EndDate) AS NewDate
Return Value = 61 Day

SELECT DATEDIFF(Week, @StartDate, @EndDate) AS NewDate
Return Value = 9 Week

SELECT DATEDIFF(Hour, @StartDate, @EndDate) AS NewDate
Return Value = 1464 Hour

SELECT DATEDIFF(minute, @StartDate, @EndDate) AS NewDate
Return Value = 87840 minute

SELECT DATEDIFF(second, @StartDate, @EndDate) AS NewDate
Return Value = 5270400 second

DECLARE @StartDate DATETIME
DECLARE @EndDate DATETIME
SET @StartDate ='2007-06-05'
SET @EndDate ='2007-06-06'

SELECT DATEDIFF(millisecond, @StartDate, @EndDate) AS NewDate

Return Value = 86400000 millisecond

Tuesday, August 25, 2009

10 Windows XP Services You Should Never Disable

1. DNS Client
If you stop this service, you will disable your computer’s ability to resolve names to IP addresses, basically rendering Web browsing all but impossible.

2: Network Connections
If this service is disabled, network configuration is not possible. New network connections can’t be created and services that need network information will fail.

3: Plug and Play
If you disable Plug and Play, your computer will be unstable and incapable of detecting hardware changes.

4: Print Spooler
When the Print Spooler service is not running, printing on the local machine is not possible. 5: Remote Procedure Call (RPC)Bad news. The system will not boot. Don’t disable this service.

6: Workstation
Disable the Workstation service and your computer will be unable to connect to remote Microsoft Network resources.

7: Network Location Awareness (NLA)
Your computer will not be able to fully connect to and use wireless networks. Problems abound!8: DHCP ClientWithout the DHCP Client service, you’ll need to manually assign static IP addresses to every Windows XP system on your network. If you use DHCP to assign other parameters, such as WINS information, you’ll need to provide that information manually as well.

9: Cryptographic Services
Disable Cryptographic Services at your peril! Automatic Updates will not function and you will have problems with Task Manager as well as other security mechanisms.

10: Automatic Updates
New security updates will not be automatically installed to your computer.

Wednesday, August 19, 2009

Convert String to System.Drawing.Color in ASPX C#

Here is a small example of how to convert a System.Drawing.Color to the HTML color format (Hex value or HTML color name value) and back.

System.Drawing.Color c = System.Drawing.ColorTranslator.FromHtml("#F5F7F8");
String strHtmlColor = System.Drawing.ColorTranslator.ToHtml(c);

Sunday, August 2, 2009

Happy Friendship Day 2009


Developing 100 Friends in 1 year is not a gain. But developing 1 Friend for 100 years is a great achievement. "Happy Friendship Day 2009"