Monday 19 February 2007

MySQL version gotchas

There I was furiously developing software for a website using straight JDBC, which I had not used for a while, having worked with data abstraction layers and found a MySQL gotcha.
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

Just today, I had to link IIS to Tomcat 5.5. I had done this for quite a few years. It was an interesting experience. I will attach some useful links below, but first a word of advice :

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 /conf directory to have values that match your environment and installation directories. My example one is below.
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

This is a quick recipe for beans fry. I will try and give some tips for a quick meal / side disk. If you are tired of boiling beans this is a better alternative.

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.
First, if you have frozen green beans, thaw them in the microwave. If fresh, then slice them. Heat the oil up in a deep fry pan or a vessel. When the oil is reasonably hot, put the mustard seeds in and fry them until they start to crackle.
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

There are probably a million pages out there on SEO and search engine submission and optimisation techniques and it goes on and on.

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