2012年1月

小吞QQ空间(Qzone)日志备份工具

小吞QQ空间(Qzone)日志备份工具

小吞QQ空间(Qzone)日志备份工具是一款能够将指定QQ帐号的空间日志下载并导出为多种格式的软件。具有绿色、小巧、稳定、占用内存低等特点。如需卸载,删除即可,不给系统留下任何垃圾文件。

功能介绍

  1. 下载指定QQ号空间日志
  2. 支持日志附图下载
  3. 支持多种导出格式(TXT,HTML,CHM),其他格式陆续开发中...
  4. 支持设置导出的编码(UTF-8、GBK)
  5. 支持设置导出的顺序(正序、反序)
  6. 可以实现离线浏览日志、并不会出现在“最近访客”列表中

小吞QQ空间(Qzone)日志备份工具主界面

小吞QQ空间(Qzone)日志备份工具导出界面

软件信息

  • 软件语言:简体中文
  • 授权方式:免费软件
  • 文件大小:1MB
  • 操作系统要求:Windows XP/Vista/Windows 7

下载地址

QzoneBackup.zip

使用方法

  1. 点击本页面的“立即下载按钮”,下载到电脑的任意目录并解压缩
  2. 运行Qzone2WP.exe,打开软件主界面
  3. 点击“新增用户”,输入需要备份的QQ号
  4. 点击“下载”,软件开始下载日志和图片数据,等待一段时间,时间长短视日志数量来定
  5. “下载”完成后提示“下载成功”,点击“导出”,设置导出的文件类型、编码、顺序,点击“确定”即可

更新日志

Version 1.0 2012.01.29

  1. 第一版发布

Version 1.1 2012.02.05

  1. 修复下载非200图片提示“联网失败”错误
  2. 添加WORD导出功能

qzone api

列表:
http://b1.qzone.qq.com/cgi-bin/blognew/blog_output_titlelist2?uin=10000&vuin=10000&verbose=1&pos=0&num=15&sorttype=0&v=1&maxlen=68&bdm=b.qzone.qq.com&rand=0.11542812990956008&g_tk=1595358287&cate=&cateHex=&ref=qzone&v6=1
uin:被访问的Q号
vuin:访问的Q号
verbose:是否显示目录信息(cate_info)
pos:第一个的pos的offset
num:显示文章数量,1~100
sorttype:
0:pubtime desc排序 按发表时间由新到旧排序
1:replytime desc排序 按最新评论时间由新到旧排序
3:按最后修改时间由新到旧排序
4:按评论数目由多到少排序
v:1 隐藏abstract
v:2 显示abstract
bdm:b域名
rand:随机数
g_tk:?
cate:目录id
cateHex:目录hex字符串
ref:引用
v6:1 版本6

内容:
http://b1.qzone.qq.com/cgi-bin/blognew/blog_output_data?uin=10000&blogid=1325561159&styledm=ctc.qzonestyle.gtimg.cn&imgdm=ctc.qzs.qq.com&bdm=b.qzone.qq.com&mode=0&numperpage=15&blogseed=0.4479592749848962&property=GoRE×tamp=1325595249&dprefix=&g_tk=5381&ref=qzone&v6=1
blogid:文章id
styledm:样式表域名
imgdm:图片域名
bdm:b域名
mode:?
numperpage:每页数量
blogseed:随机输
property:GoRE
timestamp:时间戳
dprefix:
g_tk:?
ref:引用
v6: 版本6

标题128
内容:153600

Debug Assertion Failed! f:\sp\vctools\vc7libs\ship\atlmfc\src\mfc\dlgdata.cpp Line: 42

Debug Assertion Failed! f:\sp\vctools\vc7libs\ship\atlmfc\src\mfc\dlgdata.cpp Line: 42

---------------------------
Microsoft Visual C++ Debug Library
---------------------------
Debug Assertion Failed!

Program: d:\dev\debug\Qzone2WP.exe
File: f:\sp\vctools\vc7libs\ship\atlmfc\src\mfc\dlgdata.cpp
Line: 42

For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.

(Press Retry to debug the application)
---------------------------
终止(A)   重试(R)   忽略(I)   
---------------------------

打开mfc源代码文件dlgdata.cpp 报错的那个一行:

HWND CDataExchange::PrepareCtrl(int nIDC)
{
    ASSERT(nIDC != 0);
    ASSERT(nIDC != -1); // not allowed
    HWND hWndCtrl;
    m_pDlgWnd->GetDlgItem(nIDC, &hWndCtrl);
    if (hWndCtrl == NULL)
    {
        TRACE1("Error: no data exchange control with ID 0x%04X.\n", nIDC);
        ASSERT(FALSE);
        AfxThrowNotSupportedException();
    }
    m_hWndLastControl = hWndCtrl;
    m_bEditLastControl = FALSE; // not an edit item by default
    ASSERT(hWndCtrl != NULL);   // never return NULL handle
    return hWndCtrl;
}

DebugView里面报错:

[6932] Error: no data exchange control with ID 0x0400. 

果然ID为0x400(1024)的控件用了DDX,没有删除关联变量的情况下,在界面删除了控件

问题的原因是在界面上删除了相应的Control,但是没有删掉相应的DDV

void CQzone2WPDlg::DoDataExchange(CDataExchange* pDX)
{
    CDialog::DoDataExchange(pDX);
    DDX_Control(pDX, IDC_USERLIST, m_userList); //delete this line!
}

How to store UTF-8 encoding data to sqlite3 using Visual C++

I've created a sqlite database with encoding UTF-8(default).

Then I use the following statement to insert data:

strcpy(sql,"insert into blog(title) values('呵呵')");
sqlite3_exec(db,sql,0,0,0);

then I open the sqlite database with tool called SQLite Developer the value of title field shows ºǺ� garbage code under Data encoding:UNICODE. then I changed Data encoding to ANSI, value of title shows right.

As I know the sqlite3_exec prototype is :

int sqlite3_exec(
  sqlite3*,                                  /* An open database */
  const char *sql,                           /* SQL to be evaluated */
  int (*callback)(void*,int,char**,char**),  /* Callback function */
  void *,                                    /* 1st argument to callback */
  char **errmsg                              /* Error msg written here */
);

I still try to pass wchar_t type to sql,but still won't work it out.

My Visual C++ project already defined UNOCODE & _UNICODE, So my question is: how to store UTF-8 encoding data to sqlite3 using Visual C++?


Update(question solved)

I use iconv to convert GBK encoding to UTF-8 inspired by msandiford. Thanks msandiford so much.

char* pOut;
char* pIn;
size_t inLen,outLen=2000;
strcpy(sql,"insert into blog(title) values('呵呵')");
string strSQL = sql;
char* sql2 = (char*)malloc(2000);
memset(sql2,0,2000);
pOut = &sql2[0];
inLen = strlen(strSQL.c_str());
pIn = const_cast<char*>(strSQL.c_str());
iconv_t g2u8 = iconv_open("UTF-8","GBK");
iconv(g2u8,(const char**)&pIn,&inLen,&pOut,&outLen);
sqlite3_exec(db,sql2,0,0,0);

Collecting comments into answer form:

From the question comments, apparently the source files are not encoded in UTF-8. Converting to UTF-8 or using the UTF-8 encoding directly seems to work.

Using UTF-8 encoding directly:

strcpy(sql,"insert into blog (title) values ('\xE5\x91\xB5\xE5\x91\xB5')");


You could avoid having to convert all your source files to UTF-8 by doing something like this:

sprintf(sql, "insert into blog (title) values('%s')", AnsiToUtf8("呵呵"));

Unfortunately the AnsiToUtf8() function is going to be pretty platform specific.


Looking further into this, it appears that Visual Studio saves source files in the default encoding for your Windows locale settings. Based on this, there could potentially be an assortment of encodings if your dev team's computers are set up for different locales.

I think it would be quite difficult, if not impossible, to implement an AnsiToUtf8() function that would cope in all the possible cases, especially given that the locale settings for the computer that the code is developed on may not be the same as the computer that ultimately runs the code.

I think the cleanest way to resolve this would be to use UTF-8 encoding uniformly in source files, assuming you want to use code points in string literals outside the areas where the default encoding and Unicode overlap.

Another way would be to internationalise the code so that the source files did not contain extended characters, and use something like GNU gettext or similar to handle translations.

via http://stackoverflow.com/questions/8753812/how-to-store-utf-8-encoding-data-to-sqlite3-using-visual-c

CMake编译pcrecpp静态库

  1. 下载并安装CMake(2.8.6),解压pcre(最新版本8.21)。

  2. 打开CMake GUI,指定"where is the source code:"到D:/dev/pcre-8.21,指定"where to build the binaries:"到D:/dev/pcre-8.21/out,点Configure,然后有很多配置,如果需要支持Unicode,勾选 PCRE_SUPPORT_UNICODE_PROPERTIESPCRE_SUPPORT_UTF8 ,支持Unicode就不能同时勾选PCRE_EBCDIC,然后点Generate

  3. 进入D:\dev\pcre-8.21\out打开PCRE.sln。如果你的project定义了/D "UNICODE",那么pcrecpp项目也需要这样定义。两者的运行时库也要保持一致(比如都是/MDd)。右击项目,生成。

  4. 在项目中引用生成的pcrecppd.lib和pcred.lib(这个也是需要的,否则链接报错),并加上头文件。

    include <pcrecpp.h>
    pragma comment(lib,"pcred.lib")
    pragma comment(lib,"pcrecppd.lib")
  5. 在项目“于处理器定义”中加上PCRE_STATIC

  6. Over.