December 2, 2013

using external JARs in Eclipse

In order to use external JAR files in Eclipse, the most robust way if
you develop on multiple platforms is to use "Preferences > Java > Build
Path > Classpath Variables" to add a classpath variable. You can give it
any name you wish, and you must associate to it the file name of the JAR
that you want to include.

import source code in eclipse

To import existing source code in Eclipse, do the following:
1) Create a new project and give it the same name with the directory
containing your source code.
2) Uncheck "Use default location" and manually set the location to the
directory containing the source code.
Usually Eclipse automatically detects your source code, and you can
simply click "Finish" to finalize project creation.

November 26, 2013

color code messages in thunderbird

In order to color message lines in the message pane in Thunderbird, you need to edit the CSS file "chrome/userChrome.css" in your profile directory. On Mac OS X this is located in "~/Library/Thunderbird/Profiles/xyz.default/". If the CSS file (or the chrome directory ) do not exist, create them.

A possible application is color coding replied messages. The code below uses green color to highlight them:

/*
 * Do not remove the @namespace line -- it's required for correct functioning
 */

/*
 * Set default namespace to XUL
 */
@namespace
url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");

/* background for normal message lines */
treechildren::-moz-tree-cell(replied) {
background-color: LightGreen !important;
}
/* background for current message line */
treechildren::-moz-tree-cell(replied,current) {
background-color: Green !important;
}
/* background for selected message lines */
treechildren::-moz-tree-cell(replied,selected) {
background-color: Green !important;
}

More examples can be found here:
http://www.eriwen.com/css/tweaking-thunderbirds-chrome/

October 31, 2013

show changes for a certain revision in svn

In order to show the source code changes for a certain revision "RVSN", use the following command:
> svn diff -c RVSN

October 4, 2013

hide tab in Thunderbird

In order to hide the tab in Thunderbird and increase the useful window area, set the option "mail.tabs.autoHide" to "true" by using the Config Editor (accessible from Preferences > Advanced > General). If more that one tab are created, then the area is displayed again.

October 1, 2013

map Alt key in Linux when logging from Mac OS X

When logging from Mac OS X in Linux via ssh, the Alt key seems not to be mapped correctly, and it cannot be used in emacs. The solution seems to be to run this command on the Mac OS X machine from which you connect:
xmodmap -e "keycode 66 = Meta_L"

September 20, 2013

fix create INBOX folder problem in Thunderbird

When using Thunderbird with IMAP folders, you may encounter the fact that INBOX folders are created in the IMAP directory when moving messages to Trash.
One way to fix this is to use the Config Editor (Preferences > General menu) and search for "trash_folder_name". The value of can be something like INBOX/Trash, and it should be changed to Trash.
You should restart Thunderbird for the changes to take effect.
Reference: http://superuser.com/questions/278745/thunderbird-creates-a-folder-called-inbox-on-imap

September 19, 2013

prevent updates in ubuntu

To prevent the update of certain packages in Ubuntu, you can use Synaptic to lock those packages. This is accomplished by selecting the package and then choosing Package > Lock version from the menu.

For example, in order to prevent kernel updates, the following packages should be locked:
- linux-headers-generic
- linux-image-generic
- linux-headers-generic-pae
- linux-generic

August 29, 2013

tab completion for sudo

In order to enable tab completion for sudo, use the following command:
> complete -cf sudo
You can add it to ~/.bashrc for instance to activate this feature each
time you use bash.

August 20, 2013

rotate PDF files with pdftk

An easy way to rotate PDF files is to use the 'pdftk' toolkit.
Thus, in order to rotate all the pages of the document INPUT_FILE by 90 degrees clockwise (to the east) and save the output in OUTPUT_FILE, use the following command:
pdftk INPUT_FILE cat 1-endE output OUTPUT_FILE

July 30, 2013

terminal bell in ubuntu 12.04

The terminal bell seems to be disabled in Ubuntu 12.04, and to enable it the "pactl" (pulseaudio control) command needs to be used. For instance, in order to activate the "drip" sound as a terminal bell use the following command either on the command line or in .profile or .bash_profile:
/usr/bin/pactl upload-sample /usr/share/sounds/gnome/default/alerts/drip.ogg bell.ogg

In order to control the terminal bell volume use the following command either on the command line or in .bashrc:
/usr/bin/xset b 30

Reference: http://www.thinkwiki.org/wiki/Installing_Ubuntu_12.04_%28Precise_Pangolin%29_on_a_ThinkPad_X220

February 22, 2013

slow access to SMB shares on Mac OS X

Access through Finder to SMB share on the newer versions of Mac OS X
(e.g., Lion) can be slow. One possibility to improve speed is to create
the following configuration file that overrides the default OS values
'~/Library/Preferences/nsmb.conf':
[default]
notify_off=yes
By doing this you will turn off using notifications for changes on the
remote share, which can slow access for shares with many files.
Disclaimer: I do not know yet if there is any adverse effect of this
setting!

February 13, 2013

access menus in Mac OS X via keyboard

To access the top menus in Mac OS X via keyboard use the following
shortcut to select the first menu entry (the Apple logo):

* Control-Fn-F2 if you use F1, F2, etc. as system control keys
(brightness, etc.)

* Control-F2 if you use F1, F2, etc. as standard function keys.

Then you can use the arrow keys and enter to select a certain menu item.

February 8, 2013

hide folders in Mac OS X

To hide folder in Mac OS X, type the following command:
chflags hidden /path/to/folder/

The folder will not be visible in Finder, but you can still access it
via the Terminal.

To unhide the folder, use the following command:
chflags nohidden /path/to/folder/

February 3, 2013

disable ready (drum) sound in ubuntu 12.04

Create (or edit) the following file:
/usr/share/glib-2.0/schemas/50_unity-greeter.gschema.override

Add to it the following section and content:
[com.canonical.unity-greeter]
play-ready-sound = false

Make the OS aware of the changes:
sudo glib-compile-schemas /usr/share/glib-2.0/schemas/