c++ 学习笔记

1. Never Return a Pointer to a Local Object 2. Function Declarations Go in Header Files It may be temptingand would be legalto put a function declaration directly in each source file that uses the function. The problem with this approach is that it is tedious and error-prone. By putting function declarations into header files, … Read more

编绎gd-2.0.35出错

  $./configure $./make 用上面的命令出现了下面的错误: configure.ac:64: error: possibly undefined macro: AM_ICONV       If this token and others are legitimate, please use m4_pattern_allow.       See the Autoconf documentation. make: *** [configure] Error 1 解决方法, 用下面的命令: ./configure –enable-m4_pattern_allow ./make

Useful PHP Command line options

  Usage: php [options] [-f] <file> [–] [args…] php [options] -r <code> [–] [args…] php [options] [-B <begin_code>] -R <code> [-E <end_code>] [–] [args…] php [options] [-B <begin_code>] -F <file> [-E <end_code>] [–] [args…] php [options] — [args…] php [options] -a -a Run interactively -c <path>|<file> Look for php.ini file in this directory -n No … Read more

const Objects Are Local to a File By Default

When we define a nonconst variable at global scope, it is accessible throughout the program. We can define a nonconst variable in one file andassuming an appropriate declaration has been madecan use that variable in another file: // file_1.cc int counter; // definition // file_2.cc extern int counter; // uses counter from file_1 ++counter; // … Read more

FTP命令

FTP命令是Internet用户使用最频繁的命令之一,不论是在DOS还是UNIX操作系统下使用FTP,都会遇到大量的FTP内部命令。熟悉并灵活应用FTP的内部命令,可以大大方便使用者,并收到事半功倍之效。 FTP的命令行格式为:ftp -v -d -i -n -g [主机名],其中 -v显示远程服务器的所有响应信息; -n限制ftp的自动登录,即不使用; .n etrc文件; -d使用调试方式; -g取消全局文件名。 ftp使用的内部命令如下(中括号表示可选项): 1.![cmd[args]]:在本地机中执行交互shell,exit回到ftp环境,如:!ls*.zip. 2.$ macro-ame[args]:执行宏定义macro-name. 3.account[password]:提供登录远程系统成功后访问系统资源所需的补充口令。 4.append local-file[remote-file]:将本地文件追加到远程系统主机,若未指定远程系统文件名,则使用本地文件名。 5.ascii:使用ascii类型传输方式。 6.bell:每个命令执行完毕后计算机响铃一次。 7.bin:使用二进制文件传输方式。 8.bye:退出ftp会话过程。 9.case:在使用mget时,将远程主机文件名中的大写转为小写字母。 10.cd remote-dir:进入远程主机目录。 11.cdup:进入远程主机目录的父目录。 12.chmod mode file-name:将远程主机文件file-name的存取方式设置为mode,如:chmod 777 a.out。 13.close:中断与远程服务器的ftp会话(与open对应)。 14.cr:使用asscii方式传输文件时,将回车换行转换为回行。 15.delete remote-file:删除远程主机文件。 16.debug[debug-value]:设置调试方式,显示发送至远程主机的每条命令,如:deb up 3,若设为0,表示取消debug。 17.dir[remote-dir][local-file]:显示远程主机目录,并将结果存入本地文件local-file。 18.disconnection:同close。 19.form format:将文件传输方式设置为format,缺省为file方式。 20.get remote-file[local-file]:将远程主机的文件remote-file传至本地硬盘的local-file。 21.glob:设置mdelete,mget,mput的文件名扩展,缺省时不扩展文件名,同命令行的-g参数。 22.hash:每传输1024字节,显示一个hash符号(#)。 23.help[cmd]:显示ftp内部命令cmd的帮助信息,如:help get。 24.idle[seconds]:将远程服务器的休眠计时器设为[seconds]秒。 25.image:设置二进制传输方式(同binary)。 26.lcd[dir]:将本地工作目录切换至dir。 27.ls[remote-dir][local-file]:显示远程目录remote-dir,并存入本地文件local-file。 … Read more

对cakephp的几点疑惑和误解

由于开始对cakephp还不是很熟悉,所以在学的时候,对cakephp有了些疑惑和误解,现在终于明白了,现在列举如下: 1. cakephp通过Elements对view实现了模块化,使得代码得到了更好的重用,而且Elements还支持cache功能,一开始我认为Element(view)只能通过controller assign变量来动态显示信息,如果这样的话,那cache功能就没用了,因为不管Element有没有cache存在,controller都有要取得数据,然后assign到Element(view)里,其实不是这样的,Element(view)还可以通过requestAction方法取得数据。它的使用方式是: controller 代码: // controllers/comments_controller.php class CommentsController extends AppController { function latest() { return $this->Comment->find(‘all’, array(‘order’ => ‘Comment.created DESC’, ‘limit’ => 10)); } }   element 代码   // views/elements/latest_comments.ctp   $comments = $this->requestAction(‘/comments/latest’); foreach($comments as $comment) { echo $comment[‘Comment’][‘title’]; }   调用方式: echo $this->element(‘latest_comments’); 或支持cache方式 echo $this->element(‘latest_comments’, array(‘cache’=>’+1 hour’));   根据官方网站的说明,这种方式如果不使用cache的话,它的效率是很差的 2.     … Read more