November 30, 2008

python: super() method and new style class

if you want to use super() method to reuse a method in the parent class, you have to make sure the parent class is a “new style class”. simply speaking, any new style class can trace their inheritance to the bulit-in class “object”. For example, if you want to do

class C(B):
  def meth(self, arg):
    super(C, self).meth(arg)

Make sure B is defined as

class B(object):

or

class B(int):

etc...

python: directly refering __init__.py variables when importing * from a package

From this python doc page: import * from a package
We know that submodules of a package won’t be imported in a “import * from …” statement unless you define the all list in init.py .
However, they didn’t say that after you have defined all list in init.py, everything you can refer to directly is restricted to the names in that list, and other public names defined in init.py won’t be directly accessible anymore…


I guess this is how it works:
The public names imported in “import * from …” statement come from all list.
When all is not defined, the system would automatically put all the public names in init.py into all list. When all is defined, the system would just use the user’s list and won’t bother to add anything else.

One more point about init.py: the public names in it won’t be directly accessible to the submodules in this package unless you explictly import this package in those modules. This is especially confusing when people are used to object oriented packaging scheme.

November 25, 2008

scim causes input problems in some kde apps

is it because i’m using chinese scim in English locale?

anyways, scim causes keyboard input to freeze from time to time in my eric python ide.



November 24, 2008

If you’re going through hell, keep on going:)

November 21, 2008

Comet?

Spotted at UH campus at 5pm on Nov 21 2008
NASA is here. It could be anything.

November 20, 2008

energy and food for world peace?

At least that is the case in the recent US government report.

http://www.cnn.com/2008/POLITICS/11/20/global.trends.report/index.html

“While conflicts are still most likely to “revolve around trade,
investments, and technological innovation and acquisition,” the report
states that “we cannot rule out a 19th century-like scenario of arms
races, territorial expansion, and military rivalries.”“

So human race has to play this delicate game of trade,
investments, and technological innovation and acquisition reasonably well to last long enough to see the technical breakthrough in energy and environment cures us all, or it will get UGLY.


Great. Can we survive ourselves?

bootstrapping business — an agile start

http://www.inc.com/magazine/20020201/23855.html

i just came across this very interesting article about the unique style of Greg Gianforte, a software cowboy .

I didn’t mean the cowboys in the movies. They’re nuts for business. He’s a cowboy like many good old texians I know here: life time fan of DIY, with a reasonable blend of love of the wild and peaceful life. And I believe he had fun in his ride in business just like cowboys in their riding of bulls. I think that is probably the single most important talent.

But according to the article, his most important trick is bootstrapping. It is to save money, and much more. Well I can’t help comparing it to agile software development approach. (And i believe that’s what RightNow guys are practicing in their software development from beginning to the now.) The essence of it, I think, is to always do spiking before fully deploying your resources. The trick is, that, for most startup/software development, the first 10% of work is most risky, since it’s very possible that you’ve stepped into the wrong direction, but it could be the most rewarding if your direction is right, since with very little cost(other than your own HARD WORK) you get a prototype, which probable would provide 50% of the most important features.(It you can’t make it, forget about starting a small business for it.) Now the unsmart move is to throw in considerable amount of cash and other resources in from the very beginning, hoping to get a product that could blow the custermer away after it’s finished. The smart move is to do experiment a little bit with technique possibilities, and then consult customers even before you start working on the prototype, and do “sales as survey” in the prototyping phase if you have enough grasp of it. In a word, to find the short cut from idea to result(sales), bypassing as much risk as possible.

Now I think this “bootstrapping”, “short cut”, “agile approach” is a fundermantal strategy for startups and any kinds of beginner in a risky field: minize the disadvantage of constraint of resources and maximize the advantage of experimenting on a lot of things freely with feedbacks in the process. There is one more point to add, though: experience is very important to carry out this. People have to rely on experience heavily to decide the amount of resources to allocate and how to bypass risk/trouble and get to the destination. But if we also add “agile learning” into this strategy, i believe it would be general enough to be applicable to beginnners at different levels.

What is “agile learning”? just a word i give for a learning strategy that is compatible with “bootstrapping”. Calling customers as salesman to do survey is agile learning in a radical form. I how I put together my inspirations and carry out some a good enough practice to post here, soon.


November 1, 2008

ultimate python scientific package

http://www.sagemath.org/