Tuesday 17 January 2012

Post Office Protocol (POP)


POP3 Protocol:


The POP (Post Office Protocol 3) protocol provides a simple, standardized way for users to access  mailboxes and download messages to their computers.                                                     

When using the POP protocol all your eMail messages will be downloaded from the mail server to your local computer. You can choose to leave copies of your eMails on the server as well. The advantage is that once your messages are downloaded you can cut the internet connection and read your eMail at your leisure without incuring further communication costs.

Doing things counts far better than just learning..

lets try it from our terminal to retrieve mails..

Do the following in your terminal to retrieve your mails

*   openssl s_client -connect pop.gmail.com:995

This will open up the coonection

*  user  <username>
*  pass <password>

It will get in to your mail box.

*  list

list command will list all your mails and its  size..

*  retr <msg no>

Will display the particular message from your dropbox

*  top <msgno> <no.of.lines>

This will display the particular message with no of lines you mentioned

*  dele <msg no>

Will delete the message you mentioned

*  quit

Will close the session

Tuesday 10 January 2012

Get Started with apache

We had a good session on apache by our senior Mr.arwin. Here are some things on what we discussed on the session.


Apache:
 
   Apache is a freely available (http) web server.The work of apache is that to create a open source http server that runs on all the operating systems..

The main task of a Web server is to translate a request into a response suitable for the circumstances at the time. When the client opens communication with Apache, it sends Apache a request for a resource. Apache either provides that resource or provides an alternative response to explain why the request couldn’t be fulfilled. In many cases, the resource is a Hypertext Markup Language (HTML) Web page residing on a local disk, but this is only the simplest option. It can be many other things, too—an image file, the result of a script that generates HTML output, a Java applet that’s downloaded and run by the client, and so on.



Here we go:


*In linux you can install apache using the following conmmand
         sudo apt-get install apache2


*Then netstat it (ie.netstat is a network statistics)that will give the incoming ang outgoing connections using netstat -pan |grep apache


*This will show only a non own process do a sudo command so that u can view all the process.


*This will show a details like port,ipaddress and listen etc


*Then find where the apache is using the command  $whereis apache2


*From here u can go the folder of where apache is..


*apache -V will give all the compiled contents of  server including the root and config


*From the given path in the list u can go to the config file and view it


FOR CREATING A NEW MODULE:   


*You can also create anew module by installing the 
               sudo apt-get install apache2-prefork-dev


*After installing  you are ready to create a module using command 
                     sudo apxs2 -g -n "module name"


*The module files will be created


*From there go to the module folder and view the .c file 
            sudo vi mod_filename.c


*You can make changes over this files and save it


*we have to compile this file using the command
           sudo apxs2 -c -i "mod_filename.c"


*Then go the .c file and copy the load file with the locationand paste it in the apache2.conf wat we see earlier


*Paste it in the Apache2.conf


*After pasting restart the apache with the command
           sudo apachectl restart




Hope it  helped a bit to get started  with apache..

Friday 6 January 2012

Screen scraping....

I just get the impact of this screen scraping from my trainer Mr.Kamesh and it was a good one. 

Scraping:

Screen scraping is a process of extracting the data from the webpage and its a technique in which a computer program extracts a data from a website we want.

Some its too good to retrieve data from our favourite website with out CTRL+c and CTRL+v
to view the data we want to see..

So i just tried it with a program in python language.i tried to retrive the name of the candidate who recently placed from our college..

my target url:www.saec.ac.in

I scraped the data is that the person who get placed in our college from M.B.A department.
and finally i end up the code that gives me the result.

import urllib
import re
import string

url = 'http://saec.ac.in/campus/lcube.html'
response = urllib.urlopen(url)
content = response.read()
start=string.index(content,"<table")
stop=string.index(content,"</table")
content = content[start:stop]
start=string.index(content,"</tr")
content = content[start+4:]
start=string.index(content,"<tr")
stop=string.index(content,"</tr")
content = content[start:stop]
for field in re.findall('>([^<]+)<',content):
    print field.replace('\n ',''),

just tried a bit of scraping over here..and im working on top of it to scrap a bulk data.