Sunday, January 28, 2007

Passing objects into Methods in Java

Having worked with C/C++ extensively for couple of year, now I am refreshing my memory on Java..It's kinda difficult to do away with C/C++ practices :) Thought the following post might be of interest to you.

Is parameter passing in Java by reference or by value?
Bottomline: Everything in java is passed by value. But objects are NEVER passed to the method!

myth: objects are passed by reference, primitives are passed by value. (This is wrong)

Pass by reference means, you are working with the actual pointer that points to the object. For example, this is how C++ works.


When java passes an object to a method, it first makes a copy of a reference to the object, not a copy of the object itself.

The following example illustrates the point.

public class PassByValueTest {

class Point {
int x;
int y;
public Point(int x, int y) {
this.x = x;
this.y = y;
}

public void setPoint(int x, int y) {
this.x = x;
this.y = y;
}

public String toString() {
return "Point[x="+x+",y="+y+"]";
}
}

public void method1(Point pt){
pt.setPoint(5, 5);
}

public void method2(Point pt){
pt = new Point(10,10);
}

public Point createPoint(){
return new Point(1,1);
}


public static void main(String [] args){
PassByValueTest test = new PassByValueTest();
Point p = test.createPoint();
System.out.println("Before calling method1: "+ p.toString());
strTest.method1(p);
System.out.println("After calling method1: "+ p.toString());
strTest.method2(p);
System.out.println("After calling method2: "+ p.toString());
}

Output:
Before calling method1: Point[x=1,y=1]
After calling method1: Point[x=5,y=5]
After calling method2: Point[x=5,y=5]

Notice that values inside the Point object get changed after calling method1, but not after method2. That's becasue, a copy of a reference to Point object p is passed, not the actual refernce itself. This is the key difference from languages like C++.

ref1(address) ---> p (object) <--- copyref1(address)

copyref1 is passed into method1. We modify the object pointed to by copyref1 which is the actual object. Therefore the mofications remain even after calling method1.

copyref1 is passed into method2. When our code gets out of method2, it does not affect the object pointed to by ref1. The new object created inside method2 simply garbage collected by the JVM.

Futher reading:
http://www.yoda.arachsys.com/java/passing.html
http://www-128.ibm.com/developerworks/library/j-praxis/pr1.html
http://javadude.com/articles/passbyvalue.htm

Monday, January 22, 2007

Beware of "Storm Worm"

Storm Worm is a trojan horse attack baiting people with weather information. It spreads through emails. The email carries the subject "230 dead as storm batters Europe".

People who open the attachment becomes part of a botnet, which attackers can exploit later without the knowledge of the user. It's kinda social engineering in that it tries to fool people by giving timely alert about current deadly weather conditions prevailing in most parts of the world. The attachment is an executable file which promises to give more details about the weather conditions. Opening the attachement creates a backdoor which can be later exploited later to steal data or use post malicious spams.

Sunday, January 21, 2007

Introduction to C++ Programming [Part 3]

Previous Related Posts: Part1 Part2

C++ Data Types

There are two groups of built-in data-types; fundamental types and derived types. The fundamental types represent integers and floating-point numbers. The derived types include arrays, strings, pointers and structures. We’ll first look at fundamental types. The following table gives you the data types available, their memory usage and the range of values they can take.


Data Type

Size (in bytes)

Range of values

unsigned short int

2

0 to 65,535

short int

2

-32,768 to 32,767

unsigned long int

4

0 to 4,294,967,295

long int

4

-2,147,483,648 to 2,147,483,647

int (16 bit)

2

-32,768 to 32,767

int (32 bit)

4

-2,147,483,648 to 2,147,483,647

unsigned int (16 bit)

2

0 to 65,535

unsigned int (32 bit)

2

0 to 4,294,967,295

char

1

256 character values

float

4

1.2e-38 to 3.4e38

Double

8

2.2e-308 to 1.8e308

bool

1

true or false



It should be noted that sizes of the data types vary with the platform. C++ standard does not specify exact sizes for data types, as no one choice is suitable for all computer designs. C++ offers a flexible standard with some guaranteed minimum sizes;

· A short integer is at least 16 bits

· An integer is at least as big as short

· A long integer is at least 32 bits and at least as big as int.

Unsigned types don’t hold negative values. To represent floating-point numbers you can either use decimal representation (e.g.: 234.45) or use E notation (e.g.: 2,3445e+2).

A word about the type bool is in order. This type was recently introduced to C++. Earlier C++ used to interpret nonzero values as true and zero values as false (this is still valid). Now you can use the type bool to represent true and false, and the predefined literals true and false represent those values.


Variables

To store an item of information in a computer, the program needs to keep track of three fundamental properties.

· Where the information is stored

· What value is kept there

· What kind of information is stored

We declare variables to keep track of these properties.

Syntax:

Data_type variable_name; //declare a variable

Variable_name = value; //assign a value

Or

Data_type variable_name = value; //declare and assign a value

e.g.: int iAge;

unsigned int uiCounter;

You can create more than one variable of the same type in one statement.

e.g.: long lSize, lWeight;

int iAge = 30, iID, iCityCode = 501;

The type used in the declaration describes the kind of information, and the variable name represents the value symbolically. The program allocates large enough memory space to hold the data. A variable can hold different values of the same data type during the execution of the program.

Naming Rules:

· The only characters you can use in names are alphabetic characters, digits and the underscore character.

· The first character in a name cannot be a digit.

· Variable names are case sensitive.

· You can’t use a C++ keyword for a name. (e.g.: void, return , main)

· C++ places no limits on the length of a name, and all characters in a name are significant.

C++ is a strongly typed language, meaning that you must declare any variable before it is used in the program.

e.g.:

#include <iostream>

using namespace std;

int main()

{

int iIntValue = INT_MAX; //initialize iIntvalue to max int value

cout << "int takes " <<"\n";

cout << "int takes " <<"\n";

cout << "The max int value is "<<"\n";

return 0;

}

INT_MAX is a symbol defined in limits.h file and represents the largest possible value that an int can take. sizeof() function (defined in the compiler) takes either the data type or variable name and returns the number of bytes it occupies in the memory.

The output would be something similar to the following. (Exact values might vary with the system you are using)

int takes 4 bytes

int takes 4 bytes

The max int value is 2147483647

C++ allows you to create aliases for data types. We use the typedef keyword to do so.

Syntax: typedef type type_name;

e.g.: Creating an alias for the type unsigned short int

typedef unsigned short int USHORT;

Now you can use USHORT instead of unsigned short int.

e.g.: USHORT usMyVariable;

Constants

After you initialize a constant, its value is set; the compiler does not let you subsequently change the value. It is a good programming practice to define constants rather than using numeric or character values. When you want to change the value, you only need to change the constant declaration.

Syntax:

const type name = value;

e.g.: const int DAYS = 7;

The const qualifier is used to indicate that the item is a constant. You can assign a value to a constant only when you declare it.

You can use #define statement (e.g.: #define DAYS 7) to create symbolic constants. But it is better to use this only when it is absolutely necessary. const lets you specify the type explicitly, but #define doesn’t. Further, you can use C++’s scoping rules (which we’ll look at under functions) to limit the definition to particular functions or files.

The C++ enum facility provides an alternative means to const for creating symbolic constants, which we’ll be looking at under derived types.

In the next lesson, we'll be starting from operators and control structures.

Implications of shooting down satellites

As you have probably heard in news, China recently shot down one of their own satellites from ground as part of missile testing.


(Courtesy: Time magazine)

Implications:
In the event of a major war, first thing the china would probably do to shoot down all the lower orbit spy satellites.
At the moment, it seems that China is demonstrating military capabilities mainly at United States.
Possible damages that can be caused by the space debris left by the shooting.
New international laws to prevent activities in space which is harmful to many nations.

Here's the article on Time magazine for more information.

Saturday, January 20, 2007

Dawn of a new year based on Islamic calendar

According to the Islamic calendar, which is based on the Lunar system, today is the first day of Muharrum, 1428!!! (Muharrum is the first month of the Islamic calendar)

Friday, January 19, 2007

Top Five Technologies Being Tested This Year

According to a survey conducted by ComputerWorld, here are the top five technologies being tested this year.

1. Server Virtualization
The idea is to increase the CPU utilization and decrease the number of servers required.

2. Document Management
In addition to picking the right content and shipping it out to the right aggregator at the right moment, they are looking at extending the product to support internal processes such as contract management, marketing and business development.

3. Content Security/Control
Idea is to have a centrally manageable devices for content security.

4. Asset Management
5. Business Process Management

You can find the complete article here.

Wednesday, January 17, 2007

TrueCrypt to mitigate phishing attacks

As we all know, phishing attacks are on the rise, one solution to this problem is to use encryption.

I came across a cool open source software TrueCrypt (4.2) which does the work for you. It supports Windows and many flavors of Linux. According their web site, following are the main features.

  • Creates a virtual encrypted disk within a file and mounts it as a real disk.
  • Encrypts an entire hard disk partition or a storage device such as USB flash drive.
  • Encryption is automatic, real-time (on-the-fly) and transparent.
  • Provides two levels of plausible deniability, in case an adversary forces you to reveal the password:

    1) Hidden volume (steganography – more information may be found here).

    2) No TrueCrypt volume can be identified (volumes cannot be distinguished from random data).
  • Encryption algorithms: AES-256, Blowfish (448-bit key), CAST5, Serpent, Triple DES, and Twofish.
    Mode of operation: LRW (CBC supported as legacy).


One feature that is not yet available is boot sector encryption, which is available in Microsoft windows Vista.

Introduction to C++ Programming [Part 2]

Previous Related Posts: Part1

Compiling a C++ Source

In general under Unix, compiling a C++ source MySource.C is done as follows.

g++ MySource.C
This produces a binary program (a.out). Compilation and linking is done in one go.

If the default name is not wanted, the name of the executable can be specified using the -o flag:

g++ -o MySource MySource.C

If only a compilation is required, the compiled module can be generated using the -c flag:

g++ -c MySource.C

This produces the file MySource.o, which can be linked to other modules later on.

First Program

#include <iostream>

using namespace std;

int main()

{

cout << "My First Program";

cout << "\n";

return 0;

}

Once you compile and run the program, you should see the following output:

My First Program

_

Note:

If you are using an older compiler, you might need to use #include <iostream.h >; instead of #include <iostream>; in that case, you also would omit the using namespace std; line.

Some windowing environments run the program in a separate window and automatically close the window when the program finishes. You can make the window stay open until you strike a key by adding the statement cin.get(); before the return statement.

How this works:

Every C++ program should have a main() function. When you run a C++ program, execution always starts at the beginning of main() function. In general, a function is a block of code that performs one or more actions. Usually functions are invoked or called by other functions, but main() is exceptional. main(), like all functions, must state what kind of value it will return. The return value type for main() in this example is int, which means that this function returns an integer.

C++ uses a preprocessor. As the name suggests, this is a program that processes a source file before the main compilation takes place. You don’t have to do anything special to invoke this preprocessor. It automatically operates when you compile the program. Preprocessor processes directives that begin with #.

For example, #include is a preprocessor directive. This directive causes the preprocessor to add the content of iostream file to your program. This data is used by the cout in your program. Your original file is not altered, but a composite file formed from your file and iostream goes to the next stage of compilation.

Header files

Files such as iostream are called include files or header files. The C tradition has been to use the h extension with header files as a simple way to identify the type of file by its name. C++ header files have no extension.

E.g.: iostream.h in C and just iostream in C++

There are also C header files that have been converted to C++ header files. These files have been named by dropping the h extension and prefixing the file name with a c.

E.g.: math.h in C changed to cmath in C++

Namespace

Namespacing support is a new C++ feature designed to simplify the designing of programs that combine pre-existing code from several vendors.

One potential problem is that you might use two prepackaged products that both have the functionality, say update(). If you then use the update() function, the compiler won’t know which version you mean. The namespace facility solves this problem. It allows a vendor to package the functionality into a container called namespace. The namespace should be unique among vendors. If the two vendors place their functionality in namespaces A and B, then the full name for their update() function would be A::update() and B::update() respectively.

cout and many other predefined objects are placed under the standard namespace called std. So the full name for cout is std::cout. You don’t need to prefix each cout with std::, if you use the directive using namespace std; at the beginning of your program. Any predefined function/object, which does not have a prefix, is then assumed to be under std namespace.

cout

cout is the standard output stream of C++. Data is written to the output stream using the insertion operator <<. It can display variety of things including string, numbers, etc. The stream cout is actually an object of a given class. This is defined in the iostream header file. “\n” (newline character) is a special formatting character used to move the cursor to next line. You could use the keyword endl instead of “\n” in the above example.

cout << “My First Program”;

cout << endl

Or

cout << “My First Program” << endl

Coding style

C++ identifies the end of a statement by a semicolon. Carriage return or any other special character does not have any meaning. This means you can spread a single statement over several lines or place several statements on one line. Although C++ gives you much formatting freedom, your program will be easier to read if you follow a sensible style. Most of the C++ programmers follow this style;

· One statement per line

· An opening and closing brace for a function, each of which is on its own line

· Statements in a function indented from the braces

· No white spaces around the parentheses associated with a function name

In the next lesson, we'll be looking at C++ data types. Until than, Happy coding!

Digital Advertising Tools by Microsoft

Microsoft has got into the business of building research tools that show marketers how consumers behave online. All the technologies are designed to help provide the better advertising experiences for users, advertisers and developers.


Microsoft adCenter Labs focus on 7 new areas.

  • keyword and content technologies
  • ad selection and relevance
  • audience intelligence
  • social networking
  • video
  • platforms
  • devices

Some of the technologies are…

  • Keyword Services Platform. The platform provides a set of Web service APIs related to keyword technologies, including keyword recommendation, forecasting, categorization and monetization, enabling developers to build more intelligent applications for online advertising and beyond.
  • Commercial intent detection. Advanced keyword analysis helps differentiate consumers who are looking to make an online purchase from those who are searching for information about products or performing other tasks.
  • Large display feedback. Vision-based technology creates interactive public displays that can measure the size of the audience, as well as track audience gestures and estimate demographics.
  • Social video sharing. This next-generation video sharing solution features a synchronized “commenting” technology. The introduction of novel in-video, synchronized comments enables a new level of interaction between users, opening up the video as a medium for collaboration.
  • Content classification: By accurately analyzing and matching the Web pages included in search results, Microsoft adCenter Labs technology helps increase the probability that the ads displayed during Web searches are relevant to consumers.
Some Related news >>

Microsoft's ad pitch underpins Net moves

Introduction to C++ Programming [Part 1]

Introduction To C++

Programming has evolved from procedural, structured to object-oriented. Earliest programs were thought of as a series of procedures that acted upon data. A procedure, or function, is a set of specific instructions executed one after the other. The data was quite separate from the procedures, and the trick in programming was to keep track of which functions called which other functions, and what data was changed. It was virtually impossible to understand a program by reading it and modifying such a program was a nightmare.

To get around the potential confusions, structured programming (a more disciplined style of programming) was created. The main idea behind structured programming is to divide and conquer (top-down approach). A computer program can be thought of as consisting of a set of tasks. Any task that is too complex to be described simply would be broken down into a set of smaller component tasks, until the tasks were sufficiently small and self-contained enough that they were easily understood. This approach was enormously successful for solving complex problems.

With time many deficiencies in structured programming became clear. It does not mimic the way we are thinking. It is natural to think of your data and what you can do with your data as related ideas. It does not promote reusability; programmers found themselves constantly reinventing new solutions to old problems. The idea behind reusability is to build components that have known properties, and then to be able to plug them into your program, as you need them. Programs are becoming increasingly interactive, and it has become important to design for that kind of functionality. Structured programming is more biased towards old-fashioned step-by-step user interfaces.

Object oriented programming attempts to address these issues. It provides techniques for managing enormous complexity, achieves reuse of software components, and couples data with the tasks that manipulate that data.

C++ fully supports object-oriented programming, including the four pillars of object-oriented development: encapsulation, data hiding, inheritance, and polymorphism, which we’ll be looking at in detail as we move along.

C++ was initially developed by Bjarne Stroustrup in the early 1980’s. C++ was developed by adding OOP features to C without significantly changing the C component. C++’s OOP aspect was inspired by a computer simulation language called Simula67. C++ is a superset of C, meaning that any valid C program is a valid C++ program too.

A touch of OOP

A touch of OOP would be useful for you to have a good mind-set on C++ programming. OOP emphasizes the data, unlike structured programming which emphasizes algorithms. The idea is to design data forms that correspond to the essential features of a problem. In C++, a class is a specification describing a new data form and an object is a particular data structure constructed according to that plan. For example, a class could describe the general properties of a teacher, while an object would represent a specific teacher, say, Mr. Perera.

In general, a class defines what data are used to represent an object and the operations that can be performed upon that data. The following example should make this point more clear.

You are writing a computer program capable of drawing circles. You could define a class to describe the circle; the data part would contain center, radius, thickness and colour attributes and the operations part would have move, resize, delete, copy, change colour, change thickness operations. Then you use this to create an object according to class specification. The object will hold the values describing the circle and you can use the class methods to modify that circle. If you draw two circles, the program will create two objects, one for each circle.

It should be clear that the OOP approach to program design is to first design classes that accurately represent those things with which the program deals. Then you proceed to design a program using objects of those classes. It follows a bottom-up approach, where you proceed from a lower level of organization, such as classes, to a higher level, such as a program design.

OOP is more than binding data and methods into a class specification. It facilitates creating reusable code which can save a lot of work. Information hiding safeguards data from improper access. Polymorphism lets you create multiple definitions for operators and functions. Inheritance lets you derive new classes from old ones.

Standards

If you can run a program without changing the source code on different platforms (with different C++ compilers), we say the program is portable. There are two obstacles for portability; hardware and language divergence.

Hardware specific programming is less likely to be portable. A good programming practice is to minimize the use of hardware specific functionality.

Compilers from different vendors might have slight incompatibilities. This inevitably creates the problem of language divergence. To minimize this, the Accredited Standards Committee, operating under the procedures of the American National Standards Institute (ANSI), started to create an international standard for C++. Today, most of the compiler vendors support ANSI/ISO C++ standard.

Steps of creating a program

The diagram shown below explains the process. Source code is your program written in a text editor. Compiler converts your source code to machine language and the output is called the object code. Linking combines your object code with object code for the functions you use (user created libraries and built-in libraries) and with some standard startup code to produce a runnable version of your program, which is called the executable code.



The extension you use for source files depends on the C++ implementation. Linux systems use C, cc, cxx or c whereas Windows systems use cpp or cxx.

Tuesday, January 16, 2007

You name an acronym, it's there!

I came across this interesting acronym finder site which gives the meanings of acronyms along with how popular they are. The speciality of this site is that, acronyms are compiled human edited by Mike Molly and his wife, Susan Ebert. It has more than half a million of acronyms and grows about 200 per day.

Monday, January 15, 2007

I Have a Dream

"I have a dream that one day little black boys and black girls will be able to join hands with little white boys and white girls as sisters and brothers

I have a dream today"
-Martin Luther King, Jr.

Sunday, January 14, 2007

Who’ll win the battle over the trademark “iPhone”?

You might have seen the short speech by Steve Jobs at the annual technology convention. He unveiled Apple’s latest product, iPhone, which is a combination of an iPod, phone and Internet communicator. The big new these days is not the release of the product itself but the trademark. The trademark iPhone belongs to Cisco. I am sure Cisco will Sue Apple Inc. over this issue. We’ll have to wait and see who’ll win the battle.

Why Java doesn’t allow static variables inside methods?

As you may already know that static variables in Java are scoped to the class. I couldn’t find the exact answer as to why it is this way, but my guess is that when you make a variable static, your intension is to have that variable available across multiple calls to the method where you want to have the static variable. Under this circumstance, the scope of the variable is over and above the method scope. It’s like using a private member variable. The approach taken by Java may improve the clarity, but it may violate encapsulation requirements.

Friday, January 12, 2007

The Parable of the Black Belt

Picture a martial artist kneeling before the master sensei in a ceremony to receive a hard-earned black belt. After years of relentless training, the student has finally reached a pinnacle of achievement in the discipline.

"Before granting the belt, you must pass one more test," says the sensei.

"I am ready," responds the student, expecting perhaps one final round of sparring.

"You must answer the essential question: What is the true meaning of the black belt?"

"The end of my journey," says the student. "A well-deserved reward for all my hard work."

The sensei waits for more. Clearly, he is not satisfied. Finally, the sensei speaks. "You are not yet ready for the black belt. Return in one year."

A year later, the student kneels again in front of the sensei.

"What is the true meaning of the black belt?" asks the sensei.

"A symbol of distinction and the highest achievement in our art," says the student.

The sensei says nothing for many minutes, waiting. Clearly, he is not satisfied. Finally, he speaks. "You are still not ready for the black belt. Return in one year."

A year later, the student kneels once again in front of the sensei. And again the sensei asks: "What is the true meaning of the black belt?"

"The black belt represents the beginning -- the start of a never-ending journey of discipline, work, and the pursuit of an ever-higher standard," says the student.

"Yes. You are now ready to receive the black belt and begin your work."

Source: Built to Last: Successful Habits of Visionary Companies, by James C. Collins and Jerry I. Porras

Earning a PhD is no different!

Six Traits of a Successful Graduate Student

1 [Initiative]
"The difference between people who exercise initiative and those who don't is literally the difference between night and day. I'm not talking about a 25 to 50 percent difference in effectiveness; I'm talking about a 5000-plus percent difference, particularly if they are smart, aware, and sensitive to others."
- Stephen R. Covey, The 7 Habits of Highly Effective People

Foster a "can do" attitude

2 [Tenacity]
"Let me tell you the secret that has led me to my goal. My strength lies solely in my tenacity."
- Louis Pasteur

Stick with things even when you get depressed or when things aren't going well.

3 [Flexibility]
"Back in graduate school, I'd learned how to survive without funding, power, or even office space. Grad students are lowest in the academic hierarchy, and so they have to squeeze resources from between the cracks. When you're last on the list for telescope time, you make your observations by hanging around the mountaintop, waiting for a slice of time between other observers. When you need an electronic gizmo in the lab, you borrow it in the evening, use it all night, and return it before anyone notices. I didn't learn much about planetary physics, but weaseling came naturally."
- Clifford Stoll, The Cuckoo's Egg

"The Chinese call luck opportunity and they say it knocks every day on your door. Some people hear it; some do not. It's not enough to hear opportunity knock. You must let him in, greet him, make friends and work together."
- Bernard Gittelson

Take advantage of opportunities and synergies, working around problems, and be willing to change plans as required.

4 [Interpersonal skills]
"For humans, honesty is a matter of degree. Engineers are always honest in matters of technology and human relationships. That's why it's a good idea to keep engineers away from customers, romantic interests, and other people who can't handle the truth."
- Scott Adams, The Dilbert Principle

"I can calculate the motions of the heavenly bodies, but not the madness of people."
- Isaac Newton

Treat people with respect and determining their different working styles. Give credit where credit is due. Acknowledge and thank them for their help. Return favors. Respect their expertise, advice and time. Apologize if you are at fault. Realize that different people work in different ways and are motivated by different things

5 [Organizational skills]
"Failing to plan is planning to fail."

Organize your tasks as if you were juggling them.

6 [Communications skills]
"What is written without effort is, in general, read without pleasure."
- Samuel Johnson

"Present to inform, not to impress; if you inform, you will impress. "
- Fred Brooks

Confidence is the key.

Source: http://www.cs.unc.edu/%7Eazuma/hitch4.html

Dirty hack to get google map working for me

My requirement was to show addressing details plus some additional details when a user click on a marker in google map. The additional detail I set, always got reset to the last user data in my array. Investigating the cause, I found that, google map API does not call addAddressToMap callback function (code shown below) each time when I iterate through the loop. Rather, it calls these callback functions at the end. So, I decided to use a global variable to hold additional details. Having fixed that, I ran into another problem. I had to declare a local variable to copy the global value and then add a listener to each marker object. Here's the complete javascript source.

var map;
var geocoder;
var detail;
var marker;
var counter = 0;
var details = new Array()
var locations = new Array()

//------------------------------------------------------------
//user information
//you can populate these arrays using an xml file for example
details[0] = 'Mohamed Nabeel
CS Graduate Student (2006)';

locations[0] = 'Galle, Sri Lanka';
details[1] = 'Farrukh Mateen
ME MS Student (2006)';

locations[1] = 'Islamabad, Pakistan';
var headcount = 2;
//------------------------------------------------------------

function addAddressToMap(response) {
if (!response || response.Status.code != 200) {
alert("Sorry, we were unable to geocode that address");
} else {
var place = response.Placemark[0];
var detailx;
var point = new GLatLng(place.Point.coordinates[1],
place.Point.coordinates[0]);
var marker = new GMarker(point);
detailx = details[counter++];

GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(detailx + '
' + place.address);});

map.addOverlay(marker);
}
}

// showLocation() is called when you click on the Search button
// in the form. It geocodes the address entered into the form
// and adds a marker to the map at that location.
function showLocation(address) {
geocoder.getLocations(address, addAddressToMap);
}

function load() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(0,0), 1);
geocoder = new GClientGeocoder();
var i = 0;
for(;i
showLocation(locations[i]);
}
}
}

Wednesday, January 10, 2007

Switching To Blogger

I used to blog at bloglines and decided to switch to Blogger. You can access all my past post at bloglines from here.