Multiple Monitors in Ubuntu 14.04 LTS

March 4th, 2017 by Ruwan Egoda Gamage

It was not straight forward to configure 3 monitors in my Ubuntu 14.04 LTS desktop machine. I’m using an Nvidia graphics card to connect first two monitors and on board Intel graphics card to connect the third monitor.

Apparently there is a bug in xrandr, and following configuration helped me to get it working.

I’ve created a ~/.xsessionrc and placed following content in it.

xrandr \
--output DVI-I-1 --mode 1280x1024 --pos 0x0 --panning 4480x1080+0+0/1280x1024+0+0/0/0/0/0 --rotate normal \
--output DVI-I-0 --mode 1920x1080 --pos 1280x0 --panning 4480x1080+1280+0/1920x1080+1280+0/0/0/0/0 --rotate normal --primary \
--output HDMI-1 --mode 1280x1024 --pos 3200x0 --panning 4480x1080+3200+0/1280x1024+3200+0/0/0/0/0

Let me try to explain the numbers. Say, there are three monitors, M1, M2 and M3 arranged in the same order left to right.
Furthermore, their resolutions are W1xH1, W2xH2, and W3xH3 respectively. Then we could configure them as following.

xrandr \
--output <M1> --mode <W1>x<H1> --pos 0x0 --panning <W1+W2+W3>x<max(H1,H2,H3)>+0+0/<W1>x<H1>+0+0/0/0/0/0 --rotate normal \
--output <M2> --mode <W2>x<H2> --pos <W1>x0 --panning <W1+W2+W3>x<max(H1,H2,H3)>+<W1>+0/<W2>x<H2>+<W1>+0/0/0/0/0 --rotate normal --primary \
--output <M3> --mode <W3>x<H3> --pos <W1+W2>x0 --panning <W1+W2+W3>x<max(H1,H2,H3)>+<W1+W2>+0/<W3>x<H3>+<W1+W2>+0/0/0/0/0

Use xrandr function without any parameters to identify M1, M2 and M3 and all supported resolutions.

DIY Aquarim Stand

April 27th, 2015 by Ruwan Egoda Gamage

Last weekend, I’ve built an stand for my 75 gallon aquarium. It was based on numerous designs available in the internet.
This is what I modeled in sketchup.
DIY aquarium stand sketchup

I have used 4x2x96 inch studs & #10 2.5 inch wood screws from Lowes. Total cost was roughly $30.

I’ve used following spreadsheet for all caculations. It can be changed for any aquarium size.
DIY Aquarium Stand Spreadsheet

This is after cutting all the pieces according to the spreadsheet.

This is the end result.

My Rigidbot 3D Printer build

September 24th, 2014 by Ruwan Egoda Gamage

My Shapeoko 2 DIY CNC build

September 24th, 2014 by Ruwan Egoda Gamage

I flew my quadcopter closer to Bambarakanda Falls, Sri Lanka

September 24th, 2014 by Ruwan Egoda Gamage

How to recover a discarded draft in Gmail

June 2nd, 2013 by Ruwan Egoda Gamage


However, If you are lucky there are few options that would work.

1. Just hit the “UNDO” button :-) . You have few seconds for that.

2. If you’ve discarded the draft on a PC, you could use Android phone GMail app if available. You have to do that quickly :-) .

  • Disconnect the phone from Internet: If you are using 3G/4G data connectivity select Airplane mode quickly. If using wireless internet, disconnect that.
  • Select Drafts (top dropdown in the app).
  • If you are lucky, the Draft might be there. Copy the entire text.
  • Compose a new message and paste it.
  • Reconnect internet.

3. Re-type the lost message from memory :-(

#2 saved me!!


Recovering ubuntu after a crash : a mount issue

February 22nd, 2012 by Ruwan Egoda Gamage

My ubuntu machine dumped following and went into initramfs prompt.

mount: mounting /dev/disk/by-uuid/xxxxxxxxxxxxxxxxxxxxxxxxx on
/root failed: Invalid argument
mount: mounting /dev on /root/dev failed: No such file or directory
mount: mounting / sys/ on root/sys failed: No such file or directory
mount: mounting /proc on /root/proc failed: No such file or dirctory
Target filesystem doesn't have /sbin/init.
No init found. Try passing init= boot arg
BusyBox vx.xx.x (Ubuntu 1:x.xx.xx.xubuntu7) built-in shell (ash)

Several attempts to recover it using the LiveCD (10.04 LTS, same CD used during installation) failed.
ubuntu@ubuntu:~$ sudo umount /dev/sda1
umount: /dev/sda1: not mounted
ubuntu@ubuntu:~$ sudo e2fsck -f -v /dev/sda1
e2fsck 1.41.11 (XX-Mar-2010)
e2fsck: Device or resource busy while trying to open /dev/sda1
Filesystem mounted or opened exclusively by another program?

Then found out that this was a reported e2fsck bug!!

Comments suggested to use either 9.10 LiveCD or a nice boot-repair cd!

Since the latter downloaded earlier :-) , I gave it a try. It fixed the issue! I believe the former would fix it too.

TTFace – The Bus Time Table Display System for Southern Province of Sri Lanka

July 19th, 2011 by Ruwan Egoda Gamage

Have you been to a bus stand in Southern Province of Sri Lanka recently? Specially the new bus-stand in Galle? If you did, you might have noticed the new Bus Time Table Display System (TTFace).

I’m thankful to Southern Provincial Road Passenger and Transport Authority (SPRPTA), for the opportunity provided me to develop the above system.

We have come a long way since the first version I gave them for free in 2005. Now the system is in it’s version 3.

A sense of accomplishment : How people are using the system.

System Features

  • Displays information in 6 rows corresponding to 6 routes at a given time.
  • Each row displays multiple routes by rotating them over time.
  • In each row, Destination, Via and Route No information is displayed.
  • In each row, next two buses and their departure times are displayed of the route.
  • For each route, hop information is rotated. For each hop; destination, distance, and fare are displayed.
  • In each route, the bottom row displays the entire schedule of the day.
  • Displays a text marquee at the bottom. TTFace uses that to display important messages and text advertisements.
  • Displays video advertisements.
  • Supports, Sinhala, Tamil and English Languages.
  • Single computer supports multiple screens.

A courageous friend of mine

July 12th, 2011 by Ruwan Egoda Gamage

It was my first day in the University of Moratuwa. I remember, how much excited I was to make new friends. During the orientation I started a conversation with the gentlemen who was sitting next to me. As I remember, it was my first attempt to talk to a batch-mate I`ve never met before.

I couldn’t recall, how I started the conversation exactly. Most probably, I might have asked his home town. The conversation proceeded few more seconds.

I asked, “So, did you do any sports in your school?”

He smiled. And gently replied, “I couldn’t! I’m crippled”.

I felt really bad. I shouldn’t have asked that question. Unfortunately , I hadn’t noticed his condition. I certainly hoped that his thoughts were the same and most importantly I didn’t hurt his feelings.

Over the years I came to know about him a bit more. He was determined, courageous and most importantly very friendly. In the final exam, he ranked top in his field. After graduation, he joined a grad school in National University of Singapore with a scholarship.

A few days ago, he earned his PhD from National University of Singapore.

Dr. Jayathilake, CONGRATULATIONS machan. I wish you all the very best from the bottom of my heart. I’m honored to know you personally.

Developing Web for Sri Lankans

April 4th, 2011 by Ruwan Egoda Gamage

It is always a pain to support all – at least widely used – browsers! Specially a lot of time is wasted in fixing issues in Internet Explorer (A.K.A. Internet Exploder!).

However, if the target audience is Sri Lankans, that worry is getting less and less. Sri Lankans, more than 69%, are using Firefox and Chrome!

Source: StatCounter Global Stats – Browser Market Share