Tuesday, December 05, 2006

Friday, August 18, 2006

Wiki: OOAD

Check out this cool wiki for information about OOAD..
http://c2.com/cgi/fullSearch


Enjoy OOADing..

David Hayden's blog.. excellent

http://www.davidhayden.com/davidhayden/default.aspx

Enjoy Reading,
Rajesh

Sunday, August 06, 2006

Some good math link....

General
http://www.cut-the-knot.org/index.shtml

University lecture videos
http://www.archive.org/details/arsdigita_02_discrete_math

Thursday, August 03, 2006

Wednesday, July 05, 2006

Lets learn C

The C Journey

Lesson One : Introduction
C is everywhere, though .net, java, python is taking the world by storm. It is still one of the fundamental language to learn beginning programming. Though some may argue the case to be otherwise, but this is the way which worked best for me.

Lets get to the heart of the matter. Every C program begins with a main() function. main() is the entry point for a C program.

Let's write our first program, which is a hello world.


#include stdio.h
/* This program prints "Hello World" on the console. */
void main()
{
printf("Hello World\n");
}


The above program highlights many important features of C. Note the include file "stdio.h". The printf() function is located in this header file. You can treat stdio.h as a library containing many input/output functions. Later on we will see how to write our own such library.

Compile this program in your favorite editor and run it. You will be greeted with a "Hello World".

The "\n" at the end of "Hello World\n" string indicates a new line character. This instructs the compiler to postion the cursor on the next line.

And also note every C statement ends with a semicolon.
Also every block of statement is enclosed in a curly brace {...}.

Text written between /*.. */ are comments. This is for programmers reference. Comments are ignored by the compiler. Comments can also be represented by two forward slashes (//)
eg. // this line is a comment

The "void" indicates that the function doesn't return a value. This warrants an explanation as what a function is, which we will see in further section.

Lesson Two: Data Types
Objective: The objective of this section is to understand the following.
Memory Concepts
Data Types
Variables
Constants
Naming Conventions
scanf function
Arithmetic in C
Operator Precedence

Memory Concepts:
A computer has both short-term and long-term memory. A computer's long-term memory is called nonvolatile memory and is generally associated with mass storage devices, such as hard drives, large disk arrays, diskettes, and CD-ROMs. In later lessons, we will learn how to use nonvolatile memory for storing data.

This chapter concentrates on short-term, or volatile, memory. Volatile memory loses its data when power is removed from the computer. It's commonly referred to as RAM (random access memory).

RAM is made up of fixed-sized cells with each cell number referenced through an address. In later lessons, "Arrays," we will discuss memory cell reference through address pointers.

Generally Programmers reference memory cells through the use of variables. There are many types of variables, depending on the programming language, but all variables share similar characteristics, as described below

Name : The name of the variable used to reference data in program code

Type : The data type of the variable (number, character, and so on)

Value : The data value assigned to the memory location

Address: The address assigned to a variable, which points to a memory cell location

Data Types
We will look up at some of the data types such as strings, Boolean, arrays, objects, and data structures.

Let's concentrate on the following important data types
Integers
Floating-point numbers
Characters

Integers
Integers are whole numbers that represent positive and negative numbers, such as -3, -2, -1, 0, 1, 2, and 3, but not decimal or fractional numbers. Integer data types hold a maximum of four bytes of information and are declared with the int (short for integer) keyword as shown in the following line of code.

int x;

In C, you can declare more than one variable on the same line using a single int declaration statement, as demonstrated next. This preceding variable declaration declares three integer variables named x, y, and z.

int x, y, z;

Floating-Point Numbers
Floating-point numbers are all numbers, including signed and unsigned decimal and fractional numbers. Signed numbers include positive and negative numbers whereas unsigned numbers can only include positive values. Examples of floating-point numbers are shown in the following list.

09.4543
3428.27
112.34329
-342.66
-55433.33281

Use the keyword float to declare floating-point numbers, as shown next. This code has three floating-point variable data types called operand1, operand2, and result.

float operand1;
float operand2;
float result;

Characters
Character data types are representations of integer values known as character codes. For example, the character code 90 represents the letter Z. Note that the letter Z is not the same as the character code 122, which represents letter z (lowercase letter z).

Characters represent more than the letters of the alphabet; they also represent numbers 0 through 9, special characters, such as the asterisk (*), and keyboard keys, such as the Del (delete) key and Esc (escape) key. In all, there are a total of 128 common character codes (0 through 127), which make up the most commonly used characters of a keyboard.

Character codes are most notably organized through the ASCII (American Standard Code for Information Interchange) character set. For a listing of common ASCII character codes, see Appendix E, "Common ASCII Character Codes."

DEFINITION ASCII or American Standard Code for Information Interchange is noted for its character set, which uses small integer values to represent character or keyboard values.


In C, character variables are created using the char (short for character) keyword as demonstrated next.

char firstInitial;
char middleInitial;
char lastInitial;

Character data assigned to character variables must be enclosed in single quotes ('), also known as tick marks or apostrophes. As you'll see in the next section, the equals sign (=) is used for assigning data to the character variable.


Initializing Variables and the Assignment Operator
When variables are first declared, the program assigns the variable name (address pointer) to an available memory location. It is never safe to assume that the newly assigned variable location is empty. It's possible that the memory location contains previously used data (or garbage). To prevent unwanted data from appearing in your newly created variables, initialize new variables, as shown here.

int x;
char firstInitial;

x = 0;
firstInitial = '\0';

The preceding code declares two variables: one integer and one character data type. After creating the two variables, I initialize them to a particular value. For the integer variable, I assign the value zero (0), and for the character data type, I assign the character set \0, which is known as the NULL character. I enclosed the NULL character in single quotes. Single quotes are required when assigning data to the character data type.


Printing Variable Contents
To print the contents of variables, use the printf function with new formatting options, as demonstrated in the following code block. First, I declare three variables (one integer, one float, and one character), and then I initialize each of them. After initializing the variables, I use the printf statement to output each variable's contents to the computer's screen.


#include

main()

{

//variable declarations
int x;
float y;
char c;

//variable initializations
x = -4443;
y = 554.21;
c = 'M';

//printing variable contents to standard output
printf("\nThe value of integer variable x is %d", x);
printf("\nThe value of float variable y is %f", y);
printf("\nThe value of character variable c is %c\n", c);

}


Conversion Specifiers
Because data is stored as unreadable data in the computer's memory, programmers in C must specifically tell input or output functions, such as printf, how to display the data as information. You can accomplish this seemingly difficult task using character sets known as conversion specifiers.

Conversion specifiers are made up of two characters: The first character is the percent sign (%), and the second is a special character, which tells the program how to convert the data. Table 2.2 describes the most common conversion specifiers for the data types discussed in this chapter.

Common Conversion Specifiers Used with Printf Conversion Specifier Description

%d
Displays integer value

%f
Displays floating-point numbers

%c
Displays character


Displaying Integer Data Types with printf
Integer data types can easily be displayed using the %d conversion specifier with a printf statement as shown next.

printf("%d", 55);

The output of the preceding statement prints the following text:

55

The %d conversion specifier can also be used to output the contents of a variable declared as integer data type, as demonstrated next.

int operand1;
operand1 = 29;
printf("The value of operand1 is %d", operand1);

In the preceding statements, I declare a new integer variable called operand1. Next, I assign the number 29 to the newly created variable and display its contents using the printf function with the %d conversion specifier. Each variable displayed using a printf function must be outside the parentheses and separated with a comma (,).

Displaying Floating-Point Data Types with printf
To display floating-point numbers, use the %f conversion specifier demonstrated next.

printf("%f", 55.55);

Here's another example of the %f conversion specifier, which prints the contents of a floating-point variable:

float result;
result = 3.123456;
printf("The value of result is %f", result);

Although the %f conversion specifier displays floating-point numbers, it may not be enough to display the floating-point number with correct or wanted precision. The following printf statement demonstrates the precision problem.

printf("%f", 55.55);

This printf example outputs a floating-point number with a six-digit precision to the right of the decimal point, as shown next.

55.550000

To create precision with floating-point numbers, adjust the conversion specifier using numbering schemes between the % sign and the f character conversion specifier.


printf("%.1f", 3.123456);
printf("\n%.2f", 3.123456);
printf("\n%.3f", 3.123456);
printf("\n%.4f", 3.123456);
printf("\n%.5f", 3.123456);
printf("\n%.6f", 3.123456);

The preceding code block produces the following output:

3.1
3.12
3.123
3.1234
3.12345
3.123456

I included the escape sequence \n in each of the preceding printf statements (except the first line of code). Without the new line (\n) escape sequence, each statement's output would generate on the same line, making it difficult to read.

Displaying Character Data Types with printf
Characters are also easy to display using the %c conversion specifier, as shown next.

printf ("%c", 'M');

The output of this statement is simply the single letter M. Like the other conversion specifiers, you can output the contents of a character variable data type using the %c conversion specifier and a printf statement as demonstrated next.

char firstInitial;
firstInitial= 'S';
printf("The value of firstInitial is %c", firstInitial);

You can use multiple conversion specifiers in a single printf statement as shown next.

char firstName, middleName, lastName;
firstName= 'R';
middleName= 'R';
lastName= 'P';
printf("My Initials are %c.%c.%c.", firstName, middleName, lastName);

The output of the preceding program statements is as follows.

My Initials are R.R.P
Notice in the statement below that each variable displayed with the printf statement is outside the double quotes and is separated with a single comma.

printf("My Initials are %c.%.c.%c.", firstName, middleName, lastName);

Text inside printf's double quotes is reserved for displayable text, conversion specifiers, and escape sequences.

Monday, July 03, 2006

Build your own Forms Authentication

The authentication ticked is created with the FormsAuthenticationTicket class. Its constructor accepts the following parameters:

version : The version of the authentication ticket[this value will be one]
name : The user name associated with the authentication ticket
issueDate : The date that the authentication ticket was issued
expiration : The date that the authentication ticket should expire
isPersistent: A boolean value indicating whether to allow the ticket to persist
after the user closes the browser
userData : A string value of any data that you would like to store. For eg.,
say your email ID.

Add an asp.net form, with a button 'Create Ticket'. On click on this button invoke the 'Login' method.

void Login(Object s, EventArgs e)
{
if (txtUsername.Text == "xxx" && txtPassword.Text == "xxx")
{
FormsAuthenticationTicket objTicket;
HttpCookie objCookie;
objTicket = new FormsAuthenticationTicket(1, txtUsername.Text,
DateTime.Now, DateTime.Now.AddMinutes(60), true,
"tt@server.com");
objCookie = new HttpCookie(".ASPXAUTH");
objCookie.Value = FormsAuthentication.Encrypt(objTicket);
Response.Cookies.Add(objCookie);

Response.Redirect("Default.aspx");
}
}

In the default.aspx Page_Load event add the following code..

void Page_Load() {
FormsIdentity objTicket;

objTicket = (FormsIdentity)User.Identity;
lblName.Text = objTicket.Ticket.Name;
lblIssueDate.Text = objTicket.Ticket.IssueDate.ToString();
lblExpiration.Text = objTicket.Ticket.Expiration.ToString();
lblIsPersistent.Text = objTicket.Ticket.IsPersistent.ToString();
lblVersion.Text = objTicket.Ticket.Version.ToString();
lblUserData.Text = objTicket.Ticket.UserData;
}

Enjoy coding..

Monday, June 12, 2006

Tech.Ed 2006...

My first tech.ed 2006 experience was not as expected, but still gain some understanding about the future trends in ms software innovation...
My favorite topics were LINQ, DLINQ as of now...

Friday, May 26, 2006

Another AJAX link...(*****)

http://www.fiftyfoureleven.com/resources/programming/xmlhttprequest

Enjoy Ajaxing....

Thursday, May 25, 2006

Javascript - AJAX Blog...

Have a look at the following URL...

http://www.ditchnet.org/wp/2005/06/15/ajax-freakshow-drag-n-drop-events-2/

Tuesday, May 23, 2006

Six sigma tutorial...

Here is a website containing great tutorials on six sigma ...
http://sixsigmatutorial.com/default.aspx

Tuesday, May 16, 2006

Software design documents...

Software design documents...

http://www.rspa.com/spi/index.html


Happy designing/documenting...

Monday, May 15, 2006

Yukon Rocks !!!

Yukon/SQL Server 2005 Rocks.

Features include CLR Programming, Custom types, User defined aggregates,
Notification services, Integration services etc....


Need to dig more deeply....

Tuesday, April 11, 2006

Open source web design :)

Heard of open source softwares...

Here it is open source web designs...

http://www.oswd.org/

Enjoy...

Good CSS links...

http://www.cssplay.co.uk/menus/index.html
http://glish.com/css/

Thursday, April 06, 2006

Excellent javascript drag-drop link...

http://www.javascriptkit.com/howto/drag.shtml

Enjoy Dragging....

Tuesday, March 28, 2006

Interesting read...

Have a look at it...
http://weblogs.asp.net/dannychen/archive/2006/03/02/439437.aspx

An elegant solution to a recurring problem...

Enjoy...

Friday, March 24, 2006

Learn pool, billiards, snooker...

Wanna learn pool, billiards, snooker....
Visit
http://www.easypooltutor.com/

Thursday, March 23, 2006

My first homepage using Google Page Creator

I was thinking of creating a home page for me for a long time...

Here is a prototype page created with Google Page Creator...
http://pillai.rajesh.googlepages.com/home


More to come...

Wednesday, March 15, 2006

Excel FAQ

http://www.mrexcel.com

OOP - web link

Concise summary of OOP concepts..
http://www.toa.com/pub/oobasics/oobasics.htm


Enjoy

Object Primer - Cohesion

Tip : An object should be highly cohesive.

Cohesion is a measure of how much an item say for eg. a class or method, makes sense.
Objects with low cohesion are more likely to be changed.

A method is highly cohesive if it does one thing and only one thing.

Object Primer - Coupling

Object coupling describes the degree of interrelationships among the objects that make up a system. The more any one object knows about any other object in the system, the tighter the coupling is between those objects.

In other words, coupling is a measure of how two items, such as classes or methods, are interrelated. When one class depends on another class the are said to be coupled. When one class interacts with another class, but does not know have any knowledge of the implementation details of the other class they are said to be loosely coupled. When one class relies on the implementation of another class, they are said to be tighly coupled.


Point: Always try for loose coupling among objects. This can be achieved by programming to a common interface(super type).

Saturday, February 11, 2006

Lessons from Head First Design Pattern - 1

OO Basics
---------------------------
- Abstraction
- Encapsulation
- Polymorphism
- Inheritance


OO Principles
---------------------------
- Encapsulate what varies
- Favor composition over inheritance
- Program to interface, not implementations.
- Strive for loosely coupled designs between objects that interact
- Classes should be open for extension but closed for modification.
- Depend on abstractions. Do not depend on concrete classes.

OO Patterns
---------------------------
Strategy - Defines a family of algorithms, encapsulate each one, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it.

Observer - Defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.

Decorator - Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.

Factory Method - Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to the subclasses.

Singleton - Ensures a class only has one instance and provide a global point of access to it.

Thursday, February 09, 2006

Resources for unit testing...

http://www.nunit.org/index.php?p=resources

ajax blog.....

http://ajaxblog.com/

AJAX is the next cutting edge technology complimenting .net,java,php ruby etc....

Have fun...

Sunday, January 29, 2006

Something different than routine..

Just tired of doing the same stuff...its time for a change..

Currently working on beta project called "SkyFramework" in my free time....
Its something similar to "Ruby On Rails", but "SkyFramework" would be for .net...

Its still in its initial desing...but some test code is already on the move..

Monday, January 02, 2006

Ascii art !!1

http://www.chris.com/ascii/


Enjoy...