07-20
2010
 

UPDATE 2010-08-02: After working with Adobe on this, they recommended removing the ColdFusion 9 Hot Fix 1. After doing so, the problem was resolved. They are currently working on why the Hot Fix is causing this problem.

To resolve this issue, I did the following:

  1. Stopped the ColdFusion Server
  2. In the [CF9 Install Root]/lib/updates folder, rename the shf9000001.jar file to shf9000001.jar.bak.
  3. Restart ColdFusion

I recently installed the ColdFusion 9.0.1 update and experienced the same problem many others have encountered. Basically, after the install, I attempt to access the Administrator and receive the error: "The DataSource service is not available." So, I check the server.log and see this error:

"Information","main","07/20/10","19:48:07",,"Starting sql..." "Error","main","07/20/10","19:48:07",,"Unable to initialize SQL service: java.lang.NoSuchMethodError: coldfusion.sql.Executive.getInstance()Lcoldfusion/sql/Executive;"

Wonderful! Make sure you test install on a backup server like I did. That really saved me a bigger headache.

Some have tried reinstalling ColdFusion 9 and running the 9.0.1 update immediately after with mixed results. That will be my next course of action tomorrow over a few Pepsi Throwbacks.

04-30
2010
 

UPDATE 2010-07-20: You can now access multiple data sources using ColdFusion Release 9.0.1. The Release notes say it all. Yeah!

I recently created a project at work where I implemented the ORM functionality in ColdFusion 9. It's a convenient feature until it becomes necessary to access a separate database from the original database listed in the ColdFusion data source.

Read more

07-16
2009

Blogging Hiatus Over

By Chris Schofield in Life
 

After a couple of months of no blogging (sorry about that), I've finally got back into semi-normal routines. My full-time job has been brutal since my co-worker left for a full-time position back in May (congratulations!) and we have not found another part-time individual to replace him (although I'm encouraged about current prospects). All the while attempting to release a new product (one month late) and fix all of the problems associated with releasing a new product (for the past two weeks). Finally, lots of travels in June from Independence, Missouri to Park City, Utah. Oh, and swimming with my Google G1 in my pocket, resulting in a swollen battery, totally fried phone, and lots of headache without a cell phone and remote internet service. Thankfully, that's been fixed with a new black G1 (my fantastic boss offered to purchase for me). Attempting to keep a dying pumpkin plant from perishing (lost that battle today). Letting my wife plant some ugly $5 Wal-Mart trees in our back yard (I refused to let her plant them in the front yard). Producing a new Flex application for tracking truck and trailer repairs for LW Miller Companies (that app has kept me up at night for the past 3 months). Resuming work on another Flex app for Carolee's Creations (I'm no scrapbooker myself, but the app is sure cool!) Enjoyed my wife's 34th birthday and my daughter's 5th birthday. Looking forward to my baby daughter's 1st birthday in August and my 34th birthday in the same month. Helping my Mom make it through euthanizing her 15-year-old Maltese poodle "Murphy" (that sucked). Wondering why my car has a tough time starting in the middle of the hot day. And finally, losing some baby fat that I've had for 33 years.

Anyway, I've got plenty of things to blog about, mostly about integrating ColdFusion, .Net, and Flex together. Some MySQL crap I've had to deal with over the past few weeks (actually the crap is from previous developers who didn't know what hell they were doing). I hate cleaning up others people's work.

Glad to be back! Stay tuned!

Stealing from Picasso (and Cameron Moll) this list focuses on the difference between good developers and great developers when building, maintaining and tweaking web sites and web applications.

Read more

04-23
2009
 

When using ViewStacks in Flex 3, the child components are not instantiated until the specific ViewStack component in which it resides is displayed. If you need to access the components prior to them being viewed, you avoid getting null values for components using a couple of methods.

Read more

We recently created a survey to help us better understand certain circumstances about our customers in the current economy and how we could use that information to increase sales conversions for our products. After a customer took the survey, they were redirected to a sign up page on our web site to enter a drawing to win one of several gas cards.

Read more

03-18
2009
 

I have a stored Boolean value in a database as a varchar(5): "true" or "false". In Flex, if you wish to use that value as a Boolean object, say in an "if" statement, you will need to convert that string to a Boolean type.

Unfortunately, in Flex it will not work as expected when casting the string as Boolean. If the string is null or empty, the conversion to Boolean will provide a FALSE value. Otherwise, the conversion will return TRUE.

view plain print about
1var t:String = "true";
2var b:Boolean = new Boolean(t);
3trace(b); // b is true because t has a value other than null or "".
4
5// Now change the value
6
7t = null;
8b = new Boolean(t);
9trace(b); // b is false because t is null.
10
11// Now change it again
12
13t = "";
14b = new Boolean(t);
15trace(b); // b is false because t is "".

So, unlike ColdFusion, the Boolean object in Flex does not consider the actual value of the string. Just whether it HAS a value at all.

One solutions is:

view plain print about
1t = "true";
2b = new Boolean((t == "true"));
3trace(b); // b is true because t is equal to "true".

If you compare t to "true" it will return a Boolean true. Otherwise, it will return false. I like this because now with the Boolean object, it can be used within any comparison situation where a true/false value is necessary.

You can read more about Flex Type Conversions on Adobe's web site

As I've been working on my Flex projects, I've noticed several things that I keep remembering as I experience errors, troubleshoot logic, or look up references:

1) Realize That Flex Is Case-Sensitive

This was probably the first thing I had problems with. While I tried to follow case in naming and referencing ColdFusion variables and functions, I still found myself troubleshooting Flex errors due to case-sensitive typos. But you'll get over it quickly.

2) Purchase Flex Builder

I've developed Flex using the SDK and command line compiler and while it is free and works, using Flex Builder saves you so much time and effort. The auto compiler, along with the code insight for Flash AND Flex objects and functions, and the lovely debugger makes it so much faster and much more fun to develop. Make the $250 investment for at least Flex Builder Standard and if possible the Flex Builder Pro w/Charting for $699.

3) Understand That Flex and ActionScript Are COMPLETELY Object-Oriented

Having been a ColdFusion developer for the past 7+ years, I never really experienced the true OO nature of a lower-level programming language, aside from Java. I understood the basic concepts of classes, inheritance, encapsulation, polymorphism, etc. but never saw the need in CF because even with components, it's still very procedural and limited in some aspects. But, with that in mind, ColdFusion is also a lot less complex, and in almost every way it is much easier to work with.

4) Get Used To A Completely Event-Driven Architecture

This is one of the greatest traits of Flex (and event-driven programming): every action/event is driven by an action/event. In order to even do anything in Flex, an event must happen. In the beginning a ColdFusion developer might find this frustrating, but in a sense, the same principles apply with ColdFusion, like a user submitting a form, and you process it. It's just with Flex, handling ResultEvents or other Events takes a little getting used to.

5) Know That Flex And ColdFusion Work Very Well Together

From handling queries to structs to arrays to every other variable type, ColdFusion and Flex easily communicate.

6) When Possible, Use RemoteObjects To Communicate With ColdFusion

Speaking of ColdFusion and Flex working well together. If you use remote objects, there will be less overhead in the online communication between CF and Flex. This is because RemoteObjects communicate using the binary Action Message Format (AMF).

7) Remember That ActionScript Is A Lot Like C#.NET Which Is A Lot Like Java Which Is A Lot Like...

(Just in case you're learning C# or interested in learning it) While MXML is tag based (it is XML), you'll usually create a Flex app with a combination of both MXML and ActionScript. Since I've been getting used to ActionScript, I've also been getting used to C#.NET, which is the language used on the web site where I work. They share similar syntax and OO properties and frameworks, which has actually enhanced my learning of C#. It has also helped my Java programming, but then I'm already somewhat familiar with it having used it often with ColdFusion.

8) Bookmark blog.flexexamples.com

I'd like to personally thank Peter DeHaan for creating and managing flexexamples.com. I often reference the Flex code snippets at flexexamples.com to figure out the simplest but most effective solutions.

9) Get Tour de Flex

Another great tool for learning the basics of Flex components and objects. I used it more often while first learning Flex, but I sill sometimes refer to it to remember how to setup and use some objects. It does contain more complex third-party examples too.

10) First, Build A Simple App That YOU Need

I would recommend this with any other programming language, but with Flex it makes a lot of sense. If you can build a Flex app that you need, say a web-based widget or new Flash web site, you'll quickly become familiar with the more basic Flex concepts. Move beyond the irksome and obvious "Hello World" app and build something useful. Then post it online!

11) Get Familiar With The Flex UI Components

Some Flex beginners may find themselves trying to build a list or UI layout component that may already exist. I once tried to build a control almost identical to the TileList control. Why build it if it already exists?

However, sometimes you may want to tweak the control to behave or look differently. Because of #3 above, you can create your own control and extend the control you want to modify. Done that many times, and I love the custom functionality you can create.

12) Blog About The Problems You Find/Solve, No Matter How Simple

Unfortunately, I only blog about some of the problems I encounter and subsequently solve. I hope to do it more often. You'll likely find someone else has the same problem you have solved and you'll save them a lot of time and effort by posting the solution on your blog.

Any other thoughts? Feel free to add a comment!
03-09
2009
 

Using the AnimateProperty object, you can do some great effects on various properties of an object. The following code is simply a custom Flex component with a canvas containing a label.

view plain print about
1<?xml version="1.0" encoding="utf-8"?>
2<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"
3    borderStyle="solid" borderColor="#7D88B5"
4    width="200" height="50"
5    verticalScrollPolicy="off"
6    backgroundColor="#0F1739"
7    backgroundAlpha="0"
8    rollOverEffect="{anOver}"
9    rollOutEffect="{anOut}"
>

10    
11    <mx:Script>
12        <![CDATA[
13            import mx.events.EffectEvent;
14            [Bindable]
15            public var title:String = "[no label]";
16        ]]>
17    </mx:Script>
18
19    <mx:AnimateProperty id="anOver" property="backgroundAlpha" fromValue="0" toValue="1" duration="300" isStyle="true" />
20    <mx:AnimateProperty id="anOut" property="backgroundAlpha" fromValue="1" toValue="0" duration="300" isStyle="true" />
21
22    <mx:Label text="{title}" id="lbltitle" color="white" fontSize="24" top="6" left="15"></mx:Label>
23</mx:Canvas>

To animate the backgroundAlpha, I first set it to 0 in the Canvas. Then I add the "rollOverEffect" and "rolloutEffect" attributes and set them to the AnimateProperty objects "anOver" and "anOut", respectively.

One problem I found was since the backgroundAlpha property is a style, you need to make sure and add the "isStyle='true'" attribute and value for the AnimateProperty object. That caused me a little headache.

You can modify the duration (in milliseconds) to make it fade faster or slower.

Sometime, I'll have to look into animation. From what I've seen it doesn't seem to be terribly difficult.

03-04
2009
 

I have a few database tables in MySQL with columns defined as BOOLEAN data types. It should be noted that if you plan to work with BOOLEAN data types in ColdFusion queries, you need to specify the cfsqltype as "CF_SQL_TINYINT" in the <cfquerypram> tag as follows:

view plain print about
1<cfquery name="qry" datasource="#application.dsn#">
2 SELECT * FROM tablename
3 WHERE is_active = <cfqueryparam value="#varname#" cfsqltype="cf_sql_tinyint" />;
4</cfquery>

As quoted from the MySQL documentation:

"[Boolean] types are synonyms for TINYINT(1). A value of zero is considered false. Non-zero values are considered true:"

More Entries

 
Copyright 2010 Chris Schofield - Raw blog processing ColdFusion Jedi power provided by BlogCFC. A freaking sweet project by Raymond Camden.