Archive for the ‘Blogging’ Category

What is Mailserver

Sunday, September 21st, 2008

What is a Mailserver?

A mailserver is a family of programs that answer email automatically. These programs are also called list servers. A good mailserver will be able to filter out spam, and prevent your mailbox from being clogged. A mailserver can be installed on the main Web server, or on a separate server.

It has two programs installed: Sendmail program and POP program

1) Sendmail Program

This program allows the mailserver to process outgoing email. If an email address does not exist, the mailserver will return the mail to the sender.
If the sender sends the mail to a particular email address and if that email address does not exist then the mailserver send the mail back to the sender.
If any technical problem arises during the mail delivery, the mail might be returned back to the sender. In all cases in which mail is returned, it arrives with an explanation or error code. By reading the error code you can determine why the mail failed to reach its destination.

2) POP  Program

The POP (Post Office Protocol) program collects incoming email. As it receives mail, it creates a single text file of accumulated messages for each email address. If the end-user has configured his or her email client to delete mail from the server upon collection, the mailserver’s text file is wiped when the mail is collected. Some people, however, store email on the mailserver. This is not only a privacy concern, but can also lead to malfunctions on the mailserver when text files become too lengthy.

Technorati Tags:

Server log files

Sunday, September 21st, 2008

In today competitive world it has become necessary to keep track of our visitors. As a business policy you should know :

* Who is visiting our Web site * What browsers do they use?
* Where do they go in the site * What pages do they look at?
* How long they stay at our site? etc.

The answers to these questions would be found in  Server log files

A server log is a file (or several files) automatically created and maintained by a server.
Your Web server log files contain much useful information such as :

  • Which pages get the most traffic – and the least.
  • What sites are referring visitors to you.
  • Which pages visitors look at.
  • What browsers and operating systems are most popular with visitors.
  • When search engine spiders and directory editors visit.

This information often helps webmasters to figure out problems on our web site. Using log file we get detail information of our visitors. Once we know from where we are getting targeted traffic then it becomes easy for us to take necessary steps for maintaining and improving traffic from particular search engine.

The server stores visitor information in files with the .log extension, nearly all of the major Web servers use a common format for this log files. These log files contain information such as the IP address of the remote host, the document that was requested, and a timestamp.

The syntax for each line of a log file is:

site logName fullName [date:time GMToffset] “req file proto” status length

Each of the eleven items listed in the above syntax and example are described in the following list.

  • site-either an IP address or the symbolic name of the site making the HTTP request
  • logName - login name of the user who owns the account that is making the HTTP request. Most remote sites don’t give out this information for security reasons. If this field is disabled by the host, you see a dash (-) instead of the login name.
  • fullName - full name of the user who owns the account that is making the HTTP request. Most remote sites don’t give out this information for security reasons. If this field is disabled by the host, you see a dash (-) instead of the full name. If your server requires a user id in order to fulfill an HTTP request, the user id will be placed in this field.
  • Date - date of the HTTP request.
  • Time - time of the HTTP request. The time will be presented in 24-hour format.
  • GMToffset - signed offset from Greenwich Mean Time. GMT is the international time reference.
  • req - HTTP command. For WWW page requests, this field will always start with the GET command.
  • file-path and filename of the requested file.
  • proto-type of protocol used for the request.
  • status-status code generated by the request.
  • length-length of requested document.

These data can be combined into a single file, or separated into distinct logs, such as an access log, error log, or referrer log. However, server logs typically do not collect user-specific information.

These files are usually not accessible to general Internet users, only to the webmaster or other administrative person. A statistical analysis of the server log may be used to examine traffic patterns by time of day, day of week, referrer, or user agent.

Technorati Tags:

Web Site Design and SEO

Tuesday, September 16th, 2008

There are many important factors for good SEO results of a website. First of all comes the Domain Name, Hosting Service Selection, Website Design and Launching of website on World Wide Web. Finally your SEO efforts by getting more and more in-bound links.
The Domain Name is treated as address of your website. Always choose an unique domain name with one of keyword in it mathching your business. The Domain Name should give a short idea of your website.Selection of proper host appropriate hosting plan according to your requirement is a next thing you should do. You should be very much focussed on website designing.Make sure that customer should be satisfied with content of the website and also match his requirement.Avoid graphics and other technologies which take a lot of time to load a website.This may cause to loose customers as no one likes to wait so long.Proper linking should be there within the pages. Use of anchor texts is very important as they are more as keywords than anchor text. The text written on web pages should be easy for visitors to read and understand. Proper use of fonts and background should be made. Keyword phrases used should match the requirement of search engine spiders and search engine users. Use of different title tags on each page of a website helps in optimisation. Proper use of meta tags is also important factor in search engine rankings. There should not be any spelling or grammatical mistake. In short site should be properly edited. Avoid using flash, frames and popups. Browser Compatibility should be checked before submission of your website.

Technorati Tags:

Java Code for working with Database

Tuesday, September 16th, 2008

Here is a simple example to select a row from a database and to display that information.
/*== database constants ==*/
string dbhost = “localhost”;
string dbname = “directory”;
string dbuser = “webuser”;
string dbpass = “–password–”;

string dbdriver = “org.gjt.mm.mysql.Driver”;

/*== setup database driver and connect ==*/
Class.forName(DBDRIVER).newInstance();
string conurl = “jdbc:mysql://”+dbhost+”/”+dbname;
Connection db = DriverManager.getConnection(conurl,dbuser,dbpass);

/*== create sql query and execute ==*/
string sql = ” SELECT firstname,lastname FROM users “;

Statement stmnt = db.createStatement();
ResultSet rs = stmnt.executeQuery(sql);
/*== display results ==*/
while (rs.next())
{
out.println(”Name: “+rs.getString(”firstname”)+ ” ” + rs.getString(”lastname”) +”\n”);
}

Technorati Tags:

How to access cookies set at the client side

Tuesday, September 16th, 2008

Class javax.servlet.http.cookies can be used to access cookies on the client side. The following code demonstrates this technique. It checks the existence of cookie MyCookie.

boolean dcookiefound = false;

Cookie[] cookies = request.getCookies();

for(int nIndex=0;nIndex < cookies.length;nIndex++)
{
if(cookies[nIndex].getName().equals(“MyCookie”))
{
dcookiefound = true;
//desired cookie found, use it
}

}

if(dcookiefound == false)
{
//cookies not found.
}

Technorati Tags:

FZip- A Rocking Actionscript 3 Class Library

Monday, September 15th, 2008

FZip is an Actionscript 3 class library to progressively load standard ZIP compressed files into a Flash movie and extract,decompress contained files on-the-fly, while the archive is still loading.

Fzip is really useful when you want to load many files into your ongoing project such as images for gallery, icons, thumbails btmaps etc

Note that in order to be able to decompress compressed files in a ZIP archive, FZip requires the presence of an Adler32 checksum in addition to the standard CRC32 checksums contained in ZIP archives (this can be readily managed with a few lines of server-side scripting).
FZip was written by Claus Wahlers and Max Herkender
Originally posted by Matteo; For more detail and demo visit these site;

Fzip – http://codeazur.com.br/lab/fzip/
Fzip demo – http://codeazur.com.br/lab/fzip/demo/

Technorati Tags:

How to read client side cookies from a servlet

Monday, September 15th, 2008

It is easy to read the cookies from a servlet.
Cookies[] getCookies() returns an array of Cookie objects.

// Check for cookies
Cookie[] cookies = request.getCookies();

// Check to see if any cookies exists
if (cookies != null)
{
for (int i =0; i< cookies.length; i++)
{
Cookie aCookie = cookies[i];
System.out.println (Name : + Cookie.getName());
System.out.println (Value:  + Cookie.getValue());
}
}

Technorati Tags:

Transferring MySQL database to new server.

Monday, September 15th, 2008

Transferring MySQL database to new server.

While transferring from one host to another you need to take many precautions, one of them is of your database (MySQL).
You should backup all your database files before it is transferred. You can do it so using two methods :

1) Using third party tool such as PhpMyAdmin.

2) Using ” dump” tool which comes bundled with MySQL.

Using PhpMyAdmin :

It is a PHP script which gives ability to interact you database.
To manage and manipulate MySQL databases use options under “export” section of PhpMyAdmin. Select the appropriate database and zip up the files it can save you bandwidth and time to download the backup file.

Now to transferring onto new server, first create a new database, unzip files and extract the backup then restore your database.
It also lets you mess up the database directly. There is no “undo” or “undelete” in your database. Always exercise caution when working with the database.
Most host have their control panel PhpMyAdmin pre-installed.

Using dump tool :

You have to use different commands at command line environment or UNIX shell environment.
Type command :

mysqldump -u [username] -p [password] –opt [databasename] > backup.sql

this command will take backup of your database.

Now on the new server, you can restore the database by inputting the following command:

mysql -u [username] -p [password]
The options in brackets need to be filled out with the appropriate information, such as, the username and password. It is also a good idea to take a “dump” of your database regularly for backup purposes in case the server fails or you have a corrupt database.

Database for any business plays a vital role so to preserve it you should take maximum precaution.

Technorati Tags:

Migrating to new host

Monday, September 15th, 2008

For some reasons, you decided to move your site at new host.
Before moving to new host , plan your migration properly otherwise you may end up in a mess.
When you migrate to new host you get new DNS, new IP and new content ( if you manage for it )
Now you may think that you have migrated so why to keep any data at old server so you may put blank pages over there, keeping the old server still live.
This is most worst mistake which is usually done by webmasters which causes their new migrated site to get banned even though there is nothing wrong in it.

The reason for this is :
Since old server is still live, some Googlebots were using the old DNS/old IP and went to old serever and they received a blank page there, other Googlebots were going to new server they were using new DNS, new IP, new Contents. Due to this Google was getting two different pages at same time hence it consider it as an ” Cloaking ” and you are banned for such mistake.

How to avoid this :
*) Bring a copy of your site up at the new IP address.

*) Update your nameserver to point to the new IP address.

*) Once you see search engine spiders fetch pages from the new IP address, then be sure to take down the copy of your site at the old IP address.

*) Do not do all of the changes at the same time.

*) Make sure there are never two servers responding to requests for your domain dishing out different content.

Technorati Tags:

How to protect a directory under Apache

Monday, September 15th, 2008

This can be done with .htaccess, visitors must input username and password before they can access the protected directory.

Step 1.
Create the file “.htaccess” with the following content under the directory you want to protect, you can specify the password in any place as long as Apache can access it.

AuthUserFile /home/account/passwd/.htpasswd
AuthGroupFile /dev/null
AuthName “Title”
AuthType Basic
require valid-user

Step 2.
Generate the password file “.htpasswd” under the directory /home/account/passwd/ with the following command:
# htpasswd -c .htpasswd user_name

You will be reminded to input password for the user “user_name”, this command can be called multi times to generate multi users.

Step 3.
This step may not be necessary. If there is an entry about the directory you want to protect in Apache configuration file, make sure AllowOverride has the option authconfig.

For example, when protecting Awstats pages, the Apache configuration file should be modified as following:
Options None
AllowOverride authconfig
Order allow,deny
Allow from all

Restart Apache
# /usr/local/sbin/apachectl restart

Technorati Tags: