Monday, May 18, 2009

Google maps API key generation issue



When deploying a web application from STAGE to LIVE I got the following message when trying to use the Google maps API.

I went to generate a Google map key from here as I did for the local and STAGE deploy.
Unfortunately the new key didn't work and I re-generated the key half a dozen times with no success.
Anyway, I diverted my attention to something else and after a couple of hours went back to this issue and miracolously the page came up without the above message.

But I don't believe in miracles... so what have happened I have no idea?
My two cents on this is that the DNS change didn't propogate everywhere until I came back to look again into the problem.

Any other solutions are welcome!

UPDATE: Could be it was a proxy issue and the page was cached somewhere that's the reason behind the delay most probably!

Wednesday, May 13, 2009

Java Open CMS Comparison

There are a bunch of commercial and open source CMS out there.
Which is the best?
As I see it I don't want to bend over for the CMS to work! But the CMS has to work for me.
Functionality I am mainly looking for are the following:
  • 'whizzy' way to modify content.
  • Manage entities like categories, products... as proper entities not as documents
  • Easy way to manage translation
I started looking at the following CMSs:
I have used extensively Polopoly... I think its ideal for newspaper type content. Manages nicely translation and entities but lacks on the whizzy content.
On a smaller scale there is Blandware At Leap, similar to Polopoly. Nice approach but personally I think the business logic is tightly coupled with the CMS.
I had a look at the online demos for the rest of the CMSs in the above list.
I liked DotCMS... I will try to install it and give it a go....Will keep you posted!
Any other suitable CMS to add to my list?

SQL Server performance

When having a website which is under performing one of the bottlenecks could be the database.
Several reasons, database schema not correctly configured, too many calls to the database...
Normally I take this approach:
I switch on the SQL Profiler and look at the queries being sent to the database. I mimic online traffic by using tools like JMeter.
From the Profiler one can easily determine queries that take long and tackle those queries by adding any necessary indices, removing any fields that are not used and so on.
Also, I try to group calls to the database to avoid expensive DB trips.
Additionally one can have two connection pools... For Selects one may use a ReadOnly pool. This will perform queries much faster.
This link has some good tips to look at SQL Performance

Thursday, May 7, 2009

Automated testing with Hudson and Selenium

We use Hudson for continuous integration. I prefer Hudson from CruiseControl since its more user-friendly and one can easily add projects through the easy-to-use GUI instead of manually manipulating XML files.

Selenium is great framework to create automated tests.
My purpose was to automate the automated tests and add them to our build process so we have 'full circle'.

I created a little Java project and an ANT script where one can record tests using the Selenium IDE and adds these tests to our test suite. Test results are displayed using TestNG. If anyone is interested I can send him the test project I created.

My only problem was how to get the Selenium Server running when starting the job through Hudson.

My first attempt was an ANT as the following one:
<target name="start-selenium-server">
<java timeout="300000" fork="true" jar="${ws.home}/selenium-server-1.0-beta-2/selenium-server.jar">
<arg line="-port 4444">
<arg line="'-firefoxProfileTemplate">
</arg>
</arg>
</java>
</target>
While this approach worked fine when running through a command window, unfortunately the fork=true didn't work properly when launched as an ANT build step from Hudson. Hudson waited until the process timed out and didn't start the Selenium Server on a separate JVM.

My second attempt was to have the Selenium Service running as a Windows Service. This approach worked great!
I used Java Service Wrapper

One can easily follow the instructions here to set up JSW.

But this is how I have set up the wrapper.conf file:
# Java Application wrapper.java.command=%JAVA_HOME%/bin/java # Java Main class. This class must implement the WrapperListener interface # or guarantee that the WrapperManager class is initialized. Helper # classes are provided to do this for you. See the Integration section # of the documentation for details. wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp # Java Classpath (include wrapper.jar) Add class path elements as # needed starting from 1 wrapper.java.classpath.1=../lib/wrapper.jar wrapper.java.classpath.2=/selenium-server-1.0-beta-2/selenium-server.jar wrapper.java.classpath.3=/selenium-server-1.0-beta-2/selenium-server-coreless.jar wrapper.java.classpath.4=/selenium-server-1.0-beta-2/selenium-server-sources.jar wrapper.java.classpath.5=/selenium-server-1.0-beta-2/selenium-server-tests.jar wrapper.java.classpath.6=/selenium-server-1.0-beta-2/selenium-server-test-sources.jar # Java Library Path (location of Wrapper.DLL or libwrapper.so) wrapper.java.library.path.1=../lib # Java Additional Parameters # Log file to use for wrapper output logging. wrapper.logfile=../logs/wrapper.log wrapper.commandfile=./dump.command wrapper.ntservice.console=true # Initial Java Heap Size (in MB) #wrapper.java.initmemory=3 # Maximum Java Heap Size (in MB) #wrapper.java.maxmemory=64 # Application parameters. Add parameters as needed starting from 1 wrapper.app.parameter.1=org.openqa.selenium.server.SeleniumServer wrapper.app.parameter.2=-port 4444 wrapper.app.parameter.3=-firefoxProfileTemplate "C:\firefoxProfile" #Log Level wrapper.console.loglevel=DEBUG wrapper.logfile.loglevel=DEBUG #******************************************************************** # Wrapper Windows Properties #******************************************************************** # Title to use when running as a console wrapper.console.title=SeleniumService #******************************************************************** # Wrapper Windows NT/2000/XP Service Properties #******************************************************************** # WARNING - Do not modify any of these properties when an application # using this configuration file has been installed as a service. # Please uninstall the service before modifying this section. The # service can then be reinstalled. # Name of the service wrapper.ntservice.name=SeleniumService # Display name of the service wrapper.ntservice.displayname=SeleniumService # Description of the service wrapper.ntservice.description=SeleniumService # Service dependencies. Add dependencies as needed starting from 1 wrapper.ntservice.dependency.1= # Mode in which the service is installed. AUTO_START or DEMAND_START wrapper.ntservice.starttype=AUTO_START # Allow the service to interact with the desktop. wrapper.ntservice.interactive=true

Sunday, May 3, 2009

Agilo for scrum

Agilo for Scrum is an open source, web-based tool to support the Scrum process. It is developed and maintained by agile42, and supports Scrum Teams, Scrum Master, Product Owner and the main ceremonies and artifacts (copied from wikipedia ;) ).
It's free that's what makes appealing compared to Rally and ScrumWorks
Agilo also offers online hosting for your projects.

What's not stated in the website is what a tremendous task is to install this software. I usually give my thumbs down for a software that makes it difficult for me to work with. If its difficult to install, imagine the software itself to use it or the customer support.
Anyway I thought I'll give it a shot... my other opinion regarding open source is that they make it difficult or documentation sucks so you buy their services either consultancy or hosting... Nothing against Agile42 but across the years this is my experience with OSS.

In favour of Agilo, I have to state that I never used Python before. Anyway I found this link which made the installation less painful.

I just need to add the following points or make it more clear to round up what's nicely described in the stated link.

1. Agilo needs Trac to work with and in turn Trac works with Python 2.5. My first attempt before finding the above link was to install the latest version of Python :(
2. I had to install Setuptools to get it working.
3. Adding a user to trac
C:\Python25\Scripts>trac-digest.py -u username -p password >> "C:\Program Files\
Apache Software Foundation\Apache2.2\htdocs\trac\passwords.txt"

Add to administrators
C:\Python25\Scripts>trac-admin.exe "C:\Program Files\Apache Software Foundation\
Apache2.2\htdocs\trac" permission add maab TRAC_ADMIN

3. You can test the installation of trac before setting up Apache with the following command:
C:\Python25\Scripts>tracd-script.py -p 8000 --auth=trac,"C:\Program Files\Apache
Software Foundation\Apache2.2\htdocs\trac\passwords.txt",trac "C:\Program Files
\Apache Software Foundation\Apache2.2\htdocs\trac"

4. This is how I configured Apache
LoadModule python_module modules/mod_python.so


SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnv "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/trac"
PythonOption TracUriRoot /trac


That's all, good luck!

I haven't used the software extensively so far but it looks promising.