FlexFusion

June 11, 2008

New job

Filed under: Professional — Tags: , , — Gareth @ 7:31 am

It was a tough decision for me, but I just started a new job at KForce I had some good friends at eAutoclaims, and the coding was always something new, but hopefully I’ll be able to keep my skills in Flex by writing my own code at home, or perhaps even doing some contract gigs.

I’ll be back to developing mainly with ColdFusion again, but there definitely seems to be some momentum for a push towards Flex.  I’ve still got my fingers crossed that they’ll go to CF8 soon due to its struct/object creation improvements, and the LCDS express data transfer back to Flex.  They’re using the Mach-II framework (which I have done zero work with before, but looks very similar to just about every other framework out there), which will be nice to get my feet wet.

I’m still going to continue publishing Flex content on the site, but as I’m not going to be working with it at my job as much, I may not have as much to talk about (considering my last post was May 22nd, I had better start writing more often or I’ll be posting once a year :) ).

April 14, 2008

Returning typed objects to Flex from ColdFusion

Filed under: ColdFusion, Flex, code — Tags: , , , , — Gareth @ 12:22 pm

Back in January I saw Brian Kotek’s post about returning typed structs to Flex. When I first read this article, I wasn’t sure how useful it was (I guess I was getting a little confused with the addition of Transfer and AOP in the article, and figured it was just something for that framework). A few weeks later I came across another article about the same idea, and something clicked and I realized just how brilliant this was.

Previously in order to return a typed object to Flex from Coldfusion, you would usually set up aliasing within both your ActionScript object and your CFC

AS:

[RemoteClass(alias="com.mySite.UserVO")]
public class UserVO {

CFC:

<cfcomponent alias="com.mySite.UserVO">

Then, when you transfer objects back and forth between ActionScript and ColdFusion, they are automagically converted to that specific type (along with all of the methods that go along with them). The only bad thing with this method, is that in order to transfer the CFC VO back from ColdFusion to ActionScript, you have to create that object in ColdFusion. Now this doesn’t create much overhead for one object, but if you query the database and return those query rows as separate objects, you have to createObject on each query row, which is an insane hog of memory and server resources. Plus, ActionScript cannot use any of the extra methods that CF is returning, so really anything other than the CFC object’s properties are just extraneous information.

Using the newly discovered technique, you can return the CFC object’s properties as structs rather than having to use createobject each time. You create the properties of the CFC as keys in the struct, such as

myStruct['firstName'] = "John";
mystruct['lastName'] = "Doe";

All that’s needed is to set one extra key in the struct e.g. myStruct['__type__'] = “com.mySite.UserVO” When the items are returned to ActionScript any struct that has __type__ as a key is automagically converted to an object of that type. What’s even more brilliant is if any items within the struct also have an __type__ (e.g. if the user has a company, and that company is returned as a company struct using the same __type__ methodology) then they also get converted to that typed object, so some sort of recursion is happening also.

Now for the sad news (on my part at least). After spending 3 days trying to get this to work on CFMX7 (I had read in a couple of different places that this supposedly would work in CFMX7), I finally found that it apparently only works via LiveCycle or CF8 (which has Flex Data Services Express, I think). After trying everything imaginable, I ended up just having to write a function to convert the returned data to objects. Now I’m hoping that my company will upgrade to CF8, but I don’t think that will be happening. It looks more likely to be Java + WebORB. I’m not sure if this same capability is possible with WebORB, but I’m hoping it does. Certainly is a nice feature to have. Anyway, hopefully this post will be informative for those with CF8 (or LiveCycle) and save those others with CFMX7 from going down the same path as me for 3 days :)

The original post with a little more details is on the CFTalk Mailing List

April 9, 2008

isDate function for Flex…found!

Filed under: Flex, code — Tags: , , — Gareth @ 9:12 am

Well, sort of…

ColdFusion has a very nice “isDate()” function that allows you to pass in a variety of formats, and check whether the passed in value is a date. I had been searching for something similar in Flex, but had very little success until I started playing around with different functions myself.

I had been writing a custom controller for a datagrid which allowed passing in data from an object or table and displaying it in an editable datagrid. The problem I ran into was that depending on the data returned, trying to set those values back to the object that I was using, caused me some issues (such as trying to set a date stored in a text field, back to the object as a “new Date” value). After trying many different kinds of things, I found that the parse function of date works very nicely.

You can do something like

    if ( Date.parse( myDateField.text ) ) {
        myObj.recordingDate = Date.parse( myDateField.text );
    }

If you pass it a value that is not a valid date, the statement returns false.

Anyway, I had been searching around for a while trying to find something that would allow me to check for isDate and this fit the bill nicely. It also allows you to pass in quite a varied type of date formatting and it still recognizes it. Very powerful feature, it seems.

April 5, 2008

Wrapping up my background

Filed under: Personal — Tags: , , , — Gareth @ 10:00 am

This should finish up my technical background and can get on with the good stuff.

After proving that I could actually program given something interesting to do, the web development company promptly offered me a position. It consisted of one man who had been working for himself for several years. I worked on all kinds of projects there, large and small, and was allowed to develop my skills in other ventures, not just ColdFusion. However after several years, I felt myself stagnating and not being challenged enough, so, once again, after getting bored, I decided I should look for something new. I had been looking into going towards something of a more OOP design, and needed somewhere that would allow someone with a self-taught CF background, to begin somewhat a-new but bringing all of the coding background along for the ride.

Enter my current company and Adobe Flex. I had no idea (before beginning the position) how much programming and OOP was involved in Flex and ActionScript. I thought that it was all just Flash (which I never thought of as anything more than a design program). After playing with Flex and ActionScript for a couple of weeks, I’ve got a whole new appreciation for it.  It has challenged me more than anything I’ve done so far, and forces me to rethink my previous procedural style of thinking every day. There always seems to be something that can be re-written better or more logically, or encapsulated to save time later. And on that point, I think this article just about sums up me, my programming, and a good portion of why I do what I do The Nerd Handbook (better than I could explain myself :) )

Anyway, if anyone actually made it this far, thanks for reading and hopefully I’ll have the time and patience (and the code) to post something helpful.

April 4, 2008

A Little Background

Filed under: Personal — Tags: , , , , — Gareth @ 10:00 am

Well, not really too little, but hopefully I won’t bore anyone…it’s all great stuff…really
I learned programming in high school, mainly Pascal on UNIX PCs (yes, we all thought that was way too much money to spend on computers that we were just using to type short Pascal programs on), with some Hypercard on Apple II’s, and some TC Logo on any PCs they had lying around. Before this I had really just tinkered with my old Commodore64 and BASIC, so nothing too crazy. Not seeing any of the potential work or monetary gains in this, I switched gears and went with Biology in college. In my junior year, I realized that I really did not like the biology I was learning (that plus my grades weren’t up to par with being that doctor my mum always wanted me to be), I figured it was too late to change course so I might as well finish up and figure out what I wanted to do after graduation.

I ended up going back home and looking for whatever would earn me some cash, that did not involve manual labor (grocery store stocking and assisting my dad with home repairs taught me early about the benefits of an education). I began working as a temp, then worked as a DBA (well, they called me a DBA, but I don’t think MSAccess really counts, but I still keep DBA on the resume :) ) at a mortgage company. I transitioned to their web department (this involved my boss leaving and them saying “Here, you have to do the web site now as well”). Luckily they hired a company using ColdFusion to develop their external site, as I had been having fun with classic ASP before that.

I ended up getting bored just working on the intranet (they used frontpage to manage it), and asked if the web development company needed any help building the site. Not ones to turn down free coding help, they jumped at the chance. From here I got to see (and learn) some not so useful coding practices for ColdFusion (pound signs everywhere), but hey, it was a start and I did manage to fix them going forward. I began working with CF4.5 with MSAccess as the dB, and was well on my way to becoming the CF Guru I am today.

April 2, 2008

Welcome to FlexAbility!

Filed under: Personal — Tags: , , , , — Gareth @ 11:43 pm

Not exactly the most original title for my first post to my very own blog, but everyone has to start somewhere…and yes I do know that it is spelled Flexibility, but this is a better play on words.

I’m writing to this blog partially as a way to post my thoughts, and partially as a way for me to remember things that may have caused me grief while coding in the past.  In writing them, perhaps I can help others through the same issues but with less grief.

I began writing to a blog over at ColdFusion Community and will probably still post there every now and then, but I thought that I would try creating my own rather than going solely through there.  My wife has been asking for a place to post her thoughts so I figured why not keep everything together and just post them both to the family web site.  She hasn’t decided on what she wants hers to be called yet, but once she does, I’m sure she’ll be posting like crazy!

I had originally tried out blogspot/blogger and thought that it would be a simple process to get it up and running.  Initially it was.  I made one post.  I then decided to start copying over some of my posts from CF Community, and that was where my problems started.  At CFC, you could “future date” your posts.  I posted specific days for the blogspot posts, not knowing that that just puts a date on the post, not when it will actually be posted.  After I made 4 posts (apparently too quickly for blogspot), my blog got mark as potential spam.  I got sent an e-mail notifying me that my blog was mark as potential spam, so I went and clicked the “unspam me” link, and went on my merry way.  After 5 days of hearing nothing back, I decided to search around to find another way to notify Google that I was actually a real person and not trying to spam anyone (I’m sure talking about my history would definitely boost the blog spam ratings of someone, somewhere).  Finally I found a link, filled in more or less the same information as before, and waited another 5 days before hearing nothing.  After posting nothing for 10 days, and finally having something to say, I decided enough was enough and started to look around for other solutions.  I then came across WordPress.com

I signed up for an account which, just like blogspot, was quick and easy.  Signed in and started to make my first post.  As I went through my day, I surfed around a bit and found someone who posted that wordpress.com was built off of open source code at wordpress.org  Having a family site written in PHP (for fun, I know, crazy aren’t I :) ), I decided I would try installing the wordpress.org pages and give it a whirl.  Well, after running through the 5 minute installation process, I’m glad I went with Wordpress.  It was such a simple thing to get going, and looks very clean and professional throughout.  Having the PHP pages available is really nice for customization, and as a learning tool.  I’m always looking for ways to improve my coding skills, and what better way than to look through code that has had perhaps thousands of eyes looking at it, improving and optimizing the code.  Plus the simplicity of the administration section will be a boon for the wife.  She wants something that’s easy to use, that she can post her thoughts and pictures and be done with.

This blog will probably be primarily focused on Adobe Flex, Adobe AIR, and Adobe/Macromedia ColdFusion, but have a smattering of personal items, probably some rants, and certainly a PHP issue every now and then.  Hopefully it will become something that will get a regular following, but if it helps one person who was having difficulty coding, then it will have done its job.

Powered by WordPress