Thursday, May 28, 2009

check date is valid javascript

function isDate(dateStr) {
var datePat = /^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{4})$/;
var matchArray = dateStr.match(datePat); // is the format ok?

if (matchArray == null) {
alert(”Please enter your birth date as dd/mm/yyyy. Your current selection reads: ” + dateStr);
return false;
}

day = matchArray[1]; // p@rse date into variables
month = matchArray[3];
year = matchArray[5];

if (month <> 12) { // check month range
alert(”Month must be between 1 and 12.”);
return false;
}

if (day <> 31) {
alert(”Day must be between 1 and 31.”);
return false;
}

if ((month==4 || month==6 || month==9 || month==11) && day==31) {
alert(”Month “+month+” doesn`t have 31 days!”);
return false;
}

if (month == 2) { // check for february 29th
var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
if (day > 29 || (day==29 && !isleap)) {
alert(”February ” + year + ” doesn`t have ” + day + ” days!”);
return false;
}
}
return true; // date is valid
}

function checkForValidDate(){
var ddlVMonth = document.getElementById(”_ctl0_DropDownListMaanden”);
var ddlVDay = document.getElementById(”_ctl0_DropDownListDagen”);
var ddlVYear = document.getElementById(”_ctl0_DropDownListJaren”);

if (!isDate(ddlVDay.value + ‘/’ + ddlVMonth.value + ‘/’ + ddlVYear.value))
{ return(false); }

return(true);
}

Tuesday, May 19, 2009

Run Commands in Windows

Do you use the Run feature in Windows XP? For most, this feature remains unused (or rarely used). Why is that? Well, first off nearly all of the Run Commands Correspond to a particular Control Panel Item or a Utility, Tool or Task that can be accessed through Windows.

Here is the list of different Run command. To access go to run (Win + R )

  • Accessibility Controls : access.cpl
  • Accessibility Wizard : accwiz
  • Add Hardware Wizard : hdwwiz.cpl
  • Add/Remove Programs : appwiz.cpl
  • Administrative Tools control : admintools
  • Adobe Acrobat (if installed) : acrobat
  • Adobe Designer (if installed) : acrodist
  • Adobe Distiller (if installed) : acrodist
  • Adobe ImageReady (if installed) : imageready
  • Adobe Photoshop (if installed) : photoshop
  • Automatic Updates : wuaucpl.cpl
  • Bluetooth Transfer Wizard : fsquirt
  • Calculator : calc
  • Certificate Manager : certmgr.msc
  • Character Map : charmap
  • Check Disk Utility : chkdsk
  • Clipboard Viewer : clipbrd
  • Command Prompt : cmd
  • Component Services : dcomcnfg
  • Computer Management : compmgmt.msc
  • Control Panel : control
  • Date and Time Properties : timedate.cpl
  • DDE Shares : ddeshare
  • Device Manager : devmgmt.msc
  • Direct X Control Panel (If Installed)* : directx.cpl
  • Direct X Troubleshooter : dxdiag
  • Disk Cleanup Utility : cleanmgr
  • Disk Defragment : dfrg.msc
  • Disk Management : diskmgmt.msc
  • Disk Partition Manager : diskpart
  • Display Properties control : desktop
  • Display Properties : desk.cpl
  • Display Properties (w/Appearance Tab Preselected) control : color
  • Dr. Watson System Troubleshooting Utility : drwtsn32
  • Driver Verifier Utility : verifier
  • Event Viewer : eventvwr.msc
  • Files and Settings Transfer Tool : migwiz
  • File Signature Verification Tool : sigverif
  • Findfast : findfast.cpl
  • Firefox (if installed) : firefox
  • Folders Properties control : folders
  • Fonts control : fonts
  • Fonts Folder : fonts
  • Free Cell Card Game : freecell
  • Game Controllers : joy.cpl
  • Group Policy Editor (XP Prof) : gpedit.msc
  • Hearts Card Game : mshearts
  • Help and Support : helpctr
  • HyperTerminal : hypertrm
  • Iexpress Wizard : iexpress
  • Indexing Service : ciadv.msc
  • Internet Connection Wizard : icwconn1
  • Internet Explorer : iexplore
  • Internet Properties : inetcpl.cpl
  • Internet Setup Wizard : inetwiz
  • IP Configuration (Display Connection Configuration) : ipconfig /all
  • IP Configuration (Display DNS Cache Contents) : ipconfig /displaydns
  • IP Configuration (Delete DNS Cache Contents) : ipconfig /flushdns
  • IP Configuration (Release All Connections) : ipconfig /release
  • IP Configuration (Renew All Connections) : ipconfig /renew
  • IP Configuration (Refreshes DHCP & Re-Registers DNS) : ipconfig /registerdns
  • IP Configuration (Display DHCP Class ID) : ipconfig /showclassid
  • IP Configuration (Modifies DHCP Class ID) : ipconfig /setclassid
  • Java Control Panel (If Installed) : jpicpl32.cpl
  • Java Control Panel (If Installed) : javaws
  • Keyboard Properties control : keyboard
  • Local Security Settings : secpol.msc
  • Local Users and Groups : lusrmgr.msc
  • Logs You Out Of Windows : logoff
  • Malicious Software Removal Tool : mrt
  • Microsoft Access (if installed) : access.cpl
  • Microsoft Chat : winchat
  • Microsoft Excel (if installed) : excel
  • Microsoft Frontpage (if installed) : frontpg
  • Microsoft Movie Maker : moviemk
  • Microsoft Paint : mspaint
  • Microsoft Powerpoint (if installed) : powerpnt
  • Microsoft Word (if installed) : winword
  • Microsoft Syncronization Tool : mobsync
  • Minesweeper Game : winmine
  • Mouse Properties control : mouse
  • Mouse Properties : main.cpl
  • Nero (if installed) : nero
  • Netmeeting : conf
  • Network Connections control : netconnections
  • Network Connections : ncpa.cpl
  • Network Setup Wizard : netsetup.cpl
  • Notepad : notepad
  • Nview Desktop Manager (If Installed) : nvtuicpl.cpl
  • Object Packager : packager
  • ODBC Data Source Administrator : odbccp32.cpl
  • On Screen Keyboard : osk
  • Opens AC3 Filter (If Installed) : ac3filter.cpl
  • Outlook Express : msimn
  • Paint : pbrush
  • Password Properties : password.cpl
  • Performance Monitor : perfmon.msc
  • Performance Monitor : perfmon
  • Phone and Modem Options : telephon.cpl
  • Phone Dialer : dialer
  • Pinball Game : pinball
  • Power Configuration : powercfg.cpl
  • Printers and Faxes control : printers
  • Printers Folder : printers
  • Private Character Editor : eudcedit
  • Quicktime (If Installed) : QuickTime.cpl
  • Quicktime Player (if installed) : quicktimeplayer
  • Real Player (if installed) : realplay
  • Regional Settings : intl.cpl
  • Registry Editor : regedit
  • Registry Editor : regedit32
  • Remote Access Phonebook : rasphone
  • Remote Desktop : mstsc
  • Removable Storage : ntmsmgr.msc
  • Removable Storage Operator Requests : ntmsoprq.msc
  • Resultant Set of Policy (XP Prof) : rsop.msc
  • Scanners and Cameras : sticpl.cpl
  • Scheduled Tasks control : schedtasks
  • Security Center : wscui.cpl
  • Services : services.msc
  • Shared Folders : fsmgmt.msc
  • Shuts Down Windows : shutdown
  • Sounds and Audio : mmsys.cpl
  • Spider Solitare Card Game : spider
  • SQL Client Configuration : cliconfg
  • System Configuration Editor : sysedit
  • System Configuration Utility : msconfig
  • System File Checker Utility (Scan Immediately) : sfc /scannow
  • System File Checker Utility (Scan Once At Next Boot) : sfc /scanonce
  • System File Checker Utility (Scan On Every Boot) : sfc /scanboot
  • System File Checker Utility (Return to Default Setting) : sfc /revert
  • System File Checker Utility (Purge File Cache) : sfc /purgecache
  • System File Checker Utility (Set Cache Size to size x) : sfc /cachesize=x
  • System Information : msinfo32
  • System Properties : sysdm.cpl
  • Task Manager : taskmgr
  • TCP Tester : tcptest
  • Telnet Client : telnet
  • Tweak UI (if installed) : tweakui
  • User Account Management : nusrmgr.cpl
  • Utility Manager : utilman
  • Windows Address Book : wab
  • Windows Address Book Import Utility : wabmig
  • Windows Backup Utility (if installed) : ntbackup
  • Windows Explorer : explorer
  • Windows Firewall : firewall.cpl
  • Windows Magnifier : magnify
  • Windows Management Infrastructure : wmimgmt.msc
  • Windows Media Player : wmplayer
  • Windows Messenger : msmsgs
  • Windows Picture Import Wizard (need camera connected) : wiaacmgr
  • Windows System Security Tool : syskey
  • Windows Update Launches : wupdmgr
  • Windows Version (to show which version of windows) : winver
  • Windows XP Tour Wizard : tourstart
  • Wordpad : write

Monday, May 18, 2009

Abstract Class and interface

Ref :- http://www.codeproject.com/KB/cs/abstractsvsinterfaces.aspx

What is an Abstract Class?

An abstract class is a special kind of class that cannot be instantiated. So the question is why we need a class that cannot be instantiated? An abstract class is only to be sub-classed (inherited from). In other words, it only allows other classes to inherit from it but cannot be instantiated. The advantage is that it enforces certain hierarchies for all the subclasses. In simple words, it is a kind of contract that forces all the subclasses to carry on the same hierarchies or standards.

What is an Interface?

An interface is not a class. It is an entity that is defined by the word Interface. An interface has no implementation; it only has the signature or in other words, just the definition of the methods without the body. As one of the similarities to Abstract class, it is a contract that is used to define hierarchies for all subclasses or it defines specific set of methods and their arguments. The main difference between them is that a class can implement more than one interface but can only inherit from one abstract class. Since C# doesn�t support multiple inheritance, interfaces are used to implement multiple inheritance.


Abstract Class Employee

using System;

namespace AbstractsANDInterfaces
{
///


/// Summary description for Employee.

///


public abstract class Employee
{
//we can have fields and properties


//in the Abstract class

protected String id;
protected String lname;
protected String fname;

//properties


public abstract String ID
{
get;
set;
}

public abstract String FirstName
{
get;
set;
}

public abstract String LastName
{
get;
set;
}
//completed methods


public String Update()
{
return "Employee " + id + " " +
lname + " " + fname +
" updated";
}
//completed methods


public String Add()
{
return "Employee " + id + " " +
lname + " " + fname +
" added";
}
//completed methods


public String Delete()
{
return "Employee " + id + " " +
lname + " " + fname +
" deleted";
}
//completed methods


public String Search()
{
return "Employee " + id + " " +
lname + " " + fname +
" found";
}

//abstract method that is different


//from Fulltime and Contractor

//therefore i keep it uncompleted and

//let each implementation

//complete it the way they calculate the wage.


public abstract String CalculateWage();

}
}

For remaining please refer the below link
http://www.codeproject.com/KB/cs/abstractsvsinterfaces.aspx