Python Learning Journal (Part II - Preparing for Mechanize)

0 comments

To get familiar with Python syntax, I'll start with a play-around with web crawler scripts. I'll be using Mechanize, a supposedly stateful programmatic web browsing module. For introduction, I'll try to write a script to list out recent torrents from thepiratebay.org/recent. And later I'll proceed with a script to retrieve and then summarize flight tickets price from www.airasia.com. Input parameters would be date range, origin city, and destination city. Then the script shall print out a table consists of date, time, and price. And then it will list out additional fees and taxes that will be applied upon payment.


Mechanize Installation

There is one thing I like about python, it's that everything comes with a general installation script:
python setup.py install


Unlike Java, you need to mess around with path, classpath, and jar files.
So, to install Mechanize, it's as simple as downloading the archive, and then unpack followed by running the command with sudo.


Editor

For editor, I'm using Eclipse with PyDev plugin.
To install this Plugin, simply go to Help | Install New Software, and then setup new site: http://pydev.org/updates.
Later, just go to Preference and setup this section: "Interpreter - Python".


Reference

For me, code convention is very important. And thus, here is the general convention of Python - PEP 8.
Let me summarize here things that are new to me:
  • For indentation use 4 spaces, not tab
  • No space before and after = to indicate a keyword argument or default parameter
  • For package and module name use lowercase no underscore
  • For class name use CamelCase
  • For internal class name use CamelCase and one leading underscore
  • Exception name should have the suffix "Error"
  • Function/method/instance variables names use underscored lowercase
  • Non-public method/instance variables names use underscored lowercase and one leading underscore
Below are some basic readings to do:

Glomelurus.com: Short Story about Custom Domain Name

2 comments

I have finally subscribed a domain for this blog, triggered by an ads-tweet from my ex-colleague about hosting and domain name.

First name came to mind is momotaro.com. I have been naming almost all of my computers I've ever used with this name. And then the domain has been taken (of course), since it's a hero name of a very famous Japanese classic story. But actually they are giving it up (not sure why because I can't read Japanese). So this name is actually available for auction. But I don't think I need a domain name that special for just these simple writings.

img source: http://www.jimstanis.com
And then second name came to mind is momokun.com, and still this name is taken, for some kind of kindergarten website, I guess? And they messed up the encoding style, all those Japanese characters are displayed with ISO-8859-1.

And voila, glomelurus.com is available. This name is special for me, because I was having a lot of troubles in remembering body parts name in Biology lesson more than a decade back. And until yesterday, I never realized that all this time I've been misspelling this kidney's component.


Glomelur.us has also came to mind but due to pricing, I've also given up this one. Since ".com" is the most common suffix for domains, it shouldn't be that bad I supposed.

Python Learning Journal (Part I - Foreword)

0 comments

Learning from past experiences and evidences, there is always a death point for everything when it comes to technology, especially IT. So it is always a good thing to try out something different, prepare yourself for that one day when you need to make that changes.

I have been sticking myself to Java for at least 4 years (I started as a Delphi fans - the legendarily popular desktop programming language). At that time, Java was just starting to get popular with its runtime version 1.5.0.

The problem with Java is that you need to type a lot, java codes, XML, XSD, properties file and everything. However this problem can be overcame by varieties of sophisticated tools and IDE. And then the hosting cost for a Java web application, is not cheap. You'll at least need a dedicated server. There is no way you can host it shared with another applications.

Not to mention when you code for a desktop application, there is hardly any good and productive desktop UI library you can rely on. The only thing that is robust enough IMHO is SWT (The Standard Widget Toolkit) from Eclipse foundation, which consumes a lot of memory and is very very slow (needs references).

I am not saying that Java is bad, or going to be outdated soon. Actually Java is really good for an enterprise solution. But I think it is a requirement to explore something contrastingly different (a dynamic language) than the thing you do everyday, once in a while. And ironically Python is not even something new, should I pick another language instead?

Sexism in IT Career

0 comments

It has never come to my mind to write this blog entry until I saw a Python workshop advertisement which is "specially designed" for ladies. I don't know if it represents sexism, but the first thing that passed in my mind is: why would women need a specially design workshop in the first place?

Is it based on the assumption that women don't excel men in logic, that is why they need a separate workshop, so that they can learn programming with a slower pace to prevent slowing down the other members (which will happen in a unisex workshop) ?

You can say, "no, this is not it". Then why is it categorized based on gender and not based on the skill level of the candidates?

Catholic educates boys and girls separately, which I don't know why because I'm not a Catholic. But I believe that the reason behind it is not because of smartness differentiation between boys and girls.

In my humble opinion, women and men have the same opportunities to understand complex algorithm and how to work with programming language. There is no correlation between gender and ability when it comes to logic. This kind of gender specialized workshop has just proved that there has been some unprofessional gender prejudices happening in the community (which is sad), perhaps as a result of society belief.

What do you think? Do you see or experience any similar discrimination incident ongoing in your workplace?


Update per 03 August 2011

After asking for a number of trusted friends' opinions, it turns out that I had been acting too subjective upon posting this entry. Whatever the reason is, claiming something to be sexist is so judgmental and it's inappropriate. I apologize for that I've written this entry, I admit that it was subjective and personal.