Skip navigation.

Posts tagged with "python"

破玩意儿

, ,



基本上已经忘记继续作下去了,自己没有需求。

Call Fortran Dll from Python with ctypes (I)

,

一直都用Fotran写数值计算的程序,通常直接把Fortran源程序编译成可执行文件来用,通过命令行来执行。这样的使用方式具有悠久的历史,目前绝大多数fortran程序仍然是这样使用的。对于开发者或者个人使用者,这不是大问题,但是大部分终端用户总是希望可以直观的操作和控制程序的运行,对于厚厚的使用说明以及命令行的操作形式保持敬而远之的态度。

但是Fortran不包含图形界面的库,要作GUI就无能为力。不过现在也有一些公司推出了Fortran版图形扩展库,可以编写简单的图形界面,比如Compaq Visual Fortran (CVF)就附带了QuickWin的图形接口。可惜受到Fortran本身能力所限,这些扩展功能终归太过简单。

于是出现更为流行的方式:将Fortran代码编译成链接库(dll, lib, so ..),再通过其他具有图形界面处理的程序代码(c, c++, delphi, visual basic, java ...) 来调用。这些东西我没接触过,具体如何处理不太清楚。界面与计算核心分别由相应的专业人员来开发,配合很容易。只是对于个人开发者,要学会几种语言就比较头疼了,时间、精力都受到限制。

Python在图形界面上的功能上不输于c/c++等语言,比如wxWidgets, Qt, Gtk等优秀的GUI库都有相应的Python绑定。而且Python易学易懂。一个具有一般编程经验的人完全可以在几个小时之内学会Python并写出具有完整功能的程序来。我喜欢用python,很自由,很强大。于是我希望通过python作图形界面,用fortran作计算核心, call fortran dll from python.

ctypes是Python的扩展,可以调用链接库中的函数

ctypes is a ffi (Foreign Function Interface) package for Python
2.3 and higher.

ctypes allows to call functions exposed from dlls/shared libraries
and has extensive facilities to create, access and manipulate
simple and complicated C data types in Python - in other words:
wrap libraries in pure Python. It is even possible to implement C
callback functions in pure Python.



update: 下面这个例子有很多问题。

尝试一下,下面是一个非常简单的例子。

Fortran代码 使用CVF 6.6.C 编译
function test(x) result(y)
  !DEC$ ATTRIBUTES DLLEXPORT, ALIAS:'test', STDCALL::test
  integer x, y

  y = x + 10

end function


在python中调用
>>> from ctypes import *
>>> testdll = windll.LoadLibrary("d:\\fortran\\testdll\\Release\\testdll.dll")
>>> testdll.test(c_int(111))
121


这个例子太简单了,所以有一些问题没有表现出来:rolleyes:

FCKeditor not support Opera in MoinMoin

, ,

MoinMoin 1.5 加入基于FCKeditor的可视化编辑器,使用起来还是比较舒服的,特别是点击按钮就可以加入macro,非常的方便,不再需要记住复杂的语法。

但是目前为止FCKeditor不支持Opera,所以在Opera中暂时无法享受到可视化编辑的乐趣,实在是很遗憾的事情。

http://www.fckeditor.net/

ANN: wxPython 2.6.2.1

,

Announcing
----------

The 2.6.2.1 release of wxPython is now available for download at
http://wxpython.org/download.php. There have been many enhancements
and fixes implemented in this version, listed below and at
http://wxpython.org/recentchanges.php.


What is wxPython?
-----------------

wxPython is a GUI toolkit for the Python programming language. It
allows Python programmers to create programs with a robust, highly
functional graphical user interface, simply and easily. It is
implemented as a Python extension module that wraps the GUI components
of the popular wxWidgets cross platform library, which is written in
C++.

wxPython is a cross-platform toolkit. This means that the same program
will usually run on multiple platforms without modifications.
Currently supported platforms are 32-bit Microsoft Windows, most Linux
or other Unix-like systems using GTK2, and Mac OS X 10.2+, in most
cases the native widgets are used on each platform.

MoinMoin 1.5 out!

,

download: http://moinmoin.wikiwikiweb.de/MoinMoinDownload

cheers :cheers:

[ReleaseInfo]

_ _
/\/\ ___ (_)_ __ /\/\ ___ (_)_ __
/ \ / _ \| | '_ \ / \ / _ \| | '_ \ __
/ /\/\ \ (_) | | | | / /\/\ \ (_) | | | | | /| |_
\/ \/\___/|_|_| |_\/ \/\___/|_|_| |_| |.__)


==============================================
MoinMoin 1.5.0 advanced wiki engine released
==============================================

MoinMoin is an easy to use, full-featured and extensible wiki software
package written in Python. It can fulfill a wide range of roles, such as
a personal notes organizer deployed on a laptop or home web server,
a company knowledge base deployed on an intranet, or an Internet server
open to individuals sharing the same interests, goals or projects.

A wiki is a collaborative hypertext environment with an emphasis
on easy manipulation of information.

MoinMoin 1.5.0 is the first release on the 1.5 branch bringing you
several new features such as the GUI editor, which allows the users
to edit pages in a WYSIWYG environment, and many bug fixes. The download
page: http://moinmoin.wikiwikiweb.de/MoinMoinDownload


Major new features in 1.5
=========================

* The WYSIWYG editor for wiki pages allows you to edit pages without touching
the markup. Furthermore, the wiki page is not stored as HTML after editing
but kept as wiki markup in order to simplify the editing process for users
that cannot or do not want to use the new editor.

* AutoAdmin security policy allows users to gain admin permissions on particular
pages.

* The new authentication system allows to add short methods that check the credentials
of the user. This allowed us to add eGroupware single sign on support.

* Separation of homepages into a separate wiki (in a farm) and having a single
user database is supported.

* A DeSpam action to allow mass-reverting of spam attacks.

* PackageInstaller support for simplified installation of plugins, themes
and page bundles.

Note that Python 2.3.0 or newer is required.
For a more detailed list of changes, see the CHANGES file in the
distribution or http://moinmoin.wikiwikiweb.de/MoinMoinRelease1.5/CHANGES

MoinMoin History
================

MoinMoin has been around since year 2000. The codebase was initally
started by Jürgen Hermann; it is currently being developed by a growing
team. Being originally based on PikiPiki, it has evolved heavily since then
(PikiPiki and MoinMoin 0.1 consisted of just one file!). Many large
enterprises have been using MoinMoin as a key tool of their intranet, some
even use it for their public web page. A large number of Open Source
projects use MoinMoin for communication and documentation. Of course there
is also many private installations.


More Information
================

* Project site: http://moinmoin.wikiwikiweb.de/
* Feature list: http://moinmoin.wikiwikiweb.de/MoinMoinFeatures
* Download: http://moinmoin.wikiwikiweb.de/MoinMoinDownload
* DesktopEdition: http://moinmoin.wikiwikiweb.de/DesktopEdition
* This software is available under the GNU General Public License v2.
* Changes: http://moinmoin.wikiwikiweb.de/MoinMoinRelease1.5/CHANGES
* Known bugs:
* http://moinmoin.wikiwikiweb.de/KnownIssues
* http://moinmoin.wikiwikiweb.de/MoinMoinBugs

sent by Alexander Schremmer for the MoinMoin team