关于apache Alias斜杠/的实验

Alias /icons/ "D:/wamp/bin/apache/Apache2.2.17/icons/"

访问http://localhost/icons/正常,访问http://localhost/icons 404

Alias /icons "D:/wamp/bin/apache/Apache2.2.17/icons"

访问http://localhost/icons自动加上后面的/,正常。

Alias /icons "D:/wamp/bin/apache/Apache2.2.17/icons/"

访问http://localhost/icons自动加上后面的/,正常。

Alias /icons/ "D:/wamp/bin/apache/Apache2.2.17/icons"

访问http://localhost/icons/xx.gif,404,访问http://localhost/icons 404 Not Found。

所以结论是Alias后面的虚拟路径后面不要加多余的/,后面的文件系统路径加不加/就随便你了。

Tagged | Leave a comment

vs2005 未能完成操作。未指定的错误

具体解决过程是这样的:

        1、先把.vcproj 文件剪切到其他地方

        2、打开.sln,报错-》点“确定”-》再点“确定”

        3、把 .vcproj 文件 放回来,在vs2008右边的“解决方案”处右键 重新加载,就可以了。

Tagged | Leave a comment

VC编译curl 7.19.0

打开curl-7.19.0\vc6curl.dsw F7编译。报错:

D:\win32dev\curl-7.19.0\lib\ldap.c(49) : fatal error C1189: #error :  Your Platform SDK is NOT sufficient for LDAP support! Update your Platform SDK, or disable LDAP LDAP support!

如果不需要编译出来的libcurl.lib支持LDAP,在VC菜单Project->Settings->c/c++->Preprocessor definitions加上:CURL_DISABLE_LDAP

在vc2005下一切正常。无需添加这个CURL_DISABLE_LDAP。

用nmake编译curl 7.24.0

D:\dev\curl-7.24.0\winbuild>nmake /f Makefile.vc mode=static VC=6 USE_SSPI=no US E_IPV6=no USE_IDN=no GEN_PDB=no DEBUG=yes

其中有一个比较坑爹的地方,就是一个编译选项本来是USE_SSPI,结果makefile.vc里面帮助写的是USE_SSSPI,多了一个S


D:\dev\curl-7.24.0\winbuild>nmake /f Makefile.vc

Microsoft (R) 程序维护实用工具 8.00.50727.762 版
版权所有 (C) Microsoft Corporation。保留所有权利。

Invalid mode:
Usage: nmake /f makefile.vc mode=<static or dll> <options>
where <options> is one or many of:
VC=<6,7,8,9,10>              - VC versions
WITH_DEVEL=<path>            - Paths for the development files (SSL, zlib, etc.)

Default to sibbling directory deps: ../deps
Libraries can be fetched at http://pecl2.php.net/downloads/php-windows-builds/
Uncompress them into the deps folder.
WITH_SSL=<dll or static>     - Enable OpenSSL support, DLL or static
WITH_ZLIB=<dll or static>    - Enable ZLib support, DLL or static
WITH_SSH2=<dll or static>    - Enable LIbSSH2 support, DLL or static
USE_SSSPI=<yes or no>        - Enable SSPI support, default to yes
ENABLE_IPV6=<yes or no>         - Enable IPV6, default to yes
DEBUG=<yes or no>            - Debug builds
ENABLE_IDN=<yes or no>          - Wheter or not to use IDN Windows APIs. Require
s Windows Vista or later.
or to install http://www.microsoft.com/downloads/details.aspx?FamilyID=AD6158D7-
DDBA-416A-9109-07607425A815
GEN_PDB=<yes or no>          - Generate Program Database (debug symbols release
build)
Makefile.vc(32) : fatal error U1050: please choose a valid mode
Stop.
Tagged , | Leave a comment

WSAETIMEDOUT&WSAECONNREFUSED

WSAETIMEDOUT
10060

 

Connection timed out.

A connection attempt failed because the connected party did not properly respond after a period of time, or the established connection failed because the connected host has failed to respond.

WSAECONNREFUSED
10061

 

Connection refused.

No connection could be made because the target computer actively refused it. This usually results from trying to connect to a service that is inactive on the foreign host—that is, one with no server application running.

int i = connect(sck,(LPSOCKADDR)&serverInfo,sizeof(struct sockaddr));

之后,i返回-1(0xffffffff),WSAGetLastError发现错误是WSAETIMEDOUT,用网页访问发现原来服务器ip是网通的,而哥牵的是电信,ping不通也打不开网页。到了公司之后错误成了WSAECONNREFUSED。后查看代码发现这句:

serverInfo.sin_port = htons(8080);

而请求的端口应该是8088。= =#。

Tagged , , | Leave a comment

Google Maps JavaScript API v3 dblclick双击事件冒泡

After registering e.g. a dblclick handler on a Rectangle, how do I 
prevent that event from triggering another handler as well (e.g. map 
zoom)? 

google.maps.event.addListener(area, 'dblclick', function(event) { 
// do something, but don't zoom in! 
}); 

在地图上双击后会触发zoom in。

那么如何停止触发zoom in呢,可以让MapOptions对象的disableDoubleClickZoom设置为true。

但是我们有时候需要双击zoom in,有时候又不需要呢?这个问题已经提交到了gmaps-api-issues的issues里面,不过我的方法是在函数体内写一段错误的js代码。比如某一个不存在的对象的方法。something.method();

Tagged | Leave a comment

feedsky种子换地址了

http://feed.feedsky.com/it_trans 转到 http://feed.feedsky.com/techguru

因为更容易记住,并且feedsky手动ping完全没有效果,说的是几分钟内生效,但是等了一下午还是没反应。我只是想删除应该加密的日志而已。但是feedburner立刻就ping完就生效了。并且我有一个07年新建的feed种子现在尽然无法管理了,点击直接返回【我的feed】页面。太奇怪了。太无语了。已经反馈给feedsky。很多订阅的it_trans的朋友,我表示抱歉。这次估计你们在feed reader里面也看不到了,因为我先斩后奏已经转到了techguru。算是重新开始一段新的旅程吧。

最后,两个feed地址:

http://feeds.feedburner.com/techgurucn (墙外)

http://feed.feedsky.com/techguru (墙内)

update(2012.01.06) 两个(fb/fs)的feed种子都删除了,还是用tunps.com/feed吧

Tagged | Leave a comment

reading 2011.11

程序员们 不要想一辈子靠技术混饭吃(很多转载,自己搜)

天朝人民实用技术知识大全 (怎么坐飞机,怎么坐月子…太tmd的实用了)

《看客》第117期:山城“贫民窟”

《看客》第116期:人在“堵”途

Using libcurl with SSH support in Visual Studio 2008

Using libcurl in Visual Studio

将中文版VC转换为英文版的方法

什么是far、near关键字?

科索沃战争

Easter Eggs in Captain America

南斯拉夫

《看客》第111期:“犹太方舟”以色列

Tagged | Leave a comment

warning C4018: “<”: 有符号/无符号不匹配

一般是int和unsigned比较的时候报错。转为一致的数据类型即可。

比如

int sent = 0;
while (sent<strlen(query)) 
{
    //....
}
strlen的返回值是size_t,也就是unsigned。而sent为int。将sent改为unsigned
Tagged | Leave a comment

转换字符串为16进制int /转换json \uXXXX码为可识别的中文 [C语言]

#include <stdio.h>
int i;
char *str1 =  "cdef";
sscanf(str1,"%x",&i);
printf("%x\n",i);

str1是需要转换成16进制int型的字符串。最后将”cdef”转为0xcdef。

有些人问这个有什么鸟用呢。

其实总所周知javascript object notation表示cjk字符串的形式是:\uXXXX,XX都是0~15(0~F)的数字。

使用如下代码:

DWORD dwNum;
WCHAR str[10]={0};
char str2[10]={0};
str[0] = 0x751f;//生
str[1] = 0x65e5;//日
str[2] = 0x5feb;//快
str[3] = 0x4e50;//乐
str[4] = 0x0001;//
dwNum = WideCharToMultiByte(CP_OEMCP,0,(LPCWSTR)str,-1,NULL,0,NULL,FALSE);
WideCharToMultiByte (CP_OEMCP,0,(LPCWSTR)str,-1,str2,dwNum,NULL,FALSE);
printf("%s",str2);

如果要生成unicode表(0×0000~0xFFFF),可以使用以下代码:

#include <windows.h>
#include <stdio.h>
void main()
{	
	DWORD dwNum;
	char str2[10];
	int i;
	WCHAR str[100];
	FILE *fp;
	ZeroMemory(str,0xf);
	fp = fopen("c:\\ansi.txt","w+");
	for(i=0;i<0xffff;i++)
	{
		*str=i;
		
		dwNum = WideCharToMultiByte(CP_OEMCP,0,(LPCWSTR)str,-1,NULL,0,NULL,FALSE);
		WideCharToMultiByte (CP_OEMCP,0,(LPCWSTR)str,-1,str2,dwNum,NULL,FALSE);
		fprintf(fp,"%s",str2);
	}
}

生成的ansi.txt大概有85kB:

如果直接fprintf str的话:

int i;
WCHAR str[100];
FILE *fp;
ZeroMemory(str,0xf);
fp = fopen("c:\\unicode.txt","w+");
for(i=0;i<0xffff;i++)
{
	*str=i;
	fprintf(fp,"%s",(LPCWSTR)str);
}

输出的unicode.txt大小128kB,有各国的文字,armania,阿拉伯,泰文之类的…

Tagged , , | Leave a comment

ckeditor for wordpress 3.6.2.1 HTML转义bug

blogging的时候添加代码喜欢用<pre>标签,然后c代码里面有很多的#include <stdio.h>之类的头文件引用。

在wysiwyg模式下输入<>后html模式下应该转义成&lt;和&gt;,但是这个bug直接转成了<>,当再切换到wysiwyg的时候,#include <stdio.h>已经变成了#include <stdio.h></stdio.h>。因为把<stdio.h>当成了一个html tag。

This bug has been reported a week ago in this post. michal_cksource (the author of ckeditor) said bug has been fixed, but it will be available in next release.:(

只能忍忍了,现在暂时用KindEditor.Everything is just fine.

Tagged | Leave a comment