Viewing by month: November 2006

Nov 29 2006

Getting Flex Data Services running on OS X/Intel

I'm by no means a J2EE or FDS expert, but I hacked away for a bit tonight and got FDS up and running on my Intel MBP.

Here's a step-by-step guide for what I did. If you're up to snuff with J2EE deployments, it's likely to seem elementary...this is a guide for CF developers who don't care to know much of anything about systems administration.

1. Use the JRun admin console to create a new server named "flex." Don't bother trying to start it once it's done.

2. Open finder, and go to /Applications/JRun4/servers . Ctrl-click "flex" and do a Get Info. In "Ownership & Permissions," expand the details. Unlock if necessary, and change the owner to your user. Give the admin group read & write access. Then, do "Apply to enclosed items" (this is important! My first time through, I did each dir individually, going through the stack of errors in Terminal!

3. Try to do the following at the command line:

/System/Library/Frameworks/JavaVM.framework/Versns/1.4.2/Home/bin/java -server -Djava.awt.headless=true -jar /Applications/JRun4/lib/jrun.jar -start flex

Some console messages should go by, but you should only get warning, info, and user types, with the last line reading:

user JSPServlet: init

Ok, hit CTRL-C to shut it down.

4. Now, we need to deploy Flex Data Services. This means we need to get our grubby unsupported-deployment-seeking paws on flex.war. While we're at it, we'll get the samples and the flex-admin bits going, too.

5. Find a Windows machine (or start Parallels), and download the Flex Data Services 2 installer. Run it, and choose a J2EE install to existing J2EE server. Install to c:fds2 (the default).

6. Go into c:fds2 and grab flex.war, flex-admin.war, and samples.war. Copy them to /Applications/JRun4/servers/flex/.

7. Under /Applications/JRun4/servers/flex, create three directories: "flex", "flex-admin", and "samples".

8. Copy each .war into its respective dir.

9. In terminal, go into each directory and extract the war, such as:

jar -xvf flex.war

10. Copy commons-logging.properties file from the samples/WEB-INF/flex/jars/ to /samples/WEB-INF/classes - I'm not too sure how/why this resolves the commons-logging conflict, but I read it on David Fekke's blog, and it works.

11. Start the Flex server with the following command:

/System/Library/Frameworks/JavaVM.framework/Versns/1.4.2/Home/bin/java -server -Djava.awt.headless=true -jar /Applications/JRun4/lib/jrun.jar -start flex

You'll see a lot more stuff go by this time.

11. Go to your JRun administrator console. Look at the "flex" server's HTTP Port setting (mine is 8301). Browse to http://localhost:[that number], such as http://localhost:8301. You should get a "Welcome to JRun 4!" message. Yeeha.

12. Going to http://localhost:8301/flex will give you a nice message about this being a template application. Whee.

13. Ok, http://localhost:8301/flex-admin will give you the runtime monitoring/management console.

14. And, last, http://localhost:8301/samples will let you drill down into the Notes sample to see a sample of FDS in action, pushing data happily between client instances!

1 comments - Posted by Joe Rinehart at 10:42 PM - Categories: Flex | Flex and ColdFusion

Nov 29 2006

Getting JRun Admin Console on Intel-based Macs

When I got my MacBook Pro a few weeks ago, I was thrilled to find a great guide to getting ColdFusion working with Apache on Intel-based Macs.

I needed to get the JRun console going tonight to deploy another J2EE app, and I thought I'd post a step-by-step guide to setting it up to start automatically. It assumes you've gotten CFMX installed using the instructions I linked to, and that you'll be using Lingon to manage the startup.

Here it is:

1. Open Lingon

2. Click "Users Daemons"

3. Double click the daemon you created that runs CFMX. Mine's named "CFMX Service."

4. Click "Expert" in the buttonbar.

5. Select all of the XML and copy it to the clipboard.

6. Click "Cancel" in the lower-left

7. Click "New," choose Users Daemons, and click "Create"

8. Click "Expert" in the buttonbar

9. Paste in the XML

10. Change the dict/string value to "JRun Admin Service" and the last /dict/array/string value from "cfusion" to "admin. You XML is probably just like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0">
<dict>
   <key>Label</key>
   <string>JRun Admin Service</string>
   <key>ProgramArguments</key>
   <array>
      <string>/System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Home/bin/java</string>
      <string>-server</string>
      <string>-Djava.awt.headless=true</string>
      <string>-jar</string>
      <string>/Applications/JRun4/lib/jrun.jar</string>
      <string>-start</string>
      <string>admin</string>
   </array>
   <key>RunAtLoad</key>
   <true/>
</dict>
</plist>

Ok, you'll now get the JRun admin console at http://localhost:8000!

5 comments - Posted by Joe Rinehart at 8:46 PM - Categories: ColdFusion MX

Nov 27 2006

Login/Security in Flex 2, Web Services, etc.

Ray Camden's been blogging a series that outlines a basic login/logout scenario in Flex 2, concluding his thoughts about using CFLogin to integrate with Flex 2's setRemoteCredentials() bit with one word: "Ugh."

I've been working on a similar task recently: that of hooking up Flex 2 to the authentication mechanism I first started using about three years ago at the National Wildlife Federation, where I had to do a number of applications that were available via CF, Web Services, and Flash Remoting. It's since evolved to use ColdSpring and a few design patterns I've found handy.

Read more...

9 comments - Posted by Joe Rinehart at 8:28 PM - Categories: Flex and ColdFusion

Nov 22 2006

Semantically encapsulating effect sequences in Flex 2

Sorry for the hiatus - shutting down one job and starting a new company at the same time proves to drain a bit of time! The Cairngorm for ColdFusion series will continue when I take some time off this weekend.

For now, I wanted to share an idea and solicit feedback.

One thing I'm doing in Flex applications is trying to provide visual "feedback" for user actions by using effects and sequences.

An example I've always liked is on OS X, where the login window sort of "shakes its head at you" by "waggling" side to side when you've typed a wrong username/password.

I wanted to emulate this throughout my application, "waggling" things like submit buttons when there's a validation problem.

I started on a single form, adding a sequence to do it:

<mx:Sequence id="loginFailedSequence" target="{loginFormLevelControl}">
   <mx:children>
      <mx:Move duration="100" xBy="-10" />
      <mx:Move duration="200" xBy="20" />
      <mx:Move duration="100" xBy="-10" />
   </mx:children>
</mx:Sequence>

Ok, that'll do it on one form. But what I wanted was a sequence that I could keep in one place and reuse wherever i wanted to say "No" to a user. If a client decided they didn't want a waggle, but a fade to red, I wanted to change this in once place.

I did this by extending Sequence with a "No" class. Notice that I've named it semantically, not literally: I'm stating that this is the sequence that says "No," not one that waggles things side to side. Here's the code:

package com.firemoss.generic.view.sequence
{
   import mx.effects.Sequence;
   import mx.effects.Move;

   public class No extends Sequence
   {
      public function No() {
         super();
         
         var moveEffect:mx.effects.Move;
         
         moveEffect = new Move(this.target);
         moveEffect.duration = 100;
         moveEffect.xBy = -10;
         this.addChild(moveEffect);
         
         moveEffect = new Move(this.target);
         moveEffect.duration = 200;
         moveEffect.xBy = 20;
         this.addChild(moveEffect);

         moveEffect = new Move(this.target);
         moveEffect.duration = 100;
         moveEffect.xBy = -10;
         this.addChild(moveEffect);
      }   
   }
}

Now, in any component, I can bring this component in by adding a new namespace (say, "sequences"), and then all I have to do to use it is state:

<sequences:No id="loginFailedSequence" target="{loginFormLevelControl}" />

Because it extends sequence, I just use the following code to play "No":

loginFailedSequence.play();

(Of course, you could choose the target at that play() time, too).

Now, if someone wants to change the "No" visual cue from a waggle to a fade, I just change No.as.

Thoughts? Did I just re-invent a wheel?

20 comments - Posted by Joe Rinehart at 8:38 AM - Categories: Flex | Flex and ColdFusion

Nov 8 2006

Important Model-Glue:Unity Changes

In preparation for Beta 2, I've made two changes to the framework over the past few days, of which anyone using the bleeding edge release needs be aware:

Change 1:

If you create a new application from the app template, scaffolds will not automatically be created the moment you add a tag.

You'll need to append ?scaffold=true to the URL.

If you'd like changed to scaffolds to always be detected whenever the framework loads, change the "rescaffold" setting of the ColdSpring.xml file in your application to "true".

If you'd like to change the name/value of URL variable appended to force rescaffolding, change the "rescaffoldKey" and "rescaffoldPassword" settings of the ColdSpring.xml file in your application.

Reason for change:

It can take a long time to load a page if you're using a lot of scaffolds, and it's not the easiest workflow to constantly be updating the ColdSpring.xml file whenever you want to start/stop having scaffold changes detected. Usually, you know when you've changed a scaffold, so this lets you reload scaffold tags explicitly.

Change 2:

Resource pooling has been removed: http://trac.model-glue.com/model-glue/ticket/229

Reason for change:

Resource pooling is proving problematic, and the framework is plenty fast thanks to duck typing.

0 comments - Posted by Joe Rinehart at 7:22 AM - Categories: Model-Glue

Nov 7 2006

Flash VM Open Sourced! To Mozilla Foundation!

Adobe made a big announcement today: it's contributing source code from the ActionScript Virtual Machine to the Mozilla Foundation.

Brendan Eich, the creator of JavaScript and CTO of the Mozilla Foundation, claims it's the "the largest contribution to the Mozilla Foundation since its inception."

The new project will be called "Tamarin," and aims to provide a standards-based approach for cross-platform rich application development.

Read more at Adobe's pressroom.

1 comments - Posted by Joe Rinehart at 7:52 AM - Categories: Flex and ColdFusion

Nov 6 2006

Cairngorm for ColdFusion/MG Developers (Part 2, Model Locator)

Well, the extra RAM for the MacBook Pro got here, so it's time to switch to using it for Flex development. Woot! What better to kick it off than talking about the Model Locator pattern?

Read more...

8 comments - Posted by Joe Rinehart at 11:05 PM - Categories: Flex and ColdFusion