python

Base64 Encoding in Android 2.1 or Earlier

Base64 is common used. Now Google added a utility class android.util.Base64. Unfortunately it is only available in Android 2.2 and later.

So, you need just a little bit work to use it with Android 2.1 or ealier. Yes, just copy and past the source of Base64 into your project. Make sure to preserve the Apache 2.0 license section, in order to conform to the license. The source code is provided at the end of this post, for your reference.

My disclaimer: I am not responsible for any result in doing the practice described hereby. Read the license if you need.

Now let’s see example usage:

The output is:

Encoded: dGhpcyBpcyBhIG1lc3NhZ2UgYnkgZnJhbmsu

Decoded: this is a message by frank.

Let’s try decode the message in python:

You will get the same input message htere. Now you are ready to send your data to anywhere, like app engine, you know!


The android.util.Base64 source

Yahoo API & web services

Recently I am interested in Yahoo API and web services, especially inquirying finance data via the APIs.

Yahoo provides nice language support. For example, python is supported at

http://developer.yahoo.com/python/

At the bottom of the page, you can find a list of popular programming language, such as Java, .NET, Ruby, Javascript,  and so on.

Also at the bottom, there is a list of yahoo services, such as search, finance, weather, flicker….seems a lot of stuff to play with. :)