Problem with Sybase performance

February 10th, 2010

We had a strange problem with Sybase performance: the query that should have used indexes while executing did not, and as a result took forever to execute.  For some reason the time stamp was not treated as date type when set from the code. So the easiest solution was to add ?DYNAMIC_PREPARE=true to the connection string, and that solved the problem.

Tip Calculator For Blackberry released

September 18th, 2009

A few days ago I release a tip calculator for blackberry phones. The application is very easy to use, and I’ve gotten very positive response so far. Check the calculator out at http://www.naftulinconsulting.com/j2me/tipcalculator.htm

Adding an Icon to Your Website

July 22nd, 2009

Here is how you can add an icon to your website – or actually to all the pages on your site. First of all you will need to find an image and convert it to the .ico format. I’ve used http://www.html-kit.com/favicon/ as an online tool to do that. Save icon image on your site and have pages refer to it with the following head segment:
<head>
….
<link rel=”shortcut icon” href=”_path_to_your_icon_.ico” >
</head>
And that’s it. Now I need to find a good icon for my sites 🙂

Integration testing with Maven

July 7th, 2009

If you need to run integration tests with Maven, check out FailSafe maven plug-in (http://mojo.codehaus.org/failsafe-maven-plugin/). It assumes that your integration tests are in the same directory as unit tests, but are named *IT.java. The reason you want to separate the integration tests execution from unit test integration tests, is because the integration tests take much longer and might have to have some setup before they are run and tear down after they are run.  You don’t want to run the integration tests all the time – it’s too expensive, but you do want to run them before developer checks in the code and (at least) for continuous build environment. To skip the integration tests you can use the following command:

mvn install -DskipITs

When using it, you will most probably get the following error:
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
To avoid this error add the following property in the properties part of pom.xm (after build as described by http://maven.apache.org/pom.html#Properties)
<properties>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>

One more thing – I had problems by just putting -DskipITs=true, since the plug-in code did not check for it. So I used the following plugin configuration note the skipITs:

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>failsafe-maven-plugin</artifactId>
<version>2.4.3-alpha-1</version>
<configuration>
<skipTests>${skipITs}</skipTests>
</configuration>

<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>

Place to get video training

July 1st, 2009

http://www.lynda.com/ – one of the places to get the training! My boss mentioned it in our conversation about training materials and looking at the site it might be a worth the money they are asking for… Where does one find time though?

Php code generator

June 4th, 2009

After a long search I found a wonderful Php code generator that runs on Windows, connects to your database, allows you to select tables and even asks you about security. It produced about 90% of the final code for me – I just needed to re-arrange certain things, trim certain long descriptions and have my database connection class replace in-place connection strings. Even without any of my work the solution worked out of the package! Impressinve. Here is the link to it: http://www.sqlmaestro.com/products/mysql/phpgenerator/download/ called Php Generator for MySQL.

Plugins I usually use with Eclipse installation

June 3rd, 2009

Here is the list of plugins I usually use with eclipse installation – a quick way for me to upgrade eclipse and still remember the site without searching for them:
FindBugs http://findbugs.cs.umd.edu/eclipse
DBViewer http://www.ne.jp/asahi/zigen/home/plugin/dbviewer/
PHPeclipse http://phpeclipse.sourceforge.net/update/stable/1.2.x/
PERL EPIC http://e-p-i-c.sf.net/updates
EMMA http://update.eclemma.org/
Mobile Tools For Java (DSDP/MTJ) http://download.eclipse.org/dsdp/mtj/updates/0.9/stable/
Java Decompiler http://java.decompiler.free.fr/
Java Auto Documentation Plugin http://jautodoc.sourceforge.net/update/

Spring JDBC and Sybase Temp Tables

May 8th, 2009

I had a problem with using temp tables and Spring JDBC code lately. The main problem was that in Sybase a temp table can be accessed only on the same connection which created it. When executing several SQl statements in default Spring JDBC usage (DriverManagerDataSource using connection pool) could give different connections from connection pool for each of the statements. So in default implementation we cannot garantee that a temp table is visible. One possible fix is to use transaction (@Transactional) which would ensure that same connection is used. In our case, Sybase is configured in a way that does not allow us to drop temp table in the same transaction as create and select from it.

com.sybase.jdbc3.jdbc.SybSQLException: The ‘DROP TABLE’ command is not allowed within a multi-statement transaction in the ‘tempdb’ database.

 So the only way out was to us SingleConnectionDataSource for one method as described in http://forum.springsource.org/showthread.php?p=239922&posted=1#post239922

I released Configuration Manager 1.7

January 8th, 2009

I released configuration manager 1.7. The new release adds support for different configuration values for different environments – like production, qa and development. It also adds a couple of tutorials: Environment settings: dev, qa, etc and How to enable JMX. Here is the link to download the latest release.

How to add sources to Eclipse/Idea project generated by Maven

November 21st, 2008

Wanted to have a link here, since it takes me a while to find it: http://maven.apache.org/plugins/maven-eclipse-plugin/examples/attach-library-sources.html.