Archive

Archive for July, 2007

C# Tutorial : Lesson 08 – Functions/Methods

July 24th, 2007

The programming model has gone through many refinements, each change improving upon the model. One of the early changes was the inclusion of Subroutines or Subprograms. As the names suggest, these are fragments of code within a program. They offer the following advantages:-

  • Reduction of code duplication by offering re-usability
  • Simplifying program logic by decomposing the program into smaller blocks
  • Improving readability of the program
Why do we need functions?

Consider the following program:-

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
using System;
 
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int JoinDay;
 
            Console.WriteLine("Enter the day of Joining:");
            JoinDay = Convert.ToInt32(Console.ReadLine());
 
            switch (JoinDay)
            {
                case 1:
                    Console.WriteLine("You Joined on a Sunday");
                    break;
 
                case 2:
                    Console.WriteLine("You Joined on a Monday");
                    break;
 
                case 3:
                    Console.WriteLine("You Joined on a Tuesday");
                    break;
 
                case 4:
                    Console.WriteLine("You Joined on a Wednesday");
                    break;
 
                case 5:
                    Console.WriteLine("You Joined on a Thursday");
                    break;
 
                case 6:
                    Console.WriteLine("You Joined on a Friday");
                    break;
 
                case 7:
                    Console.WriteLine("You Joined on a Saturday");
                    break;
            }
 
            int ResigDay;
            Console.WriteLine("Enter the Resignation Date:");
            ResigDay = Convert.ToInt32(Console.ReadLine());
 
            switch (ResigDay)
            {
                case 1:
                    Console.WriteLine("You Resigned on a Sunday");
                    break;
 
                case 2:
                    Console.WriteLine("You Resigned on a Monday");
                    break;
 
                case 3:
                    Console.WriteLine("You Resigned on a Tuesday");
                    break;
 
                case 4:
                    Console.WriteLine("You Resigned on a Wednesday");
                    break;
 
                case 5:
                    Console.WriteLine("You Resigned on a Thursday");
                    break;
 
                case 6:
                    Console.WriteLine("You Resigned on a Friday");
                    break;
 
                case 7:
                    Console.WriteLine("You Resigned on a Saturday");
                    break;
            }
 
 
            Console.ReadLine();
 
        }
    }
}

This program displays the weekday of joining and resigning based on the day code entered by the user. While, there are no errors in the code, there is a problem – repetition of code. The switch block in the second case (Resignation Day) is more or less the same except for the prefix to the output message being You Resigned on a . Looping is meant to minimize code repetition, but it is not applicable everywhere. In scenarios such as these we should use functions to reduce code repetition. Below is the same program when done by using a function.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using System;
 
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int JoinDay;
 
            Console.WriteLine("Enter the day of Joining:");
            JoinDay = Convert.ToInt32(Console.ReadLine());
 
            Console.WriteLine("You Joined on a {0}", GetDayFromCode(JoinDay));
 
            int ResigDay;
            Console.WriteLine("Enter the Resignation Date:");
            ResigDay = Convert.ToInt32(Console.ReadLine());
 
            Console.WriteLine("You Resigned on a {0}", GetDayFromCode(ResigDay));
 
            Console.ReadLine();
 
        }
 
        public static string GetDayFromCode(int Code)
        {
            switch (Code)
            {
                case 1:
                    return "Sunday";
 
                case 2:
                    return "Monday";
 
                case 3:
                    return "Tuesday";
 
                case 4:
                    return "Wednesday";
 
                case 5:
                    return "Thursday";
 
                case 6:
                    return "Friday";
 
                case 7:
                    return "Saturday";
 
                default:
                    return "";
            }
 
        }
    }
}

We have saved 28 lines by using the function for just 2 cases – Date of Joining & Resigning.

Note: – We haven’t added provision for handling invalid day codes i.e values not belonging to the range 1 – 7.

The terms function and methods are used interchangeably. Functions are composed of statements that are grouped under a name and can be used repeatedly by just calling the function.

Declaration

Before we can use a function, we need to define its properties, what it does and the value that it returns. Any function declaration has two parts – Signature and Body. We will use this function as our example to study the two parts.

1
2
3
4
5
public int SumOfTwoNumbers(int Num1, int Num2)
{
    int Sum = Num1 + Num2;
    return Sum;
}
Function Signature

The function signature is composed of the Return Type, Function Name and the optional Parameters and Access Specifier.

  • Return Type
    The return type determines the type of value that the function will return. It can be any of the atomic data types (int, char, string, bool, float, etc) or the user defined types (enums, objects, structures). A function that does not return any value should have a return type of void.
  • Function Name
    The function name can be anything that follows the naming rules:-

    • The name must begin with a letter or an underscore & can be followed by a sequence of letters (A-Z), digits (0-9) or underscore (_)
    • Special Characters such as ? – * / \ ! @ # $ % ^ ( ) [ ] { } , ; : . cannot be used in the function name.
    • A function name must not be the same as a reserved keyword such as using, public, etc.
    • The name can contain any number of the allowed characters.
    • Functions with the same class cannot have the same name
  • Parameters
    Functions take values as input, process it and return the output. These inputs are in the form of parameters. The parameters themselves are composed of the data type and the parameter name. The data type restricts the values that can be passed to the function (int only allows Integer values, bool allows Boolean values and so on) and the parameter name can be used like a regular variable under the function body. This variable would be initialized with the value that is passed to the function when it is invoked (called). A function can have any number of parameters each of which need to separated by a comma.
Function Body

This is where we define what the function actually does. In our case, the body is composed of the lineint Sum = Num1 + Num2; which does the actual calculation and return Sum which returns the value to the calling function. Every function (except the constructor and destructor) which doesn’t have a return type of void must return a value. The return value must comply with the data type specified in the signature.

Calling/Invoking the function

By calling/invoking the function, we imply using it – which results in the lines of code written inside it being executed. Calling a function is very simple. We do so by the following syntax:-

FunctionName(param1, param2 …);

In our case, it would go something like – SumOfTwoNumbers(6, 9);. This line will pass the execution to the function SumOfTwoNumbers along with the values 6 and 9 which will get copied in the variables Num1 and Num2. After this, the line int Sum = Num1 + Num2; will be executed and the sum of the two numbers will be stored in the variable Sum. Finally, this value will be returned to the calling function, which basically discards this value (as of now). We can store this result as int MySum = SumOfTwoNumbers(6, 9); or display it on screen as follows Console.WriteLine(SumOfTwoNumbers(6, 9));.

Special Cases

A parameter can have two variations – ref and out. When these prefixes are applied to any parameter, its behaviour changes. Normally, the values passed to the function are just copies of the original value and any changes made to this value have no effect on the original value. By using the ref keyword we can force the value to be passed by reference. This creates an alias of the variable which might have a different name but points to the same address in the memory. Thus, changes made to this value reflect in the original value.

The swap function is a trivial example of this difference:-

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using System;
using System.Collections.Generic;
using System.Text;
 
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int A = 10, B = 20;
            Console.WriteLine("The value of A = {0} and B = {1}", A, B);
            Swap(A, B);
            Console.WriteLine("The value (after swapping) of A = {0} and B = {1}", A, B);
            Console.ReadLine();
        }
 
        public static void Swap(int A, int B)
        {
            int Temp = A;
            A = B;
            B = Temp;
            Console.WriteLine("The value (during swapping) of A = {0} and B = {1}", A, B);
        }
    }
}

The output of the following program would be:-

The value of A = 10 and B = 20
The value (during swapping) of A = 20 and B = 10
The value (after swapping) of A = 10 and B = 20

As you can see, the changes made to the value of A and B inside the Swap function have no effect on the values of A and B inside the Main function. This is because both pairs of variable belong to their scopes (the Swap function and the Main Function) and are hence separate. However, by using the ref keyword, we can point the variable A inside the Main and Swap function to the same memory location (same holds for the variable B). The variable A inside the Swap function will be called an alias of the variable A inside the Main function. The alias doesn’t need to have the same name either. The alias stores the memory address of the original variable and not its value.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using System;
using System.Collections.Generic;
using System.Text;
 
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int A = 10, B = 20;
            Console.WriteLine("The value of A = {0} and B = {1}", A, B);
            Swap(ref A, ref B);
            Console.WriteLine("The value (after swapping) of A = {0} and B = {1}", A, B);
            Console.ReadLine();
        }
 
        public static void Swap(ref int A, ref int B)
        {
            int Temp = A;
            A = B;
            B = Temp;
            Console.WriteLine("The value (during swapping) of A = {0} and B = {1}", A, B);
        }
    }
}

Output:-

The value of A = 10 and B = 20
The value (during swapping) of A = 20 and B = 10
The value (after swapping) of A = 20 and B = 10

By using the ref keyword, we have made the change persistent inside the Main function.

Note: It is necessary to specify the ref keyword during function calling.

A function can take multiple inputs but only return a single value. There might be situations when we need multiple values as output from the function. We can do this by using either the ref or the out keyword. Both of them result in references being passed. The only difference is that the out keyword passes along null values and is hence ideally suited for output purposes.

Note: It is necessary to specify the out keyword during function calling.

partho C#

C# Tutorial : Lesson 07 – Creating Value Types & Reference Types – Part II

July 23rd, 2007
foreach statement

This statement is explicitly used to traverse through arrays. The benefit of using foreach over the normal for statement is that it is not necessary to check the size of the array while using the former.

Syntax:-

foreach(type identifier in expression)
{
statement 1;
statement 2;

}

Suppose we have an array StudentNames containing the name of all the students in a class. We need to display the name of each one of them on screen. First we will see how it can be done using the for loop.

1
2
3
4
5
string[] StudentNames = new string[] {"Peter", "Tony", "Bruce", "Scott", "Clark", "Kenshin"};
for (int I = 0; I < StudentNames.Length; I  )
{
	Console.WriteLine(StudentNames[I]);
}

Now we’ll use the foreach statement to do this.

1
2
3
4
5
string[] StudentNames = new string[] {"Peter", "Tony", "Bruce", "Scott", "Clark", "Kenshin"};
foreach (string StudentName in StudentNames)
{
	Console.WriteLine(StudentName);
}
Param Arrays

Remember the Console.WriteLine method which outputs the result using a string format followed by the additional values as input parameters. For example: Console.WriteLine(”The sum of {0} and {1} is {2}”, Num1, Num2, Num1 Num2); would display The sum of 5 and 6 is 11 for values 5 and 6 for Num1 and Num2 respectively. What is worth noting here, is that WriteLine() can take any number of parameters after the string format. So, something like this would work as well:-

Console.WriteLine("The Prime Numbers -> {0}, {1}, {2}, {3}, {4}", 2, 3, 5, 7, 11);

This is done by the param array data type. Example:-

1
2
3
4
5
6
7
8
9
public static int Sum(params int[] Numbers)
{
	int Sum = 0;
	foreach (int Number in Numbers)
	{
		Sum  = Number;
	}
	return Sum;
}

This is a function to return the sum of any number of numbers. The numbers to be summed are passed as parameters during the function call as: Sum(4, 69, 13, 99);

Note: param array should be the last parameter in the function signature which also means that only one param array can be used in a function. Why is this done? Consider the following function signature: public static int MyFunction(params int[] A, int C). How would we call the function if this were to be allowed? MyFunction(1, 2, 3, 4, 5); How can the compiler determine where the values for the param array A finish? Actually, if a reverse scanning of parameters were to be done, this could be determined. But that would increase useless complexity of having to implement this along with the normal forward scanning of parameters.

Multi Dimensional Arrays

Up until now, we have only worked with Single Dimensional arrays. Now we shall see how the Multi Dimensional arrays are declared, initialized and manipulated. The pictures below show how the Single and Double Dimensional arrays are represented.

Single Dimensional Array

Multi Dimensional Array

While, the Single Dimensional arrays are represented as a single row of elements, Double Dimensional arrays are represented by multiple rows. Similarly, arrays with 3 dimensions would be represented in 3D space along the three axes.

Declaration

Declaration is done by the syntax:-

datatype [ , ] VariableName;

The number of commas ( , ) inside the square brackets [ ] should be one less than the number of dimensions required for the array.

Example Usage:-

int [ , ] Numbers;
Initialization

Initialization is done in a way where each row is treated like a single dimensional array. Example:-

1
2
3
4
5
6
int[,] Numbers = new int[3, 3]
{
	{1, 2, 3},
	{4, 5, 6},
	{7, 8, 9}
};
Assigning Values

Values can be assigned as:-

Numbers[1, 2] = 7;
Array Class

The Array class defined in the System namespace serves as the base class for all the arrays in the Common Language Runtime. It can be used to create, manipulate, search and sort arrays.

Some of the common Properties and methods are summarized below.

Properties

  • IsFixedSize – Returns a boolean value (True / False) indicating whether the array is of Fixed Size or not.
  • IsReadOnly – Returns a boolean value (True / False) indicating whether the array is Read Only or not.
  • Length – Returns a 32-bit integer that represents the total number of elements across all dimensions in the array.
  • Rank – Returns the number of dimensions (also called the Rank) of the array.
Methods
  • BinarySearch – Performs the faster Binary Search algorithm on the array and returns the number if found.
  • Clear – Resets the value of the supplied range of elements in the array to the default values of the datatype:-
    • int – 0
    • bool – false
    • Reference Data Types – Null
  • Copy – Copies a range of elements to another array along with type casting and boxing as required
  • CopTo – Copies all elements to the specified single dimensional array
  • Find – Searches for the given value and returns its first occurrence in the array
  • FindAll – Returns all occurrences of the searched element in the array
  • GetLength – Returns the 32 bit length of the array
  • GetValue – Returns the value of the specified item in the array
  • IndexOf – Searches for the given value and returns the index of the first position its found in
  • Resize – Resizes the array
  • Reverse – Reverses the order of the elements. (Works only on a single dimensional array)
  • SetValue – Sets the value at the specified location of the array
  • Sort – Sorts the elements. (Works only on a single dimensional array)
Collections

An integer array can only store integers. Same goes for any other array type – string, boolean, etc. Collections overcome this limitation of arrays and can store elements of different types as items. This is possible because Collections actually store references and not values. We use the System.Collections namespace to work with collections.

Boxing – No, not the Sport! Boxing is the automatic conversion of value types to reference types allowing them to be stored in collections.
Unboxing – The reverse of the former, conversion of reference type to value type.

Because Collections store references, it is necessary to do the above conversions while storing and retrieving values in Collections.

Array List – Array List is a better alternative to arrays because of the following advantages it offers over arrays. It resides in the System.Collection namespace.

  • Resizing – Arrays cannot be resized natively. So, one has to create a new array and copy the elements of the existing one followed by rearrangement of references for this process. Array List on the other hand work on the concept of Linked List where memory is allocated and deallocated at runtime as and when required.
  • Adding an element – To add an element we need to first create a new array, copy the values before the position where the new element is to be inserted, insert the new element and then insert the remaining elements. Again, a cumbersome process for arrays. Array Lists only need to allocate memory for the new element and resolve the references of the elements on both side of the new element.
  • Deleting an element – All elements after the element to be deleted need to be shifted forward to fill up the vacancy created by the deletion. Array Lists rely on releasing the memory occupied by the element and resolving the references of the elements on both sides.

Common Methods used by the Array List class:-

  • Add – Adds an item at the end of the Array List
  • Clear – Removes all the items from the Array List
  • Insert – Inserts an element into the Array List at the specified position
  • Reverse – Reverses the order of all the elements or a portion of the Array List
  • Remove – Deletes the item at its first occurrence
  • TrimToSize – Sets the maximum capacity to the number of elements currently in the the Array List

Other Classes that the collection namespace provides are:-

  • Queue – A Collection that works on the First-In-First-Out (FIFO) rule. Here, insertion of elements occur at the rear and deletion at the front.
  • Stack – Works on the Last-In-First-Out (LIFO) rule. Both insertion and deletion occur at the top of the stack.
  • Hash Table – It uses unique keys to access/store elements in the collection.

partho C#

C# Tutorial : Lesson 06 – Creating Value Types & Reference Types – Part I

July 23rd, 2007
Value Types & Reference Types

In C#, Variables are either value types or reference types depending on what they store, values or references. By reference we imply that the variable holds the memory address of another location where the actual value is stored. All built in data types – Int, Char, String, Float, Boolean, etc are value types while classes are reference types. The following is a diagrammatic representation of these two types.

In this picture there are two variables Num1 and Num2. Both of these being integer variables store the values directly.

The two variables in this case are actually objects of a car class. As you can see, they do not store the values directly but only a pointer to the memory location where the value is actually stored.

Consider the following code snippet:-

1
2
3
4
5
6
int Num1, Num2;
Num1 = 100;
Num2 = Num1;
Num1 ++;
Console.WriteLine("Num1={0}", Num1);
Console.WriteLine("Num2={0}", Num2);

Here we declare two integer variables, Num1 and Num2. On line 2 we set the value of Num1 to 100 and at line 3, we copy the value of Num1 to Num2. Both Num1 and Num2 now store 100. In the next line, we increment the value of Num1 by 1, thus it stores 101 now. This doesn’t make any change in the value of Num2 as both of them are value types and have a separate storage location in the memory. Finally, we display the numbers and the output comes as:-

Num1=101
Num2=100

Now take a look at this code snippet:-

1
2
3
4
5
6
Car Ferrari, McLaren;
Ferrari = new Car("F2004");
McLaren = Ferrari;
McLaren.Model = "F2002";
Console.WriteLine("Ferrari={0}", Ferrari.Model);
Console.WriteLine("McLaren={0}", McLaren.Model);

Two objects of the Car class are declared. We instantiate Ferrari by using the new keyword, passing the value F2004 to its constructor which sets the Model to F2004. The third line McLaren = Ferrari; copies the value stored by the object Ferrari to McLaren. All classes being reference types, the objects store the memory address of the actual storage location. Hence, by copying Ferrari to McLaren, we are actually copying the memory location. Now both Ferrari & McLaren are pointing to the same physical location in the memory. In the next line, the model for the McLaren is changed to F2002. This doesn’t make any change to the value stored by the McLaren object, i.e the memory address. The change occurs in the storage location pointed to by the McLaren object. Since, Ferrari is pointing to the same memory location this change reflects there as well and the results of the last two lines are:-

Ferrari=F2002
McLaren=F2002

Structures

A structure is a value data type which is used to group related heterogeneous data types. Say you want to store the details of all the employees of your company such as – Name, Post, Salary, Joining Date, etc. In such a scenario we can create a structure named employee which would be composed of these fields. We use the struct keyword to create structures with the following syntax:-

struct StructureName
{
member variable 1
member variable 2

}

Structures are similar to classes in the sense that they contain data members and functions, have access specifiers and need to be instantiated, but they do have notable differences such as:-

  • Structures are value types whereas classes are reference types
  • Structures can not be inherited
  • They cannot have default constructor

Example Usage:-

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
struct Employee
{
	public string Name;
	public string Post;
	public int Salary;
	public string JoiningDate;
}
static void Main(string[] args)
{
	Employee Emp1 = new Employee();
	Console.WriteLine("Enter Employee's Name");
	Emp1.Name = Console.ReadLine();
	Console.WriteLine("Enter Employee's Post");
	Emp1.Post = Console.ReadLine();
	Console.WriteLine("Enter Employee's Salary");
	Emp1.Salary = Console.ReadLine();
	Console.WriteLine("Enter Employee's Joining Date");
	Emp1.JoiningDate = Console.ReadLine();
}

Note: Unlike in other languages such as C/C , structures in C# can have member functions.

Enumeration

Enumeration is another value data type that we use to store non generic values such as the name of the day – Sunday, Monday, etc. One may question the need for enumeration considering that we can use the string data type to store the names. But, one could assign just about any value to the day, which we certainly don’t want. We could also use the numbers from 0 – 6 to denote the 7 days. However, that doesn’t clarify whether 0 is for Sunday or Saturday. The enum keyword is used to create an enumerated data type with the following syntax:-

enum EnumDataType { Value1, Value2, and so on }

Example usage:-

1
2
3
4
5
6
enum Month { Jan, Feb, Mar, Apr, May, Jun, Aug, Sep, Oct, Nov, Dec };
static void Main(string[] args)
{
	Month ThisMonth;
	ThisMonth = Month.May;
}

Note:- The values of an enumerated data type are assigned in design time and not at runtime using the Console.Read or Console.ReadLine method.

Arrays

An array is a collection of values of the same data type, grouped under the same name and referred to by their distinct indexes. This is how they are represented in the memory.

Declaration

Syntax:-

datatype[] ArrayName;

  • Where datatype is the type of data that the array will store – int, string, char, etc.
  • [] Specifies the size of the array.
  • ArrayName is the name with which we would be using the array.
  • Example usage:-

    int[] Marks;

    Initialization
    Memory is allocated to the array only when it is instantiated. The instantiation can be done in the following methods. Once initialized a default value is assigned to all of the elements depending on their data type – 0 for int, “” (NULL String) for char or string, etc.

    Syntax:-

    ArrayName = new datatype[size];

    This step can be done along with the declaration.

    datatype[] ArrayName = new datatype[size];

    Example Usage:-

    int[] Marks = new int[10];

    Note: This creates 10 elements starting from 0 to 9

    Assigning values
    Each element of the array can be accessed by specifying their index along with the ArrayName.

    ArrayName[index] = value;

    Example:-

    Marks[5] = 99;

    Values can also be assigned during declaration as follows:-

    datatype[] ArrayName = {value1, value2, value3 and so on};

    Example:-

    int[] Marks = {100, 13, 69, 99};

    Using this process implicitly sets the size for the array. In this case it would be 4. The elements can be accessed by their indexes starting from 0 to 3. Note: In C# Index always starts at 0.

    Using the following is equivalent to using the above line of code.

    int[] Marks = int[4] {100, 13, 69, 99};

    Copying an Array
    You can copy an array just as easily you copy other variables. Example:-

    1
    2
    
    int[] Source = {0, 1 , 2, 3, 4};
    int[]Destination = Source;

    One point to note is that an array being a reference type, both these arrays point to the same location in memory and any change made in either of them would be reflected in the other one as well. To make separate copies of the array, we need to copy each of the elements individually. The code below does just that.

    1
    2
    3
    4
    5
    6
    
    int[] Source = { 0, 1, 2, 3 };
    int[] Destination = new int[Source.Length]; // Set the size of the destination to be the same as that of the source
    for (int I = 0; I < Source.Length; I  )
    {
    	Destination[I] = Source[I];
    }

    This step can be done along with the declaration.

    datatype[] ArrayName = new datatype[size];

    Example Usage:-

    int[] Marks = new int[10];

    Note: This creates 10 elements starting from 0 to 9

    partho C#

FileZilla – Open Source FTP Client

July 19th, 2007

FileZillaNo matter what the critics say, FTP still is the best way to transfer your web pages and associated files to the server. FileZilla is an open source, simple, quick and reliable FTP client that packs in a lot of features. The software targeted at the 32 bit Microsoft Windows platforms, is licensed under the GNU General Public License. All in all, a must have for all the site administrators out there.

Here’s a listing of some of it’s features.

  • FTP & SFTP Protocol support
  • Site Manager to store connection & initialization details
  • Support for Proxy
  • Multi-threaded download/upload
  • ASCII/Binary/Auto Transfer Modes
  • Download/Upload En-queuing

Links:-

Source Forge Project

partho Freeware

Venturing into the World of Game Programming

July 18th, 2007

Yesterday, I found an excellent article on how to begin Game Programming using the DirectX API. The tutorials are based on the CLR brothers C# and VB .NET. I would recommend going along with C# because the tutorials are not 100% VB .NET tested.

Since then, I have had to download the Direct X SDK and re-format my Windows partition. Thanks to the power failure attributing to Visual Studio Orcas Uninstallation going berserk. That wasn’t the end of it though. The old nLited Unattended CD of Windows XP SP2 which was backed up on the CD-RW blew as well.

Back to the tutorials! The entire article being well explained is divided into 8 parts. I’ve managed to sail through the first two. Although, I cannot say that everything was crystal clear. This whole venture requires a lot of background learning on the basis of the co-ordinate system and patience is the key.

Here goes the link.

partho General