Posts

Finding a use for an iPad 1

I'd noticed that most of the recent applications in the App Store won't install on my iPad 1 anymore. They either need a gyroscope or IOS 6 or 7. My iPad is stuck on IOS 5. The first problem with this is that I haven't found a way to browse the App Store for applications that ARE compatible. This is incredibly frustrating, since its just left to trial and error finding some that will work. I'd heard about the ' download the latest version that is compatible ' feature, so decided that since my iPad is in awesome condition I'd gift it to my parents - who wouldn't be needing the latest and greatest features. This hasn't been so simple, and I suspect others might have the same problem so I've tried to document what I've found: Doing a 'reset' to erase the iPad (before gifting it to someone) will leave you in the unfortunate situation of not being able to install many applications very easily. At this point, it doesn't seem p...

Using Selenium WebDriver to select JSF/PrimeFaces selectOneMenu options

I'm using JBehave with Selenium WebDriver to test my PrimeFaces (JSF2) application. Selecting an option from a SelectOne option list isn't standard though because of the HTML markup generated by the JSF component. The facelets code to place the selectOneMenu uses the ID 'state': This generates HTML div blocks with id's prefixed with this components id: To select an option, I use a method which manipulates the appropriate divs - this can be used as illustrated below: To reuse this type of utility method, I put it in a base Page Object class:

Some user feedback

I was exporting my banking transactions the other day. It's a much more tedious process than it has to be and after using this for years and not seeing any updates to the site I thought I'd send some feedback - written as stories: As an Online Banking Customer, I want the system to remember my export preferences so that I can efficiently export my transactions ­  currently I have to set everything every time (even if you navigate from a selected account, you still have to pick an account) ­  file format (i.e CSV) ­  date format (dd/mm/yycc)  As an Online Banking Customer, I want to export transactions for all my accounts in one go so that I can efficiently export my transactions ­ so I don't have to do them one at a time ideally multiple accounts in one file  As an Online Banking Customer, I want to be able to access more than 12 months worth of transactions so that I don't have to export so often. ­  not much history is available online...

Exposing the version of your Maven built web application

Sometimes its useful to expose the version of your web application - I find it useful so vsConsole can display the version of the deployed application for each environment on the dashboard. If you build your app with Maven, you can use this code to get the version, and simply wire up a controller/rest endpoint to return it as text/plain. To expose the version of your maven built spring web application, you can use a REST controller like that shown below. Note, you won't see a valid version while running in the IDE - it'll only work when running the Maven built WAR. If you want to add the Jersey dependencies to your spring application try using the following dependency declaration.

Avoid embedding database connection information in your code

I've seen projects where the application code base contains database connection information - passwords and all, or, WAR files are rebuilt for each environment with properties substituted appropriately for the target environment. Rather than putting database information in the application code, it makes more sense to use a JDNI data source provided by the container. This way the exact same application code is deployed to all environments, and we don't encounter any exposed passwords - since the owner of the container (in production environments the infrastructure/support team) define the data source themselves. Database access via JNDI data source in Tomcat In your application server you want to define a data source which points to the database server and schema of your choice. Here, I'm using the H2 database , and assuming this is the DEV Tomcat server, I point it to the DEV schema - define this resource in the Tomcat context.xml :  <Resource name=" jdbc/...

Deploying to Tomcat 7 with Maven

It's sometimes nice to be able to update a development Tomcat 7 server from Maven - this makes it simple to hook automatic deployment into a CI server or just update the dev server as a developer. First, the Tomcat manager application needs to be installed (check Tomcat's webapps directory for the manager application) and configured with the appropriate user credentials: Now, I needed to define the server admin credentials in my maven settings (~/.m2/settings.xml): Then, I updated the POM to configure the maven tomcat plugin : Now, using 'mvn tomcat7:redeploy' lets me update the dev server. Note however, on Windows you may have some problems with undeploying the application - after an undeploy command, some jars may be left over in the webapps/appname directory. When you try to redeploy your app you'll see an error containing " cannot invoke tomcat manager fail - unable to delete... ". To work around this, you can change the TOMCAT_HOME/...

Exception: AbstractMethodError requires c3p0 upgrade

Image
photo credit: markchadwickart via photopin cc I just encountered this exception: Exception in thread "main" java.lang.AbstractMethodError: com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.setCharacterStream(ILjava/io/Reader;J)V at org.hibernate.type.descriptor.sql.ClobTypeDescriptor$4$1.doBind(ClobTypeDescriptor.java:114) at org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:92) It turns out that upgrading c3p0 does the trick (from 0.9.1.2 to 0.9.2.1):         <dependency>             <groupId>com.mchange</groupId>             <artifactId>c3p0</artifactId>             <version>0.9.2.1</version>         </dependency>