Skip to main content

Posts

Showing posts from June, 2008

SQL Server Function to Determine a Leap Year

CREATE FUNCTION [dbo].[ufn_IsLeapYear] ( @pDate DATETIME ) RETURNS BIT AS BEGIN IF (YEAR( @pDate ) % 4 = 0 AND YEAR( @pDate ) % 100 != 0) OR YEAR( @pDate ) % 400 = 0 RETURN 1 RETURN 0 END GO OR create function dbo.fn_IsLeapYear (@year int) returns bit as begin return(select case datepart(mm, dateadd(dd, 1, cast((cast(@year as varchar(4)) + '0228') as datetime))) when 2 then 1 else 0 end) end go

Important point to be remember in Designing!

skip to main | skip to sidebar Designer's Blog will show Designing tricks Thursday, June 5, 2008 XHTML Transitional There are very basic rules to follow for making the site xhtml transitional. It should be necessary atleast to make the site xhtml transitional compliant. Please visit the link: http://www.nypl.org/styleguide/xhtml/guidelines.html To make the site xhtml strict, There are some more rules to follow but that should be done only if required. Posted by Ansuiya Sablok at 10:23 AM 0 comments Wednesday, June 4, 2008 Some points to remember Please keep in mind the following points while doing the coding. 1. Quote all attribute values. 2. Find the controls which should be compatible with all browsers. 3. Place the controls properly. Take care for the design, not to be disturbed. 4. Always give alt and title to images. If you don't want to give alt to image then you can leave alt="" . Give proper title to links as well. 5. Always ...

Important point To Remember in C# Coding.

C# 1. Are exceptions used to indicate error rather than returning status or error codes? 2. Are all classes and public methods commented with .NET style comments? Note that comments should discuss the "what" of public methods. Discussion of "how" should be in blocks or in-line with the code in question. 3. Are method arguments validated and rejected with an exception if they are invalid? 4. Are Debug. Asserts used to verify assumptions about the functioning of the code? Comments like, "j will be positive" should be rewritten as Asserts. 5. Do classes that should not be instantiated have a private constructor? 6. Are classes declared as value types only infrequently used as method parameters, returned from methods or stored in Collections? 7. Are classes, methods and events that are specific to an assembly marked as internal? 8. Are singletons that may be accessed by multiple threads instantiated correctly? 9. ...

Creating Encrypted Connection string

Tuesday, June 3, 2008 Creating Encrypted Connection string Creating Encrypted Connection string You should always encrypt the connectionStrings section of a configuration file to prevent your database connection strings from being stolen by evil hackers. aspnet_regiis tool for encryption The easiest way to encrypt a section in the web configuration file is to use the aspnet_regiis command-line tool.This tool is located at the following path: C:\WINDOWS \Microsoft.NET \Framework \v2.0.50727 \aspnet_regiis.exe The following command encrypts the connectionStrings section of a configuration file located in a virtual directory named /MyApp: aspnet_regiis -pe connectionStrings -app /TestSite Notice that the -app option is used to specify the application ’s virtual path. You can encrypts a configuration section by using the -pef option.The following command decrypts a configuration file located in a folder named TestSite: aspnet_regiis -pef connectionStrings c:\TestSite You can decrypt a conf...