Don't write another line code until you have seen this Get link Facebook X Pinterest Email Other Apps November 10, 2007 I think this talk is one of the best talk I have found in Googles Engineering series. Google talks are generally very good, but this is even better and has a good speaker.Joshua Bloch talk "How To Design A Good API and Why it Matters" presents a lot of good information what to think about when creates API:s. Even if you aren't writing another framework it is important. I think people seems to believe today that reuse can only be done using frameworks. Joshua points out the importance of good API:s inside your program and for different modules.I would also like to add that this is important when designing new XML-DTD:s, which is a kind of API. For instance, I have seen XML file formats that says the address-tag includes space separated e-mail addresses. Why not use multiple address-tags, one for each address. In this way I can solely use my XML-parser to parse the file and do not need add extra code to separate the sting at spaces.If you do not have an hour at the moment, remember this points which I have taken from the talk:When in doubt, leave it outDon't make the client do anything that the module could doThe paper he gives away he says is from the abstract from OOPSLA so I assume it is this abstract he means. I like rule of thumbs in this format.A very good book on the same topic is "Object-Oriented Design Heuristics" by Riel. Get link Facebook X Pinterest Email Other Apps Comments
Circles in PostGIS June 14, 2008 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... Read more
Create your own CA with TinyCA2 (part 1) June 18, 2007 A Certificate Authorities (CA) issues certificates to people and organization that gives us the possibility to know that we surf to the right web site and not a phising site. This concept can be nice to use on your private sites too, but you may not want to spend a lot of money to get a certificate for your site. Most common when one installs a web-mail server at home is using a self signed certificate. When one surf to the web-mail server from a friends computer one can not be sure that nobody listens to the traffic if one not verifies the signature of the self signed certificate. Maybe an easier and definitely a more scalable solution to this is to create ones own CA structure. When we are ready with this how to you will have installed a certificate on your web server, installed the root certificate into your Firefox, and you will have the root certificate stored on a USB-memory stick. First time you want to read your mail from a friends computer you install the root certificate f... Read more
Create your own CA with TinyCA2 (part 2) June 19, 2007 In part one of this series we created a root CA, a sub-CA and a certificate for our web site All certificates are stored in TinyCA2 s configuration. In this part we will: export the root CA:s certificate import the root CA:s certificate into Firefox export the certificate for the web site configure our web server to use the web site certificate To be able to import the root CA certificate to Firefox we must export it from TinyCA2. In the main window of TinyCA2, open the CA-menu and select Open CA. Select your root CA. Select Export CA Certificate in the toolbar, which is the second icon from the right. You may change the file name. Press Save when ready. Start Firefox, select the Edit-menu and Preferences. Click the Advanced icon and then the Encryption tab. Select View certificates and then the Authorities tab. You can see all the CA:s you trust. Click Import and select the file with your exported root certificate. You can in the Downloading Certificate window control what purpo... Read more
Comments