Archive for the 'Note to self' Category

Flex Builder 3, .swc Libraries and Linked Source

I’ve been using Mate for some time and liking it very much. I wanted to be able to use Flex Builder’s ability to navigate to and view the source of included types. With only having the downloaded .swc file in my /libs directory that wasn’t possible. It took me some time to sort it out, so here’s my recipe in case it helps anyone (and so I can remember next time).

This should also work for any project that you can download the source for, that just happened to be Mate for me. I’m using Flex Builder 3 — not sure what would be different if anything with FB2.

1. Download the source using the directions here

2. Create a Flex Library Project in Flex Builder, let’s call it ‘MateLib’

3. Import the source into the project, leaving out all the .svn directories, such that your folder structure looks like:

MateLib
   /bin
   /com
      /asfusion
         /mate
            /etc....
   manifest.xml

4. Right click the project in the FB Navigator view and select: Properties -> Flex Library Compiler. Set the Namespace URL: to “http://mate.asfusion.com/” and Mainifest file: to manifest.xml

5. Save and build the project.

6. In your project that uses the library, select Properties -> Flex Build Path and click Add SWC and navigate to the MateLib project -> /bin folder and select the MateLib.swc file there.

Now you can use the standard way to include Mate components in your mxml, with:

xmlns:mate="http://mate.asfusion.com/"

And you’ll be able to view the source code by command-clicking (control-click on Windows I think) a Mate component. You can also select the text, e.g. Dispatcher, and use the F3 key. And… the classes will also come up and be navigable with the Open Type, command-T, navigator.

Flex Time

It looks like I’ll be doing Flex RIA development, which I’m really looking forward to. Right now I need to tuck away a few links for further study…

Cairngen - for generating the basics for a Cairngorm Flex app:
http://code.google.com/p/cairngen/wiki/GettingStarted

Paul Williams - a series of blog posts on presentation tier design patterns with an eye to Flex:
http://weblogs.macromedia.com/paulw/

dpUint - Flex unit testing framework with async testing support baked-in:
http://code.google.com/p/dpuint/wiki/Introduction

Prana - an IoC for Flex… useful with Cairngorm:
http://www.herrodius.com/blog/64

Steven Weber very good introduction to Cairngorm:
http://www.adobe.com/devnet/flex/articles/cairngorm_pt1.html

Bruce Eckel articles on Artima:
http://www.artima.com/weblogs/viewpost.jsp?thread=212818
http://www.artima.com/weblogs/viewpost.jsp?thread=230610

And Getting Started with Flex at Adobe:
http://learn.adobe.com/wiki/display/Flex/Getting+Started

Capistrano subversion permissions issue

I finally got Capistrano running. The last hurdle was a funky one having to do with subversion. Our deployment environment is 2 web/application servers and one db server. We have another machine that hosts our subversion repository.

The issue was that each machine has to check out from the subversion server. When they went to do that, there was a message to accept the server or not. This would hang Capistrano.

To solve it, ssh into each of your web/app/db machines. From each, check out from the subversion server interactively and choose to permanently accept the svn server.

How to set ENV for rake migrate

If you’re running a recent rails app and are on a host like DreamHost where the RAILS_ENV isn’t set, you’ll need to use this to run your migrations:

rake environment RAILS_ENV=production migrate

Otherwise you’ll get this:

Cant connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock

Or you’ll connect to your development database if you have one configured.