Talks

Satellite Feature Detection Using ConvNets

I presented my journery through a Kaggle Competition about detecting features from satellite imagery and various techniques to score a high rank using Convolutional Neural Networks.

20 Mar 2015 - Learn Data Science Meetup

Asynchronous Javascript

Asynchronous nature of Javascript is often misunderstood. I presented how Asynchronous Javascript works and compare using callbacks, promises, thunks and async/await.

01 Apr 2015 - UrtheCast

Angular JS Complex Form Validations

The native Angular JS validations cannot be used for more complicated validations. I discussed the pros and cons of Angular style form validations, how to move validation logic out of the views, and how to develop a more declarative style of validations in services.

17 Dec 2014 - Angular JS Meetup

Introduction to Web Development

Taught the basics of web development, HTML & CSS to undergraduate students at American University of Sharjah in a workshop.

15 Feb 2009 - American University of Sharjah

Projects

Unmanned Autonomous Aircraft

Led a multidisciplinary team of senior engineering students to designed and build an autonomous aircraft capable of searching for targets on the ground.

Worked on embedded systems, on-board camera, communication system, control system, path planning & ground control station.

See the presentation here that includes a flight video.

UAV Ground Control Station

Create a Ground Control Station for autonomous aircraft to display telemetry, plan and task mission plan and tune the control system parameters.

This later evolved into the Ground Control Station provided by MARS Robotics.

GPS & IMU Sensor Fusion

Performed research on combining GPS location with accelerometers and gyro data to get high accuracy position and velocity for use in a car collision avoidance system.

Results are published here

CFD Analysis of trailing cars

A computational fluid dynamics simulation to study the optimal distance for drafting(slipstreaming) vehicles.

Finite Element Analysis of a Trebuchet

Structural analysis simulation of a Trebuchet.

AUS Formula SAE

Volunteered to build a formula style race-car for FSAE. Worked on fabrication of A-arms and design of impact attenuation.

IM Sniffer

A packet sniffer that shows you all IM Traffic on your network

Shibshib

Arabic meme site

Venio

I was the founding employee of a nutrition planning web and mobile app. The startup was part of the Extreme Startups Accelerator (now Highline) program and reached 20+ employees at its peak.

Check out video here

Thoughts

Python Patterns

I have now been working with Python for more than a month, here are some of the interesting patterns that I found in the language. Its a nice, clean and easy language, in particular I really enjoy the list comprehensions.

##Lists

###Loop over a list

    for item in items:
        print item

###Loop over a dictionary

    for key, value in dictionaryname.items()

###Map with list comprehensions

    [func(item) for item in items]

###Map over list of lists

    [func(item) for list in lists for item in items]

###Filter list

    [item for item in items if wanted(item)]

###Conditions in list comprehensions

    #increase magnitude
    [item -1 if item < 0 else item + 1 for item in items]

##Modules

###Create a module

Create a folder with a blank file named init.py

###Import classes from modules

    from modulename import ClassName

###Relative import or modules

    from ..packagename import modulename

##Debugging

###Escape in to interpreter

    import code
    code.interact(local=locals())

##Benchmark

###Simple Benchmark

    from time import time
    t1 = time.time()
    function()
    t2 = time.time()
    print t2-t1

##Exceptions

###Raise an exception

    raise Exception("message")

Useful built-in types: ValueError, TypeError, ArithmeticError. Complete List

12 Oct 2013

Hackers and Painters Quotes

Some quotes I liked from Paul Graham’s book:

“Start by building something clean and simple, something you would want to use yourself”

“The best thing software can be is easy, but the way to do this is to get the defaults right, not to limit users choices.”

“The top 5% of programmers probably write 99% of the good software”

“Wealth is what people want”

12 Jan 2013

Startup Lessons Learned in a Year

Lessons learned from a year in entrepreneurship - A brief description of things I wish I had found out earlier and as well as reminders for myself for the future.

Ideas are not important

If you have a brilliant idea which you haven’t validated and created a prototype for, its worthless. If its a good idea, there are many people who have thought about it before. Most successful companies are not the first one trying out an idea - Google is not the first search engine, Heroku is not the first web applications host. Execution plays a great part. The idea actually becomes worth something when you have iterated over it several times, validated it and your business model is making revenue.

Your Startup is your team

As the idea doesn’t really matter, what matters is the team. Select the people in your team very carefully. Ideally you would want to start a company with someone you have known for a while and can fully trust. The team should be extremely capable, you do not want to work with mediocre people, at least in the beginning.

Validate before building

Validate that the problem you are trying to solve is actually a problem. Validate that the solution is actually monetizable. There are many companies working on products that are either not really significant enough problems for people to pay money. Ash Maurya explains how to do customer development very well in Running Lean.

Iterate

This concept has been repeated my many: solve the problem in the simplest way you can, get feedback, make small continuous improvements. Eric Ries explains why you should do this by taking the example of IMVU in The Lean Startup by .

Don’t neglect your health

Your health is more important than anything else. While hard work is very important, make sure you get enough sleep and exercise. Working extremely long hours and not getting any exercise is not sustainable in the long run.

Inbound marketing

Write a blog on topics that interest your users. Not only would this show your potential customers that you actually care about what you are doing (and you better do), it would also make you more visible in search engines. Read Inbound Marketing to learn more.

A/B testing and Cohort Analysis

Run data driven experiments and see what works and what does not. This is not just changing the color of the signup button when your product is ready and needs more traffic, AB test from the very beginning. Even when you are validating your idea, try out different ways to say what you business does(or might do in future). See how adding features changes your metrics.

Growth

Don’t spend money on marketing when the product is not ready. When you reach product-market fit, aim for a constant growth rate. You need to aim for a good conversion and retention rate before spending on acquisition.
Paul Graham has a great article on growth.

Types of Markets

Understanding what kind of market your startup is targeting is very important as it effects everything. It helps you better understand your customers, competition, how long it might take you to reach profitability.
Steve Blank explains Market Types in the second half of chapter 3 on his How to Build a Startup course on Udacity.

Trust your team

Make your whole team feel like they are a part of it. Ask them for their input, be transparent, make sure every one is as enthusiastic about the startup as you are. Get engineers to talk to customers. Curate ideas from everyone in the team instead of one person generating them.

Books over blogs

There are a lot of interesting blog posts about startups but it’s a waste of time to read too many of those. You can learn a lot more by reading a book on the topic. Books provide a more in depth analysis, on average are (usually) written by more experienced and accomplished people.

Focus on problem, not the solution

Its easy to get attached to the product you are working so hard on. But what you should really get attached to is the problem and continuously think of how to solve the problem better rather the how to make the product better.

I would love to hear your comments on this list. I am in no way an experienced entrepreneur and these are lessons I have learned from mingling with other startups, having been a founding member of Venio, going through the Extreme Startups program, listening to accomplished mentors and reading through reading. I hope people starting a high growth company can learn something from here.

09 Jan 2013

Minimalism

Ever since we are little the idea of more being better is instilled in our brains. The more toys or gadgets you have the happier you would feel, the more you speak the smarter you would sound, the higher grades you get the better, the more money you earn the more successful you are.

As time passes by, I have come to realize that this is not true. When I was in school, my father urged me and my siblings to buy few but good clothes and it made sense, but I only thought it applied only to clothing.

It wasn’t until I moved I realized that I have tons of useless things lying around. Things I though I might need one day kept safely in storage, belonging that I thought were memorable stored safely in my drawers. I spent a long time sorting through all these things, I threw away many, gave away some, and packed “important” items into a few boxes. The idea was that after spending two years abroad and I would return back. It made sense.

It has been 6 and a half years, I haven’t seen those boxes again. The only important thing that I can remember they had were my Taekwondo medals. I don’t know whether those boxes are still stored safely but when I visit Pakitan next time I might try to retrieve my medals.

I also had Rs. 2000 deposited in a bank account when I was little, 15 years ago it was a lot of money. I could have bought a really expensive toy with it, but everyone know’s you need to save and a bank account is the perfect place to store money. Now 15 years later that money is worthless, partly because of inflation, partly because its easy for me to get that much money now. For those who don’t have the context, earnings from interest are not allowed in Islam, but I bet even after interest, that money won’t be worth anywhere close to what it was worth to me back then. The idea was by saving I would have more but it didn’t work out.

I’m not saying that you should not plan long term, the thing these days is, there is so much new items and the context changes so fast, the old items lose their use for people very quickly because theres going to be a new thing that you are obsessed with. At university I kept the engineering books I liked, I thought I might use them when I go to grad school or might need to review some concepts at work, it would be faster to do those through books I am used to already. I was so wrong. After finishing my undergraduate studies, I decided to completely change the direction of my career. Even if I had needed these books, I could have easily found something similar at a good library.

I moved again a few times, each time getting rid of things, but only because I had to, not because I was trying to be minimal.

Recently, a I have seen many examples of things that are great but are minimal. Books that are concise, web layouts that only have the basics, companies that barely have the manpower they need. This is starting to shatter my idea of more is better.

I thought selling old used items was a waste, because if you buy them again, you’d have to pay more. It doesn’t work out financiallly. But there is a cost associated with owing things. You need phyical space, you use a lot of mental capacity of thinking about what I own and where is it, its harder to find what you do need. It might not be that bad if you want to live at one home throughout your life, but thats not the case for most these days, it can be pretty costly to move belonging, I feel its the best to not become too attached to too many of them.

Old unused items are like dead code in software, you have it written down somewhere, but it doesnt do anything. It just makes your program hard to understand and makes pieces of code you are looking for hard to find.

Now instead of thinking if I would ever need this item again, I think can I live without this? And if I discard this what is the cost of getting something with the same value again? This is important. If you cannot get something anywhere else for example pictures of you from childhood, the cost is high(or even infinite) if its a book you can order from Amazon or read at you local library, the cost is low. The other thing to consider is if there is a close substitute available. For example your new cell phone does the same things as your old phone and more, you do not gain anything extra just by keeping it, so you should sell your old phone. But if you do not have any pictures of your early childhood, you would really value the one if its the only one remaining.

Instead of cherishing belongings, I have learned to cherish experiences. I want to own the minimum number of things I can live with.

26 Dec 2012

Jekyll Tips

While there are a few ready made themes available for Jekyll, if you want you site to be different its not too hard. Here are some tips to make it easier.

Setting a custom URL

If you create a page called about.html and you want yoursite.com/about to point to this page, without the .html extention. All you need to do is put a permalink in the yaml front matter:

# about.html
---
title: About
permalink: about/
---

Custom post types

If you want to create sections on your site like Projects, Gallery, Notes, etc in a different list then your blog, you can set custom metadata for instance category in the yaml front matter and create a page that loops over all posts but only shows the ones you need.

	
<!-- projects.html -->
{% for page in site.pages %}
	{% if page.category == 'project' %}
    <a href="{{ page.url }}">
        <h3>{{ page.title }}</h3>
    </a>
	{% endif %}
{% endfor %}
	

This example shows pages, but it can be done with posts as well. You can even create subfolders in /_posts to make it easier to organize.

Truncating HTML content

Suppose you are listing all the posts on your blog index and want to truncate html, Jekyll will give you a parse error due to invalid html. TruncateHTML plugin comes to the rescue.

Discarding HTML tags

If you want to do the same as above but don’t care about html formatting in your content, and easier way to do this is

	
...
{{ post.content | strip_html | truncate: 140 }}
...
	

25 Dec 2012

Designing beautiful web applications

Here are a bunch of guidelines I think are important for creating a great user experience for your web users.

Design for audience

It is important to put yourself in the users shoes, and design something they would want to see. Design for tastes of the target market. Make sure that you fulfill some of the users’ top objectives for visiting your site without too much scrolling or too much clicking.

Word Density

Everyone seems busy these days. People typically skim over the content and then read word by word. Make sure that you limit the words the user sees per pixel. Where more details are required write a summary before the full text.

Element density

Users on the Internet are often presented with too much information at the same time websites are often too noisy. Users prefer clean and simple interfaces. Provide quality over quantity. Too much information can easily distract the user from figuring out which is the most important thing on a page.

Visual information

It is hard to read words: use icons, pictures, videos, charts and other visuals to support the text.

Ease of navigation

Minimize the number of mouse clicks, scrolls and page refreshes needed to access any information or options. For example instead of having a save button for saving settings, save settings as checkboxes are checked, and as textfields and dropdowns are changed, except for important actions like changing password or deleting something. In place text editing is way simpler then having an edit button which pops up a box where you have to click save after text input.

Typography

Use fonts that are easy to read. Avoid tiny fonts, while some people love them, other people have a really hard time reading them. Use Plenty of spacing. Font face reflects the personality of the website.

Colors

Make sure the colors you use reflect the sites targeted personality. While lots of colors make the site more playful on the other end of the horizon you can just use shades or black and white to create a very elegant website.

Gradients, shadows and 3D effects

If you are using any of these make sure they have a consistent light source. Imagine that the light is coming from top right for instance and create a combination of gradients, shadows and 3d effects based on that. Same goes for reflection and glossy effects. Human brain quickly recognizes if the light source defies the laws of physics. So if you try to mimic the real world by providing gradients, shadows and 3D elements, make sure they look believable.

Positioning

Positioning/layout should take into account the users psychology. Users typically view a webpage in an F shape, that may be true to a certain extent for your website.

Shapes

Try to use golden ratios where you have rectangles. Try playing around with some of your elements and see if they look better as circles and squares.

Conventions

Try to stick to conventions, but do not be afraid to break them if you find a more natural way for the user to interact. For example how Apple switched the scroll directions in the new Macs to make it more intuitive like iPads.

Flow

If it’s a web application, there are three different ways of changing displayed information. Full page refresh, overlay box and div refresh. Full page refreshes are the most conventional form and are useful to completely change the context. They should be used for static content pages and when the context completely changes, eg. perhaps when the user signs in and sees his dashboard. When in a single visit, a user is expected to change between views several times, either an overlay box or div refresh. While overlay boxes are very useful for hiding information not needed, over use of overlay boxes can be very distracting. For instance the new tweet form on Twitter is an overlay box which hides the input box which is not needed when viewing tweets but it is shown as soon as the new tweet button is clicked. If there are too many refreshes it is a better idea to use div refreshes.

02 Jun 2012

Homemade Indoor Helicopter

For a while I have been thinking about getting an indoor helicopter and modding it with an on board computer, camera, wifi to make it fly autonomously and do interesting things with it.

However, getting a prebuilt copter has its limitations. Such as

  • Helicopter not designed to handle the kind of payload you want
  • It being very hard to make modifications
  • In case of the helicopter being damaged it might be really expensive or impossible to repair

Thats why I want to create my own helicopter. I will admit it is not easy task, in fact even though I have a decent understanding of airplanes, many aspects of helicopters still bewilder me.

I came across an detailed account of how someone built a helicopter himself which is very inspiring, its the only such homebrew project I could find. To be honest I might have dropped the idea completely if I didn’t find this. Here’s a picture:

##Labs

Hence, I am on a quest to understand more about how they work and play with some of these. I should really get access to a hack space for this project. I like these two in Toronto:

##Things I would need

  • Airframe - This would be custom built but its a good idea to use parts from another helicopter that is popular
  • On board computer - Im thinking a Raspberry pi might be a good idea, other possibilities are Gumstix and Ardunio
  • Gyro & Accelerometer - I found a low-cost MEMS unit
  • Camera - IP camera might be too big for this, I dont like analog cameras, so need to do more research here.
  • Communication - I’d rather use wifi then using analog transmission. Ubiquiti Bullet is an interesting device that I have used before.
  • Ground Control Station - I already created a software for this at AUS, I can modify it according to my needs.
  • Books on the topic - Need to head to a good library (i.e. UofT)

##Timeframe This would probably take at least 2-3 years of spare time if not more, I’m already involved in a lot of stuff, but keep finding myself researching on miniature helicopters every now and then.

02 Apr 2012

Brainwave Reading

Ever since I watched a TED Talk, I forget which one, I have become fascinated by the possibilities of controlling things with thought and finding more about yourself.

I really want to get my hands on one the the brain reading headsets and maybe create an custom interface for my computer. It would be really cool to do even the simplest things like switching between windows. Think about terminal go to go to the last used terminal while programming, similarly switching to the code editor and webbrowser in itself would be really cool.

Here are two hardware products I came across that are available to consumers:

Mindwave looks less scary and is also a third the cost but Emotiv probably has better sensor.

02 Apr 2012

Jekyll vs. Wordpress

I have been using wordpress to host my website for more than 5 years, its a great platform. I like it because it comes with lots of nice themes, a good number of plugins, is open source and I can freely edit and modify how my site looks.

However, I just switched to Jekyll recently which is a static site generator. It doesn’t come with a huge array of features like Wordpress but quite the opposite, its simple.

The learning curve for jekyll is higher then wordpress but its easier to use my own theme written from scratch, I don’t have to use a database, its easier to write posts using a text editor. With my new little website in place, I feel like I am going to write more often. :)

Here are some tips on using Jekyll

04 Mar 2012

Rails upload files to AWS

There is a very easy way to upload files to AWS S3, however you can easily get lost with different gems and options available. My favorite way is using paperclip with aws-sdk. Here are some quick steps to get you started, look at the gems homepages for more information.

Gemfile

gem 'aws-sdk'
gem 'paperclip'

Then run bundler

bundle install

config/initializers/aws.rb

AWS.config({
  :access_key_id => 'REPLACE_WITH_ACCESS_KEY_ID',
  :secret_access_key => 'REPLACE_WITH_SECRET_ACCESS_KEY',
})

Example of what your model might look like:

class User < ActiveRecord::Base
  has_attached_file :photo,
    :storage => :s3,
    :bucket => 'mybucket',
    :s3_credentials => {
      :access_key_id => ENV['S3_KEY'],
      :secret_access_key => ENV['S3_SECRET']
    }
end

Migration:

class AddPhotoColumnsToUser < ActiveRecord::Migration
  def change
    change_table :users do |t|
      t.has_attached_file :photo
    end
  end
end

Note: has_attached_file does not seem to work with create_table

This is how to put it in your form

<%= form.file_field :avatar %>

You also need a create action in your controller. Assuming you used a scaffold, it should work just fine. Enjoy!

01 Mar 2012

Positioning variable number of fixed width divs side by side in a fluid layout

In recent months, I have been experimenting a lot with fluid width layouts. As we now have devices with a range of screen sizes, to create a good user experience across all different resolutions, I think fluid layouts are the way to move forward.

One of the things, I got stuck with was displaying a number of fixed width divs on a fluid layout such that each row has the maximum number of divs it can take. In my initial version, everything floated to the left, but i finally figured out how to center the divs.

Style:

#container {
    text-align: center;
}

.box {
    width: 300px;
    height: 300px;
    margin: 10px;
    background-color: #ccc;
    vertical-align: top;
    display: inline-block;
}

HTML:

<div id="container">
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
</div>

This is especially useful as lists are becoming more visual, for example each blog post having a picture associated with it.

18 Feb 2012

Too Much Noise

Over the last couple of months, I have realized that I have not been as productive as I would like to be. It’s not that I am spending less time at work, but it feels like there is too much distraction these days. I used to be able to do things more efficiently when I spent a couple of hours doing just one thing and having a deadline for it. Now it seems that when I am working on something, new things come up, I leave some things unfinished to come back to later on and ultimately there are a gazillion windows open on my computer at some point my computer starts lagging and I decide to close everything. To be more productive, I have come up with some solutions.

Cut down email time - I get tons of emails from lots of places and had made it a point to read them all, but now I cut down email time to just one hour in the morning, try to read as much of it as I can and get rid of the rest.

Do one thing at a time - Completely focus on just one thing at a time, put a deadline for yourself and try to meet it.

Divide tasks into subtasks - Its motivating to have things finished. If you just have a broader task listed on your todo list, it might be there for a couple of days, it feels nice to just put subtasks and see what you have completed at the end of the day.

22 Jan 2012

Tech Celebrities

I have been seeing a lot of posts about how everyone cared so much about Steve Jobs death and not Dennis Ritchie’s. Thats the sad reality of life, people appreciate business people more then engineers/hackers. Steve Jobs, Bill Gates and Mark Zukerburg are world renowned figure because people use products created by their companies first hand on a day to day basis.

Everyone uses so much code and ideas that were initiated by Dennis Ritchie, Linus Torvalds, Richard Stallman but are unaware of it. I dont even know the name of the guy who created Apache on which majority of the web runs. Even though these guys gave away whatever they created for free for everyone to use. I forgot the name of the engineer who invented the vacuum cleaner but I know the person who first started selling them was called Hoover.

Even in tech community, David H. Hansson is a legend in some circles but I bet 90 percent of software developers have never heard of him, without him the web would not have been so 2.0ish, we might not have had Twitter, scribd, 43Things, luminosity, github, etc.

Lesson: If you want to be well known, do something that everyday people use. Or if you dont care about fame(or money) that gives you the freedom to do whatever you think is worth doing.

07 Nov 2011

Amazing Programming Font

As stupid as it sounds, one of the reasons why I hate coding on Windows is because windows monospace fonts suck compared to what Linux has. I had windows ports of Gedit and Geany on my network folder but Windows fonts were just painful to look at.

After spending some time with Mac, I am setting up my programming environment on Linux box but I didnt like any of the monospace fonts installed by default. Searching on the internet, I eventually found a font I liked and it turns out its Mac’s monospace font called Monaco. Luckily, there is a way to get in working on Linux.

Its these little things that makes Mac so amazing.

21 Oct 2011

Higher level programming for embedded systems

I don’t have too much experience in this area, but I was thinking, it would be cool to have something more higher level for programming embedded systems. It would be cool if you could write Ruby code to program a robot. There are GUIs out there that allow kids to program robots but its not really as interesting as coding.

During my senior design project at AUS, we were using Simulink Realtime Toolkit to program our unmanned aircraft. And I must admit Simulink is really cool particularly for programming control systems, but it has its limitations. It was really painful to create and improve our communication stack. It would have been much easier to do in C, now the thing is you can embed C code in Simulink and we did, but you are forced to do something every time step like the rest of the Simulink blocks, it would be nice to be more procedural.

Something I also learnt during this project was that hardware programming is actually done on a much lower level than making computer applications. Take communication stacks for example, the packets are typically fixed length, with a byte for indicating packet type. Which is efficient but a TCP protocol, HTTP for example which uses a string to identify the packet is easier to work with for programmers. Now efficiency makes sense with expensive processors and low computational resources. But I think now is the right time for a Rails like revolution in Embedded systems.

With Ruby on Rails, webs applications can be created faster, they might not be as efficient as writing an application in Ruby from scratch. Webservers are not that expensive these days but web developers are. So it makes a lot of sense to use Rails. Also Rails makes web development more fun by using a Dont Repeat Yourself philosophy, programmers spend less time doing repetitive tasks and concentrate on the building part more. Ruby is platform independent, it would be great to see open source robotics code that can be run across platforms. Not to forget that Ruby itself is opensource and free, if you have to pay a lot of money to get a licence for proprietary software, its just going to slow things down.

I believe that the new generation is going to do great things. Some schools teach some robotics, many teach programming. The cost of computation is going down. We shouldn’t care too much about efficiency and just let people be creative without worrying to much about the details. We need a platform with automatic memory allocation and garbage collection, with opensource libraries which have an easy and consistent way to install, something like rubygems or python eggs. We need to follow convention over configuration. It would be nice if we have a PID controller class, a communication protocol class, debugging/controlling over an ssh terminal, easy way to interface with different kinds of hardware such as wifi, bluetooth, ethernet, servos, sensors, camera, etc.

Obviously it could not run on all hardware, but we need several different platforms to support this kind of system. I think an opensource Unix-based OS can be a good start to create something like this. We need to make configuration and installation of these systems as simple as possible. Also we need to have educational videos similar to railscasts.com on how various things can be done with it.

01 Oct 2011

more

© 2017. All rights reserved.