Deferreds in loops and recursive functions (Dojo)

When working with deferreds it sometimes is not that easy and intuitive as I thought. If you don’t know perfectly well how the deferreds work, then a little mistake can destroy all the fun you can have with deferreds … and bring you headaches.

Most of the times you probably will use deferreds that are easy to handle, like in the following example:

So in this case you simply create a new deferred object and return its promise to the caller. When the remote call or whatever delays your execution, is finished, the deferred gets resolved and the caller can continue.

Read more... (241 words, estimated 58 secs reading time)

Posted in Javascript / HTML / CSS | Tagged , , | 1 Comment

Datepicker from UI-Bootstrap with non-US format

When I was trying to use a date format like “dd.MM.yyyy” in a datepicker element from the UI-Bootstrap library then I came across the problem that I couldn’t easily add a date by manual input.

I fixed that by writing a directive, which handles the input differently on that date format. I admit that it looks more like a hack but it works pretty good. Hopefully this functionality will be supported soon! Additionally the popup now closes automatically on “Enter” or “Tab”, which I prefer instead of tabbing through each date-field.


Posted in AngularJS | Tagged , | 10 Comments

Add DoubleClick behaviour to ng-grid

If you want to react when double-clicking on a row of a ng-grid in AngularJS, then you can do the following:

  1. Add the following Javascript-File to some dir accessible from your app and don’t forget to load it during startup.

  2. Define a function to handle the double-click and update the grid-options as shown here:

And now have fun :)



Posted in AngularJS, Javascript / HTML / CSS | Tagged , | 10 Comments

Jersey Tests with Authentication

When I tested my REST-interface, which I implemented with Jersey, I also wanted to write Unit tests for an easy test. Since I spent some time to get authentication and autorisation working, I stood before another problem, when logging in and check access to my resources.

The problem that occured was that with each request a new session id was generated, which makes my authentication worthless. But I found a way around it:

So the secret is to save the cookie of the response and append it to each following request!

Posted in Uncategorized | 1 Comment

Grizzly Server: Static resources locked when server running

When I was finished setting up my neatly configured environment (grizzly, jersey, filters, static resources, …) I got annoyed when I started to work on the frontend. When the Grizzly server was running and e.g. the index.html was called, then there seems to be a file lock on that file. This prevents me from making changes to it so that I would have to stop the server, save the file and start the server to make the changes visible. This is no fun when developing!

Read more... (167 words, estimated 40 secs reading time)

Posted in Java, REST | Tagged , | Leave a comment

IE: Event in onClick-Handler

When I normally register an onClick handler in Firefox or Chrome, the first argument will contain the event itself, but what about our old friend IE? This one won’t get any arguments and I wondered how I could access the event to figure out what kind of event it exactly was … and which target had been hit.

In IE there’s a global variable called ‘event’ which can be accessed and contains all the data we want to have. So in your code you probably need something like:

to make it work in all browsers!

Posted in Javascript / HTML / CSS | Leave a comment

OJB: Can’t read repository file ‘repository.xml’

When getting this error when trying to access a database configured with OJB, then check the XML-files referenced by the repository.xml file. If you find a XML-header then remove it and it should work fine again.

I had the problem when I wanted to dynamically change the repository_database.xml file and then tried to access the MetadataManager, which accessed the configuration file(s).  When I wrote the XML file with the TransformerFactory I had to do the following to remove the header:

Posted in Uncategorized | Leave a comment

JSP: NoSuchMethodError when accessing

When accessing your website with JSPs and you immediately get the error about not finding some method in class:

then you should check that there are not two different versions of the jasper compiler included.

Posted in Java | Leave a comment

Spring: Attribute “xmlns” must be declared for element type “beans”

This happens if you add ‘xmlns’ tags into your application-context file where you define your beans. Also other spring configurations might lead to a similar error. The solution for this is to remove the document type of the xml-file, which should look like this:

Afterwards the error should be gone, since the file is not checked against another definition.

Posted in Uncategorized | 1 Comment

SVN-Repository setup with Apache

To access your local repository from the internet/intranet you need to configure your Apache server.  The module for svn access must be loaded first and afterwards the location and how to access the repository. Edit the http.conf as a super user as following:

Or if you wanna add security access:

Then you should however add the password via the command line:

Restart the web server and you’re done! You should now be able to access your svn repository via the url:

Posted in Apache | 1 Comment