As I wrote looong time ago, I released ShakeCommandWindow 0.94
New features are:
- Open window by pressing macro button
- At-least-not-crash level fail safe on pointer/floating point/pipe related runtime errors (1)
- Fix freeze bug when pressing macro button while settings panel is open
- Fix freeze bug when trying to display non-ascii string
- Created settings dialog (2)
- Modified default gcc header/footer includes
I signal trapped inside the SCW plug-in so now it doesn't crash when your gcc code has a null-pointer bug, /0 bug, etc. This is not perfect, because newer gcc compilers do not let me raise an exception inside the signal handler, class destructors are not called property, it will probably cause memory leaks and some other side effects. That's why I call it At-least-not-crash level fail safe. But I was happy with this when I was using SCW to make another plug-in.
For unknown reason, my wxPython wouldn't work anymore when a button is in a tab, so I made a separate settings dialog and "settings" button to open the dialog.
You can download it here.
Wednesday, October 29, 2008
As I wrote looong time ago, I released ShakeCommandWindow 0.94
Saturday, October 25, 2008
Friday, October 24, 2008
As many of the readers probably know, Massive is a software for crowd simulation which was first developed for The Lord of the Rings. I have a strong interest in the software because my last work was crowd simulator development (which concept is completely different from massive). I went to a seminar held by Crescent because this time Stephen Regelous, the founder and CTO of Massive Software was the presenter. He explained some of new features such as agent field with which you can feed boid force (each component separately) to the brain with lots of parameters to set weight and select which neighbor agents to be considered. At the party after the seminar I talked with him and found he is a very nice and friendly guy (I heard he spoke some Japanese, can he speak Japanese?).
Stephen, at the party
Another surprise was that I met a girl I know for the first time in 6 years! She is now working for Prometech Software, which I think is the best R&D based CG company in Japan. We talked lots of technical and non-technical stuff and had fun. She gave me the answer of one of my questions (Why does the free surface boudary condition used in one of particle based fluid simulations works) which had been puzzling me for a long time.
Sunday, October 19, 2008
Because Python3.0 (aka Python3000) has no backward compatibility, it is supposed to cause some trouble when porting existing code to Python3.0. According to PEP3000 (PEP stands for Python enhancement proposal) , there is a recommended procedure to port 2.x code to 3.0. This is a quote from PEP3000
- You should have excellent unit tests with close to full coverage.
- Port your project to Python 2.6.
- Turn on the Py3k warnings mode.
- Test and edit until no warnings remain.
- Use the 2to3 tool to convert this source code to 3.0 syntax. Do not manually edit the output!
- Test the converted source code under 3.0.
- If problems are found, make corrections to the 2.6 version of the source code and go back to step 3.
- When it's time to release, release separate 2.6 and 3.0 tarballs (or whatever archive form you use for releases).
For Python experts: did you know there's one byte code assigned just for PRINT_NEWLINE? No wonder Guido wanted to renew Python interpreter. You can see the list of byte codes here. (and compare it with Python3.0's byte code instructions, you'll see lots of them are simplified or generalized with arguments.)
by the way, is anybody reading this blog regularly? I'm just curious.
Saturday, October 18, 2008
I don't know if it's a world trend but in Japan beautiful factory photos are popular since several years ago.
This is a site made by a professional photographer who has published a photo book which has pictures of only industrial complexes.
And ruin photos are getting popular as well.
Maybe he is not a professional photographer but his pictures are awesome.
If you've seen "life after people" and you liked it, you'll also like these.
Thursday, October 16, 2008
While browsing my friend's blog, I found he's mentioned a site that introduces a simple raytracer written in Haskell. That reminded me another site where you can see lots of simple raytracers implemented in various programming languages.
Somewhere I found a raytracer written in PostScript but I've forgotten where it was.
Tuesday, October 14, 2008
Another game for artists
1st time: Couldn't see the rule.
2nd time: Mouse pointer jumped.
Parallelogram 8.2 4.1 1.0
Midpoint 2.2 4.2 4.2
Bisect angle 2.4 6.6 2.2
Triangle center 1.3 5.1 4.8
Circle center 0.0 2.8 4.5
Right angle 4.4 3.9 4.6
Convergence 2.0 2.2 2.2
Overall score: 3.47
It's more difficult than the previous one. Be prepared!
Saturday, October 11, 2008
I made a presentation at a meeting called "Python code reading" held by a Python community in Japan. It's a meeting to read one standard Python module each time (a volunteer makes a presentation) to steal knowledge and techniques by reading scripts written by Python gurus. We read inspect module this time.
Here are several topics I mentioned during the code reading.
- basic usage of inspect module
- method generation mechanism by descriptor and decorator
- custom import (PEP302, which is used by importing zipped modules)
- code object and its meaning
- various special attributes (co_filelineno etc.)
- .pyo file
- file open mode 'U'
- imp module
- negative lookbehind assertion
- method resolution order
- how to clear the cache of the source code which is used by inspect.getsource(), etc.
(if the cache is kept uncleared, getsource() etc. still returns an old source after you modify the script and reload the module)
And what I studied during its preparation (but not talked during the presentation) are
- Python VM and byte code
- disassembling using dis module
- Python dev bug tracking
I didn't mention VM related stuff so that the meeting wouldn't be only for experts (and there was no time to explain them anyway).
Tuesday, October 7, 2008
Inspect module offers various useful functions to Python developers.
Here are four most basic and useful functions inspect module has.
Before showing them, I will just make a simple module (mymodule.py) for the example usages shown below. It has just one function and two classes.
#f() just prints "hello"
This function is probably the most useful one in the module, along with getabsfile().
It returns the source code where object is defined.
object can be a class, method, function, etc (not instance because an instance gets created dynamically).
>>> print inspect.getsource(mymodule.B)
It returns the absolute path to the file where object is defined.
>>> print inspect.getabsfile(mymodule.A)
Get lines of comments immediately preceding an object's source code.
the object can be a class, function, etc...
>>> print inspect.getcomments(mymodule.f)
#f() just prints "hello"
It returns a detailed information of attributes a class has.
It includes in what class a method is defined.
>>> for m in inspect.classify_class_attrs(mymodule.B):
... print m
('ma', 'method', <class 'mymodule.A'>, <function ma at 0x260c30>)
('mb', 'method', <class 'mymodule.B'>, <function mb at 0x260c70>)
There are many many functions. inspect module is a friend of every Python users from beginners to byte code analysers.
Monday, October 6, 2008
Have you seen this?
Ragel State Machine Compiler
Ragel compiles executable finite state machines from regular languages. Ragel targets C, C++, Objective-C, D, Java and Ruby. Ragel state machines can not only recognize byte sequences as regular expression machines do, but can also execute code at arbitrary points in the recognition of a regular language. Code embedding is done using inline operators that do not disrupt the regular language syntax.
Interesting, and looks so useful !
Oct. 9 added.
I found another tool.
The State Machine Compiler
While Ragel is more suitable for text processing, this one is something more general purpose. Though it is interesting, I wonder if it is so useful. I know it's tedious to turn a state diagram into a code when the number of states/actions gets larger but it's just tedious and not confusing. Just wondering if adding a tool for it in the project is worth while, trading off building and porting simplicity.
Well, I haven't looked through the document. I'm just saying that after the first look and may change my opinion later.
By the way bringing the concept of state machine in visual programming can be interesting. It's an easy to learn concept and naturally easy to visualize (thinking about something weird again ;)