Saturday, February 13, 2016

The beginning of a journey

Alhamdulillah, yesterday, February 12, 2016, I finally defended my PhD thesis successfully. I am grateful to Dr. Zartash and Dr. Ihsan for sparing time for rehearsals and feedback during the entire last week.  Also, Dr. Tariq Jadoon was there in the mock presentation and gave excellent feedback. A special thanks to my sincere friend Kamran Nishat for being there throughout the last week or so. He lent a great and invaluable helping hand. He was there with excellent suggestions just as he has been throughout my PhD studies at LUMS. Irteza was also there with encouragement in the tough last week. A special thanks to Zeeshan Rana, Akeel Faridee, Umar Suleman and Fahad Javed for being there to attend the defense presentation.
I will write more details about it later. One might think that this is the end. In fact, it is a beginning. Conference of this degree symbolizes an expression of confidence in my ability to do independent research. It is not a farewell, but a welcoming ceremony to the club. Hopefully, a spectacular journey of discovery lies ahead. I pray that Allah may help me in that journey more than He has during my PhD, in particular, and in the rest of my life in general.
One last reflection in this post is that I did not feel "that moment" to be one of pride. It was more of a humbling one. In fact, my entire PhD experience has been a humbling one because it made me realize not how much I have learnt, but that there is a vast amount of things that I do not know.

Wednesday, November 12, 2014

Open source cloud platforms

If you think that OpenStack is one of a kind, you need to update yourself. There are several open source players in this area. Please read this interesting article (not written by me) about open source cloud platforms. 

Friday, September 27, 2013

Latex -> PS -> PDF profile for TeXnicCenter 2.01 Beta

I love using TeXnicCenter for writing my conference papers. I am presently using v 2.01 Beta of it. Other software versions are:

dvips - 5.992
latex - 2.9.4535
ps2pdf wouldn't tell me which version it is

I created the PDF of a paper and not all fonts were embedded. I had to modify the default output profile. I've extracted the .tco file for the latex => PD => PDF profile that you can import to your install of TeXnicCenter.

Thursday, December 27, 2012


I just saw this piece in Dawn. I don't see how one can celebrate when everything around us is falling apart. People are going hungry and shivering in cold nights. Streets are littered. Traffic is rowdy. Just because I have earned some money, or gotten pocket money, I have the right to party? Instead of a few moments of music, laughter and fun, which produces nothing concrete in the end except memories, wouldn't it be much more enriching and useful if we did something creative?

The rich will party for sure, because they don't have a problem. They've created their own Amreeka right here in Pakistan. This local Amreeka is better than the actual one, because this one comes with a "get out of jail free" card so they don't have to follow any rules. That's why you see them still living here with their dual and triple nationalities. They can buy anything here. I'm sorry about this blanket statement here, many rich people are responsible people, too, I'm sure. But this is the overall picture that you get in the society.

So, if you're planning on going to a concert or a not-so-underground-anymore farmhouse dance, drugs,  drinks and sex party ask yourself this question: Do you have a different choice? How about planting some trees in public places? How about talking to your neighborhood marketplace shop owners to coordinate on keeping the area clean and green? How about visiting your neighbor and asking how they're doing? How about sitting with your parents and asking how they are doing? How about collecting sweaters for schools children's uniforms who can't afford them? How about fixing some street lights? If you're so full of energy and you've got so many similar friends, how about taking some cartel-ing traders to task who are charging unreasonable prices for stuff?

Is there something worth your while in that list? If not, I'm sure I've missed quite a few good deeds that you can do and it will be fun in it's own way and much more rewarding. So, what will it be? The red pill or the blue pill? Choose wisely, for your choice will have ramifications not just on a few hours of your life, but on the lifetimes of our generations to come.

Monday, November 19, 2012

Ubuntu 12.04 server crash and recovery

Wow, my last blog entry was over an year ago. I've been real busy. Anyway, I had a server crash last Friday night and I had to work hard and careful (yea, right!) to recover it to a good state. I found a few useful resources on the web for this task, so I thought I'd blog about it so that the method is handy for my future use as well as for others. Let's look, first, at what the problem was.

The server is being used for course labs, assignments and exams. Students write, compile and run C++ code on this machine. The server had accumulated some updates and needed to restart to apply them. Friday night, we had a midterm exam where students worked live and interactively on the server to solve the exam questions. After the exam was over, we decided to shut the server down for a few minutes so that the exam end time could be policed and students wouldn't be able to continue working on the problems. After shutting the server down, I came back to my office and turned it back on. But the server halted during the bootup process. I had to recover the server to a working state. I had to do it without losing data. It would be nice if the user account information (passwords) would remain intact. So, those are the parameters of the job. Now let's see what went wrong and then at how I fixed it.

When the server rebooted, it stuck during the boot process complaining about something like "cifs_mount failed with exit code -101". I knew that there is a NAS that I am mounting over SMB through /etc/fstab, so that must've been the culprit. But how do I remove that line from /etc/fstab when the server wouldn't boot up. After googling, I determined that one get the system to drop me at a root shell prompt by editing the kernel arguments at the GRUB boot prompt. So, I hit 'e' to edit the kernel parameters and typed "init=/bin/bash" at the end of the kernel line. The machine started and dropped to the root shell. But when I tried to edit the /etc/fstab file, it was read-only. Of course, the hard drive hadn't been mounted in read-write mode, yet. Some more googling revealed that I should do a "mount -o remount,rw /". Having done that, I was able to get the line that mounts the NFS commented out of /etc/fstab. Reboot, but still, the boot didn't complete and the server was stuck at an error message which complained of pre-start process terminating with some error code. I did some more googling which led me to a bug report about upstart in a past versioin of ubuntu. But apparently, that bug didn't apply to the version I am using (12.04).

So, it seemed that recovering without a reinstall was out of the question. To get data backup, I booted with a Ubuntu desktop live CD. But how do I mount the server's hard drive. For that, I followed the steps on this page. Then, I connected my NAS on a USB port and did the following:

sudo mkdir /mnt/lg
sudo mount /dev/sdb1 /mnt/lg

Then, I copied all user folders to the NAS:

cd /home
tar /mnt/lg/homes.tar.gz *

Having done that, I also backed up all contents of the /var/log and /var/www folder onto the NAS. To get backup of the user accounts, I followed the steps outline on this page. Note that you'd have to intersperse sudo with most commands on that page. Also, where the page talks about piping one command's output to another, I had to use a sudo at the beginning of the command as well as somewhere in between. I guess we can do a hit and trial next time, too, until we stop getting a permission denied.

Finally, I unmounted the NAS

sudo umount /mnt/lg

and rebooted the server with the 12.04 server install CD in the drive. I re-installed the server and selected to use the existing LVM partition on the hard drive without formatting it, so all data was safe anyway. I decided to turn off automatic udpates this time. Then, after the server booted up successfully, I connected my NAS and mounted it. Then, I followed the restore instructions at this page.

That's it! The server was back online, with all passwords same as before and no data loss. Of course, I had to install g++ and ncurses again. Plus, I made a few mess ups in between so I had to follow the same steps as above one more time almost from scratch. Also, when the server crashed and I had the path traced out, it was 11:30 pm before I could do anything useful and I had a class early morning for which I hadn't even started preparing, so I left for home and only started working on the server recovery at about 2 pm next day. So, the server was offline for about a full day.

Saturday, September 17, 2011

New province

You might have heard the complaints of how the southern Punjab is far from the Takht-e-Lahore and hence the former must be made a separate province. This is a very bad and dangerous reasoning for doing something that might be legitimately necessary. Unfortunately, it is being used as the prime reason to do so.
Can't you take this same argument and apply it in the context of the Balochistan province, for instance, being far from Takht-e-Islamabad. Hence, I presume that the federal government should feel that just as Southern Punjab should be separated from Takht-e-Lahore, Balochistan should also be separated from .....
A very dangerous precedent is being set here.