Error

C++博客 首页 新随笔 联系 聚合 管理
  217 Posts :: 61 Stories :: 32 Comments :: 0 Trackbacks

#

cp –a [src] [des]

ps

kill –9 [pid]

Xwin –query [ip]

gdb –tui

ssh [user]@[ip]

scp [local file path] [user]@[ip]:[remote path]

nm -D [so name]

posted @ 2012-09-12 13:37 Enic 阅读(66) | 评论 (0)编辑 收藏

传说这就是AGG:

agg

要理解这张图上的几个概念:

*vertex source: 顶点源。一切的图像的世界是由点构成的。

*cordinate conversion pipeline: 坐标转换管道。不用自己去担心各种坐标系?

*scanline rasterizer: 光栅化,把顶点数据处理合成一组组线段,这里可能会有一些fix或者effect。

*renderers: 渲染器

*rendering buffer: 用于存放像素点的内存

我的理解是这样:图像是以点集的方式存在的,要画图先是冲一组点集开始,先把这一组点的坐标转换成目标坐标,然后通过光栅化形成一组线段,然后通过渲染器把这一组线段渲染到buffer上面形成面。点->线段->面

*****************************************************************************************************

一、vertex source

 

我理解它是一个concept,官方解释是这个:

    所有实现了void rewind(unsigned path_id);和unsigned vertex(double* x, double* y);的类。

agg提供的vertex source concept如下(可以自己扩展):

ellipse 圆

arc 弧线

curve3 curve4 贝塞尔曲线

gsv_text AGG自带字模的文字输出(只支持ASCII码)

gsv_text_outline<>  可变换文字,输入为gsv_text和变换矩阵

rounded_rect  圆角方形

path_storage 路径存储器,可以用join_path方法加入多个顶点源。

arrowhead  箭头

 

二、coordinate conversion pipeline

    坐标转换管道用于改变顶点源产生的顶点,包括坐标、命令、产生新顶点等。如对顶点进行矩阵变换、插入顶点形成虚线之类的功能。

1.变化矩阵 trans_affine

头文件:#include <agg_trans_affine.h>

接口:scale 缩放、rotate旋转、translate平移、矩阵*乘法、invert取反矩阵

2.坐标转换管道

template<class VertexSource, class Markers = null_markers> struct conv_stroke;

变成连续线 构造参数为VertexSource width属性决定线宽。

template<class VertexSource, class Markers = null_markers> struct conv_dash;

虚线

template<class MarkerLocator, class MarkerShapes> class conv_marker;

建立标记

template<class VertexSource> struct conv_contour;

轮廓变换

template<class VertexSource> struct conv_smooth_poly1_curve;

圆滑过渡多边形各顶点

template<class VertexSource> struct conv_bspline;

圆滑过渡多义线各顶点

template<class VertexSource, class Curve3 = curve3, class Curve4 = curve4> class conv_curve;

可识别VertexSource中的曲线信息

template<class VertexSource, class Transformer = trans_affine> class conv_transform;

矩阵变换 用变换矩阵重新计算顶点位置

 

三、scanline rasterizer

1.scanline

扫描线是一种保存span的容器,span用于表示一小条(水平方向)细线。图像中同一行的span组成一个Scanline

2.rasterizer

Rasterizer就是把相当于矢量数据的一堆顶点和命令转换成一行行的扫描线的设备,它就象粉刷工人对照着图纸把彩漆刷到墙上一样

 

四、renderers

    渲染器负责表现扫描线Scanline中的每个线段(span)。在渲染器之前,AGG图形中的线段是没有颜色值的,只是位置、长度和覆盖率(透明度)。渲染器赋于线段色彩,最终成为一幅完整的图像。

    渲染器被分成底中高三层。其中底层负责像素包装,由PixelFormat Renderer实现;中层是基础层,在PixelFormat Renderer的基础上提供更多方法,是所有高层渲染器依赖的基础,由Base Renderer实现;高层负责渲染Scanline中的线段,由Scanline Renderer等实现。

 

五、rendering buffer

Rendering Buffer是一个内存块,用于保存图像数据。这是AGG与显示器之间的桥梁,我们要显示AGG图形实际上就是识别这个内存块并使用系统的API显示出来 而已(实际上几乎不需要做转换工作,因为无论是Windows还是Linux,API所用的图像存储格式与Rendering Buffer都是兼容的)。

 

差不多了,其他的东东现在看多了白搭,俺们要在战斗中学会战斗,,,

posted @ 2012-09-10 16:36 Enic 阅读(243) | 评论 (0)编辑 收藏

Module.h
    网狐的“com”工具箱:
简单介绍下这个东东,其实我以前分析的时候就说过了,这个设计看上去很美,其实用起来不那么方便。这不6603就没有这玩意了。
    网狐的COM接口比较简单,只有两个接口
interface IUnknownEx
  void Release()
  void* QueryInterface(REFGUID guid, DWORD dwQueryVer)
从这个接口可以看出唯一的外部依赖就是guid 和 dwQueryVer

在来看那个help工具模版类
template <typename IModeluInterface> class CTempldateHelper
 //构造函数
 CTempldateHelper(REFGUID Guid, DWORD dwVersion);
 //构造函数
 CTempldateHelper(REFGUID Guid, DWORD dwVersion, LPCTSTR pszModuleDll, LPCSTR pszCreateProc);
两个构造函数,能看出点什么不,,,
// 这代表DLL的名,和DLL中创建组件的函数名,别告诉我你不知道动态加载dll
LPCTSTR pszModuleDll, LPCSTR pszCreateProc
// 这些稀烂班子就是隐藏了动态加载的过程而已
 //获取错误
 inline LPCTSTR GetErrorDescribe() const;
 //指针重载
 inline IModeluInterface * operator->() const;
 //获取接口
 inline IModeluInterface * GetInterface() const;

这样看起来很美,其实隐藏了太多东西,降低了代码的可读性。接口都看不到了,,,坑爹的,,,

posted @ 2012-08-27 17:07 Enic 阅读(785) | 评论 (0)编辑 收藏

其实是可以配置的:

1.界面上Search后面有个下拉框,选择Advanced View,之后就会发现下面多了好多选项。

cmake

里面有一个CMAKE_USE_RELATIVE_PATHS的定义,选中它,重新配置收工。

posted @ 2012-08-01 23:44 Enic 阅读(1606) | 评论 (0)编辑 收藏

进入vc命令行  dumpbin
posted @ 2012-07-18 16:06 Enic 阅读(166) | 评论 (0)编辑 收藏

dll加载的时候会开辟 全局变量 静态变量 的空间,而且每次loader都会,而且多次loader不共享
posted @ 2012-07-18 15:45 Enic 阅读(497) | 评论 (0)编辑 收藏

#实际上是调用cmake安装目录\share\cmake-2.8\Modules\FindQt4.cmake
#设置好一批预定义的东东
FIND_PACKAGE(Qt4 REQUIRED)

# 不解释
SET(helloworld_SOURCES main.cpp hellowindow.cpp)
SET(helloworld_HEADERS hellowindow.h)

#处理helloworld_HEADERS中的MOC宏,处理结果生成在helloworld_HEADERS_MOC
QT4_WRAP_CPP(helloworld_HEADERS_MOC ${helloworld_HEADERS})

#添加QT头文件和宏
INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS})






**********************************************

Using CMake to Build Qt Projects

Written by: Johan Thelin

Qt comes with the QMake tool for handling cross platform building issues. However, there are other build systems available such as autotools, SCons and CMake. These tools meet different criterias, for example external dependencies.

When the KDE project shifted from Qt 3 to Qt 4 the project changed build tool from autotools to CMake. This has given CMake a special position in the Qt world &emdash; both from the number of users point and from a feature support and quality point. Seen from a workflow point of view, Qt Creator supports CMake since version 1.1 (1.3 if you want to use a Microsoft toolchain).

A Basic Example

In this article we will focus on CMake itself, and how to use it in conjunction with Qt. To do this, let's start with an overview of a simple, but typical CMake-based project. As you can tell from the listing below, the project consists of some source files and a text file.

$ ls CMakeLists.txt hellowindow.cpp hellowindow.h main.cpp 

Basically, the CMakeLists.txt file replaces the projectfile used by QMake. To build the project, create a build directory and run cmake and then make from there. The reason for creating a build directory is that CMake has been built with out-of-source building in mind from the very start. It is possible to configure QMake to place intermediate files outside the source, but it requires extra steps. With CMake, it is the default.

$ mkdir build $ cd build $ cmake .. && make 


CMake building a basic project.

The argument given to CMake refers to the directory where the CMakeLists.txt file resides. This file controls the whole build process. In order to fully understand it, it is important to recognize how the build process looks. The figure below shows how the user files: sources, headers, forms and resource files are processed by the various Qt code generators before joining the standard C++ compilation flow. Since QMake was designed to handle this flow, it hides all the details of this flow.


The Qt build system.

When using CMake, the intermediate steps must be handled explicitly. This means that headers with Q_OBJECT macros must be run through moc, user interface forms must be processed by uic and resource files must pass through rcc.

In the example that we started with the world is slightly easier, though. It is limited to a single header file that needs to meet moc. But first, the CMakeLists.txt defines a project name and includes the Qt4 package as a required component.

PROJECT(helloworld) FIND_PACKAGE(Qt4 REQUIRED) 

Then all sources involved in the build process are assigned to two variables. The SET command assigns the variable listed first with the values that follow. The names, helloworld_SOURCES and helloworld_HEADERS, is by convention. You can name them either way you like.

SET(helloworld_SOURCES main.cpp hellowindow.cpp) SET(helloworld_HEADERS hellowindow.h) 

Notice that the headers only include the headers that needs to be processed by moc. All other headers can be left out of the CMakeLists.txt file. This also implicates that if you add a Q_OBJECT macro to any of your classes you must ensure that it is listed here.

To invoke moc, the macro QT4_WRAP_CPP is used. It assigns the names of the resulting files to the variable listed first. In this case the line looks as follows.

QT4_WRAP_CPP(helloworld_HEADERS_MOC ${helloworld_HEADERS}) 

What happens is that all headers are processed by moc and the names of the resulting source files are listed in the helloworld_HEADERS_MOC variable. Again, the variable name is by convention rather than forced.

In order to build a Qt application, the Qt include directories needs to be added as well as a range of defines need to be set. This is handled through the commands INCLUDE and ADD_DEFINITIONS.

INCLUDE(${QT_USE_FILE}) ADD_DEFINITIONS(${QT_DEFINITIONS}) 

Finally, CMake needs to know the name of the resulting executable and what to link it to. This is conveniently handled by by the commands ADD_EXECUTABLE and TARGET_LINK_LIBRARIES. Now CMake knows what to build, from what and through which steps.

ADD_EXECUTABLE(helloworld ${helloworld_SOURCES}      ${helloworld_HEADERS_MOC}) TARGET_LINK_LIBRARIES(helloworld ${QT_LIBRARIES}) 

When reviewing the listing above, it relies on a number of variables starting with QT_. These are generated by the Qt4 package. However, as a developer, you must explicitly refer to them as CMake is not build as tightly to suite Qt as QMake.

Adding More Qt

Moving beyond the initial example, we now look at a project with both resources and user interface forms. The resulting application will look quite similar to its predecessor, but all the magic takes place under the hood.

The CMakeLists.txt file start by naming the project and including the Qt4 package - the complete file can be downloaded as a source code package accompanying this article. Then all the input files are listed and assigned to their corresponding variables.

SET(helloworld_SOURCES main.cpp hellowindow.cpp) SET(helloworld_HEADERS hellowindow.h) SET(helloworld_FORMS hellowindow.ui) SET(helloworld_RESOURCES images.qrc) 

The new file types are then handled by QT4_WRAP_UI and QT4_ADD_RESOURCES. These macros operate in the same ways as QT4_WRAP_CPP. This means that the resulting files are assigned to variable given as the left-most argument. Notice that the header files generated by uic are needed as we need to build a dependency relationship between them and the final executable. Otherwise they will not be created.

QT4_WRAP_CPP(helloworld_HEADERS_MOC ${helloworld_HEADERS}) QT4_WRAP_UI(helloworld_FORMS_HEADERS ${helloworld_FORMS}) QT4_ADD_RESOURCES(helloworld_RESOURCES_RCC ${helloworld_RESOURCES}) 

All the resulting files are then added as dependencies to the ADD_EXECUTABLE macro. This includes the uic generated headerfiles. This establishes the dependency from the executable to the hellowindow.ui file through the intermediary ui_hellowindow.h header.

ADD_EXECUTABLE(helloworld ${helloworld_SOURCES}      ${helloworld_HEADERS_MOC}      ${helloworld_FORMS_HEADERS}      ${helloworld_RESOURCES_RCC}) 

Before this file can be used to build the project there is a small caveat to handle. As all intermediate files are generated outside the source tree, the header file generated by uic will not be located by the compiler. In order to handle this, the build directory needs to be added to the list of include directories.

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) 

With this line, all intermediary files will be available in the include path.

Qt Modules

Until now we have relied on the QtCore and QtGui modules. To be able to use more modules, the CMake environment must be tuned to enable them. By setting them to TRUE using the SET command, the included modules can be controlled.

For instance, to enable OpenGL support add the following line to your CMakeLists.txt.

SET(QT_USE_QTOPENGL TRUE) 

The most commonly used modules are controlled using the following variables.

  • QT_USE_QTNETWORK
  • QT_USE_QTOPENGL
  • QT_USE_QTSQL
  • QT_USE_QTXML
  • QT_USE_QTSVG
  • QT_USE_QTTEST
  • QT_USE_QTDBUS
  • QT_USE_QTSCRIPT
  • QT_USE_QTWEBKIT
  • QT_USE_QTXMLPATTERNS
  • QT_USE_PHONON

In addition to these, the variable QT_DONT_USE_QTGUI can be used to disable the use to QtGui. There is a similar variable to disable QtCore, but that is more to be feature complete than to actually add much useful value.

Added Value and Complexity

It is not as trivial to use CMake as QMake, but the rewards are more features. The most notable point when moving from QMake is CMake's built in support for out-of-source builds. It can really change habits, and thus make versioning code much easier.

It is also possible to add conditionals for various platforms and build scenarios. For instance, use different libraries for different platforms, as well as tuning the same project differently for different situations.

Other powerful features are the ability to generate multiple executables and libraries in one build as well as using said executables and libraries in the same build. This, in combination with the QtTest module can handle complex build situations from a single configuration.

The choice between CMake and QMake is really quite easy. For straight forward Qt projects, QMake is the obvious choice. When the build requirements passes the complexity threshold for QMake, CMake can take its place. With Qt Creator's support for CMake, the same tools can still be used.

posted @ 2012-07-16 12:24 Enic 阅读(2629) | 评论 (0)编辑 收藏

1.获取当前路径:os.getcwd();

2.获取指定目录文件/文件夹列表:os.listdir(path)

/////////////////////////////////////////////////////////////////

顺便粘一点相关的东东

////////////////////////////////////////////////////////////////

os.walk()
函数声明:walk(top,topdown=True,onerror=None)
1>参数top表示需要遍历的目录树的路径
2>参数topdown的默认值是"True",表示首先返回目录树下的文件,然后在遍历目录树的子目录.Topdown的值为"False"时,则表示先遍历目录树的子目录,返回子目录下的文件,最后返回根目录下的文件
3>参数onerror的默认值是"None",表示忽略文件遍历时产生的错误.如果不为空,则提供一个自定义函数提示错误信息后继续遍历或抛出异常中止遍历
4>该函数返回一个元组,该元组有3个元素,这3个元素分别表示每次遍历的路径名,目录列表和文件列表
os,walk()实例:
import os
def VisitDir(path):
for root,dirs,files in os.walk(path):
for filespath in files:
print os.path.join(root,filespath)
if __name__=="__main__":
path="/root"
VisitDir(path)
os.path.walk()
函数声明:walk(top,func,arg)
1>参数top表示需要遍历的目录树的路径
2>参数func表示回调函数,对遍历路径进行处理.所谓回调函数,是作为某个函数的参数使用,当某个时间触发时,程序将调用定义好的回调函数处理某个任务.回调函数必须提供3个参数:第1个参数为walk()的参数tag,第2个参数表示目录列表,第3个参数表示文件列表
3>参数arg是传递给回调参数func的元组.回调函数的一个参数必须是arg,为回调函数提供处理参数.参数arg可以为空
os.path.walk()实例:
import os,os.path
def VisitDir(arg,dirname,names):
for filespath in name:
print os.path.join(dirname,filespath)
if __name__=="__main__":
path="/root"
os.path.walk(path,VisitDir,())
os.path.walk()与os.walk()产生的文件名列表并不相同.os.path.walk()产生目录树下的目录路径和文件路径,而os.walk()只产生文件路径
如下面的例程:
1 # -*- coding: utf-8 -*-
2 import os
3 for root, dirs, files in os.walk('/media/cdrom0'):
4 open('mycd.cdc', 'a').write("%s %s %s" % (root,dirs,files))
完成的功能是讲/media/cdrom0下的目录文件写入到mycd.cdc中。
代码解释:
1. 声明是 utf-8 编码文本;

2. 引入了 os 模块;

3. 使用os.walk() 扫描光盘,并返回三个对象;

4. 使用open()打开mycd.cdc 文件对象,并声明成追加模式,逐行记录以上三个对象。

posted @ 2012-07-12 23:54 Enic 阅读(423) | 评论 (0)编辑 收藏

    很久以前就知道emacs在Linux上的默认路径是×××默认名字是.emacs;

    但是Windows上折腾起来就很麻烦,首先是自己手动傻逼的去创建.emacs无法创建,然后一阵百度谷歌知道名字叫_emacs了突然发现,还是没用,,,继续一阵搜索什么该注册表啊什么的都来了,,,

 

    今天介绍一种简单的找默认配置文件路径的办法:

1)启动emacs

2)单击options菜单 –> 单击下拉中的 “Active Region H,,,”

3)单击options菜单 –> 单击下拉中的 “Save Options”

4)恩,现在你应该能看到配置文件路径了,,,下面命令或者说叫状态栏?就会显示了

 

 

 

S2:

VBYXILFEX_{21L[MSU6W213

S3:

image

S4:

image

posted @ 2012-07-04 23:13 Enic 阅读(594) | 评论 (0)编辑 收藏

官方文档:

FTP Custom Commands

Not all protocols are HTTP-like, and thus the above may not help you when you want to make, for example, your FTP transfers to behave differently.

Sending custom commands to a FTP server means that you need to send the commands exactly as the FTP server expects them (RFC 959 is a good guide here), and you can only use commands that work on the control-connection alone. All kinds of commands that require data interchange and thus need a data-connection must be left to libcurl's own judgement. Also be aware that libcurl will do its very best to change directory to the target directory before doing any transfer, so if you change directory (with CWD or similar) you might confuse libcurl and then it might not attempt to transfer the file in the correct remote directory.

A little example that deletes a given file before an operation:

headers = curl_slist_append(headers, "DELE file-to-remove");

/* pass the list of custom commands to the handle */  curl_easy_setopt(easyhandle, CURLOPT_QUOTE, headers);

curl_easy_perform(easyhandle); /* transfer ftp data! */

curl_slist_free_all(headers); /* free the header list */

If you would instead want this operation (or chain of operations) to happen _after_ the data transfer took place the option to curl_easy_setopt(3) would instead be called CURLOPT_POSTQUOTE and used the exact same way.

The custom FTP command will be issued to the server in the same order they are added to the list, and if a command gets an error code returned back from the server, no more commands will be issued and libcurl will bail out with an error code (CURLE_QUOTE_ERROR). Note that if you use CURLOPT_QUOTE to send commands before a transfer, no transfer will actually take place when a quote command has failed.

If you set the CURLOPT_HEADER to 1, you will tell libcurl to get information about the target file and output "headers" about it. The headers will be in "HTTP-style", looking like they do in HTTP.

The option to enable headers or to run custom FTP commands may be useful to combine with CURLOPT_NOBODY. If this option is set, no actual file content transfer will be performed.

FTP Custom CUSTOMREQUEST

If you do want to list the contents of a FTP directory using your own defined FTP command, CURLOPT_CUSTOMREQUEST will do just that. "NLST" is the default one for listing directories but you're free to pass in your idea of a good alternative.

 

中文:

FTP自定义命令

并不是所以的协议都像HTTP那样,通过消息头来告诉服务器如何处理请求。对于FTP,你就要使用另外的方式来处理。

发送自定义的命令到ftp服务器,意味着你发送的命令必须是能被ftp服务器理解的命令(FTP协议中定义的命令,参考rfc959)。

下面是一个简单的例子,在文件传输操作操作之前删除指定文件:

headers = curl_slist_append(headers, "DELE file-to-remove"); /* pass the list of custom commands to the handle */ curl_easy_setopt(easyhandle, CURLOPT_QUOTE, headers); //curl_easy_setopt(easyhandle, CURLOPT_POSTQUOTE, headers); // 在数据传输之后操行删除操作
curl_easy_perform(easyhandle); /* transfer ftp data! */ curl_slist_free_all(headers); /* free the header list */

FTP服务器执行命令的顺序,同这些命令被添加到列表中顺序是一致的。发往服务器的命令列表中,只要有一个命令执行失败,ftp服务器就会返回一个错误代码,此时libcurl将直接返回CURLE_QUOTE_ERROR,不再执行剩余的FTP命令。

将CURLOPT_HEADER设置为1,libcurl获取目标文件的信息,并以HTTP消息头的样式来输出消息头。

FTP自定义CUSTOMREQUEST

使用CURLOPT_CUSTOMREQUEST属性,可以向FTP服务器发送命令。”NLST”是ftp默认的列出文件列表的命令。 下面的代码用于列出FTP服务器上的文件列表:

int main(int argc, char **argv) { curl_global_init(CURL_GLOBAL_WIN32); CURL *easy_handle = curl_easy_init(); curl_easy_setopt(easy_handle, CURLOPT_URL, "ftp://127.0.0.1/");curl_easy_setopt(easy_handle, CURLOPT_CUSTOMREQUEST, "NLST");
curl_easy_perform(easy_handle); curl_easy_cleanup(easy_handle); curl_global_cleanup(); return 0; }
posted @ 2012-06-29 00:14 Enic 阅读(567) | 评论 (0)编辑 收藏

仅列出标题
共22页: First 14 15 16 17 18 19 20 21 22