4h Project

We will use this pong game for as our educational project. The source code is attached. Adapted from the example here http://programarcadegames.com/python_examples/show_file.php?file=pong.py by removing the joystick requirement.


Two players use keys z,x and m,n .

Continuously build / preview a latex document

You can easily build and preview latex documents using both emacs and evince. Evince will reload pdf documents once changed. I use inotify to trigger the build shell script once any .tex file is changed. The scripts below are generic enough to be used for any build:

The first script is build.sh


pdfcmd="pdflatex -file-line-error -interaction batchmode"

for i in `ls *.tex`; do
    echo Building $i
    echo '***************************'
    ${pdfcmd} $i
    basename=`basename $i tex`
    echo Basename is ${basename}
    bibtex ${basename}aux
    ${pdfcmd} $i
    ${pdfcmd} $i

    cat ${basename}log | grep 'l\.'

The second script checks for any modified .tex file, then re-invokes build.sh

while inotifywait -e close_write *.tex;

Have fun.

Python books for the 4H computer group

Python books. The authors of those books are sharing their work openly, which is good and make them awesome people for sharing their work. You can download both books and place them on your CHIP’s desktop. They can be there for you to read while you’re coding. We can do that together next time we meet.

1. Think Python by Allen Downey. Green Tea press & Allen Downey made their book available publicly for free, which is awesome (Thanks Allen & Green Tea press). We will be using their book while learning python in our 4H group. PDF link is here:


Think Python 2e

2. Making games with Python and Pygame. Al Sweigart the author of the book made is sharing his book openly under Creative Commons license (Thanks Al – you’re awesome). We will use his book once we gain enough Python knowledge. PDF link is here:


Book page: http://inventwithpython.com/pygame/chapters/

Just upgraded to trusty tahr

Last time I tested trusty tahr XFCE was not behaving correct. They released it a day ago, and I upgraded few of my machines at home. Everything worked great. As far as desktop, for me there weren’t that much changes. XFCE still works.

The set back I noticed was not due to ubuntu but due to the incompatibility of the bitcoin client. The bitcoin-qt program depends on libdb4.8 and boost 3.1, which are not part of ubuntu anymore (and most likely debian). So it seems that the ubuntu maintainers removed it from the distribution for that purpose. People on the forum were reasoning that the PPA maintainer doesn’t have time and he’s only one guy. I don’t think the guy can do anything if the dependencies are not there, I also don’t think that ubuntu distribution will accept a statically linked version of bitcoin-qt.

May be bitcoin should move the standard wallet to another format, which is not dependent on a certain libdb version. May be an XML format with the wallet encoded as hex strings.

Your work around: Download the statically linked version from the bitcoin.org website.

Trusty Tahr, won’t be a big update for me at least

Just tried installing the beta of ubuntu trusty tahr, and being an xfce user I really didn’t notice much updates over there other than just being an LTS. I had to pin apt packages back to saucy to downgrade since the xfce indicator applet was crashing non stop.

Will definitely upgrade towards the end of the month once it stabilizes a bit more.

Eclipse kepler

I downloaded eclipse kepler today and tested it on my laptop.

Improved things:

  1. Memory usage is much less, and the IDE is more responsive. Juno was already good, but kepler uses even less memory.
  2. Highlighting the token under the cursor used to hang in Juno. Now it works without hanging in kepler.
  3. Javascript editor is improved. Some auto completion is implemented when ctrl+space is clicked.

Things that did not get fixed:

  1. Auto format on save for javascript still does not work
  2. The javascript formatter is still way behind the java one.

I didn’t test any JEE like JSF or JSP features. I also was not interested that much in HTML5 editing, even though I think I will try soon.

More on raring, gdm lxdm wdm srim, which one works

lxdm doesn’t work with mate. Once you select mate and try to login nothing happens. When I switch to a text console and do ps -ef | grep session it seems that there is no session running. wdm logs in fine, but sound does not work and the network applet appears as if there’s not network, but actually network is working.

gdm works fine and the other services work as well. I didn’t test lightdm but I don’t like it because I feel it is slow.

Ubuntu raring 13.04 maven error broken package

It seems that ubuntu raring 13.04 was released with a packaging problem in maven. I upgraded my home computer desktop quantal 12.10 to 13.04 raring and other some regular issues, which I usually solve by apt-get -f install, I got an error while installing maven. It seems that maven depends on both libwagon-java and libwagon2-java and both contain the same jar file. dpkg then will issue an error and stop.

By doing some search I found a page on launchpage with the error report: https://bugs.launchpad.net/ubuntu/+source/wagon2/+bug/1171056

I forced the installation of libwagon2 using dpkg -i –force-all /var…. and it worked. However, I know that now when one of those two packages gets removed the jar will be removed as well, and then I will need to purge then package then re-install it.

Eclipse vertical scope lines

Vertical scope indentation lines on a dark theme in eclipse

Vertical scope indentation lines on a dark theme in eclipse

I found a plugin called indent guide that produces a left scope indentation guides similar to intellij. I tested it and it works perfect with Juno. You can install the plugin through Help -> Install Software, then add http://atlanto.github.com/IndentGuide/update to work with. That’s how my eclipse editor looks now:


** Update: Lots of people come here searching for the scope lines. Seems that the projects above are no longer there.

Final java dev environment

Screen shot of eclipse with a dark color theme while editing jBug

Screen shot of eclipse with a dark color theme while editing jBug

I’ve been going back and forth between IntelliJ’s idea, netbeans and eclipse for java development. I was able lately to setup eclipse with all the features I need, and performs all the compilation function required including pulling maven dependencies and hot deploying jetty’s code on save and the best thing was the ability to edit it’s colors using the CSS provided.

How to do that:

1. Using git clong jBug from http://github.com/mibrahim/jbug.git
2. Inside there, there’s a directory called “settings” in which there are two files: preferences.epf (which includes the editor settings and color theme) and e4_default_gtk.css and that will set the color and font sizes of the tabs.
3. Copy the css file over your eclipse/plugins/org.eclipse.platform_4.2.1.v201209141800/css/e4_default_gtk.css

For plugins, using the market place add the following:

1. egit (to integrate with git)
2. Run-jetty-run, will use in-place deployment with jetty and will close and open the handlers and contexts if you change any of your classes or their dependencies (excellent work)
3. m2e for maven
4. Eclipse color theme. In case you wanted to change the theme edit the wombatcss.xml then import it.

Since eclipse is not a limited edition as idea, you will be able to edit jsp and other files that you won’t be able to edit in idea. It is also much more efficient in terms of memory usage than netbeans and does not block or stop erratically like netbeans as well.