Simplyprofound.com
Flash, Flex, AIR, ASP.NET, PHP, AJAX, whatever it takes...

One Reason Ruby on Rails Appeals to Me

April 18, 2008 02:49 by dave

RoR acolytes whisper the name David Heinemeier Hansson with a passion that is not a little eery. (google "dhh" and he's at the top, wikipedia brings him right up  too). Nonetheless, the creator of RoR known for his strong opinions has some excellent, uncompromising ideas about development that are inspiring me.

I was watching the RailsConf keynote speech from 2006 (I'm a little behind the times, sure, but this stuff was way ahead of it's own time methinks) and DHH made a statement that I really thought well encapsulated what I like about RoR:

"If you have the initial assumption that things should be able to be done by hand without leaving you crying, it leads to better design." 

In context he was speaking about REST and how adding additional methods to your controller may be easy, but it becomes messy and you should ask yourself why you are adding those additional methods. If you adopt the constraints of REST (giving you essentially 7 methods for CRUD operations in the controller), and you do not let yourself easily tag addt'l methods on the controller, you'll learn something about your design and a more simple solution will present itself. 

He contrasts this approach against other frameworks that have become heavily dependent on IDEs in order to facilitate development. He likes to pick on java, but nobody is really safe from his barbs.

Checkout the keynote if for no other reason than to gain a great understanding of REST. Other books I've read recently and highly recommend:

Flexible Rails: Flex 3 on Rails 2 by Peter Armstrong
The Rails Way by Obie Fernandez (and others)
Agile Web Development with Rails by Dave Thomas & DHH 

 


Firefox Search Plugins for Adobe LiveDocs

April 3, 2008 15:29 by dave

I stumbled upon some very useful Firefox plugins tonight. While I have LiveDocs in my linkbar anyway, I love being able to search Actionscript 3 and Flex documentation directly from the search engine field in Firefox. Check it out: 

http://en.flash-ripper.com/firefox-search-plugins-flash-flex-air-actionscript-adobe-labs/
 


Flex Debugging - SecurityError #2060

April 1, 2008 17:18 by dave

I was wiring up an ExternalInterface call from my Flex application to javascript function in my HTML page today. It's really easy. But darn it if I could get the thing to work when debugging or running from Flex Builder. I kept getting the error:

SecurityError #2060: Security sandbox violation: ExternalInterface caller... (blah/blah/mxml cannot talk to blah/blah/html)

I was also getting an error in my javascript function which drew my attention. I was calling document.getElementById('myDiv').innterHTML and getting the error that my element "has no properties". Now, that's not a tough bit of code, so what was the deal? I was calling the function before the element was actually available in the page...it didn't exist yet. To verify this I put the function call inside of a window.onload function and viola, it worked.

So, back to the security error. I searched high and low and found dozens of 0 reply posts (there has to be a name for those poor souls left adandoned and alone - I think I'm the author of most of them!) where developers lamented the issue. 

The common situation: it works on the web server, but throws this error when running/debugging locally.

Flex Builder launches the application in your browser, and throws localhost on the front of the path which sounds like it's running in a virtual web server. It's not. Notice file://localhost. That means it's just reading the file locally, hence the security exception. 

It seemse to me that the only reasonable solution is to run a local web server and launch the Flex application to the local web path rather than the file path. Then your browser would be looking at http://localhost instead and the security issue would go away. 

To accomplish this setup your web server run a website from the bin-debug folder, then in Flex Builder modify your run/debug dialogue to open http://localhost/nameOfMyApp/myFile.html instead of the filepath that is there now.


Tags: ,
Categories: Flex
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed