March 18, 2014

Angular JS : Angular-UI modals won't show up with Bootstrap 3

While migrating from Bootstrap 2 to 3 in an angular jS app, realized there was a bug in modals implementation : Angular-UI directive doesn't add a "display block" CSS prop to the built modal, so it will never show up.

To fix it, simply add the following CSS :

FIX ui-bootstrap modals + bootstrap 3
*/ .modal.ui-bootstrap-modal {   display: block; }
And open the modals this way :
$scope.openTheModal = function () {
templateUrl: 'myModalTemplate.html',
scope: $scope,
windowClass: 'ui-bootstrap-modal'
Here we add a different class from the regular 'modal' class. Reason is : in my app I had both plain Bootstrap3 modals and angular-UI modals. Simply adding display: block property on 'modal' class was breaking regular Bootstrap 3 modals.

Hope this help.

December 30, 2013

Grunt uglify task breaks angular app

Here is the error in the browser console :

  1. Error: [$injector:unpr] Unknown provider: aProvider <- a$injector/unpr?p0=aProvider%20%3C-%20a at http://localhost:9000/vendor/bower_components/angular/angular.js:78:12 at http://localhost:9000/vendor/bower_components/angular/angular.js:3538:19 at Object.getService [as get] (http://localhost:9000/vendor/bower_components/angular/angular.js:3665:39) at http://localhost:9000/vendor/bower_components/angular/angular.js:3543:45 at getService (http://localhost:9000/vendor/bower_components/angular/angular.js:3665:39) at invoke (http://localhost:9000/vendor/bower_components/angular/angular.js:3687:13) at Object.instantiate (http://localhost:9000/vendor/bower_components/angular/angular.js:3708:23) at http://localhost:9000/vendor/bower_components/angular/angular.js:6758:28 at link (http://localhost:9000/vendor/bower_components/angular-route/angular-route.js:897:26) at nodeLinkFn (http://localhost:9000/vendor/bower_components/angular/angular.js:6212:13) <div ng-view="" class="ng-scope"> angular.js:9384

What happened is that Grunt uglify task included angular files (angular-route.js in this case).
Minification included in uglify task broke the file by minufying some string that mustn't be minified.

Three solutions :
  • Make the grunt task do not include unwanted files, and include those files already minified in your app.
  • If problem still occurs after first solution, your angular modules are not "uglify friendly". There's a special way to declare your dependencies so that minifying goes smooth, as described on this page ("a note on minification" paragraph) for example. Please note that instead of doing this declaration "by hand", you can use the "ng-min" task that automatize the process and keep your code clean.
  • Well, in my case I still had issue, so I ended turning off the "mangle" option in uglify (that very option that make long strings into smaller to compress response size). You can turn off the option like this :
 uglify: {

            options: {
                mangle: false

Hope this help.

August 28, 2013

Getting MysQL utilities to work in MySQL Workbench 6.0 on Ubuntu 12.04 LTS

I installed MySQl Workbench 6.0 (downloaded from thier website) on my Ubuntu 12.04 LTS.
Installation ran smoothly.

However when I tried to start the shell for MySQL Utilities, I had an error saying that MySQL utilities weren't installed, and that I had to download and install them.

So I did. But when trying to install the .deb package for my arch, boom :

The MySQL Connector/Python module was not found

I found this module that looked like the right one (disclaimer : I'm a total noob regarding linux)

sudo apt-get install python-mysql.connector

Installation OK, but still MySQL can't find the connector.

What worked in the end : download and compile sources :

cd /usr/share

sudo wget

sudo unzip

cd mysql-connector-python-1.0.12/

sudo python install

Then I was able to launch the shell utilities.

Hope this help.

August 14, 2013

Eclipse shortcuts

There's already tons of posts dealing with this, but I don't care and I'll share my favourite eclipse shortcuts anyway :

Ctrls ^^
Ctrl + Space => completion
Ctrl + T => show implementations for an interface method
Ctrl + Shift + O (the letter)=>organise imports
Ctrl + Alt + H => lookup call hierarchy for this method or attribute
Alt + Shift + X, then J => Run a java class containing a main method
Alt + Shift + X, then T => Run junit tests in current class
Alt + up or down arrow => move a line up or down
Alt + left or right arrow => go to last edited location
Ctrl + Alt + up or down arrow => duplicate current line and copy it above or below
Ctrl + page up or page down => move from one tab to another. Really useful, except when you hit the bloody xml editor in your tabs...
Ctrl + L => goto line number ....
Ctrl + Shift + L => pops up the shortcut list
Alt + Enter => Access file properties. Useful to check file encoding, or check version control file URL
Ctrl + Shift + R => Open File
Ctrl + Shift + T => Open Type. Useful to find a class in a jar for example
Ctrl + W => Close file
F12 => Go to editor view
Ctrl + M => maximize/minimize current editor
Ctrl + 1 => show quickfix. has the same effect as hovering over an error with the mouse
Ctrl + E => display list of opened editors
Ctrl + Shift + F => Format code
Ctrl + I => Indent code
F3 => open d├ęclaration
F4 => open hierarchy
Alt + Shift + R => rename field
Alt + Shift + T => show refactor menu

I usually also create a binding for the "generate getters and setters" action.

Please feel free to propose new ones if you feel like I've forgotten important ones.

July 18, 2013

PowerMock and SSL Context : NoSuchAlgorithmException

I was  trying to unit test a method that's sending an HTTP message to a potentially secured URI. Therefore, somewhere in the process the javax SSL Context interface is used.

I obvisouly want to mock that call, because I'm testing the method and not the call itself. When ryunning the test, I get the exception below :

com....TechnicalException: class configured for SSLContext: not a SSLContext


at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(

at sun.reflect.DelegatingMethodAccessorImpl.invoke(

at java.lang.reflect.Method.invoke(

at org.junit.internal.runners.TestMethod.invoke(

at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.runTestMethod(

at org.junit.internal.runners.MethodRoadie$

at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(

at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.executeTest(

at org.powermock.modules.junit4.internal.impl.PowerMockJUnit49RunnerDelegateImpl$PowerMockJUnit49MethodRunner.executeTestInSuper(

at org.powermock.modules.junit4.internal.impl.PowerMockJUnit49RunnerDelegateImpl$PowerMockJUnit49MethodRunner.executeTest(

at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.runBeforesThenTestThenAfters(

at org.junit.internal.runners.MethodRoadie.runTest(


at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.invokeTestMethod(

at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.runMethods(

at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$

at org.junit.internal.runners.ClassRoadie.runUnprotected(

at org.junit.internal.runners.ClassRoadie.runProtected(







at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(


at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(

Caused by: class configured for SSLContext: not a SSLContext




... 31 more

This is related to the SSLCOntext loading stuff from the upstream classloader - which is Power Mock's one when running the test.

Solution : use @PowerMockIgnore annotation on the top of your test class :


public class MessageProcessorTest { ... }

Found the solution thanks to this thread and that issue.



June 02, 2013

ATI Radeon 2600 drivers on Ubuntu 12.04.02 with 3.5.0-32 kernel

I just spent a few hour trying to install proprietary drivers on my (old) laptop for my (old) graphic card.
If the following configuration talks to you, then I might help you :-)

- Ubuntu 12.04.02
- Kernel version 3.5.0-32-generic
- ATI Radeon 2600 graphic card

Since the last kernel update, unable to install Catalyst 13.1 drivers. dpkg creation is successful, but when trying to install those dpkg I am getting a bad exception when fglrx is installing.

Error! Bad return status for module build on kernel: 3.5.

DKMS part of installation failed. Please refer to /usr/share/ati/fglrx-install.log for details

Same result with the graphic installer of course.

After a while I found some 13.4 Catalyst drivers. Installation goes smoothier, but in the end...

aticonfig: No supported adapters detected 

Arrrgh ! They dropped support for 2600 series in this version !

Only solution that worked for me :

Hope this help !

May 28, 2013

Concurrent calls in Axis 1.4 : thread safety issue

I had to deal with concurrent calls issue in Axis 1.4.
After googling a bit, it turns out that some guys from axis crew state the following :
- Generated service locators are thread safe
- However, ports stubs retrieved from those locators are NOT thread safe !

So even if the stubs look designed to be reused (they're caching bits of request for performance matter I suppose), that's really a bad idea to do so.

I wanted to know where exactly the problem was, so I dove into the sources, and here is what I found.

Let's suppose I retrieve my stub this way :
axisGeneratedProxy.getMyGeneratedWSStub().theMethodToCall([some Params]);
In the theMethodToCall method, you'll find the following :
org.apache.axis.client.Call _call = createCall();
If you go up the hierarchy a little, you'll find out that the createCall method is returning a call object generated from the org.apache.axis.client.Stub class. This call object is generated this way :
public abstract class Stub implements javax.xml.rpc.Stub {
 // The last call object
 protected Call _call = null;public Call _createCall() throws
      * Creates a call from the service.
      * @return
     public Call _createCall() throws ServiceException {
         _call = (Call) service.createCall();
          // TODO: There is a lot of code in the generated stubs that
         // can be moved here.
         return _call;

So what do we have here ? The generated call object is stored temporarly in a _call class attribute. If concurrent threads T1 and T2 get mixed up in this method, we'll end up with both threads sharing the same call object.

So, back to the stub code.
After getting back this call object, it's filled with data. Here, both threads will manipulate the same object, so potentially some data will get mixed up... but as we're in a stub method, that should be the same data so it doesn't really bother.

But the real problem occurs later in the call.invoke() method : when adding the body element to the message, the following private method is used :
 public void addBodyElement(SOAPBodyElement element)
        if (body == null) {
            body = new SOAPBody(this, soapConstants);

        _isDirty = true;

Here the body attribute is a class attribute... If two or more threads get mixud up here, the stub sharing the same call element, the two calls will go to the server with the same body element...

Solution : use many stubs, don't reuse one !