在C程序中集成Python

测试环境:Ubuntu 10.04

[code language=”c”]
#include
#include int main(int argc, char * argv[])
{
// initialize the interpreter
Py_Initialize();
// evaluate some code
PyRun_SimpleString(“import sys\n”);
//ignore line wrap on following line
PyRun_SimpleString(“sys.stdout.write(‘Hello from an embedded Python Script\\n’)\n”);
// shut down the interpreter
Py_Finalize();
return 0;
}
[/code]

编译:
[code language=”bash”]
$gcc Listing1.c -I/usr/include/python2.6 -lpython2.6
[/code]

编译成.so
[code language=”bash”]
$gcc -c -fPIC Listing2.c -I/usr/include/python2.6
$gcc -shared Listing2.o -o libcrypto.so -lpython2.6
[/code]

参考:
1. Embedding Python in Multi-Threaded C/C++ Applications

Test: 在C程序中集成LUA

虽然一直对LUA感兴趣,可惜是一直以来对它的兴趣集中在WOW插件上,而且只是使用。因为它在WOW中的精彩,我非常想尝试一下建立一个类似的环境。昨晚做了个很容易查询到的例子,在Ubuntu Linux 10.04下编译通过:
文件清单:
1. test.c
[code language=”c”]
#include “lua.h”
#include “lualib.h”
#include “lauxlib.h”

int main()
{
int s=0;

lua_State *L = lua_open();

// load the libs
luaL_openlibs(L);

//run a Lua scrip here
luaL_dofile(L,”foo.lua”);

printf(“\nI am done with Lua in C++.\n”);

lua_close(L);

return 0;
}
[/code]
2. foo.lua
[code language=”lua”]
print(“I am using Lua from within C”)
[/code]
编译过程:
[code language=”bash”]
gcc test.c -I /usr/include/lua5.1 -llua5.1
[/code]
执行結果:
[code language=”bash”]
I am using Lua from within C

I am done with Lua in C++.
[/code]

今晨的球,德国0:1西班牙。再看百度贴吧中的预言:

我来自不远的未来,我知道很多人只会把我的话当是个玩笑,我愿意先给大家一点事实的证据。

我给出的的证据很简单,目前世界最关注的世界杯,决赛双方将是荷兰和西班牙,荷兰2:1战胜了西班牙,斯内德和另一个你们猜不出的替补球员进了球。希望我的这番话不要在世界杯决赛前传到南非,否则我担心球员心态受影响,从而改变了历史。

一个月后我会回来,那时候希望你们愿意相信我的所有关于未来的话!
贴吧原址
截图:
如果Android处理LUA足够快,我愿意做一个预言者。
参考:
1. How to embed Lua 5.1 in C++

新RAD Studio2010版现在发布!

今早收到Embarcadero公司的邮件,新版的RAD Studio 2010发布了。

令人兴奋的全新RAD Studio 2010包括全新的Delphi ®、C + +Builder®、和Delphi Prism ™。 Embarcadero公司(原CodeGear的)RAD Studio在提供一切您所需要的,能够闪电般的建立快速、紧凑、生动丰富的原生Windows、.NET、Web和数据库应用程序的功能。

RAD Studio 2010 的新功能主要在于:增强的 IDE和可视化组件库 (VCL) 框架和基础的编译器以及其他各项工具,这使得你构建那些跨越所有的数据源和层次的可视化应用变得更加容易。 RAD Studio 2010 中的重要新功能包括:

  • 新增功能! 支持最尖端的触摸和手势-使您的应用程序能够支持包括Windows 7在内的任何 Windows 操作系统
  • 新增功能! 通过增强的DataSnap™框架和DBExpress数据访问驱动,支持最新的数据库平台,包括Firebird数据库的支持!
  • 新增功能! IDE Insight,随时访问任何功能,设置,或组件
  • 新增功能! 包括tabbed toolbar的Delphi 7 经典模式布局选项
  • 新增功能! 超过 120项针对开发的IDE 功能增强
  • 功能增强! 在2009版的基础上,又有超过一百项的功能增强,包括 Unicode、 泛型、 匿名方法等等

原文

NUI – cross-platform for OpenGL app

NUI is a cross-platform C++ GUI programming framework for OpenGL applications built on top of the NGL framework. In other words, its purpose is to help programmers write multi-platform GUI applications with a simple knowledge in C++. The rendering being based on OpenGL, graphics can intensively use alpha blending, anti-aliasing, complex primitives and even 3D with full hardware acceleration when available.

NUI是一个跨平台的,用于OpenGL应用开的的C++ GUI框架,它基于NGL框架构建。换句话说,它的目标是帮助程序员利用简单的C++知识就可以编写出多平台的GUI程序。渲染部分基于OpenGL,alpha混合、抗锯齿、复杂的原始的计算,特别是当硬件加速可用的时候,可以进行加速。

(后面一句我胡翻的,大致的意思如此吧)

来源, NGA

mongoDB

The best features of key/values stores, document databases and RDBMSes in one.

MongoDB is a high-performance, open source, schema-free document-oriented database. MongoDB is written in C++ and offers the following features:

  • Collection oriented storage – easy storage of object-style data
  • Dynamic queries
  • Full index support, including on inner objects
  • Query profiling
  • Replication and fail-over support
  • Efficient storage of binary data including large objects (e.g. videos)
  • Auto-sharding for cloud-level scalability (currently in early alpha)
  • Commercial Support Available

A key goal of MongoDB is to bridge the gap between key/value stores (which are fast and highly scalable) and traditional RDBMS systems (which are deep in functionality).

MongoDB是一个高性能的面向文件的开源数据存储项目。十分容易部署,管理和使用。可以通过网络访问,并且由C++语言编写。主要包含的功能特性有易存储对象类型的数据,完全索引支持,查询支持,复制和故障恢复支持,高效的二进制数据存储,自动处理碎片提高云层次上的扩展性。高性能,可扩展,适当的功能使这个项目的主要设计目标。

BerkeleyDb之后,可以找到的替代品之一。

参考:

1. http://rdc.taobao.com/blog/dw/archives/410

WinxGUI – WINX

WinxGui is composed of some sub-libraries. They are winsdkwtlstdextwinx.

winsdkwtl are 3rdparty libraries. winsdk is Windows Platform SDK, which is provided by Microsoft. wtl is Windows Template Library. It is a C++ library for developing Windows applications and UI components. It extends ATL (Active Template Library) and provides a set of classes for controls, dialogs, frame windows, GDI objects, and more.

stdext is a GUI-less library. stdext means STL (Standard Template Library) extensions. It extends STL and provides a set of classes for diagnosis, memory management, unit tests, file io, etc. stdext is self systematic. It depends nothing else, and you can use it freely.

winx is the core of WinxGui library, of course. It depends winsdk(optional), wtl, and stdext. You may ask me why you based on WTL. In Dive into WinxGui I will answer the question.

In fact, stdext library is more general and useful than winx. So, we decided to release stdext library independently. Its homepage is http://code.google.com/p/stdext/. The wiki of stdext library is http://cpp.winxgui.com/.

http://code.google.com/p/winx/