Category Archives: Program

ubuntu下使用netcdf库

netcdf自身带了C++接口,可是按照例子,怎么也连接不了,最后发现是要加参数: g++ -lnetcdf_c++ -lnetcdf -o test *.cpp

Posted in Linux, Program | Tagged , , | Leave a comment

用PHP处理中文PDF

因项目需要,现在想在服务器端动态生成PDF文件,已一个PDF为模板,然后把所需的数据动态填入。 本来在使用zend framework,因此很直接的就使用zend_pdf类来进行测试,代码实现如下: $pdf = Zend_Pdf::load($this->view->config->offline->template); $pdf->pages = array_reverse($pdf->pages); $style = new Zend_Pdf_Style(); $font = Zend_Pdf_Font::fontWithPath($this->view->config->offline->font, ( Zend_Pdf_Font::EMBED_DONT_SUBSET)); $pdf->pages[0]->setFont($font, 10); $pdf->pages[0]->saveGS(); //datalist $pdf->pages[0]->drawText(str_replace(“;”,”\n”,$datalist), 100, 570,”UTF-8″); //project $pdf->pages[0]->drawText($formData['project'], 100, 430,”UTF-8″); $pdf->pages[0]->drawText($formData['realname'], 100, 78,”UTF-8″); $pdf->pages[0]->drawText($formData['realname'], 130, 590,”UTF-8″); $pdf->pages[0]->drawText($formData['unit'], 95, 58,”UTF-8″); $pdf->pages[0]->drawText($formData['address'], 285, … Continue reading

Posted in Program | Tagged , , , , , , | 1 Comment

c++的类模板

c++的类模板中有一些要注意的地方: 1、除非编译器实现了export关键字,否则将模板成员函数放置在一个独立的实现文件中将无法运行。(在GCC中,就是无法连接,编译可以通过) 因为模板不是函数,它们不能单独编译。模板必须与特定的模板实例化请求一起使用。 2、在类模板的操作符重载的友元函数中,要先声明,如

Posted in Program | Tagged , , , | Leave a comment

C# 2008:From Novice to Professional

Apress.Beginning.C.Sharp.2008.From.Novice.to.Professional.Nov.2007 书名:《C# 2008:From Novice to Professional》 作者:Christian Gross (Author) 出版商:Apress 发行日期:2007年11月 语言:英语 ISBN-10/ISBN-13:1590598695/978-1590598696 http://www.amazon.com/exec/obidos/tg/detail/-/1590598695/ 粗看了一遍,介绍的比较全面,感觉不是很深入。

Posted in Program | Tagged , , | Leave a comment

php5中的basename函数问题

因为phpbb3中上传中文文件的时候会产生文件名丢失的问题,经过一番搜索后,发现是PHP5的问题。 phpbbchina给出了解决方案。 PHP5中的相关BUG见BUG。 看样子,要在PHP6中才能解决此问题。

Posted in Program | Tagged , , , | Leave a comment

生成UUID/GUID

php的生成办法: <?php class System { function currentTimeMillis() { list($usec, $sec) = explode(” “,microtime()); return $sec.substr($usec, 2, 3); } } class NetAddress { var $Name = ‘localhost’; var $IP = ’127.0.0.1′; function getLocalHost() // static { $address = new NetAddress(); $address->Name … Continue reading

Posted in Program | Tagged , , , , | 1 Comment

c++中如何创建目录

c++中读写文件直接使用fstream就可以操作,但如何对目录进行操作? 一番搜索下来后,发现std库并不能处理目录的操作,需要使用额外库来进行操作。 windows平台下: #include <windows.h> CreateDirectory (char *DirName, SECURITY_ATTRIBUTES Attribs); linux平台下: #include <sys/stat.h> mkdir (const char *path, mode_t mode); 一个例子: #include <sys/types.h> #include <sys/stat.h> int status; … status = mkdir(“/home/cnd/mod1″, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); 还可以使用boost的跨平台方案: #include “boost/filesystem.hpp” … Continue reading

Posted in Program | Tagged , , | Leave a comment

msnconvert 0.2 版本发布

在msnconvet 0.1版本的基础添加了如下功能: 1 添加msnlogtest和pidgintest测试程序。 msnlogtest可以对一个MSN的聊天记录XML进行解析并进行显示。 pidgintest可以对pidgin的blist.xml文件进行解析和显示。 2 使用permit信息进行额外的判断。当contacts无法找到对应的信息时,再使用permit信息进行二次的判断。 3 实现了结果的输出显示。 4 添加了-a\-b参数,分别指定account\buddy。就是说,可以在指定logfile后再继续指定你的msn帐号以及对应聊天记录的好友帐号。 msnconver 0.2 source code msnconvert 0.2 binary for ubuntu gutsy

Posted in Linux, Program | Tagged , , | 1 Comment

使用branch的策略

在开发过程中,开始可以直接使用trunk进行开发,每到发布一个新版本时候,就拷贝到tags里。但随着系统的复杂化,特性的增加,模块的增多,系统越来越复杂,这个时候,为了系统的稳定性考虑,就可以考虑使用branch来进行开发。每增加一个新特性,首先在branch里进行,当稳定性达到一定程度后,就可以合并到trunk。 这个是由QGIS的开发者提出来的一个策略: Initial announcement on mailing list Before starting, make an announcement on the developer mailing list to see if another developerm is already working on the same feature. Also contact the technical advisor of the project steering committee (PSC). … Continue reading

Posted in Program | Tagged , | Leave a comment

confuse with treeview’s mouse click event and drag event

Using Gtk::TreeView in my code, get confused with the mouse click event and drag event. What I am expected is that: press the mouse, begin the drag event, release the mouse begin click event. But I get this: press the … Continue reading

Posted in Linux, Program | Tagged , , , , | 2 Comments