<?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/"
	xmlns:georss="http://www.georss.org/georss">

<channel>
	<title>Here Comes The Sun</title>
	<atom:link href="http://sunng.info/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://sunng.info/blog</link>
	<description>苏ICP备06039259号</description>
	<lastBuildDate>Wed, 10 Mar 2010 01:17:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Sunng.info in Mosaic</title>
		<link>http://sunng.info/blog/2010/03/sunng-info-in-mosaic/</link>
		<comments>http://sunng.info/blog/2010/03/sunng-info-in-mosaic/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 01:17:37 +0000</pubDate>
		<dc:creator>Sunng</dc:creator>
				<category><![CDATA[留影]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://sunng.info/blog/?p=510</guid>
		<description><![CDATA[Mosaic:
http://en.wikipedia.org/wiki/Mosaic_browser

这么一看，什么标准通通扯淡，还是图片管用，什么浏览器都可以显示。Similar Posts:

很山寨
Happy new year with Yan 0.4
Yan Captcha Service
Alexander Sukhanov
Opera-mini


Share/Save]]></description>
			<content:encoded><![CDATA[<p>Mosaic:<br />
<a href="http://en.wikipedia.org/wiki/Mosaic_browser">http://en.wikipedia.org/wiki/Mosaic_browser</a></p>
<p><a href="http://www.flickr.com/photos/40741608@N08/4420674473/" title="mosaic by 贝小塔, on Flickr"><img src="http://farm5.static.flickr.com/4058/4420674473_e14d48020e.jpg" width="457" height="500" alt="mosaic" /></a></p>
<p>这么一看，什么标准通通扯淡，还是图片管用，什么浏览器都可以显示。<strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://sunng.info/blog/2010/02/%e5%be%88%e5%b1%b1%e5%af%a8/" rel="bookmark" title="2010/02/03">很山寨</a></li>
<li><a href="http://sunng.info/blog/2010/01/happy-new-year-with-yan-0-4/" rel="bookmark" title="2010/01/01">Happy new year with Yan 0.4</a></li>
<li><a href="http://sunng.info/blog/2009/10/yan-captcha-service/" rel="bookmark" title="2009/10/24">Yan Captcha Service</a></li>
<li><a href="http://sunng.info/blog/2009/08/alexander-sukhanov/" rel="bookmark" title="2009/08/01">Alexander Sukhanov</a></li>
<li><a href="http://sunng.info/blog/2009/07/opera-mini/" rel="bookmark" title="2009/07/10">Opera-mini</a></li>
</ul>
<p><!-- Similar Posts took 6.451 ms --></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fsunng.info%2Fblog%2F2010%2F03%2Fsunng-info-in-mosaic%2F&amp;linkname=Sunng.info%20in%20Mosaic">Share/Save</a>]]></content:encoded>
			<wfw:commentRss>http://sunng.info/blog/2010/03/sunng-info-in-mosaic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<georss:point>31.203057 121.6174866</georss:point>	</item>
		<item>
		<title>New features in JTS 1.11</title>
		<link>http://sunng.info/blog/2010/03/new-features-in-jts-1-11/</link>
		<comments>http://sunng.info/blog/2010/03/new-features-in-jts-1-11/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 05:16:08 +0000</pubDate>
		<dc:creator>Sunng</dc:creator>
				<category><![CDATA[装备]]></category>
		<category><![CDATA[GIS]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://sunng.info/blog/?p=505</guid>
		<description><![CDATA[JTS最近发布了1.11版本，新增了：

对Delaunay三角网、Voronoi多边形的支持；
把Geometry对象转换为AWT的Shape对象的功能
对几何对象进行densify的操作（增加结点）；
计算Hausdorff相似度和Area相似度的支持

计算Delaunay三角网和Voronoi多边形：
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596import java.util.ArrayList;
import java.util.Collection;

import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.GeometryCollection;
import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.triangulate.DelaunayTriangulationBuilder;
import com.vividsolutions.jts.triangulate.VoronoiDiagramBuilder;

/**
&#160;*
&#160;* @author Sun Ning/SNDA
&#160;* @since 2010-3-3
&#160;*/
public class DelaunayAndVoronoiApp &#123;

&#160; &#160; /**
&#160; &#160; &#160;* create some predefined sites
&#160; &#160; &#160;* @return
&#160; &#160; &#160;*/
&#160; &#160; public static Collection&#60;Coordinate&#62; getPredefinedSites&#40;&#41;&#123;
&#160; &#160; &#160; &#160; double&#91;&#93;&#91;&#93; coords = &#123;&#123;100,27&#125;,&#123;28, 50&#125;,&#123;29, 40&#125;,&#123;32, 90&#125;, &#123;12, 26&#125;&#125;;
&#160; &#160; &#160; &#160; ArrayList&#60;Coordinate&#62; coordinates = new ArrayList&#60;Coordinate&#62;&#40;coords.length&#41;;

&#160; [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://lin-ear-th-inking.blogspot.com/2010/03/jts-version-111-released.html">JTS最近发布了1.11版本</a>，新增了：</p>
<ul>
<li>对<a href="http://en.wikipedia.org/wiki/Delaunay_triangulation">Delaunay三角网</a>、<a href="http://en.wikipedia.org/wiki/Voronoi">Voronoi多边形</a>的支持；</li>
<li>把Geometry对象转换为AWT的Shape对象的功能</li>
<li>对几何对象进行densify的操作（增加结点）；</li>
<li>计算<a href="http://en.wikipedia.org/wiki/Hausdorff_distance">Hausdorff相似度</a>和Area相似度的支持</li>
</ul>
<p>计算Delaunay三角网和Voronoi多边形：</p>
<div class="codecolorer-container java blackboard" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br />68<br />69<br />70<br />71<br />72<br />73<br />74<br />75<br />76<br />77<br />78<br />79<br />80<br />81<br />82<br />83<br />84<br />85<br />86<br />87<br />88<br />89<br />90<br />91<br />92<br />93<br />94<br />95<br />96<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.ArrayList</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Collection</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.vividsolutions.jts.geom.Coordinate</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.vividsolutions.jts.geom.Geometry</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.vividsolutions.jts.geom.GeometryCollection</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.vividsolutions.jts.geom.GeometryFactory</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.vividsolutions.jts.triangulate.DelaunayTriangulationBuilder</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.vividsolutions.jts.triangulate.VoronoiDiagramBuilder</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #008000; font-style: italic; font-weight: bold;">/**<br />
&nbsp;*<br />
&nbsp;* @author Sun Ning/SNDA<br />
&nbsp;* @since 2010-3-3<br />
&nbsp;*/</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> DelaunayAndVoronoiApp <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #008000; font-style: italic; font-weight: bold;">/**<br />
&nbsp; &nbsp; &nbsp;* create some predefined sites<br />
&nbsp; &nbsp; &nbsp;* @return<br />
&nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> Collection<span style="color: #339933;">&lt;</span>Coordinate<span style="color: #339933;">&gt;</span> getPredefinedSites<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> coords <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#123;</span>100,27<span style="color: #009900;">&#125;</span>,<span style="color: #009900;">&#123;</span>28, 50<span style="color: #009900;">&#125;</span>,<span style="color: #009900;">&#123;</span>29, 40<span style="color: #009900;">&#125;</span>,<span style="color: #009900;">&#123;</span>32, 90<span style="color: #009900;">&#125;</span>, <span style="color: #009900;">&#123;</span>12, 26<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; ArrayList<span style="color: #339933;">&lt;</span>Coordinate<span style="color: #339933;">&gt;</span> coordinates <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ArrayList<span style="color: #339933;">&lt;</span>Coordinate<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span>coords.<span style="color: #006633;">length</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&lt;</span>coords.<span style="color: #006633;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; coordinates.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Coordinate<span style="color: #009900;">&#40;</span>coords<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>0<span style="color: #009900;">&#93;</span>, coords<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>1<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> coordinates<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #008000; font-style: italic; font-weight: bold;">/**<br />
&nbsp; &nbsp; &nbsp;* <br />
&nbsp; &nbsp; &nbsp;* @param coords<br />
&nbsp; &nbsp; &nbsp;* @return a geometry collection of triangulations<br />
&nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> Geometry buildDelaunayTriangulation<span style="color: #009900;">&#40;</span>Collection<span style="color: #339933;">&lt;</span>Coordinate<span style="color: #339933;">&gt;</span> coords<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; DelaunayTriangulationBuilder builder <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> DelaunayTriangulationBuilder<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; builder.<span style="color: #006633;">setSites</span><span style="color: #009900;">&#40;</span>coords<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> builder.<span style="color: #006633;">getTriangles</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> GeometryFactory<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #008000; font-style: italic; font-weight: bold;">/**<br />
&nbsp; &nbsp; &nbsp;* <br />
&nbsp; &nbsp; &nbsp;* @param coords<br />
&nbsp; &nbsp; &nbsp;* @return a collection of polygons<br />
&nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> Geometry buildVoronoiDiagram<span style="color: #009900;">&#40;</span>Collection<span style="color: #339933;">&lt;</span>Coordinate<span style="color: #339933;">&gt;</span> coords<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; VoronoiDiagramBuilder builder <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> VoronoiDiagramBuilder<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; builder.<span style="color: #006633;">setSites</span><span style="color: #009900;">&#40;</span>coords<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> builder.<span style="color: #006633;">getDiagram</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> GeometryFactory<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #008000; font-style: italic; font-weight: bold;">/**<br />
&nbsp; &nbsp; &nbsp;* <br />
&nbsp; &nbsp; &nbsp;* @param args<br />
&nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Collection<span style="color: #339933;">&lt;</span>Coordinate<span style="color: #339933;">&gt;</span> coordinates <span style="color: #339933;">=</span> getPredefinedSites<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000; font-style: italic; font-weight: bold;">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Delauny<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; GeometryCollection triangulations<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>GeometryCollection<span style="color: #009900;">&#41;</span>buildDelaunayTriangulation<span style="color: #009900;">&#40;</span>coordinates<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">int</span> total <span style="color: #339933;">=</span> triangulations.<span style="color: #006633;">getNumGeometries</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Total triangulations: %d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>, total<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&lt;</span>total<span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Geometry g <span style="color: #339933;">=</span> triangulations.<span style="color: #006633;">getGeometryN</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Coordinate<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> coords <span style="color: #339933;">=</span> g.<span style="color: #006633;">getCoordinates</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Triangulation %d: &quot;</span>, i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span>Coordinate c <span style="color: #339933;">:</span> coords<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;(%.3f, %.3f) &quot;</span>, c.<span style="color: #006633;">x</span>, c.<span style="color: #006633;">y</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000; font-style: italic; font-weight: bold;">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Voronoi<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; GeometryCollection diagram <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>GeometryCollection<span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; buildVoronoiDiagram<span style="color: #009900;">&#40;</span>coordinates<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">int</span> totalDia <span style="color: #339933;">=</span> diagram.<span style="color: #006633;">getNumGeometries</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&lt;</span>totalDia<span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Geometry g <span style="color: #339933;">=</span> diagram.<span style="color: #006633;">getGeometryN</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Coordinate<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> coords <span style="color: #339933;">=</span> g.<span style="color: #006633;">getCoordinates</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Diagram %d: &quot;</span>, i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span>Coordinate c <span style="color: #339933;">:</span> coords<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;(%.3f, %.3f) &quot;</span>, c.<span style="color: #006633;">x</span>, c.<span style="color: #006633;">y</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>输出：</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Total triangulations: 5<br />
Triangulation 0: (32.000, 90.000) (12.000, 26.000) (28.000, 50.000) (32.000, 90.000) <br />
Triangulation 1: (32.000, 90.000) (28.000, 50.000) (100.000, 27.000) (32.000, 90.000) <br />
Triangulation 2: (100.000, 27.000) (28.000, 50.000) (29.000, 40.000) (100.000, 27.000) <br />
Triangulation 3: (100.000, 27.000) (29.000, 40.000) (12.000, 26.000) (100.000, 27.000) <br />
Triangulation 4: (12.000, 26.000) (29.000, 40.000) (28.000, 50.000) (12.000, 26.000) <br />
Diagram 0: (-76.000, 88.625) (-76.000, 178.000) (176.713, 178.000) (72.699, 65.730) (-38.235, 76.824) (-76.000, 88.625) <br />
Diagram 1: (-76.000, -62.000) (-76.000, 88.625) (-38.235, 76.824) (11.978, 43.348) (56.422, -10.619) (57.006, -62.000) (-76.000, -62.000) <br />
Diagram 2: (11.978, 43.348) (-38.235, 76.824) (72.699, 65.730) (67.316, 48.882) (11.978, 43.348) <br />
Diagram 3: (176.713, 178.000) (188.000, 178.000) (188.000, -62.000) (57.006, -62.000) (56.422, -10.619) (67.316, 48.882) (72.699, 65.730) (176.713, 178.000) <br />
Diagram 4: (11.978, 43.348) (67.316, 48.882) (56.422, -10.619) (11.978, 43.348)</div></td></tr></tbody></table></div>
<p>将Geometry对象转换成Shape对象，绘制在JPanel上：</p>
<div class="codecolorer-container java blackboard" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.awt.Color</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.awt.Dimension</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.awt.Graphics</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.awt.Graphics2D</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.awt.Shape</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Collection</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.swing.JFrame</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.swing.JPanel</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.vividsolutions.jts.awt.ShapeWriter</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.vividsolutions.jts.geom.Coordinate</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.vividsolutions.jts.geom.Geometry</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Random</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #008000; font-style: italic; font-weight: bold;">/**<br />
&nbsp;*<br />
&nbsp;* @author Sun Ning/SNDA<br />
&nbsp;* @since 2010-3-3<br />
&nbsp;*/</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> JTS2Awt <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> showUI<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">Shape</span>... <span style="color: #006633;">shape</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">JFrame</span> jframe <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">JFrame</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;JTS Geometry to AWT Shape&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">JPanel</span> jp <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">JPanel</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> paint<span style="color: #009900;">&#40;</span><span style="color: #003399;">Graphics</span> g<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">paint</span><span style="color: #009900;">&#40;</span>g<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">Graphics2D</span> g2d <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Graphics2D</span><span style="color: #009900;">&#41;</span>g<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>shape <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Shape</span> s<span style="color: #339933;">:</span> shape<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; g2d.<span style="color: #006633;">setColor</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Color</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Color</span>.<span style="color: #006633;">HSBtoRGB</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Random</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">nextFloat</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, 1f, 0.6f<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; g2d.<span style="color: #006633;">draw</span><span style="color: #009900;">&#40;</span>s<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; jp.<span style="color: #006633;">setPreferredSize</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Dimension</span><span style="color: #009900;">&#40;</span>150, 150<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; jframe.<span style="color: #006633;">getContentPane</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>jp<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; jframe.<span style="color: #006633;">setDefaultCloseOperation</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">JFrame</span>.<span style="color: #006633;">EXIT_ON_CLOSE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; jframe.<span style="color: #006633;">pack</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; jframe.<span style="color: #006633;">setVisible</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #003399;">Shape</span> toShape<span style="color: #009900;">&#40;</span>Geometry geom<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; ShapeWriter writer <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ShapeWriter<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> writer.<span style="color: #006633;">toShape</span><span style="color: #009900;">&#40;</span>geom<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Collection<span style="color: #339933;">&lt;</span>Coordinate<span style="color: #339933;">&gt;</span> coords <span style="color: #339933;">=</span> DelaunayAndVoronoiApp.<span style="color: #006633;">getPredefinedSites</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Geometry geomT <span style="color: #339933;">=</span> DelaunayAndVoronoiApp.<span style="color: #006633;">buildDelaunayTriangulation</span><span style="color: #009900;">&#40;</span>coords<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Geometry geomD <span style="color: #339933;">=</span> DelaunayAndVoronoiApp.<span style="color: #006633;">buildVoronoiDiagram</span><span style="color: #009900;">&#40;</span>coords<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; showUI<span style="color: #009900;">&#40;</span>toShape<span style="color: #009900;">&#40;</span>geomT<span style="color: #009900;">&#41;</span>, toShape<span style="color: #009900;">&#40;</span>geomD<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p><a href="http://www.flickr.com/photos/40741608@N08/4403349474/" title="jts by 贝小塔, on Flickr"><img src="http://farm5.static.flickr.com/4010/4403349474_cc3db44369_o.png" width="158" height="177" alt="jts" /></a></p>
<p><strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://sunng.info/blog/2009/10/mapping-geometry-in-grails-and-mysql/" rel="bookmark" title="2009/10/06">Mapping Geometry in Grails and MySQL</a></li>
<li><a href="http://sunng.info/blog/2009/10/reading-gps-data-from-exif-using-groovy/" rel="bookmark" title="2009/10/05">Reading GPS Data From EXIF Using Groovy</a></li>
<li><a href="http://sunng.info/blog/2009/07/osm-static-api-with-javafx/" rel="bookmark" title="2009/07/18">OSM Static API with JavaFX</a></li>
<li><a href="http://sunng.info/blog/2009/07/up-and-running-postgresql-and-postgis-on-ubuntu-8-10-step-by-step/" rel="bookmark" title="2009/07/10">[旧]Up and Running: PostgreSQL and PostGIS on Ubuntu 8.10, Step By Step</a></li>
<li><a href="http://sunng.info/blog/2009/03/cp-bookmakes-to-another-pdf-file/" rel="bookmark" title="2009/03/25">cp bookmakes to another pdf file</a></li>
</ul>
<p><!-- Similar Posts took 7.363 ms --></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fsunng.info%2Fblog%2F2010%2F03%2Fnew-features-in-jts-1-11%2F&amp;linkname=New%20features%20in%20JTS%201.11">Share/Save</a>]]></content:encoded>
			<wfw:commentRss>http://sunng.info/blog/2010/03/new-features-in-jts-1-11/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<georss:point>31.203057 121.6174866</georss:point>	</item>
		<item>
		<title>封闭开发</title>
		<link>http://sunng.info/blog/2010/03/%e5%b0%81%e9%97%ad%e5%bc%80%e5%8f%91/</link>
		<comments>http://sunng.info/blog/2010/03/%e5%b0%81%e9%97%ad%e5%bc%80%e5%8f%91/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 15:04:50 +0000</pubDate>
		<dc:creator>Sunng</dc:creator>
				<category><![CDATA[自话]]></category>
		<category><![CDATA[Life]]></category>

		<guid isPermaLink="false">http://sunng.info/blog/?p=503</guid>
		<description><![CDATA[从后天起，我就要被封闭开发了。地点在公司对面的酒店里，问具体的情况据老大说，是要去一个“有人给你做饭，有人给你洗衣服”的地方，说得跟人间天堂似的。去年刚到公司实习的时候就赶上有组封闭开发，印象中好像封了有一个多月。老实说封闭开发也是没办法的事情，我们这个菜场式的办公环境，一个人手上又有多个项目，不断地有人来找你问各种各样的事情，就算不问你，问你旁边的人，声音大到耳机挡不住，这种环境下怎么可能开发出有质量的产品。参考一下敏捷团队空间注意事项，那想想，封就封了吧。
这次项目到四月中旬截止，还不太清楚会是什么情况，能不能上网，每天要干多长时间，具体情况等我从小黑屋发来现场报道吧。Similar Posts:
None Found


Share/Save]]></description>
			<content:encoded><![CDATA[<p>从后天起，我就要被封闭开发了。地点在公司对面的酒店里，问具体的情况据<a href="http://amoeba.meidusa.com/wordpress/">老大</a>说，是要去一个“有人给你做饭，有人给你洗衣服”的地方，说得跟人间天堂似的。去年刚到公司实习的时候就赶上有组封闭开发，印象中好像封了有一个多月。老实说封闭开发也是没办法的事情，我们这个菜场式的办公环境，一个人手上又有多个项目，不断地有人来找你问各种各样的事情，就算不问你，问你旁边的人，声音大到耳机挡不住，这种环境下怎么可能开发出有质量的产品。参考一下<a href="http://www.infoq.com/cn/news/2010/02/agile-team-spaces">敏捷团队空间注意事项</a>，那想想，封就封了吧。</p>
<p>这次项目到四月中旬截止，还不太清楚会是什么情况，能不能上网，每天要干多长时间，具体情况等我从小黑屋发来现场报道吧。<strong>Similar Posts:</strong>
<ul class="similar-posts">None Found
</ul>
<p><!-- Similar Posts took 1.455 ms --></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fsunng.info%2Fblog%2F2010%2F03%2F%25e5%25b0%2581%25e9%2597%25ad%25e5%25bc%2580%25e5%258f%2591%2F&amp;linkname=%E5%B0%81%E9%97%AD%E5%BC%80%E5%8F%91">Share/Save</a>]]></content:encoded>
			<wfw:commentRss>http://sunng.info/blog/2010/03/%e5%b0%81%e9%97%ad%e5%bc%80%e5%8f%91/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
	<georss:point>31.203057 121.6174866</georss:point>	</item>
		<item>
		<title>Get your conky location aware</title>
		<link>http://sunng.info/blog/2010/02/get-your-conky-location-aware/</link>
		<comments>http://sunng.info/blog/2010/02/get-your-conky-location-aware/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 15:17:26 +0000</pubDate>
		<dc:creator>Sunng</dc:creator>
				<category><![CDATA[装备]]></category>
		<category><![CDATA[conky]]></category>
		<category><![CDATA[GIS]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[location]]></category>

		<guid isPermaLink="false">http://sunng.info/blog/?p=494</guid>
		<description><![CDATA[
Add this in your conkyrc
1${exec curl -s &#34;http://api.hostip.info&#34; &#124; xpath -e &#34;//gml:featureMember/Hostip/gml:name/text()&#34; -q} ${exec curl -s &#34;http://api.hostip.info&#34; &#124; xpath -e &#34;//gml:featureMember/Hostip//gml:coordinates/text()&#34; -q}
Hostip is well known as a service provider of the geoclue framework. It translates IP address to geolocation information. The API we use will return a GML document like
123456789101112131415161718192021222324&#60;?xml version=&#34;1.0&#34; encoding=&#34;ISO-8859-1&#34; ?&#62;
&#60;HostipLookupResultSet version=&#34;1.0.1&#34; xmlns:gml=&#34;http://www.opengis.net/gml&#34; [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/40741608@N08/4370628754/" title="2010-02-19-225826_188x44_scrot by 贝小塔, on Flickr"><img src="http://farm5.static.flickr.com/4014/4370628754_5a22522b80_o.png" width="188" height="44" alt="2010-02-19-225826_188x44_scrot" /></a></p>
<p>Add this in your conkyrc</p>
<div class="codecolorer-container text blackboard" style="border: 1px solid #9F9F9F;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">${exec curl -s &quot;http://api.hostip.info&quot; | xpath -e &quot;//gml:featureMember/Hostip/gml:name/text()&quot; -q} ${exec curl -s &quot;http://api.hostip.info&quot; | xpath -e &quot;//gml:featureMember/Hostip//gml:coordinates/text()&quot; -q}</div></td></tr></tbody></table></div>
<p>Hostip is well known as a service provider of the geoclue framework. It translates IP address to geolocation information. The API we use will return a GML document like</p>
<div class="codecolorer-container xml blackboard" style="border: 1px solid #9F9F9F;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br /></div></td><td><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;ISO-8859-1&quot;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;HostipLookupResultSet</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0.1&quot;</span> <span style="color: #000066;">xmlns:gml</span>=<span style="color: #ff0000;">&quot;http://www.opengis.net/gml&quot;</span> <span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span> <span style="color: #000066;">xsi:noNamespaceSchemaLocation</span>=<span style="color: #ff0000;">&quot;http://www.hostip.info/api/hostip-1.0.1.xsd&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gml:description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>This is the Hostip Lookup Service<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gml:description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gml:name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>hostip<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gml:name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gml:boundedBy<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gml:Null<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>inapplicable<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gml:Null<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gml:boundedBy<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gml:featureMember<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Hostip<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ip<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>58.212.88.212<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ip<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gml:name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Nanjing<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gml:name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;countryName<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>CHINA<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/countryName<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;countryAbbrev<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>CN<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/countryAbbrev<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">&lt;!-- Co-ordinates are available as lng,lat --&gt;</span><br />
&nbsp; &nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ipLocation<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gml:pointProperty<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gml:Point</span> <span style="color: #000066;">srsName</span>=<span style="color: #ff0000;">&quot;http://www.opengis.net/gml/srs/epsg.xml#4326&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gml:coordinates<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>118.883,32.05<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gml:coordinates<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gml:Point<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gml:pointProperty<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ipLocation<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Hostip<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gml:featureMember<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/HostipLookupResultSet<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></td></tr></tbody></table></div>
<p>Because it uses ip to lookup your address, you cannot expect higher resolution and precision currently. <strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://sunng.info/blog/2010/02/suppressing-simple-xmls-class-attribute/" rel="bookmark" title="2010/02/08">Suppressing simple-xml&#8217;s class attribute</a></li>
<li><a href="http://sunng.info/blog/2010/01/all-new-sunng-info/" rel="bookmark" title="2010/01/28">All new SUNNG.INFO</a></li>
<li><a href="http://sunng.info/blog/2009/12/yan-0-3/" rel="bookmark" title="2009/12/20">Yan 0.3</a></li>
<li><a href="http://sunng.info/blog/2009/12/use-yan-in-ruby-web-application/" rel="bookmark" title="2009/12/21">Using Yan in Ruby Web Application</a></li>
<li><a href="http://sunng.info/blog/2009/11/nginx-http-push/" rel="bookmark" title="2009/11/26">Nginx HTTP Push</a></li>
</ul>
<p><!-- Similar Posts took 8.335 ms --></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fsunng.info%2Fblog%2F2010%2F02%2Fget-your-conky-location-aware%2F&amp;linkname=Get%20your%20conky%20location%20aware">Share/Save</a>]]></content:encoded>
			<wfw:commentRss>http://sunng.info/blog/2010/02/get-your-conky-location-aware/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<georss:point>32.032377 118.793506</georss:point>	</item>
		<item>
		<title>Using weather</title>
		<link>http://sunng.info/blog/2010/02/using-weather/</link>
		<comments>http://sunng.info/blog/2010/02/using-weather/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 13:43:23 +0000</pubDate>
		<dc:creator>Sunng</dc:creator>
				<category><![CDATA[装备]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[location]]></category>
		<category><![CDATA[util]]></category>

		<guid isPermaLink="false">http://sunng.info/blog/?p=491</guid>
		<description><![CDATA[Ubuntu仓库里有个weather-util包，可以用来查看天气信息。weather工具从weather.noaa.gov网站获得天气信息，对美国的城市可以直接用名字查询，其他国家只能使用id查询。id的规则和weather.com不太相同。
中国的天气站点id可以在这个页面上查到。比如南京ZSNJ，上海浦东ZSPD。使用weather工具查询：
weather -i ZSNJ
Current conditions at China (ZSNJ) 32-00N 118-48E 12M (ZSNJ)
Last updated Feb 18, 2010 &#8211; 08:00 AM EST / 2010.02.18 1300 UTC
   Temperature: 35 F (2 C)
   Relative Humidity: 59%
   Wind: from the SSW (210 degrees) at 4 MPH (4 KT)
简化操作，可以在$HOME下创建.weatherrc文件，形如
1234&#91;default&#93;
ID = ZSPD
&#91;nj&#93;
ID = ZSNJ
就可以直接使用
weather

Current conditions at China [...]]]></description>
			<content:encoded><![CDATA[<p>Ubuntu仓库里有个weather-util包，可以用来查看天气信息。weather工具从weather.noaa.gov网站获得天气信息，对美国的城市可以直接用名字查询，其他国家只能使用id查询。id的规则和weather.com不太相同。</p>
<p>中国的天气站点id可以在<a href="http://weather.noaa.gov/weather/CN_cc.html">这个页面</a>上查到。比如南京ZSNJ，上海浦东ZSPD。使用weather工具查询：<br />
<em>weather -i ZSNJ</em></p>
<blockquote><p>Current conditions at China (ZSNJ) 32-00N 118-48E 12M (ZSNJ)<br />
Last updated Feb 18, 2010 &#8211; 08:00 AM EST / 2010.02.18 1300 UTC<br />
   Temperature: 35 F (2 C)<br />
   Relative Humidity: 59%<br />
   Wind: from the SSW (210 degrees) at 4 MPH (4 KT)</p></blockquote>
<p>简化操作，可以在$HOME下创建.weatherrc文件，形如</p>
<div class="codecolorer-container ini blackboard" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="ini codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>default<span style="">&#93;</span></span><br />
<span style="color: #000099;">ID</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> ZSPD</span><br />
<span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>nj<span style="">&#93;</span></span><br />
<span style="color: #000099;">ID</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> ZSNJ</span></div></td></tr></tbody></table></div>
<p>就可以直接使用<br />
<em>weather</em></p>
<blockquote><p>
Current conditions at China (ZSPD) 31-07N 121-46E (ZSPD)<br />
Last updated Feb 18, 2010 &#8211; 08:00 AM EST / 2010.02.18 1300 UTC<br />
   Temperature: 35 F (2 C)<br />
   Relative Humidity: 47%<br />
   Wind: from the NE (050 degrees) at 7 MPH (6 KT) (direction variable)
</p></blockquote>
<p>和<br />
<em>weather nj</em></p>
<blockquote><p>Current conditions at China (ZSNJ) 32-00N 118-48E 12M (ZSNJ)<br />
Last updated Feb 18, 2010 &#8211; 08:00 AM EST / 2010.02.18 1300 UTC<br />
   Temperature: 35 F (2 C)<br />
   Relative Humidity: 59%<br />
   Wind: from the SSW (210 degrees) at 4 MPH (4 KT)</p></blockquote>
<p><strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://sunng.info/blog/2010/03/new-features-in-jts-1-11/" rel="bookmark" title="2010/03/03">New features in JTS 1.11</a></li>
<li><a href="http://sunng.info/blog/2009/12/setting-environment-variables-for-netbeans-continued/" rel="bookmark" title="2009/12/30">Setting Environment Variables for NetBeans, Continued</a></li>
<li><a href="http://sunng.info/blog/2009/12/setting-environment-variables-for-glassfish-v3/" rel="bookmark" title="2009/12/29">Setting Environment Variables for Glassfish v3</a></li>
<li><a href="http://sunng.info/blog/2009/12/setting-environment-variables-for-netbeans/" rel="bookmark" title="2009/12/28">Setting Environment Variables for NetBeans</a></li>
<li><a href="http://sunng.info/blog/2009/08/inside-grails-flash-scope/" rel="bookmark" title="2009/08/07">Inside Grails Flash Scope</a></li>
</ul>
<p><!-- Similar Posts took 8.042 ms --></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fsunng.info%2Fblog%2F2010%2F02%2Fusing-weather%2F&amp;linkname=Using%20weather">Share/Save</a>]]></content:encoded>
			<wfw:commentRss>http://sunng.info/blog/2010/02/using-weather/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<georss:point>32.032377 118.793506</georss:point>	</item>
		<item>
		<title>I ♥ Free and Open Source Software</title>
		<link>http://sunng.info/blog/2010/02/i-%e2%99%a5-free-and-open-source-software/</link>
		<comments>http://sunng.info/blog/2010/02/i-%e2%99%a5-free-and-open-source-software/#comments</comments>
		<pubDate>Sun, 14 Feb 2010 13:43:22 +0000</pubDate>
		<dc:creator>Sunng</dc:creator>
				<category><![CDATA[未分类]]></category>
		<category><![CDATA[foss]]></category>

		<guid isPermaLink="false">http://sunng.info/blog/?p=485</guid>
		<description><![CDATA[
Similar Posts:

Patch for Fantasdic Google Source
Restore Nautilus to open gnome menu after installed PCManFM
Open Source Charting Toolkits in JavaScript


Share/Save]]></description>
			<content:encoded><![CDATA[<p><a href="http://fsfe.org/campaigns/valentine-2010/valentine-2010.html"><img src="http://fsfe.org/campaigns/valentine-2010/vd-i-love-fs-358x60.png" style="border: 0 !important;" alt="I love Free Software!"></a></p>
<p><strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://sunng.info/blog/2010/02/patch-for-fantadic-google-source/" rel="bookmark" title="2010/02/02">Patch for Fantasdic Google Source</a></li>
<li><a href="http://sunng.info/blog/2009/10/restore-nautilus-to-open-gnome-menu-after-installed-pcmanfm/" rel="bookmark" title="2009/10/25">Restore Nautilus to open gnome menu after installed PCManFM</a></li>
<li><a href="http://sunng.info/blog/2009/10/open-source-charting-libraries-in-javascript/" rel="bookmark" title="2009/10/22">Open Source Charting Toolkits in JavaScript</a></li>
</ul>
<p><!-- Similar Posts took 5.391 ms --></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fsunng.info%2Fblog%2F2010%2F02%2Fi-%25e2%2599%25a5-free-and-open-source-software%2F&amp;linkname=I%20%E2%99%A5%20Free%20and%20Open%20Source%20Software">Share/Save</a>]]></content:encoded>
			<wfw:commentRss>http://sunng.info/blog/2010/02/i-%e2%99%a5-free-and-open-source-software/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<georss:point>32.0183376666 118.811044693</georss:point>	</item>
		<item>
		<title>老物什 / Old Stuff</title>
		<link>http://sunng.info/blog/2010/02/%e8%80%81%e7%89%a9%e4%bb%80-old-stuff/</link>
		<comments>http://sunng.info/blog/2010/02/%e8%80%81%e7%89%a9%e4%bb%80-old-stuff/#comments</comments>
		<pubDate>Sun, 14 Feb 2010 09:12:02 +0000</pubDate>
		<dc:creator>Sunng</dc:creator>
				<category><![CDATA[留影]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[photo]]></category>

		<guid isPermaLink="false">http://sunng.info/blog/?p=482</guid>
		<description><![CDATA[大年初一翻旧物，找到一些让人颇有感触的旧物件。2004年买的RH9，2005年夏天买的Fedora 4。前者至今还安装在我家最旧的电脑里，虽然我都忘了它的样子了。
包装





手册



CDs




这个代理商里仁软件似乎已经倒闭了。Similar Posts:
None Found


Share/Save]]></description>
			<content:encoded><![CDATA[<p>大年初一翻旧物，找到一些让人颇有感触的旧物件。2004年买的RH9，2005年夏天买的Fedora 4。前者至今还安装在我家最旧的电脑里，虽然我都忘了它的样子了。</p>
<p>包装<br />
<a href="http://www.flickr.com/photos/40741608@N08/4355891380/" title="00011 by 贝小塔, on Flickr"><img src="http://farm5.static.flickr.com/4044/4355891380_b32fe9d173.jpg" width="500" height="335" alt="00011" /></a><br />
<a href="http://www.flickr.com/photos/40741608@N08/4355892466/" title="00012 by 贝小塔, on Flickr"><img src="http://farm5.static.flickr.com/4008/4355892466_04bca6512d.jpg" width="500" height="335" alt="00012" /></a><br />
<a href="http://www.flickr.com/photos/40741608@N08/4355894700/" title="00014 by 贝小塔, on Flickr"><img src="http://farm5.static.flickr.com/4061/4355894700_a83995eaca.jpg" width="500" height="335" alt="00014" /></a><br />
<a href="http://www.flickr.com/photos/40741608@N08/4355150633/" title="00013 by 贝小塔, on Flickr"><img src="http://farm5.static.flickr.com/4049/4355150633_106e97e909.jpg" width="500" height="335" alt="00013" /></a><br />
<a href="http://www.flickr.com/photos/40741608@N08/4355155529/" title="00018 by 贝小塔, on Flickr"><img src="http://farm5.static.flickr.com/4057/4355155529_d0397b83d3.jpg" width="500" height="335" alt="00018" /></a></p>
<p>手册<br />
<a href="http://www.flickr.com/photos/40741608@N08/4355153647/" title="00016 by 贝小塔, on Flickr"><img src="http://farm5.static.flickr.com/4010/4355153647_7877938213.jpg" width="500" height="335" alt="00016" /></a><br />
<a href="http://www.flickr.com/photos/40741608@N08/4355171643/" title="00022 by 贝小塔, on Flickr"><img src="http://farm3.static.flickr.com/2708/4355171643_d7c67e9d3a.jpg" width="500" height="335" alt="00022" /></a><br />
<a href="http://www.flickr.com/photos/40741608@N08/4355170579/" title="00021 by 贝小塔, on Flickr"><img src="http://farm3.static.flickr.com/2744/4355170579_18ee80953a.jpg" width="500" height="335" alt="00021" /></a></p>
<p>CDs<br />
<a href="http://www.flickr.com/photos/40741608@N08/4355152825/" title="00015 by 贝小塔, on Flickr"><img src="http://farm5.static.flickr.com/4042/4355152825_d7b6d44328.jpg" width="500" height="335" alt="00015" /></a><br />
<a href="http://www.flickr.com/photos/40741608@N08/4355897540/" title="00017 by 贝小塔, on Flickr"><img src="http://farm3.static.flickr.com/2802/4355897540_6ff0e17b46.jpg" width="500" height="335" alt="00017" /></a><br />
<a href="http://www.flickr.com/photos/40741608@N08/4355899486/" title="00019 by 贝小塔, on Flickr"><img src="http://farm5.static.flickr.com/4064/4355899486_a9a618f68f.jpg" width="500" height="335" alt="00019" /></a><br />
<a href="http://www.flickr.com/photos/40741608@N08/4355900468/" title="00020 by 贝小塔, on Flickr"><img src="http://farm5.static.flickr.com/4004/4355900468_ec4c180d79.jpg" width="500" height="335" alt="00020" /></a></p>
<p>这个代理商里仁软件似乎已经倒闭了。<strong>Similar Posts:</strong>
<ul class="similar-posts">None Found
</ul>
<p><!-- Similar Posts took 1.492 ms --></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fsunng.info%2Fblog%2F2010%2F02%2F%25e8%2580%2581%25e7%2589%25a9%25e4%25bb%2580-old-stuff%2F&amp;linkname=%E8%80%81%E7%89%A9%E4%BB%80%20%2F%20Old%20Stuff">Share/Save</a>]]></content:encoded>
			<wfw:commentRss>http://sunng.info/blog/2010/02/%e8%80%81%e7%89%a9%e4%bb%80-old-stuff/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	<georss:point>31.790957 118.8661782</georss:point>	</item>
		<item>
		<title>Virtual Machine Searcher for Gnome Deskbar Applet</title>
		<link>http://sunng.info/blog/2010/02/virtual-machine-searcher-for-gnome-deskbar-applet/</link>
		<comments>http://sunng.info/blog/2010/02/virtual-machine-searcher-for-gnome-deskbar-applet/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 08:18:33 +0000</pubDate>
		<dc:creator>Sunng</dc:creator>
				<category><![CDATA[广告]]></category>
		<category><![CDATA[gnome]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://sunng.info/blog/?p=475</guid>
		<description><![CDATA[Very glad to announce another daily-coding work: an extension for gnome deskbar applet to search and launch virtual machine. There is a plugin for gnome-do that does the same job. That&#8217;s what I create the the plugin for. I switched to deskbar because gnome-do&#8217;s Do.exe reminds me nightmares when I was a M$ Windows user. [...]]]></description>
			<content:encoded><![CDATA[<p>Very glad to announce another daily-coding work: an extension for gnome deskbar applet to search and launch virtual machine. There is a plugin for gnome-do that does the same job. That&#8217;s what I create the the plugin for. I switched to deskbar because gnome-do&#8217;s Do.exe reminds me nightmares when I was a M$ Windows user. The deskbar applet has been a great replacement, however, the virtualbox plugin in Do is really impressive while deskbar doesn&#8217;t provide me the same functionality.</p>
<p>You can ignore words above and just take a look at the screenshot:<br />
<a title="deskbar-virtualbox by 贝小塔, on Flickr" href="http://www.flickr.com/photos/40741608@N08/4350951202/"><img src="http://farm5.static.flickr.com/4062/4350951202_9ede9c4318_o.png" alt="deskbar-virtualbox" width="560" height="400" /></a></p>
<h3>Download</h3>
<p>Download the extension from (the highlighted one):<br />
<a href="http://bitbucket.org/sunng/daily-coding/downloads/?highlight=5137">http://bitbucket.org/sunng/daily-coding/downloads/?highlight=5137</a></p>
<p>You can also trace the development at bitbucket project. However, the repository is mixed with other small code snippets. Currently, mercurial doesn&#8217;t support subdirectory pull. So there is no way to grab the deskbar-applet individually.</p>
<h3>Installation</h3>
<p>copy this file to <em>/usr/lib/deskbar-applet/deskbar-applet/modules-2.20-compatible/</em> (Ubuntu installation for example) with super user privilege. Right click desktbar applet, select Preference, Searchers tab, hit &#8220;Reload&#8221; button, then check the Virtualbox Deskbar Module.<br />
<a title="deskbar-preference by 贝小塔, on Flickr" href="http://www.flickr.com/photos/40741608@N08/4350219097/"><img src="http://farm5.static.flickr.com/4006/4350219097_126cdb3c8d.jpg" alt="deskbar-preference" width="500" height="346" /></a></p>
<h3>Issue</h3>
<p>Feel free the report issues on bitbucket:<br />
<a href="http://bitbucket.org/sunng/daily-coding/issues/">http://bitbucket.org/sunng/daily-coding/issues/</a><strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://sunng.info/blog/2009/12/yan-0-3/" rel="bookmark" title="2009/12/20">Yan 0.3</a></li>
<li><a href="http://sunng.info/blog/2009/11/exaile-doubancovers-upgrades/" rel="bookmark" title="2009/11/22">Exaile-DoubanCover 0.0.2</a></li>
<li><a href="http://sunng.info/blog/2009/11/doubancovers-has-been-merged-into-exaile-cn/" rel="bookmark" title="2009/11/10">DoubanCovers has been merged into Exaile-cn</a></li>
<li><a href="http://sunng.info/blog/2009/11/exaile-cover-plugin-douban-covers/" rel="bookmark" title="2009/11/05">Exaile cover plugin: Douban Covers</a></li>
<li><a href="http://sunng.info/blog/2009/07/osm-static-api-with-javafx/" rel="bookmark" title="2009/07/18">OSM Static API with JavaFX</a></li>
</ul>
<p><!-- Similar Posts took 8.956 ms --></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fsunng.info%2Fblog%2F2010%2F02%2Fvirtual-machine-searcher-for-gnome-deskbar-applet%2F&amp;linkname=Virtual%20Machine%20Searcher%20for%20Gnome%20Deskbar%20Applet">Share/Save</a>]]></content:encoded>
			<wfw:commentRss>http://sunng.info/blog/2010/02/virtual-machine-searcher-for-gnome-deskbar-applet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<georss:point>31.203057 121.6174866</georss:point>	</item>
		<item>
		<title>List your installed virtualbox virtual marchines using vbox python xpcom api</title>
		<link>http://sunng.info/blog/2010/02/list-your-installed-virtualbox-virtual-marchines-using-vbox-python-xpcom-api/</link>
		<comments>http://sunng.info/blog/2010/02/list-your-installed-virtualbox-virtual-marchines-using-vbox-python-xpcom-api/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 05:33:51 +0000</pubDate>
		<dc:creator>Sunng</dc:creator>
				<category><![CDATA[把戏]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[VirtualBox]]></category>

		<guid isPermaLink="false">http://sunng.info/blog/?p=470</guid>
		<description><![CDATA[I&#8217;m sorry for the long title. Due to lack of documentation, it&#8217;s not easy to use python xpcom api from virtualbox sdk. The code below is just a sample that lists your installed virtual machines. It works on linux with VirtualBox OSE 2.0.8. Hope useful to you.
1234567import vboxapi
vmsg = vboxapi.VirtualBoxManager&#40;None, None&#41;
vbox = vmsg.vbox
vmsg.mgr.getSessionObject&#40;vbox&#41;
machs = vbox.getMachines&#40;&#41;
names [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m sorry for the long title. Due to lack of documentation, it&#8217;s not easy to use python xpcom api from virtualbox sdk. The code below is just a sample that lists your installed virtual machines. It works on linux with VirtualBox OSE 2.0.8. Hope useful to you.</p>
<div class="codecolorer-container python blackboard" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br /></div></td><td><div class="python codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #ff7700;font-weight:bold;">import</span> vboxapi<br />
vmsg = vboxapi.<span style="color: black;">VirtualBoxManager</span><span style="color: black;">&#40;</span><span style="color: #008000;">None</span>, <span style="color: #008000;">None</span><span style="color: black;">&#41;</span><br />
vbox = vmsg.<span style="color: black;">vbox</span><br />
vmsg.<span style="color: black;">mgr</span>.<span style="color: black;">getSessionObject</span><span style="color: black;">&#40;</span>vbox<span style="color: black;">&#41;</span><br />
machs = vbox.<span style="color: black;">getMachines</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
names = <span style="color: #008000;">map</span><span style="color: black;">&#40;</span><span style="color: #ff7700;font-weight:bold;">lambda</span> x: <span style="color: black;">&#40;</span>x.<span style="color: black;">name</span>,x.<span style="color: #008000;">id</span><span style="color: black;">&#41;</span>, machs<span style="color: black;">&#41;</span><br />
<span style="color: #ff7700;font-weight:bold;">print</span> names</div></td></tr></tbody></table></div>
<p>Output:</p>
<div class="codecolorer-container python blackboard" style="border: 1px solid #9F9F9F;"><div class="python codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: black;">&#91;</span><span style="color: black;">&#40;</span>u<span style="color: #483d8b;">'Ubuntu'</span>, u<span style="color: #483d8b;">'aac3fd46-4f1e-4f6e-8abe-b1a5516abf8c'</span><span style="color: black;">&#41;</span>, <span style="color: black;">&#40;</span>u<span style="color: #483d8b;">'Windows'</span>, u<span style="color: #483d8b;">'fa73952e-f0a6-4bf0-af20-259513d73bc1'</span><span style="color: black;">&#41;</span>, <span style="color: black;">&#40;</span>u<span style="color: #483d8b;">'OpenSolaris'</span>, u<span style="color: #483d8b;">'a951542c-3178-4a6b-8087-f1b0314e283a'</span><span style="color: black;">&#41;</span>, <span style="color: black;">&#40;</span>u<span style="color: #483d8b;">'LinuxMint'</span>, u<span style="color: #483d8b;">'8191f256-1b76-4ce7-a202-93730dae1b33'</span><span style="color: black;">&#41;</span>, <span style="color: black;">&#40;</span>u<span style="color: #483d8b;">'Fedora'</span>, u<span style="color: #483d8b;">'ca250f45-d752-4baf-9281-fb0847dc8287'</span><span style="color: black;">&#41;</span>, <span style="color: black;">&#40;</span>u<span style="color: #483d8b;">'Freebsd'</span>, u<span style="color: #483d8b;">'8322b62a-aed5-4f04-9815-9fadfeba9fe1'</span><span style="color: black;">&#41;</span>, <span style="color: black;">&#40;</span>u<span style="color: #483d8b;">'ArchLinux'</span>, u<span style="color: #483d8b;">'efc1167a-4e06-4c14-aeb0-bfb303c8f5f7'</span><span style="color: black;">&#41;</span>, <span style="color: black;">&#40;</span>u<span style="color: #483d8b;">'openSUSE'</span>, u<span style="color: #483d8b;">'02e18816-311d-420b-99b3-6b4b4cccf7b7'</span><span style="color: black;">&#41;</span>, <span style="color: black;">&#40;</span>u<span style="color: #483d8b;">'CentOS'</span>, u<span style="color: #483d8b;">'ccf0421c-85c4-4123-8722-57abc494c633'</span><span style="color: black;">&#41;</span><span style="color: black;">&#93;</span></div></div>
<p><strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://sunng.info/blog/2009/11/%e5%9c%a8rhel4%e4%b8%8a%e6%90%ad%e5%bb%bapythonlighttpdfastcgi%e7%8e%af%e5%a2%83/" rel="bookmark" title="2009/11/27">在RHEL4上搭建Python/Lighttpd/FastCGI环境</a></li>
<li><a href="http://sunng.info/blog/2009/09/some-python-segments/" rel="bookmark" title="2009/09/22">Some python segments</a></li>
<li><a href="http://sunng.info/blog/2009/09/performance-visualization-with-gnuplot-continued/" rel="bookmark" title="2009/09/24">Performance Visualization with Gnuplot, continued</a></li>
<li><a href="http://sunng.info/blog/2009/09/performance-visualization-with-gnuplot/" rel="bookmark" title="2009/09/23">Performance Visualization with Gnuplot</a></li>
<li><a href="http://sunng.info/blog/2009/06/how-you-waste-your-storage/" rel="bookmark" title="2009/06/06">How you waste your storage?</a></li>
</ul>
<p><!-- Similar Posts took 8.117 ms --></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fsunng.info%2Fblog%2F2010%2F02%2Flist-your-installed-virtualbox-virtual-marchines-using-vbox-python-xpcom-api%2F&amp;linkname=List%20your%20installed%20virtualbox%20virtual%20marchines%20using%20vbox%20python%20xpcom%20api">Share/Save</a>]]></content:encoded>
			<wfw:commentRss>http://sunng.info/blog/2010/02/list-your-installed-virtualbox-virtual-marchines-using-vbox-python-xpcom-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sunng&#8217;s Canvas based Heatmap API</title>
		<link>http://sunng.info/blog/2010/02/sunngs-canvas-based-heatmap-api/</link>
		<comments>http://sunng.info/blog/2010/02/sunngs-canvas-based-heatmap-api/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 07:10:03 +0000</pubDate>
		<dc:creator>Sunng</dc:creator>
				<category><![CDATA[广告]]></category>
		<category><![CDATA[手艺]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[visualization]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://sunng.info/blog/?p=464</guid>
		<description><![CDATA[Glad to announce my works this morning: A simple heatmap API based on HTML5 canvas.

The programming interface is rather simple now. To create such a heatmap, you just new a heatmap object by:

&#60;canvas width="300" height="215" id="canv"&#62;&#60;/canvas&#62;


heatmap = new HeatMap("canv");

Then read your dataset and push data into the heatmap:

heatmap.push(x, y, value);

At last, spread the data and [...]]]></description>
			<content:encoded><![CDATA[<p>Glad to announce my works this morning: A simple heatmap API based on HTML5 canvas.<br />
<a href="http://www.flickr.com/photos/40741608@N08/4347604245/" title="canvas by 贝小塔, on Flickr"><img src="http://farm5.static.flickr.com/4071/4347604245_486bd3a12e_o.jpg" width="300" height="215" alt="canvas" /></a></p>
<p>The programming interface is rather simple now. To create such a heatmap, you just new a heatmap object by:</p>
<pre class="brush:html">
&lt;canvas width="300" height="215" id="canv"&gt;&lt;/canvas&gt;
</pre>
<pre class="brush:javascript">
heatmap = new HeatMap("canv");
</pre>
<p>Then read your dataset and push data into the heatmap:</p>
<pre class="brush:javascript">
heatmap.push(x, y, value);
</pre>
<p>At last, spread the data and get the canvas rendered:</p>
<pre class="brush:javascript">
heatmap.spread();
heatmap.render();
</pre>
<p>Now you got it.</p>
<p>For advanced usage, you can specify the resolution of heatmap by px:</p>
<pre class="brush:javascript">
heatmap = new HeatMap("canv", 2);
</pre>
<p>Large value will gain performance with low image quality.</p>
<p>Also, you can specify a value to define the attenuation value of each px.</p>
<pre class="brush:javascript">
heatmap.spread(5);
</pre>
<p>Finally, there is an option to use your own color schema for heatmap generation.</p>
<pre class="brush:javascript">
heatmap.render(function(value, maxValue){
    var light = value / maxValue * 100;
    return "hsl(20, 75%, "+light+"%)";
});
</pre>
<p>The parameters passed in are current pixel value and max value in whole context.</p>
<p>That&#8217;s all the toolkit. More functionality and options might be added in future. Grab it from my bitbucket page:<br />
<a href="http://bitbucket.org/sunng/daily-coding/src/tip/canvas-heatmap/">http://bitbucket.org/sunng/daily-coding/src/tip/canvas-heatmap/</a></p>
<p>There is a demo page which you can test the api by clicking canvas:<br />
<a href="http://www.flickr.com/photos/40741608@N08/4347650163/" title="canvas-raw by 贝小塔, on Flickr"><img src="http://farm3.static.flickr.com/2733/4347650163_ea740356e4_o.jpg" width="326" height="284" alt="canvas-raw" /></a><br />
then click heatmap button!<br />
<a href="http://www.flickr.com/photos/40741608@N08/4348397874/" title="canvas2 by 贝小塔, on Flickr"><img src="http://farm3.static.flickr.com/2796/4348397874_8ac80b0756_o.jpg" width="314" height="275" alt="canvas2" /></a></p>
<p>This is the new year gift for my readers and my dear friends !<strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://sunng.info/blog/2010/01/happy-new-year-with-yan-0-4/" rel="bookmark" title="2010/01/01">Happy new year with Yan 0.4</a></li>
<li><a href="http://sunng.info/blog/2009/12/yan-0-3/" rel="bookmark" title="2009/12/20">Yan 0.3</a></li>
<li><a href="http://sunng.info/blog/2009/12/use-yan-in-ruby-web-application/" rel="bookmark" title="2009/12/21">Using Yan in Ruby Web Application</a></li>
<li><a href="http://sunng.info/blog/2009/12/a-button-by-gimp/" rel="bookmark" title="2009/12/09">A button by GIMP</a></li>
<li><a href="http://sunng.info/blog/2009/10/open-source-charting-libraries-in-javascript/" rel="bookmark" title="2009/10/22">Open Source Charting Toolkits in JavaScript</a></li>
</ul>
<p><!-- Similar Posts took 8.271 ms --></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fsunng.info%2Fblog%2F2010%2F02%2Fsunngs-canvas-based-heatmap-api%2F&amp;linkname=Sunng%26%238217%3Bs%20Canvas%20based%20Heatmap%20API">Share/Save</a>]]></content:encoded>
			<wfw:commentRss>http://sunng.info/blog/2010/02/sunngs-canvas-based-heatmap-api/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
	<georss:point>31.203057 121.6174866</georss:point>	</item>
	</channel>
</rss>
