Showing posts with label Tools. Show all posts
Showing posts with label Tools. Show all posts

Thunderbird 3.1.5 Release with Critical security fixes

Mozilla Thunderbird 3.1.5 version released today. This free and open source email client is one of the better standalone ones available. Since development is done by a community of developers with the help of security experts; issue identification and resolution process is so efficient. Thunderbird 3.1.5 can be downloaded from here for any platform (Windows, Mac OS and Linux) in around fifty languages.

This release has fixes for five critical security vulnerabilities as shown below.
  • Unsafe library loading Vulnerabilities
  • Dangling pointer vulnerability in LookupGetterOrSetter
  • Use-after-free error in nsBarProp
  • Buffer overflow and memory corruption using document.write
  • Miscellaneous memory safety hazards (rv:1.9.2.11/ 1.9.1.14)

An upgrade to latest 3.1.5 version is advised to avoid any security issues. All credit goes to those great people who devote their time and effort on getting another release out.

Attempted to lock an already-locked dir: Subversion issue

"Attempted to lock an already-locked dir" - svn: Working copy locked; this message is frequently faced by users of SubVersion (SVN) source repository. The message is self explanatory; simply some source files are locked and no commit or update operations allowed on those files/folders. In some occasions, Software developers in a team receive this message in a SVN operation even though none of them have locked the files or folders; causing confusion. So how would you try and resolve?

We use Subversion to create and store our projects in repositories; Subclipe (an Eclipse plugin) as the client tool to connect to repository.

We tried following solutions

1. Commit Changes - change and commit changes into repository
2. File Delete - delete the files and commit the delete into repository
3. Override & update - override the local changes and update from repository

None of the above options resolved the issue, but got the same type of error messages. Followings are the error messages shown inside Eclipse while trying the above mentioned options.

commit -m C:/workspace/MyProject/config.properties
Attempted to lock an already-locked dir
svn: Working copy 'C:\workspace\MyProject' locked

update -r 13 C:/workspace/MyProject/src
Attempted to lock an already-locked dir
svn: Working copy 'C:\workspace\MyProject' locked

delete --force C:/workspace/MyProject/config.properties
Attempted to lock an already-locked dir
svn: Working copy 'C:\workspace\MyProject' locked

Use Cleanup command

Subversion:Team-CleanupSubversion supports a command named "Cleanup"; it is used to release the locks on a project.

If you have faced with the above issue while no one has locked the project files, you can run this command and resolve the issue.
You do this in Eclipse by right clicking the project; then Team->Cleanup as shown in the image.

Tomcat + Apache HTTP: Servers Connecting Guide

Apache Tomcat is a Servlet/JSP container and used to deploy dynamic Java contents like JSPs and Servlets. Tomcat has some web server capabilities, however it is not a full blown web server to serve high traffic web sites. In the meantime Apache HTTP server is a full blown web server. So in general Tomcat is configured along with Apache HTTP server to maintain a healthy web site with dynamic content. This article will cover the steps of configuring HTTP server and Tomcat connection, however this will not discuss installation details of Apache or Tomcat.

System Requirements

  • Apache HTTP server installed
    • download from here
    • we used version 2.2.10 for this article
  • Apache Tomcat installed
    • download from here
    • we used version 5.5 here
Short Names
Followings are the short names used to denote folders used in this article.
  • %APACHE_HTTP_HOME%
    • denotes Apache HTTP Server installation directory. In our testing machine, it is "D:\ASF\Apache"
  • %CATALINA_HOME%
    • Tomcat installation directory; for example: "D:\ASF\Tomcat"

Connection Configurations

The connection between HTTP server and Tomcat will be done using Apache Tomcat Connector module named mod_jk which is configured inside Apache HTTP server. For that first download the correct version of connector from here.

For version 2.2.10 of Apache HTTP; correct connector version is 2.2.4 (available here). Make sure to download the correct version, as incorrect version may result in errors.

Mod_jk configuration

Apache HTTP ServerNow the downloaded mod_jk module must be configured in Apache HTTP server. First rename the above downloaded file say mod_jk-1.2.26-httpd-2.2.4.so to "mod_jk.so". In Apache server, module files are stored under %APACHE_HTTP_HOME%\modules folder. Now copy the mod_jk.so file into this folder.

Then open the HTTP server configuration file named httpd.conf. It's located in %APACHE_HTTP_HOME%\conf folder. This file has a number of lines used to load Modules starting with "LoadModule ". Add the following line below these lines.

LoadModule jk_module modules/mod_jk.so

Now the downloaded mod_jk module is added into Apache server.

Tomcat Server Information

We need a new properties file to store details about the Tomcat server. Create a new file named workers.properties inside %APACHE_HTTP_HOME%\conf folder with the following content.

worker.list=localTomcat
worker.localTomcat.host=localhost
worker.localTomcat.port=8009
worker.localTomcat.type=ajp13

Pay attention to the above port 8009; this is the port defined inside %CATALINA_HOME%\conf\server.xml file as follows.

<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

Tomcat ServerIf the port in AJP 1.3 connector section of Tomcat is different than 8009, change the above workers.properties file to match that.

Now we need to configure the workers.properties file in %APACHE_HTTP_HOME%\conf\httpd.conf file. For that add the following lines after the line that we added into httpd.conf in a previous step.

JkWorkersFile conf/workers.properties
JkShmFile logs/mod_jk.shm
JkLogFile logs/mod_jk.log

Now everything is setup. However still we have not yet defined the important part; which user requests to be forwarded to Tomcat server from Apache server.

URL Patterns

Following is the format of those configurations.

JkMount  <URL_PATTERN>  <WORKER>
  • <URL_PATTERN> - the url pattern that you need to forward to Tomcat
  • <WORKER> - the worker name defined in workers.properties file.
We can set up multiple url patterns as follows.

JkMount  /myProject/* localTomcat
JkMount /*.jsp localTomcat
JkMount /*.do localTomcat

First one will send all requests for a web application named "myProject" to Tomcat while the second will send all requests ending with ".jsp". The third line configures for all requests ending with ".do" (many use .do extension with Struts actions).

Add required configuration lines as above into httpd.conf (just after the lines we added in above steps).

Setup Completed

Now try the URLs of your application as follows (using Apache port number, rather than Tomcat port number). We assumed Apache HTTP server is running on port 80. Following as some sample urls for the above configurations.

http://localhost/myProject/
http://localhost/testApp/main/admin.jsp
http://localhost/strutsApp/login.do

Now Apache will direct all these request to Tomcat (running on a different port) and serve the client smoothly.

Related Article: How to change Tomcat port

Sun suspends NetBeans IDE DVD Starter Kit distribution program

Sun has suspended their NetBeans IDE DVD Starter Kit distribution program indefinitely. Yes, you read it correctly; they have done it. So many developers used to get most of Sun (free) products through the distribution program. Students with less bandwidth (in some colleges & universities); specially users without Internet access to home computers are fond of this service as NetBeans DVDs are freely delivered to their hands at no cost.

According to NetBeans.org;
"Since August 30th, 2005, NetBeans.org has shipped more than 225,000 CDs & DVDs to developers around the world through this initiative! During this period, NetBeans has experienced explosive growth as a download, media kit, and a community. To stay ahead of this encouraging trend we are looking into ways to effectively satisfy increasing demand for NetBeans software worldwide."

For sure this service played a huge role in helping so many Java developers. Also the program is a good marketing option for NetBeans since Eclipse (the best free Java IDE) provides no such services, rather than allowing free download. Sun also has decided to follow the same; stick only for free downloads. However the Starter Kit is available for download as an ISO image. In near future may offer downloads via mirrors and bit torrent; but not sure how near that future is. Anyway we are grateful to service Sun provided us.

[Eclipse] Access restriction: Class is not accessible due to restriction on required library

"Access restriction: Class is not accessible due to restriction on required library"; error message may be shown while developing Java projects in Eclipse IDE. Error message is self-explanatory, some classes can not be loaded into the project since restriction rules are being imposed on those classes.

How to solve

This error message can be removed by changing a setting inside Eclipse IDE. Open up the dialog box shown below, using any of the following paths.
  • Windows -> Preferences -> Java -> Compiler -> Errors/Warnings
  • (Project) Properties -> Java Compiler -> Errors/Warnings
Locate the "Forbidden reference (access rules)" option under "Deprecated and restricted API" section in the dialog box. This option decides how to handle access rules defined inside Eclipse. By default it is set to "Error" which causes Eclipse to complain about references to any restricted classes. Choosing any other option (Warning or Ignore) will remove these error messages.

"Warning" or "Ignore" options will only hide the potential issue in the project, by allowing the project to use any classes ignoring predefined access rules. To completely resolve this issue, analyze the project and located the use of restricted classes and take necessary actions (either remove those references or access rules).

Chrome or Firefox - which browser to choose?

Chrome is the newest baby in browser family or the next competitor in browser war. What ever it is, Google released their browser named Chrome. But Mozilla Firefox is the most popular browser in the world right now and Google was the major supporter for Firefox. Even while supporting it, they have built their own browser free and open source. Here we are looking at the two browsers and trying to compare them to decide whether to switch to the new one or not leaving our old but fascinating friend Firefox?

Interesting features

1. One Process per each tab
Tab is not another thread running inside the browser process; there is a separate process per tab. Even if one tab crashes, the rest of the tabs will be running as nothing happened; which was not available in Firefox. This is one of the most interesting features.

2. New tab is filled with useful links
For a new tab in Firefox, you can load a predefined page, a blank page or a predefined set of page links (using an extension). But you would be much happier to see a set of links that you dealt with in recent past; Chrome comes exactly with that. The new tab will show a set of links;
  • Most visited pages
  • Recently closed
  • Recently Bookmarked
I do not think the last one will be much useful, but the other two will be pretty handy.

3. Rich Location bar
Location bar in Chrome is a combination of location bar & search bar. You can directly type a url or a search keyword, also it comes with suggestions.
Using separate location bar per each tab is also an interesting move, each tab looks like individual browser instances; while in firefox you have single location bar shared by all tabs.

4. Speed
Stephen Shankland at CNet has posted an article on speed, and it tells most of the details. However Brendan at MozillaZine has published another set of testing statistics. So we'll have to check some statistics done by an independent party to get a clear view. Anyway Chrome is starting up so fast compared to any other browser.

Some complains

Since Chrome is still in beta, this may be a good time to suggest some features or improvements. Following are some complains that we have.

1. No warning in closing
When multiple tabs are opened Firefox is used to show a warning in closing the browser, but Chrome does not and closes immediately. Since people can accidentally close the browser better to add it soon.

2. Displaying different fonts
Some of the fonts are not displayed smoothly as Firefox used to do. Above image shows how the same content is displayed in two of these browsers.

3. No XML viewer
May be it is not a must to have a XML viewer in a browser, but we are used to it. Firefox and IE both have good XML viewers, but Chrome lacks it. Similar to this Opera and Safari also do not have this feature. Many people happened to work with XML files every day and having an XML viewer in the browser is an added advantage.

4. Security issues
Chrome has exposed to a set of known security issues by using an older version of WebKit, which had already been fixed. Anyway we expect Google to fix it soon.

Main Concern

Above all of these our main concern is the lack of support for extension development. We are used to live with some great extensions with Firefox, which we are not experiencing with Chrome. Since it is still in beta version, we should wait for extension support. However no API is released for extension development, users will have to wait longer than expected to see some useful extensions. There are so many extensions that makes our lives easier and better. Few of them are;
  • NoScrip
  • Adblock
  • Gmail Manager
What are the other reasons that you are not switching to Chrome straightaway?

Write Java with JDK 1.5 features and run on JRE 1.4

JavaHave you being writing your Java code on Java 1.5 (JDK 1.5) with new features like auto boxing, generics and enums? And suddenly realized that your customer's servers are still using Java 1.4 (JRE 1.4)? This is not a surprise since most of the customers are not in a position to take a risk and try the newer versions as they are running live/online businesses. But as professionals in the software development field, we have to move with the latest/stable versions available in the market. That's where the conflict occurs.

Now you must deploy your Java 1.5 codes into a 1.4 Java runtime environment (even may be 1.3 or 1.2). Even if the Java code has not used any of the new features of Java 1.5, you still can not run your code in 1.4 JRE as the runtime throws an error saying "java.lang.UnsupportedClassVersionError".

Compile 1.5 codes for 1.4 JVM

Java compiler provides an option to specify the target JVM of the generated classes like 1.5, 1.4, and 1.3 as follows.

public class MyClass {
public static void main(String args[]) {
System.out.println("Main Method");
}
}

> javac -source 1.4 -target 1.4 MyClass.java

Even if your JDK is of version 1.5, above command will compile your class so that it can run on a JRE 1.4. But the above option only works if your class does not use any of the new features in Java 1.5 (like auto boxing, enums etc).

Check the following class. Compiling it with "target" option will result in a compile time error.

public class MyClass {
public static void main(String args[]) {
Integer count = 1;
System.out.println("Main Method");
}
}

> javac -source 1.4 -target 1.4 MyClass.java

The compiler error is shown because auto boxing is not supported in 1.4.

This means that we can not use 1.5 features if we are going to run the programs on an older version. So this is not a real solution for our issue.

Can not run/deploy code with new features on 1.4 JVM?

Java retroweaver logoThere is an open source free solution to this issue. The tool is named "Retroweaver", and it can generate class files for older JREs using classes with new features of the 1.5 version. This is a nice tool and it supports most of the Java 1.5 features.

Retroweaver site says;

... supports most 1.5 features while running on 1.4.
  • generics
  • extended for loops
  • static imports
  • autoboxing/unboxing
  • varargs
  • enumerations
  • annotations

Also this has a good documentation (even though it's not up to date. Don't blame them; they are doing it for free).

This tool can convert .class files of 1.5 version to another older JRE version. Also it has the capability of converting a complete .jar file.

Check out this stream