Skip to main content

Posts

tightvnc with gnome messes up the keyboard mapping

Everytime I run our unit tests, I get Java Swing windows flying across my screen making it impossible to work. A friend suggested that if I ran the tests in a vncclient session, the windows will be contained within vncviewers window. So I installed tightvncserver and client on my Ubuntu 9.10 machine. When I started vncviewer I realized that the keyboard mapping as messed up, making it impossible to type anything sensibly in the vnc session. Some searching seems to suggest that Gnome is causing this problem. This page offered a solution of changing VNC's startup file to not fully start Gnome, and it worked for me. Workaround: I modified my ~/.vnc/xstartup to be: #!/bin/sh xrdb $HOME/.Xresources gnome-wm & gnome-panel & nautilus --no-default-window & gnome-cups-icon & gnome-volume- manager & xterm &

Java Applet on 64 bit Linux

I have been working on an Ubuntu 9.10 (64 bit system) from some time. I had read some stories of problems running 64 bit Java Applets on 64 bit Firefox, so when I needed to use Applets I did some googling to figure out how to do it. I came across a couple of posts. Some had different solutions for different versions (3.5, 3.6) of Firefox, and they also wanted me to use IcedTea. The solution I used is outlined here , and it worked perfectly well for me. Note: You may not have libnpj2.so in the same place mentioned below. mkdir ~/.mozilla/plugins/ ln -s /usr/lib/jvm/jre1.6.0_12/lib/amd64/libnpjp2.so ~/.mozilla/plugins/

Showing lines before and after a grep match

Today I ran running grep on the output of hg log , but only to realize that I wanted a couple of lines before and after the line which matched as well. I am sure this is common knowledge, but I did not know how to do it, so am sharing it in the hope that someone finds it useful. hg log | grep --before-context=2 --after-context=2 username Running the above showed me changeset number, comments etc for all the mercurial changesets committed by the specified user.

Some thoughts on redesigning education

Some time back I read a blog post on redesigning education. It asked some very good questions. Stuff which I had been thinking of myself. I left my thoughts on the blog, but I would also like to start a conversation around these ideas with those who read this blog as well. I would like to know what other people think of the issue of redesigning (college) education. I have often thought about how college education can be improved. To answer this question, we first have to ask a very basic question. What is the purpose of education? To me, we need education for 3 things: To learn more about the world around us To lead positive constructive lives To earn a good living / fulfill our ambitions I think education has to a large extent evolved to fulfill #3 (with a bias towards earning a comfortable living). The semester system, along with multiple choice tests, and grading, has made our education system into an assembly line. Students are pushed into the assembly line, given classes, adminis...

Fixing a mistake after commiting in Git

So, I ran into an interesting issue while coding today. I made a lot of changes and committed code to my Git repository. Just after committing, I realized that I still had to make some changes to a file and those changes should also have gone in with the previous commit. Fixing a commit mistake can be done in two ways. Revert the commit, make the changes and then recommit them. This is the preferred way if we have already made the changes public (and thus someone may already have pulled them). However, in my case I am the only one working on this project right now and I had not pushed the changes to GitHub, so I could try the other method. So here's what I did. I made changes to the file, added it to the index, and committed it thus: $git commit --amend Committing code with the --amend switch will cause the index to be committed as part of the previous commit. Git also brings up the editor window, in case we want to change the commit message. This method can also be used to change ...

Lack of design patterns in Python

While searching for PyCon videos, I came across Joe Gregorio's very good video on (lack of) design patterns in Python. I have also added the video timeline along with some notes I made for myself and my takeaway. Enjoy the video. Timeline: [00:00] - Start [00:15] - People pick tools based on a mythology and not necessarily facts [02:35] - Python isn't just Java without the compiler [03:34] - Design patterns are also a sign of weakness in a language [04:06] - Lack of design patterns in Python (proof of lack) [06:10] - Patterns are built into Python [07:00] - Strategy pattern in Python the wrong and right way [07:36] - The strategy pattern is invisible in languages with first-class functions [08:07] - Some other language features in Python (first class functions, metaprogramming, iterators, closures) [09:17] - The iterator pattern (iterators) is also built into Python [09:36] - The observer pattern is also built into Python [10:17] - Factory method pattern in Python ( [10:34] ...

iAccelerator

iAccelerator I took a sabbatical from my consulting work this summer to participate in the iAccelerator program. This is a program for early stage software startups, similar to YCombinator , but the first of it's kind (I believe) in India. I enjoy teaching programming, I have taught programming classes at a college , done corporate workshops, and more recently have been working on a website for participatory learning . This time I was looking for a different kind of mentoring experience, something which would be free form and fun. After a discussion with Freeman , I decided to go spend the summer at iAccelerator. In the first few days of the program we had introductions by all the teams where they spoke about their product and vision. This was followed by a session on team building and thinking out of the box, a few legal sessions, sessions on accounting and company law, and several other mentoring sessions. All this is very useful for early stage software stratups, especially whe...