Introduction to cfajaxproxy
Jul 19th
I’ve been using Coldfusion for quite some time now, but only recently have I taken advantage of what seems to be a relatively unknown or at least poorly publicized feature called cfajaxproxy, which allows you to create a Javascript object from a CFC, and dynamically interact with Coldfusion using Javascript functions. More >
Disable DataTip targets in Flex charts
May 13th
After working on my new data visualization project at Grooveshark, I’ve been looking for a way to remove the DataTip “targets”, which I have considered calling “points”, “dots”, and “circles” in my search to turn these little things off.
In case you don’t know what they are, here’s a picture:

After trudging through the Flex SDK source code, turns out its a simple style setting for the ChartBase class. Now I feel silly…
var myChart:ColumnChart = new ColumnChart();
myChart.setStyle("showDataTipTargets",false);
or in MXML
<mx:ColumnChart showDataTipTargets="false"/>
Windows Phone 7
Feb 19th
Windows Phone 7 was unveiled at World Mobile Conference last week. Since 2006, Microsoft has been struggling with its mobile market, losing much of its former market-sha
re to Blackberry(RIM), Android, and of course the iPhone. So whats new about Windows Phone 7? Practically everything. The biggest change according to Joe Belfiore, the vice president of Windows Phone program management, is “a shift in focus from buisness and enterprise users to end users”. So, what does this mean? Basically a more customizable, better-looking UI, more features everyday people want, and close integration with social networking. Windows phone 7 aggregates many services together into hubs like pictures, music, mail, etc. It integrates things like Facebook, Twitter, Myspace, Live, Gmail, etc. to pull all the relevant information into that hub. For example in the pictures hub there would be your Facebook pictures, camera pictures, Myspace pictures, Flikr pictures, etc. The UI is also completely different, and is reminiscent of the Zune/Windows Media Center kinetic text look.
So is all this going to rekindle Microsoft’s smartphone market share? Will it change the mobile market for years to come? One thing is for sure though, it’s re-instilled my faith in Microsoft in the mobile market. We’ll see how things really are when “Holiday 2010″ rolls around.
Adobe AIR Coming to Smartphones
Feb 15th
In a recent press release, Adobe has announced that they will be releasing the adobe AIR platform to mobile devices, including Android, Windows Mobile, and the iPhone as part of the Open Screen Project. No release date has been set for the runtimes.
The Adobe AIR 2.0 beta SDK has been released and is available for download. It includes a handful of new features including multi-touch and gesture support. for downloads and other information, see the Adobe Labs page.
Just another reason to love being a Flex Developer.
Downtime
Jan 25th
Sorry If I inconvenienced anyone, somehow my server got unplugged and I didn’t notice.
Integer Division In Flex/Actionscript
Jan 18th
If you’re used to C and other elemental high level programming languages, you know that 5÷9 = 0 and 10÷7 = 1. ActionScript being higher level than C automatically coerces the quotient of two numbers to the Number class, producing a decimal. To get the correct integer quotient, use the Math.floor function, which drops the decimal.
//This produces 4 var integer:int = Math.floor(14/3);
Intro to Try/Catch in Flex/Actionscript
Jan 15th
Sometimes when you’re making a Flex application, you’ll expect a certain piece of code to fail at some point. This is the job of try and catch. For example, say I wanted to loop over a bunch of components I had within an HBox:
<mx:HBox id="myHBox"> <mx:Panel title="1"/> <mx:Panel title="2"/> <mx:Panel title="3"/> <mx:Panel title="4"/> <mx:Panel title="5"/> <mx:Panel title="6"/> <mx:Panel title="7"/> </mx:HBox>
To loop over these panels without setting a specific id for each, we can use the DisplayObject‘s getChildAt() function. So within the
private function averageTitles(box:HBox):Number
{
// initialize some variables
var tempTotal:int = 0;
var i:int = 0;
var length:int = 0;
var isEnd:Boolean = false;
var tempPanel:Panel;
//loop until the isEnd variable is true
while(!isEnd)
{
//Try to get the child at location i
try
{
tempPanel = box.getChildAt(i);
tempTotal += parseInt(tempPanel.title);
i++;
}
//if it fails, we have reached the end of the panels
catch(e:Error)
{
isEnd = true;
}
//we always want to increase the length,
//since the length is longer than the index
finally
{
length++;
}
}
//return the average
return tempTotal / length;
}
(Obviously the length is unnecessary, Its just an example)
The try block is what the program will attempt to execute first, and the code you expect to fail. In this example, the myHBox.getChildAt(i) is undoubtedly going to fail at some point when the HBox runs out of panels. When this happens, the program will throw an error, more specifically a RangeError, meaning you’re attempting to access something outside the array’s bounds. The catch block will quite literally “catch” the error before it escapes to the main application and causes a runtime error(the window that pops up when something goes wrong in a flash movie in your browser). The catch block will then execute the code within its block. A catch block can catch many kinds of errors; in my example I use the error type Error, meaning it will catch all errors. Since I know what kind of error will occur in my code, I could have just as easily written:
catch(e:RangeError)
{
isEnd = true;
}
And the effect would be the same. You can also catch multiple types of errors within a try block using multiple catch statements where appropriate.
For a list of all types of errors, look at the Subclasses of the Error class in the Adobe Flex Language Reference.
You may also have noticed the finally block which increments the var length. The finally block is used to execute code regardless of when an error happens. So in the finally block in my code:
finally
{
length++;
}
The length will always be incremented if there is an error or not, as we need the total number of items to find the average.
That’s basically it, I’ll write a more advanced tutorial later on things like throwing new errors and such. Good luck in your coding endeavors.
Black SMS-Chat Skin for Windows Mobile
Jan 4th
For those of you who use the new SMS Chat for Windows Mobile, I created a new skin to replace the crappy black one that comes as the default. It works with SMS-Chat 1.25, so upgrade if you don’t have the latest version.

Unfortunately the developers hard coded in a lot of color information so we’re stuck with the blue for now(I’d rather have it as a green). Just download the black.bmp and black_alert.bmp files and copy them to /Program Files/VITO/SMS-Chat/skins/bin directory and overwrite the existing ones. Hope you enjoy!
Exporting to Excel using ColdFusion
Dec 19th
Sometimes you’ll have a query that you want your users to be able to export to an Excel file. If you have ColdFusion 9, you could use the cfspreadsheet tag to do this, however ColdFusion 8 users and below don’t have this luxury. Fortunately the workaround isn’t all too bad. Here’s what you do:
<cfcontent type="application/msexcel"> <cfheader name="Content-Disposition" value="filename=myFile.xls"> <table> <tr><!-- A row --> <td>A Cell</td> </tr> </table> </cfcontent>
That’s all there is to it. Basically you format the spreadsheet using HTML for a table. You can also format the cells using CSS, although results vary by which version of Excel or Open Office Spreadsheet your using. Office 2007 and 2010 allow for more customization using CSS than 2003 does, but for the most part generating simple spreadsheets using this method works pretty well. For example if I wanted to change the background color and set up a 3 column table with a header:
<cfcontent type="application/msexcel"> <cfheader name="Content-Disposition" value="filename=myFile.xls"> <table style="background-color:#366092; color:#FFFFFF;"> <tr><!-- Header Row--> <td colspan="3" style="font-size:15px;">This is a header</td> </tr> <tr> <td>A Cell</td> <td>A Cell</td> <td>A Cell</td> </tr> <tr> <td>A Cell</td> <td>A Cell</td> <td>A Cell</td> </tr> </table> </cfcontent>
Which yields:

Excel 2010
Just remember to use cfoutput when exporting ColdFusion data.

