ISNAN in javascript

{ Posted on 1/17/2010 11:28:00 AM by Silvercode }
isNaN(value) function
Well, isNan function determines whther a value is number or not.. if it is not a number, it returs true else it returns false...

eg: ISNAN("Hello") returns true
ISNAN(123) returns false
And in certain cases, javascript returns NAN in your textbox even though its a number,if you are pressing tab key.. if that is the case inorder to avoid it..just assign the next textbox value to 0 where it appears as NAN.
i.e. document.getelementbyid("idname").value =0;
This will do the trick...
Happy coding...

extract decimals from an integer

{ Posted on 1/17/2010 11:25:00 AM by Silvercode }
Here number is 1.35
decno=mynumber.substring(mynumber.indexOf('.'), mynumber.length);

Use the substring function to extract from the "." till the length of the number field, which gives you the result :
.35

Happy coding...

Printscreens in Miscrosoft Note 2007

{ Posted on 1/05/2010 03:15:00 PM by Silvercode }
tips for taking perfect printscreens using microsoft note 2007
STEP1:
As img below


STEP2:
Click Window key with S -> Select area u want prntscreen
Img effects (use step 3: else go to step 4)
STEP3:
Img effects -> powerpoint 2007 -> slideshow -> ctrl+v ->format tab -> Select image ->Drop Shadow rectangle -> ctrl + c
Step4:
Open MSoffice -> ctrl+v

Alternate row colors in Crystal Reports

{ Posted on 1/04/2010 04:00:00 PM by Silvercode }
STEPS:
After defining the databse objects in crystal reports,right click details section -> section expert -> details -> color -> backgroundcolor -> formula editor -> Add the formula as below :
IF RecordNumber mod 2 = 0 Then
crRed
Else
NoColor

After this you can see alternating rows as the color

Coloring row fields for an IFIELD object in crystal report

{ Posted on 1/04/2010 03:32:00 PM by Silvercode }

coloring a particular field in crystal report... we must be thinking programatically coloring an IFIELD(database) object is pretty difficult thing to do... its very simple...
STEP 1:
Rght click the IFIELD object name EMPID -> clck format editor -> border -> background -> click on formula editor ->
if {DataTable1.EMPID} <> "" then
cryellow else
crnocolor

if employeeid is not a null field , it highlights the field with yellow, else it gives no color.
below is the example image

Extract date from datetime in sql

{ Posted on 1/03/2010 03:49:00 PM by Silvercode }
How do we extract date part from datetime in sql???
below is the query to do that....
select convert(varchar(10), '10/21/2009 23:15:0000',110)

it returns the resultset as:

10/21/2009

error to use a section registered as allowDefinition='MachineToApplication' beyond application level

{ Posted on 1/03/2010 03:41:00 PM by Silvercode }
Tags :


We developers often comes up facing with the above error when we build a project. Solution for this is very simple. We have multiple web.config in the same project folder accidentally. Just find the duplicated web.config and delete it. Error vanishes while building the project.

Convert string dd/mm/yyyy to mm/dd/yyyy

{ Posted on 1/03/2010 09:18:00 AM by Silvercode }
Step1:
Declare an Array to store the datevalues from a string
Step2:
Assign it to the string declarations and append the string with "/"
And reuse the date anywhere in your file according to your need.
Dim sArr()
sArr = stringdate.Split("/")
Dim dd As String = sArr(0).ToString
Dim mm As String = sArr(1).ToString()
Dim yyyy As String = sArr(2).ToString().Substring(0, 4)
Dim sDate As String = mm + "/" + dd + "/" + yyyy
This code snippet is basically useful in situations where UK dateformat is to be used, other than US culture.And We can call this function whereever needed, just for display purpose or conversion purpose.
Happy Coding.