Sunday, May 27, 2007

8 Essential SEO Techniques

1) Title Tag - The title tag is the most powerful on-site SEO technique you have, so use it creatively! What you place in the title tag should only be one thing, the exact keyword you used for the web page that you are trying to optimize. Every single web page should have it's own title tag.

2) ALT Tags - ALT tags were meant to be for text browsers because the images didn't show in text browsers and the ATL tags would tell the visitor what it's about. You should put your main keyword(s) in the ALT tags, but don't over do it because you could get dropped in the results or even worse banned for life!

3) Link Popularity - Link popularity is the most powerful SEO tool out of all them. Most search engines don't even consider web sites if there is not at least one or two links pointing to the web site. Having another site(s) link to your web site is important when it comes to getting your site a good ranking. Your keywords should be in the links you get and keep the keywords short. When you receive requests for a link exchange, check the site out before linking with them, check for spam (Repeat keywords, hidden text, etc.).

4) Keyword Density - This is also vital and should be used with research. You should use the keyword(s) once in the title tag, once in the heading tag, once in bold text, and get the density between 5% to 20% (Don't over do it!). Also use your keyword(s) both low and high on the web page, keyword(s) should be in the first sentence and in the last one.

5) Page Size - Your web page's speed is important to your visitors and the search engines. Why? Because the robots will be able to spider your web page faster and easier. Try your best to keep your web page over 5k and under 15k in size.

6) Rich Theme - Search engines are looking at themes more and more. Build content (Articles, FAQ, tips, etc.) much as possible and keep the web pages around 200 to 500 words. Create content that's related to your market and link them out to other related content on your site. Try to get 200 web pages or more.

7) Web Site Design - This is also important, if you want to get indexed! Text content should out weigh the HTML content. The pages should validate and be usable in all of today's leading edge browsers. Stay away from flash and Java Script, search engines dislike them both a lot.

8) Insite Cross Linking - This will help you get all of your web pages indexed by the search engines. Your web pages should be no more than three clicks away from the home page. Link to topic related quality content across your site. This will also help build you a better theme through out your web site. On every page you should link back to your home page and your main service(s).

Search Engine Architecture

To understand SEO you need to be aware of the architecture of search engines. They all contain the following main components:

Spider - a browser-like program that downloads web pages.

Crawler – a program that automatically follows all of the links on each web page.

Indexer - a program that analyzes web pages downloaded by the spider and the crawler.

Database– storage for downloaded and processed pages.

Results engine – extracts search results from the database.

Web server – a server that is responsible for interaction between the user and other search engine components.

Specific implementations of search mechanisms may differ. For example, the Spider+Crawler+Indexer component group might be implemented as a single program that downloads web pages, analyzes them and then uses their links to find new resources. However, the components listed are inherent to all search engines and the seo principles are the same.

Spider: This program downloads web pages just like a web browser. The difference is that a browser displays the information presented on each page (text, graphics, etc.) while a spider does not have any visual components and works directly with the underlying HTML code of the page. You may already know that there is an option in standard web browsers to view source HTML code.

Crawler: This program finds all links on each page. Its task is to determine where the spider should go either by evaluating the links or according to a predefined list of addresses. The crawler follows these links and tries to find documents not already known to the search engine.

Indexer: This component parses each page and analyzes the various elements, such as text, headers, structural or stylistic features, special HTML tags, etc.

Database: This is the storage area for the data that the search engine downloads and analyzes. Sometimes it is called the index of the search engine.

Results Engine: The results engine ranks pages. It determines which pages best match a user's query and in what order the pages should be listed. This is done according to the ranking algorithms of the search engine. It follows that page rank is a valuable and interesting property and any seo specialist is most interested in it when trying to improve his site search results. In this article, we will discuss the seo factors that influence page rank in some detail.

Web server: The search engine web server usually contains a HTML page with an input field where the user can specify the search query he or she is interested in. The web server is also responsible for displaying search results to the user in the form of an HTML page.

Thursday, May 24, 2007

More Java Interview Questions

Q: What is the difference between an Interface and an Abstract class?
A: An abstract class can have instance methods that implement a default behavior. An Interface can only declare constants and instance methods, but cannot implement default behavior and all methods are implicitly abstract. An interface has all public members and no implementation. An abstract class is a class which may have the usual flavors of class members (private, protected, etc.), but has some abstract methods.

Q: Describe synchronization in respect to multithreading.
A: With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchonization, it is possible for one thread to modify a shared variable while another thread is in the process of using or updating same shared variable. This usually leads to significant errors.

Q: Difference between HashMap and HashTable?
A: The HashMap class is roughly equivalent to Hashtable, except that it is unsynchronized and permits nulls. (HashMap allows null values as key and value whereas Hashtable doesnt allow). HashMap does not guarantee that the order of the map will remain constant over time. HashMap is unsynchronized and Hashtable is synchronized.

Q: What are Checked and UnChecked Exception?
A: A checked exception is some subclass of Exception (or Exception itself), excluding class RuntimeException and its subclasses.
Making an exception checked forces client programmers to deal with the possibility that the exception will be thrown. eg, IOException thrown by java.io.FileInputStream's read() method·
Unchecked exceptions are RuntimeException and any of its subclasses. Class Error and its subclasses also are unchecked. With an unchecked exception, however, the compiler doesn't force client programmers either to catch the
exception or declare it in a throws clause. In fact, client programmers may not even know that the exception could be thrown. eg, StringIndexOutOfBoundsException thrown by String's charAt() method· Checked exceptions must be caught at compile time. Runtime exceptions do not need to be. Errors often cannot be.

Q: What are different types of inner classes?
A: Nested top-level classes, Member classes, Local classes, Anonymous classes

Nested top-level classes- If you declare a class within a class and specify the static modifier, the compiler treats the class just like any other top-level class.
Any class outside the declaring class accesses the nested class with the declaring class name acting similarly to a package. eg, outer.inner. Top-level inner classes implicitly have access only to static variables.There can also be inner interfaces. All of these are of the nested top-level variety.

Member classes - Member inner classes are just like other member methods and member variables and access to the member class is restricted, just like methods and variables. This means a public member class acts similarly to a nested top-level class. The primary difference between member classes and nested top-level classes is that member classes have access to the specific instance of the enclosing class.

Local classes - Local classes are like local variables, specific to a block of code. Their visibility is only within the block of their declaration. In order for the class to be useful beyond the declaration block, it would need to implement a
more publicly available interface.Because local classes are not members, the modifiers public, protected, private, and static are not usable.

Anonymous classes - Anonymous inner classes extend local inner classes one level further. As anonymous classes have no name, you cannot provide a constructor.

Q: When you serialize an object, what happens to the object references included in the object?
A: The serialization mechanism generates an object graph for serialization. Thus it determines whether the included object references are serializable or not. This is a recursive process. Thus when an object is serialized, all the included objects are also serialized alongwith the original obect.

Q: Give a simplest way to find out the time a method takes for execution without using any profiling tool?
A: Read the system time just before the method is invoked and immediately after method returns. Take the time difference, which will give you the time taken by a method for execution.

To put it in code...

long start = System.currentTimeMillis ();
method ();
long end = System.currentTimeMillis ();

System.out.println ("Time taken for execution is " + (end - start));

Q: What is daemon thread and which method is used to create the daemon thread?
A: Daemon thread is a low priority thread which runs intermittently in the back ground doing the garbage collection operation for the java runtime system. setDaemon method is used to create a daemon thread.

Q: What modifiers are allowed for methods in an Interface?
A: Only public and abstract modifiers are allowed for methods in interfaces.

Q: What is transient variable?
A: Transient variable can't be serialize. For example if a variable is declared as transient in a Serializable class and the class is written to an ObjectStream, the value of the variable can't be written to the stream instead when the class is retrieved from the ObjectStream the value of the variable becomes null.

Q: Explain garbage collection?
A: Garbage collection is one of the most important feature of Java. Garbage collection is also called automatic memory management as JVM automatically removes the unused variables/objects (value is null) from the memory. User program cann't directly free the object from memory, instead it is the job of the garbage collector to automatically free the objects that are no longer referenced by a program. Every class inherits finalize() method from java.lang.Object, the finalize() method is called by garbage collector when it determines no more references to the object exists. In Java, it is good idea to explicitly assign null into a variable when no more in use. I Java on calling System.gc() and Runtime.gc(), JVM tries to recycle the unused objects, but there is no guarantee when all the objects will garbage collected.

Q: What’s the difference between the methods sleep() and wait()
A: The code sleep(1000); puts thread aside for exactly one second. The code wait(1000), causes a wait of up to one second. A thread could stop waiting earlier if it receives the notify() or notifyAll() call. The method wait() is defined in the class Object and the method sleep() is defined in the class Thread.

Wednesday, May 23, 2007

Core Java Interview Questions

1. Can there be an abstract class with no abstract methods in it?
Yes

2. Can an Interface be final?
No

3. Can an Interface have an inner class?
Yes.
public interface abc
{
static int i=0; void dd();
class a1
{
a1()
{
int j;
System.out.println("inside");
};
public static void main(String a1[])
{
System.out.println("in interface");
}
}
}


4. Can we define private and protected modifiers for variables in interfaces?
No

5. What is Externalizable?
Externalizable is an Interface that extends Serializable Interface. And sends data into Streams in Compressed Format. It has two methods, writeExternal(ObjectOuput out) and readExternal(ObjectInput in)

6. What modifiers are allowed for methods in an Interface?
Only public and abstract modifiers are allowed for methods in interfaces.

7. What is a local, member and a class variable?
Variables declared within a method are “local” variables. Variables declared within the class i.e not within any methods are “member” variables (global variables). Variables declared within the class i.e not within any methods and are defined as “static” are class variables

8. What are the different identifier states of a Thread?
The different identifiers of a Thread are: R - Running or runnable thread, S - Suspended thread, CW - Thread waiting on a condition variable, MW - Thread waiting on a monitor lock, MS - Thread suspended waiting on a monitor lock

9. What are some alternatives to inheritance?
Delegation is an alternative to inheritance. Delegation means that you include an instance of another class as an instance variable, and forward messages to the instance. It is often safer than inheritance because it forces you to think about each message you forward, because the instance is of a known class, rather than a new class, and because it doesn’t force you to accept all the methods of the super class: you can provide only the methods that really make sense. On the other hand, it makes you write more code, and it is harder to re-use (because it is not a subclass).

10. Why isn’t there operator overloading?
Because C++ has proven by example that operator overloading makes code almost impossible to maintain. In fact there very nearly wasn’t even method overloading in Java, but it was thought that this was too useful for some very basic methods like print(). Note that some of the classes like DataOutputStream have unoverloaded methods like writeInt() and writeByte().

11. What does it mean that a method or field is “static”?
Static variables and methods are instantiated only once per class. In other words they are class variables, not instance variables. If you change the value of a static variable in a particular object, the value of that variable changes for all instances of that class. Static methods can be referenced with the name of the class rather than the name of a particular object of the class (though that works too). That’s how library methods like System.out.println() work. out is a static field in the java.lang.System class.

12. How do I convert a numeric IP address like 192.18.97.39 into a hostname like java.sun.com?
String hostname = InetAddress.getByName("192.18.97.39").getHostName();

13. Why do threads block on I/O?
Threads block on i/o (that is enters the waiting state) so that other threads may execute while the I/O operation is performed.

14. What is synchronization and why is it important?
With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchronization, it is possible for one thread to modify a shared object while another thread is in the process of using or updating that object’s value. This often leads to significant errors.

15. Is null a keyword?
The null value is not a keyword.

16. Which characters may be used as the second character of an identifier,but not as the first character of an identifier?
The digits 0 through 9 may not be used as the first character of an identifier but they may be used after the first character of an identifier.

17. What modifiers may be used with an inner class that is a member of an outer class?
A (non-local) inner class may be declared as public, protected, private, static, final, or abstract.

18. How many bits are used to represent Unicode, ASCII, UTF-16, and UTF-8 characters?
Unicode requires 16 bits and ASCII require 7 bits. Although the ASCII character set uses only 7 bits, it is usually represented as 8 bits. UTF-8 represents characters using 8, 16, and 18 bit patterns. UTF-16 uses 16-bit and larger bit patterns.

19. What are wrapper classes?
Wrapper classes are classes that allow primitive types to be accessed as objects.

20. What restrictions are placed on the location of a package statement within a source code file?
A package statement must appear as the first line in a source code file (excluding blank lines and comments).

21. What is the difference between preemptive scheduling and time slicing?
Under preemptive scheduling, the highest priority task executes until it enters the waiting or dead states or a higher priority task comes into existence. Under time slicing, a task executes for a predefined slice of time and then reenters the pool of ready tasks. The scheduler then determines which task should execute next, based on priority and other factors.

22. What is a native method?
A native method is a method that is implemented in a language other than Java.

23. What are order of precedence and associativity, and how are they used?
Order of precedence determines the order in which operators are evaluated in expressions. Associatity determines whether an expression is evaluated left-to-right or right-to-left

24. What is the catch or declare rule for method declarations?
If a checked exception may be thrown within the body of a method, the method must either catch the exception or declare it in its throws clause.

25. Can an anonymous class be declared as implementing an interface and extending a class?
An anonymous class may implement an interface or extend a superclass, but may not be declared to do both.

26. What is the range of the char type?
The range of the char type is 0 to 2^16 - 1.

Advanced Search Engine Optimization Techniques

The ladders covered up to this point are all quite normal and commonly agreed upon. However more advanced techniques are less simple. There are many different thoughts about what works and what the most successful strategies are. In addition, each search engine works slightly differently and advanced strategies require you to consider these differences.

It pays to learn as much as you can about different ideas and trends, and spend time deciding which is most suitable for you. Most likely, you will find a certain combination of techniques is the best plan.

To simplify the situation we can say there are two main areas of SEO:

  1. Content-based SEO: Building and optimizing the content of your website.
  2. Non-Content SEO: Any optimization technique which is unrelated to the actual content of the site.

The comparative benefits of these techniques are debated regularly in SEO circles. Many people lean heavily toward one philosophy or the other; that is, "Content Is King" versus "Content is Secondary". The arguments can get very heated but our advice is not to take either side too strongly. Both philosophies are perfectly valid and should co-exist peacefully. The smart webmaster will carefully consider all techniques and work towards the best mix.

What does SEO stands for?

For people to find your site via a search engine, the site will require a high Search Engine Results Position (SERP). This means when they search keywords phrases like SEO techniques, they will find you site page on the first page of the search engine results. Ending up on the 10 page of the search engines results will not get you any traffic.

Optimizing your website so you will obtain a high search engine results position is what SEO Techniques is all about. It is reported that 65% of all websites visited start with a search from a search engine.

Getting a high SERP is a combination of a number of things. Leaving out any of the items on the following list of SEO Techniques can result in your page not getting as high a search engine results position as it could.