e^t

我是风的歌

正在浏览标签为 python 的文章

Combine Vim and Python

抢沙发

In Chinese, that combination would be “adding wings to the tiger”.

I believe most people are using Python26 and do not have Python27 on their system. Instead of “install then uninstall” Python27, you can follow what I did: copy your python26.dll to vim/vim73/ and rename it into “python.27″ ;)

For basic use, it works well, although vim freezed when I tried to use urllib following link 2 (below). Something still puzzles me is after (painfully) got a real python27.dll and put it into vim73 directory, things got much worseand even a python print command would crash vim! So I would stay with the renamed python26.dll for now.

Some commands to try.
:py print 2*3
:py import sys; print sys.version
:py print vim.eval(“&filetype”)

To write your own functions inside _vimrc (that’s why you got attracted by this article, right? ) Here are some links I found useful:

getting stared:

http://www.builderau.com.au/program/python/soa/Extending-Vim-with-Python/0,2000064084,339283181,00.htm

more advanced:

http://www.tummy.com/Community/Presentations/vimpython-20070225/vim.html
http://tmske.blogspot.com/2007/05/python-scripting-in-vim-1.html

vim python doc:

http://vimdoc.sourceforge.net/htmldoc/if_pyth.html

四叉树

抢沙发

四叉树是对二维空间中散布的点进行空间索引。把一个矩形不断四等分,直到每个矩形里面只有一个点为止,不存在点的地方就不划分。这样做的目的是节约资源,同时可以使用树算法的速度优势。需要注意的是,如果点集里面有两个点距离非常近,那么这两个点会嵌套在很多层四叉树树枝中——因为需要足够的细分来把它们分开。所以有些四叉树并不限制叶子中的点数,并在同时对四叉树的最大层数进行限制,例如8层——别嫌少这已经可以提供4^8-1个节点,4^7个叶子了!

The Blasius’ equation in fluid mechanics or more specific, boundary layer problem, is one of the most famous ODE. It appears after some wise manipulations like using stream function and similarity transformation (Google it) and writes as:

bldemo_screenshot
The following is a Python script solving it with shooting method, also has a Qt Gui for simple manipulation of the guessed value for each “shooting”, have fun!
bldemo.zip

我的python IDE

抢沙发

这个日志算是学习之余敲敲键盘放松一下~

pyscripter是受不了了,虽然自动完成很快。但是一运行可视化的程序就会要么down了,要么在关闭运行的程序的时候一起退出——连个保存提示都没有!

editra并非面向python,挺漂亮,窗口还可以透明,pyshell插件也有好几种颜色模式。launch插件可以直接运行python脚本。可是pyshell竟然不能import后来安装的模块,应该是路径问题,可是找了半天也没有找到路径在哪里设置,

pydev一直很钟爱,但是wxpython竟然总是无法自动完成,真不知道那么多大些关键词一个一个敲出来会是怎样的精力浪费。

scite很好,但是自动完成等等功能似乎很弱,配置的语法还是lua,重要的是没有项目管理和调试器。没有到达IDE的层次。

Komodo editor太大,wing ide免费版太弱,而破解软件已经越来越为我排斥——幸好maya和vue都有ple版,至于电脑上面的Mathematica,将来一定把money给wolfram补上!

真不知道一个pyshell的自动完成那么好,这些editor怎么就不好好学。当然pyshell只用于interactive,它自动完成的部分都是已经load进入解释器的。可是别的也不应该这么逊啊!

还是适用ulipad和eclipse吧。其实上面所有的软件都挺好,将来也会关注他们的更新,期待更少的bug和更多的features。叹息啊!虽然自信不再是菜鸟,但是不成为高手,还是只有被欺负的份儿!

空间里python的tag已经在那儿很久了,可到现在也只有一片文章。也算增加一下吧~

另外不知道Foxit software为什么原因,现在用最新版本foxit reader在pdf文档上面做标记之后保存,页面上面再也没有刺眼的水印了——以前版本的话除非你花钱买一个pro版本。非常好~
据说forxit公司是中国人到美国创办的公司,还有传言adobe可能会收购这个和它针锋相对的竞争者,都不知道是不是真的。


官方网站

http://www.opencascade.org/

在另一个网站上面看到的简练介绍:

Open CASCADE – along with ACIS and Parasolid – is one of the three major modeling kernels available on the market today. It is quite a sophisticated set of C/C++ libraries. According to the information from its vendor, tens of millions of dollars were invested into its development. This is reflected both in the number of features and the quality of the product. It seems to be an ideal starting point if you are going to develop a very complex CAD/CAM/CAE, GIS or other engineering type or scientific applications.

There is one important difference between Open CASCADE and other kernels: it is open source and freely downloadable. This made it possible to convert its modules into Python modules. This means that you can use the Open CASCADE modules in the friendly Python environment from now on. One of the advantages is that you can learn how to use this excellent library much more quickly. The Open CASCADE sample problems were programmed in Python using Robin Dunn’s nice wxPython library (though you can use other packages as well like pyQt/PyKDE, Java (Jython) or PythonWin e.g.) as a GUI, for your convenience. If you want to know more about how Open CASCADE can be used in Python, please click on the Gallery button.

这个网站实现了OC的一个python接口,不过好像已经停止开发了,最新的还是2003年的,不知道是否还和比较新的python 2.5兼容。不过还有一个当前正在快速开发的binding,看起来比较有希望。现在太忙了,没有时间搞这些,不过写出一个为自己量身定制的软件是个挺坚定的梦想……