Making ColdFusion/Flash Remoting and WordPress Play Nice on IIS

OK, this post isn’t completely about Flash, Flex, or Mobile, but it is about ColdFusion, so I guess it’s still applicable…  I recently made a few changes my WordPress blog (specifically adding “pretty” permalinks for posts).   In order for this to work properly, you have to add rewrite rules in your web.config so that IIS will be able to map URLs to wordpress/PHP, where it can correctly resolve the URL to the actual post.   (You can read more about WP permalinks here.)

Once you setup the rewrite rules, all is well and good, right?  Well, almost… This is an IIS server, running ColfFusion and PHP.   While the wordpress blog was working great, I realized that all of my AMF remoting on the server stopped working.  It turns out that the rewrite rules were affecting all pages that don’t physically exist.  This includes the “/Flex2Gateway/” endpoint used by ColdFusion to resolve all AMF requests.  Note: the “Flex2Gateway” url path doesn’t point to a physical folder or file; it is a virtual mapping.

In order for WordPress and ColdFusion to play nicely together on the same server, you will need to setup your rewrite rules to map all URLs that don’t contain the string “flex2gateway”.   It’s not that complicated really, but took a little while to track down what exactly was happening.  I used the ECMAScript pattern syntax for a regular expression that will match all strings that don’t include “flex2gateway”, and here’s the final solution:

[xml]
<rule name="wordpress" patternSyntax="ECMAScript">
<match url="^((?!flex2gateway).)*$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
[/xml]

Adobe Releases Beta of Edge HTML5 Tool

Exciting news this morning!  I awoke to see that Adobe has released a beta version of EDGE, the HTML5 motion and interaction Design tool on Adobe Labs, as well as theexpressiveweb.com/, an HTML5 showcase site.

EDGE will allow you to create Flash-like timeline animations purely using standards-compliant HTML.  You can see a preview form the examples site below:

EDGE Sample (note: may not work in every browser)

You can read a bit more about theexpressiveweb.com and the thoughts behind it on Adobe devnet at: http://www.adobe.com/devnet/html5/articles/introducing-expressive-web.html

theexpressiveweb.com

 

Exporting AIR Mobile Apps as Desktop Apps

A great question came out of the comments on my last post “Why Can’t I Run My App in the iOS Simulator” asking if it is possible to export the mobile simulator from Flash Builder to allow you to distribute builds for functional testing/validation.   The quick answer is yes (but you don’t really export the simulator).

Let me explain… When running or debugging a mobile application directly within Flash Builder’s environment, you really are running a local desktop application within the ADL executable (AIR Debug Launcher) that is part of the AIR SDK.  The size/layout of ADL in this case is locked to imitate the experience of a particular device/configuration.  The mobile application isn’t running in a device-specific simulator.

All Flex/AIR mobile applications can actually be exported as .AIR files that can run within the desktop runtime environment.  This enables you to easily repurpose an application from mobile to desktop.

Keep in mind, this does not mean there will be a 100% parity between desktop and mobile features, interaction, and performance.  Interaction paradigms, such mouse vs. touch, keyboard vs. hard-keys vs. soft-keys, form factor, as well as hardware (CPU/memory) may all have critical impacts in the overall experience.  Again, if you are targeting mobile devices, then it is imperative that you test your applications on real, physical devices to identify any kind of performance issues, bugs, or UX issues.

To export a mobile application for desktop usage as a .AIR file, just select the “Signed AIR package for installation on desktop” export option within the “Export Release Build” dialog.

Flash Builder Export AIR Options

The exported AIR file will use the standard AIR runtime, inclusive of cross-platform features and the AIR installer.  Note: I used a local dev certificate in this example, with just the default options.

AIR Installer

At runtime, it will look like any other AIR application.  You can configure the AIR app-xml descriptor files to customize it.

Runtime Mobile AIR Application on the Desktop

 

Why Can’t I Run My App in the iOS Simulator?

One very common and valid question when developing AIR mobile applications is “Why can’t I run my app in the iOS simulator?”

This is especially the case once you realize that you can compile and target the Android emulator; The ADT packager supports exporting to the Android emulator, but you can also install any APK (Android Package) binary file into the emulator using the normal tools contained within the Android SDK.

The reason that you can run a Flex Mobile app in the Android emulator, but not in the iOS Simulator comes down to the fundamental difference between an emulator and a simulator. An emulator emulates a physical device; The emulator program mimics the hardware, and the device-specific code that will run on the actual device runs within the mimicked environment. A simulator simulates an environment – it has a likeness or model of an environment, however it is not identical to the target environment.

In this case, the Android emulator mimics the hardware environment and is capable of running a compiled APK for a Flex/AIR mobile application. However, the iOS simulator is not capable of executing the contents of an IPA file. This isn’t specific to an IPA file for an AIR mobile app, but any IPA file – even those downloaded from Apple’s own app store.

The executable content within an IPA file is compiled targeting the device’s A4-ARM processor. Your desktop computer uses an intel-based processor architecture, which isn’t compatible and will not work. Even if you rename an IPA file to a ZIP file and extract the contents, it will not work within the iOS Simulator because of the CPU architecture differences.

Best Practice:

The first, and most important point that I emphasize regarding mobile application development is that nothing is more important than testing your mobile applications on a physical device. Emulators and simulators can help you see how an application may operate within a given environment, but they do not provide you with the actual environment. Physical devices may have memory, CPU, or other physical limitations that an emulator or simulator may not be able to reveal.

Secondly, keep in mind that emulators and simulators are created to make your development process easier and faster (especially if hardware is not readily available for the entire dev team). The debugging environment within Flash Builder is designed exactly for that purpose. You can quickly and easily test your application’s interface and functionality with a single button click. You can even setup debugging profiles for multiple devices, or use one of the predefined device configurations:

While these capabilities make developing for multiple form factors and multiple device types significantly easier and faster, this does not trump my first point. If you are targeting specific hardware, then it is imperative that you test thoroughly on your target platform(s).

Joining Adobe!

I’m pleased to announce that as of next week (July 26th) I will be joining Adobe as a Technical Evangelist, with an emphasis on enterprise mobile applications! Many of you know that I’ve been passionate about the Adobe ecosystem for quite a few years… I became really involved late in the Macromedia days, and have worked with Flex since 1.5 and Flash since version 3 (now working on version 11). I’ve had the opportunity to work on some incredible projects, and a lot has changed throughout this time. I have been fortunate to witness the changes throughout the web that have been made possible by Adobe’s technologies, and I’m even more excited that I now get to play a part in it.

In the last year I have primarily focused on mobile application development (both phone and tablet paradigms)… native Objective-C for iOS, HTML5, Appcelerator Titanium, PhoneGap, a little bit of native Android, and (last, but most definitely not the least) Adobe AIR for mobile (BlackBerry, Android, and iOS). Now, I am excited to use this experience to show how Adobe’s technologies can be used in web, desktop, and mobile scenarios, for building incredible applications on multiple platforms, with an easy-to-use and extremely powerful development paradigm.

I’d also like to take a moment to thank my current employer, Universal Mind, for the opportunities that I’ve had while working here. While with UM I have had a great experience, and I wish them many great successes in the future. It has been an awesome time, and I’ve had the good fortune of being a part of some ground-breaking and exciting projects (while also getting to work with some of the best and brightest in the consulting and design industry).

This is an exciting opportunity, and I am happy to share it with all of you. If you ever are in need of information or best practices regarding Adobe and/or mobile, please do not hesitate to ask!

Until next time…

Blog Updated!

Well, hello again everyone! It’s been a while since I’ve been active on this blog (tricedesigns.com). This is the first post at this location in nearly 2 years. As I was writing for insideria.com this blog began to suffer. If you’re wondering where the old content has gone, I’ve decided to take it down.  All of my content which was formerly at insideria.com is now available at developria.com.

I migrated this site from the old Blogger hosting since they decided to no longer support FTP publication, and a lot of the content that I had here was from 2006-2009, so a fair amount of it was outdated. If there was something that you really miss, please let me know, and I will dig it up, update and re-post.

Expect to see this blog become a lot more active, with some significant updates in the near future. I have some exciting announcements coming soon, and you can expect to find a lot of content regarding mobile applications, mobile paradigms, and their applicability in the enterprise.