Saturday, June 2, 2012

Ordering among citations in a multiple citation in Bibtex

It is possible to arrange multiple references within the same brackets by doing \cite{paper1,paper2} instead of \cite{paper1}\cite{paper2}. The former will produce for example [1,2] and the latter will produce [1][2]. The former approach is considered better.

However, sometimes the ordering among the citations within a multiple citation might not come right. For example, \cite{paper1,paper2} might produce [2,1] instead of [1,2]. Here again, it is considered better to order citations in a multiple citation according to the order they appear in the references list. To make sure they are ordered as such add \usepackage{cite} in the preamble of your latex source file.

Saturday, May 26, 2012

Mounting and Unmounting ISO files in Ubuntu

Create a directory first.

$mkdir /home/myusr/example

Mount the iso by,

$sudo mount -o loop filename.iso /home/myusr/example
This will mount the ISO file to the created directory.
To unmount do,
$sudo umount /home/myusr/example 


Monday, September 19, 2011

TexShop coloring

From version 3.06 (Lion) it is possible to have different background and foreground colors in TexShop.

You can select the background colors from Preference dialog box. However, other colors must be
specified at command line.

defaults write foreground_R 1
default write foreground_B 1
default write foreground_G 1
will make the font color to white.

The background color can be changed from TexShop Preferences window.

defaults write TexShop commandblue 1
defaults write TexShop commandred 0
defaults write TexShop commandgreen 1
will make the command color to cyan.

To change the cursor color to white do
defaults write TexShop insertionpoint_R 1
defaults write TexShop insertionpoint_G 1
defaults write TexShop insertionpoint_B 1

defaults write TexShop commentred 0
defaults write TexShop commentblue 0
defaults write TexShop commentgreen 1
will make the comment color to lime green.

These are RGB decimal color codes. To obtain those values divide RGB colors from 255.
Here is a list of RGB colors.

TexShop documentation where these color preferences are mentioned can be seen here.

Thursday, September 1, 2011

pygmentize

Install pygmentize by

sudo easy_install Pygments

quick start (copied from the official Web site)



You can use Pygments from the command line, using the pygmentize script:
$ pygmentize test.py
will highlight the Python file test.py using ANSI escape sequences (a.k.a. terminal colors) and print the result to standard output.
To output HTML, use the -f option:
$ pygmentize -f html -o test.html test.py
to write an HTML-highlighted version of test.py to the file test.html. Note that it will only be a snippet of HTML, if you want a full HTML document, use the "full" option:
$ pygmentize -f html -O full -o test.html test.py
This will produce a full HTML document with included stylesheet.
A style can be selected with -O style=.
If you need a stylesheet for an existing HTML file using Pygments CSS classes, it can be created with:
$ pygmentize -S default -f html > style.css

Wednesday, August 17, 2011

Python urllib proxies

It is possible to open a url via a proxy server using urllib as shown in the following code.
Here is the documentation.
Here is a list of proxies. To check your IP you can use this site.

import urllib
import re

httpProxy =  "http://85.172.205.91.static.giga-dns.com:3128"
webSite = "http://whatismyipaddress.com/"

if False:
    # no proxy.
    txt = urllib.urlopen(webSite).read()

if True:
    # with proxy.
    proxies = {'http':httpProxy}
    txt = urllib.urlopen(webSite, proxies=proxies).read()
    
IPreg = re.compile('

Thursday, July 28, 2011

Aptana Studio

In Apatana studio you can perform block editing. First select some lines of text and then press Command+Option+A. This will enable block highlighting mode. Now use Shift+Arrow Keys to expand or shrink the current selection. When you type in some text, all the highlighted fields will change simultaneously.

Friday, July 8, 2011

Synchronizing system clock (Ubuntu)

There are nice GUIs to do this if you have installed some Window managing system such as Gnome or KDE. However, if you have a server installation and have not installed any of those Window managing system and/or want to do this via command line then do the following (requires sudo access).


sudo ntpdate ntp.ubuntu.com

Continuously monitor GPU usage

 For nvidia GPUs do the follwing: nvidia-smi -l 1