Our new Family member

Long time no see! Sorry to skip updates. I’ve been busy in the missing period. Well, what should I restart to write?

My wife gave birth to a baby boy, Kanata on May. Last month, we went to a Shinto shrine to pray for his healthy growth, which is called “Omiyamairi” in Japan. These are memorial photos from the photo shop ad.

June 9th was Google Developer Day 2009 in Japan. Of course I joined. Google excited developers of participants by giving away an Android phone each and unveiling Google Wave. After a while, Google gave us one more present. No sooner had Google sent an e-mail offering a Google Wave Developer Sandbox account than I signed up for it. Don’t be disappointed if you missed it. You can request it from Sandbox Access in Google Wave API.

Google Wave is a new innovative tool, which might rebuild our communication on the net. I’ve luckily happened to meet it and I am now greedy for mastering JavaScript and the language’s one of prospective library, jQuery. If you have an account of the developer sandbox, please visit the wave of my practice, “Wanna buy a Wave T-Shirt?” and click a button!

I wish I had more time to spare! But I still continue to be busy caring for children and doing chores as paternity for the time being…

Fix overflow:auto display in IE

If you want an overflow code snippet to be displayed correctly in IE, you must write some more css code to fix a vertical scrollbar bug.

As far as Byteflow concerned, simply add the following code to highlight.css.

* html pre code { /* for IE6 */
   overflow: visible;
   overflow-x: auto;
   overflow-y: hidden;
   padding-bottom: 15px;
}

*:first-child+html pre code { /* for IE7 */
   overflow: visible;
   overflow-x: auto;
   overflow-y: hidden;
   padding-bottom: 15px;
}

That’s it.

Please call me an idiot. It is still continued a bit more.

First, the following line is meaningless in this case.

   overflow: visible;

And second, It seems to me that IE6 can’t display horizontally overflowed code correctly whether above steps are added or not. One dirty solution imaginable for me is adding width property and I easily take this for the moment.

   width: 550px;

Since content width depends on the theme I chosen, these steps might have been added to theme’s css.

Alter tables to replace Byteflow

Recently, I replaced this site’s Byteflow with latest one. Unfortunately, the former version that I used was distributed last October. Since a couple of Models were modified last November, I had to alter database tables to update my Byteflow .

All I had to do is described in The Django Book, Chapter 5, “Making Changes to a Database Schema”.

First, I compared each create table command by running manage.py sqlall [each app] command on each version. As Byteflow dev site announces, Site link field and related index(es) were added to blog.Post and blogroll.Link model classes. After copying down the database for work , I altered these tables’ schema by running sql commands as follows. I’m using MySQL.

For blog.Post model’s table:

ALTER TABLE `blog_post` ADD `site_id` INT( 11 ) NOT NULL DEFAULT '1' AFTER `id` ;

Note that default value ‘1’ is my site id on my django_site table. I had to set it for existing records.

ALTER TABLE `blog_post` CHANGE `site_id` `site_id` INT( 11 ) NOT NULL ;

New record doesn’t need the default value. So I unset it just in case.

ALTER TABLE `blog_post` ADD UNIQUE `site_id` ( `site_id` , `slug` , `date` ) ;
ALTER TABLE `blog_post` ADD INDEX `blog_post_site_id` ( `site_id` ) ;

For blogroll.Link model’s table:

ALTER TABLE `blogroll_link` ADD `site_id` INT( 11 ) NOT NULL DEFAULT '1' AFTER `user_id` ;
ALTER TABLE `blogroll_link` CHANGE `site_id` `site_id` INT( 11 ) NOT NULL ;
ALTER TABLE `blogroll_link` ADD INDEX `blogroll_link_site_id` ( `site_id` ) ;

In reality, I used phpMyAdmin instead of typing commands. Finally, I ran manage.py syncdb command to synchronize models with tables.

At the moment, it seems to me that everything is all right and I’m very comfortable.

Dive Into Python

Since I am a professional C/C++ programmer, which only means my profession, I can read Python code and modify some trivial changes, even though I don’t know much of Python. But when I want to write new functions, which are not lying in front of my sight, I have no idea how I can write them from scratch and where I can get related information directly. Definitely, I must practice Python in fundamentals first and make my programs streamlined, avoiding waste of time and vulnerable steps.

Luckily, there is Dive Into Python, an online book we can read on the net and on desktop free of charge. It’s great! It’s relatively concise without lengthy explanation and full of interesting suggestions through intuitive examples. How fantastic is that its sentences are easy for programmers who speaks English as a second language, like me. (But I know a book that readers can read easily is difficult to write. It’s a kind of Columbus’ egg.)

Unfortunately, some of URLs in examples are missing, especially the ones on Chapter 12, SOAP Web Services. The temperature function on http://www.xmethods.net/ has disappeared already. Moreover, Google Web Services are no longer available to, at least, new developers, replaced with AJAX Search API implemented by JavaScript literally. So I practiced those examples with Amazon SOAP infrastructure likewise.

>>> from SOAPpy import WSDL
>>> server = WSDL.Proxy('http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl')
>>> results = server.ItemSearch(SubscriptionId="YOUR_ACCESS_KEY_ID", AssociateTag="YOUR_ASSOCIATE_ID", SearchIndex="Music", Keywords="Beatles")
>>> for item in results.Items.Item:
        print item.ItemAttributes.Title
        
The Beatles (The White Album)
Abbey Road
Sgt. Pepper's Lonely Hearts Club Band
Across The Universe [Deluxe Edition]
The Beatles 1
Rubber Soul
Revolver [UK]
A Hard Day's Night
Magical Mystery Tour
Let It Be
>>>

You can get Access Key ID from Amazon Web Services after you sign up. You can also get Associate ID from each locale’s Associates Center, e.g. https://affiliate-program.amazon.com/ for US program, but you can simply use “ws” anonymously. Note that WSDL documents are available by version and by locale. The following list shows each locale’s WSDL URL for the Version 2008-08-19. You can get the latest version’s WSDL without version subdirectory string from its path.

US: http://ecs.amazonaws.com/AWSECommerceService/2008-08-19/AWSECommerceService.wsdl
UK: http://ecs.amazonaws.com/AWSECommerceService/2008-08-19/UK/AWSECommerceService.wsdl
DE: http://ecs.amazonaws.com/AWSECommerceService/2008-08-19/DE/AWSECommerceService.wsdl
JP: http://ecs.amazonaws.com/AWSECommerceService/2008-08-19/JP/AWSECommerceService.wsdl
FR: http://ecs.amazonaws.com/AWSECommerceService/2008-08-19/FR/AWSECommerceService.wsdl
CA: http://ecs.amazonaws.com/AWSECommerceService/2008-08-19/CA/AWSECommerceService.wsdl

I suppose SOAPpy, a Python SOAP module introduced in this book, is also outdated already. There is Zolera SOAP Infrastructure, or ZSI module supported by the same project primarily now. So I’m going to learn more yet about ZSI and its bundled tool wsdl2py. To be honest, I’m using pyAWS for my Amazon Plugin now. But I’ll consider replacing it with one of the SOAP modules and adding more functionality to the plugin, after going through the SOAP modules thoroughly.

New Year’s Resolution

As I turned well into forty, I’ve become aware that I will never use English before I have one foot in the grave. In fact, writing (speaking) in foreign language is very stressful because I can’t say exactly what I want to say. But people peeking my site are probably programmers, and our common language is programming language(s). Right? I believe you’ll get the points from my articles, whatever I write them in English.

Anyway, I’ve made up my mind to write my blog in English. Since I know my writing is lousy prose with grammatical errors, I am grateful if someone, of course you!!!, suggest to me how to improve my writing in English.