Fedora 15: firefox bookmarks subfolder icons missing

You need first to install dconf-editor if not already done:

sudo yum install dconf-editor

launch it and go to

org->gnome->desktop->interface

set menus-have-icons=true.

Posted in Linux | Tagged , | Leave a comment

How to setup PHP under fedora

The following solution to install Apache, MySQL and PHP was checked under Fedora 15 distribution.

First, you need to install the relevant packages:

su #for root login, enter password when prompted
yum install mysql-server
service mysqld start
mysqladmin -u root password <set your wished password here>
yum install phpmyadmin

Now, you need to start the relevant services:

su #for root login, 
service mysqld restart
service httpd restart

This should be done each time you need to use unless you want those services to start with your OS. In such case, you should type:

su #for root login
chkconfig --add httpd
chkconfig httpd on
chkconfig --add mysqld
chkconfig mysqld on

In order to test your PHP files, write a simple script:

<?php phpinfo() ?>

and place it in /var/www/html. Look at http://localhost/phpinfo.php to check if the script works.

You can also access the phpMyAdmin by navigating to http://localhost/phpmyadmin

Posted in Linux | Tagged , | Leave a comment

How to mount a USB key

With the most recent distributions of Linux, and their GUI environment, mounting a USB key is automatically done when inserting the key. Yet, sometimes, it is useful to mount it yourself (for instance, when running Linux in level 3).

Once the key is inserted, the generic command is

sudo mount /media/sda1 /media/your_usb_directory

where the /media/your_usb_directory is the directory where the usb will be mounted. it must exists. And /media/sda1 is the USB device. It may be different on different systems. The generic name is sdxx (e.g. sda1, sdb2, sdc2,…).

Finally, use the umount command once done before removing the key:

sudo umount /media/sda1
Posted in Linux | Tagged | Leave a comment

Fedora 15: how to enable the “delete” key

A “missing” shortcut in Fedora 15 as compared to previous Fedora distributions is the “delete” key: when you wanted to remove a file or a folder, you simply had to press the “delete” key. There is no such keyboard short cut in Fedora 15, at least by default. Instead there is a “Move to Trash” operation possible when right-clicking on a file/folder.

To setup the “delete” key, you first need to install dconf-editor tool using yum:

sudo yum install dconf-editor

launch it and go to

org>gnome>desktop>interface>

and set can-change-accels to true (see image).

Then, you need to associate the keyboard short cut for “Move to Trash” . To do so, open a File Manager (or go on the desktop) and select a file. In the menu, click on “Edit” and take your mouse over to “Move to Trash”. Once the mouse is over this item, press “Delete” key two times. The short cut has been set as the key for “Move to Trash”.

Note that in some forums, the tool gconf-editor is used in place of dconf-editor. I tried this solution but it does not work. In my case, I had to use dconf-editor instead.

Posted in Linux | Tagged | Leave a comment

Fedora 15: post installation

Once in a while I install a fresh version of Fedora (or ubuntu). Of course, the installation process provides most of the basic tools (browser, editor…) but you miss you favorite ones. Each time, you need to repeat some identical tasks such as installing missing plugins, installing your favorites tools and so on.

This page summarizes the required tasks to get back a working installation.

Packages installation with yum

First, update your existing packages.

yum update

You can install this package to speed up the yum searches:

sudo yum install yum-fastestmirror

Then, the entire command to install the packages I use is:

sudo yum install yumex kile gvim ipython python-virtual PyQt4 git-svn thunderbird virtualenv 
sudo yum install qhull* freeglut*  bison flex CGAL-devel sip-devel PyQt4-devel  qt4-devel
sudo yum install dvipng vim qscintilla* boost boost-devel boost-python R R-core scons 
sudo yum install readline readline-devel flex-static patch wget dos2unix
sudo yum install gimp azureus

Firefox related

Firefox requires the flash plugin for the videos. Many web sites (e.g., Fedora FAQs) provides help on this subject. You need to install the plugin yourself. First, you need to add the repositories:

sudo rpm -ivh http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm
sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux

and then the plugin:

sudo yum install flash-plugin nspluginwrapper.x86_64 nspluginwrapper.i686 alsa-plugins-pulseaudio.i686 libcurl.i686

Firefox has also many addons. I use the following ones:

xmarks
firebug
adblock plus

How to install acroread

First, you need to install the repositories

sudo rpm -ivh http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm
sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux

and then for Fedora 15 (on x86_64 bit system, 32-bit dependencies is also installed) type:

sudo yum install nspluginwrapper.i686 AdobeReader_enu

Gnome issues in Fedora 15

Where is the shutdown button ?

In Fedora 15, the menu shows the Suspend button but Shutdown one. It is shown when I press Alt only. Nevertheless, if you want it to appear it is possible by installing the following package:

sudo yum install gnome-shell-extensions-alternative-status-menu

You will need to log out and log back in to see the button.

How to maximize the windows

Gnome 3 layout is quite different from previous versions provided with earlier distribution of Fedora. One annoying issue is that you can not minimize or maximize the windows anymore. At least by default. Indeed, you can install the following package:

sudo yum install gconf-editor

Launch gconf-editor, go to

desktop>gnome>shell>windows

In the button_layout, set the value to

:minimize,maximize,close

where is the desktop ?

Install the following package:

sudo yum install gnome-tweak-tool

Launch gnome-tweak-tool, select File Manager. Set “Have File Manager handle the desktop” to ON.

Python packages

sudo easy_install scons nose sphinx rpy2 numpy matplotlib scipy

OpenAlea/VPlants packages

See OpenAlea page related to Fedora

Reference for Gnome desktop issues: link1.

Posted in Linux | Tagged , | Leave a comment

Linux command: cut (to extract information from text files)

It is very common in data analysis to have to deal with text files containing CSV data or data in columns/rows. Sometimes you just want to look at the third column only, so you try to find a nice little tool to do this job for you, or you open a python session and write your own little program. I used to use awk for that.

awk '{print $3 }' datafile.txt

However, I recently discover cut, which does the same job without. IT works as follows. To extract the column/field 3, type:

cut -f3 datafile.txt

To extract 2 different columns (let us say 1 and 3), and specify the delimiter (here : sign) type:

cut -d: -f1,3 datafile.txt

You can also work with columns instead of fields by using -c instead of -d

Posted in Linux | Tagged | Leave a comment

Skype video missing under linux

In principle in the options->advanced section you should have a section called video devices

If not, then quit Skype, and create this environmental variable

export LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so

Restart Skype and go to options->advanced->video devices that should be available now.

Tested under Fedora 14 with Skype 2.2.0.25

Posted in Linux | Tagged , | Leave a comment

What is Virtualenv

Virtualenv is a tool to create isolated Python environments.

Its usage could be very useful when dependencies and versions are tricky. Imagine you have an application that needs version 1 of a library, but another application requires version 2. If you install everything into /usr/lib/python2.7/site-packages (the standard place where all packages are installed), then you may upgrade a library that shouldn’t be upgraded.
Besides, what if you can’t install packages into the global site-packages directory because of restricted permission ?

In these cases, you can use virtualenv to create an environment that has its own installation directories, that doesn’t share libraries with other virtualenv environments (and optionally doesn’t access the globally installed libraries either).

To create a virtual environment, type:

virtualenv --no-site-packages <directory>

or

virtualenv <directoy>

The former version (with –no-site-packages) will not even use any of the already installed packages in /usr/lib/python/site-packages.

Then to activate an environment, simply go into it and activate it:

cd <directory>
source ./bin/activate

From now, when you install a python packages, it will be installed in /lib/python/site-packages

See Virtualenv website for more details.

Posted in Python | Tagged , | Leave a comment

Mount an ISO file under linux with bchunk

The tool bchunk can be used to mount an ISO file. Under Fedora 9, you could use it as follows. First, you need to install it:

yum install bchunk

bchunk converts a .cue (and its pair-wise .bin) file into an iso file:

bchunk your.cue your.bin image

that creates a file named image01.iso.Then simply mount it:

sudo mount -r -t iso9660 -o loop image01.iso /media/cdrom/
Posted in Linux | Tagged , | Leave a comment

Combine AWK and SED to create symbolic links

The unix tools AWK and SED are very powerful tools to manipulate files and perform text processing tasks. It’s true that the syntax is not always very intuitive but it can help you in performing task in a single line.

The following example illustrate the usage of SED and AWK. This is surely not the best one but gives some overview about the gensub awk command and replacement commands.

Let us suppose first that you need to find recursively a list of files that match a pattern.

find . -name "__init__.py"

These files contains the full path names (with the directory). From these files, you want to create a symbolic link (ln -s command under Linux) and in addition you want to keep to keep track of the directory (replacing the / sign with a _ sign).

find . -name "__init__.py" | awk '{print "ln -s " $1 " " gensub("/", "_", "g", $1)}'

The “gensub” command is used by awk to replace a character by an other. The “g” means replace all occurences.

Yet, because a directory starts with “./”, all files start with a ”._”, which can be removed with  “sed”. Note that the ”.” is a special character, so you need to use ”\.” instead of simply ”.” .

The final command is therefore:

find . -name "__init__.py" | awk '{print "ln -s " $1 " " gensub("/", "_", "g", $1)}' | sed -e 's/\._//g'
Posted in Linux | Tagged , | 1 Comment