# Random Notes from My Research Life @ IISc

## June 8, 2012

### Hard word wrapping in gedit

Filed under: Linux,ResearchLife — Sooraj K. Ambat @ 12:41
Tags: , , ,

gedit is a handy option for dealing ‘.txt. files.

Unfortunately, gedit does not contain any hard word wrapping plugin.

1. Open gedit
2. Navigate to Edit -> Preferences -> Plugins
3. Enable “External Tools”and press “close”
4. Now, go to “Tools” -> “Manage External Tools”
5. Press “New” (press ‘+’ sign) and enter “Line Break at Col 80″ (or any name you like)
6. Paste the following script in the “command(s)” text area (you can choose to leave out the #comments, these are only here as a reminder in case you want to modify it to fit your needs):

#!/bin/sh
BREAK=80
# fmt [-WIDTH][OPTION]… [FILE]…
# –uniform-spacing — one space between words, two after sentences
# –split-only — split long lines, but do not refill
# –width=WIDTH — maximum line width (default of 75 columns)
# when FILE is -, read standard input
fmt –uniform-spacing –split-only –width \$BREAK –

7. Choose “Current selection” as Input
8. Choose “Replace current selection” as Output
9. At this point, you can choose to create a shortcut key such as “ctrl+m” for easy access.
10. Close “External Tools Manager” by pressing the “Close” button
11. Now this script is executable under the “Tools” menu. Alternatively, you can use your shortcut key for quick access.

My gedit version: 3.4.1, OS: Ubuntu 12.04 (64-bit)

## April 30, 2012

### Installing latex extras

Filed under: Latex — Sooraj K. Ambat @ 14:47
Tags: , , , ,

$\LaTeX$ may often require packeges like multirow.

many packges are not included by default in texlive.

To install the extra packages use the following command

sudo apt-get install texlive-latex-extra

## April 2, 2012

### Mex Error in Matlab

Filed under: Linux,Matlab — Sooraj K. Ambat @ 01:34
Tags: , , ,

While using mex compiler in Matlab 2010+ versions, error occurs due to the conflict between tha shared libaries used by Matlab and the OS (mine is Ubuntu 11.10).

One of the solutions is to remove the Matlab shared libraries and use show the system shared libraries to Matlab.

This can be done by

```cd \$MATLAB
cd sys/os/glnx86
mkdir old
mv libstdc++.* libg2c.* libgcc_s* old```

Then, update the library path

```export LD_LIBRARY_PATH=/usr/lib32:/usr/lib:\$LD_LIBRARY_PATH

## April 1, 2012

### Speeding Up Matlab

Filed under: Linux,Matlab,ResearchLife — Sooraj K. Ambat @ 22:40
Tags: , , ,

The performance of the linear algebra operations in any machine ultimately depend on the efficient BLAS implementation available on the machine and Matlab is not an exception!

By default, Matlab uses a version of Intel MKL which they upgrade with every release.

But usually the default option will not be optimal for the particular machine.

Luckily, Linux version of Intel MKL is free for non-commercial use.

I could install it on  my machine today. But linking Intel MKL with Matlab is not completed yet.

I’ll update it once I complete the job.

## March 9, 2012

### Adding New Application Launcher to Unity in Ubuntu

Filed under: Linux,Matlab,Uncategorized — Sooraj K. Ambat @ 23:00
Tags: , , ,

To add New Application Launcher (here we are using Matlab as example)  to Unity in Ubuntu 11.10, copy the following into a file with an extension ‘.desktop’ and save it in /usr/share/applications/.

[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Matlab2010b
Comment=Matlab2010b
Exec=/usr/local/MATLAB/R2010b/bin/matlab -desktop
Icon=/usr/local/MATLAB/Matlab_Logo.png
Terminal=false

You may replace Matlab with any other application of your choice, but don’t forget to update the other relevant information.

## March 8, 2012

### Enhancing Bash

Filed under: Linux — Sooraj K. Ambat @ 15:17
Tags: , ,

Use the following e lines in Bash init. (/etc/bash.bashrc in Ubuntu 11.10!)

````export HISTCONTROL=erasedups `
`export HISTSIZE=10000 `
`shopt -s histappend````

The first line removes the duplicate commands saved in history (when a command is entered).
Second line sets history size to 1000 lines.
The third line makes sure that when you exit a bash shell, the history from that session is appended to ~/.bash_history. (By default this may not happen always especially when you are working on multiple shells!)

### Searching History in Bash

Filed under: Linux — Sooraj K. Ambat @ 14:50
Tags: , ,

Often we require to repeat a command already typed earlier in bash.

To search for a previous command used in bash, use CTRL+R and start typing the previous command.

Use CTRL+R  again (while searching), and it will jump back further in history and search with the same text.

ENTER will execute command.(You may also use CTRL+O as well for the same.)

The command can be modified using the arrow keys before pressing ENTER.

CTRL+C cancels the search.

## February 5, 2012

### Latex Symbols in Matlab figure on Ubuntu

Filed under: Latex,Linux,Matlab,Uncategorized — Sooraj K. Ambat @ 15:35
Tags: , , , , ,

By default, Matlab figure inUbuntu (I’ve faced this problem in 10.04, 10.10, 11.04, and 11.10) is unable to interpret the latex symbols.

Matlab figure also shows problems with fonts installed.

We can correct it by installing packages using the command in terminal:

sudo apt-get install xfonts-100dpi xfonts-75dpi

## January 3, 2012

### Epson Perfection V30 Scanner Installation

Filed under: SSPLab — Sooraj K. Ambat @ 11:57
Tags: , ,

We have a Epson Perfection V30 Scanner in SSP Lab.

The detailed installation instruction for Ubuntu OS can be find in

## December 24, 2011

### Annotating PDF files under Linux

Filed under: ResearchLife — Sooraj K. Ambat @ 13:20
Tags: , , , ,

Annotating PDF files under linux is a tough job due to some issues related to GNU PDF.

‘Okular’ is a good option, if you always use a single machine.

Okular stores the annotations in ‘.kde/share/apps/okular/docdata/’.

If you move the pdf file to some other system then all the annotations will be lost.

One solution is to move all the data from the above mentioned folder to your new system.

But this folder contains meta data from all pdf files you opened so far.

Another problem with Okular is that even if you rename your pdf file, your annotation is gone!

One solution is to use the Okular custom archive file type ‘.okular’. But this file can be opened only using Okular.

One effective solution I found is to use some windows application with wine.

It Seems that PDF-XChange Viewer is a good option to use with wine.

Hence temporarily let me work like this, though I don’t really like to work with windows 🙂

Blog at WordPress.com.