Pages

Sublime-HTMLPrettify

HTMLPrettify couldn't find nodejs because it sets the default path to:

c:/Program Files/nodejs

in the HTMLPrettify.sublime-settings file.

I changed it to:

d:/Program Files/nodejs

but that didn't work either.

Ultimately I added "node.exe" to the path giving:

d:/Program Files/nodejs/node.exe

and suddenly it all came to life.

Linux Mint 15 CodeLite Unit Tests

When I created my first Unit Test in CodeLite it would not compile because UnitTest++.h was not available.

I loaded libunittest with:

sudo apt-get install libunittest++-dev


Then added /usr/include/unittest++ to the CodeLite compiler includes by opening the Build Settings dialog which is on the Settings menu.


printf format strings

I copied this excellent quick reference guide from Pádraig Brady at PixelBeat lest it should go offline at some point in the future.


%[flags][min field width][precision][length]conversion specifier
  -----  ---------------  ---------  ------ -------------------
   \             #,*        .#, .*     /             \
    \                                 /               \
   #,0,-,+, ,',I                 hh,h,l,ll,j,z,L    c,d,u,x,X,e,f,g,s,p,%
   -------------                 ---------------    -----------------------
   # | Alternate,                 hh | char,           c | unsigned char,
   0 | zero pad,                   h | short,          d | signed int,
   - | left align,                 l | long,           u | unsigned int,
   + | explicit + - sign,         ll | long long,      x | unsigned hex int,
     | space for + sign,           j | [u]intmax_t,    X | unsigned HEX int,
   ' | locale thousands grouping,  z | size_t,         e | [-]d.ddde±dd double,
   I | Use locale's alt digits     t | ptrdiff_t,      E | [-]d.dddE±dd double,
                                   L | long double,  ---------=====
   if no precision   => 6 decimal places            /  f | [-]d.ddd double,
   if precision = 0  => 0 decimal places      _____/   g | e|f as appropriate,
   if precision = #  => # decimal places               G | E|F as appropriate,
   if flag = #       => always show decimal point      s | string,
                                             ..............------
                                            /          p | pointer,
   if precision      => max field width    /           % | %

Linux Mint 15 Codelite C++11 gcc 4.7.3

I'm experimenting with C++11 using CodeLite 5.1 and gcc 4.7.3

The support for C+11 is experimental and has to be turned on with a compiler switch. This page describes the alternatives.

I used -std=c++11


which I set in the Project Settings dialog. Common Settings / Compiler / C++ Compiler Options, like this:


I also made the compiler switch available to all build configurations by adding to the Build Settings dialog which is on the Settings option of the main menu:

Linux Mint 15 Launch Browser with Function Key

On my Compaq 6820s (UK keyboard) the F3 key should have launched the default web browser but didn't.

I used the Keyboard Shortcuts app to redefine the key used to launch the browser:

Linux Mint 15 Suspend when power button is pressed

I wanted my Compaq 6820s to Suspend when the power button was pressed. Using the Power Management application I set the General tab options like this:


But the results were unreliable, something along the lines of:
Press Power -> Laptop Suspends
Press Power -> Laptop Resumes, briefly, then Shuts Down
Press Power -> Laptop boots

I looked at the /etc/acpi/powerbtn.sh

I don't know how this script works but the last two lines caught my eye:

# If all else failed, just initiate a plain shutdown.
/sbin/shutdown -h now "Power button pressed"


Which makes it quite difficult to catch problems. So I commented out the last line:

sudo pluma /etc/acpi/powerbtn.sh

# If all else failed, just initiate a plain shutdown.
#/sbin/shutdown -h now "Power button pressed"


And that was sufficient to give me the result I was looking for. Now the power button consistently follows the actions in the Power Management settings.

Linux Mint 15 Suspend when laptop lid is closed

I tried to use Power Management to set my laptop to Suspend when the lid is closed but instead it simply blanked the screen.

I found a workaround here, thanks to Unrealist.

In the file /etc/acpi/lid.sh comment out this line . /usr/share/acpi-support/screenblank something like this:


sudo pluma /etc/acpi/lid.sh

if [ $? = 0 ]
then
    for x in /tmp/.X11-unix/*; do
 displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
 getXuser;
 if [ x"$XAUTHORITY" != x"" ]; then
     export DISPLAY=":$displaynum"     
     #. /usr/share/acpi-support/screenblank
 fi
    done