Yes, you are right indeed.

This is a tradeoff between clean code and performance penalty. From where I
test it is 184ms which is quite negligible compared to the time it takes to
load maps...



On Sun, Sep 20, 2009 at 3:06 AM, George Georgovassilis <
[email protected]> wrote:

>
> Hello Martin,
>
> Look lot cleaner than my solution - however I see a certain
> performance penalty with that. The bootstrap process with your example
> is:
>
> 1. load host page
> 2. load .nocache.js
> 3. load .cache.js
> 4. load google maps API
>
> and it's all serialized.
>
> With the direct injection of the code into the html the bootstrap
> process is shortened, because GWT's module and the Maps API load in
> parallel:
>
> 1. load host page
> 2. load .nocache.js and google maps API in parallel
> 3. load .cache.js
>
> what do you think?
>
>
> On Sep 19, 4:56 pm, Martin Delemotte <[email protected]>
> wrote:
> > Have a look at AjaxLoader:
> >
> > AjaxLoader.init("your maps key here");
> >         AjaxLoader.loadApi("maps", "2", new Runnable() {
> >             public void run() {
> >                 //action to perform after api is loaded
> >             }
> >         }, null);
> >
> > On Sat, Sep 19, 2009 at 9:42 AM, George Georgovassilis <
> >
> > [email protected]> wrote:
> >
> > > Sorry to hijack this thread, but since we're talking about this...
> > > what's the best way of loading the maps API javascriptlibrary without
> > > blocking (aka unblocking parallel downloads)?
> >
> > > So far I ended up with this:
> >
> > > <script type="text/javascript">
> > > //<![CDATA[
> > > function loadGoogleMapsAPI(){
> > > var script = document.createElement("script");
> > > script.type = "text/javascript";
> > > script.src = "http://maps.google.com/maps?
> > > file=api&v=2&async=2&sensor=false&key=XYZ";
> > > document.body.appendChild(script);
> > > }
> > > window.setTimeout("loadGoogleMapsAPI()",1);
> > > //]]>
> >
> > > On Sep 19, 4:33 am, martind <[email protected]> wrote:
> > > > I formatted my disk and reinstalled Fedora 11 yesterday. I do not
> > > > encounter the problem anymore.
> > > > I guess I will never know what was wrong ;)
> >
> > > > On Sep 13, 11:34 am, martind <[email protected]> wrote:
> >
> > > > > If I compile my application and run it in my system browser, it
> works
> > > > > fine. Firebug raises no issues.
> >
> > > > > However, it fails in hosted mode...
> >
> > > > > On Sep 12, 5:57 pm, Eric Ayers <[email protected]> wrote:
> >
> > > > > > I've not heard of problems using the Maps API with GWT 1.7.  Can
> you
> > > > > > use firebug or some other way to trace your network messages and
> see
> > > > > > that indeed the script tag you've got in your module
> specification is
> > > > > > working?
> >
> > > > > > On Sat, Sep 12, 2009 at 5:48 PM, martind<
> [email protected]>
> > > wrote:
> >
> > > > > > > 1) yes, I have tried running it with a Maps key. I also tried
> > > > > > > generating a new one with no luck.
> >
> > > > > > > 2) no, I am on Fedora 11 with Firefox 3.5.3
> >
> > > > > > > I have another error related to the Maps API which might help
> > > diagnose
> > > > > > > the problem:
> >
> > > > > > > [ERROR] Unable to load module entry point class
> > > > > > > com.coopiz.client.Coopiz (see associated exception for details)
> > > > > > > com.google.gwt.core.client.JavaScriptException: (TypeError):
> > > > > > > $wnd.GClientGeocoder is not a constructor
> > > > > > >  fileName: transient source for
> > > > > > > com.google.gwt.maps.client.impl.__GeocoderImplImpl
> > > > > > >  lineNumber: 30
> > > > > > >  stack: ()@transient source for
> > > > > > > com.google.gwt.maps.client.impl.__GeocoderImplImpl:30
> > > > > > > gwtOnLoad([object Window],"coopiz","1.6")@:0
> > > > > > > gwtOnLoad(undefined,"coopiz","http://localhost:8080/coopiz/
> > > ")@http://
> > > > > > > localhost:8080/coopiz/hosted.html?coopiz:20
> > > > > > > qc()@http://localhost:8080/coopiz/coopiz.nocache.js:2
> > > > > > > ()@http://localhost:8080/coopiz/coopiz.nocache.js:8
> > > > > > > @http://localhost:8080/coopiz/hosted.html?coopiz:39
> >
> > > > > > >        at
> > > com.google.gwt.maps.client.impl.__GeocoderImplImpl.construct
> > > > > > > (Native Method)
> > > > > > >        at
> > > com.google.gwt.maps.client.geocode.Geocoder.<init>(Geocoder.java:
> > > > > > > 41)
> > > > > > >        at com.coopiz.client.model.PersistenceManager.<init>
> > > > > > > (PersistenceManager.java:26)
> > > > > > >        at
> > > com.coopiz.client.controllers.ApplicationController.<init>
> > > > > > > (ApplicationController.java:14)
> > > > > > >        ...
> >
> > > > > > > If I comment the portion of code which generates the error
> above, I
> > > > > > > get the error reported in the first message of this thread.
> >
> > > > > > > Could it have something to do with an upgrade from GWT 1.6 to
> 1.7 ?
> > > I
> > > > > > > just checked the upgrade steps but maybe I missed something ?
> >
> > > > > > > On Sep 8, 11:27 am, Eric Ayers <[email protected]> wrote:
> > > > > > >> 1) Have you tried running it with a Maps key installed as the
> > > error
> > > > > > >> message suggests?
> >
> > > > > > >> 2) Are you on Windows?  If so, have your IE
> cache/proxy/security
> > > > > > >> settings changed recently?  That sometimes gets in the way of
> the
> > > > > > >> Google APIs requests.
> >
> > > > > > >> On Mon, Sep 7, 2009 at 6:50 PM, martind<
> > > [email protected]> wrote:
> >
> > > > > > >> > Hi all,
> >
> > > > > > >> > I'm using:
> > > > > > >> > - GWT 1.7.0
> > > > > > >> > - gwt-maps 1.0.4
> > > > > > >> > - GAE 1.2.5
> > > > > > >> > - Eclipse 3.5 with the Google plugin
> > > > > > >> > - Sun JDK 1.0.6_16
> > > > > > >> > - linux (Fedora 11)
> >
> > > > > > >> > A few weeks ago, I began a project using gwt-maps which
> worked
> > > fine.
> > > > > > >> > But somehow it got broken recently. I get the following
> error in
> > > > > > >> > hosted mode:
> >
> > > > > > >> > [ERROR] Unable to load module entry point class
> test.client.Test
> > > (see
> > > > > > >> > associated exception for details)
> > > > > > >> > java.lang.RuntimeException: The Maps API has not been
> loaded.
> > > > > > >> > Is a <script> tag missing from your host HTML or module
> file?
> > >  Is the
> > > > > > >> > Maps key missing or invalid?
> > > > > > >> >        at
> > > com.google.gwt.maps.client.Maps.assertLoaded(Maps.java:32)
> > > > > > >> >        at
> > > com.google.gwt.maps.client.geom.LatLng$.newInstance(Native Method)
> > > > > > >> >        at test.client.Test.onModuleLoad(Test.java:46)
> >
> > > > > > >> > My Test.gwt.xml file is the following:
> >
> > > > > > >> > <?xml version="1.0" encoding="UTF-8"?>
> > > > > > >> > <!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web
> Toolkit
> > > 1.7.0//
> > > > > > >> > EN" "
> > >http://google-web-toolkit.googlecode.com/svn/tags/1.7.0/distro-
> > > > > > >> > source/core/src/gwt-module.dtd">
> > > > > > >> > <module rename-to='test'>
> > > > > > >> >  <!-- Inherit the core Web Toolkit stuff.
> > >  -->
> > > > > > >> >  <inherits name='com.google.gwt.user.User'/>
> >
> > > > > > >> >  <inherits name="com.google.gwt.maps.GoogleMaps" />
> > > > > > >> >  <script src="http://maps.google.com/maps?
> > > > > > >> > gwt=1&amp;file=api&amp;v=2&amp;sensor=false" />
> >
> > > > > > >> >  <!-- Inherit the default GWT style sheet.  You can change
> > > -->
> > > > > > >> >  <!-- the theme of your GWT application by uncommenting
> > >  -->
> > > > > > >> >  <!-- any one of the following lines.
> > >  -->
> > > > > > >> >  <inherits
> name='com.google.gwt.user.theme.standard.Standard'/>
> > > > > > >> >  <!-- <inherits
> name='com.google.gwt.user.theme.chrome.Chrome'/>
> > > -->
> > > > > > >> >  <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/>
> > > -->
> >
> > > > > > >> >  <!-- Other module inherits
> > >  -->
> >
> > > > > > >> >  <!-- Specify the app entry point class.
> > > -->
> > > > > > >> >  <entry-point class='test.client.Test'/>
> > > > > > >> > </module>
> >
> > > > > > >> > I used wireshark to debug and it seems that "
> > >http://maps.google.com/
> > > > > > >> > maps?gwt=1&amp;file=api&amp;v=2&amp;sensor=false" is never
> > > acessed. If
> > > > > > >> > I try loading the URL in my browser it works fine.
> >
> > > > > > >> > At first I thought it was an issue with Fedora Eclipse or
> with
> > > OpenJDK
> > > > > > >> > so I replaced them with the "official" eclipse and Sun JDK
> but
> > > no
> > > > > > >> > luck...
> >
> > > > > > >> > Has anybody got the same issue ?
> >
> > > > > > >> --
> > > > > > >> Google Code Jam 2009http://code.google.com/codejam
> >
> > > > > > --
> > > > > > Google Code Jam 2009http://code.google.com/codejam
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to