A tribute to awesome women

Women_Tribute

I know I’m a bit late but I wanted to remember International Women’s Day by paying tribute to the most awesome women I’ve had the privilege of knowing…

Marjorie… Looking back at my college days, you were one of the few people who have truly influenced my way of looking at the world. Just being around you is intellectually stimulating. I don’t know any other person with whom I can have a conversation on any topic, be it literature, philosophy, religion, or science. You and Justin together make the world’s most awesome couple. The world needs more of you before it can become a better place.

Tessa… Having known you as a very close friend, I am overwhelmed every time I think about how much you’ve struggled in your personal life to pursue your dreams. You are the most fiercely independent woman I have ever known and your track record as a computer scientist is impeccable. I sincerely hope that life rewards you with all the happiness that you thoroughly deserve.

Urmila… I’ve always regarded you as my superhero because you are the one I personally aspire to become. Most of the people I know who have achieved success have done so at the expense of their health. But you are living proof, that one can master health and career at the same time. You truly are a role model for men and women alike.

Samreen… To me you are an embodiment of the idea of “Women in Computer Science”. The way you have shattered the notion of male dominance in this field through your hard work is simply awe inspiring. You are a role model for the entire “Desi” community. I hope more young women follow in your footsteps to success.

Ren… You are the most creative person I’ve ever had the good fortune of knowing. You are teeming with potential and I hope your first job is just the beginning of a wonderful and exciting career. You are the person every IS major should aspire to become.

Humaira… You are the smartest and most successful individual in our Bangladeshi community here in Qatar. Having been taught in the same high school as you, I cannot help but be amazed at the tremendous odds you have surpassed to become who you are today. Your success will continue to inspire our community for many years to come.

Waltz with a neutron star

I am a lonely atom
I travel through space and time
Someday I hope to meet a neutron star
And ionize myself in her radiating beauty
Together we shall dance for eons
Until gravity takes its toll and turns us to dust

No Regrets

A good decision is often associated with making the most of an opportunity. Be it choosing your major, proposing to the girl you love, or pursuing the right career. But sometimes good decisions involve knowing when to let go. Life has its ups and downs. Decisions that made perfect sense years ago, may not be good for you any more. Life is too short to cling on to old decisions for nostalgia’s sake. If you can honestly convince yourself that you have failed at everything you could do to make your life better, it is time to choose a different path. Just make sure when you embark on your new journey, you bring along all of the good experiences and none of the regrets. Don’t let hindsight fool you into thinking that you are a failure. If you took the path that was the best for you under the circumstances, walked it for several years, and outlived its usefulness, you have nothing to regret. Holding a grudge is the worst possible way to repay God for his infinite blessings.

As I write this, I am concluding a 7 year long chapter of my life. I am humbled for being rewarded with so much happiness at such a young age. It would be terribly ungrateful of me, towards God, and towards the people I love to consider these 7 beautiful years to be the outcome of a bad decision. I would like to thank everybody who supported me from the beginning. I couldn’t ask for better friends, and more importantly, I couldn’t ask for better parents who remained patient with me even when I doubted them.

I ask God to provide me with courage to deal with this new phase of life, and I ask all of you to keep me in your prayers.

Smarter apps, not just smarter phones

How would you define a “smart phone”? Does the ability to run arbitrary apps make a phone smart? Among the hundreds of apps on the app store, only a handful of them show any sign of rudimentary intelligence. They are all good at doing stuff, but are not that great at learning. I’m not just picking on mobile apps. In fact, traces of intelligence are even harder to find in desktop apps.

Let’s travel back in time to 1995 and look at how things have evolved over time, from an intelligence perspective. Web browsers can now remember passwords, auto-fill web addresses, and maybe even pre-fetch web pages to a certain extent. What about Office products? Nothing much either. We have gained better auto-correct, better grammar checking, and frequent auto-saves. What about the core operating system itself? How has it become more intelligent? We have made a few strides in pre-fetching documents and executables. But the file-manager is just as dumb as it was back in 1995 and built-in media player still doesn’t do much to organize my music.

It’s 2013 and we still don’t have a file manager that understands what files I frequently use together. It still puts the burden on the user to create folders and organize his personal data. Our web-browsers still treat all websites in the same way. It still can’t tell whether the new tab you just opened is in the same context as the other ones you currently have open. Your browsing history is still a list of websites sorted by time, and not by context. We download stuff from the net all the time, but your file manager still can’t tell you which sites were open when you downloaded the file.

Coming back to the mobile world. We still don’t have phones that recognize our daily routines. Our call-logs are still plain lists that display the most recent calls. It’s not smart enough to recognize that you call your wife everyday during lunch hour, or that you hang out with your best friends every weekend. Our map application doesn’t infer my home, and office location. It’s not smart enough to know that I leave for office everyday at around 8:30 and it can’t tell me what is the best route to take, without me explicitly asking for it.

Looking at the great things Google has done to advance the state of art for search engines, I strongly believe that we have all the necessary algorithms to solve these kinds of problems. And with quad-core processors in both desktops and mobiles we have the necessary hardware to carry out personal analytics on our devices without even connecting to the Internet. As consumers, we need to raise our voice to demand such intelligent features in our applications. Only then will developers and device manufacturers shift their attention from simply making larger screens to creating apps that actually improve the quality of our life.

Mac and I – Part 2

So in the last episode I walked you through my first boot experience with my brand new Mac Mini. And I also talked about how washed out the colors looked on my external LCD display. Fortunately, I didn’t have to take the Mini back to the Apple store. An out of the box color callibration process was enough to somewhat fix the problem. In this episode I am going to talk about my experience in installing new apps on my Mac. I promised I’d talk about the Mac App Store, but I will touch on that topic a bit later in the article. I am first going to cover the more traditional way of downloading and installing apps from the internet.

Manual downloading and installing

Windows users will be familiar to downloading installers from the internet. Windows Installers typically have the .msi or .exe extension. You download and run the installer, jump through some hoops, accepting some license agreements on the way, hit finish and you are done. Installing apps on a Mac has fewer steps. You first download an installer. Typically on a Mac, the installer has a .dmg file extension. Launching the installer brings up a small window with two icons. One of them is the icon of the app you want to install. And the other icon is that of a folder. At first glance they will seem like two distinct desktop shortcuts. But you’ll soon find out that clicking the icons does nothing. Then after a bit of messing around, I figured out that if you drag the application icon to the folder icon, the app gets installed. I will admit the installation process has much fewer steps than Windows, but I don’t understand why this could have been a simple, “Would you like to install this application?” dialogue box. I installed a few more apps in this manner. And each app seems to have its own version of the “Drag to Install” window. In fact, the Dropbox app didn’t even show 2 icons. Once you launch the installer, you see a new window with only 1 icon, and a message asking you to double click it. After doing so, the app installs itself without any further questions. I know I am nitpicking here, but given Apple’s attention to detail I was expecting a more standardized and polished install experience.

Mac App Store

Before I begin I must say that the Mac App Store is a very new application. It hasn’t gone through enough iterations like the operating system itself. That said, given that there are several well-polished mobile and desktop app stores out there, there is no excuse for Apple to try to force us through this horrendous experience. When you first launch the App Store, you are presented with this:

Screen Shot 2013-01-21 at 10.37.20 PM

That’s right, a blank window. No indication of what the application is doing. No visible cues as to which of the five screens is currently selected. Depending on your internet speed, a few seconds later, all the contents on the screen pop up at once. You are presented with familiar sounding sections like Featured Apps, Top Free apps, Top Paid apps etc. I am OK with a featured Apps section, but I don’t see why the primary categorization is based on the price of an app. When I go to an App Store, my first thought isn’t, “Let me check out what’s free”. I usually go in with a use case in mind, “I need an app to edit my photos”. And only then, I think about, “Are there free apps that can satisfy my use case”. Again, I know I am nitpicking, but I started using a Mac with a lot of expectations about great design and usability.

The last point I want to make about the MacApp Store is about search. Since I write regularly on my blog, I was interested in checking out writing apps. I’ve read about a lot of fantastic distraction free writing apps for MacOS and quite naturally my first instinct was to use the app store to check them out. I type “writing apps” in the search box and this is what I get:

Screen Shot 2013-01-21 at 11.10.03 PM

Nothing to see here, sorry. Puzzled I googled for “writing apps”, got the name of an app and paste it in the search box. Voila, the app showed up in the results. The point I am trying to make is if I have to type in the name of the app, then how is it a “search box”. Just for comparison sake, I searched for “writing apps” in the Android app store and I was presented with dozens of legitimate writings apps sorted by popularity. How hard is it to replicate this functionality in the Apple App Store?

That’s it for this second session. Next time I will review some good paid apps and give my opinion on whether they are worth the money or not. Until then, stay tuned.

Mac and I – Part 1

My laptop finally gave up last week and succumbed to chronic BSOD. I could’ve taken the it for repairs. But given the cheap computer market in Doha, I decided to go for a new one instead. After giving it a long hard though, I finally decided to bite the bullet and go for a Mac. Not a Macbook, nor an iMac. I settled for the very affordable 2012 Mac Mini. Being an avid Windows and Linux user for the last 6 years, I decided it was high time to get a Mac and see what’s all the fuss about. This series is an effort to document my experience getting used to a Mac.

Hardware

As with everything else from Apple, the Mac Mini hardware is gorgeous. But unlike other Apple products this one was affordable too. For just 3500 QRS I got myself a Intel i7 Quad Core with a 1 TB fusion drive (hybrid SSD+HDD). At the time of writing, this is the cheapest device running MacOS. I had my own external LCD, speakers and mouse. The only other peripheral I purchased along with the Mini was the bluetooth keyboard.

First Boot

The first boot experience with the Mini was smooth. I was worried whether it would detect the bluetooth keyboard in the first go. But the OS provided graphical instructions on how to pair the keyboard to the device. The account creation process was very similar to that of any Ubuntu-derivative. Full name, user name, password, time zone, keyboard layout and you are done.

LCD: The first disaster

Since I was not willing to shell out another 5000 riyals for an Apple display, I specifically asked the salesman, will the Mac work with my external LCD display. He ensured me that as long as the display supports HDMI there should not be any problem. I took his word for it. After booting up the Mac for the first time, I noticed that the colors seemed a bit off. I opened up Safari and started browsing, I noticed that all the webpages looked washed out. I visited my website to get a sense of comparison. I noticed that the grey bar at the top of my site was completely gone. It appeared pure white just like the rest of the page. Even the text didn’t render as smooth as I liked it to be. I googled the color problem and it turned out to be a common issue with external displays. The gurus of the interwebs suggested to use the Color Callibrator from System Preferences to adjust the signal sent to the display. I gave it a shot and it ended in vain. The OS didn’t recognize the color profile of my display. I was heart-broken. Eventually I was able to get the callibrator to work after a system update. The colors are much better now, but still not up to the full capabilities of my display. After fixing the color issue, the text rendering improved a bit. But again, I had seen better text rendering even in Ubuntu.

Alright, I guess that is enough for the first post. Next time I will share my thoughts on the new Mac App Store, stay tuned.

When man becomes less important than machine

Last Friday a colleague of mine had a heart-attack. He is in early forties and had no pre-existing conditions. Luckily for him, he survived the incident after a quick surgery. I’ve had relatives back in my home country who passed away in an untimely manner. But never before have I been in a situation where I was close enough to the victim to notice his absence.

Today as I stared at his empty cubicle, a sense of irony grasped me. My colleague used work on Turbine Monitoring and Diagnostics. What that means in plain English is that he analyzes data gathered from hundreds of sensors on a turbine and uses it to predict failures ahead of time and allow engineers to carry out preventive maintenance.  Day in, day out he kept working, pulling out fancy algorithms out of a hat to keep a machine chugging along in some remote Arabian desert. All of this work, just so that some billion dollar oil company won’t have to see a dent in their obscene profits.

We spend our whole lives perfecting machines while our arteries get clogged and bones become brittle. We manage to find 8 hours in a day to serve our metal overlords, but not 30 minutes to take care of our own health. What sense is there to trade human life to give immortality to a machine?

Pen Friends

Feelings are best left in the hazy existence of the mind. That’s the motto I have always lived by. That’s why I rarely write about personal topics. But today is going to be different. Reminiscing is nice, but I feel I need to write in order to do justice to the memories of some wonderful people I have met.

I don’t know how many of you can relate to this. Back in the day, before Facebook and Hi5 existed, people could meet new friends on e-pal sites. I don’t even think such a concept exists anymore. We rarely interact online with people outside our circles. Even among those who do, most of them are only interested in people with provocative profile pictures. There was a time when people didn’t care how their friends looked. It was a time before short-conversations over twitter and chat. People used to take time out of their lives to actually write you an email, or even post a letter.

Although with time we have grown apart, I feel extremely lucky to have had a couple of amazing pen-friends. So here’s to you YanDream and Jhum, hope this post brings back good memories and smiles on your faces.

Yandream, I always knew that wasn’t your real name. But I remember you explaining to me that “dream” is what your name means in Chinese. 29 emails from way back in 2005 is all that I have to remind me of you. You were the first person to actually write me a letter. That was awesome of you. In this era, nothing spells friendship more than a hand-written letter. From what I gathered from Facebook and Google, you have made true all the things you used to talk about. Really makes me proud seeing all your fantastic photography and design. Keep up the great work Meng !

Jhum, Jhum, Jhum, I have many things to say about you. You are my oldest and longest running e-pal. Reading through my emails I realized how much of my life I have shared with you. I claim to lead a robotic existence and not share anything with any one. But with you I shared everything from my love life to career-aspirations. In a way, you were my first personal blog. You were the first (and only) e-pal I have talked over phone. You are always one click away on Facebook. I pray I can get off my lazy butt once in a while and write a good long mail to me.

That’s it. I feel much better already. I don’t know if I will hear from any of you. But just know that you are part of what made my childhood awesome.

Best Wishes

Shahriar

Challenges of pursing a CS degree at the CMU Qatar campus

Last Monday I went to the Qatar National Convention Center to attend the senior convocation. In the dinner banquet that followed I was fortunate enough to share the table with a gentleman who was on the advisory board of CMU alongside two other rising seniors. Given his position, the gentleman naturally asked us if we had any feedback about the Qatar campus. I was afraid that the three of us would commence a long rant about the horrors of the CS program. But what followed was a very well-structured explanation of what’s wrong in the CS program offered in Qatar. In fact, the explanation was so good that I decided to summarize it over here in this blog post.

Inability to offer classes to meet all curriculum requirements

This is by and large, the biggest problem CS students face on the Qatar campus. A good number of students walking at the convocation this year, will not get a degree because of this problem alone. The culprit in almost all of these cases is the Science Lab requirement. As per the curriculum,  CS students have to take 4 science courses, one of them being a science lab course. For a long time the Qatar campus has not been able to offer the lab requirement. Students were advised to cross register with Texas A&M/Cornell or spend a semester abroad in Pittsburgh to meet this requirement. For many students, neither of these options were feasible because of schedule clashes, or the unwillingness to study abroad. To be completely honest, the university did plan to offer lab courses many times. But for many consecutive semesters, these courses were canceled due to low number of registrations, or other logistic reasons. Even when the occasional Biology/Chemistry/Psychology lab was offered, students often found themselves unable to enroll in them because of not meeting pre-requirements. I understand, that this is a new campus and it will take time to iron out all the issues, but if there is consistently an issue with a single requirement, there should be a simple solution to offer a permanent class or waive the requirement all-together.

Ever changing elective requirements

This is one of those problems that affects both the campuses, but is aggravated over here because of the lack of choices for electives. The CS curriculum requires students to complete on course each to meet the Algorithms and Logic electives. In the Pittsburgh campus, there are about half a dozen choices for each of these electives. However, even one course for each elective is not offered consistently. Different visiting faculty often attempt to offer a different course every year, and the CS department tries to shoe-horn these courses to meet the elective requirements. Whenever, the schedule of classes is published every semester, it is often impossible to get a straight answer from academic advisors as to what requirements these new classes meet. The confusion surrounding this matter sometimes continues well after students have already started attending classes. Again, this does not seem like a very difficult problem to solve. Any debate about which requirement a course meets should be resolved before the schedule of classes is published and should be clearly documented.

Lack of a roadmap for future course offerings

This is somewhat related to the previous to. But I thought it deserves some special attention. As I said before, there are lab courses that are canceled right before the semester, unexpected lab courses for which students don’t have pre-requisites for, and even courses that switch to a different category during the semester. The situation regarding minors is even more unclear. The only thing for certain is that students can minor in BA and IS. With varying number of cross-registered/main campus courses, it is possible to minor in Maths and Design. Students have done it before. But only those students will be able to tell you what work-around they needed for the minor. Walk up to your advisor and ask for a suggested course sequence for a minor in X, chances are your advisor will be just as clueless as you are. Given all these complications, it is very difficult for a student to plan out a 4 year degree plan. What the CS program desperately needs is a roadmap of course offerings. I understand that there are many unforeseen factors. But I think a one-year or two-year roadmap of course-offerings is a reasonable demand.

Others

Besides these we also talked about other problems from our own experience. But they were mostly subjective in nature. That’s why I decided to file them under “others” and talk only about the most common of the issues. Given the dramatically small class sizes in CS, students get a lot of face time with professors both in and outside of class. While this could have been potentially beneficial, professors seem to abuse the extra face time by openly discussing poor grades, resulting in poor academic morale in an already challenging undergraduate program.

 

I was very happy to see the gentleman taking notes of all our feedback. I hope he gets the chance to bring them up someday and truly make a difference for prospective students.

Structural Pattern Matching using Exceptions

Back in college when I was first exposed to functional languages, I fell in love with algebraic data types and structural pattern matching. Now that I have joined the work-force I no longer have the freedom to work with those languages. So I decided to give a shot at emulating structural pattern matching in Java.

If this concept is new to you here’s a short intro. Let’s say we want to represent binary trees. We know that a tree has three kinds of structures:

  • A node that can have a left branch and right branch
  • A leaf that has a value
  • An empty tree with no value or branches

In Haskell, we can group these three structures under a single data type:

image

Now, whenever we do any kind of operation on trees, we can use pattern matching to find out which of these three structures we are dealing with. For example, here is function that calculates the depth of a tree.

image

This recursive function, tests the structure of the tree and returns different values depending on the pattern that matched.

Now, all that is good. But how do we implement the same in an object oriented language that does not support algebraic data types or pattern matching. Well, the closest thing to algebraic data types in an OOP language like Java is a class. And to simulate pattern matching we will use a feature called polymorphism.

Here’s our first implementation:

image

Nothing fancy is going on in this code snippet. I declared an interface called Tree which defines a method signature called “depth”. There are three classes that implement this interface. And each class provides it’s own implementation of depth. With this setup, the master depth function is trivial:

image

With the help of polymorphism, at each step of the recursion, the right implementation of depth is going to be called based on the class.

So? What’s the problem?  Well, it was trivial to write, but it’s going to be a nightmare to maintain this setup. Let’s say, tomorrow we want to add a function to flatten a tree, or a function to do an in-order traversal. We would have to add the methods to the tree interface. And then we would need to add an implementation of these methods to each of the three classes. Doesn’t sound like a lot of work. But imagine if we were distributing these classes as a library and there were hundreds of other people using it. Each time we add a couple of utility methods to the Tree interface we would need to recompile all the classes and deploy a new version of the library, and ask hundreds of users to update to the latest version.

So, we will need to think of a different approach. One that does not require us to change the original classes. We need an approach that empowers the library user to write his own implementation of “depth” without any fuss.

The quick and dirty way would be to use the instanceof operator to perform pattern matching manually.

image

This version works, but it has its problems. By using the instanceof operator we are giving up all compile-time guarantees on whether we are doing our cast correctly. That means, if you make any mistake, you’ll only find that out only at runtime. Moreover, our previous approach used interfaces. So we were guaranteed to have an implementation of depth for each possible structure. In our new approach, there are no such guarantees. If the library user, forgot to check for a particular variant of the tree structure he wouldn’t get any compile time warning, just an exception at runtime.

We need a new approach. One that takes advantage of compile time checks and also forces us to exhaustively check for all possible structures. We can do that using Exceptions and Try-Catch blocks. Here’s our new implementation of Tree:

image

Here are the important differences:

  • Tree is not an interface anymore, it’s a concrete class
  • Tree extends Exception, so it can be thrown
  • Node, Leaf, and Empty are also exceptions, so they can also be thrown
  • The match method can throw an exception corresponding to each possible structure

With our new approach, here is our new depth function:

image

Since the match method of the Tree class exhaustively lists all possible structures as throwable Exceptions, the depth function will even not compile unless there is a catch block for each structure. As a result, you are getting both exhaustiveness and compile time checks at the same time. To be honest, this does not guarantee 100% exhaustiveness. The developer of the library has to make sure he throws an Exception for each possible sub-class of his algebraic type. But at least, in this approach, the burden of responsibility lies on the API side, not on the user. Therefore, if any future release of the library introduces a new structure, users won’t have to read the documentation, or discover it at runtime. They can just rely on the compiler to do the check for them and identify the affected methods.

There’s just one thing that makes this approach less than perfect. Unfortunately, our tree class cannot be generic. Because of the way generics are implemented in Java, sub-classes of Exception are not allowed to be generic.

If this is a deal breaker for you, check out this excellent blog post that describes another approach using the Functional Java library.