其实哪是什么封闭啊,不过是在公司大厅中间辟出一块相对独立的区域,大家坐在一起开发。别提了,我们原来都是分布式开发,也就是最近才坐在一起。除了老大偶尔自掏腰包大伙一起吃饭以外,“有人给你洗衣服”就不要想了。晚上依然是各回各家,老大的老大昨天对老大说,要注意身体,不要天天干到12点,到11点就行了。
最近一周每天工作12小时以上,身体居然真的撑不住了。昨天下午开始头痛无力,按时下了班,结果晚上就发烧了。不过咱底子好,睡了一觉功力又恢复了,今天继续干。
This content is published under the Attribution-Noncommercial-Share Alike 3.0 Unported license.
Mosaic:
http://en.wikipedia.org/wiki/Mosaic_browser
这么一看,什么标准通通扯淡,还是图片管用,什么浏览器都可以显示。
This content is published under the Attribution-Noncommercial-Share Alike 3.0 Unported license.
JTS最近发布了1.11版本,新增了:
- 对Delaunay三角网、Voronoi多边形的支持;
- 把Geometry对象转换为AWT的Shape对象的功能
- 对几何对象进行densify的操作(增加结点);
- 计算Hausdorff相似度和Area相似度的支持
计算Delaunay三角网和Voronoi多边形:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | import 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; /** * * @author Sun Ning/SNDA * @since 2010-3-3 */ public class DelaunayAndVoronoiApp { /** * create some predefined sites * @return */ public static Collection<Coordinate> getPredefinedSites(){ double[][] coords = {{100,27},{28, 50},{29, 40},{32, 90}, {12, 26}}; ArrayList<Coordinate> coordinates = new ArrayList<Coordinate>(coords.length); for(int i=0; i<coords.length; i++){ coordinates.add(new Coordinate(coords[i][0], coords[i][1])); } return coordinates; } /** * * @param coords * @return a geometry collection of triangulations */ public static Geometry buildDelaunayTriangulation(Collection<Coordinate> coords){ DelaunayTriangulationBuilder builder = new DelaunayTriangulationBuilder(); builder.setSites(coords); return builder.getTriangles(new GeometryFactory()); } /** * * @param coords * @return a collection of polygons */ public static Geometry buildVoronoiDiagram(Collection<Coordinate> coords){ VoronoiDiagramBuilder builder = new VoronoiDiagramBuilder(); builder.setSites(coords); return builder.getDiagram(new GeometryFactory()); } /** * * @param args */ public static void main(String[] args){ Collection<Coordinate> coordinates = getPredefinedSites(); /** * Delauny */ GeometryCollection triangulations = (GeometryCollection)buildDelaunayTriangulation(coordinates); int total = triangulations.getNumGeometries(); System.out.printf("Total triangulations: %d\n", total); for(int i=0; i<total; i++){ Geometry g = triangulations.getGeometryN(i); Coordinate[] coords = g.getCoordinates(); System.out.printf("Triangulation %d: ", i); for(Coordinate c : coords){ System.out.printf("(%.3f, %.3f) ", c.x, c.y); } System.out.println(); } /** * Voronoi */ GeometryCollection diagram = (GeometryCollection) buildVoronoiDiagram(coordinates); int totalDia = diagram.getNumGeometries(); for(int i=0; i<totalDia; i++){ Geometry g = diagram.getGeometryN(i); Coordinate[] coords = g.getCoordinates(); System.out.printf("Diagram %d: ", i); for(Coordinate c : coords){ System.out.printf("(%.3f, %.3f) ", c.x, c.y); } System.out.println(); } } } |
输出:
1 2 3 4 5 6 7 8 9 10 11 | Total triangulations: 5 Triangulation 0: (32.000, 90.000) (12.000, 26.000) (28.000, 50.000) (32.000, 90.000) Triangulation 1: (32.000, 90.000) (28.000, 50.000) (100.000, 27.000) (32.000, 90.000) Triangulation 2: (100.000, 27.000) (28.000, 50.000) (29.000, 40.000) (100.000, 27.000) Triangulation 3: (100.000, 27.000) (29.000, 40.000) (12.000, 26.000) (100.000, 27.000) Triangulation 4: (12.000, 26.000) (29.000, 40.000) (28.000, 50.000) (12.000, 26.000) 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) 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) Diagram 2: (11.978, 43.348) (-38.235, 76.824) (72.699, 65.730) (67.316, 48.882) (11.978, 43.348) 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) Diagram 4: (11.978, 43.348) (67.316, 48.882) (56.422, -10.619) (11.978, 43.348) |
将Geometry对象转换成Shape对象,绘制在JPanel上:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Shape; import java.util.Collection; import javax.swing.JFrame; import javax.swing.JPanel; import com.vividsolutions.jts.awt.ShapeWriter; import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Geometry; import java.util.Random; /** * * @author Sun Ning/SNDA * @since 2010-3-3 */ public class JTS2Awt { public static void showUI(final Shape... shape){ JFrame jframe = new JFrame("JTS Geometry to AWT Shape"); JPanel jp = new JPanel(){ @Override public void paint(Graphics g){ super.paint(g); Graphics2D g2d = (Graphics2D)g; if(shape != null){ for(Shape s: shape){ g2d.setColor(new Color(Color.HSBtoRGB(new Random().nextFloat(), 1f, 0.6f))); g2d.draw(s); } } } }; jp.setPreferredSize(new Dimension(150, 150)); jframe.getContentPane().add(jp); jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jframe.pack(); jframe.setVisible(true); } public static Shape toShape(Geometry geom){ ShapeWriter writer = new ShapeWriter(); return writer.toShape(geom); } public static void main(String[] args){ Collection<Coordinate> coords = DelaunayAndVoronoiApp.getPredefinedSites(); Geometry geomT = DelaunayAndVoronoiApp.buildDelaunayTriangulation(coords); Geometry geomD = DelaunayAndVoronoiApp.buildVoronoiDiagram(coords); showUI(toShape(geomT), toShape(geomD)); } } |
This content is published under the Attribution-Noncommercial-Share Alike 3.0 Unported license.
从后天起,我就要被封闭开发了。地点在公司对面的酒店里,问具体的情况据老大说,是要去一个“有人给你做饭,有人给你洗衣服”的地方,说得跟人间天堂似的。去年刚到公司实习的时候就赶上有组封闭开发,印象中好像封了有一个多月。老实说封闭开发也是没办法的事情,我们这个菜场式的办公环境,一个人手上又有多个项目,不断地有人来找你问各种各样的事情,就算不问你,问你旁边的人,声音大到耳机挡不住,这种环境下怎么可能开发出有质量的产品。参考一下敏捷团队空间注意事项,那想想,封就封了吧。
这次项目到四月中旬截止,还不太清楚会是什么情况,能不能上网,每天要干多长时间,具体情况等我从小黑屋发来现场报道吧。
This content is published under the Attribution-Noncommercial-Share Alike 3.0 Unported license.
Add this in your conkyrc
1 | ${exec curl -s "http://api.hostip.info" | xpath -e "//gml:featureMember/Hostip/gml:name/text()" -q} ${exec curl -s "http://api.hostip.info" | xpath -e "//gml:featureMember/Hostip//gml:coordinates/text()" -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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | <?xml version="1.0" encoding="ISO-8859-1" ?> <HostipLookupResultSet version="1.0.1" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.hostip.info/api/hostip-1.0.1.xsd"> <gml:description>This is the Hostip Lookup Service</gml:description> <gml:name>hostip</gml:name> <gml:boundedBy> <gml:Null>inapplicable</gml:Null> </gml:boundedBy> <gml:featureMember> <Hostip> <ip>58.212.88.212</ip> <gml:name>Nanjing</gml:name> <countryName>CHINA</countryName> <countryAbbrev>CN</countryAbbrev> <!-- Co-ordinates are available as lng,lat --> <ipLocation> <gml:pointProperty> <gml:Point srsName="http://www.opengis.net/gml/srs/epsg.xml#4326"> <gml:coordinates>118.883,32.05</gml:coordinates> </gml:Point> </gml:pointProperty> </ipLocation> </Hostip> </gml:featureMember> </HostipLookupResultSet> |
Because it uses ip to lookup your address, you cannot expect higher resolution and precision currently.
This content is published under the Attribution-Noncommercial-Share Alike 3.0 Unported license.
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 – 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文件,形如
1 2 3 4 | [default] ID = ZSPD [nj] ID = ZSNJ |
就可以直接使用
weather
Current conditions at China (ZSPD) 31-07N 121-46E (ZSPD)
Last updated Feb 18, 2010 – 08:00 AM EST / 2010.02.18 1300 UTC
Temperature: 35 F (2 C)
Relative Humidity: 47%
Wind: from the NE (050 degrees) at 7 MPH (6 KT) (direction variable)
和
weather nj
Current conditions at China (ZSNJ) 32-00N 118-48E 12M (ZSNJ)
Last updated Feb 18, 2010 – 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)
This content is published under the Attribution-Noncommercial-Share Alike 3.0 Unported license.









on
on
on