Santosh :-) Technically!!!

Tuesday, December 19, 2006

Tomcat - Apache Integration

Requirements:

  • JDK 1.5
  • Apache (apache_2.0.59-win32-x86-no_ssl.msi)
  • Tomcat (apache-tomcat-5.5.20.exe)
  • jakarta-tomcat-connectors ( mod_jk-1.2.14-apache-2.0.54.so)

Tomcat – Apache Integration (Using mod_jk connector) in Windows:
First install both the servers. Let apache be in port 80 and Tomcat in port 8080.

Create a workers.properties file with the following lines under the conf folder of Apache. This makes your apache listen to tomcat through the ajp13 class (ajp13 class sends the individual packet information using the Ajp13Packet class, and implements the communication between the server and the servlet container. It routes the tomcat’s servlet support methods to the correct packets for the webserver).


workers.tomcat_home=C:\Program Files\Apache Software Foundation\Tomcat 5.5
workers.java_home=C:\Program Files\Java\jdk1.5.0_03
ps=\

# Define worker 'workp'
worker.list=workp

# Set properties for worker 'workp' (ajp13)
worker.workp.type=ajp13
worker.workp.host=localhost
worker.workp.port=8009

worker. workp.cachesize=10
worker. workp.cache_timeout=600
worker. workp.socket_keepalive=1
worker. workp.reclycle_timeout=300

And copy the mod_jk.so (Mod_jk connector module file) file into the modules folder of Apache Home. The name of the connector file should be mod_jk.so only as per our code.

Now include the following code in the httpd.conf file in the conf folder of Apache. This loads and mounts the connector to interact with Tomcat.

LoadModule jk_module modules/mod_jk.so

JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel error
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"

Alias /jsp-examples "C:/Program Files/Apache Software Foundation/Tomcat 5.5/webapps/jsp-examples/"

Options Indexes +FollowSymLinks
AllowOverride None
Allow from all

Alias /servlets-examples "C:/Program Files/Apache Software Foundation/Tomcat 5.5/webapps/servlets-examples/"

Options Indexes +FollowSymLinks
AllowOverride None
Allow from all

Alias /MyWebsite/ "C:/Program Files/Apache Software Foundation/Tomcat 5.5/webapps/MyWebsite/"

Options Indexes +FollowSymLinks
AllowOverride None
Allow from all

AllowOverride None
deny from all

JkMount /jsp-examples/*.jsp workp
JkMount /servlets-examples/* workp
JkMount /MyWebsite/* workp

The “workp “is a worker property defined in the workers.properties file.

Here we have the Servlets-example, jsp-example and our own site MyWebsite Mounted. We can customize the alias and Directory tag to include other sites.The above finishes the configuration in Apache side.

Now add the following context paths in the server.xml file of Tomcat located under the conf folder. These context paths facilitate the deployment of the site. Place the code before closing the tag.

Each context path corresponds to a single folder in the webapps folder of tomcat. If your web application contains subfolders, then those folders also needs a corresponding context path.

For example: if MyWebsite contains another folder called folder1 then the context path for that must be as below:


And also add the corresponding Mount command in the httpd.conf in Apache

JkMount /MyWebsite/folder1/* workp

Now start the Tomcat server first and then Apache. Now try accessing the pages deployed in tomcat from apache’s port (80).

Example:
http://localhost/servlets-examples/
Or http://localhost/jsp-examples/
Or http://localhost/Mywebsite
Or http://localhost/MyWebsite/folder1

Likewise you can copy your site directly into the webapps folder of Tomcat and creating an alias and context as above would deploy your site.

Resources:
  • Apache (apache_2.0.59-win32-x86-no_ssl.msi) - Download
  • Tomcat (apache-tomcat-5.5.20.exe) - Download
  • jakarta-tomcat-connectors (mod_jk-1.2.14-apache-2.0.54.so) - Download

Thursday, May 04, 2006

WebBrowser in Netbeans5.0 and VS2005

Was trying out a web browser in Netbeans 5.0 from the inspiration got from Ashwins post on it. Then thought of trying out the same in Vs2005 ie in C#.Net. Both had their own part of differences in look and feel and as well in code.

First u can get the whole procedure of creating it in Netbeans from Aswins Two minute browser post. The code involved is just three lines...(Copied from aswin's post)

Code under the actionperformedevent of the Go button:
try
{
WebBrowser wb=new WebBrowser();
wb.setURL(new URL(txtUrl.getText()));

browPane.
add(wb);
}
catch(Exception ex)
{
JOptionPane.showMessageDialog(null,ex.getMessage());
}

And the Browser comes as:


Now lets see how well we can do the same in C#.Net:

  1. Open Microsoft VisualC# 2005(Am using express in this case).
  2. Now File->NewProject and select Windows application.And name the project as Browser.
  3. Now drop a Textbox and a Button control from the toolbox.
  4. Now drag and drop a WebBrowser control from the toolbox.
  5. Now type the following line under the Button click event of the button.
webBrowser1.Navigate(textBox1.Text);

6. Now press F5 to run the project.

And the browser comes out as below:


Now lets see the differences:

1.First the lines of code:- Netbeans:3 and VS2005:1

2.In Netbeans, the browser accepts the url as only "http://google.com" and will show an exception "Protocol not found" if the "http://" is left out. this can be noted from the screen shots provided. Though this can be sorted out by adding some two lines of code, this was not handled automatically by the setUrl() method in Netbeans5.0.

The modified code would be...
try
{
WebBrowser wb=new WebBrowser();
Boolean b = contains(txtUrl.getText(),"http://");
if(b)
{
wb.setURL(new URL(txtUrl.getText()));
browPane.add(wb);
}
else
{
wb.setURL(new URL("http://"+txtUrl.getText()));
browPane.add(wb);
}
}
catch(Exception ex)
{
JOptionPane.showMessageDialog(null,ex.getMessage());
}

//code outside the actionperformed event
public boolean contains(String string, String string0)
{
return false;
}



But the navigate() method in C#.Net handles it perfectly and no exception or error is shown. So it works with and without the "http://" part.

3.We need a JDIC
(JDesktop Integration component) if the browser is moulded in Netbeans and this is not a problem in VS2005.

4.Netbeans IDE has a tabbedpane which facilitats tabbed browsing but i dont find a similar one in Vs2005, may be i ve not searched it properly.So if anyone gets to know such a facility in Vs2005 plz ping me back.

Downloads:


Tuesday, March 07, 2006

The Google Way

Got to tumble upon google's way of searching in one of my usual link traversals that i daily do. And also a friend of mine was reading about it and we started a discussion about. So it took me to an article where they had plotted approximately on how google works for it's search industry to it a happening thing.

It explained everything right from the invention of internet to the present state. It dealth with how web crawling is efficiently implemented. And how well the Page rank technique is used. Page rank is nothing but a rank or vote given to a page or site with respect to the visitor turnout to that link randomly. Every search engine has its own way of ranking its pages...Simply saying page ranking is indexing of pages according to the importance it gains from the users hit ratio to it.
This figure to your right gives an abstract overview of how a search engine works. you might see from it that its not only page rank or indexing is being used, but it involves more sophisticated things like anchors, resolver, lexicon,hit lists and so on.

Each page is ranked indexed and stored as links in a page using anchors. Google uses c nad c++ for its implementation. Each document or page is parsed and then is indexed into the barrels u see in the figure. And again it is sorted according to its respective ids.

And whats amazing is that, a single search query we give need some 100s of gb storage to return us the links relating to it. And for the ranking, indexing and those lexicon stuff again needs dozens of gbs. now imagine how it handles search queries all over the world without compromising service to us. Really amazing.

The magic is done by the algorithm they use which is yet to revealed fully for public. And it need not be or will not be revealed as u would create ur own google(like am santosh and ill name it as sangle.com) if its revealed fully.

This is just a pick n preview kind of explanation of the total analysis on the page i read.
for detailed reading plz take ur mouse pointeres to click the following links:

Hope u experience the same thrill i felt...........


Thursday, January 26, 2006

ASP.NET's "Atlas" Vs "Ajax"

ASP.NET Atlas is a package of new Web development technologies that integrates an extensive set of client script libraries with the rich, server-based development platform of ASP.NET 2.0.

Atlas enables us to develop Web applications that can update data on a Web page by making direct calls to a Web server — without needing to round trip the page.

Atlas applications are cross-platform and will run with little or no change in any modern browser.

Example of appplications developed using Atlas are....
Atlas also has an equalent competent package known as Ajax(Asynchronous JavaScript and XML).But Creating Ajax-based Web applications has its own disdvantages.
  • Highly Complex.
  • Requires extensive knowledge of client script.
Some examples of Ajax based applications are...
So atlas is not a mere copy of AJAX but an extension of AJAX by overcoming its loopholes.
The improvements of ATLAS over AJAX are....
  • Atlas client script libraries simplifies the tasks of creating rich UIs and remote procedures calls by providing you with true object-oriented APIs and components for Atlas development.
  • Atlas extends the AJAX concept by providing a rich, integrated server development platform in ASP.NET 2.0.
  • Includes ASP.NET Web services and server controls that enable you to take advantage of the power of ASP.NET
Simply saying, Atlas simplifies AJAX development and incorporates AJAX concepts into the Web application development process.

For more information follow the below mentioned links......
Technically
...........Santosh Jayamurugan

Sunday, December 18, 2005

Steganography

Steganography (a Greek translation of the term Steganography is secret writing) has been used in various forms. It has found use in variously in military, diplomatic, personal and intellectual property applications. Briefly stated, steganography is the term applied to any number of processes that will hide a message within an object, where the hidden message will not be visible to an observer.

Its basically an art or technique of hiding information in the following:
* Images
* Audio
* Video
* Many more objects too!!

Moreover it has now got a global attention as Osama bin laden used this technique to enter the highly protected city in the world "NEWYORK" to distruct the twin towers.

He eventually used it to hide the two planes that collided with the towers from the radar images!!!. Thus fooling the security grids.

Technically
.....Santosh Jayamurugan