Programming, Technology, Web Development, Whatever
Nathan
Posts by Nathan
CRUD problem in IE6 with cfajaxproxy
Aug 9th
When using the CFC generator in Coldfusion Builder to create a DAO for a database table, Coldfusion will create four functions
within this file, namely create, read, update, and delete. When creating a Javascript object out of the CFC using cfajaxproxy, Coldfusion will populate your document with Javascript that contains the names of these functions in the document. This will break IE6.
Typically this wouldn’t be a problem, however the trouble arises when the document is populated with the last function: delete. Whereas Coldfusion sees delete as a function within the CFC, however delete in Javascript is a reserved word to deallocate dynamically allocated memory. All other browsers (including IE7+) recognizes that delete is indeed a function of your CFC, however IE6 simply recognizes it as a reserved word, and discontinues parsing the pages Javascript, resulting in Object Expected errors when other Javascript code is executed. To get around this, you simply need to rename the delete function in the CFC to something different.
Attached Files:
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!