Archive for September, 2008

Rotate Effect and Non Embedded Fonts in Flex 4

Thursday, September 25th, 2008 by Greg Jastrab

One big improvement in Flash Player 10 is that fonts no longer need to be embedded in order to rotate text or alter it’s alpha. Below is a simple example demonstrating both of these features by using the Rotate and Fade effects in Flex 4.

(Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)

Check out how simple the code is below!

(more…)

Fork Pools in Ruby on Rails

Friday, September 19th, 2008 by Nick Gauthier

If you need to process 1000 items independently, the simplest thing to do is to handle them one-by-one. But what if there is a large delay that is not caused by your application when you handle an item? What if you need to make a 100ms web request per item, only to do about 10ms of processing on that item? This would take 1000 x 110ms (100ms to wait, 10ms to process)!

So what do we do?

(more…)

Migrating Serialization Changes Within an AIR Application

Thursday, September 11th, 2008 by Greg Jastrab

I just submitted my entry to the AIR Cookbook for the AIR Cookbook Cook-off.

It solves the problem of having your AIR application store an IExternalizable class on disk but then later adding more fields to that class. How would you read the old version of the class without encountering a runtime error if you tried to read the new field that wasn’t present in the older serialization?

Go check it out the cookbook entry to find out how to do this and please rate the article!

Using ActiveRecord’s to_xml to produce custom xml including deep level associations

Wednesday, September 10th, 2008 by Glenn Gentzke

ActiveRecord provides a powerful method to all its records called to_xml. Most web developers using RoR should be familiar with its usage and hopefully use it for their simple xml production needs. But what do you do when you need to produce xml that is selective, includes associations, or contains custom tags? There are many ways to manipulate to_xml’s output and I’ll explain a few below.
(more…)

Ruby: Patch to fix broken YAML.dump for multi-line strings (String#to_yaml)

Thursday, September 4th, 2008 by John Trupiano

I love YAML. It’s portable. The majority of languages I work with already have libraries built to read/write it. It’s more lightweight, more expressive, and easier to read than XML. I really love YAML.

Unfortunately, it turns out that Ruby’s YAML library is a little incomplete for some edge cases. I just discovered that YAML.dump fails to generate valid YAML for certain multi-line strings. The specifics are very difficult to explain, and we’ll summarize them at the end after trying out some examples. Fire up irb and give the following a try.

require 'yaml'
s = "\n  Something embedded.\nAnd on a new line."
YAML.load(YAML.dump(s))

(more…)