2009年6月28日星期日

gps初步:ozi/smartcomgps

参考了一下丁丁关于gps的扫盲贴,将一些语焉不详或者需要的心得的地方记下来放在这里。

1:手机导航软件和外置模块
当前我的N78安了一个凯得利的破解导航软件,但功能非常有限,就只能标出你当前位置而已,与smartcomgps相比,少了存储航迹和导入航线等功能,无法做到和网上已有航线共享,它的好处就是内置了一个gps,不需要外部gps模块,但搜索卫星之类的都非常之慢,肯定是要被淘汰的。

smartcomgps在上面那篇文章中有下载链接,是破解版,但还需要一个证书。smartcomgsp应该是需要一个外部的gps模块,用手机测试了下,发现N78自带的gps也能使用。关于gps的硬件模块,丁丁的blog里面有好些文章,总结来说就是芯片分为两种类型:sirf III和mtk II,推荐使用mtk II的模块,淘宝上面几百可以买到。

2:ozi软件
ozi软件可以用来导入手机gps生成的航迹文件,文件后缀名为.plt(point of track)和wpt(waypoint),在ozi explorer的load from file里面可以找到对应的选项。在ozi的save to file里面还有export to google earth的选项,可以导出为google earth 的kml文件。

就写这么多了,等我去整一个gps模块看看对应的效果再说。

Posted via web from redicaps's posterous

2009年6月21日星期日

Net::Douban and XML parse in Perl

If anybody is interested, I am trying to write a Perl module for douban.com. This site has its own API for the user interface, and many people have wrote the client package for this API with languages including Python/Ruby/Java/Php,you can find them at "http://www.douban.com/group/dbapi/" and the API documents at "http://www.douban.com/group/dbapi/".
I have created a repository at github.com, the url is "http://github.com/woosley/Perl-Net-Douban/tree/master". Right now it has a little code pushed to the repository, please feel free to fork and contribute some code.

What I want to say here is I can not find any module suitable for parse Atom and GData format XML at "search.cpan.org". Java/Ruby/Python have Google's GDate package support, but Perl dosen't. Maybe XML::Feed/XML::FeedPP/XMl::TreePP can be used to parse Atom, but the documentation really sucks.

So I spent my day at "search.cpan.org" tring to find some XML module support for XPath. Two choices:
XML::XPath
XML::LibXML

The document for XML::LibXML sucks too. However, it is recommended by most of the Perl hackers because it is more powerful, more efficient and better maintained compared with XML::XPath.

Here is the code I used at first

my $xml = XML::LibXML->new->parse_string( $string);
my @nodeset = $xml->find('//entry');
print Dumper @nodeset;

This dose not work. The story is that you can’t match on the default namespace in XPath. Element names without a prefix always match the null namespace, not the default namespace if it happens to be associated with a URI. So you need another Module:
XML::LibXML::XPathContext;
here is the code:

my $node = XML::LibXML->new->parse_string($string);
my $xml = XML::LibXML::XPathContext->new( $node);
$xml->registerNs('atom','http://www.w3.org/2005/Atom');
my @nodeset = $xml->findnodes('//atom:entry');
print $xml->findvalue('.//atom:id',$nodeset[0]);

2009年6月17日星期三

在路上

太阳啊
我不喜欢你长长的胡须
以及藏在你胡须里面的白昼
于是我用云朵将他们点燃
点燃我的帽子
晚霞便是那些灰烬

在黑夜我总是忧伤
我能看到狮子在哭泣
我行走的心在哭泣
这旅途像黄土高原一样贫瘠?
我试图阅读星辰的思想
却总是得到太阳的嘲笑
或许这黑夜只是掩盖白昼的破碎毛毯

我命令风
告诉我答案
尽头,深渊在何处!

精灵从石头里面跳出
这些纤细的长耳朵的虫子
他们不是藏在太阳的胡须里
那在哪?

风说
前行何其遥远
而堕落却近在咫尺
流星啊
你为何将天空抛弃?
还是天空抛弃了你我

出师未捷身先死/长使英雄泪满襟

南京、成都、泸定

2009年6月1日星期一

list/杂项

南京-成都 中铺 460
和机票价格一样

1.95外胎 2*98 = 196
本来想用1.5的光头胎,被骑行群里面众将劝阻,路太烂,光头胎不靠谱

16扳手 5
卸脚踏用15mm扳手,跑了5个五金店都没有这种型号,言曰此型号少用,遂用16号替代,还能用

骑行裤 99
冲锋裤 80

户外凉鞋 99
还是打折品,户外装备真贵啊

刹车片/补胎片、胶水 14
48块补胎片,看你能爆多少次胎!!

补胎锉刀 修车师傅赞助 感谢ing
车首包 金师兄赞助
货架 陈师兄赞助
驼包 红木木赞助
药物 红木木赞助一部分

今天又称了下行李:12公斤不算重
体重 67.5公斤,看看回来能瘦到何种程度。

上个川藏线海拔图