Friday, November 20, 2015

Web site incorrectly rendering a font in italics at least in Windows Chrome browser

If your browser (I have seen it in Windows Chrome) incorrectly renders a specific font in italics you might be facing a corrupted font.

The first thing to do in order to resolve this issue is to determine the font being used. This is something you can find easily from chrome inspector (right click on an incorrectly rendered in italics word) which will reveal the current applied style including the font.

Once you know the font type then go to and select that font. Most likely it will be looking also in italics. See below how the whole page renders in italics:

This means that the particular font is corrupted as a result of a corrupted program installation or uninstallation.

To correct the issue just delete the font from C:\Windows\Fonts and bring it back again from a working machine (the file is a ttf which contains bold, italics, narrow and other combinations for example arial.ttf).

Saturday, November 14, 2015

On Protractor: End to End (e2e) tests should fail if there are javascript errors

End to End (e2e) tests should fail if there are javascript errors. They most likely won't cover all the application functionality, but many (if not most) of the regressions we encounter in production are related to javascript errors. Here is how to stop your continuous delivery pipeline if there is a single javascript error at runtime. Note that at a minimum smoke e2e tests should exist meaning that all of your views should be tested at least expecting to render html, not having unexpected logical errors and not having javascript errors. Webdriver allows us to get a hold of the browser console log. This means we can detect if there are javascript errors at runtime and make our tests fail. For more info see Protractor makes our lifes easier though. All we need to do is to include the below configuration in protractor.conf.js:
exports.config = {
  plugins: [{
    path: 'node_modules/protractor-console-plugin',
    failOnWarning: true,
    failOnError: true
// To test the solution just force a JS error that does not stop your test from passing. // For example adding a simple script tag in your index.html:
    console.undefinedMethod('will never run');
After the test is run you get:
Plugin: /usr/local/lib/node_modules/protractor/plugins/console/index.js (teardown) Fail: Console output SEVERE: 72:17 Uncaught TypeError: console.undefinedMethod is not a function [launcher] 0 instance(s) of WebDriver still running [launcher] chrome #1 failed 1 test(s) [launcher] overall: 1 failed spec(s) [launcher] Process exited with error code 1

Tuesday, November 10, 2015

Find all javascript files except those below a directory

Very useful specially for those dealing with nodejs where we want to avoid searching for "node_modules"
find ./ -not -path "*node_modules*" -name "*.js"

Friday, October 30, 2015

Find out apache module version

It took me sometime to find out a way to determine the version number of any apache module. Basically the 'strings' command can extract the existing strings in the shared library and with grep we can use the regex "${mod_name}/[0-9]\.[0-9]" where mod_name is a variable containing the name of the module. I am omitting the real version numbers below for security reasons:
$ strings /usr/lib/apache2/modules/ \
    | grep "mod_pagespeed/[0-9]\.[0-9]"
$ strings /usr/lib/apache2/modules/ \
    | grep "mod_ssl/[0-9]\.[0-9]"

Wednesday, October 28, 2015

RabbitVCS needs restart in ubuntu 14.04 with lxde

It used to work out of the box with 12.04 and unity but now it needs restart after installation:
sudo add-apt-repository ppa:rabbitvcs/ppa
sudo apt-get -q -y --force-yes install rabbitvcs-core rabbitvcs-cli rabbitvcs-gedit rabbitvcs-nautilus3exit
sudo shutdown -r now
In addition in a different machine with update and upgrade it started showing up (no restart needed):
sudo apt-get -y update
sudo apt-get -y upgrade
In other cases just restarting nautilus made the trick:
killall nautilus
I even had to just start nautilus from command line to get it to work:

Sunday, October 11, 2015

trying to overwrite ... which is also in package ... Sub-process /usr/bin/dpkg returned an error code (1)

dpkg: error processing archive /var/cache/apt/archives/libffi-dev_3.1~rc1+r3.0.13-12_amd64.deb (--unpack):
 trying to overwrite '/usr/share/info/', which is also in package xrdp 0.9.0+master
Processing triggers for man-db ( ...
Processing triggers for doc-base (0.10.5) ...
Processing triggers for install-info (5.2.0.dfsg.1-2) ...
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)
$ sudo dpkg -i --force-overwrite /var/cache/apt/archives/libffi-dev_3.1~rc1+r3.0.13-12_amd64.deb

Thursday, October 08, 2015

Solution for mysql Warning: Using a password on the command line interface can be insecure

Mysql or mysqldump "Warning: Using a password on the command line interface can be insecure" should not be IMO in the stderr. The stderr is for errors and not for warnings. The correct way to handle these situations in the shell should be using a different handler (should I propose stdwarn or stdwarning?) which of course we do not currently have available.

As I have stated in Stackoverflow, the recommended way to solve this issue penalizes the ones that do the right thing to protect the ones that do the wrong thing. If the password is stored inside a script file it will not show up with ps or in any log. Putting the credentials in an external file does help the ones that would cron a command using the plain text password instead of variables which, but why helping those when they are doing the incorrect thing? In the meantime scripts that have been running for years now fail and we need to modify them just because this warning comes up in the stderr.

Since we are stuck with using the external credentials file here is a quick hack to please mysql commands. Basically we create the file on the fly: