Showing posts with label M.E. Show all posts
Showing posts with label M.E. Show all posts

Study and configuration of various servers

1.   Study and configuration of various servers.
Every Web site sits on a computer known as a Web server. This server is always connected to the internet. Every Web server that is connected to the Internet is given a unique address made up of a series of four numbers between 0 and 255 separated by periods.for example, 68.178.157.132 or 68.122.35.127.

When you register a Web address, also known as a domain name, such as tutorialspoint.com you have to specify the IP address of the Web server that will host the site. You can load up with Dedicated Servers that can support your web-based operations.
There are four leading web browsers: Apache, IIS, lighttpd and Jagsaw. Now we will see these servers in bit more detail.

Apart from these Web Servers, there are other Web Servers also available in the market but they are very expansive. Major ones are Netscape's iPlanet, Bea's Web Logic and IBM's Websphere.
Proxy server

A proxy server is a computer that offers a computer network service to allow clients to make indirect network connections to other network services. A client connects to the proxy server, then requests a connection, file, or other resource available on a different server. The proxy provides the resource either by connecting to the specified server or by serving it from a cache. In some cases, the proxy may alter the client's request or the server's response for various purposes.

Step 1
First of all you will need proxy servers (proxys) for your Internet Browser. You can get some free proxy servers for test here or you can buy VIP access to have fastest and most stable public proxy servers here.

Step 2
Good! You have proxy server(s), lets say that one is: 210.176.165.168:3128. Now you will need to start Internet Explorer. Click on Tools (circle #1) menu and select Internet Options... (circle #2) in the list as shown below.
                             
Step 3
Move to the Connections (circle #1) tab. At the bottom of the window in the Local Area Network (LAN) settings section click on the LAN Settings... (circle #2) button as shown bellow.

Step 4
First of all check the box labeled Use a proxy server (circle #1) and after click on Advanced (circle #2) button as shown below.


Step 5
Type your proxy servers IP address under Proxy address to use (circle #1) label and proxy port under Port (circle #2) field as shown below. Check the box labeled Use the same proxy server for all protocols (circle #3) as shown below. Click OK (circle #4) button


Now you have successfully setup proxy for your Internet Explorer.
E-mail Server:

Introduction
hMailServer is an email server for Microsoft Windows. It allows you to handle all your email yourself without having to rely on an Internet service provider (ISP) to manage it. Compared to letting your ISP host your email, hMailServer adds flexibility and security and gives you the full control over spam protection. hMailServer is an efficient as well as powerful email server which has variety of features and can be maintained and configured easily.
SMTP
SMTP stands for Simple Mail Transfer Protocol. SMTP is used when email is delivered from an email client, such as Outlook Express, to an email server or when email is delivered from one email server to another. SMTP uses port 25.
POP3

POP3 stands for Post Office Protocol. POP3 allows an email client to download an email from an email server. The POP3 protocol is simple and does not offer many features except for download. Its design assumes that the email client downloads all available email from the server, deletes them from the server and then disconnects. POP3 normally uses port 110.
IMAP

IMAP stands for Internet Message Access Protocol. IMAP shares many similar features with POP3. It, too, is a protocol that an email client can use to download email from an email server. However, IMAP includes many more features than POP3. The IMAP protocol is designed to let users keep their email on the server. IMAP requires more disk space on the server and more CPU resources than POP3, as all emails are stored on the server. IMAP normally uses port 143.


Installing hMailServer
Step 1: Download
The first step is to download hMailServer. The installation program is available for download at http://www.hmailserver.com/

Step 2: Install

  • Double-click on the downloaded file to launch the setup. The first dialog which is shown is the Welcome dialog, in this one, simply click Next.
  • The next step is to read the license agreement. If you don't accept the license agreement, please cancel the installation. If you agree, select "I accept the agreement" and click next.
  • Select the destination folder and click Next. You should select a local drive and not a network folder. It is possible to install hMailServer on removable devices, but you will not be able to run hMailServer from the device on another computer.
  • Select which components you want to install and click Next. On the server, you should install all available components. If you have already installed the hMailServer server on another computer and you want to manage that remotely, you only need to install the Administrative tools.
  • Select which start menu folder you want to place the hMailServer icons in and click Next.
  • After the files have been installed, you need to provide the installation program with a main hMailServer password. The password can be anything you like as long as it's longer than 5 characters. You will need the password later on when performing server administration, so don't forget it. You only need to specify the password the first time you install hMailServer
  • After you have finished the installation, it's time to start hMailServer Administrator (found in the start menu). The first thing which appears is the Connect dialog. This dialog allows you to connect to different hMailServer installations in your network. Normally, you will want to connect to localhost. Select localhost, and click Connect. In the password dialog, enter your main hMailServer password and click OK.

Configuring hMailServer

Connecting to hMailServer

  1. From the Start menu, select hMailServer Administrator
    Now the hMailServer Administrator - Connect dialog is opened. This dialog allows you to connect to different hMailServer services.
  2. Double-click on the "localhost" host name to connect to the hMailServer instance running on localhost.
  3. In the password dialog, specify the password you specified during the installation of hMailServer - the main hMailServer administration password, and then click OK
  4. Now hMailServer Administrator is started.

Domains & Accounts

Every hMailServer domain should be connected to an internet domain. Say that you're the owner of the domain something.com, then you should add something.com as a domain in hMailAdmin. If you wish to use your email server locally then you do not need an internet domain name. Just specify any domain name which would be used locally through LAN.
  1. Start hMailAdmin.
  2. Click Add domain.
  3. Enter something.com as domain name.
  4. Click Save
The next step is to add accounts to your server. The normal setup is to have one account per email address you want to be able to send and receive email from. If you want the addresses webmaster@something.com and info@something.com, simply add this to hMailAdmin:
  1. Start hMailAdmin
  2. Expand the Domains node in the tree to the left
  3. Click on the domain something.com
  4. Click Add account
  5. Enter webmaster as the account address, set the password and click Save
  6. Click on the domain something.com in the tree to the left
  7. Click Add account
  8. Enter info as the account address, set the password and click Save

Specifying public host name

For an email server to work properly, it needs to know its public name on the Internet. This is normally something like mail.something.com. Since there is no good way for software to automatically detect the public host name of the computer where it is running, you need to tell hMailServer what public hostname to use. While it's possible to run hMailServer without telling it its public hostname, some email servers will reject email from you if you don't specify it.
  1. Start hMailAdmin
  2. In the tree to the left, go to Settings -> Protocols -> SMTP
  3. To the right, the SMTP settings are now shown. Click on the Delivery of e-mail tab.
  4. Under host name, enter the public hostname of the computer where hMailServer is running.
  5. Save the change

Configure firewalls

Make sure that any firewall running on the same server as hMailServer is configured to allow incoming traffic on ports 25, 110 (for POP3) and 143 (for IMAP).
Configuring Windows Live Mail (Email client)
  1. Install Windows Live Mail on Windows7
  2. Open Windows Live Mail and go to “Accounts” Tab
  3. Select “Email”
  4. “Add Your Email Accounts” Window will be displayed
  5. Enter the email address and password of email account created in hMailServer
  6. Click Next. Select “Server Type” as POP. In the “Server Address” field enter the address of email server. If you are using a local email server then enter the IP address of computer on which hMailServer is installed.
  7. Click Next and account is ready.
  8. Now you can create, send and receive emails from hMailServer using Windows Live Mail


Socket & Networking Programming


ARP :

    import java.net.InetAddress;
    import java.net.NetworkInterface;
    import java.net.SocketException;
    import java.net.UnknownHostException;
    import java.util.Scanner;
    
    public class MacAddress {
            public static void main(String[] args){
                        try{                 
    Scanner console = new Scanner(System.in);
    System.out.println("Enter System Name: ");
    String ipaddr = console.nextLine();
    InetAddress address = InetAddress.getByName(ipaddr);
    System.out.println("address = "+address);
    NetworkInterface ni = NetworkInterface.getByInetAddress(address);
   
    if (ni!=null){
            byte[] mac = ni.getHardwareAddress();
            if (mac!= null){
            System.out.print("MAC Address : ");
            for (int i=0; i<mac.length; i++){
            System.out.format("%02X%s", mac[i], (i<mac.length - 1) ? "-" :"");
            }
    }
    else{
            System.out.println("Address doesn't exist or is not accessible/");
            }
    } 
else{
            System.out.println("Network Interface for the specified address is not found");
            }
  }
  catch(Exception e){   }
  }
}

OUTPUT:





UDP Chat Application
MyClient.java  :
import java.io.*;
import java.net.*;
public class MyClient {
public static void main(String[] args) {
try{     
Socket s=new Socket("localhost",6666);      
DataOutputStream dout=new DataOutputStream(s.getOutputStream());
dout.writeUTF("Hello Server");
dout.flush();
dout.close();
s.close();
}catch(Exception e){System.out.println(e);}
}
}







MyServer.java :
import java.io.*;
import java.net.*;
public class MyServer {
public static void main(String[] args){
try{
ServerSocket ss=new ServerSocket(6666);
Socket s=ss.accept();//establishes connection
DataInputStream dis=new DataInputStream(s.getInputStream());
String  str=(String)dis.readUTF();
System.out.println("message= "+str);
ss.close();
}catch(Exception e){System.out.println(e);}
}
}


Introduction html,css,style sheet

What is HTML?
HTML is the "mother tongue" of your browser.
To make a long story short, HTML was invented in 1990 by a scientist called Tim Berners-Lee. The purpose was to make it easier for scientists at different universities to gain access to each other's research documents. The project became a bigger success than Tim Berners-Lee had ever imagined. By inventing HTML he laid the foundation for the web as we know it today.
HTML is a language, which makes it possible to present information (e.g. scientific research) on the Internet. What you see when you view a page on the Internet is your browser's interpretation of HTML. To see the HTML code of a page on the Internet, simply click "View" in the top menu of your browser and choose "Source".
HTML is used to make websites. It is as simple as that!
HTML is an abbreviation of "HyperText Mark-up Language" – which can be defined as follows.
  • Hyper is the opposite of linear. In the good old days - when a mouse was something the cat chased - computer programs ran linearly: when the program had executed one action it went to the next line and after that, the next line and so on. But HTML is different - you can go wherever you want and whenever you want. For example, it is not necessary to visit MSN.com before you visit HTML.net.
  • Text is self-explanatory.
  • Mark-up is what you do with the text. You are marking up the text the same way you do in a text editing program with headings, bullets and bold text and so on.
  • Language is what HTML is. It uses many English words.
The basic structure for all HTML documents is simple and should include the following minimum elements or tags:
·        <html> - The main container for HTML pages
·        <head> - The container for page header information
·        <title> - The title of the page
·        <body> - The main body of the page
Remember that before an opening <html> tag, an XHTML document can contain the optional XML declaration, and it should always contain a DOCTYPE declaration indicating which version of XHTML it uses.
Now we will explain each of these tags one by one. In this tutorial you will find the terms element and tag are used interchangeably.

The <html> Element:

The <html> element is the containing element for the whole HTML document. Each HTML document should have one <html> and each document should end with a closing </html> tag.
Following two elements appear as direct children of an <html> element:
·        <head>
·        <body>
As such, start and end HTML tags enclose all the other HTML tags you use to describe the Web page.

The <head> Element:

The <head> element is just a container for all other header elements. It should be the first thing to appear after the opening <html> tag.
Each <head> element should contain a <title> element indicating the title of the document, although it may also contain any combination of the following elements, in any order:
·        The <base> tag is used to create a "base" url for all links on the page. Check HTML Base tag.
·        The <object> tag is designed to include images, JavaScript objects, Flash animations, MP3 files, QuickTime movies and other components of a page. Check HTML Object tag.
·        The <link> tag is used to link to an external file, such as a style sheet or JavaScript file. Check HTML Link tag.
·        The <style> tag is used to include CSS rules inside the document. Check HTML Style tag.
·        The <script> tag is used to include JAVAScript or VBScript inside the document. CheckHTML Script tag.
·        The <meta> tag includes information about the document such as keywords and a description, which are particularly helpful for search applications. Check HTML Meta tag.

Example:

Following is the example of head tag.
<head>
<title>HTML Basic tags</title>
<meta name="Keywords" content="HTML, Web Pages" />
<meta name="description" content="HTML Basic Tags" />
<base href="http://www.tutorialspoint.com" />
<link rel="stylesheet" type="text/css" href="tp.css" />
<script type="text/javascript">
_uacct = "UA-232293";
urchinTracker();
</script>
</head> 

The <title> Element:

You should specify a title for every page that you write inside the <title> element. This element is a child of the <head> element). It is used in several ways:
·        It displays at the very top of a browser window.
·        It is used as the default name for a bookmark in browsers such as IE and Netscape.
·        Its is used by search engines that use its content to help index pages.
Therefore it is important to use a title that really describes the content of your site. The <title> element should contain only the text for the title and it may not contain any other elements.

Example:

Here is the example of using title tag.
<head>
<title>HTML Basic tags</title>
</head>

The <body> Element:

The <body> element appears after the <head> element and contains the part of the Web page that you actually see in the main browser window, which is sometimes referred to as body content.
A <body> element may contain anything from a couple of paragraphs under a heading to more complicated layouts containing forms and tables.
Most of what you will be learning in this and the following five chapters will be written between the opening <body> tag and closing </body> tag.

Example:

Here is the example of using body tag.
<body>
   <p>This is a paragraph tag.</p>
</body>

Putting all together:

Now if we will put all these tags together, it will constitute a complete HTML document as follows:
<html>
 
<head>
<title>HTML Basic tags</title>
<meta name="Keywords" content="HTML, Web Pages" />
<meta name="description" content="HTML Basic Tags" />
<base href="http://www.tutorialspoint.com" />
<link rel="stylesheet" type="text/css" href="tp.css" />
<script type="text/javascript">
_uacct = "UA-232293";
urchinTracker();
</script>
</head>
 
<body>
   <p>This is a paragraph tag.</p>
</body>
 
</html>

HTML Images

Images are very important to beautify as well as to depicts many concepts on your web page. Its is true that one single image is worth than thuasands of words. So as a Web Developer you should have clear understanding on how to use images in your web pages.

Insert Image - The <img> Element:

You will insert any image in your web page by using <img> tag. Following is the simple syntax to use this tag.
 
<img src="image URL" attr_name="attr_value"...more attributes />
 

Image Attributes:

Following are most frequently used attributes for <img> tag.
·        width: sets width of the image. This will have a value like 10 or 20%etc.
·        height: sets height of the image. This will have a value like 10 or 20% etc.
·        border: sets a border around the image. This will have a value like 1 or 2 etc.
·        src: specifies URL of the image file.
·        alt: this is an alternate text which will be displayed if image is missing.
·        align: this sets horizontal alignment of the image and takes value either left, right orcenter.
·        valign: this sets vertical alignment of the image and takes value either top, bottom orcenter.
·        hspace: horizontal space around the image. This will have a value like 10 or 20%etc.
·        vspace: vertical space around the image. This will have a value like 10 or 20%etc.
·        name: name of the image with in the document.
·        id: id of the image with in the document.
·        style: this will be used if you are using CSS.
·        title: specifies a text title. The browser, perhaps flashing the title when the mouse passes over the link.
·        ismap and usemap: These attributes for the <img> tag tell the browser that the image is a special mouse-selectable visual map of one or more hyperlinks, commonly known as an image map. We will see how to use these attributes in Image Links chapter.

A Simple Example:

<img src="http://www.tutorialspoint.com/images/html.gif" alt="HTML Tutorial" />
This will produce following result:
HTML Tutorial

Image Attributes - width, height, title, border and align:

Now let us try to set some more attributes:
<img src="http://www.tutorialspoint.com/images/html.gif"
alt="HTML Tutorial" width="100" height="100" 
border="2" align="right" title="HTML Tutorial" />
This will produce following result:
HTML Tutorial
Remember that all the images will have a border by default. In our examples its not showing because our global style sheet has set img {border:0px;} which means that no border will be displayed till it is mentioned explicitly.

HTML Tables

Tables are very useful to arrange in HTML and they are used very frequently by almost all web developers. Tables are just like spreadsheets and they are made up of rows and columns.
You will create a table in HTML/XHTML by using <table> tag. Inside <table> element the table is written out row by row. A row is contained inside a <tr> tag . which stands for table row. And each cell is then written inside the row element using a <td> tag . which stands for table data.


Example:

<table border="1">
<tr>
<td>Row 1, Column 1</td>
<td>Row 1, Column 2</td>
</tr>
<tr>
<td>Row 2, Column 1</td>
<td>Row 2, Column 2</td>
</tr>
</table>
This will produce following result:


CSS Introduction

What is CSS?

Cascading Style Sheets, fondly referred to as CSS, is a simple design language intended to simplify the process of making web pages presentable.
CSS handles the look and feel part of a web page. Using CSS, you can control the color of the text, the style of fonts, the spacing between paragraphs, how columns are sized and laid out, what background images or colors are used, as well as a variety of other effects.
CSS is easy to learn and understand but it provides powerful control over the presentation of an HTML document. Most commonly, CSS is combined with the markup languages HTML or XHTML.

Advantages of CSS:

·        CSS saves time - You can write CSS once and then reuse same sheet in multiple HTML pages. You can define a style for each HTML element and apply it to as many Web pages as you want.
·        Pages load faster - If you are using CSS, you do not need to write HTML tag attributes every time. Just write one CSS rule of a tag and apply to all the occurrences of that tag. So less code means faster download times.
·        Easy maintenance - To make a global change, simply change the style, and all elements in all the web pages will be updated automatically.
·        Superior styles to HTML - CSS has a much wider array of attributes than HTML so you can give far better look to your HTML page in comparison of HTML attributes.
·        Multiple Device Compatibility - Style sheets allow content to be optimized for more than one type of device. By using the same HTML document, different versions of a website can be presented for handheld devices such as PDAs and cell phones or for printing.
·        Global web standards - Now HTML attributes are being deprecated and it is being recommended to use CSS. So its a good idea to start using CSS in all the HTML pages to make them compatible to future browsers.

CSS Inclusion - Associating Styles

There are four ways to associate styles with your HTML document. Most commonly used methods are inline CSS and External CSS.

Embedded CSS - The <style> Element:

You can put your CSS rules into an HTML document using the <style> element. This tag is placed inside <head>...</head> tags. Rules defined using this syntax will be applied to all the elements available in the document. Here is the generic syntax:
<head>
<style type="text/css" media="...">
Style Rules
............
</style>
</head>

Attributes:

Attributes associated with <style> elements are:
Attribute
Value
Description
type
text/css
Specifies the style sheet language as a content-type (MIME type). This is required attribute.
media
screen
tty
tv
projection
handheld
print
braille
aural
all
Specifies the device the document will be displayed on. Default value isall. This is optional attribute.

Example:

Following is the example of embed CSS based on above syntax:
<head>
<style type="text/css" media="all">
h1{
color: #36C;
}
</style>
</head>

Inline CSS - The style Attribute:

You can use style attribute of any HTML element to define style rules. These rules will be applied to that element only. Here is the generic syntax:
<element style="...style rules....">

Attributes:

Attribute
Value
Description
style
style rules
The value of style attribute is a combination of style declarations separated by semicolon (;).

Example:

Following is the example of inline CSS based on above syntax:
<h1 style ="color:#36C;"> This is inline CSS </h1>
This will produce following result:

Inline CSS

External CSS - The <link> Element:

The <link> element can be used to include an external stylesheet file in your HTML document.
An external style sheet is a separate text file with .css extension. You define all the Style rules within this text file and then you can include this file in any HTML document using <link> element.
Here is the generic syntax of including external CSS file:
<head>
<link type="text/css" href="..." media="..." />
</head>

 

 

 

 

Attributes:

Attributes associated with <style> elements are:
Attribute
Value
Description
type
text/css
Specifies the style sheet language as a content-type (MIME type). This attribute is required.
href
URL
Specifies the style sheet file having Style rules. This attribute is a required.
media
screen
tty
tv
projection
handheld
print
braille
aural
all
Specifies the device the document will be displayed on. Default value isall. This is optional attribute.

Example:

Consider a simple style sheet file with a name mystyle.css having the following rules:
h1, h2, h3 {
color: #36C;
font-weight: normal;
letter-spacing: .4em;
margin-bottom: 1em;
text-transform: lowercase;
}
Now you can include this file mystyle.css in any HTML document as follows:
<head>
<link type="text/css" href="mystyle.css" media="all" />
</head>

Imported CSS - @import Rule:

@import is used to import an external stylesheet in a manner similar to the <link> element. Here is the generic syntax of @import rule.
<head>
<@import "URL";
</head>
Here URL is the URL of the style sheet file having style rules. You can use another syntax as well:
<head>
<@import url("URL");
</head>

Example:

Following is the example showing you how to import a style sheet file into HTML document:
<head>
@import "mystyle.css";
</head>

CSS Rules Overriding:

We have discussed four ways to include style sheet rules in a an HTML document. Here is the rule to override any Style Sheet Rule.
·        Any inline style sheet takes highest priority. So it will override any rule defined in <style>...</style> tags or rules defined in any external style sheet file.
·        Any rule defined in <style>...</style> tags will override rules defined in any external style sheet file.
·        Any rule defined in external style sheet file takes lowest priority and rules defined in this file will be applied only when above two rules are not applicable.

Handling old Browsers:

There are still many old browsers who do not support CSS. So we should take care while writing our Embedded CSS in an HTML document. The following snippet shows how you can use comment tags to hide CSS from older browsers:
<style type="text/css">
<!--
body, td {
   color: blue;
}
-->
</style>

CSS Comments:

Many times you may need to put additional comments in your style sheet blocks. So it is very easy to comment any part in style sheet. You simple put your comments inside /*.....this is a comment in style sheet.....*/.
You can use /* ....*/ to comment multi-line blocks in similar way you do in C and C++ programming languages.

Example:


/* This is an external style sheet file */
h1, h2, h3 {
color: #36C;
font-weight: normal;
letter-spacing: .4em;
margin-bottom: 1em;
text-transform: lowercase;
}
/* end of style rules. */