Archive for March, 2005

using ’set variable’ to store a new array in a sharedObject BUG

PROBLEM  Today I ran into a rather perplexing bug in Flash when I tried to create/write to a shared object. I needed to create an array named after an ID and then store 3 values into that array. The idea is that each ID would have its own array with its own 3 values. Since the name of the array would depend on which ID we were dealing with, I resorted to using the set variable command in order to use a variable as the name of the array like this:

myData = sharedobject.getLocal("myData", "/");
set("myData.data."+ID, new Array());
eval("myData.data."+ID)[0] = value1;
eval("myData.data."+ID)[1] = value2;
eval("myData.data."+ID)[2] = value3;

But to my dismay, not only was nothing being written to the shared object, the shared object wasn’t even being created!

SOLUTION:  The solution that I came up with isn’t great, but it works. I figured out through much trial and error that unless something else is written to the shared object without using Set Variable, Set Variable won’t work. Not only that but if you set, for example:

myPersonalData.data.test = true

you will only be able to write to the shared object a single time because next time, since myPersonalData.data.test is already set to true, nothing changes. In order to work around this I used the following solution:

myData = sharedobject.getLocal("myData", "/");
myData.data.lastIDStored=ID;
set("myData.data."+ID, new Array());
eval("myData.data."+ID)[0] = value1;
eval("myPersonalData.data."+ID)[1] = value2;
eval("myData.data."+ID)[2] = value3;

The reason this works so well is because if I’m creating a new array, I’m sure the ID has never been used before and therefore will never be the last ID stored.

The problem only exists when creating a new array, not for changing the array, so if the last ID is the same as the new ID it won’t matter.

Bookmark and Share

1 Response  |  add yours »

Firefox cache issues

As a web developer, I am constantly reloading pages that are still in the development stage to see how my code is affecting the outcome (Dreamweaver can only preview so well in the design window, thank goodness for F12). Since I want to be absolutely sure that what I’m seeing is the most current version, I always turn my “Temporary Internet Files” and my “Cache” off. This becomes especially important as I develop with Flash.

When Firefox came out, I went to the options dialogue to turn off the cache and only noticed the option to specify how big the cache could be. So I ignorantly set the size to zero and thought it would do the trick. wrong! This causes major problems with our friend the Firefox.

The first issue I noticed was that I could no longer install extensions and themes. For some reason, firefox has to cache them before it can install them. So, thinking I was a genius, I set the cache limit to 1, instead of zero. That fixed the problem. For the past 6 months (or however long I’ve been using Firefox now) that’s the way it’s been. Until today.

Lately I’ve noticed that my personal websites (including the blog you are reading now) have had problems loading the CSS file. It was kind of random; sometimes it loaded, sometimes it didn’t. I searched and researched the problem blaming Firefox all the way. But today, as part of my research, I upped my cache to 10000 and the problem went away. So I started researching more in that direction and came across a help file on mozilla.org telling me that if I wanted to turn off cache I could do it by plugging about:config into the address bar and changing the setting browser.cache.disk.enable to false.

DUH! Why didn’t I think of that before. Probably because it should be in the options menu to begin with, in my opinion.

Now even though I have my cache set to zero my CSS files are loading properly and extensions have no problems installing because I have actually turned cache “off”.

Bookmark and Share

13 Responses  |  add yours »

Backing up Firefox settings, bookmarks, extensions, themes, etc.

Today I wrote a batch file to back up my Firefox settings. Yesterday, I lost all of my Firefox settings because, like an idiot, I was messing with the application data files without backing them up first. So after re-installing all of my favorite extensions and theme, I decided it was something I never wanted to have happen again. I researched to death a way to transfer this stuff from my laptop (WIN XP) to where the data was lost (WIN 2000), but after a long time I realized that the following file was causing problems:
C:Documents and SettingsprofileApplication DataMozillaFirefoxProfiles
random.defaultchromeoverlayinfobrowsercontentoverlays.rdf
and since I couldn’t figure out a way around it, I gave up. If you know how to deal with it, or why that file causes me problems, I’d love to hear about it.

I also spent a while on google trying to find any type of backup/restore extensions or programs. I did find one called MozBackup, but not only are they not developing it anymore, it didn’t work.

In my research I realized that you can just copy the firefox directory, and use it for backup. So I created a directory called c:documents and settingsprofilemy documentsFFBackupfirefox and a batch script called backupFF.bat in my C:/ root directory with the following code:

xcopy /E /Y “c:documents and settingsprofileapplication datamozillafirefox” “c:documents and settingsprofilemy documentsFFBackupfirefox”

exit

Then I went to control panel > shceduled tasks and created a new schedule to run my bat file once a week. As far as I can tell, problem solved.

Bookmark and Share

1 Response  |  add yours »

Search