Wednesday, April 8, 2015

Testing Google Task Queues

Google Task Queues are a great way to have snippets of code be executed at a later time. They can be used to spread application load, or to have some task executed at a programatically provided timestamp. The API is easy to understand and use, and Google provides an easy way to Unit test your code.

So far so good! This works perfectly when you use the default queue. If you want to use a non-default queue, however, there's a catch. The documentation prescribes that you just point your LocalTaskQueueTestConfig to the queue.xml file, and that's it. That is indeed all there is to it, but only if you have the XmlParser on your classpath (org.mortbay.xml.XmlParser). If it is not there, add this dependency to your POM:

<dependency>
  <groupid>com.google.appengine</groupid>
  <artifactid>appengine-tools-sdk</artifactid>
  <version>${appengine.target.version}</version>
</dependency>


This provides the XmlParser you need!

Tuesday, June 24, 2014

Summer of Technology 2014 @Contribute

A new summer, a new Summer of Technology! As tradition prescribes, there's an interesting workshop/session every Tuesday of the summer. I will be hosting a session on Google's Cloud platform, but there's a lot of other topics as well.

Pick your session and subscribe!

Tuesday, February 4, 2014

XPath in Internet Explorer

Every web developer knows how difficult it is to get things running on all browsers. Usually, Internet Explorer is doing the best it can to make your life a hell. A good example thereof, is it's lack of XPath support.

In most browsers, you can use document.evaluate() to pass an XPath expression, and get a result. In Internet Explorer, however, this method just doesn't work. No error message, no result, just some unexpected behavior in your application. Luckily, there's an easy solution that doesn't require you to rewrite your code, or implement some ugly if IE hacks.

The solution is called Wicked Good Xpath, and is an open source project maintained by Google. It's easy to use, and doesn't interfere with your existing code. You can find everything you need here.

Basically, all you have to do is download the .js file, and add it to your page through script tags.

<script src="wgxpath.install.js"></script>

Then you have to call wgxpath.install() from your JavaScript code, and the document.evaluate() function will be available.

Thursday, October 24, 2013

Setting a timeout on an Apache CXF webservice call

In this short post, I'll provide the code for setting a timeout on a webservice call. The client has been generated by Apache CXF 2.6.1, and the webservice is accessed by an HTTP call.

Client client = ClientProxy.getClient(yourPortType);

HTTPConduit httpConduit = (HTTPConduit) client.getConduit();

HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(5000);
httpClientPolicy.setReceiveTimeout(5000);

httpConduit.setClient(httpClientPolicy);

You should add this chunk of code before you call the method on yourPortType. The connectionTimeout is how long it may take to connect to the service, the receiveTimeout is how long it may take for the webservice to respond.


Wednesday, September 11, 2013

Web Accessibility Course

Attention fellow web developers! Google is giving a free online course to improve the accessibility of your website/application. While this might not seem like a big issue, the World Health Organization estimates the number of people with visual impairments to be 285 million. You can save them from a lot of frustration, and offer a far better user experience by following a few guidelines.

Making your site more user friendly to blind or low vision people doesn't have to be 'a pain in the ass'. It should come naturally, with a minimum of extra effort. Google will provide techniques and tools, as well as expert guidance to make the world wide web a slightly better place, one site at a time.



Thursday, June 27, 2013

Summer of Technology @Contribute

Just like last year, Contribute organizes a 'Summer of Technology'. The concept is as simple as it is nice: free one-day workshops for everyone interested. If you're a developer, architect, ... or just a technology enthusiast, take a look at the sessions we're organizing, and register for the ones that you're interest in.

You'll find the full overview at the Contribute website: http://www.contribute.be/sot

Topics range from Oracle Forms over BigData/NoQSL to version control. Every tuesday, this summer!

Friday, June 14, 2013

Eclipse cannot run program javaw.exe

Yesterday, I checked out a project from SVN, I ran mvn eclipse:eclipse and imported it into my IDE. So far so good, everything compiled, Maven could run all the tests, all was well.

But then I tried to run a JUnit test in Eclipse. I kept getting a strange error about Eclipse not being able to run javaw.exe in my project-folder. After some Googling, I found that the underlying error that causes this problem, was of an entirely different nature: Windows has a character limit to command line statements. And since Eclipse assembles the classpath itself to pass it on as a launch parameter, the command line character limit got violated.

I now knew what was causing the error, but fixing it didn't seem that simple. I tried to remove all unnecessary libraries (there weren't a lot), but the problem persisted. So I changed to drastic measures: I moved my Maven repository to a folder directly at my C:\ disk. The path was about 30 characters shorter than before, but since Eclipse was adding a whole lot of Maven libraries to my classpath, it made a huge difference.

After that, I could run my JUnit test without any problems. I suppose I'm safe for now, but what will happen when we add even more libraries to the project? It's possible that at a given point, the classpath will be too long for even the shortest possible repo-path you can get. And then what? Switching to Linux could be an option, but during my quest to solve this problem, I also read that IntelliJ has better support for this. So going there could be an option too. Or I could just write/wait for an Eclipse plugin that deals with this problem...