<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>LiangXu Wang &#187; Program</title>
	<atom:link href="http://wlx.westgis.ac.cn/category/computer/program/feed/" rel="self" type="application/rss+xml" />
	<link>http://wlx.westgis.ac.cn</link>
	<description>technology backup/share</description>
	<lastBuildDate>Sat, 14 Jan 2012 03:56:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>有意思的一篇文章：[译稿]为什么我们不要 .NET 程序员</title>
		<link>http://wlx.westgis.ac.cn/746/</link>
		<comments>http://wlx.westgis.ac.cn/746/#comments</comments>
		<pubDate>Wed, 21 Dec 2011 03:15:25 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Program]]></category>
		<category><![CDATA[.net]]></category>

		<guid isPermaLink="false">http://wlx.westgis.ac.cn/?p=746</guid>
		<description><![CDATA[文章地址：[译稿]为什么我们不要 .NET 程序员 有些观点我比较赞同： 用 .NET 进行编程就像是在麦当劳做烹饪。那里有全套神奇的设备能够自动的造出所有的东西。只有你按一下正确的按钮，跟着提示灯的指示，你就可以批量的制造出完美无缺的1.6盎司的汉堡，比地球上的任何其他人都要快。 然而，如果你想做出一个1.7盎司的汉堡，很抱歉，你做不到。很简单，没有这样的按钮。 馅饼是预先做成了那样的尺寸。它们做出来之后就被冷冻，所有你无法把它们揉到一起做成其它尺寸，解冻机和烹饪机是一体的，你没有办法在它们之间进行拦截。 麦当劳的厨房产出的食品精确的和麦当劳的菜单保持一致的——这种模式使你的大脑不需要任何的思考。可是，它不能偏离菜单，对烹饪机器的任何你妄想的压挤变 形都会导致它停止工作，而被送回返厂维修。]]></description>
			<content:encoded><![CDATA[<p>文章地址：<a href="http://www.cnbeta.com/articles/166297.htm">[译稿]为什么我们不要 .NET 程序员</a><br />
有些观点我比较赞同：</p>
<blockquote><p>用 .NET 进行编程就像是在麦当劳做烹饪。那里有全套神奇的设备能够自动的造出所有的东西。只有你按一下正确的按钮，跟着提示灯的指示，你就可以批量的制造出完美无缺的1.6盎司的汉堡，比地球上的任何其他人都要快。</p>
<p>然而，如果你想做出一个1.7盎司的汉堡，很抱歉，你做不到。很简单，没有这样的按钮。 馅饼是预先做成了那样的尺寸。它们做出来之后就被冷冻，所有你无法把它们揉到一起做成其它尺寸，解冻机和烹饪机是一体的，你没有办法在它们之间进行拦截。 麦当劳的厨房产出的食品精确的和麦当劳的菜单保持一致的——这种模式使你的大脑不需要任何的思考。可是，它不能偏离菜单，对烹饪机器的任何你妄想的压挤变 形都会导致它停止工作，而被送回返厂维修。</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/746/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ubuntu oneiric apache2.2 tomat7 mod_jk geonetwork</title>
		<link>http://wlx.westgis.ac.cn/741/</link>
		<comments>http://wlx.westgis.ac.cn/741/#comments</comments>
		<pubDate>Fri, 16 Dec 2011 06:24:07 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Program]]></category>
		<category><![CDATA[apache2]]></category>
		<category><![CDATA[geonetwork]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[mod_jk]]></category>
		<category><![CDATA[oneiric]]></category>
		<category><![CDATA[tomact7]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://wlx.westgis.ac.cn/?p=741</guid>
		<description><![CDATA[在一台新服务器上安装了ubuntu oneiric 11.10中安装apache2.2 tomcat7，现在想通过mod_jk把二者桥接起来。 1. 首先安装 sudo apt-get install tomcat7 apache2 libapache2-mod-jk 2. 修改workers.properties sudo nano /etc/libapache2-mod-jk/workers.properties 把其中一行： workers.tomcat_home=/usr/share/tomcat6 替换为： workers.tomcat_home=/usr/share/tomcat7 3. 配置tomcat7 sudo nano /etc/tomcat7/server.xml 把port 8009这行的默认注释给去掉： &#60;Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /&#62; 并添加host中添加自己的应用： &#60;Context path="/geonetwork" docBase="/var/www/xining/geonetwork/web/geonetwork/" crossContext="false" debug="0" reloadable="false" &#8230; <a href="http://wlx.westgis.ac.cn/741/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>在一台新服务器上安装了ubuntu oneiric 11.10中安装apache2.2 tomcat7，现在想通过mod_jk把二者桥接起来。<br />
1. 首先安装</p>
<blockquote><p>sudo apt-get install tomcat7 apache2 libapache2-mod-jk</p></blockquote>
<p>2. 修改workers.properties</p>
<blockquote><p>sudo nano /etc/libapache2-mod-jk/workers.properties</p></blockquote>
<p>把其中一行：</p>
<blockquote><p>workers.tomcat_home=/usr/share/tomcat6</p></blockquote>
<p>替换为：</p>
<blockquote><p>workers.tomcat_home=/usr/share/tomcat7</p></blockquote>
<p>3. 配置tomcat7</p>
<blockquote><p>sudo nano /etc/tomcat7/server.xml</p></blockquote>
<p>把port 8009这行的默认注释给去掉：</p>
<blockquote><p>
<code><br />
    &lt;Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /&gt;</code></p></blockquote>
<p>并添加host中添加自己的应用：</p>
<blockquote><p><code> &lt;Context path="/geonetwork"<br />
          docBase="/var/www/xining/geonetwork/web/geonetwork/"<br />
          crossContext="false"<br />
          debug="0"<br />
          reloadable="false" /&gt;</code></p></blockquote>
<p>4. 修改apache2 site配置</p>
<blockquote><p>sudo nano /etc/apache2/sites-enabled/xining</p></blockquote>
<p>在其中，添加：</p>
<blockquote><p>JkMount /geonetwork/* ajp13_worker<br />
JkMount /geonetwork ajp13_worker</p></blockquote>
<p>以让mod_jk生效。</p>
<p>5. 重启相关服务</p>
<blockquote><p>sudo service apache2 restart<br />
sudo service tomcat7 restart</p></blockquote>
<p>6. 安装sun-java6-jdk<br />
我们应用的GEONETWORK软件在使用默认的OPENJDK时会有错误产生，如不能登录、不能查询，因此需要安装SUN JDK。</p>
<blockquote><p>sudo apt-get install python-software-properties<br />
sudo add-apt-repository ppa:ferramroberto/java<br />
sudo apt-get update<br />
sudo apt-get install sun-java6-jdk<br />
sudo update-alternatives &#8211;config java  </p></blockquote>
<p>安装完成后，可以通过java -version命令确认：</p>
<blockquote><p>java version “1.6.0_26&#8243;<br />
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)<br />
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/741/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>bluefish 2.2.0发布了</title>
		<link>http://wlx.westgis.ac.cn/739/</link>
		<comments>http://wlx.westgis.ac.cn/739/#comments</comments>
		<pubDate>Thu, 15 Dec 2011 16:32:29 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Program]]></category>
		<category><![CDATA[bluefish]]></category>
		<category><![CDATA[gtk3]]></category>

		<guid isPermaLink="false">http://wlx.westgis.ac.cn/?p=739</guid>
		<description><![CDATA[bluefish是我现在进行php编程的ide工具，其最新版本2.2.0发布了，最大的变化是支持gtk-3了。 就是不知道什么时候ubuntu能有更新包出来，估计等不及就要自己编译了。]]></description>
			<content:encoded><![CDATA[<p>bluefish是我现在进行php编程的ide工具，其最新版本2.2.0发布了，最大的变化是支持gtk-3了。<a href="http://oli4444.wordpress.com/2011/11/27/bluefish-2-2-0-released/" title="bluefish 2.2.0 blog"></a><br />
就是不知道什么时候ubuntu能有更新包出来，估计等不及就要自己编译了。</p>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/739/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>postgresql中从多表中进行update</title>
		<link>http://wlx.westgis.ac.cn/734/</link>
		<comments>http://wlx.westgis.ac.cn/734/#comments</comments>
		<pubDate>Sun, 11 Dec 2011 08:24:05 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Program]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://wlx.westgis.ac.cn/?p=734</guid>
		<description><![CDATA[有时候，需要根据其他表的数据对某表的数据进行更新，这是就可以用到多表更新的功能： update metadata m set source=s.uuid from source s right join datasource d on s.id=d.sourceid where m.uuid=d.uuid]]></description>
			<content:encoded><![CDATA[<p>有时候，需要根据其他表的数据对某表的数据进行更新，这是就可以用到多表更新的功能：</p>
<blockquote><p>
update metadata m set source=s.uuid from source s right join datasource d on s.id=d.sourceid where m.uuid=d.uuid
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/734/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>bing api json中文搜索有乱码</title>
		<link>http://wlx.westgis.ac.cn/732/</link>
		<comments>http://wlx.westgis.ac.cn/732/#comments</comments>
		<pubDate>Wed, 30 Nov 2011 02:38:21 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Program]]></category>
		<category><![CDATA[bing json 中文]]></category>

		<guid isPermaLink="false">http://wlx.westgis.ac.cn/?p=732</guid>
		<description><![CDATA[系统中使用bing api json进行查询后发现搜索结果有乱码，网上搜索后发现是一个返回高亮的问题： bing api默认的请求参数是上面这样的。后面经发现’Options’=>’EnableHighlighting’,有问题。如果指定 Bing Search API时如果指定Options=EnableHighlighting（如下），则返回的Jason字符串中在关键字两边会有全角空格字符，而全角空格字符在IE下显示为很长的空格，在Firefox上显示为乱码。 最终解决方方案：在查询請求中去除Options=EnableHighlighting的参数设置后正常。]]></description>
			<content:encoded><![CDATA[<p>系统中使用bing api json进行查询后发现搜索结果有乱码，网上搜索后发现是一个<a href="http://www.codeshows.com/bing-api%E6%90%9C%E7%B4%A2%E7%BB%93%E6%9E%9C%E6%9C%89%E4%B9%B1%E7%A0%81/">返回高亮的问题</a>：</p>
<blockquote><p>bing api默认的请求参数是上面这样的。后面经发现’Options’=>’EnableHighlighting’,有问题。如果指定<br />
Bing Search API时如果指定Options=EnableHighlighting（如下），则返回的Jason字符串中在关键字两边会有全角空格字符，而全角空格字符在IE下显示为很长的空格，在Firefox上显示为乱码。</p>
<p>最终解决方方案：在查询請求中去除Options=EnableHighlighting的参数设置后正常。</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/732/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>colorbox vs thickbox</title>
		<link>http://wlx.westgis.ac.cn/716/</link>
		<comments>http://wlx.westgis.ac.cn/716/#comments</comments>
		<pubDate>Sat, 05 Nov 2011 11:53:39 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Program]]></category>
		<category><![CDATA[colorbox]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[thickbox]]></category>

		<guid isPermaLink="false">http://wlx.westgis.ac.cn/?p=716</guid>
		<description><![CDATA[As it has been compared in this website, we test the two js script for &#8216;box&#8217; in our site too, colorbox is chosen finally. The reason: colorbox support an image url without image extension, use the photo:”true” option, in thickbox &#8230; <a href="http://wlx.westgis.ac.cn/716/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>As it has been compared in <a href="http://www.softwareprojects.com/resources/programming/t-thickbox-colorbox-fancybox-shadowbox-comparis-1968.html">this website</a>, we test the two js script for &#8216;box&#8217; in our site too, <a href="http://jacklmoore.com/colorbox/">colorbox</a> is chosen finally.<br />
The reason: colorbox support an image url without image extension, use the photo:”true” option, in thickbox you must use the iframe to implement this result.</p>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/716/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>odtphp: A nice library to output openoffice odt file</title>
		<link>http://wlx.westgis.ac.cn/711/</link>
		<comments>http://wlx.westgis.ac.cn/711/#comments</comments>
		<pubDate>Fri, 04 Nov 2011 02:33:32 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Program]]></category>
		<category><![CDATA[libreoffice]]></category>
		<category><![CDATA[odt]]></category>
		<category><![CDATA[odtphp]]></category>
		<category><![CDATA[openoffice]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://wlx.westgis.ac.cn/?p=711</guid>
		<description><![CDATA[Recently, I want to add a function in our data center website(Which is only Chinese version now, an English version is preparing): “output the geographic metadata to openoffice odt format”. So, the odtphp project came into my sight. After download &#8230; <a href="http://wlx.westgis.ac.cn/711/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Recently, I want to add  a function in our <a href="http://westdc.westgis.ac.cn" target="_blank">data center website</a>(Which is only Chinese version now, an English version is preparing): “output the geographic metadata to openoffice odt format”. So, the <a href="http://www.odtphp.com" target="_blank">odtphp project</a> came into my sight.</p>
<p>After download the 1.0.1 version, and try some tests in its code. There is no problem in the text replacing, but if I insert into the odt file an image, the OpenOffice (What I use is LibreOffice) always tell me this file need repair, although the repair result nice. Dig into another search, find this problem and<a href="http://vikasmahajan.wordpress.com/2010/12/09/odtphp-bug-solved/" target="_blank"> solution in the author&#8217;s blog</a>.</p>
<p>Use the latest version (1.3) in the author&#8217;s blog, this bug is disappeared. </p>
<p>There is another requirement in my site yet, maybe it is not a problem: The image file which is dynamic produced has not a extension in the url, So the code in odtphp: setImage must change its behavior here.</p>
<p>So I patched the code, and released it here (it&#8217;s GPL license):</p>
<blockquote><p><code>wlx@wlxpc:~$ diff odf.php odtphp-1.0.1_modified_files/odf.php<br />
111a112,113<br />
&gt;         $filename = strtok(strrchr($value, '/'), '/.');<br />
&gt;         $file = substr(strrchr($value, '/'), 1);<br />
116,118d117<br />
&lt;         $filename=md5($value);;<br />
&lt;         $imgext=array('.gif','.jpg','.png','.swf','.psd','.bmp','.tif','.tif','.jpc','.jp2','.jpx','.jb2','.swc','.iff','.wbmp','.xbm','.ico');<br />
&lt;         $file=$filename.$imgext[$size[2]];<br />
287,289c286<br />
&lt;             //$this-&gt;file-&gt;addFile($imageKey, 'Pictures/' . $imageValue);<br />
&lt;             $this-&gt;file-&gt;addFromString('Pictures/' . $imageValue,file_get_contents($imageKey));<br />
&lt;<br />
---<br />
&gt;             $this-&gt;file-&gt;addFile($imageKey, 'Pictures/' . $imageValue);</code></p></blockquote>
<p>In short, what I do: change the filenmae to a hash string (md5(source)), and save it with file_get_contents function (which could parse the url).</p>
<p>And, a big Thanks to you and your odtphp project: <a href="http://vikasmahajan.wordpress.com" target="_blank">Vikas Mahajan</a>.<br />
Download patch file: <a href='http://wlx.westgis.ac.cn/uploads/2011/11/odf.php_.patch_.zip'>odf.php.patch</a></p>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/711/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C++矩阵库比较</title>
		<link>http://wlx.westgis.ac.cn/682/</link>
		<comments>http://wlx.westgis.ac.cn/682/#comments</comments>
		<pubDate>Sun, 15 May 2011 10:11:22 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Program]]></category>
		<category><![CDATA[armadillo]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[it++]]></category>
		<category><![CDATA[matrix]]></category>

		<guid isPermaLink="false">http://wlx.westgis.ac.cn/?p=682</guid>
		<description><![CDATA[同化系统中要大量使用矩阵类，现在使用的是之前有我们自己发展的纯C++的一个矩阵类，而后又引入了IT++类的支持，现在回头来看，又有很多新的C++矩阵类库发展出来，并且有很好的特性。今天就用了几个测试代码在我的DELL T7400工作站进行了测试，主要比较的是我们自己的矩阵类、armadillo、IT++（参考文献中还有和其他矩阵类的比较）。 1. 实际测试平台 UBUNTU 11.04，DELL T7400 INTEL XEON X5450@3.0GHz（双CPU，各四核，测试时只用1核）。 g++ 4.5.2 it++ 4.0.7 （系统自带） armadillo 1.2.0 (手工安装） 2. 编译方法 armadillo采用的是如下编译方法： g++ -o test -larmadillo -O2 -fwhole-program xxx.cpp IT++采用的是如下编译方法： g++ -o test -litpp -O2 -fwhole-program xxx.cpp 我们的矩阵类用的是如下的编译方法： g++ -o test &#8230; <a href="http://wlx.westgis.ac.cn/682/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>同化系统中要大量使用矩阵类，现在使用的是之前有我们自己发展的纯C++的一个矩阵类，而后又引入了IT++类的支持，现在回头来看，又有很多新的C++矩阵类库发展出来，并且有很好的特性。今天就用了几个测试代码在我的DELL T7400工作站进行了测试，主要比较的是我们自己的矩阵类、armadillo、IT++（参考文献中还有和其他矩阵类的比较）。<span id="more-682"></span></p>
<p>1. 实际测试平台<br />
UBUNTU 11.04，DELL T7400 INTEL XEON X5450@3.0GHz（双CPU，各四核，测试时只用1核）。<br />
g++ 4.5.2<br />
it++ 4.0.7 （系统自带）<br />
armadillo 1.2.0 (手工安装）<br />
2. 编译方法<br />
armadillo采用的是如下编译方法：</p>
<blockquote><p>g++ -o test -larmadillo -O2 -fwhole-program xxx.cpp</p></blockquote>
<p>IT++采用的是如下编译方法：</p>
<blockquote><p>g++ -o test -litpp -O2 -fwhole-program xxx.cpp</p></blockquote>
<p>我们的矩阵类用的是如下的编译方法：</p>
<blockquote><p>g++ -o test -larmadillo -O2 -fwhole-program -ldas/include/ ldas/src/util/exception.cpp cas1.cpp</p></blockquote>
<p>3. 测试方法及代码<br />
主要测试矩阵的加法运算和乘法运算，构建了ABZ三个1000*1000矩阵，分别测试了Z=A+B、Z=A*B以及Z=A+B+C、Z=A*B*C各100次，比较其计算时间。<br />
armadillo代码：</p>
<blockquote><p><code>#include &lt;iostream&gt;<br />
#include &lt;armadillo&gt;<br />
 int main() {<br />
 int size = 1000; int N = 100;<br />
//Armadillo<br />
// size and N are specified by the user on the command line<br />
arma::mat A = arma::randu(size,size);<br />
arma::mat B = arma::randu(size,size);<br />
arma::mat C = arma::randu(size,size);<br />
arma::mat Z = arma::zeros(size,size); int i;<br />
arma::wall_clock timer; timer.tic();<br />
for(i=0; i&lt;N; ++i) Z = A+B+C; // or Z = A+B+C ... etc<br />
std::cout &lt;&lt; "armadillo: time taken for addition = " &lt;&lt; timer.toc() / double(N) &lt;&lt; std::endl;<br />
timer.tic();<br />
for(i=0; i&lt;N; ++i) Z = A*B*C; // or Z = A+B+C ... etc<br />
std::cout &lt;&lt; "armadillo: time taken for multiplication = " &lt;&lt; timer.toc() / double(N) &lt;&lt; std::endl;<br />
}</code></p></blockquote>
<p>IT++测试代码：</p>
<blockquote><p><code>#include &lt;itpp/itbase.h&gt;<br />
 #include &lt;itpp/base/random.h&gt;<br />
#include &lt;itpp/base/timing.h&gt;<br />
int main()<br />
{ int size = 1000; int N = 100;<br />
//IT++<br />
itpp::mat A2 = itpp::randu(size,size);<br />
itpp::mat B2 = itpp::randu(size,size);<br />
itpp::mat C = itpp::randu(size,size);<br />
itpp::mat Z2 = itpp::zeros(size,size); int i;<br />
itpp::Real_Timer timer; timer.tic();<br />
for(i=0; i&lt;N; ++i) Z2 = A2+B2+C;<br />
std::cout &lt;&lt; "IT++: time taken for addition = " &lt;&lt; timer.toc() / double(N) &lt;&lt; std::endl;<br />
timer.tic();<br />
for(i=0; i&lt;N; ++i) Z2 = A2*B2*C; // or Z = A+B+C ... etc<br />
std::cout &lt;&lt; "IT++: time taken for multiplication = " &lt;&lt; timer.toc() / double(N) &lt;&lt; std::endl;<br />
}</code></p></blockquote>
<p>自己实现的矩阵类：</p>
<blockquote><p><code>#include &lt;iostream&gt;<br />
#include &lt;armadillo&gt;<br />
#include "matrix.hpp"<br />
#include "exception.h"<br />
 int main() {<br />
 int size = 1000; int N = 100;<br />
//Armadillo<br />
// size and N are specified by the user on the command line<br />
ldas::Matrix&lt;double&gt; A(size,size);<br />
for(int i=0;i&lt;size;i++)<br />
  for(int j=0;j&lt;size;j++) A.set(i+1,j+1,rand()/RAND_MAX);<br />
ldas::Matrix&lt;double&gt; B(size,size);<br />
for(int i=0;i&lt;size;i++)  for(int j=0;j&lt;size;j++) B.set(i+1,j+1,rand()/RAND_MAX);<br />
ldas::Matrix&lt;double&gt; C(size,size);<br />
for(int i=0;i&lt;size;i++)  for(int j=0;j&lt;size;j++) C.set(i+1,j+1,rand()/RAND_MAX);<br />
ldas::Matrix&lt;double&gt;  Z(size,size);<br />
arma::wall_clock timer; timer.tic();<br />
for(int i=0; i&lt;N; ++i) Z = A+B; // or Z = A+B+C ... etc<br />
std::cout &lt;&lt; "our Matrix: time taken for addition = " &lt;&lt; timer.toc() / double(N) &lt;&lt; std::endl;<br />
timer.tic();<br />
for(int i=0; i&lt;N; ++i) Z = A*B; // or Z = A+B+C ... etc<br />
std::cout &lt;&lt; "our Matrix: time taken for multiplication = " &lt;&lt; timer.toc() / double(N) &lt;&lt; std::endl;<br />
}</code></p></blockquote>
<p>4. 测试结果<br />
A+B&#038;A*B<br />
armadillo: time taken for addition = 0.00803794<br />
armadillo: time taken for multiplication = 0.117536<br />
IT++: time taken for addition = 0.0119361<br />
IT++: time taken for multiplication = 0.119165<br />
our Matrix: time taken for addition = 0.029522<br />
our Matrix: time taken for multiplication = 17.4216</p>
<p>A+B+C&#038;A*B*C<br />
armadillo: time taken for addition = 0.0107693<br />
armadillo: time taken for multiplication = 0.230288<br />
IT++: time taken for addition = 0.0254268<br />
IT++: time taken for multiplication = 0.237969<br />
our Matrix: time taken for addition = 0.05127<br />
our Matrix: time taken for multiplication = 34.428</p>
<p>5. 测试结果分析<br />
如armadillo作者自己所言，armadillo的计算速度最快，矩阵的加法，特别有长算式的计算，armadillo的优势非常明显。我们自己的矩阵类由于乘法是采用常规方法实现的，没有使用BLAS，因此效率差距很明显。</p>
<p>6. 参考文献<br />
<a href="http://sourceforge.net/projects/itpp/forums/forum/115656/topic/3740250">it++ vs armadillo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/682/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>实现了一个SCAR的zotero translator</title>
		<link>http://wlx.westgis.ac.cn/603/</link>
		<comments>http://wlx.westgis.ac.cn/603/#comments</comments>
		<pubDate>Wed, 27 May 2009 14:55:30 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Program]]></category>
		<category><![CDATA[RS]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[SCAR]]></category>
		<category><![CDATA[translator]]></category>
		<category><![CDATA[zotero]]></category>

		<guid isPermaLink="false">http://wlx.westgis.ac.cn/?p=603</guid>
		<description><![CDATA[SCAR: Science of Cold and Arid Regions 是所里新办的一个期刊，看了几篇文章，打算摘录下来，zotero却不支持，需要自己再写一个转换器(translator)，花了一下午的时间，终于搞出来了，暂时不支持搜索功能。 把下面的代码保存到zotero下的translator目录，给个名字，如SCAR.js，然后重新启动一下FIREFOX，应该就可以使用了。 { "translatorID":"d5770df3-b41a-45cb-bb3a-261948c9af49", "translatorType":4, "label":"SCAR", "creator":"Liangxu Wang&#60;wangliangxu＠gmail.com&#62;", "target":"http://www.scar.ac.cn/hhkxen/ch/reader", "minVersion":"1.0", "maxVersion":"", "priority":100, "inRepository":true, "lastUpdated":"2009-5-27 22:33:00" } function detectWeb(doc, url) { var articleRe = /view_abstract.aspx/; var s = articleRe.exec(url); if(s) { return "journalArticle"; } &#8230; <a href="http://wlx.westgis.ac.cn/603/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>SCAR: Science of Cold and Arid Regions 是所里新办的一个期刊，看了几篇文章，打算摘录下来，zotero却不支持，需要自己再写一个转换器(translator)，花了一下午的时间，终于搞出来了，暂时不支持搜索功能。<br />
把下面的代码保存到zotero下的translator目录，给个名字，如SCAR.js，然后重新启动一下FIREFOX，应该就可以使用了。</p>
<p><code>{<br />
    "translatorID":"d5770df3-b41a-45cb-bb3a-261948c9af49",<br />
    "translatorType":4,<br />
    "label":"SCAR",<br />
    "creator":"Liangxu Wang&lt;wangliangxu＠gmail.com&gt;",<br />
    "target":"http://www.scar.ac.cn/hhkxen/ch/reader",<br />
    "minVersion":"1.0",<br />
    "maxVersion":"",<br />
    "priority":100,<br />
    "inRepository":true,<br />
    "lastUpdated":"2009-5-27 22:33:00"<br />
}</p>
<p>function detectWeb(doc, url) {<br />
    var articleRe = /view_abstract.aspx/;<br />
    var s = articleRe.exec(url);</p>
<p>    if(s) {<br />
        return "journalArticle";<br />
    } else {<br />
        return "multiple";<br />
    }</p>
<p>    return false;<br />
}</p>
<p>function scrape(doc) {<br />
    var nsResolver = null;</p>
<p>    var itemType = "journalArticle";<br />
    var newItem = new Zotero.Item(itemType);<br />
    Zotero.debug(itemType);</p>
<p>    // 标题<br />
    var title = doc.getElementById('EnTitle').textContent;<br />
    Zotero.debug("Title:"+title);<br />
    newItem.title = title;</p>
<p>    // 附件，网页快照<br />
    var snapName = title + " (SCAR)";<br />
    Zotero.debug(snapName);<br />
    newItem.attachments.push({document:doc, title:snapName, mimeType:"text/html"});<br />
    //Zotero.debug(doc);</p>
<p>    //关键词<br />
    var keys=doc.getElementById('EnKeyWord');<br />
    var tags=keys.getElementsByTagName('u');<br />
    var i=0;<br />
    for(i=0;i&lt;tags.length;i++){<br />
      newItem.tags.push(tags[i].textContent);<br />
      Zotero.debug("tag:"+tags[i].textContent);<br />
    }<br />
    //摘要<br />
    var abstract=doc.getElementById('EnAbstract');<br />
    newItem.abstractNote = Zotero.Utilities.trim(abstract.textContent);<br />
    // 出版社<br />
    newItem.publicationTitle = 'Sciences in Cold and Arid Regions';<br />
    newItem.ISSN='1674-3822';<br />
    newItem.url = doc.location.href;<br />
    //出版时间<br />
    var ref=doc.getElementById('ReferenceText').textContent;<br />
    if (ref.match(/,(\d+).+Sciences in Cold and Arid Regions,(\d+)\((\d+)\):(.+)\./))<br />
    {<br />
      newItem.volume=ref.match(/,(\d+).+Sciences in Cold and Arid Regions,(\d+)\((\d+)\):(.+)\./)[2];<br />
      newItem.issue=ref.match(/,(\d+).+Sciences in Cold and Arid Regions,(\d+)\((\d+)\):(.+)\./)[3];<br />
      newItem.pages=ref.match(/,(\d+).+Sciences in Cold and Arid Regions,(\d+)\((\d+)\):(.+)\./)[4];<br />
      newItem.date=ref.match(/,(\d+).+Sciences in Cold and Arid Regions,(\d+)\((\d+)\):(.+)\./)[1];<br />
    }<br />
    //作者<br />
    if (ref.match(/(.+),\d+\.+/))<br />
    {<br />
      authors=ref.match(/(.+),\d+\.+/)[1].split(',');<br />
      for(i=0;i&lt;authors.length-1;i++) {<br />
        newItem.creators.push(Zotero.Utilities.cleanAuthor(authors[i], "author", true));<br />
      }<br />
      author=authors[authors.length-1].split('and');<br />
      for(i=0;i&lt;author.length;i++) {<br />
        newItem.creators.push(Zotero.Utilities.cleanAuthor(author[i], "author", true));<br />
      }<br />
    }<br />
    Zotero.debug("finished.");<br />
    newItem.complete();<br />
}</p>
<p>function doWeb(doc, url) {<br />
    var namespace = doc.documentElement.namespaceURI;<br />
    var nsResolver = null;</p>
<p>    if(detectWeb(doc, url) == "multiple") {<br />
        Zotero.debug("Enter multiple~");<br />
        // TODO: implement the multiple function.<br />
    } else {<br />
        var urls = [url];<br />
    }<br />
    Zotero.debug(urls);<br />
    // 下面对每条url进行解析<br />
    Zotero.Utilities.processDocuments(urls, scrape, function() { Zotero.done(); });<br />
    Zotero.wait();<br />
}</code><br />
也可以直接下载：<a href='http://wlx.westgis.ac.cn/uploads/2009/05/scar.js'>scar.js</a></p>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/603/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>cout float的显示问题</title>
		<link>http://wlx.westgis.ac.cn/589/</link>
		<comments>http://wlx.westgis.ac.cn/589/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 04:52:05 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Program]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[cout]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://wlx.westgis.ac.cn/?p=589</guid>
		<description><![CDATA[在c++，使用cout直接显示float类型的数据，在不同系统上显示方式可能有所不同。 测试代码： #include &#60;iostream&#62; using namespace std; int main() { float t=0.000000277; cout&#60;&#60;t&#60;&#60;endl; return 0; } 在LINUX上： 2.77e-07 而在WINDOWS上结果如下： 2.77e-007]]></description>
			<content:encoded><![CDATA[<p>在c++，使用cout直接显示float类型的数据，在不同系统上显示方式可能有所不同。<br />
测试代码：<br />
<code>#include &lt;iostream&gt;</p>
<p>using namespace std;</p>
<p>int main()<br />
{<br />
    float t=0.000000277;<br />
    cout&lt;&lt;t&lt;&lt;endl;<br />
    return 0;<br />
}</code><br />
在LINUX上：</p>
<blockquote><p>2.77e-07</p></blockquote>
<p>而在WINDOWS上结果如下：</p>
<blockquote><p>2.77e-007</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/589/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

