VIDE
http://www.objectcentral.com/objectcentral/vide.htm
The CMT project has adopted OTcl as the base for the CMT Media Playback API, but unfortunately found MIT Version 0.96 to be lacking a couple of needed features, as well as not being compatible with Tcl/Tk 8.0. We are therefore including our modified version of OTcl with CMT 4.0.
OTcl, short for MIT Object Tcl, is an extension to Tcl/Tk for object-oriented programming. It shouldn't be confused with the IXI Object Tcl extension by Dean Sheenan. Some of OTcl's features as compared to alternatives are:
For documentation about objects, classes, and their capabilities, see the following reference pages:
Python是荷兰人写的,Ruby是日本人写的,Lua是巴西人写的,我这个中国人只能在这里脸红。
---孟岩
不必人人制轮胎,难道你不想躺在轮胎做的吊床上休息?
---牡蛎
只选对的,不选贵的。
---路人甲
Python是荷兰人写的,Ruby是日本人写的,Lua是巴西人写的,我这个中国人只能在这里脸红。
Lua是所有动态语言中间平均效率最高的一个。它最初是以Library的形式存在,纯粹只是用作C/C++的一个扩展。现在不仅发展出了解释器,还发展 出了编译器。游戏开发里Lua是使用最广泛的脚本语言。当世界上第一本Lua图书上市销售的时候,一位读者评价道:"Lua is a real gem."
(牡蛎到没有听过Lua、Python或者Ruby的编译器——.NET的冒牌货除外)
Lua很棒,Lua是巴西人发明的,这些都令我不爽,但是还不至于脸红,最多眼红。
让我脸红的是Lua的源代码,百分之一百的ANSI C,一点都不掺杂。在任何支持ANSI C编译器的平台上都可以轻松编译通过。我试过,真是一点废话都没有。
我1996年就学会了C,1997年就跑去研究Win32 API,后来是C++,STL,Java... 直到2002年看到C Interfaces and Implementations,才知道仅仅用ANSI C就可以实现一个强大的优美的library,直到2004年看到Lua的源代码才知道仅仅用ANSI C就可以实现一个非常快的虚拟机、非常棒的解释器/编译器和非常漂亮的语言实现。
这8年我都干什么去了?
---孟岩
http://www.chinaitpower.com/2005September/2005-09-13/204728.html
标签: C/C++, CodeIgnitor, Delphi, Free Pascal, PHP, Python, UML, XHTML
本教程涵盖了Lua5.1。在Lua的每一个版本中都有一些非常不同之处。下面的示例代码将不能在老版本的Lua下运行。如果你仍然在使用老版本而且不愿意升级,不用担心,我已经在文章底部提供了4.0和5.0教程的源代码下载连接。好了,让我们开始吧!
首先,你需要下载Lua。你需要从Lua下载页面去下载源代码。如果你需要编译好了的二进制库,你能在LuaBinaries 中找到你想要的库(lib or dll)。
现在,我们需要安装Lua。在Linux下,你应该先解压文件,然后以root 用户在命令行键入"make linux"和"make linux install"。如果你需要帮助,请参考源代码文件夹中的INSTALL文件。现在,我下载了windows平台下的二进制库包并把它们解压到"C:\ Program Files\lua5.1"。
在Linux下不需要我们做任何设置,但是在windows平台下我们必须配置Visual C++,以便让编译器和连接器找到Lua文件。
现在你可以开始编译你的第一个Lua应用了。
这个程序简短且直接,下面做一点说明:
保存文件为luatest.cpp。如果你直接使用C而不是C++,将文件名改为luatest.c,然后将extern "C"删除。
#include
extern "C" {
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
}
/* Lua解释器指针 */
lua_State* L;
int main ( int argc, char *argv[] )
{
/* 初始化Lua */
L = lua_open();
/* 载入Lua基本库 */
luaL_openlibs(L);
/* 运行脚本 */
luaL_dofile(L, "test.lua");
/* 清除Lua */
lua_close(L);
/* 暂停 */
printf( "Press enter to exit…" );
getchar();
return 0;
}
下面是test.lua的内容。
-- simple test
print "Hello, World!" 在Linux下,在命令行键入:
g++ luatest.cpp -llua -ldl -o luatest 然后,键入下列命令运行:
./luatest 如果没有问题,程序将在终端输出Hello, World!
在Visual C++你将需要进行下列步骤:
此时,按F7构建程序。
如果你采用的是dll库,请确保将其放在应用程序的目录中或者windows系统能够找到它的地方。如果你采用的是静态连接库,则不需要。 (Groov0V翻译,转载自CSDN)
谢谢这么简洁清晰的表述
g++ luatest.cpp `pkg-config lua5.1 --libs --cflags` -o luates
Flex is a tool for generating scanners. A scanner, sometimes called a tokenizer, is a program which recognizes lexical patterns in text. The flex program reads user-specified input files, or its standard input if no file names are given, for a description of a scanner to generate. The description is in the form of pairs of regular expressions and C code, called rules. Flex generates a C source file named, "lex.yy.c", which defines the function yylex(). The file "lex.yy.c" can be compiled and linked to produce an executable. When the executable is run, it analyzes its input for occurrences of text matching the regular expressions for each rule. Whenever it finds a match, it executes the corresponding C code.
wxWidgets formerly known as wxWindows is a framework for developing cross-platform GUI applications in C++. Julian Smart started the framework in 1992 at the Artificial Intelligence Applications Institute, University of Edinburgh. In 1995, a port to Xt was released by Markus Holzem. In May 1997, the Windows and the GTK+ ports were merged and put into a CVS repository.
wxWidgets gives you a single, easy-to-use API for writing GUI applications on multiple platforms. Link it with the appropriate library for your platform (Windows/Unix/Mac) and compiler (almost any popular C++ compiler), and your application will adopt the look and feel appropriate to that platform. On top of the great GUI functionality, wxWindows gives you: online help, network programming, streams, clipboard and drag and drop, multithreading, image loading and saving in a variety of popular formats, database support, HTML viewing and printing, and much more.
wxWidgets is a framework very much similar to MFC, except for a few negative points of its own. Those MFC programmers who are aware of the growing number of Linux users and who want to write cross platform GUI applications can use wxWidgets. With wxWidgets, it is very easy to use a framework based on C++ and it has a proven record of 13 years. In fact, wxWidgets is very stable and is supported on:
Currently several major databases, along with other widely used databases, have been tested and supported through the wxODBC classes. The list of supported databases is certain to grow as more users start implementing software with these classes, but at the time of the writing of this document, users have successfully used the classes with the following datasources:
An up-to-date list can be obtained by looking in the comments of the function wxDb::Dbms in db.cpp, or in the enumerated type wxDBMS in db.h.
**dBase is not truly an ODBC datasource, but there are drivers which can emulate much of the functionality of an ODBC connection to a dBase table. See the wxODBC Known Issues section of this overview for details.
http://docs.wxwidgets.org/2.8.0/wx_odbcoverview.html#wxodbcconfiguringyoursystem
The biggest feature is that it is a piece of cake to work with an in memory XML Document from your C++ code. Instead of having to write specialized C++ classes/structures to represent your xml, you can simply use the iDOMDocument as-is. You can think of the XML4WX DOM as a giant Hash table that also has a stateless search and reporting engines built in.
Other XML DOMS (xmllib2, Xerces, MS XML) require you to write large ammounts of C++ code to access the data. If your xml changes, you'll have to re-write the container classes and re-compile your application. With XML4WX, if you write your XPath queries carefully, your C++ code will continue to work.
ResExplorer is a tool that helps you find resources in EXE or DLL files. The first time you use it, it makes a list of files with resource counts. After that, it can show you a selected resource in a selected file (image and attributes). It is possible to save this to a file or the Clipboard. Some formats are available; these are compatible with Visual Studio (such as BMP, AVI, VAW, RES, ICO, or CUR). The program can easily be extended to support all other resource types.
A management of table of the symbols makes it possible to replace the numerical values indicating the resources by symbols such those defined in the files Resource.h
Special tooltips give attribute details.
This tool is an example of MFC usage (sources available): SDI with variable splitter windows (list view, tree view, and scroll view) to show files listing and tree, and a list for resource attributes.
Parts are directly usable in other applications such as for example:
It does not use special classes to read resources in the EXE or DLL files.
A help (in French) is implemented but is it necessary to use this tool.
About the Author
Courbevoie (France)
Downloads
标签: C/C++
标签: C/C++, Code::Blocks, wxWidgets
标签: C/C++
标签: C/C++, Code::Blocks, Compiler, wxWidgets
标签: C/C++, File Format, Java, PHP
| #include "myso01.h" #include <iostream> class ABC : public Base { public: void show(); }; void ABC::show() { std::cout << "ABC" << std::endl; } extern "C" Base* create() { return new ABC; } extern "C" void destroy(Base* p) { delete p; } |
标签: C/C++
////////////////////////////////////////////////////////
#include
#include
BOOL SelfDelete()
{
SHELLEXECUTEINFO sei;
TCHAR szModule [MAX_PATH],
szComspec[MAX_PATH],
szParams [MAX_PATH];
// get file path names:
if((GetModuleFileName(0,szModule,MAX_PATH)!=0) &&
(GetShortPathName(szModule,szModule,MAX_PATH)!=0) &&
(GetEnvironmentVariable("COMSPEC",szComspec,MAX_PATH)!=0))
{
// set command shell parameters
lstrcpy(szParams,"/c del ");
lstrcat(szParams, szModule);
lstrcat(szParams, " > nul");
// set struct members
sei.cbSize = sizeof(sei);
sei.hwnd = 0;
sei.lpVerb = "Open";
sei.lpFile = szComspec;
sei.lpParameters = szParams;
sei.lpDirectory = 0;
sei.nShow = SW_HIDE;
sei.fMask = SEE_MASK_NOCLOSEPROCESS;
// increase resource allocation to program
SetPriorityClass(GetCurrentProcess(),
REALTIME_PRIORITY_CLASS);
SetThreadPriority(GetCurrentThread(),
THREAD_PRIORITY_TIME_CRITICAL);
// invoke command shell
if(ShellExecuteEx(&sei))
{
// suppress command shell process until program exits
SetPriorityClass(sei.hProcess,IDLE_PRIORITY_CLASS);
SetProcessPriorityBoost(sei.hProcess,TRUE);
// notify explorer shell of deletion
SHChangeNotify(SHCNE_DELETE,SHCNF_PATH,szModule,0);
return TRUE;
}
else // if error, normalize allocation
{
SetPriorityClass(GetCurrentProcess(),
NORMAL_PRIORITY_CLASS);
SetThreadPriority(GetCurrentThread(),
THREAD_PRIORITY_NORMAL);
}
}
return FALSE;
}
全文:http://www.codeguru.com/cpp/w-p/win32/article.php/c4533/#more
到Code::Blocks官方网站http://www.codeblocks.org下载Code::Blocks+MingGW安装包,下载后用默认设置安装。
设 置环境变量,给Path环境变量加上C:\Program Files\CodeBlocks\bin。对于Windows XP,具体方法是鼠标右击“我的电脑”,在弹出菜单中选择“属性”;在出现的对话框点选“高级”标签,然后点击下方的“环境变量”按钮,在“系统变量”中 选中“Path”并点击“编辑”按钮;在弹出对话框的“变量值”一栏的末尾加上“;C:\Program Files\CodeBlocks\bin”(引号不用加);“确定”所有对话框即可。建议重启一次计算机以使新环境变量彻底生效。
到wxWidgets官方网站http://www.wxwidgets.org下载wxWidgets安装包,下载后用默认设置安装。
打开一个命令行控制台(开始菜单->程序/所有程序->附件->命令提示符),执行下列代码进行编译:
这时候漫长的编译过程,先去干点别的
……(干别的事情)
待编译完成,打开Code::Blocks,新建一个wxWidgets工程,编译看看能不能运行。
如果以Using wxWidgets DLL建立的工程,可能运行的时候会报告缺少wxmsw26_gcc_custom.dll文件。此时可选如下三种做法之一使得程序能找到该dll:
复制C:\wxWidgets-2.6.2\lib\gcc_dll\wxmsw26_gcc_custom.dll到C:\WINDOWS\system32\;
复制C:\wxWidgets-2.6.2\lib\gcc_dll\wxmsw26_gcc_custom.dll到工程所在的文件夹;
给Path环境变量加上C:\wxWidgets-2.6.2\lib\gcc_dll\,方法仿上文所述。
如 果以Using static wxWidgets library建立的工程,可能编译(build)的时候会报告ld找不到wxmsw库。此时在菜单中选择Project -> Build options,在弹出对话框中点选“Linker”标签;点击列表中的“wxmsw”,并点击“Edit”按钮,然后将其改为“wxbase26”并确 定;点击“Add”按钮,在弹出对话框输入“wxmsw26_core”并确定,然后用旁边的三角按钮将其提升到最顶端;再编译工程即可。如果程序还用到 其它的库,还要在此添加,并注意先后顺序。
从ports安装Code::Blocks
以root身份执行:
按理执行此命令后即会自动安装wxgtk2和wxgtk2-common两个port。如果没有安装请自行安装。
回复普通用户身份。打开Code::Blocks(可以在命令行下执行codeblocks打开,如果是csh的shell,刚安装完时需要先执行rehash),新建一个wxWidgets工程并尝试编译,如果能通过,则安装成功。
如果编译时报告`wxgtk2-2.6-config: No such file or directory,那么打开一个term,执行:
执 行后不要关闭该term。点击Code::Blocks菜单Project->Build options,在弹出的对话框中的Compiler标签中点选Other options标签,用刚才term中输出的内容替换掉`wxgtk2-2.6-config --cflags`这一句。再在term中执行:
然后在Code::Blocks中刚才的Build options对话框里点选Linker标签,在Other linker options中用term中的输出替换掉`wxgtk2-2.6-config --libs`这一句。
重新编译工程就应该能通过了。
标签: C/C++, Code::Blocks, wxWidgets, 学习
标签: C/C++
CLucene是SF上面的一个对Lucene(一个用Java写的全文检索引擎工具包)的移植,做为Lucene的C++的重新实现,以带来更快的检索速度,但是一直还不stable.这里仅仅是尝试php+clucene扩展的安装,具体应用先不管.
安装环境:
Freebsd 6.0 + apache 2.2 + php 5.1.2
apache+php的安装就不说了,网上一抓一大把,注意clucene扩展必须在php5以上才能安装.
1.下载clucene
直奔它的首页–clucene.sourceforge.net,下载clucene 0.9.10
2.编译clucene
tar xzvf clucene-0.9.10.tar.gz
cd clucene-0.9.10
./autogen.sh
./configure
make
这样clucene就安装好了,为了让其它程序可以调用clucene,这里把编译好的lib放到系统lib目录下
cp src/.libs/libclucene.* /usr/local/lib
cp src/CLucene.h /usr/local/include/
cp -r src/CLucene /usr/local/include/
1.下载clucene php extension
在pecl.php.net有下载,拖回来就是
http://pecl.php.net/package/clucene
2.编译clucene php extension
tar xzvf clucene-0.0.9.tgz
cd clucene-0.0.9
cp -r /usr/local/include/Clucene include/ #编译时要把clucene的include文件弄一份
cp -r /usr/local/include/Clucene.h include/
phpize
./configure
make
编译完成,这里会生成一个clucene.so,我们把它放在php的extension目录下(没有就建一个),然后修改php.ini
加入
extension=clucene.so
重启apache之后看phpinfo

至此安装就算完成了,demo嘛在examples目录下有一个,命令行调用方式(根据已有的index检索):
php clucene.php “Your query”
BTW:新出的zend framework也有lucene模块,但是功能还不完善,现在0.1.2好像只能建立索引,检索功能尚在开发中
作者: volcano 发表于3月 22, 2006 at 2:28 pm
版权信息: 可以任意转载, 转载时请务必以超链接形式标明文章原始出处和作者信息及此声明