Friday, June 27, 2008

64-bit computing

I have used 64-Ubuntu for a few month now. I seriously thought about using a 64-bit Linux one and a half year ago. Back then one needed to fix a lot of things to get it work nice, i.e. fixing flash.
Have things been better? Yes. Are they good? Definitely no.

On a modern Ubuntu version you can get flash work with no trix. Its still not 64-bit., which I have written about earlier. Most codecs in the video-players works as well.

But there are several other problems. I have also written about Google Web Toolkit and 64-bit Linux, which was a bit of a hassle. We also have several binary drivers that is 32-bit only.

Today I want to install Google Gears. Guess what? It does not support 64-bit, except if you use the ugly ndiswrapper solution. All new processors from AMD and Intel are 64-bit, except Intels new Atom processor. This must mean that most of the computers used today supports 64-bit. So why doesn't we get 64-bit support in our software?

Saturday, June 14, 2008

Circles in PostGIS

OGC and PostGIS has no data type to represent a circle. Instead one use ST_Buffer(geom, distance) to get a geometry that covers the area within the distance to geom. So if geom is a point you get a circle. But it does not return an exact circle. The circle is approximated represented by a polygon using eight points. One can increase the precission by adding a third argument to ST_buffer that is the number of points in the polygon returned. The unit for distance depends on what SRID is used.

But what if you have a geometry that you know is a circle created with the method above? There is no exact method as far as I know, but her comes a good approximation.

First we want the origo of the circle. ST_Centroid(geom) comes to handy. It returns the centeroid point of the geometry, in this case the origo of the circle.

To get the radius we pick out the first point in the polygon returned by ST_Buffer with PointN(ExteriorRing(geom),1).
We need to call ExteriorRing to get the polygon of geom since ST_Buffer does return type is a geometry and not a polygon. Then we calculate the distance betwen origo and the polygons first point with ST_distance_sphere. ST_distance_sphere always returns distance in meters.

All together:
circle=ST_Buffer(GeomFromEWKT('SRID=3021;POINT(1537619 6347866)'),
10000, 16)
origo=ST_Centroid(geom)
radius=ST_distance_sphere(PointN(ExteriorRing(geom),1), origo)

I use the swedish projection RT-90 which uses distances in meters to create the circle.

Sunday, June 8, 2008

Bits, Bytes, and Words

I have observed that I haven't written in this blog for nearly a month. Not much has happened in the area of this blog.

  • Some more colleges has start using Linux on their desktop.
  • Currently I am developing an "failsafe" system for emergency handling in Java/JEE/Spring. I am now working on the second generation.
  • I have updated a lot of crypto keys as a follow up to the nasty openssl-bug in Debian/Ubuntu.
Today I listened to a talk by Martin Fowler and Jim Webber about middleware and Enterprise Service Buses (ESB). A talk well worth listen to if you are working in or close to the SOA world.