Monday, May 14, 2012

Install Oracle VM VirtualBox in [X]Ubuntu/Debian (ppa)

Oracle VM VirtualBox (formerly Sun VirtualBox, Sun xVM VirtualBox and innotek VirtualBox) is an virtualization software package that's installed on an existing host operating system as an application; this host application allows additional guest operating systems, each known as a Guest OS, to be loaded and run, each with its own virtual environment.

Install

Open a terminal window and run:

# 1
sudo sh -c "echo deb http://download.virtualbox.org/virtualbox/debian `lsb_release -a | egrep -i codename | awk '{print $2}'` contrib > /etc/apt/sources.list.d/virtualbox.list"
# 2
wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -
# 3
sudo apt-get update && sudo apt-get install virtualbox virtualbox-qt virtualbox-guest-additions-iso -y
# 4
sudo usermod -a -G vboxusers $USER

References

VirtualBox 4.1.14 for Linux
VirtualBox at Wikipedia
Ubuntu – Distribution Agnostic Virtualbox Auto-Install Script (What Justin's Thinking)

Sunday, May 13, 2012

Mouse Scrolling without raising window in XFCE 4/Xubuntu

By default, when scrolling with the mouse wheel on a window that's on the background, that window is raised becoming the top window.

To prevent the window from raising, open a terminal window and run:

xfconf-query -c xfwm4 -p /general/raise_with_any_button -s false

The same result can also be accomplished with "Settings Editor" (xfce4-settings-editor), selecting the xfwm4 channel and unpicking the raise_with_any_button value.

[FIX] Adjust sound with Multimedia Keys in XFCE 4/Xubuntu

When I installed Xubuntu 12.04 on my laptop (HP Touchsmart tm2) I noticed that even though I had sound playback and the OSD worked, the sound volume didn't increased/decreased after hitting the proper keyboard keys. This was because the keys were actually adjusting the volume of the HDMI output.

This can fixed by changing the value of active-card in the xfce4-mixer settings, but first the correct value must be determined:

  1. Open "Sound Settings" (Alt+F2 and type: pavucontrol).
  2. Select the "Output Devices" Tab.
  3. Annotate the device's name, leaving out spaces and all characters from this list: ()[]-/
  4. Now add "Playback" to the beginning and "PulseAudioMixer" to the end of name annotated in the previous step. For me the correct value is: PlaybackBuiltinAudioAnalogStereoPulseAudioMixer

Now that we possess the correct, lets change the xfce4-mixer settings:

  1. Open the "Settings Editor" (Alt+F2 and type: xfce4-settings-editor).
  2. Choose the xfce4-mixer channel.
  3. Edit the active-card value entering the value determined previously.
  4. For settings take effect, either restart xfce4-volumed (killall xfce4-volumed && xfce4-volumned) or logout/login.

Saturday, May 12, 2012

[HOW TO] Determine and change character file encoding

Determine file encoding:

file -bi some_file

Change file encoding:

iconv -f current_encoding -t destination_encoding file > file_new_encoding

List known coded character sets:

iconv --list

Convert with Vim (eg, converting to utf-8):

:write ++enc=utf-8 file_name

References

Stackoverflow - How can I change a file's encoding with vim?
Determine and change file character encoding
iconv manpage

Wednesday, May 9, 2012

[FIX] Pastie doesn't appear on Xfce panel (indicator-plugin)

Problem: Even though pastie is running it doesn't appear on Xfce panel's indicator-plugin. Well, this happens when the icon theme being used doesn't possess a "gtk-paste" icon. And that's what happens with the default Xubuntu 12.04 icon theme (elementary-xfce-dark).

Fortunately, all we need to do is borrow a "gtk-paste" icon from the "Humanity" themes (it comes installed by default in Xubuntu 12.04), and this icon will work well in dark and light panels.

Install

Open a terminal window and run:

# Create a symbolic link to the gtk-paste icon in elementary-xfce
sudo ln -s /usr/share/icons/Humanity/actions/16/gtk-paste.svg /usr/share/icons/elementary-xfce/actions/16/gtk-paste.svg
sudo ln -s /usr/share/icons/Humanity/actions/48/gtk-paste.svg /usr/share/icons/elementary-xfce/actions/48/gtk-paste.svg
sudo ln -s /usr/share/icons/Humanity/actions/24/gtk-paste.svg /usr/share/icons/elementary-xfce/actions/24/gtk-paste.svg
sudo ln -s /usr/share/icons/Humanity/actions/22/gtk-paste.svg /usr/share/icons/elementary-xfce/actions/22/gtk-paste.svg

# Update icon cache for the elementary-xfce theme
sudo gtk-update-icon-cache -f /usr/share/icons/elementary-xfce

Note: You might have noticed I told that the default icon theme for Xubuntu 12.04 is "elementary-xfce-dark" and the above instructions are for "elementary-xfce", well the first inherits the latter, so we kill two birds with one stone.

References

Regenerating GNOME Icon Cache

Install pastie from source in [X]Ubuntu 12.04 Precise

Pastie is clipboard manager for Linux and a few posts back I talked about installing the deb package for Oneiric in Precise, however I noticed that in some cases the following error occurred:

Traceback (most recent call last):
  File "/usr/bin/pastie", line 29, in
   import pastielib.cli as cli
ImportError: No module named pastielib.cli

I find out that installing it from source would solve the problem on that cases.

Install

Open a terminal window and run:

# (Only if pastie is installed) Uninstall pastie
sudo apt-get remove pastie -y

# Install dependencies
sudo apt-get install python-gnome2 python-keybinder

# Get the sources and extract
wget http://goo.gl/Xf2A7 -O - | tar xz

# Change to pastie source directory and install pastie
cd pastie_*
sudo python setup.py install

# Clean up by remove the pastie source directory
cd .. && sudo rm -rf pastie_*/

Note: If pastie doesn't appear on Xfce panel see this.

Monday, May 7, 2012

Install latest MyPaint in [X]Ubuntu (ppa and git)

MyPaint is a fast and easy open-source graphics application for digital painters. It lets you focus on the art instead of the program. You work on your canvas with minimum distractions, bringing up the interface only when you need it.

In the screenshot is the MyPaint interface with some subwindows opened (Brush List Editor, Color Triangle and Layers). Hit tab to hide the subwindows or F11 for fullscreen mode and then it'll be only you, the brush and the canvas :p

Please visit my sketch blog (Wilson's Sketch Blog) to see what I've done with MyPaint (besides the portrait of Marion Cotillard in the screenshot).

Install

Bellow are provided instructions for installing MyPaint via ppa and git. Choose git you want the latest version of MyPaint (I recommended it), but unfortunately you won't get automatic updates, so instruction are provided also for updating.

Open a terminal window for typing the following instructions.

ppa - Xubuntu 11.10

Ubuntu Oneiric repositories have MyPaint 0.9.X, so we'll be adding MyPaint Testing ppa to get version >= 1.0:

sudo add-apt-repository ppa:achadwick/mypaint-testing -y
sudo apt-get update && sudo apt-get install mypaint
ppa - Xubuntu 12.04

The Ubuntu Precise repositories already have MyPaint >= 1.0:

sudo apt-get install mypaint
Git - Install

If you choose to pull MyPaint from git repository you'll get the most recent version, but first some dependencies must be installed:

# preparing a folder for storing the sources
cd
mkdir sources
cd sources
# installing dependencies
sudo apt-get install git-core g++ python-dev libglib2.0-dev python-numpy swig scons gettext libpng12-dev liblcms2-dev libjson0-dev
# download the last sources
git clone git://gitorious.org/mypaint/mypaint.git
# enter the directory , compile and install.
cd mypaint
sudo scons prefix=/usr/local install
Git - Update
# going to the sources folder
cd ~/sources/mypaint/
# update the sources
git pull
# recompile and install.
sudo scons prefix=/usr/local install

References

MyPaint
Kubuntu 12.04 install notes (David Revoy's Blog)
MyPaint testing PPA