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?
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??
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…
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:
- be sure that application fails when adding GPolyline to map –
- spend a lot of time digging in Your code, even try to understand cryptic, auto-generated GM API code
- leave problem for a few days or even weeks
- return to issue
- read Google Maps API reference
- add VML namespace and CSS definitions
- proceed with coding
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.
I have noticed recently, that most often made typo by me is SERACH. Looks like I’m not only one having this problem. And what is Your most often made typo?
It hits me most often with misspelled hash keys, like
params[:serach] in Rails. This one drives me crazy :)
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:
- acts_as_paranoid and
- 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:
- data were updated/deleted on one side
- data were updated on both sides
- on one side entry was deleted and on the other side were updated
Newer entry takes precedence.
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.
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 :)