Friday, February 27, 2009

Jah! Das ist gut!

Pyshell? no Pyshell!

pyshell> z = 5 # regular python statements
pyshell> print 'z = %s' % z
z = 5

pyshell> echo "the value of z is: %z" # pyshell statements
the value of z is: 5
pyshell> po.sym_expansion = '$'
pyshell> echo "the value of z is: %z" # no worky
the value of z is: %z
pyshell> echo "the value of z is: $z" # Jah! Das ist gut!
the value of z is: 5
pyshell> echo %{SHELL} # Expanding an environment var
/bin/bash # Doh!

Just like C Shell is a shell with C like grammar, Pyshell is a shell with Python grammer.
Looks good but I just found it on the net, I don't know if it's matured.

Thursday, February 26, 2009

Python one-liner

"How to make oneliner in Python?" NISHIO HIROKAZU's Blog

Saturday, February 21, 2009

Wednesday, February 18, 2009

Various ways to have data in a file

1) Simple text file using open()
pros: Anybody can do it
cons: Not Pythonic
2) Write data as a Python script, import it to read
pros: Pythonic, flexible
cons: .pyc file may cause problem on some occasion. The user needs to know at least basic Python script.
3) XML
pros: Any programming language has XML parsers. Python has one in the std modules.
cons: XML is Ugly.
pros: Much more human eyes friendly than XML.
cons: Not yet well known, not in the std modules in Python, maybe 2) is enough?
5) pickle
pros: Good for storing Python generated data, std module.
cons: None
6) shelf
pros: Good for storing key-value data, std module.
cons: Somehow it doesn't seem useful to me.
7) sqlite3
pros: Can be used as a simple database, std module (Python version >=2.5).
cons: Need to know SQL (A friend of mine recommends sqlalchemy but I haven't used it yet)
8) zodb
pros: Support redo/undo, Object database (reconstruct references).
cons: Not in the std modules, Not good for very frequent write accesses (slow).
pros: Same as YAML.
cons: Same as YAML.

What else?

Friday, February 13, 2009

Happy 1234567890

| o |---|
|o o | |
| o |---|
| o o |

Monday, February 9, 2009


Paco is a nice tool when you cannot depend software install on yum, aptitude, etc. It records what a 'make install' creates (files, dirs, sym links...). You can use it like

$ ./configure
$ make
$ sudo paco -D make install

If you want to uninstall it, you can delete all the files with a single command. You can use gui (called gpaco) as well if you like it. It doesn't see application dependencies (but Windows installer doesn't see it as well, does it?). I use this when I source bould a software. A friend of mine told me that he didn't need this because he installs everything in /usr/local/ but started feeling like using it after I told him that we don't install everything in /usr/local/, e.g. device drivers. Some applications create preference file/dir(s) in the home directory. You'll have no chance of making a garvage when you uninstall an application using this utility. Internally it uses LD_PRELOAD and hooks system calls.

By the way I don't do a lot of CG work recently. That's because I don't write technical stuffs a lot.


A sculptor.

(Photo from here)

A page about him on the Louvre museum site
link to his another work


Monday, February 2, 2009

Who reads this blog?

This map is taken from google analysis report (showing clear world digital divide). Access from Japan includes me so it's not reliable. The top 10 access list is

United States
Japan (not reliable)
United Kingdom

So, lets predict the future of these countries. Below are the links to a site that calculates an estimated population pyramid 10 years in the future.

The points are,
1) Absolute value of younger people's population
2) Population proportion (old/young)

For example,
1) Japan is bad because the number of younger people are getting less and less.
2) Japan is bad because this value is very large.

These are just two units of measurement and they don't describe all, of course.
I have my own opinion about the future of other countries but Japan but it may be controversial, so I will not tell it.

United States
United Kingdom

and these are several other interesting population pyramids:

United Arab Emirates

If your country is not on the above links, you can get it from this page.