Techblog

Tech Blog

Our latest geek adventures!

Archive for June, 2007

28 June allowDomain() troubles … again

This time it’s a little different then the last time (with the subdomains). In the Floorplanner all the furniture elements are seperate swf’s which are loaded one by one. To minimize our data traffic we wanted to move all the furniture swf’s to Amazon’s S3 service and load them from there.

To get all the swf’s to S3 we used the Amazon S3 Firefox Organizer which is a very nice Firefox extension. Then we changed all the url’s in the (development) database and everything seemed to work fine.

BUT….. (there always is a but) one tiny little thing didn’t work, you couldn’t change the color of the furniture. Every furniture element has a color movieclip, but the Floorplanner couldn’t reach it anymore. Because the swf’s are loaded from another server, the SandBox security of Flash just didn’t allow it.

To make a (very) long story short… we had to add one line of code to every swf:

System.security.allowDomain( '*' );

We tried all different kind of things:

System.security.allowDomain( '*.floorplanner.com' );
System.security.allowDomain( 'floorplanner.com' );

System.security.allowDomain( 'www.floorplanner.com' );

this one did work, but then the subdomains didn’t…..

System.security.allowDomain( 'http://floorplanner.com' );

System.security.allowDomain( 'ip-address' );

System.security.allowDomain( 'http://ip-address' );

and the only one that really worked was ‘*’ …. aarrrgggghhh.

2 Comments -

26 June Rails and Foreign languages

Posted by Gert-Jan in Ruby on Rails

A few weeks ago, Gert-Jan asked me to post a item about languages, Rails and encoding types, since we had some trouble seeing Chinese characters as question marks in the production environment and not in the development environment. So here it is, after about four weeks of seeing this to-do item on my list ;-)

Languages such as Chinese, French, German and Swedish all use different symbols that are not supported by default settings as Latin. MySQL however has a default setting of UTF-8 and that’s the type of encoding we want. For Chinese you could also use Big5 and for Swedish you could use Swe7, it all depends on what you need, but I recommend UTF-8 for all foreign languages.

It worked perfect in our development environment but after we deployed, all characters of our weblog where transformed into question marks. After trying to change the HTML file encoding and searching the Internet for a while I didn’t find any solution. After further investigation I passed by the database.yml file to check if there was a problem of retrieving the wrong database and there I found it. Our development settings had a encoding type as parameter and the production settings did not. It was a stupid mistake but I could guess more people have problem. So If you want to use your foreign language please use the “encoding: utf8″ parameter in your database.yml and be sure to set your database up with the right encoding.

No Comments -

8 June Flash rotation

Last week we’ve been working on an importer for the Floorplanner. It allows us to generate a floor plan based on a xml file from one of our clients. This way they can keep drawing the plans with their own software and export them to the internet with the click of a button.

While working on the importer we came across an issue with the rotation in Flash. After generating a floor plan, the rotation of all doors and windows we’re slightly off. They all seemed mirrored.

After reading the documentation it became clear that Flash uses a different way of working with rotations.Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation. Wikipedia tells us that the rest of the world uses a different approach.

Solution: mc._rotation =* -1;

No Comments -