GM API shape getter plus bonus

Free goodies! Everybody likes them, am I right? Do You want some?

Some time ago I wrote simple tool to create shapes (GPolygon) with GoogleMaps API. I planned to add some features like drag&drop and finally (after two months) found some time to finish it. On http://nhw.pl/download/points.html I have published new and shinny version. Drag&drop, new icons and delete last points.

But where are ours free goodies?

Continue reading

IE errors with GPolyline – one more word

Despite of ironing some stupid mistakes with IE and GPolygon, strange things still have happened. I become suspicious when my IE7.0 have refused to work properly with official Google Maps API examples with error:

Wyst?pi? b??d w czasie wykonywania.
Czy chcesz debugowa??

Wiersz: 687
B??d: Arg: Fraction out of range (0 to 1 allowed)

(Win XP Prof, Polish, IE7 English – update IE7 also Polish version, I was tired :) at that moment)

That was too much. So, useful hint – run IE with all addons disabled (C:\Program Files\Internet Explorer\iexplore.exe --extoff) and test it again.

Of course, without addons examples runs smoothly. And few moments later I knew that DebugBar has caused this problem. I have installed it, but not used on daily basis (due to its license), so I have forgot I got this tool. Maybe I would found this error earlier if I would remember…

Strange error in IE when using GPolyline

When using GPolyline in application based on Google Maps API and application in Internet Explorer fails with strange errors deep in API, You can recover by sticking to following procedure:

  1. be sure that application fails when adding GPolyline to map – map.addOverlay(new GPolyline(points))
  2. spend a lot of time digging in Your code, even try to understand cryptic, auto-generated GM API code
  3. leave problem for a few days or even weeks
  4. return to issue
  5. read Google Maps API reference
  6. add VML namespace and CSS definitions
  7. proceed with coding

Or You can skip points starting from 2 to 5 (optionally). But all hardcore wannabe JavaScript developers (like me!) have to go go through all points ;-)))

Drat and double drat. When I was really novice with Google Maps API I have used API reference more often, with good results ;-)

So, when this happen to You remember to add proper definitions.

Apollo and Rails

On hype with Apollo launch, I’ve found one quite interesting information. About Slingshot, tool which allows developers to deploy Rails applications that work the same online and offline (with synchronization). Unfortunately Slingshot won’t be available for free (probably).

Well, it looks I had an idea how such solution should be build, at least in terms of synchronization. When You need drag and drop deployment You may consider JRuby? But lets talk about synchronization. My idea is based on fact that basically local Ruby on Rails application and normal web application are identical. Most important they share data structure – models. Magic ingredients would be:

  • updated_at
  • created_at
  • acts_as_paranoid and deleted_at
  • custom web service on web application side

Every table needs those three fields in schema. Based on information in them and last date of synchronization we can tell which rows were changed, added or deleted. Using web service we can exchange this data.

When syncing we can find following cases:

  1. data were updated/deleted on one side
  2. data were updated on both sides
  3. on one side entry was deleted and on the other side were updated

Ad. 1
Newer entry takes precedence.

Ad. 2
Conflict can be resolved in few ways: by date of change, by side (for example, web server wins always) or leave to user to decide.

Ad. 3
Like in 2 or by operation type (delete takes precedence over change).

One issue more which I came when thinking about those tool, are IDs for new entries. It is obvious (is it ?) IDs for entries have to be taken from different, distinctive spaces just to avoid conflicts. There can not be possible to create two different object in local application and web version with the same ID.

I can not find any more potential issues so I’m sure that I’m missing something important – it just looks to easy :)