Know more and connect with me on [Linkedin Profile].

Monday, December 05, 2005

Free Excellent Kids Drawing Program



This is a nice program for kids that allow them to draw.

HomePage:
http://www.newbreedsoftware.com/tuxpaint/

Screen Shots:
http://www.newbreedsoftware.com/tuxpaint/screenshots/

Download:
http://www.newbreedsoftware.com/tuxpaint/download/

Monday, November 28, 2005

Yahoo: From Dot-Com Survivor to Web 2.0 Powerhouse



This is a good article about innovations at Yahoo, it is clear Google
challenged minds and now competition and innovation became at full speed.
--
Through a series of clever acquisitions and in-house creations, Yahoo Inc.
has transformed itself from a dot-com survivor into a Web 2.0 powerhouse driven
by blogs, podcasts and other forms of user-generated social media.

Read more at:
Yahoo: From Dot-Com Survivor to Web 2.0 Powerhouse

Saturday, November 26, 2005

Data Structures Review

Preliminaries:

Floor Function: Floor (3.14) == 3

Ceiling Function: ceiling(3.14) == 4

Reminder Function: The result remaining after dividing x on y.

Absolute Value: Abs(-233) == 233 and Abs(233) == 233

Factorial Function: Factorial(4) == (4*3*2*1) ; factorial symbol is !



Permutations: There are n! of arrangement alternatives when using n elements

Exponents: 3^2 == 3 * 3 == 9

Logarithm: b^y = x is equivalent to y = Logb(x)
Log 100 = 2 and Log 1000 = 3

Linear Search: If you have a list of items, you have to check all list items to find a given x value. Worst case;
worst = n [i.e. checking all the items as the searched item is the last item]
average = (n+1)/2

The Big O Notation:
As number of items n increases, the algorithm will take more time, but the order of increase can be quiet different:
Log2 n: grows most slowly
2^n grows the most rapidly
n^m grows depends on the value of m, but generally rapid more than Log2 n.



Arrays:
Linear arrays: a set of elements that has sequential locations in memory.

Bubble Sort: Sorting n numbers means swapping elements until all elements be located in increasing order.
Phases, so that each phase will pass on all elements to push the largest element to the end of the list. Obviously, on each phase, we will pass on n-1, n-2, n-3, elements and so on.

void Bubble(int *data, int n)
{
int phases = n - 1;
int last = phases;
for(int j=0; j <= phases; j++) { last--; for(int i=0; i<=last; i++) { if(data[i] > data[i+1])
swap(data[i], data[i+1]);
}
}
}

Bubble sort has the O(n^2) in comparisons and n-1 phases.

Linear/sequential Search:
Given n elements, and trying to find some value, just pass on all the array elements, comparing each element with the given one.

int Linear(int *data, int value)
{
int loc = -1;
for (int i=0, i< loc =" i;">

Binary Search:
Binary search is extremely efficient given that the input data is sorted and you have direct access to the middle(actually any data element).
The algorithm is similar to what you do when you search a word in paper based dictionary, first you open the middle page to know if the word is in the first have or second half, and so on. A recursive function usually make developing the algoithim is so simple.

Complexity is order of Log2 n


Sparse Matrix:
A matrix that has many element as zeros or empty. It is efficient to store sparse matrixes in list that array to save space.

Linked Lists:
A groups of elements, each has a pointer to the next, the last has a NULL pointer, and there is a pointer to the first element.

Given a list of items that not sorted, and we need to search for a specific value, we can start for head of list until tail and compare each element with the given one. This is similar to linear search.

If the linked list is sorted in ascending order, we can just terminate the linear search once reach an element that is greater than the given value. The complexity order is just like linear search, Order on n.

Memory Allocation: Instead of dynamically allocate and free memory for each item in the linked list, we can just allocate a pool and take from it, this pool could be a list of the same data structure.

Header Linked List: A linked list that has aground node - the last node - and a header node, usually has a circular that the last node points at the first node.

Double Linked List: A linked list that each item has a pointer to next item and another pointer to previous item.




Stacks:
Just like a stack of dishes, so that last in is first out, and first in is last out.
Push > pushes an element at the top of the stack.
Pop > removes an element from the stack, at the top.

Stacks can be implemented easily using lists.


Quick Sort:
Quick sort is an algorithm of the divide-and-conquer type, the problem of sorting a set is reduced to the problem of sorting two sets and so on. Recursive algorithm is usually used in this sort.

1- given an element, scan from left to make sure no element is smaller than it, if so swap.
2- scan from right to left to find a value that is lower than it, if so swap.
3- if no swapping, so you have two sets and your value is now at the middle.
4- Treat each subset with the same steps form 1 to 3, if you have just a set of one or two sorted elements, just return.

The running time is measured by the number of comparison, which is: f(n) = O( n*Log n).


Recursion:
One function that requires a call to itself in order to finish. There are rules to avoid forever loop, with each recursive call you should be near the base value.
Usually recursive algorithms can be modified to normal algorithms using stacks.


Towers Of Hanoi:
Very interesting algorithm that is very easy to implement using recursion, it is based also on the concept of divide-and-conquer.
The base algorithm:

You have n disks stacked on peg A so that no disk is over a smaller disk. And you need to move all disks from A to C using auxiliary peg B, without violating the rule.

Look at this pseudo code:

Tower(n, BEG, END, AUX)
{
if (n == 1)
{
move from BEG to END
return;
}
Tower(n-1, BEG, AUX, END);
move BEG to END;
Tower(n-1, AUX, END, BEG);
}

Implementation of Recursive Function using Stack:
By using stack to store all info, we can convert the recursive routine to a non-recursive routine.

Queues:
First in First out. The queue has rear and front, all new items are added to rear, and all removed items are removed from front.

Dequeus:
Elements can be added or removed at either rear or front but not the middle.

Priority Queue:
First in First out for all items with the same priority, but higher priority is processed first.

Monday, October 31, 2005

Interview Plan

I am going to have an interview one month from now, it is so important for me to make the switch, although the I already moved from being a c++/java programmer to be a project manager, but the only chance to work abroad in US or Canada is to have a technical job. So welcome back to technology, especially I moved to management career just for a better salary, as management in our country earns better salary.

Although exciting, I will not be shocked if failed, I just will do my best and I have a complete one month to prepare myself, in all cases I will not lose anything, just reviewing my technical knowledge and skills.

But as you know, I have to have a plan, so let us start:
First we have to make task list:

Task List:

- OOP [done, I will just make a final review later]
- UML
- SQL
- Data structures and algorithms
- C++
- C# and ANS.NET [sadly, most of my experience is with java not C#, but no problem]
- English [as English is my second language, I have to improve my vocabulary and conversation skills]
English is the only one that have to be practiced daily basis, news have to be read in English, stress on grammar, and daily I must listen to some English especially US technical English.

I have difficulty making structured plan to myself, however it is somewhat easy in my work to create a plan for a certain project! But I have to do.

Tasks size estimation:

- OOP [done, took 5h (hours), another 1h for review]
- UML [4h]
- SQL [3h, 1h]
- Data structures and algorithms [20h]
- C++ [10h]
- C# and ANS.NET [30h]
- English listening [40h ]
- English grammar [20h]
- Design for my critical applications [10h]

to be continued...

Sunday, October 30, 2005

OOP Fundamental Concepts

OOP (Object Oriented Programming):
As opposed to the procedural arrangement of code, OOP is organizing code into classes and objects that imitate real world.

Fundamental concepts:

Abstraction: Focusing on the essential characteristics of some object while ignoring the unnecessary details, relative to the perspective of the viewer.

Encapsulation: Each object exposes an interface that specifies how other objects may interact with it, so the internal state can't be changed in unexpected way. Essentially hiding the implementation complexities and details.
With encapsulation, a class can be reimplemented without system side effects as long as the class interface is not broken.

Modularity: The act of partitioning a program into individual components. This will reduce program complexity, even some modules can be changed without side effects as long as the interface remain fixed.

Hierarchy: the mapped relationships of sub- and super-classes is known as a hierarchy. This can be visualized as an upside-down tree, the top of which is known as the root.

Persistence: The ability of some object to save state across time.

Links: One object to use the services of another object.

Aggregation: The containment of an object to another object as one of its members.

Aggregation & Composition: Aggregation differs from ordinary composition in that it does not imply ownership. In composition, when the owning object is destroyed, so are the contained objects. In aggregation, this is not necessarily true. For example, a university owns various departments (e.g., chemistry), and each department has a number of professors. If the university closes, the departments will no longer exist, but the professors in those departments will. Therefore, a University can be seen as a composition of departments, whereas departments have an aggregation of professors. In C++ we can say the university contains departments objects by value, but contains pointer to professors.

Sometimes aggregation is referred to as composition when the distinction between ordinary composition and aggregation is unimportant.

Using Relationship:
An object function that instantiate objects from other classes and use their services within the scope of the function.

Access Control: The class define access control to its members, so members that related to internal implementation should have restricted access from the outside world.

Polymorphisms: An object can represent many types as long as they belong to a common superclass, so that sending a message to the object will give different action depending on the actual value of the variable at the moment. Without this feature we will end up having a big switch case to decide which object-function to call.

Polymorphic Function: multiple function definitions with different parameters with same name.

Multiple Polymorphisms: Using a virtual function as in c++, you can make polymophism, making the parameter itself a polymorphic object will give us the opportunity to create multiple polymorphism to any degree. Suppose we have a virtual draw function that draw a circle, or rectangle based on the actual subclass of the object, suppose we want to draw on many media types such as Printer or Screen, we can make Printer and Screen as a subclass of Device and send an object of it to the original draw function. Now the function will draw on the exact Device based on two things: the exact object, rect or circle and the exact device, Printer or Screen.

Overloading: Overloading allows multiple functions taking different types to be defined with the same name.

Interface: Specify one or more abstract method signatures, used by subclasses.

Subclasses and superclasses: Classes are often related in some way. The most popular of these relations is inheritance, which involves subclasses and superclasses, also known respectively as child classes (or derived classes) and parent classes (or base classes).

* This is the basics from my point of view, sure I am affected with my c++/java experience, any comments?

References:
1) www.wikipedia.org
2) Object Oriented Analysis and Design with Applications by Grady Booch

Friday, October 28, 2005

Amazing Ajax Application, gmail.com


gmail !

Using AJAX technologies, you can feel the same experience of Desktop application with a web based application. Really a killer to Desktop email applications. With 2.5 Giga, it seems I will never need more space. I have more than one email account, now I am reading all of them through gmail and really enjoying it.

I just have a problem with Arabic encoding, I sometimes receive Arabic incorrectly, but I still have a work around, just click "More options" then "Message text garbled?" to see the Arabic email correctly.

I hope this problem resolved at gmail, but I have no way to report it to Google, any help?