Tuesday, November 25, 2008

Working with data in Flex

This session was led by James Ward. I was somewhat familiar with him having found a couple of interesting posts on his blog in the past about easing functions in Flex. He focused mainly on what you should use to store and move your data under different circumstances. He briefly discussed the Tour de Flex AIR application which everyone in the session was given a copy of on a nice 1gb thumb drive. Tour de Flex shows how to use a myriad of components, both built in Flex components and third party ones. I was of course interested in playing with the mapping APIs included from Google, MapQuest and Yahoo Maps.

Next we talked about different ways to send your data over the wire from the server to the client. James has a great Flex application available online which allows you to test out all of the different options. Of course AMF (Remote Objects) was basically the fastest. It did seem to get beaten by Data Services using Flex Paging though, but that's what you pay for with Blaze DS I suppose. The application is quite nice and allows you to send rows across from a server side database.

He followed that presentation by giving a few other examples that boil down to things to be careful of when dealing with large amounts of data. With XML there is a memory overhead which can become significant with large amounts of data and can cause performance issues.

For AMF (surely nothing is bad about AMF! It's a binary, no parsing required, way to send data!) he said to watch out for circular references and the overhead you accept for the use of binding. Sounds like a no big deal thing to me but maybe Adobe pays him to get people to consider buying Blaze DS?

One last thing he talked about was something I had assumed but never really quantified. He built a quick Flex application which loaded 100,000 objects into an Array and the same objects into an ArrayCollection. It took the Array a mere 100 milliseconds to complete where the ArrayCollection took 1.4 seconds! So if you are dealing with large amounts of data and want your application to be fast, watch out for those ArrayCollections.

Monday, November 24, 2008

Flash Security Model

We all know that security is one of the most important parts of any enterprise solution. That said, it's also dead boring. Deneb Meketa led this session and opened with a line very similar to that so I don't feel bad saying it. Before I get into some of what we went over in this session here is a nice video that overviews the first day and general session.

Now that you're excited let's talk security. In order to make this fairly brief I'm mainly going to just go over the five basic security rules Deneb gave us and if I think of anything for each of them I'll expound.

Rule 1: Use least privilege

When creating your cross domain files etc. never use an allowDomain="*". It may be a bit of a pain to actually enumerate the domains allowed to access your stuff but it's much better than being hacked.

Rule 2: Validate Input

You never know what someone might try to stick into the stream as input so validate it on the client side and on the server side.

Rule 3: Deploy HTTPS Consistently

Don't mix HTTP and HTTPS. All you will do is expose holes in your security.

Rule 4: Prototype Early

I thought this was an interesting rule for the Flash Security Model but as he explained a bit more it made perfect sense. If you don't prototype early there may be something you plan on doing which simply isn't allowed within the Security Model. If you prototype that stuff early and find out it won't work you may be able to find an easy way around it. If you wait until the end it may be a nightmare.

Rule 5: Keep Track of Security Changes

The last thing you want is the CEO walking up to you and saying, "Internet Explorer upgraded my Flash Player and now none of our stuff works. What did you break?" Believe me, I know.

Tuesday General Session of MAX


The General Session on Tuesday was led by Tim Buntell, the Sr. Product Manager for Flex Builder. They walked through a lot of functionality with Tim as Agent B doing a James Bond inspired walk-thru the 'lab' to look at all of the cool new stuff. It was definitely entertaining.

There were a few things that really caught my attention (besides the James Bond theme) during this session. One was Project Alchemy. This technology allows you to take C/C++ code and recompile it into ActionScript! Think of all that C/C++ code bouncing around the web that Flex developers can not take advantage of! They showed an example of a NES emulator running in Flash player as well as a Quake Player. That was pretty awesome to see. I can't wait to take advantage of some C/C++ code!

Something else that I'm sure many people will be excited to hear is that there is an IDE coming out for Cold Fusion called Bolt. It will be built off of Eclipse just like Flex Builder and from the little they talked about it I think it will be a nice change for Cold Fusion developers.

Now how is this for a shell shocker: There is a new plugin for VS 2008 called Tofino that allows you to create Flex applications/front ends for your projects! That's right, you can develop a Flex application in Visual Studio! If anyone gives this a try please let me know. It didn't seem to be that big of a deal to anyone at MAX but I think it was because most of them have never even used Visual Studio. I'd like to hear how well it performs and integrates with a normal .NET workflow.

Intro to Thermo and Gumbo

My last session on Monday was about Thermo (Adobe Catalyst) and Gumbo (Flex 4) and was led by Ryan Stewart.

This was a great session and he went over a ton of stuff that will be in Catalyst as well as going through an end to end example of taking a Photoshop file, importing it into Catalyst, marking up the parts as components, and then importing the resulting file into Flex as a project. When you open a Photoshop file in catalyst and mark the different parts as components and insert your transistions etc. what gets saved is an fxp file. This is basically just a zipped up flex project file! This was a nice way to show the story they have developed for the use of the Adobe products and I have to admit I was blown away.

Among other things of note, we were told that the first public beta would be in the first quarter of 2009. There is a new merge tool for Flex Builder which allows you to pull changes in from Flex Catalyst which is nice if you have developers and designers working on a project at the same time.

Something that really got me excited is the new Services Explorer in Fx. It allows you to select remote objects you wish to use and automatically creates strongly typed classes for you! That means you can treat them as normal objects (type checking and all) without having to go through it all on your own anymore. I'm really excited about this since we use remote objects a great deal.

Another nice addition to Fx is the Network Monitor which allows you to watch all network traffic between your Flex application and the Server. They have also included Flex Unit Support which allows you to generate test suites and auto-generate unit tests for your code! Of course you still have to fill in some of the actual test part but the skeleton is created for you. This is going to make life for us at 3-GIS much better.

One last thing he didn't spend much time on but which I'm interested in seeing is Templates. Basically if there is a standard way you build out classes or functions you can now save these as templates (boiler plate code) and stamp them down wherever they are needed. This could be a big time saver for anyone like us that uses a standard framework that requires a lot of the same basic code being written every time you add a new feature, screen or component.

I would tell you how I've found working with these features so far but unfortunately the preview disc they gave us was for Mac only and I'm stuck with a Windows box. The release for Windows though is supposed to be coming out early next year.

Friday, November 21, 2008

Real Time Collaboration Apps with Flex and Cocomo

Monday afternoon I was able to attend this session of MAX led by Nigel Pegg. The first thing he mentioned is a free collaborative tool they have created using Cocomo called Connect Now. It's a pretty durn nice piece of software especially for small/medium size companies and includes video/audio streaming capabilities. Cocomo is described as a PaaS (Platform as a Service) built for real time collaboration. The Cocomo SDK for Flex is designed to make it simple to share areas and inputs. I have signed up for a developer license but haven't had a chance to really play with it yet. I'll post back here about it once I have had a chance to do so. They allow the sharing of inputs etc. with a Batton property, basically when someone has control of an input no one else can get access to it until they are finished. Cocomo rooms (using the developer license) can be built to share user status, roles, webcams, VoIP (using the Speex Codec), documents, media etc. It even allows direct client to client streaming as of flash 10.

The Cocomo Dev Console (which is where you go once you sign in using your account) allows you to configure rooms, enter rooms, etc. For more information go here and read the FAQ!

Looking Ahead at the Next Version of Flex


This was the first regular session of MAX I attended. It was led by Ely Greenfield whose blog I check from time to time. He was talking about Flex Gumbo (Flex 4) and to some degree Flex Catalyst (formerly known as Thermo).

There are a lot of changes in Flex 4 which are necessary strictly for Catalyst to work correctly and he spent a large portion of time on them. For those of you who don't know (and I didn't before this conference) Catalyst allows a designer to take a user interface they have mocked up in Photoshop, import it into Catalyst, mark parts as 'button' or 'scroll bar' and even set transitions and animations, and then save all of their changes as a Flex Project! This means that developers can be handed a nice intuitive user interface and simply do what they do best, put in all of the business logic, without being worried about color schemes and glossy buttons.

It also means that the designer can make changes to the UI at any time without having to bother the developer. The designer simply reopens the project in Catalyst, makes the necessary changes, and saves them and the next time the developer opens his project the new UI will be in place without having bothered his code.

All of this is accomplished via the new Spark Architecture from Adobe which basically divorces visual components from their data and behavior. Don't worry about your old projects not working though because Adobe has created a new set of components (FxComponents) to take advantage of this new architecture, so all of the old components will still behave the same as always.

The way this data is passed around adobe products (Photoshop, Catalyst, etc) is through a new interaction language called FXG, a graphics format based upon MXML, which all Adobe products can read.

Flex Catalyst is a completely declaritive language (think mxml) and adds a few new metadata tages like SkinPart and SkinStates which help define things like parts of buttons and the states of those buttons.

There is also a new MXML Graphics library containing things like Fill and Stroke. These graphics objects are 1st class citizens in flex, making them usable just like any other object. This includes a new GraphicElement which is a graphics base class created purely for the purpose of rendering graphics and improving performance.

The new FlexText objects allow more liberties with text within a Flex application. This includes fading and rotating among others. Flex now has a very powerful ability to produce top quality text which is one of the reasons the NY Times is developing an AIR application.

There has been an effort to make states easier to understand inside of MXML by putting an inState property on components instead of the old state tree. This is one case where you can not use new and old styles together. A file must use one or the other.

A number of other small changes were discussed, including that if you wish to add non-visual components to your mxml you can't simply add a tag but must wrap it inside of a tag. Otherwise non visual components will be left out.

Other changes include:
  • Container tag has changed to Group
  • List class is now DataGroup class/tag
  • 3D effects now built in! (FX:Rotate3D)
  • 2-way data binding! (value='@{bindvalue}')
  • increased compiler performance! (2x-5x faster)
We were given a latest and up-to-datest copy of the new Flex Builder and Flex Catalyst but unfortunately it was for Mac only and those of us in the Windows world will have to carry on a bit longer (January or February) before we can play with both of these together.

Max 2008

So I got the chance to go to the Adobe MAX conference this year in San Francisco. It was a Monday-Wednesday (November 17-19) affair in the downtown area of the city. I've been to a number of different conferences at this point in my career but this one definitely stands out as unique. The location was nice and it had all of the standard elements of a conference: general sessions, labs, lectures, swag, etc.

The atmosphere however was a surprise to me. Instead of your normal business conference atmosphere (think lots of stuffy old guys shuffling around a large room) it was more like Lollapalooza. There were gaming stations (both console and computer) spread throughout the conference, lots of give-aways like PS3s and notebook computers, and the average age of attendees had to be about 27. There was also an interesting mix of Designers and Developers, two groups who don't traditionally walk in the same circles but it seemed to work just fine at MAX.

The general session Monday started at 9:30 a.m. Free breakfast started at 7 a.m. so naturally I got there at about 7:01 After I filled myself to capacity I went up to the third floor where the general session was going to be and figured I would get a good seat since I was almost an hour early. I was told that the session didn't start until 9:30 however and so I couldn't come in.

Thus began the wait. At about 9:32 a.m. they finally let the stampede of five thousand of us through the doors. I'm not sure what happened then, I don't know how many died, all I know is that I made it to a seat somehow. I ended up just to the right of the stage on the third row. As I walked down the isle the booming sound system pounded out recent rock hits so loudly that I could feel the bass in my chest. Up top were three giant wide screen displays placed next to each other with a panorama of Adobe images and video interviews. Once things got started the first person to come out went up to a turntable (that's right) and started a video/audio slide-show. It was one of the coolest things I've ever seen a serious geek do. When he scratched the turntables not only did it scratch the music but also the video. It basically went through a rundown of what Adobe was about, what was coming out, and how people were using the products etc. Like I said, it was pretty cool.

After that Kevin Lynch (CTO Adobe) came out and led most of the session, bringing on people from Disney, The NY Times, Google, and Maria Shriver (y'know the governator's wife) among others. They also breezed over all of things coming soon from Adobe including that next year will see the Flash Player 10 come to mobile devices as a full Flash Player! For those of you interested For those of you interested you can go to http://adobe.com/go/keynote to see a little more information about what went on. They are also supposed to have audio/video of actual sessions up at some point. I'll go over all of the sessions I attended along with my thoughts about them as I have time.

Monday, November 10, 2008

The Power of '\'

I recently went through an ordeal attempting to use the Flex command line compiler for a project I was working on. After figuring out a series of fairly cryptic problems I got to one which made no sense. I was getting a ‘cannot find file’ error for an asset that I knew to be in the correct position. In fact the project would build just fine within Flex Builder. The file was an embedded image asset located at something like ‘…/assets/images/image.png’. I couldn’t figure out why it would have an issue. After searching the internet for about half an hour I came across the post of another blogger with the same problem. He said that adding a ‘/’ to the front of his embedded file names fixed all of his issues. Lo and behold it worked for me as well. I guess the Flex Builder compiler is smart enough to find the files with or without the ‘/’ but the command line compiler wasn’t built with the same intelligence. I’ve also seen the power of the ‘/’ in a couple of other places even within Flex Builder such as source paths remaining unfound without the ‘/’ in front.
Lesson Learned: When in doubt, add a ‘/’ to the front of the path.