Thursday, 4 June 2009

XML and Database Content

I was experimenting with various development tools to present end-user database information, via a Java Web App and really struggled to get consistent results. Some queries would return data correctly, while others simply failed miserably. Usually in situations like this, you need to make sure that database access is correct, field specifications and SQL correctly formatted - you know the deal.

However, best as I might try, I simply could not get some queries to work. Admittedly my environment is quite complex, with various databases and servers, including a GlassFish App Server and a few web servers involved. In the end, the answer was very simple, and I really should have picked this up earlier. The app needs to generate the 'answer' of the query as XML output. Eventually it dawned on me - special XML characters!! Some of the database queries returned field values that contained 'special' XML characters, such as < or > or &. These are used in XML (obviously) to start and end tags (as an example). To solve the problem, you need to 'clean' every returned value from the database, before rendering the XML output. Some of the special characters are :

& replace with &amp;
< replace with &lt;
> replace with &gt;
" replace with &quot;
' replace with &apos;

Once this was done, the XML was properly formatted and could then be used by apps further down the chain.

Saturday, 2 May 2009

Google Maps and UK Postcodes

Had a real problem yesterday, when testing the use of UK Postcodes and trying to geocode the location using Google Maps API. Turns out that Royal Mail has copyright on the data and does not want everybody to use it.

Found a very useful article at that gave a very useful solution! The solution is to combine the google maps search with the google AJAX API to do a local search, if the search string 'looks like' a UK postcode. Implemented these changes and we can now reliably find UK postcodes. We need to quickly find locations, as the location is used in our new Sun/Shadow simulation. If you are intested in knowing the exact validation for UK postcodes - have a look

Friday, 24 April 2009

Sun Position calculations

I am currently implementing a sun/shadow study interface. This will allow a user to define the 'location' of the current drawing, in terms of latitude and longitude. Using calculations from the position of the sun from any location on Earth, will be possible. We can then calculate the position of a 'shadowlight' and display that in real-time using the shadowing engine in the system. This can also be video captured to produce a shadow study.

3D Animations

Started working on a new animation control, that will bring together the various types of animations in the system. It is mainly going to be used for displaying real-time shadows, linked to the current drawing 'location', which is derived using a Google Maps interface (more about that later). This will enable users to do a 'shadow study'. It will also be used to control the video capture (and possibly the 3D sound interface) functionality.

Thursday, 23 April 2009

3D Development

Around 18 months or so ago, I decided to look at the 3D development within genes1s CAD. We were getting to a stage, where the 2D and database side of the system, was pretty much well developed, but the 3d component was certainly lacking in functionality, stability and extensibility.

I looked around for some suitable 3d engines. I have developed a 3D viewer for the system in Directx 8.1, but this was difficult to maintain and lacked in features. I came across the irrLicht 3d engine, developed by Niko Gerbhardt and after some initial testing, I decided to use this engine. We use the engine primarily for display purposes and don't really use many of the other features (like collision detection or 2D GUI) as that is already taking care of with the existing components of the system. It turned out to be a wise decision, as the irrlicht library has been proving to be excellent. We are currently using version 1.5. It is an open source project and long may it's development continue. It provides us with the ability to support a multitude of graphics subsystems, including DirectX 8.x, 9.x and OpenGL. There is also support for software only (BurningsVideo) drivers.

irrKlang Integration

I want to write a lot more about the new developments in the system over the last 18 months or so, but recently I added support for 3D sound in the new engine, using irrKlang. This library is developed by Niko Gebhardt. He is well known for the development of the irrLicht 3D engine, that we use with the CAD system. We have recently upgraded to the Pro edition of the irrKlang library. Here is a link to irrKlang (and some of the other products that Niko is responsible for).

3D CAD Development

I thought it would be a good idea to start a blog about the various features and developments that is ongoing within the system. The one thing we have always been good at, is to development excellent products, but the one thing we have been pretty poor with, is to actually tell people what we are up to. Please visit this blog on a regular basis and see where we are going with developments in the various products.

Using Attributes and Colours

Here I am showing how we can use pattern attributes to display objects using different colours. We are using an attribute called ROOM_USE to...