Google Groups Home
Help | Sign in
Message from discussion prefs.Set not setting
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Dann (Google Employee)  
View profile  
 More options Jul 26 2007, 1:17 am
From: "Dann (Google Employee)" <d...@google.com>
Date: Thu, 26 Jul 2007 05:17:50 -0000
Local: Thurs, Jul 26 2007 1:17 am
Subject: Re: prefs.Set not setting
Hey everyone,

Regarding the inconsistent pref saves, it sounds like the problem may
be related to an older thread.  Instead of linking to it, I'll try to
explain.

I remember researching (along with Bonstio) inconsistent prefs.set()
calls and found that calling it multiple times consecutively in your
gadget often (if not always) results in inconsistent saves and lost
data.  Some values will save and some won't.  For example, this would
easily recreate the error:

<script>
...
prefs.set(k1, v1);
prefs.set(k2, v2);
prefs.set(k3, v3);
...
</script>

Each call sends out a separate request back to our servers containing
the data that it wants to save.  When multiple calls are sent
simultaneously, some requests seem to get lost along the way.  I wrote
an inlined test gadget that reproduces this problem.  Try it out for
yourself:
http://daniel-feedback-gadgets.googlecode.com/svn/trunk/test/test_set...

==

Here's something that may help the above problem.  The _IG_Prefs.set()
method has been extended to support passing in multiple UserPrefs
which can save data for all of them via a single a request.  This
prevents the issue where too many set requests are sent out
simultaneously.  Instead, bundle your prefs.set() calls into one
statement.  Here's an equivalent of the code snippet above:

<script>
...
prefs.set(k1, v1,
              k2, v2,
              k3, v3);
...
</script>

This shoots out a single request and saves all three UserPrefs.  Using
this technique makes saving much more consistent.  Here's an
equivalent test gadget which uses this technique.  It's the same test
gadget as above, but the only difference is that it's saving multiple
UserPrefs with a single prefs.set() call.  Now when I increment all
UserPref values and refresh, saves are almost 100% successful.
http://daniel-feedback-gadgets.googlecode.com/svn/trunk/test/test_set...

Conclusion:
If you're having trouble with lost UserPref saves, try consolidating
multiple prefs.set() statements under a single call.  This should help
out a lot.  Normally I'd include a link to the documentation, but we
don't have them yet meaning you get to try out an undocumented
feature ;)

Once again, here's what the call looks like:

prefs.set(k1, v1, k2, v2, ..., kN, vN) where N > 0

Try it out and let us know if it helps.

Thanks!

Dann

On Jul 24, 12:59 am, Bonstio <bons...@gmail.com> wrote:

> Hi Fitz,

> This is by design. You have to add multiple instances but then you get
> a different theme per tab. Please see the Skins group over athttp://groups.google.com/group/igskins?lnk=li

> On Jul 24, 1:53 am, fitz <fitzbe...@gmail.com> wrote:

> > Do you have to add this gadget to every tab, or can you have it use
> > the same theme for all tabs?  Whenever I switch tabs, it defaults back
> > to google's skin unless it's the tab that the gadget it on.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google