27 Mar 2011

Getting CouchDB / Couchbase Server and Flash to Play Nice Together

Flash-couchdb
I've dabble with NoSQL technology and I've found CouchDB as a very intriguing place to start. Since I mostly code in Flash I wanted to figure out a way of getting Flash to communication with CouchDB.

I was Googling and came across Todd Anderson's (blog) project on GitHub called, "as3couchdb". My only problem is that I prefer to do almost everything exclusively in Flash. I noticed Todd had an AS3 version in his example projects, but that it requires Flex because of the custom metadata at the time of compiling. So you would get an error like this,

"Error: The CouchModel instance [com.custardbelly.couchdb.example.model::ContactDatabase] must be annotated with [DocumentService] metadata tag."

I found a hack-around, so anyone else wanting to use CouchDB and within the Flash IDE can do so (assuming you have CouchDB running locally already - if not, download Couchbase Server here)...

  1. Simply create a new Flash project
  2. Download Todd's as3couchdb and getting the example BasicActionScriptExample Class under the Properties Panel -> Publish -> Class in the Flash IDE
  3. Go to your Publish Settings, and check the SWC box under Publish (make sure you do this, otherwise you will get this metadata tag error: "Error: The CouchModel instance [com.custardbelly.couchdb.example.model::ContactDatabase] must be annotated with [DocumentService] metadata tag." 
  4. The compile your project... the example should publish and work! How about that for getting started quickly?

If you have any questions feel free to leave a comment. I'm using Flash CS5 and Couchbase Server (CouchDB v 1.0.2) on a Mac.


For those interested in how I found this hack-around:


Images used above curteosy of seokchanyun & mondi

19 Oct 2010

Developing AIR Apps for the TV

Imaging building an application that runs on any computer, the iPhone, iPad, Android mobiles and tablets, AND on the TV!

Air-for-tv-2

Well Adobe is doing that! Using their AIR framework, a developer can write an app that runs on one platform, and then be able to repurpose most of that code, so it can run on all of the other platforms.

Click here to view the sneak peak at AIR for TV!

Air-for-tv-2

8 Oct 2010

Adobe releases AIR for Android

Aironandroidmarket
I've been a part of the Adobe AIR for Android pre-release program for a few months now. For those aren't familiar with it, it allows Flashdevelopers to build native Android apps using ActionScript 3.0. From experience, it is really ease to re-purpose your desktop AIR applications into mobile Android apps!

Check out these great resources to get started:

4 Aug 2010

My Consumer Status with Apple Over the Years

I thought I would take a minute to explain how my view on Apple has changed over the years:

  • Prior to college I had no experience with Apple and do to my immaturity I thought they sucked.
  • In college I started working for an eLearning company and was introducted to my first Mac and Final Cut Pro. I found it fabulous... no blue screen of death and it just worked. A start to a beautiful relationship... I'm completely sold that everyone should have a Mac over Windows.
  • Got my first iPhone right before the iPhone 3GS came out. Feel in love all over again.
  • Started developing iPhone apps using Flash CS5 Packager for iPhone, get one, TheProducer (Lite Edition) approved and in the iTunes App Store.
  • I developed a full version of TheProducer and submit it to the iTunes App Store.
  • Apple then announces the iPad. I pre-order an iPad. Meanwhile, I'm starting to build an iPad version of TheProducer using Flash CS5.
  • I get my iPad and even get TheProducer working on it and within days Apple block Flash (and AIR apps) on the iPhone and iPad.
  • 6 email inquiries later, the full version of TheProducer is still "In Review" at Apple and has been since March 15, 2010.
  • I lost my temper with Apple: 
  • I swap to the Google Nexus One and Android 2.2. If I may add, runs Flash and AIR apps really nicely!
  • Future outlook... I still think Windows is an inferior product in comparison to Mac OS X, but I don't think I'll be buying an iPhone 4 anytime soon.

BTW... I'm selling my iPad! Can't wait to get my hands on Notion Ink's ADAM!!!

2 Aug 2010

Unable to build a valid certificate chain for the signer

Are you receiving this error, "Unable to build a valid certificate chain for the signer" when you try to compile your AIR either via Flash or the AIR SDK ADT?

I'm using a Mac running OS X 10.6.4 and Firefox 3.6.8. I've been having this issue for a few weeks now while I've been trying to sign my AIR app so I can publish it to the Adobe Marketplace. I've followed the documentation from from Adobe and Thawte on how to export my Code Signing Certificate (CSC), but I still get this freaking error, "Unable to build a valid certificate chain for the signer"!

The only official documentation I could find was lacking:

After a couple of suggestions from the fine support people at Thawte didn't work, reading countless FAQs, searching forums, trying every single Google Search trick I wasn't able to find a solution. Joe Ward at Adobe pointed me in the right direction! I finally figured it out and thought I would document it here, so it you have a similar issue, hopefully this is a well documented solution for you other Adobe AIR Developers out there. See below...

RESOLVE THE CSC ERROR:

  1. Download & unzip thawte-roots.zip from: https://www.thawte.com/roots/index.html
  2. Open Firefox and go to Preferences -> Advanced tab -> Encryption -> View Certificates
  3. In the View Certificates window, go to Authorities and click Import...
  4. Browse over to your unzipped Thawte Roots folder -> Thawte Code Signing -> Code Signing CA
  5. Select Thawte Code Signing CA.pem and click Open
  6. You should get an alert window that states this is either "successfully installed" OR "already installed
  7. Click the OK button
  8. Repeat these steps to import: Thawte Roots folder -> Additional Thawte Roots -> thawte Primary Root CA -> thawte_Primary_Root_CA.pem
  9. Re-export your certificate

I've found that both Adobe and Thawte didn't document this error/solution very well. If you have any questions about this, please feel free to contact me and I'll help out as much as possible.

Lee Graham's Posterous

Hi! I'm Lee Graham. I'm a GOAT (Geek Of All Trades)! I'm also a Flash Platform Developer, eLearning Developer for BB&T University, Android fanatic,  & husband to the world's most beautiful girl!


Connect with Lee Graham


DISCLAIMER: The information contained on this site are strictly my personal views and doesn't reflect the views of my current employer.