Sunday, May 11, 2008

Executing anonymous servlet in Tomcat - Jboss

If you want to run anonymous servlet classes in Tomcat or Jboss that have not been defined in a web.xml file, you need to change configure it in web.xml.

Open web.xml and uncomment following lines.

<servlet>
<servlet-name>invoker</servlet-name>
<servlet-class>
org.apache.catalina.servlets.InvokerServlet
</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>


<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>

Traditionally, this servlet is mapped to the URL pattern "/servlet/*", but you can map it to other patterns as well.

Wednesday, May 7, 2008

Jython - Python with Power of Java

Jython, formerly known as JPython, is an implementation of the Python programming language written in Java.

Java and Python, each have their advantages and disadvantages. Java is a very powerful language. Python is a very easy and very efficient language. Jython is a technology capable of merging Python and Java together to create efficient and powerful applications. Jython combines the advantages of Python and the Java virtual machine and library and serves as a handy complement to the Java platform. Jython allows programmers to use the syntax and most of the features of the Python programming language.

Jython programs can easily import and use any Java class. Except for some standard modules, Jython programs use Java classes instead of Python modules. Jython includes almost all of the modules in the standard Python programming language distribution, lacking only some of the modules implemented originally in C. For example, a user interface in Jython would be written with Swing, AWT or SWT. Jython compiles to Java bytecode either on demand or statically. Jython also includes jythonc, a compiler that converts Python source code into Java bytecode (intermediate language). This allows Python programmers to write classes which can be fully utilized by a Java program.

Jython is interesting to Java programmers for several reasons:

* Jython's version of the Python interpreter shell allows convenient experimentation and exploration of ideas and APIs without having to go through the usual Java compile/run cycle.

* Python is dynamic and generic by design, so you don't have to add these features by using complex libraries (such as those for Java reflection and introspection). This makes some sorts of development easier and is especially useful in automated testing frameworks.

* Many developers like Python's syntax and the feel of the language; they find it a much more productive way to develop and maintain Java applications.

Visit following link for more details.

http://www.jython.org

Visit following link to find out Jython users.

http://wiki.python.org/jython/JythonUsers

Tuesday, May 6, 2008

Web Developer Tools

Different Tools are available in order to analyase and debug web application and help to improve website. Web developer tools makes development easier and faster.

Here is some of useful tools available for different web browsers.

1) Firebug - For Firefox Browser

Firebug integrates with Firefox to put a wealth of development tools at your fingertips while you browse. You can edit, debug, and monitor CSS, HTML, and JavaScript live in any web page.

Features:

-Inspect and edit HTML
-Tweak CSS to perfection
-Visualize CSS metrics
-Monitor network activity
-Debug and profile JavaScript
-Quickly find errors
-Explore the DOM
-Execute JavaScript on the fly
-Logging for JavaScript
-Timing and profiling
-Stack traces
-Nested grouping
-Object inspection

Visit the Firebug website for documentation, screen shots, and discussion forums:

http://www.getfirebug.com

2) IE Developer Toolbar

The Microsoft Internet Explorer Developer Toolbar provides a variety of tools for quickly creating, understanding, and troubleshooting Web pages.

Features:

-Explore and modify the document object model (DOM) of a Web page.
-Locate and select specific elements on a Web page through a variety of techniques.
-Selectively disable Internet Explorer settings.
-View HTML object class names, ID's, and details such as link paths, tab index values, and access keys.
-Outline tables, table cells, images, or selected tags.
-Validate HTML, CSS, WAI, and RSS web feed links.
-Display image dimensions, file sizes, path information, and alternate (ALT) text.
-Immediately resize the browser window to a new resolution.
-Selectively clear the browser cache and saved cookies. Choose from all objects or those associated with a given domain.
-Display a fully featured design ruler to help accurately align and measure objects on your pages.
-Find the style rules used to set specific style values on an element.
-View the formatted and syntax colored source of HTML and CSS.

For more information please visit.

http://www.microsoft.com/downloads/details.aspx?familyid=E59C3964-672D-4511-BB3E-2D5E1DB91038&displaylang=en

3) Opera Dragonfly -Opera Browser

Opera Dragonfly makes developing using Opera easier than ever. It allows Debug JavaScript, inspect CSS and the DOM, and view any errors.

-Redefine your style
-Reach breaking point step by step
-Debug the DOM
-Spot your errors
-Debug your phone or TV

For more information please visit.

http://www.opera.com/products/dragonfly/

Tips For Measuring Application Performance

Here are some of important points which should be considered while measuring application performance.

- Test systems should match production as closely as possible. Same hardware, OS, and software.
- Populate databases with the number of records expected in production.
An application may perform well with a small number of records in the database. Performance could degrade a great deal as the number of records in the table(s) increases
- Test HTTP requests with different request parameters.
Test with the extremes. A page which performs a search may perform well when the search criteria returns a small result set, but perform poorly when the search criteria returns a large result set.
- Simulate expected traffic over time including short term spikes.
A page which performs well with low request volume can cause the server to fail under higher request volume.
- Use Server load testing tools (like Apache Jakarta JMeter) to simulate heavy load.

Tomcat - Jboss Performance Tuning Tips

Apache Tomcat is an implmentation of the Java Servlet and JavaServer Pages technologies.
In production Enviroment, number of resources which can all impact application overall performance. Here are some important point which can help to improve Tomcat Performance.

Performance Tuning - Tomcat Configuration

Configure server.xml parameters as following.

-Set reloadable to false

When reloadable is true Tomcat tries to detect web application class changes and automatically reload any classes which change. Setting this to false removes a lot of unnecessary overhead in production.

-Set liveDeploy to false

liveDeploy controls whether your webapps directory is periodically checked for new web application directories and war files. This is done using a background thread. Set this to false and use the manager application or ant deploy tasks instead.

-Set debug to 0

Disable all debug output, unnecessary logging just adds overhead.

-Set swallowOutput to true

This makes sure all output to stdout or stderr for a web application gets directed to the web application log rather than the console or catalina.out. This makes it easier to troubleshoot web application problems.


Performance Tuning - Jasper 2 Configuration

Configure web.xml parameters as following.

-Set development to false

Disables JSP page out of date checks on each request and enables JSP background recompiles. development is set to true by default.

-Use JSP custom tag pooling

Object pooling of classes which implement custom tags significantly improves performance of JSP pages which use custom tag libraries. JSP custom tag pooling is enabled by default.

-Configure Jasper to fork javac compiles. (Do not set fork to true on MS Windows)

The JVM compiler javac has known memory leaks. Eliminates JVM memory usage and GC overhead of javac by configuring Jasper to fork javac when compiling JSP pages.

ORM Framework for Kotlin

In Kotlin, ORM (Object-Relational Mapping) libraries provide a convenient way to interact with databases using object-oriented programming p...