Thursday, September 24, 2009

BGT: The Humble Peformer

I've been watching Britain Got Talent (BGT) for some time now and I've never come across a performer so humble like Eugene.

Really touching video, yet happy for his courage to come forward.

Tuesday, September 22, 2009

Running Matlab Remotely: ssh -X

I wanted to run Matlab by logging into the university account remotely from my machine. Everything went fine except for the graphics. Matlab started in no graphics mode.

After bit of a search I found the solution. You have to set the X11 forwarding in you ssh configuration file. Here's how to do it.

1. cd /etc/ssh
2. sudo vi ssh_config
3. uncomment the lines "ForwardAgent" and "ForwardX11". Set their values to "yes"
4. sudo vi sshd_config
5. uncomment "X11Forwarding" and set it value to "yes" as well.

that's it and you are good to go.

Type ssh -X username@domain

To test if everything works fine try running xclock once you log in. It should open up a graphical clock window.

Funny Infinite Loop with C#

What will happen when you run the following C# code? It's a never ending loop. Oh! really? yea, note the "Name" inside set method. I have used uppercase N. Now it will call setter recursively.

Interesting isn't it? :)


public class Person
{
private String name;
public String Name
{
set
{
System.Console.WriteLine("assigning wow");
Name = value;
}
}
}


public class Hello
{
static void Main()
{
Person person = new Person();
person.Name = "wow";
}
}

Monday, September 21, 2009

Scheme Way: Eclipse Plug-in

I thought of searching for an IDE for Scheme, after being bit lazy to learn Emacs. Lucky enough I found a nice plugin for Eclipse named SchemeWay. It took me a bit of time, however, to configure and set up the plug-in to work as I like.

If you are struggling to set it up (as I did) here are few steps to help you with.

1. Download Eclipse from http://www.eclipse.org/downloads/. I chose the classic version

2. Download SchemeWay update pack from

3. Unpack the UpdateSite-1.3.0.alpha7.zip and copy the stuff inside plugins and features folders to eclipse features and plugins folders.

4. Start Eclipse and go to Help --> Install New Software.

5. Click Add on the on the Install window you get. It will give you a small window with two text boxes.

6. Click Local next to the Name text box. Now you can browse to your extracted folder of the SchemeWay update pack.

7. After couple of Ok presses Eclipse will show that it found the SchemeWay plugin. Then go ahead and install it.

8. Once everything is done, you can switch to the Scheme perspective from Window --> Open Perspective --> Other --> Scheme

9. Next task is to set the Scheme interpreter. I use the free version of Chez Scheme (i.e. Petite). So I have to set my interpreter as an external interpreter. To do this click Scheme --> Select Interpreter --> External Interpreter.

10. Now you have to give the necessary parameters to the plug-in to start your interpreter. To do this click Window --> Preferences. It will show you the preference window. On the left hand side of it you can expand the Scheme configurations. Select the External Interpreter configurations from there and set the necessary parameters.

Great! now you are good to go. Just create a new project and add a new Scheme source file. Then once you are done with typing your code, you can load it to the interpreter using CTRL+SHIFT+L.

You can play around a bit and get use to many other key short cuts.

One thing to note: you will have to set the indentation for some definitions to suit your style. You can do this by going to the same scheme configuration from Window --> Preferences.

Ubuntu 9.04: Way better than 8.10

I have used Ubuntu since it's version 6.04 simply because I felt that it is easy to work with. Anyway, for me, the versions x.04 never gave a good impression. So I used to say "hey! if it's not a x.10 version then it's not what I like". Interestingly, I am finding it is hard to say with Ubuntu 9.04.

Here's a list of things I felt really cool with 9.04.

1. No configuration necessary for the ATI drivers. Yea I had a really fun time configuring stuff with 8.04, 7.10, and 6.10 (Um, I can't remember what I did with 6.04).

2. External display detection is really awesome. It can even arrange the displays in any order I like (e.g. external one on top of default one).

3. Intel wireless card works like a charm.

4. Easy configurations for printers; hmm, I should really admire this.

5. Reliable (so far). Didn't crash, didn't reboot with errors, and most interestingly hibernate seems to work better than in previous versions.

6. Improved graphics.

In summary, I am beginning to like x.04 s as well :)

Friday, September 11, 2009

Scheme: Trace Functions

I found this really useful command in Scheme which helps to trace the function calls, while playing around it.

Say you have define a function named func. Now if you want to trace how it works when you invoke it, just type this.

> (trace func)

The next time you invoke func you will see the trace of function calls.

GSoC and UoM: Who let the "sharks" out

"...University of Moratuwa in Sri Lanka continues to dominate the field with 22 students accepted."

Wow! am I not happy to see this line in the Internet? I truly am. As a former student of University of Moratuwa, Sri Lanka, I am really happy to see the continuous achievement of its student in Google Summer of Code. To think of the fact that I too was a contributor to this success, makes me happy even more.

Keep up the good work "sharks"

Tuesday, September 01, 2009

Running Scheme on Ubuntu 8.04

Just hitting "scheme" in the console does no good if you are in Ubuntu 8.04. A workaround is explained here (http://ubuntuforums.org/showthread.php?p=4868292)

Here's the solution in brief:

sudo sysctl -w vm.mmap_min_addr=0

Now run scheme