August 27, 2014

Webstorm loses keyboard input in Ubuntu 14.04

Sometimes my Webstorm IDE loses input from keyboard in Ubuntu 14.04. I've seen people complain about it as well with PhpStorm and IntelliJ.

Symptom : mouse clicks and menu work as expected, but no keyboard input is accepted and I must restart Webstorm to make it work again.

Solution : restart the ibus service in a terminal :

sudo ibus restart

For latin keyboard people, this switched my keyboard from AZERTY to QWERTY. I had to enter the following command to make it AZERTY again.

setxkbmap fr

Hope this helps.

August 12, 2014

Ubuntu default shortcuts Ctrl+Alt+Numpad overriding google docs quick style shortcuts

I love Google Docs - it's just so fast and user friendly.

I was really used to the Ctrl+Alt+1 / Ctrl+Alt+2 / ... shortcut allowing you to quickly set a level 1 / 2 / ... header style on a line.

When I switched to Ubuntu a couple of years ago, I realized this keystroke was already assigned to Window placement and was overriding GDocs shortcuts, but I never took the time to dig where I could override this behavior.

Today, I'm proud to announce that I finally found it ^^. In case it might help anyone : the offender is the "Grid" plugin. You can configure it or switch it off using CompizConfig Configuration Manager.

Hope this help.

May 11, 2014

Translate Angular-UI DatePicker - text and popup buttons too

You might want to Angular-UI date picker in your own language instead of default english.
Fortunately, guys at Angular-UI team did the job well and used i18n angular system.

All you have to do is to include the correct language pack :

<script src="//"></script>
<script src=""></script>

There's still the popup action buttons that are not translated.
As stated in the doc, you can configure the text displayed in those buttons by altering the datepickerPopupConfig global object default values :

var DatepickerDemoCtrl = function ($scope, datepickerPopupConfig) {
datepickerPopupConfig.currentText = 'Aujourd\'hui';
datepickerPopupConfig.clearText = 'Effacer';
datepickerPopupConfig.closeText = 'Fermer';
Here's a Plunkr for demoing purpose.

Hope this help !

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.