Archive for the ‘Uncategorized’ Category

Recreating Ely’s Flex 4 List Component Series: Part 3 - Adding Transitions

Saturday, August 23rd, 2008

In Part 2 we added hovered and selected states to the ItemRenderer for the list items. In this part we’ll add some transitions to make the list look more like an Accordion. Since screenshots won’t do the example justice this time, I’ll show a screencast I made demonstrating the result first:

(Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)
(Sorry for the embed being cutoff, still figuring out the params to this word press plugin. Click through for the full embed on its own page.)

Keep reading for the source…

(more…)

Getting Subclipse to Work in Gandymede (Eclipse 3.4)

Thursday, August 21st, 2008

I just upgraded Eclipse to 3.4 (Gandymede) since the latest upgrade to Flex Builder included support for Gandymede. I did my typical install by extracting the Gandymede tarball and then installed Subclipse through the Software updates (now in Help -> Software Updates…).

It looked like everything installed okay but then when I tried to do an update in an existing project I got an error:

"Unable to load default SVN Client"

The key is to include the SVNKit Adapter JavaHL Adapter when you install Subclipse:

Include JavaHL when installing Subclipse.

Include JavaHL when installing Subclipse.

Hope that saves some people some time.

NOTE: Thanks to Mark for pointing out the recommended usage of JavaHL instead of SVNKit!

Recreating Ely’s Flex 4 List Component Series: Part 2

Tuesday, August 19th, 2008

In Part 1 of this series we learned how to create an ItemRenderer for a List in Flex 4. I wanted to get through 2 steps tonight, but only have the code for the next step finished. This code creates the item renderer seen at ~4:20 of Ely’s video.

(more…)

I can’t upgrade RubyGems from 1.1.1 to 1.2.0 on Ubuntu

Monday, July 7th, 2008

Just a quick little snippet here. RubyGems 1.2.0 dropped roughly two weeks ago….however, I’d been having trouble getting my 1.1.1 installs on Ubuntu to update properly.

john@john-ubuntu:~/passenger-recipes$ gem -v
1.1.1
john@john-ubuntu:~/passenger-recipes$ sudo gem update --system
Updating RubyGems
Nothing to update
john@john-ubuntu:~/passenger-recipes$ gem -v
1.1.1
john@john-ubuntu:~/passenger-recipes$ sudo gem update --system
Updating RubyGems
Nothing to update

The first few times I ran into this, I was too busy to figure out what was wrong and ignored it. However, there is one HUGE TIME SAVER in 1.2.0 that I just couldn’t wait for any longer. Up through 1.1.1, gem update and gem install calls both updated all locally cached gemspec’s from your gem sources. This not only led to large memory consumption (anyone on a VPS got a horror story?), but was also just a plain waste of time. If I know which gem I want to update, it should just update that gem. The onus should be on me specify that I want to fully update my cache.

That said, I finally came across Eric Hodel’s notice addressing this very problem. The solution:

john@john-ubuntu:~/passenger-recipes$ sudo gem install rubygems-update -v 1.1.1
Bulk updating Gem source index for: http://gems.rubyforge.org/
Successfully installed rubygems-update-1.1.1
1 gem installed
john@john-ubuntu:~/passenger-recipes$ sudo gem update --system
Updating RubyGems
Updating rubygems-update
Successfully installed rubygems-update-1.2.0
Updating version of RubyGems to 1.2.0
Installing RubyGems 1.2.0
...
... (success)
...
john@john-ubuntu:~/passenger-recipes$ gem -v
1.2.0

Happy upgrading.

Ruby on Rails Polymorphic Association Benchmarks

Friday, June 13th, 2008

Polymorphic relationships in Ruby on Rails are great. If you don’t know what they are, check them out here:

Understanding Polymorphic Associations

John and I were curious about the speed of these relations, since the linking between objects searches on both the ID of the foreign object, and a string which is the model name. So if you have two tables, ChildA and ChildB, your parent has a reference to child which is acutally the combination of child_id (the ID in the ChildA or ChildB table) and child_type (equal to “ChildA” or “ChildB”).

The old-school way of doing this involves creating a lookup table and using integer IDs for type, instead of strings. So you’d have another table mapping “ChildA” to “1″ and “ChildB” to “2″, then when you do your query, you are matching against the number “1″ and not the string “ChildA”.

The down side of doing it that way is that you don’t get to use Rails’ snazzy polymorphism, which makes life a lot easier. So we decided to run some tests to see how much faster it would be, and therefore, if it was worth it.

(more…)