Skip to content

CS101 with Udacity

I apologize for the lack of posts lately, a lot of things have been going on that kept me from blogging.

I have been following the CS101 course on Udacity, and it’s been great so far.

It teaches the fundamentals of computer science using Python, my favorite language.

I’m three weeks into the course, and I can say without a doubt that the course is far better than those offered by Stanford, at least they managed to get the courses started.

The homework given is challenging, but not too challenging so far.

I recommend you check it out, I’m sure you’ll find something that interests you, they currently have only two courses, but three other courses will be starting in April.

In other news, I’m also enrolled in Stanford’s Algorithms class and I don’t think I can handle it, the course is somewhat dry and the videos are too lengthy.

A 17 minute introduction video is just too much.

However, if you find Udacity’s offerings too easy, or even uninteresting, I encourage you to try Stanford’s classes, I think they’re aimed at people with more Computer Science knowledge than myself.

I’m also working on a little project using Python.


My app on the Android market

Months ago, I published a small app on the Android market, it’s called “Height Converter”.

What the app does is that it takes a length, in metric units, and converts it to imperial, and vice versa.

It works on any device running Android 1.6 and up.

I have only tested it on 1.6, 2.2 and 2.3, but it should work on any version of Android as it does not use any special API.

It requires two permissions, both related to internet connectivity, and those are only for displaying ads.

You can find the app here.


Recently, I started writing a twitter app for Android, nothing big,  just something to practice making apps with.

That requires some knowledge with OAuth, which twitter, among other websites, uses for authentication.

What differentiates OAuth from the regular path of authentication – using a username and a password – is that the app does not have access to your login credentials, which is good, security-wise, at least.

After a lot of reading, getting lost, reading some more, I managed to understand a little about how OAuth works, it goes something like this:

There’s a protected resource, which is the client data you want access to.

To gain access to this data, you need to be authorized by the user to access such data.

You will need to register with the website to get a “Consumer key” and a “Consumer secret”, those should be kept secret as they identify your application.

This is achieved by obtaining an “Access Token”, this token is a long string that can be saved for later access.

This access token is obtained by using a “Request Token”, those can be obtained by requesting one from the website that currently has the data you’re after.

Once you have a request token, you have two paths of authentication :

  1. Out-of-band (OOB) Authentication
  2. Using a verifier

In the first path, you use your request token to get a PIN code, it’s a series of numbers, the user has to copy these numbers and enter them in the application to authorize it.

The second path, which is more common, involves using a string of characters and numbers instead of a PIN code, which is appended to a callback URL specified by the application owner, usually to be extracted by the developer to complete authentication.

You can also read more about OAuth on hueniverse.

Note that some of the information above might be twitter specific, twitter implements the OAuth 1.0a standard, a new standard, OAuth 2.0 is available and in use by Facebook.

Android app development

Sorry for the long hiatus, but I was really focused on Android these past couple of months, so I had nothing useful to write about.

I do now, so here it is.

I started with the Android developers website.

While it’s really good, and you’ll still spend a lot of time reading the content there, it’s not really beginner-friendly.

The tutorials there aren’t sufficient for most tasks, I had problems with the Notepad tutorial, but I’d still recommend it to absolute beginners, it has a lot of good tips here and there.

But the most important thing on the website is the Dev guide, specially the first two articles, What is Android? and Application fundamentals.

While the first article isn’t that different than what you might read elsewhere, I suggest reading it anyway.

The second article is a must-read for everyone starting out with Android, it describes basic concepts like where the application fits in the system, and how it interacts with it.

It also discusses the basic elements of every app, like the manifest file,  Activities, Intents, Broadcast receivers, and Content providers.

Then I found the official docs to be somewhat lacking, they do discuss a lot of important topics, but not everything about Android.

I decided to look for tutorials elsewhere, specially those aimed at absolute beginners.

A friend referred me to the Android app development series from, they were also good, but they don’t go into much detail, they just tend to tell you how something is done, but not why it’s done that way, or if there’s another way to do the same thing the author is doing in the tutorial.

I decided to get a book, I chose Beginning Android application development, it’s around 450 pages, which means that it’s not comprehensive.

Although it doesn’t cover everything, but it’s really good for beginners, as it discusses most needed when developing Android apps.

I also found the SDK samples to be very useful, specially when coding a custom ListView.

The bottom line is, when learning a new framework, it’s best if you don’t rely on a single resource, even if comprehensive.

I wrote an article about getting started with Android app development, you’ll find it here.

Programmer Competency Matrix

I’ve stumbled upon this page a few months ago, and I really liked it.

I’ll admit that it’s not the only measure of how competent a programmer really is, but it provides some good advice on how to get better at learning different aspects of software development.

It measures a programmer based on his familiarity with computer science concepts, software engineering, programming, and experience.

You can find it here.

Learning Python

I recently started learning Python again, as I’ve had interest in it in the past, but stopped for some reason I don’t really remember.

I don’t follow a single source, I make use of videos, books, and random googling for answers.

I was following the MIT course I mentioned in an earlier post, Google’s Python class, and two books, “A Byte of Python“, and “Dive into Python“.

And here’s some of the things I learned:

Why this code doesn’t work in python

x = 11
print(x += 5)

While this does

x = 11
x += 5

The good people over at Stack Overflow answered this question, you’ll find the answer for this question here.

I also learned slicing, which works for strings, tuples and lists as far as I know.

A cool trick which can be done with slicing is quickly reversing a string :

s[ : :-1]    #assuming that s is a string.

Another feature in Python is the “in” operator, it checks data structures for a given element.

In Java, if you wanted to find an element, you had to use one of the binarySearch methods, or iterate over the elements of the collection and check manually.

The last thing I remember is copying and clearing a list.

list = [ 3, 5, 9]

another_list = l[:] #This creates a copy of the list, rather than another reference to the same list.

another_list[:] = [] #This clears all elements from the current list.

del list[:] #This also deletes all elements from a list.

I’m considering doing some exercises to familiarize myself further with the language, I’m thinking of using CodingBat or something similar.

I also read a little about Android development, and I think I’m getting the hang of it, even though I don’t really like dealing with XML files at all.

Reading “The Pragmatic Programmer”

I’m currently reading this book

And it’s been very good so far, it has a lot of good advice for working programmers.

It’s not suited for beginners who want to learn a programming language, but it has advice on programming philosophy, and how to handle some situations programmers usually face in the workplace.

It’s not very large (352 pages), which also makes it a good choice for someone who wants a quick read with a wealth of new information.