Folow Osama Khan on Quora 

250days until
resolution time completes!



Blaagers !

Blog

Orion Nebula - Distance from Earth: 1300 light years (Image by Panoramic Universe Pictures)

On this blog I write about: technology with focus around novel solutions for everyday problems, artificial intelligence/expert systems/computational intelligence/robotics, open source ideology, my life experiences, crazy wacky ideas I come up with and about projects/code-snippets I work on ...


Calling all Pythonistas in Pakistan ...

posted Feb 18, 2012 7:45 AM by Osama Khan   [ updated Feb 18, 2012 7:46 AM ]



import urllib

#enter True/False for the variables below after the '=' sign

pakistani = 
python_lover = 
python_powered_startup = 
wanna_learn_python = 

if (pakistani and (python_lover or python_powered_startup or wanna_learn_python)):

    print """
            You should join us! 
            Visit http://www.python.org.pk today. 
            Or wait we'll load the page source for you to hack ...
          """
    f = urllib.urlopen("http://www.python.org.pk/")
    print f.read()

elif ((not pakistani) and (python_lover or python_powered_startup or wanna_learn_python)):

    print 'Go join your local Python user group.'

else:

    print """
          Only those men are successful who can speak
          the language of God, the language of men and 
          the language of machine.
          """

Simply put, if you reside in any of the major cities of Pakistan, Karachi, Lahore or Islamabad and you want to learn Python or already code in Python or have a startup product based on Python, come join us. 
For more details visit http://www.python.org.pk

iPhone Magic!

posted Feb 7, 2012 11:01 AM by Osama Khan   [ updated Feb 7, 2012 11:04 AM ]



So yes, I have never really been a big fan of touch phones. Call me sad but I thought the iPhone was a fancy toy with very few productive applications for developers.

But right now while my wife was asleep, I picked her iPhone 4 up and installed Teamviewer Pro on the sleek white thing. Installed the same on my Ubuntu laptop which I use for development.

In three minutes I had this magical thing ready where I could access my development notebook from anywhere and write my code  as if I was sending out text messages. The VPS remote app lets me work around my servers on VPS.net and that is all I need for my web-dev work!

The 'keyboard box case' add-on to the iPhone might take my hate of touch screens away.
But now I have found a reason to buy an iPhone.

Blogging like a hacker ...

posted Jun 20, 2011 4:52 AM by Osama Khan   [ updated Jun 20, 2011 6:25 AM ]

Image found in a Google Search.

I have been one of those people who want to blog, set it all up and then after a few posts are just not able to take it all the way. I used to get distracted with all the plugins and the updates to the various famous blogging platforms out there. They are excellent applications and really powerful at what they do but for a person like me its really hard to focus on the writing and take care of all the cosmetic issues like taking care of templates, categories, tags and plugins. I am not trying to make money from my blog and neither am I trying to be the first link on search engines. I just blog to express my ideas as writing really helps me polish them. I am honored if people subscribe to my feed, find it useful or comment and share my posts. Hackers tend to be similar people. They just keep it simple. They don't load memory+cpu intensive but only visually  appealing IDEs. Instead they prefer robustness and stability of the environment they are working in. They focus on the ease of use.

I think I have overcome the hurdle of complex setups. I shall just be posting my blog posts here with some consistency. I will just be pressing a button and write the post with its title. I have also made a small desktop app on Python which is a rich text editor but connects to Google Sites and posts my new posts for me so that I don't even have to open a browser or log into my Google Account :)

In Zen teachings it is said:

A wise man makes his own decisions, an ignorant man follows the public opinion.

Best.
Osama

'Advice from an old programmer'

posted Jun 20, 2011 4:36 AM by Osama Khan

Towards the end this well written book "Learn Python the Hard Way", the author has written a small passage titled: "Advice from an old programmer". It seems to be the perfect set which every programmer should really read.
The passage goes something like this:

You have finished this book and have decided to continue with programming. Maybe it will be a career for you, or maybe it will be a hobby. You will need some advice to make sure you continue on the right path, and get the most enjoyment out of your newly chosen hobby.

I have been programming for a very long time. So long that it is incredibly boring to me. At the time that I wrote this book I knew about 20 programming languages and could learn new ones in about a day to a week depending on how weird they were. Eventually though this just became boring and couldn't hold my interest anymore. This doesn't mean I think programming is boring, or that you will think it's boring, only that I find it uninteresting at this point in my journey.

What I discovered after this journey of learning is that the languages did not matter, it's what you do with them. Actually, I always knew that, but I'd get distracted by the languages and forget it periodically. Now I never forget it, and neither should you.

Which programming language you learn and use does not matter. Do not get sucked into the religion surrounding programming languages as that will only blind you to their true purpose of being your tool for doing interesting things.

Programming as an intellectual activity is the only art form that allows you to create interactive art. You can create projects that other people can play with, and you can talk to them indirectly. No other art form is quite this interactive. Movies flow to the audience in one direction. Paintings do not move. Code goes both ways.

Programming as a profession is only moderately interesting. It can be a good job, but if you want to make about the same money and be happier, you could actually just go run a fast food joint. You are much better off using code as your secret weapon in another profession.

People who can code in the world of technology companies are a dime a dozen and get no respect. People who can code in biology, medicine, government, sociology, physics, history, and mathematics are respected and can do amazing things to advance those disciplines.

Of course, all of this advice is pointless. If you liked learning to write software with this book, you should try to use it to improve your life any way you can. Go out and explore this weird wonderful new intellectual pursuit that barely anyone in the last 50 years has been able to explore. Might as well enjoy it while you can.

Finally, I will say that learning to create software changes you and makes you different. Not better or worse, just different. You may find that people treat you harshly because you can create software, maybe using words like "nerd". Maybe you will find that because you can dissect their logic that they hate arguing with you. You may even find that simply knowing how a computer works makes you annoying and weird to them.

To this I have one just piece of advice: they can go to hell. The world needs more weird people who know how things work and who love to figure it all out. When they treat you like this, just remember that this is your journey, not theirs. Being different is not a crime, and people who tell you it is are just jealous that you have picked up a skill they never in their wildest dreams could acquire.

You can code. They cannot. That is pretty damn cool.


You can read the same passage on the book's website.

The Zen of Python

posted Jun 20, 2011 4:31 AM by Osama Khan

The Zen of Python is a great piece written by Tim Peters which fully covers the spirit behind the awfully simple yet powerful language.
Just open your terminal and shoot the Python command line and type the following to read it:

import this

The AWESOME AWESOME Google Apps

posted Mar 27, 2011 12:11 PM by Osama Khan   [ updated Mar 27, 2011 12:28 PM ]

Google Apps aren't new. We have all been using Gmail and Google Docs for some years now. Its just that the Google Apps suite has evolved so exponentially with great mutations and crossovers that it has forced me to fully shift my domain to Google Sites. I always wanted a simple site where I didn't have to code a single line and just change stuff on the fly. Well, here it is. Thanks to Google Apps I have this site and it is WYSIWYG by ALL means! I have not coded a single line and have made this site in two hours!

For more serious projects I shall be using a mix of either Django/Web2Py and Google Apps Engine or a dedicated Linux box. The best part about all this is that its all free! To find out how, click here.
  
So now I have my site and blog hosted on Google's servers and the best part is that I just pay $10/year which is my domain registration cost :)

Just today I landed on this video about the suite, showing how amazing these tools are:


Heading back to fixing the rest of the pages :)

Best.
Osama

>>>print "Hello World"

posted Mar 27, 2011 10:45 AM by Osama Khan   [ updated Mar 27, 2011 12:22 PM ]

Comic by XKCD

After joining an MBA program, going away from extreme algorithmic coding and dwelling into fast-paced still less technologically challenging small web application development role, I would confess coming back coding algorithms did seem difficult. I do not mean to undermine web development as a discipline but in my point of view, coding PHP front-end with all the jquery+ajax magic with a MySQL backend is not really challenging after sometime. Or maybe its something that I don't really enjoy or do that good. So I decided to stick to my competencies: algorithmic analyses and development. This post I read recently affirms my decision which I took a few months back.

After having worked with C#, Java, VB, C/C++, PHP, and then Assembly Language for the 8080 and 8051, I now wanted to pick on a language that really covered my ass for all sorts of projects and had its foundations in open source. I had already shifted to Ubuntu Linux as my core operating system and totally ditched all other proprietary software. I kept reading and looking around. Obvious list of languages to choose from was:  ["java" , "c++" , "ruby" , "python"]

I have somehow always found Java to be that beast who was hidden inside the body of a seductive girl. Java was the old monster we had been taught in our undergrad as our first ever language. As soon as I noticed that cin in C++ or Console.Read() in C# could do the same that would require more than a line of code in Java, I was sure its not the best language to be on. Since that day my adventure across these various languages had started. I was not really keen on getting lured back into the same trap set by the beast. Plus the fact that Oracle had recently taken over Sun Microsystems, I was sure such an acquisition would lead to a lot of tampering in the openness of Java.

C++, well the pointers always scared me. But after my O/S course, they were not a problem anymore. But then cross compiling across platforms and all that MAKE and ANSI vs GNU C++ was not very inviting. I wanted to work on a language that not only helped me make good algos but also helped me deploy them over networks or the Internet as a matter of fact. Honestly, I just wanted to learn what these Dynamic Languages were. For years I had heard about the greatness of Python and Ruby. I really wanted to be sure that if I adopt any one of these "newer" languages I was not going towards a dead end.

Ruby seemed very attractive due to all the fuss around Ruby On Rails(RoR) and its great success online. But I was somehow not convinced when I dug deeper, Ruby was still a SLOW language. Not slow in execution time, but I noticed that all the fuss was ONLY centered to RoR and not the core language. It lacked libraries and had a relatively smaller community.

Then came the snake, Python. I had explored it earlier in my undergrad years. I should say I was a pretty crap coder back then. Crappier than now. Imagine... Somehow the simplicity confused me. But I had heard and seen that all advanced research in Computer Science was being done though algorithms coded in Python. I kept looking into it to convince myself that the juice will be worth the squeeze.

Certain facts were amazing:

  • Industrial Light & Magic the company that did the effects for the Transformers movie uses Python for all the cool effects!
  • Google's search bot/spider is based on Python and C++.
  • Google, Facebook and several other technology companies se Python knowledge as a plus on their careers page.
  • NASA uses Python for various tasks.
  • It can run on multiple platforms: Mac+Windows+*nix
  • It can run on multiple platforms: Symbian+Android
  • It supports all sorts of DBMS: MySQL+SQLServer+Postgre+Oracle+OOPDB+DB2
  • It can be used on microprocessors without an O/S
  • It has all sorts of libraries for everything in science including: Artificial Intelligence, Computer Vision, Statistical Analysis, Mathematics, Robotics, Bioinformatics, Network Analyses, Distributed Computing
  • It trusted the programmer as reflected in its method protection mechanism
  • It can be easily used a web scripting language through the CGI but also has various frameworks like Django which are based on the MVC principle.
  • It can be used to make apps for the Google Apps Engine.
  • It can run, infact relies on many C++ libraries for its kick-ass features.
  • It has a huge community around it.
  • Games like Civilization are built on it, Blender supported game development with Python as its scripting language and Pygame was a neat and simple library which helped you make awesome games on Python.
  • Paul Graham advocates it as seen in this post.

I am not sure if these were the only points which made me choose Python. I am still in the process of learning various things in Python which I am sure won't end but yes having the right tools can help you be not only more productive but also be all prepared for the big occasion when a great idea lands in your head and you are to implement it to make the next Facebook.

Python: Getting Started

posted Mar 27, 2011 10:40 AM by Osama Khan   [ updated Mar 27, 2011 12:22 PM ]

Python I think is the easiest programming language to start with. Other languages like Java/C# have a "Hello World!" program spanning several lines something like this:

public class HelloWorld{
    public static void main(String [] args){
        System.out.println("Hello World!");
    }
}

Here is how it looks like on Python:

print "Hello World!"

As soon you open IDLE the GUI to the Python, you get a ready to go calculator and shell where you can write and execute code. Python is a relatively easier language to start with and there are many online sources where you can learn all the introductory topics:
  1. The Python Tutorial - This is found on the official website for Python. Its a great place to start. It talks about each programming language construct and various features of Python in detail section by section using example code.
  2. Dive into Python - If you have programming experience of some other language and are moving to Python, this resource is the right place to start. The book is also available for download in various formats.
  3. Google's Python Class - Google has continuously supported Python. This two day lecture series is a great place to jump start with the basics of Python. It has both text and video lectures with sample code.
  4. TheNewBoston's Video Tutorials - The New Boston has compiled a complete set of screencasts which walk through all the constructs and features of Python episode by episode.

Despite these free online resources, several books are available on the topic. One that I like is: Beginning Python: From Novice to Professional, Second Edition. This book which covers all the introductory and some advanced topics with relevant examples and projects.


1-8 of 8