miércoles, enero 02, 2013

Include code listings as figures in LaTeX

To include code listing as figures (including label and caption fields) in LaTeX you can do the following:

hello world!! here the code.
\captionof{figure}{a caption text.}

miércoles, octubre 19, 2011

Gnome Shell 3: tips and tricks. Clean & fast!

*. Auto login into Gnome 3, and set it as default window manager
1. sudo /usr/lib/lightdm/lightdm-set-defaults -s gnome-shell
*. Install classic Gnome and set it as default window manager
1. sudo apt-get install gnome-session-fallback
2. sudo /usr/lib/lightdm/lightdm-set-defaults -s gnome-classic
*. Restore the old-style scrollbars
1. sudo apt-get autoremove --purge liboverlay-scrollbar-*

0. First of all...
1. sudo apt-get install gnome-shell
2. sudo apt-get install gnome-tweak-tool
3. sudo add-apt-repository ppa:webupd8team/gnome3
4. sudo apt-get update

a. Alternative status menu:
sudo apt-get install gnome-shell-extensions-alternative-status-menu

b. Add new themes:
sudo apt-get install gnome-shell-extensions-user-theme

c. Add the workspace indicator:
sudo apt-get install gnome-shell-extensions-workspace-indicator

d. Classic Gnome menu:
sudo apt-get install gnome-shell-extensions-apps-menu

e. Removable drive menu:
sudo apt-get install gnome-shell-extensions-drive-menu

f. Enable system monitor:
sudo apt-get install gnome-shell-extensions-system-monitor

f2. Alternative (even better) system monitor:

sudo add-apt-repository ppa:webupd8team/gnome3
sudo apt-get update
sudo apt-get install gnome-shell-system-monitor
via: http://www.webupd8.org/2011/10/gnome-shell-system-monitor-extension.html

g. Places status indicator:
sudo apt-get install gnome-shell-extensions-places-menu

h. Dock extension:
sudo apt-get install gnome-shell-extensions-dock

i. Enable native window placement:
sudo apt-get install gnome-shell-extensions-native-window-placement

j. Xrandr indicator:
sudo apt-get install gnome-shell-extensions-xrandr-indicator

k. Enable "Auto Move Windows":
sudo apt-get install gnome-shell-extensions-auto-move-windows

l. Gajim extension:
sudo apt-get install gnome-shell-extensions-gajim

m. Enable "Windows Navigator":
sudo apt-get install gnome-shell-extensions-windows-navigator


martes, junio 14, 2011

Read a text file line by line in Java

/// read the file line by line
try {
 BufferedReader in = new BufferedReader(new FileReader(args[0]));
 String str;
 while ((str = in.readLine()) != null) {
} catch (IOException e) {

jueves, junio 09, 2011

Write a text file in Android using the emulator in Eclipse

/// check read/write permissions

boolean mExternalStorageAvailable = false;
boolean mExternalStorageWriteable = false;
String state = Environment.getExternalStorageState();

if (Environment.MEDIA_MOUNTED.equals(state)) {
// We can read and write the media
mExternalStorageAvailable = mExternalStorageWriteable = true;
Log.i(TAG,"read + write");
} else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
// We can only read the media
mExternalStorageAvailable = true;
mExternalStorageWriteable = false;
} else {
// Something else is wrong. It may be one of many other states, but all we need
//  to know is we can neither read nor write
mExternalStorageAvailable = mExternalStorageWriteable = false;

/// write text file

File testFile = new File(Environment.getExternalStorageDirectory()+"/test.txt");
}catch(IOException e){
Log.e("IOException", "exception in createNewFile() method");
//we have to bind the new file with a FileOutputStream
FileOutputStream os = null;        
os = new FileOutputStream(testFile);
}catch(FileNotFoundException e){
Log.e("FileNotFoundException", "can't create FileOutputStream");

PrintWriter pw = new PrintWriter(os);


Log.i(TAG,"wrote in: " + Environment.getExternalStorageDirectory()+ "/test.txt");

viernes, mayo 27, 2011

Install subclipse (subversion) in Eclipse in a few steps

To install Subclipse (subversion) repository plugin in Eclipse, do the following:
  • 1. Open Eclipse
  • 2. Help -> Install new software...
  • 3. Click "Add.."
  • 4. Add this repository (the name does not matter; the URL does):


  • 5. Type "subclipse" in the blank caption to search the plugin
  • 6. Select it and install it

Note that you need internet connection :)

martes, marzo 15, 2011

martes, diciembre 14, 2010

YouTube para el salón

Si eres de los que conecta el ordenador a la televisión y ve vídeos de YouTube desde el sofá de casa, seguro que te gustan estas versiones de YouTube.

La primera es una versión gigante, y se llama "XL":

La otra es una versión a pantalla completa, y se llama "Leanback":

a disfrutar!!!

domingo, diciembre 12, 2010

LaTeX compiling error

If you are compiling a LaTeX document, and you get the following error:
! I can't find file `ptmr7t'
Here you have the solution:
sudo apt-get install texlive-fonts-recommended

lunes, diciembre 06, 2010

Fix @ (at) character problem with Ubuntu in Macbook

If you can't write the @ character in Ubuntu, you should do this:

1. System > Preferences > Keyboard
2. Go to Keyboard Distribution label
3. Click Options
4. Look for something like "Key to access the third level" (sorry, my Ubuntu is Spanish ;-)
5. Select the key you are used to use when typing the @ symbol (I selected the "Alt" key)

That's all,

Some keywords for spanish readers: arreglar, problema, arroba, macbook, ubuntu