Monday, December 29, 2008

compile htmlcxx 0.83 under windows xp windows编译htmlcxx

htmlcxx Version 0.83 xp sp3 VC2005 sp1

VC complains that parsersax.tcc missing "strings.h" which can't be included.
Searched mingw path, there is a "strings.h", but obviously, there isn't one in vc8.
Try compile htmlcxx 0.82, only one error was prompted.

>d:\libs\htmlcxx-0.83\html\utils.cc(17) : error C2001: newline in constant
>d:\libs\htmlcxx-0.83\html\utils.cc(18) : error C2144: syntax error : 'char' should be preceded by
';'
View this file with ecoding utf-8, the 17 line tells tells

const char*signature = "?";

But with cp936 encoding, this line turns into:

const char *signature = "锘?;

which leads to compile error.

Then, I compared parsersax.tcc in 0.83 and 0.82, only a few lines are different.


http://htmlcxx.cvs.sourceforge.net/viewvc/htmlcxx/htmlcxx/html/ParserSax.tcc?r1=1.4&r2=1.5







Then, I commented the include lines..

Later, I got a lib.

And, it could be used to compile htmlcxxapp app.

解决办法很简单,只要把那个报错的行给注释了就好了。这个头文件是linux才有的。windows vc没有。。

另外一个utils.cc文件,只要把行17 改成

const char *signature = "";

就好了。报错是因为原来的文件是utf编码。

Sunday, December 28, 2008

wxWidgets 类 关系图

缩略图如下

wxwidgets-all classes.png 

strftime() 函数将时间格式化

------------------
为什么会抄这篇呢,因为wxDateTime::Format()这个函数使用和它一致的格式,却没有提供详细的参数解释。
------------------
我们可以使用strftime()函数将时间格式化为我们想要的格式。它的原型如下:
size_t strftime(
char *strDest,
size_t maxsize,
const char *format,
const struct tm *timeptr
);

我们可以根据format指向字符串中格式命令把timeptr中保存的时间信息放在strDest指向的字符串中,最多向strDest中存放maxsize个字符。该函数返回向strDest指向的字符串中放置的字符数。
函数strftime()的操作有些类似于sprintf():识别以百分号(%)开始的格式命令集合,格式化输出结果放在一个字符串中。格式化命令说明串 strDest中各种日期和时间信息的确切表示方法。格式串中的其他字符原样放进串中。格式命令列在下面,它们是区分大小写的。
%a 星期几的简写
%A 星期几的全称
%b 月分的简写
%B 月份的全称
%c 标准的日期的时间串
%C 年份的后两位数字
%d 十进制表示的每月的第几天
%D 月/天/年
%e 在两字符域中,十进制表示的每月的第几天
%F 年-月-日
%g 年份的后两位数字,使用基于周的年
%G 年分,使用基于周的年
%h 简写的月份名
%H 24小时制的小时
%I 12小时制的小时
%j 十进制表示的每年的第几天
%m 十进制表示的月份
%M 十时制表示的分钟数
%n 新行符
%p 本地的AM或PM的等价显示
%r 12小时的时间
%R 显示小时和分钟:hh:mm
%S 十进制的秒数
%t 水平制表符
%T 显示时分秒:hh:mm:ss
%u 每周的第几天,星期一为第一天 (值从0到6,星期一为0)
%U 第年的第几周,把星期日做为第一天(值从0到53)
%V 每年的第几周,使用基于周的年
%w 十进制表示的星期几(值从0到6,星期天为0)
%W 每年的第几周,把星期一做为第一天(值从0到53)
%x 标准的日期串
%X 标准的时间串
%y 不带世纪的十进制年份(值从0到99)
%Y 带世纪部分的十制年份
%z,%Z 时区名称,如果不能得到时区名称则返回空字符。
%% 百分号

如果想显示现在是几点了,并以12小时制显示,就象下面这段程序:

#include "time.h"
#include "stdio.h"

int main(void)
{
struct tm *ptr;
time_t lt;
char str[80];
lt=time(NULL);
ptr=localtime(<);
strftime(str,100,"It is now %I %p",ptr);
printf(str);
return 0;
}

其运行结果为:
It is now 4PM

而下面的程序则显示当前的完整日期:

#include "time.h"
#include "stdio.h"

void main( void )
{
struct tm *newtime;
char tmpbuf[128];
time_t lt1;
time( <1 );
newtime=localtime(<1);
strftime( tmpbuf, 128, "Today is %A, day %d of %B in the year %Y.\n", newtime);
printf(tmpbuf);
}

运行结果:
Today is Saturday, day 30 of July in the year 2005.

Friday, April 18, 2008

wxWidgets Internationalization -- wx 国际化编程

wxWidgets国际化编程
Internationalization 俗称I18N 因为是I打头,N结尾,总共18个字母。或者也可以叫做本地化,Localization => L10n.

wxWidgets是通过wxLocale来提供语言翻译支持。具体实现请参考录像文件。

录像下载地址

纳米盘地址: internat.7z
录像文件压缩包 439KB 解压缩后35.8M。完整演示了使用poedit从cpp文件提取 _("") 生成po文件,然后自动使用相关的mo文件包来初始化窗体界面。

Technorati :  L10n Localization

Wednesday, April 2, 2008

wxWidgets编译命令行程序

VC2005编译wxWidgets过后,就可以使用wx来编写程序了。

一开始就写GUI程序可能比较麻烦,可以先从Console程序开始。

编写一个console程序,代码如下:

#include <wx/wx.h>
class App : public wxAppConsole {
public
:
bool OnInit();
int OnRun();
};
DECLARE_APP(App);
IMPLEMENT_APP_CONSOLE(App);
bool
App::OnInit(){
return true;
}
int App::OnRun(){
wxPuts( wxT("Hello you!") );
return EXIT_SUCCESS;
}

就可以编译完成了。嗯,OnRun函数一定要重载。

Saturday, January 12, 2008

[转载] Windows下架设Subversion服务器

作者:indian 版本:v1.1 修订:2007年12月25日2:24:53 出处: blog.kysf.net

版权:作者保留对本文的一切修改、发布等权力。任何人想要转载本文部分或全部内容时,必须保留包括作者、版本、修订、出处、版权,共五项信息。对本文的参考引用,则不受限制。