Notes: Adobe AIR Local Data Storage Options

The following are my notes during the Adobe AIR Local Data Storage Options webinar that was presented during Adobe Developer Week. It was presented by Greg Hamer and the slides and demo code are already online.

Before getting started, note how Microsoft and Adobe are taking two different approaches: Microsoft is trying to bring the .Net desktop development community to the web. Adobe is conversely trying to bring web developers to the desktop! (Kevin Lynch)

There are four main options for AIR local storage: Local Shared Objects, File System, Encrypted Local Store, and the embedded SQLite database. Shared Objects are available in the Flash Player as well; all of these options are obviously available in AIR. Note that the data size limitation for Shared Objects does not exist in the AIR runtime!

Performance considerations. Shared Objects read and write very quickly. File system access and encrypted local stores are typically be slow in writing. Embedded SQLite databases are typically the best combination of speed and random access of items. Greg highlighted the AIR_LocalStorage_Demo app created by Jason Williams that demonstrates the speeds of the four storage methods.

Local Shared Objects. You can serialize memory resident data structures. Great! However, it runs in synchronous mode.

Encrypted Local Store. Used to store sensitive data. The price is the slow write speeds.  Also runs in synchronous mode. All data is serialized using ByteArray.

File System. Obviously important for management of documents. Can run in sync and async mode. The File and FileStream objects work together to point to a file and read/write data. The File object helps remove you from the pain of dealing with Mac vs. Windows environments with properties like File.userDirectory, File.documents.Directory, File.desktopDirectory, etc. It also has methods for opening Open and Save dialog boxes native to the environment as well as copying/moving/deletion methods.

Embedded SQLite Database.  Nice thing about them is that they are self-contained in a single file and require no external software installation to begin using them (support is built into the AIR runtime). Even supports transactions. And the database supports large amounts of data: SQLite has a theoretical limit of over 2TB. Supports ANSI-SQL 92.

However, it’s not a full-blown enterprise database server, obviously. So you lose things like stored procedures, enforcing data type constraints, foreign key constraints, and primary keys must be integers. It also isn’t a multiuser environment.

Session evaluation. I am unhappy to say that I was disappointed with the session. It was high-level, the coverage of code samples (when they weren’t passed over completely) consisted of merely reading the code back to us. I recommend viewing the recording if you have zero knowledge of data storage in Flex and AIR, as it would serve as a decent first-baby-step introduction for you.

Save the Day With Fiddler (or, Stop Barracuda From Blocking the iTunes Store)

Recently at work, we in IT were puzzled when a fellow employee called to report that the iTunes Store would not load on iTunes for computers on our network. The problem occurred only on our network and was not Mac or Windows specific.

Fiddler came to the rescue. Fiddler is a freeware tool that logs and allows you to inspect all HTTP traffic between your computer and the network (and thus Internet). I first heard about it at a conference when learning how to debug Ajax applications. It was especially useful when doing so with IE since there was no Firebug for IE (ahem, this is before the days of Firebug Lite and other such tools). I never really looked at it closely because, well, why do that when you could use Firebug and Firefox? ;-)

Well, it came in handy for this problem. The HTTP traffic between iTunes and the iTunes Store is less apparent since it is behind Apple’s veil of the iTunes interface. Fiddler revealed the exact domain names and in fact full URLs that were being requested, as well as the returned results. It was immediately apparent that our Barracuda Web Filter was blocking the request, so iTunes just reported that it could not connect to the iTunes Store. When we white-listed the requested domain, everything began functioning fine.

Everything had been working fine with iTunes in the past. But Barracuda updates its black list automatically. So when Barracuda apparently added certain iTunes Store domain names into its black list, namely phobos.apple.com, our hardware eventually updated its lists and began blocking iTunes Store traffic on our network.

Lesson #1: Beware the pitfalls of subscription services like Barracuda’s. They have their benefits, but they certainly can catch you unawares. Lesson #2: Use Fiddler. It is great for a lot more than web development debugging. It’s a convenient early stage network debugging tool. Lesson #3: Don’t discount the supposed dross at conferences that you think doesn’t apply to you. Perhaps years after you hear about something, you might finally come to have a need for it.

What’s Up 16 Sector’s Sleeve?

Boy, 16 Sector is drawing this thing out longer than I’d hoped. They’ve got something up their sleeve for the few Apple II enthusiasts around us.

Yes, a new piece of Apple II hardware will be coming our way very shortly. The cat’s almost out of the bag! The good ol’ days of the Apple //e and Apple IIgs are what really make me nostalgic. I even purchased an Apple IIgs recently on eBay and I’m just saving it in the box with plans to break it out when I get around to finishing my new attic office space.

For clues on the odd antics of the 16 Sector site, check the commentary at A2Central.com in their post, “More 16 Sector riddles“.

p.s. A big “hear! hear!” goes out for that post in regard to the return of the great Carrington Vanston of 1MHz fame!

Notes: BlazeDS Revealed!

These are notes from the presentation by Tom Jordahl about BlazeDS.

History lesson. Flex 1.0 introduced MXML. Originally built to be a server-based compiler. Flex 2.0 fine-tuned the product. ActionScript 3 was introduced, the Eclipse-based IDE was developed, and the server-side component was renamed Flex Data Services. That server-side product continued development and was renamed eventually to LiveCycle Data Services. Finally, a free portion was released as BlazeDS. So, its heart and heritage is in the development of Flex.

So what is BlazeDS? The part that lets your Flash/Flex app have remoting and messaging services via web services, remote objects, data push, etc.

Remoting. Used to be Flash Remoting. Allows mx:RemoteObject tag be used to make RPC calls to the server. Allows you to use CFCs and ActionScript or MXML together! Works with Java classes too, but obviously it is very nicely integrated with ColdFusion. This is the most familiar purpose for this kind of tool. But what else can BlazeDS do?

Messaging. Publish and Subscribe functionality becomes trivial. We can have real-time pushes over the web. What exactly does this mean? Your Flash/Flex apps can push data from one client to the next without refreshes or polling the server.

These services use AMF (Action Messaging Format). It is fast and small: Rather than being verbose text, it is a compact binary protocol. Not that you would ever have to know that, because it just happens behind the scenes. And its specs have been released, which means it can be supported by open source and third party developers.

So why would you still get LCDS? Well, you get certified builds with warranty coverage and support. You’re paying for Adobe to back the product. There will even be an LCDS “Community Edition” that will basically be BlazeDS with this support. Somewhat reminiscent to Red Hat vs. CentOS: Why get Red Hat when CentOS is everything Red Hat is? Because Red Hat has official support for its product. So Adobe is making the technology freely available, and giving you the option to pay for support and official builds and bug fixes.

LCDS “Enterprise Edition” is still the mother of data services. This version adds the data management capability of data services.

The installation of ColdFusion 8 gives you the free express edition of LCDS. But this is a single CPU license. If it doesn’t meet your needs, you can configure BlazeDS for ColdFusion 8. But to do this, you WILL have to remove the LCDS Express Edition that installed with CF8. Now, if you’re just using Flash Remoting, there isn’t any burning need to go to BlazeDS with CF8. However, the messaging features have no CPU restrictions with BlazeDS, so if you are using the messaging features, you may want to go with BlazeDS.

What do you use with BlazeDS vs. LCDS? LCDS has the data management features: Real-time data updates, conflict detection, caching, paging, more! RTMP channels: Direct socket connection to server, instead of the more resource-expensive HTTP. Scalability is also better with LCDS.

Tom indicated that Flex and BlazeDS will not be standing still. He certainly implied that Silverlight is in Adobe’s sights by indicating that it is “nipping at [Flex’s] heels”, suggesting that the AIR, Flex, and BlazeDS technologies will be progressing in development at a rapid pace by Adobe.

Tom explained BlazeDS and LCDS very clearly, albeit at a quick pace at first. My development rarely calls for the messaging features that would especially drive me to BlazeDS, but even so, it was beneficial to understand what BlazeDS is and it is good to know even when a product is not needed in your development arsenal, as in my case. For me, I will be using remoting only, so will stick with LCDS Express that comes with CF8.

Thanks, Tom.

  Theme Brought to you by Directory Journal and Elegant Directory.