Back from India

I just made it back to Singapore a few days ago after one week of backpacking around India with Jackson Tse and Katie Morehead. I never expected to ever go to India but, nonetheless, it was an amazing opportunity to learn more about the appealing Indian society, culture and history. I am very happy with what we have accomplished during our little trip!

To mention a few of the places we visited:

  • Trivandrum and Cochin in the state of Kerala
  • Mysore and Bangalore in the state of Karnataka
  • Maharaja’s Palace in Mysore (stunning!)
  • Chamundi Temple in Mysore
  • Padmanabhaswamy Temple in Trivandrum
  • Trivandrum Zoo
  • Kathakali Dance Concert
  • Kovalam Beach
  • Bangalore University
  • Psmup Public School in Trivandrum and another public school in Cochin
  • A Muslim Orphanage in Cochin
  • A technology park in Bangalore (where the Google office is located)

Some “side accomplishments”:

  • Bathed some elephants with a coconut.
  • Bought and distributed pens and biscuits to students at Psmup Public School.
  • Tried some street food – I can’t remember the name of the dish but it was, more or less, fried chicken skin.
  • Rode an overnight train from Trivandrum to Cochin (had a great conversation with a few Indians on the train).
  • Rode a sleeper class train from Mysore to Bangalore! This is the lowest and cheapest class in Indian trains.
  • Took two domestic flights (from Cochin to Bangalore and from Bangalore to Trivandrum).
  • BONUS – Got pickpocketed!

It was quite interesting to compare and contrast India, Egypt and other places I have seen. Hopefully I’ll have the time to write about some of this in the near future.

Hello World from Singapore

So it’s been quite a while since I posted anything here. The past few months were crazy busy. I am now in Singapore on exchange at the National University of Singapore. I arrived here last Saturday and so far my impressions are very positive. The country is very well organized, well kept and I fell in love with the tropical weather.

I am living in one of the residence halls on campus called Kent Ridge Hall. People here are super friendly and I am learning a lot about Asian culture from them.

I am staying in Singapore for four months. During this period I am hoping to:

  • Become familiar with Asian culture.
  • Learn about the factors contributing to the success and progress of Asian countries and how we can apply this to the Middle East.
  • Explore Singapore and neighboring countries.
  • Learn some Chinese!

I am hoping I’ll have the time to do all this. Especially since I am taking some heavy CS courses including Operating Systems, AI and Algorithms. Will keep you updated on how it goes!

Live Notes

For the past few months I have been involved with the project BigBlueButton, an open-source web conferencing system. That, along with looking into Etherpad’s source code, really ignited my interest in real-time collaboration technologies.

I started an open-source project to extend BigBlueButton with real-time document collaboration to the conference’s participants. The project is still at a very early stage, but will be out for beta testing in the next release of BigBlueButton.

Before I start ranting about the project, which I am tentatively and temporarily calling it “Live Notes”, let me first show you a demo. Continue reading “Live Notes” »

Etherpad on Debian/Ubuntu

Since the release of Etherpad’s source code last month and I have been really interested in studying the code and algorithm behind Etherpad’s realtime editing.

Etherpad’s backend is mostly written in Scala. Seeing how Scala is starting to be adopted by many popular online services, it’s also worth looking into.

I thought I’d start off by installing my own instance of Etherpad. Unfortunately, the installations didn’t quite work for me straight out of the box. After a few quirks, and with the help of this guide, I finally got Etherpad running. I am using Ubuntu 9.10, but the instructions should also work for Debian.

  1. Install Sun Java JDK
    apt-get install sun-java6-jdk

    Note: You need to have Sun’s Java as your default. You can verify this by the following:
    java -version
    Java(TM) SE Runtime Environment (build X.X)
    Java HotSpot(TM) Client VM (build 14.3-b01, mixed mode, sharing)

    If you see anything other than what’s above (for example, OpenJDK). You need to set Sun’s Java as the default JDK. To do so, use the following command and follow the prompt.

    sudo update-alternatives --config java

  2. Install remaining prerequisites:
    apt-get install scala mysql-server libmysql-java mercurial
  3. Paste the following to /etc/profile, and be sure to replace X.X.X with the version of mysql connector that you have installed.
    export PATH
    export JAVA_HOME="/usr/lib/jvm/java-6-sun"
    export SCALA_HOME="/usr/share/java"
    export JAVA="/usr/bin/java"
    export SCALA="/usr/bin/scala"
    export PATH="/usr/bin:/usr/bin:/usr/local/mysql/bin:$PATH"
    export MYSQL_CONNECTOR_JAR="/usr/share/java/mysql-connector-java-X.X.X.jar"
    umask 022
  4. Download the etherpad source to /usr/local/etherpad
    hg clone /usr/local/etherpad
  5. Set the environment variables: Again, remember to replace X.X.X with the corresponding version on your machine.
    export JAVA_HOME="/usr/lib/jvm/java-6-sun"
    export SCALA_HOME="/usr/share/java"
    export JAVA="/usr/bin/java"
    export SCALA="/usr/bin/scala"
    export PATH="/usr/bin:/usr/bin:/usr/local/mysql/bin:$PATH"
    export MYSQL_CONNECTOR_JAR="/usr/share/java/mysql-connector-java-X.X.X.jar"
  6. Add your domain to the superdomain section in /usr/local/etherpad/trunk/etherpad/src/etherpad/globals.js. If you will only be accessing it locally (through localhost), you don’t need to do this.
  7. Create the etherpad mysql db and privileges:
    mysql -u root -p
    # enter your password when prompted
    create database etherpad;
    grant all privileges on etherpad.* to 'etherpad'@'localhost' identified by 'password';
  8. Compile the JARs:
    cd /usr/local/etherpad/trunk/etherpad/
    ln -s /usr/share/java /usr/share/java/lib

    Edit: As Mihira pointed out in comment #2, you may come across this error when compiling with the bin/
    Unable to establish connection to compilation daemon. Compilation failed.

    The problem maybe that the server’s hostname doesn’t have a entry for in the /etc/hosts file. In that case, add to the /etc/hosts file and run bin/ again.

  9. Run the web server:
    Note: If you are running a machine or a VM with little RAM, you might encounter this message:
    Error occurred during initialization of VM
    Could not reserve enough space for object heap

    If you see this error when you try to run the web server, it can be resolved by decreasing the size of the needed heap. Edit bin/ and change the variable MXRAM from 1G to something smaller (256m should do the trick), then try running bin/ again.

  10. That’s it! You can access Etherpad locally on http://localhost:9000

Finding and Downloading Gigapixel Images – Part 1

In the last few years, my father spent a great deal of his time building a new home for us. In the living room he had this really big, yet gorgeous frame. The frame was roughly 10 feet wide and 5 feet high. We spent some time looking for a great poster that we can use to put in the frame, but with no success. An alternative solution was to obtain from the internet a photograph of an extremely high resolution (i.e. one gigapixel and above) and have it custom printed to the size that we need.

In this video, I’ll be sharing where I found these images and how I downloaded them.

If you’re following with me, you’ll need to have a tool to download websites, such as HTTrack Website Copier (Windows) or SiteSucker (Mac OS X).

Filtering and Multicolumn Sorting in Syncfusion’s Grid Control

Last week I was working with a C# application that used Syncfusion’s standard grid control and I was trying to add filtering and multicolumn sorting to the grid. However, as it turns out, the grid does not support filtering or multicolumn sorting out of the box.

Instead, Syncfusion offers another control, called the GridGroupingControl that have these features. Unfortunately, this was very inconvenient for me as the application I worked on is well established and replacing the standard GridControl with the GridGroupingControl would require a tremendous amount of effort. I’ve been in touch with the folks at Syncfusion and finally reached the following workarounds.

Continue reading “Filtering and Multicolumn Sorting in Syncfusion’s Grid Control” »

Adding Formula Fields to a Database with Ruby on Rails

Every now and then you might encounter a situation where you need to have a database column that has a value based on a formula consisting of values of other columns. Unfortunately, there is no standard way of embedding this into the SQL definition of a table. You must keep track of updating this value on your own when using the database.

But, this begs the question, why would I want to have a formula field? Can’t I just do all my calculations when I am fetching my data with a SQL query? Sure, you can. However, if you are doing calculations on vast amounts of data, having part of this data pre-calculated in a formula field can give you a solid performance boost.

If you’re using Ruby on Rails for your project, there’s a very simple solution you can implement. I’ll show you how through a trivial example. In this example, we imagine a teacher wanting to store his students’ assignment marks.

Let’s go ahead and create our rails project called teacherexample. I’ll use MySQL as my database in this example, but the concept applies to any database system.

Continue reading “Adding Formula Fields to a Database with Ruby on Rails” »

Tossed Off My Bike

I was really thrilled yesterday after receiving my first paycheck. So, the first thing I did this morning was grab my bike and set off to the bank to deposit the check into my account. Everything went really smoothly (aside from the weather being a little sketchy). I was biking my way back home thinking to myself the infamous “I am rich, bitch!”. Then, in a split second, I find myself lying in the middle of the street, with my glasses lying three feet away from me. I have been thrown off my bike amid being hit by a car that was leaving the parking lot and entering the main road. A few seconds later I realized that my left leg is bruised and my shirt ripped in half (well, almost in half).

Ken, the car driver’s name as it turns out, was a really a nice guy. He quickly apologized and offered me a ride to the hospital. I checked myself out (not in the usual way people check themselves out in) and told him there is no need for that. To make a long story short, he gave me $100 as an apology and drove me back home, as my bike was completely busted.

Since I became bikeless, and Walmart was a fair distance away, my landlady was nice enough to offer me a ride to the store. There, I imagined I’d either have to pay to fix the bike or buy a new one. Luckily, they were able to fix it. Not only that, but I was able to exchange it for a much better bike and pay the difference (which was around $50).

So, honestly, having a “bike/car” accident worked out nicely. I was able to replace my cheap bike with a much better bike, make some cash, and make my Saturday interesting for myself. How better can it get?