Archive January 2010

Flex Framework: RobotLegs simple demo

01/02/2010 in RIA View Comments

I have finally dug into the RobotLegs framework and learned enough about the workflow and idea to put together a quick video demo. The demo runs through setting up a simple project that actually utilizes the framework and injects data from a model into a TextArea. I hope you enjoy and possibly even learn a thing or two. Nevermind the yelling kids and wife…and barking dogs :) .

Click here for the demo.

If you have trouble viewing the video, you can [Right Click Here] to download the video locally. It’s around 50mb and a QuickTime video.

Source code can be obtained here and a short demo on git can be viewed here.

AS3: Creating static XML with ColdFusion and AIR

01/02/2010 in RIA View Comments

stockAIR
To build off of a couple posts earlier, the following is an example of how to access the Yahoo stock information and create a static XML with AIR file that Flash can access. I went this route after seeing the server hit that we took when 3k+ users logged in at the same time and tried to access the stock ticker. The stock ticker was hitting the Yahoo service every few seconds and was significantly slowing things down. What I decided to do was to still use the CF service to access the stocks, but instead hit it with an AIR app that then takes that information and creates a static XML file for the Flash stock ticker to access. This also solved the “after hours” stock information as the Flash file would always be hitting the static XML, which wouldn’t change after 5:00 PM. So, to define the process, Yahoo delivers stock information, the AIR application is triggered by the server via a scheduled task, AIR accesses the ColdFusion file that hits Yahoo for the stock information, then AIR takes that information and creates a static XML file. This basically took the hit to Yahoo to once every 5 minutes by ONE application, rather than once every few seconds by any number of web hits…typically at least 1k…

Read more

AS3: Yahoo Stocks via PHP Proxy

01/02/2010 in RIA View Comments

To follow a recent post about AS3 and Yahoo stocks using ColdFusion as a proxy below is some code to get the same information using PHP. I have been asked by several people on how to do this with PHP, which is not my typical scripting language. I decided to dig into it to see what the comparable method in PHP is to CFHTTP.FileContent. Turns out that the comparable function in PHP is “file_get_contents”.

<?php
//Get the file content and assign the string to $teststock
$teststock = file_get_contents('http://download.finance.yahoo.com/d/quotes.csv?s=^DJI&f=sl1d1t1c1ohgv&e=.csv');
 
//Split the string into an array to access each property of the stock
$teststring = split(",",$teststock);
 
//Print the new array to the screen
print_r($teststring);
 
print("<br /><br />");
 
//Print a specific point in the array, in this case the first one
print_r($teststring[0]);
 
print("<br /><br />");
 
//Print a specific point in the array, in this case the second one
print_r($teststring[1]);
 
?>

AS3: Yahoo Stocks, Flash and ColdFusion

01/02/2010 in RIA View Comments

After searching high and low for a good resource of semi-up-to-the-minute updated stock feeds I came to the conclusion that there aren’t any, for free anyway. I dug into the Google Finance and Data API’s, and made a lot of headway there writing the authentication methods in JavaScript, then in PHP, then in .NET…but was not able to pull something together (quickly) . I plan on revisiting that path, but I digress. I turned to the Yahoo file download that you access via http and it returns a .csv full of stock data from opening trade, current change, volume, etc. This was perfect but how do I convert that to a format that Flash can read?

I used the URLLoader method to load the data, converted it to an Array by splitting at the commas, and then loaded the different values I need by accessing a certain part of the array. This worked perfectly, locally, but then I placed it on our intranet (final resting place), and nothing showed up. Come to find out, the cross domain policies were preventing access to the file on Yahoo’s server. So to make things easier in the long run I wrote a proxy in ColdFusion that the Flash app calls to obtain the stock data. Enough of my explanations and on to the meat…

Read more

AS3: Trying out FDOT

01/02/2010 in RIA View Comments

Ted Patrick blogged yesterday that he released the latest build (32) of FDOT, a collection of AS3 classes that are created to make hard things easier to do. I have to say my first use of it did just that, taking an XML import from my normal 2 to 3 custom classes, custom events, etc. down to one basic line with a single method to handle callbacks. It’s hard for me to get out of the habit of using addEventListener’s basically everywhere, but literally within 10 minutes of downloading the latest build of FDOT I was loading in an XML dataset, transforming it to an Array (why? because I like to and it makes sorting easy), and tracing random data from the feed. I will say, I am sold and will be utilizing it whenever I can. Check out the code below, and visit Ted’s site and thank him for making this hard task easy…

You can grab the library here.

You can visit Ted’s blog post here.

Read more

Switch to our mobile site