Installing pylint OS X Leopard

Installing pylint on OS X Leopard

$ sudo port search pylint
No match for pylint found

However,

$ sudo port search py-lint
py-lint python/py-lint 0.14.0 Error (and style) checking for python
$ sudo port deps py-lint
py-lint has library dependencies on:
	python24
	py-logilab-astng

So, the pylint macpot wants to install python 2.4 while I use 2.5.2. The pylint install page suggests installing it with easy_install. This failed about half way for me when running the tests. Therefore, install pylint by hand

Downloading and installing the code was straightforward.

wget ftp://ftp.logilab.fr/pub/common/logilab-common-0.30.0.tar.gz
wget ftp://ftp.logilab.fr/pub/astng/logilab-astng-0.17.2.tar.gz
wget ftp://ftp.logilab.fr/pub/pylint/pylint-0.14.0.tar.gz
 
tar xzvf logilab-common-0.30.0.tar.gz
cd logilab-common-0.30.0
sudo python setup.py install
cd ..
 
tar xzvf logilab-astng-0.17.2.tar.gz
cd logilab-astng-0.17.2
sudo python setup.py install
cd ..
 
tar xzvf pylint-0.14.0.tar.gz
cd pylint-0.14.0
sudo python setup.py install
cd ..

Now,

$ pylint --version
No config file found, using default configuration
pylint 0.14.0, 
astng 0.17.2, common 0.30.0
Python 2.5.2 (r252:60911, Mar 25 2008, 16:47:00) 
[GCC 4.0.1 (Apple Inc. build 5465)]

That is all, pylint is installed. Now back to the code.

Summer of Code

The Google Summer of Code deadline is approaching. I’ve decided to apply to the NLTK (Natural Language Toolkit) project, which is under the Python Foundation umbrella, with an idea to port the FUF/SURGE code to Python. FUF/SURGE is well respected within the natural language community. Currently NLTK can do all kinds of different things for parsing but very little for generation. The port of this code would allow educators and scientists to use Python for generation as well. It is an exciting opportunity, and I would love to work on this over the summer.

Also, NLTK now has an IRC channel, #nltk at irc.undernet.org. Hope to see you there.

PS. If you’re interested in an extended version of the project proposal, it is here.

Some Updates

Updates?

Yes, finally there is an update. In terms of interesting news, I recently returned from a trip to Los Angeles where the annual CSUN Technology & People with Disabilities Conference was held. We presented our iGraph-Lite work. The presentation went great. There was a bunch of questions. Some that I have been asked before at other presentations and some new ones. In case you are interested in our work and would like find out more, all the materials from the presentation are available at in this post, NLIG at CSUN 2008.

It was great to meet all the people who are working in this area. At the same time, I discovered some interesting research. For example, a group of researchers from Italy presented a tool to help visually impaired school children learn math. The surprising part is that their editor uses LaTeX as input. Meaning that anyone using this tool would end up learning math and how to write math with LaTeX. Very interesting.

In other news, I came across some interesting stuff on the net like this: Python Readline Completions. Essentially showing how to use the readline lib to build a simple console with tab completion.

Convert .rtf files on Linux

Small program of the day: unrtf. It let’s you convert a given .rtf file to text, LaTex or html. Works nicely.

Installing in Gentoo:

sudo emerge -av unrtf

Converting to LaTex

unrtf --latex somefilename.rtf thelatexfilename.tex

EDIT: changed the title from “Covert .rtf files on Linux” to “Convert .rtf files on Linux”

.eps graphics and pdflatex

pdflatex doesn’t like .eps graphics files. Prior to today I used to convert all of the .eps file to .png and then run pdflatex. Today, after spending some time on the net looking around for a better solution, i’ve found a better way.
The better way is using, epstopdf.

Basically, all one has to do is add this at the top of the .tex document after the document class directive.

\documentclass{article}
\newif\ifpdf
\ifx\pdfoutput\undefined
	\pdffalse
\else
	\pdfoutput=1
	\pdftrue
\fi
\ifpdf
	\usepackage{graphicx}
	\usepackage{epstopdf}
	\DeclareGraphicsRule{.eps}{pdf}{.pdf}{`epstopdf #1}
	\pdfcompresslevel=9
\else
	\usepackage{graphicx}
\fi
\usepackage{times}
\usepackage{latexsym}
\usepackage{color}

This means that when you’re going for pdf output load the epstopdf package and have it convert all of your .eps graphics to .pdf, which pdflatex will happily use. Otherwise, just use .eps files.

Hope this helps. If you have a better way, please post in comments.

Installing pcf fonts

I always keep an eye out for nice terminal fonts. This month someone on the Gentoo Forums suggested the bleed2 font. Generally, I use truetype fonts, they are easy to install, since all one has to do is put them into the ~/.fonts and run

fc-cache -fv

Installing pcf fonts is a bit more involved. First download the font. I downloaded mine into ~/tmp. After this,
we have to create a directory for it. There are already a bunch of fonts in the /usr/share/fonts directory of my Gentoo install, so I decided to put it there.

sudo mkdir /usr/share/fonts/bleed

Now copy the font to the new directory

cd ~/tmp
sudo cp bleed2.pcf.gz /usr/share/fonts/bleed/

At this stage we have to make this directory into a font directory

sudo mkfontdir /usr/share/fonts/bleed

The directory is prepared, and now we have to tell the Xorg server to use the directory. So we edit the Xorg configuration file. My xorg.conf is located in /etc/X11/ and Vim is my text editor of choice

sudo vim /etc/X11/xorg.conf

In xorg.conf file there is a section called “Files”. This section contains a bunch of “FontPath” directives. Mine looks like this:

Section "Files"
 FontPath    "/usr/share/fonts/util"
 FontPath    "/usr/share/fonts/encodings"
 FontPath    "/usr/share/fonts/misc"
 FontPath    "/usr/share/fonts/local"
 FontPath    "/usr/share/fonts/terminus"
 FontPath    "/usr/share/fonts/corefonts"
 FontPath    "/usr/share/consolefonts"
 FontPath    "/usr/local/share/fonts"
 FontPath    "/usr/share/fonts/default"
EndSection

So, we will add our new font directory to the end of this section like so:

Section "Files"
 FontPath    "/usr/share/fonts/util"
 FontPath    "/usr/share/fonts/encodings"
 FontPath    "/usr/share/fonts/misc"
 FontPath    "/usr/share/fonts/local"
 FontPath    "/usr/share/fonts/terminus"
 FontPath    "/usr/share/fonts/corefonts"
 FontPath    "/usr/share/consolefonts"
 FontPath    "/usr/local/share/fonts"
 FontPath    "/usr/share/fonts/default"
 FontPath   "/usr/share"fonts/bleed"
EndSection

So, we’re all set to use the font. However, the Xorg server wont know about the font until it re-reads the xorg.conf cofiguration file. So, either we restart the Xorg server or we run a couple of commands that will tell the currently running Xorg server instance about the new fonts.

To notify the current instance of the server about the new fonts run the following commands:

sudo xset +fp /usr/share/fonts/bleed/
sudo xset fp rehash

Now you should be able to use the bleed font, try running the following command

xterm -fa bleed

Byte compling Javascript on Rhino

It is not all that difficult, but one has to get the classpath just right.

Suppose we have a directory “~/js”. Here we have all the required libraries (these are copied from the rhino distribution), js.jar, jsr172_1.0_api.jar, xbean.jar and our code, t.js.

The code contained in t.js is very simple:

java.lang.System.out.println("Hello from Javascript and Rhino!");

Now that we have all of this, we’re ready to compile t.js.

java -cp .:js.jar:jsr173_1.0_api.jar:xbean.jar org.mozilla.javascript.tools.jsc.Main t.js

Note: On Windows the separator is not “:”, it is “;”

The above command should generate a t.class file. We can run it by issuing the following command:

java -cp .:js.jar:jsr173_1.0_api.jar:xbean.jar t

Finally the above should output:

Hello from Javascript and Rhino!

Couple of screenshots

Patched dwm-4.2 with the bottomstack path. Now the behavior is a little better i think. Feel free to take a look.

Working wireless in Ubuntu

I got this laptop a month and a half ago. After using Vista for 2 weeks, I realized that it wasn’t for me. There is really no need to go into this, since everyone and their dog has already written about it. So, i installed Xubuntu. Almost everything worked after the install. I had to add the NVIDIA drivers (took less then 20mins). But the built-in wireless. That was a problem. There was no driver to speak of. Not even from Intel. How this is possible, I dont know.

But there are some good news. The driver surfaced recently on the Intel site. And there are tutorials for setting up Intel 4965abgn in Ubuntu. After following the tutorial I have working wireless. :)

Alternative to ‘cmd’ for Windows

Go here, http://sourceforge.net/projects/console/ , for an alternative to the stupid cmd that it the default console on Widows. Console supports tabs and transparencies and a whole bunch of nice stuff.

Next Page »