密码保护:关于最近的一点想法

要查看留言请输入您的密码。
一月 17th, 2012 全部

这是一篇受密码保护的文章。您需要提供访问密码:


我收藏的科技博客

一月 16th, 2012 全部

http://thenextweb.com/

密码保护:近期发展计划

要查看留言请输入您的密码。
一月 15th, 2012 全部

这是一篇受密码保护的文章。您需要提供访问密码:


密码保护:某日与麦总的倾谈

要查看留言请输入您的密码。
一月 9th, 2012 全部

这是一篇受密码保护的文章。您需要提供访问密码:


常用中文字体的英文名

十一月 21st, 2011 技术
中文名 英文名 Unicode Unicode 2
Mac OS
华文细黑 STHeiti Light [STXihei] \534E\6587\7EC6\9ED1 华文细黑
华文黑体 STHeiti \534E\6587\9ED1\4F53 华文黑体
华文楷体 STKaiti \534E\6587\6977\4F53 华文楷体
华文宋体 STSong \534E\6587\5B8B\4F53 华文宋体
华文仿宋 STFangsong \534E\6587\4EFF\5B8B 华文仿宋
丽黑 Pro LiHei Pro Medium \4E3D\9ED1 Pro 丽黑 Pro
丽宋 Pro LiSong Pro Light \4E3D\5B8B Pro 丽宋 Pro
标楷体 BiauKai \6807\6977\4F53 标楷体
苹果丽中黑 Apple LiGothic Medium \82F9\679C\4E3D\4E2D\9ED1 苹果丽中黑
苹果丽细宋 Apple LiSung Light \82F9\679C\4E3D\7EC6\5B8B 苹果丽细宋
Windows
新细明体 PMingLiU \65B0\7EC6\660E\4F53 新细明体
细明体 MingLiU \7EC6\660E\4F53 细明体
标楷体 DFKai-SB \6807\6977\4F53 标楷体
黑体 SimHei \9ED1\4F53 黑体
宋体 SimSun \5B8B\4F53 宋体
新宋体 NSimSun \65B0\5B8B\4F53 新宋体
仿宋 FangSong \4EFF\5B8B 仿宋
楷体 KaiTi \6977\4F53 楷体
仿宋_GB2312 FangSong_GB2312 \4EFF\5B8B_GB2312 仿宋_GB2312
楷体_GB2312 KaiTi_GB2312 \6977\4F53_GB2312 楷体_GB2312
微软正黑体 Microsoft JhengHei \5FAE\x8F6F\6B63\9ED1\4F53 微软正黑体
微软雅黑 Microsoft YaHei \5FAE\8F6F\96C5\9ED1 微软雅黑
Office
隶书 LiSu \96B6\4E66 隶书
幼圆 YouYuan \5E7C\5706 幼圆
华文细黑 STXihei \534E\6587\7EC6\9ED1 华文细黑
华文楷体 STKaiti \534E\6587\6977\4F53 华文楷体
华文宋体 STSong \534E\6587\5B8B\4F53 华文宋体
华文中宋 STZhongsong \534E\6587\4E2D\5B8B 华文中宋
华文仿宋 STFangsong \534E\6587\4EFF\5B8B 华文仿宋
方正舒体 FZShuTi \65B9\6B63\8212\4F53 方正舒体
方正姚体 FZYaoti \65B9\6B63\59DA\4F53 方正姚体
华文彩云 STCaiyun \534E\6587\5F69\4E91 华文彩云
华文琥珀 STHupo \534E\6587\7425\73C0 华文琥珀
华文隶书 STLiti \534E\6587\96B6\4E66 华文隶书
华文行楷 STXingkai \534E\6587\884C\6977 华文行楷
华文新魏 STXinwei \534E\6587\65B0\9B4F 华文新魏

 

google site search

十一月 2nd, 2011 收藏

http://www.google.com/cse/manage/all

转:十五分钟介绍 Redis 数据结构

十一月 1st, 2011 技术, 数据库

http://www.oschina.net/question/54100_28977

Sphinx 安装备忘

十月 28th, 2011 技术, 数据库

以前装过一次sphinx,现在有了中文站coreseek,他们整合了中文分词,相对来说还是方便了不少,coreseek的包里除了sphinx以外还有mmseg和一个用于测试的代码包,安装还算顺利。
安装文档见这里

http://www.coreseek.cn/products-install/install_on_bsd_linux/

在安装sphinx php扩展的时候略微麻烦了一下,直接用pecl install sphinx不成功,说找不到libsphinxclient库,后来发现libsphinxclient就在coreseek-4.1-beta/testpack/api/libsphinxclient路径下,安装之。
然后还是不能用pecl方式安装,在这里 http://pecl.php.net/package/sphinx 下载了安装包,用phpize方式安装ok。

如不安装php扩展,在testpack目录里也有一php版本的sphinx class可以使用。

对于mysql的应用,先按提示修改好csft_mysql.conf里的相关参数
然后建索引
/usr/local/coreseek/bin/indexer -c etc/csft_mysql.conf –all
如果服务器已经启动,建索引是不能覆盖的,需要加入–rotate参数
/usr/local/coreseek/bin/indexer -c etc/csft_mysql.conf –all –rotate

启动服务
/usr/local/coreseek/bin/searchd -c etc/csft_mysql.conf
停止服务
/usr/local/coreseek/bin/searchd -c etc/csft_mysql.conf –stop

启动服务后,可用php进行查询。。

1
2
3
4
5
6
7
8
9
10
11
require_once ( "sphinxapi.php" );

$cl = new SphinxClient ();
$cl->SetServer ( '127.0.0.1', 9312);
$cl->SetConnectTimeout ( 3 );
$cl->SetArrayResult ( true );
$cl->SetMatchMode ( SPH_MATCH_ANY);
$res = $cl->Query ( '网络搜索', "*" );

print_r($cl);
print_r($res);

另外还有一些高级用法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//注意文件的编码格式需要保存为为UTF-8格式
require ( "sphinxapi.php" );

$cl = new SphinxClient ();
$cl->SetServer ( '127.0.0.1', 9312);
//以下设置用于返回数组形式的结果
$cl->SetArrayResult ( true );

/*
//ID的过滤
$cl->SetIDRange(3,4);

//sql_attr_uint等类型的属性字段,需要使用setFilter过滤,类似SQL的WHERE group_id=2
$cl->setFilter('group_id',array(2));

//sql_attr_uint等类型的属性字段,也可以设置过滤范围,类似SQL的WHERE group_id2>=6 AND group_id2<=8
$cl->SetFilterRange('group_id2',6,8);
*/


//取从头开始的前20条数据,0,20类似SQl语句的LIMIT 0,20
$cl->SetLimits(0,20);

//在做索引时,没有进行 sql_attr_类型 设置的字段,可以作为“搜索字符串”,进行全文搜索
$res = $cl->Query ( '搜索字符串', "*" );    //"*"表示在所有索引里面同时搜索,"索引名称(例如test或者test,test2)"则表示搜索指定的

//如果需要搜索指定全文字段的内容,可以使用扩展匹配模式:
//$cl->SetMatchMode(SPH_MATCH_EXTENDED);
//$res=cl->Query( '@title (测试)' , "*");
//$res=cl->Query( '@title (测试) @content ('网络')' , "*");


echo '<pre>';
print_r($res['matches']);
print_r($res);
print_r($cl->GetLastError());
print_r($cl->GetLastWarning());
echo '</pre>';

给字典加入新词
/usr/local/mmseg3/etc下有个unigram.txt文件
这个是字典的文本版本
加入新词需要加入两行,如
新浪微博 1
x:1
然后执行命令mmseg -u unigram.txt
将生成一个unigram.txt.lib文件,将etc目录里的uni.lib改名,并把这个文件改名为uni.lib,重新生成索引

详细一点的可以看这里

http://hi.baidu.com/cubeking/blog/item/9aedb7a67b5b95e29152ee5c.html

jQuery plugin

九月 22nd, 2011 Javascript/HTML5, 全部, 技术

http://docs.jquery.com/Plugins/Authoring

how to – 用php抓取iTunes Store的搜索结果

八月 6th, 2011 Cocoa, how to

从iTunes Store中copy出来的链接无法直接在浏览器中打开,google之,有人已经用php+curl做了相关工作,只要在http header中加上一个参数即可

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function htmlForiTunesStoreURL($path)
// Download and return the HTML for an iTunes Store page at the given URL.
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $path);
 
    // The following header is what causes the server to think we are iTunes.app.
    // This header in particular is for the China Store.
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-Apple-Store-Front: 143465-19,12'));
 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $html = curl_exec($ch);
 
    return trim($html);
}

其中X-Apple-Store-Front: 143465-19,12,143465是中国的iTunes Store代码,-19,12不知道什么意思,这是用截取http封包的工具截出来的,-19的位置是语言代码,但网上搜索不到中文代码是什么,也许就是19

以下是其他国家的代码:

United States 143441
Argentina 143505
Australia 143460
Belgium 143446
Brazil 143503
Canada 143455
Chile 143483
China 143465
Colombia 143501
Costa Rica 143495
Croatia 143494
Czech Republic 143489
Denmark 143458
Deutschland 143443
El Salvador 143506
Espana 143454
Finland 143447
France 143442
Greece 143448
Guatemala 143504
Hong Kong 143463
Hungary 143482
India 143467
Indonesia 143476
Ireland 143449
Israel 143491
Italia 143450
Korea 143466
Kuwait 143493
Lebanon 143497
Luxembourg 143451
Malaysia 143473
Mexico 143468
Nederland 143452
New Zealand 143461
Norway 143457
Osterreich 143445
Pakistan 143477
Panama 143485
Peru 143507
Phillipines 143474
Poland 143478
Portugal 143453
Qatar 143498
Romania 143487
Russia 143469
Saudi Arabia 143479
Schweitz/Suisse 143459
Singapore 143464
Slovakia 143496
Slovenia 143499
South Africa 143472
Sri Lanka 143486
Sweden 143456
Taiwan 143470
Thailand 143475
Turkey 143480
United Arab Emirates 143481
United Kingdom 143444
Venezuela 143502
Vietnam 143471
Japan 143462

关于第二位数字的解释
1: English
2: English (slightly different texts)
3: French
4: German
5: French (slightly different texts)

现在可以就可以正常获得数据了,如

1
2
3
echo htmlForiTunesStoreURL(
"http://ax.search.itunes.apple.com/WebObjects/MZSearch.woa/wa/advancedSearch?startIndex=180&entity=software&media=software&page=2&restrict=true&free=1&genreIndex=10"
);