How to display image field inline in Drupal

Drupal is one of the greatest CMS right now. It is possible to build a site in minutes and a few days for customization without changing single line of existing codes. That means upgrading is painless. CCK is very powerful for customizing existing content types such as blog to have inline image per node using image field. However, default behavior is to display the image separately. It is not nice so I have to customize myself.

How to make menu by pure CSS

I was asked to find a solution for making a horizontal dropdown menu in HTML. I don't know how to do it but I'm sure it is possible especially in Firefox. After searching in Google, I found a good tutorial.

How to decode incorrect character encoding in e-mail using Python

Sometimes character encoding sent via e-mail are incorrect. The most often scenario is as follow.

  • Actual encoding is TIS-620.
  • Header indicates ISO-8859-1.
  • The e-mail reader displays contents in UTF-8.

As a result, it is very difficult to recover the failure. However, it is possible to solve this problem using Python.

How to set socket timeout in Python

BTQueue provides some functions regarding remote access, e.g., wget, wpost and scrape. Anyway, some urls are temporary or even permanent unavailable due to unpredictable reasons. It is necessary to set reasonable timeout for all operations including connect, send and receive.

How to join string professionally in Python

Python provides string module for manipulating given string efficiently including string.join. On the other hand, each string object has join method to act like the separator of given strings. However, I have just found another form of the join in in Python 2.5. For example, below codes are similar.

string.join(['a','b','c'],' ')
' '.join(['a','b','c'])

How to post HTTP request in Python

Once upon a time, I went to attend a conference. The organizer provided wifi access to all attendances which one has to login via web before using this free service. My problem was that I would like to use secure shell. I don't want to browse web. I don't need to start web browser just for logging in. So I wrote a simple and short python script to login automatically.