Sunday, 1 April 2007
Java / Tomcat Hosting
The worst thing, was periodically the site would go offline !!!
Gave godaddy up and went to metawerx, a hosting company in Melbourne. Brilliant service and the site is up and running in no time. Also, got Tomcat 5.5 and MySQL 5 support as a bonus.
Monday, 19 February 2007
MySQL version gotchas
My dev version of MySQL had v5.0 and I was happily using subqueries and the likes. Then I uploaded the software to my hosting account at godaddy and voila all subqueries failed. After investigations, I figured out that godaddy were still in version 4.0 of MySQL (4.0.27) which does not support subqueries. Only MySQL versions 4.1 and above do support them.
I then had to move some accounts to a new hosting account at hostmonster, who allow hosting of multiple domains in a single account. Two birds killed. My MySQL version problem got solved as they used 4.1 and I saved some money by hosting all my domains under one account.
-- Arv
Wednesday, 7 February 2007
Linking IIS to Tomcat 5.5 on Windows XP
The Tomcat Connectors web site says that the jk2 connector is deprecated because of a lack of interest and advices everyone to use the jk1.2 connector. I spent approximately 3-4 hours on the jk1.2 connector with Tomcat 5.5.20 and IIS 5.1 on XP and could not make it work. Rechecked multiple times and everything was configured exactly as the documentation suggested but IIS would not forward to Tomcat.
Gave up and went to the JK2 connector and configured it according to the documentation and voila it worked on the first go.
Below is a good link to link Tomcat with IIS. The only changes I have done from this guide is using the latest Tomcat (5.5.0), JDK 1.5 and I used IIS 5.1 on XP.
Broad Steps are :
1. Install IIS. Test independently.
2. Install JDK.
3. Install Tomcat. Test independently.
4. Setup environment variables JAVA_HOME and CATALINA_HOME in "Control Panel -> System" in your Windows configuration. The former should point to where Java is installed and the later to where Tomcat is installed.
5. Now, Stop Tomcat and IIS services.
6. Edit workers2.properties in your
7. Restart Tomcat.
8. Install the following configuration entries into the Windows registry. Edit the entries to match your environment.
[HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Jakarta Isapi Redirector\2.0]
"workersFile"="c:\\Program Files\\Apache Software Foundation\\Tomcat 5.5\\conf\\workers2.properties"
"extensionUri"="/jakarta/isapi_redirector2.dll"
"logLevel"="debug"
"serverRoot"="c:\\Program Files\\Apache Software Foundation\\Tomcat 5.5\\"
9. Install the Tomcat connector as an ISAPI filter.
(a) Go to your IIS manager and right click on your web site and go to properties.
(b) Select ISAPI filters
(c) Add one, give it a name, any name and then browse to the location where you unpacked the isapi_redirector2.dll and select it.
(d) Save.
10. Create a virtual directory on your website, call it "jakarta" and then point it to the directory where your isapi_redirector2.dll is installed. Give it execute permission.
11. Restart (start) IIS. For good measure, start the WWW service in the "services" screen of your control panel and ensure that your "default web site" is running.
12. Test. http://localhost/servlets-examples/
It should work. Good luck
workers2.properties File
info=Shared memory file. Required for multiprocess servers
file=C:\Program Files\Apache Software Foundation\Tomcat 5.5\work\jk2.shm
size=1000000
[channel.socket:localhost:8009]
info=Ajp13 worker, connects to tomcat instance using AJP 1.3 protocol
tomcatId=localhost:8009
[uri:/jsp-examples/*]
info=JSP examples, map requests for all JSP pages to Tomcat.
context=/jsp-examples
[uri:/servlets-examples/*]
info=Servlet examples, map requests for all servlets to Tomcat.
context=/servlets-examples
This is the link which I found useful. It does deal with IIS 6 which is available only on Windows Server 2003. Just use the steps above for IIS 5
Linking IIS 6.0 to Tomcat.
Tuesday, 6 February 2007
Beans Fry
Assemble these ingredients.
- 300-500g of sliced green beans (Hint: Supermarkets have frozen packets, which you can just thaw in the microwave for 2 Min's)
- 2 pieces Dried red chillies (Substitute with fresh chillies if not available)
- Diced garlic, maybe 3 pods or to taste
- 1 teaspoon mustard seeds
- 1 teaspoon sugar
- 2 teaspoons salt (or to taste)
- Oil preferably Olive Oil, maybe 2 tablespoons.
Now, add the chillies and the beans, garlic, sugar and salt.
Fry till the beans are softened.
This being a technology and food blog, it would not be complete without some versions.
Version 2 (Variation 1)
Add a can of tinned sandwich tuna and some coriander powder half way through the cooking process.
Version 3 (Variation 2)
Add some grated coconut half way through the cooking process and fry till done.
Friday, 2 February 2007
Simple Search engine submission
BUT, one of the simplest techniques to do first is to ensure your site is registered with both Google's webmaster tools and Yahoo's Site Explorer.
Most people forget to do this basic thing. There is no guarantee that this expedites submission and both Google and Yahoo don't say that, but it definitely helps from my own experience.
Google's Webmaster tools.
Yahoo's Site Explorer
Wednesday, 31 January 2007
Easy rounded corners on web pages (Web 2.0 style)
One of the best resources to do rounded corners without images and just using css and javascript is this one I found called NiftyCorners. It is quite cool and easy to use.
Web 2.0 Colors
Well, if you are a photoshop user, then you have to discover this little gem. Miles here has grabbed 70 colors and crammed them into a Photoshop color pallette. Here is his blog and the pallette.
Web 2.0 Fonts
The most common fonts in the Web 2.0 space. Notice the rounded theme at most places.
Web 2.0 Icons and buttons
This is strictly not Web 2.0, but then no-one took the trouble to define what was Web 2.0 anyway. Most of the commentrators and bloggers have made up the standards for Web 2.0. The true inspiration for some of these Icons and buttons come from Apple's Aqua interface from OS X.
If you are a Photoshop user, then here are some links to tutorials on how to create these icons or buttons. Link 1, Link 2 (a badge), Link 3
If you are a GIMP user, see my post about how to do this using GIMP.
References
See a collection of Web 2.0 logos here.
Friday, 19 January 2007
List of Java Profilers
Netbeans Profiler
NetBeans Profiler is a project to provide a full-featured profiling functionality for the NetBeans IDE. The profiling functions include CPU, memory and threads profiling as well as basic JVM monitoring, allowing developers to be more productive in solving memory or performance-related issues.
Link to Netbeans profiler
InfraRED
InfraRED is a tool for monitoring performance of a J2EE application and diagnosing performance problems. It collects metrics about various aspects of an application's performance and makes it available for quantitative analysis of the application.
InfraRED has the ability to monitor the complex architecture of J2EE application environments, provide detailed information for analysis and reporting, alert on performance related problems and guide you to determine the root cause of the problem. When you are trying to identify a performance issue that is causing your production application not meet customer expectations or you are trying to proactively identify issues prior to deploying your application, InfraRED is essential to helping you save time, and ultimately ensure a better performing, more scalable Java application.
InfraRED uses AOP to weave the performance monitoring code into the application. It comes with out of the box support for AspectJ and Aspectwerkz. It can also be made to work with other AOP frameworks such as JBoss AOP etc.
Link to InfraREDJIP - Java Interactive Profiler
JIP is a high performance, low overhead profiler that is written entirely in Java. JIP gives the developer the ability to turn the profiler on and off while the VM is running. You can also filter out classes and packages as well as control the output.
Link to JIP
JMP - Java Memory Profiler
JMP is a profiler for java that can be used to trace objects usage and method timings. JMP uses the JVMPI interface to gather statistics and interact with the JVM. JMP uses a GTK+ interface to show the status.
Link to JMP
YourKit
YourKit, LLC is a new technology leader, creator of the most innovative and intelligent tool for profiling Java applications. The YourKit Java Profiler has been already recognized by the IT professionals and analysts as the best profiling tool for Java.
With YourKit Java Profiler, both CPU and memory profiling have come to the highest professional level, where one can profile even huge applications with maximum productivity and zero overhead.
Link to YourKit web site
JProfiler
JProfiler is an award-winning all-in-one Java profiler. JProfiler's intuitive GUI helps you find performance bottlenecks, pin down memory leaks and resolve threading issues.
Link to JProfiler
Optimizeit
Optimizeit was one of the best of breed commercial profilers along with yourkit. They have now been taken over by Borland.
Link to Optimizeit (from Borland now)
P6Spy
P6Spy is an open source framework for applications that intercept and optionally modify database statements. One of the best profilers that can debug, instrument your database calls without any code changes. It does this by providing a pseudo-JDBC driver that passes calls on to the real one.
Link to P6Spy
JRat
JRat is the Java Runtime Analysis Toolkit. Its purpose is to enable developers to better understand the runtime behavior of their Java programs. The term "behavior" includes, but is not limited to performance profiling.
Eclipse TPTP
The Eclipse Test & Performance Tools Platform (TPTP) Project is an open source Top Level Project of the Eclipse Foundation.
Link to Eclipse TPTP
Troubleshooting tools in JDK 6 (Mustang)
The following tools can be used for specific troubleshooting tasks. The tools described in this section are unsupported and experimental in nature and should be used with that in mind. They may not be available in future JDK versions.
Link to these tools
Java Profilers
Using hprof
HPROF - A Heap/CPU profiling tool
In the past I have found the profiler that is included in Netbeans very useful. Inspite of Eclipse being my IDE of choice, I have had this weird combination of using Eclipse to write my code and to run it, and then hook it up with the Netbeans profiler.
Using jconsole
If you are using JDK 5, then use the built-in jconsole utility to provide some valuable insight into what the JVM is doing. All you need to do is to start the JVM with this argument -Dcom.sun.management.jmxremote.
Thus, if you are debugging a java program, use this as part of your command line or if you are debugging your application server's web instance, pass this via your application server to your JVM.
Then just execute jconsole from your JDK/bin directory to connect to the running instance and view.
Monday, 15 January 2007
Linux - Dual Monitors with ATI Radeon on IBM T42
Alas, after a lot of teeth gnashing and debug, the effects don't seem to extend properly to a dual monitor setup. My dual montior setup was more special as it had different resolutions. The laptop screen at 1400x1050 and the external Samsung monitor at 1440x900 (widescreen).
After a lot of experiementation, I discovered that using the latest ATI drivers (the fglrx ones) off the ATI website or using the Livinia repository gave the best display across the dual monitors as separate desktops, and not an extended desktop. Alas, with this option, the 3D desktop goes away, as the ATI drivers do not support the AIGLX extensions.
Thus, now I have two xorg.conf's setup on my laptop. One is for a single monitor setup (using the Xorg's radeon driver) and the other for a dual monitor setup (using the ATI driver from Livinia repository).
Some good links I used to experiment with.
http://forums.fedoraforum.org/showthread.php?t=121119
http://ozlabs.org/~jk/docs/mergefb/
http://dri.freedesktop.org/wiki/MergedFB
Single-Head xorg.conf with radeon drivers
Section "ServerLayout"
Identifier "single head configuration"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Synaptics" "CorePointer"
EndSection
Section "Module"
Load "dri"
Load "glx"
SubSection "extmod"
Option "omit xfree86-dga"
EndSubSection
EndSection
Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
Option "XkbModel" "pc105"
Option "XkbLayout" "us"
EndSection
Section "InputDevice"
Identifier "Synaptics"
Driver "synaptics"
Option "Device" "/dev/input/mice"
Option "Protocol" "auto-dev"
Option "Emulate3Buttons" "yes"
EndSection
Section "Monitor"
### Comment all HorizSync and VertSync values to use DDC:
Identifier "Monitor0"
ModelName "LCD Panel 1400x1050"
### Comment all HorizSync and VertSync values to use DDC:
HorizSync 31.5 - 90.0
VertRefresh 59.0 - 75.0
Option "dpms"
EndSection
Section "Device"
Identifier "Videocard0"
Driver "radeon"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Videocard0"
Monitor "Monitor0"
DefaultDepth 24
Option "AddARGBGLXVisuals" "True"
Option "DisableGLXRootClipping" "True"
SubSection "Display"
Viewport 0 0
Depth 24
Modes "1400x1050" "1280x1024" "1280x960" "1280x800" "1152x864" "1152x768" "1024x768" "800x600" "640x480"
EndSubSection
EndSection
Section "DRI"
Group 0
Mode 0666
EndSection
Dual-head xorg.conf with ATI fglrx drivers
Section "ServerLayout"
Identifier "Multihead layout"
Screen 0 "Screen0" LeftOf "Screen1"
Screen 1 "Screen1" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Synaptics" "CorePointer"
Option "Xinerama" "on"
Option "Clone" "off"
EndSection
Section "Module"
Load "dri"
Load "glx"
SubSection "extmod"
Option "omit xfree86-dga"
EndSubSection
EndSection
Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
Option "XkbModel" "pc105"
Option "XkbLayout" "us"
EndSection
Section "InputDevice"
Identifier "Synaptics"
Driver "synaptics"
Option "Device" "/dev/input/mice"
Option "Protocol" "auto-dev"
Option "Emulate3Buttons" "yes"
EndSection
Section "Monitor"
### Comment all HorizSync and VertSync values to use DDC:
### Comment all HorizSync and VertSync values to use DDC:
Identifier "Monitor0"
ModelName "LCD Panel 1400x1050"
### Comment all HorizSync and VertSync values to use DDC:
HorizSync 31.5 - 90.0
VertRefresh 59.0 - 75.0
Option "dpms"
EndSection
Section "Monitor"
Identifier "Monitor1"
VendorName "Monitor Vendor"
ModelName "LCD Panel 1440x900"
### Comment all HorizSync and VertSync values to use DDC:
HorizSync 31.5 - 100.0
VertRefresh 59.0 - 75.0
Option "dpms"
EndSection
Section "Device"
Identifier "Videocard0"
Driver "radeon"
EndSection
Section "Device"
Identifier "Videocard1"
Driver "radeon"
VendorName "Videocard Vendor"
BoardName "ATI Technologies Inc RV350 [Mobility Radeon 9600 M10]"
BusID "PCI:1:0:0"
Screen 1
EndSection
Section "Screen"
Identifier "Screen0"
Device "Videocard0"
Monitor "Monitor0"
DefaultDepth 24
Option "AddARGBGLXVisuals" "True"
Option "DisableGLXRootClipping" "True"
SubSection "Display"
Viewport 0 0
Depth 24
Modes "1400x1050" "1280x1024" "1280x960" "1280x800" "1152x864" "1024x768" "800x600" "640x480"
EndSubSection
EndSection
Section "Screen"
Identifier "Screen1"
Device "Videocard1"
Monitor "Monitor1"
DefaultDepth 24
SubSection "Display"
Viewport 0 0
Depth 24
Modes "1440x900"
EndSubSection
EndSection
Section "DRI"
Group 0
Mode 0666
EndSection
Using GIMP to create web graphics
Using Gimp to make Web 2.0 Buttons and Graphics
Creating Badges/Violators using Gimp
The above two links are excellent and many thanks to Binny !