Posts Tagged ‘ColdFusion’

ColdFusion 9.0.1 Release Date

Monday, January 25th, 2010

Mid April?  I’m just guessing here.

AKC wants to avoid upgrading ColdFusion to a .0 release so I’m stuck in a holding pattern until 9.0.1 comes out.  If anyone knows anything that they are allowed to share, please do!

Handling Null in ColdFusion

Tuesday, January 19th, 2010

CF uses duck typing to deal with variable types: if it quacks like an date, it must be an date.  More on duck typing

When ColdFusion gets a null back from a Java function, it is much like a duck through a jet engine.  It is going to happen eventually and the results range from gross to catastrophic.

The ColdFusion language doesn’t really consider null a possibility but CF is built on top of Java and null values can exist in Java.  If you call a function from a Java object and assign the result to a variable, that variable can become null.

<cfset myJavaReturn = CreateObject("Java","com.coldfusionpowered.xmp.NullFactory").getNull()/>

ColdFusion doesn’t differentiate between a variable that has been set to a null value and a variable that was never set at all.  In our example it will appear as if myJavaReturn never existed!  As a CF developer you have several options to deal with this:

  1. Politely ask your Java developer not to return null
  2. Use a function like StructKeyExists() or IsDefined() to check for null after your call
  3. CFParam your variable after the assignment
  4. Wrap your function call in a UDF that ensures that a value is returned
  5. isNull() in CF9 (Thanks Henry!)
  6. Suggestions?

Many times, suggestion one is not possible.  You maybe working with an established API or a middle tier that services more than just ColdFusion.  You may just get laughed at and ridiculed by the Java devs for your arrays starting at index 1.  Fortunately, checking the result isn’t hard in simple cases:


<!--- we can also create nulls in CF with a JavaCast --->
<cfset myJavaReturn = JavaCast( "null", "") />
<cfif not IsDefined("myJavaReturn")>
<cfset myJavaReturn = ""/>
</cfif>

If you have to do this a lot, you may want to wrap this up in a cffunction.


<cffunction name="AntiNull" hint="Assist with null values returned from Java, Returns an empty string if target is null.">
<cfargument name="target" default=""/>
<cfreturn arguments.target />
</cffunction>
<cfset myJavaReturn = antiNull(JavaCast("null",""))/>

I hope that helps you deal with nulls in CF.  If you have another method for dealing with this, I’d love to hear it!  Please comment.

Note: My blog frequently eats code in comments.  I am working to correct this.  I’ll try to fix your code examples if it doesn’t survive.

CF Online Meetup – VirtualBox for the CF Developer: Results

Thursday, January 14th, 2010

Questions about VMs, VirtualBox, Linux, ColdFusion or any combination are welcome at DavidHenry |at| coldfusionpowered.com

A link to the recording:

http://experts.na3.acrobat.com/p36124700/

Slides

http://blog.coldfusionpowered.com/wp-content/uploads/2010/01/vbox_for_cf_dev.pdf

Better Answers to Questions I Answered Poorly

Is Xen dead? No, Xen is alive and kickin’

Can you run a VM inside of another VM? To my surprise, yes. VirtualBox seems to allow this but it is extra slow.

What was the problem when you tried to use snapshots? The machine I was presenting from was using an old version of VirtualBox (3.0.12).  The feature I was trying to show was introduced in VirtuaBox 3.1.  Download directly from virtualbox.org to get the latest version for your operating system.  Proper use of snapshots can be found at http://www.virtualbox.org/manual/UserManual.html#snapshots.

Magic commands to forward a port from host to guest “MyVM”

DOS/Terminal Commands


VBoxManage setextradata "MyVM" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/Protocol" TCP
VBoxManage setextradata "MyVM" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/GuestPort" 80
VBoxManage setextradata "MyVM" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/HostPort" 8585

–== OR ==–

Edit {vboxhome}/Machines/MyVM/MyVM.xml

“pcnet” is the default network card, “0″ is the first network card

Add this to the <ExtraData></ExtraData> section:

<ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/http/GuestPort" value="80"/>
<ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/http/HostPort" value="8585"/>
<ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/http/Protocol" value="TCP"/>

Links

http://www.virtualbox.org/
http://download.virtualbox.org/virtualbox/3.0.12/UserManual.pdf
http://forthedeveloper.com/2009/coldfusion-virtualbox-and-ubuntu/

http://blog.zoobiesoft.com/index.cfm/2009/10/22/

http://httpd.apache.org/docs/2.0/mod/mod_alias.html#alias
Making the cfide directory map correctly in Apache2.

http://help.adobe.com/en_US/ColdFusionBuilder/Using/WS0ef8c004658c1089-38317734121cdfd5fd3-7fff.html#WS0ef8c004658c1089-38317734121cdfd5fd3-7ffe
ColdFusion Builder RDS setup instructions.

David Henry Presenting VirtualBox for Online ColdFusion Meetup

Monday, January 11th, 2010

meetup_logo1

This Thursday night (1/14/2010) I am giving a presentation on the Online ColdFusion Meetup Group at 6pm.  I am very excited about this!  I’ll be presenting on Virtualbox for the CF Developer, showing how virtual computing can enhance your web development efforts.

I’ve been watching the CF Meetup since early 2007 when it was brought back by Charlie Arehart.  Hundreds of speakers including most of my personal CF heros have given presontations on various CF-Related topics through the group.  I am very proud to be joining this list of presenters.

Wish me luck!  Hope I see you there.

RegEx GREP for UDFs that conflict with new CF9 functions

Thursday, January 7th, 2010

You can also do this with the code analyzer in the CF administrator.

(?x)<cffunction[^>]+["'](?:
ApplicationStop|ArrayContains|ArrayDelete|
ArrayFind|ArrayFindNoCase|IsSpreadsheetFile|
IsSpreadsheetObject|FileSkipBytes|Location|
ObjectLoad|SpreadsheetFormatColumn|
SpreadsheetFormatColumns|SpreadsheetFormatRow|
SpreadsheetFormatRows|SpreadsheetGetCellComment|
CacheGetAllIds|CacheGetMetadata|CacheGetProperties|
CacheGet|CachePut|ObjectSave|ORMClearSession|
ORMCloseSession|ORMEvictQueries|ORMEvictCollection|
SpreadsheetGetCellFormula|SpreadsheetGetCellValue|
SpreadsheetInfo|SpreadsheetMergeCells|
SpreadsheetNew|CacheRemove|CacheSetProperties|
DirectoryCreate|DirectoryDelete|DirectoryExists|
ORMEvictEntity|ORMEvictQueries|ORMExecuteQuery|
ORMFlush|ORMGetSession|SpreadsheetRead|
SpreadsheetReadBinary|SpreadsheetSetActiveSheetNumber|
SpreadsheetSetCellComment|SpreadsheetSetCellFormula|D
irectoryList|DirectoryRename|EntityDelete|
EntityLoad|EntityLoadByExample|ORMGetSessionFactory|
ORMReload|ObjectEquals|SpreadsheetAddColumn|
SpreadsheetAddFreezePane|SpreadsheetSetCellValue|
SpreadsheetSetActiveSheet|SpreadsheetSetFooter|
SpreadsheetSetHeader|SpreadsheetSetColumnWidth|
EntityLoadByPK|EntityMerge|EntityNew|EntityReload|
EntitySave|SpreadsheetAddImage|SpreadsheetAddInfo|
SpreadsheetAddRow|SpreadsheetAddRows|
SpreadsheetAddSplitPane|SpreadsheetShiftColumns|
SpreadsheetShiftRows|SpreadsheetSetRowHeight|
SpreadsheetWrite|Trace|FileDelete|FileSeek|
FileWriteLine|GetFunctionCalledName|GetVFSMetaData|
IsIPv6|IsNull|SpreadsheetCreateSheet|
SpreadsheetDeleteColumn|SpreadsheetDeleteColumns|
SpreadsheetDeleteRow|SpreadsheetDeleteRows|
SpreadsheetFormatCell|TransactionCommit|
TransactionRollback|TransactionSetSavePoint|
ThreadTerminate|ThreadJoin|Throw|Writedump|Writelog
)["'][^>]*>

CF9: ColdFusion Administrator Code Analyzer

Thursday, January 7th, 2010

I’m trying out the code analyzer in ColdFusion 9. It has a setting called “Code Version” that you can set to CF7 or CF8. Why no CF9 I wonder.

CFInNC Conference Registration Open!

Wednesday, August 26th, 2009

Registration opens today! Get registered now for this FREE conference! http://cfinnc.com/
http://cfinnc.com/page.cfm/badges

FREE Conference – ColdFusion, Flex AIR – in North Carolina!

Thursday, August 6th, 2009

The organizers of the CFinNC 2009 Conference are proud to announce the ColdFusion in North Carolina 2009 Conference to be held October 17-18, 2009 on the Centennial Campus of NC State University in Raleigh, North Carolina. The conference will be aimed at ColdFusion and Flex developers and others who are interested in web design using these technologies.

Registration for the event will be FREE which includes entry to the weekend event and all presentations.

In preparation for this conference, we would like to hear feedback from you and your members on what types of content you would be interested in hearing. We hope to make this conference relative to all levels of developers, so your input will be invaluable.

Please visit our website www.cfinnc.com for more information. We are currently accepting submissions for presentations. If you have a topic you would like to speak on, please go to www.cfinnc.com/page.cfm/presenters for more information.

Please announce this to your members. We are really excited at the opportunity to organize this conference and hope that it will be a useful resource for you and your members.

Sincerely,

The CFinNC 2009 team

Docs for New Features Available – Model-Glue 3 Beta 1!

Wednesday, May 20th, 2009

Guess what!  The model-glue framework just released a beta of version 3!

As I mentioned in an earlier post, I’ve been having fund helping the team to organize and publish documentation for the new features in version 3.  I am really impressed with how fast I’ve been able to get up to speed with this framework with only a few spare minutes per night and a little reading.

This framework lets parts of your application quite literally write themselves.  Customize the results and only write from scratch only when necessary.  Less busy work, more results, oh yeah!

New features include:

  1. Bean Injection
  2. Typed Events
  3. Event Generation
  4. Event.copyToScope()
  5. Search Engine Safe Urls
  6. Application.CFC Integration
  7. Content Caching
  8. Helpers
  9. Formats
  10. Remoting

A summary list of these features can be found at http://docs.model-glue.com/wiki/NewFeaturesInMG3

TACFUG is on the Upcoming Flex/Flash Catalyst and Coldfusion/Bolt Tour!

Wednesday, May 13th, 2009

TACFUG in Raleigh, NC (my beloved local CF user group) has been selected to be a stop on the upcoming Adobe Flex/Flash Catalyst and Coldfusion/Bolt tour!  AKA ‘Gumbo’ and ‘Centaur’ as I understand.  We’ve been politely told by Adobe *NOT* to refer to specific version numbers when talking about this event.  I suppose that is just in case they decide to change the versions to Flex 5/ColdFusion 10 at the last moment.

Tour Event: Adobe Flex/Flash Catalyst and Coldfusion/Bolt tour
Date and Time: June 16, 2009 from 6:30pm – 9:00pm
Address: Rail Inc7001 Weston Pkwy Cary, NC 27513
Speakers: Adam Lehman

If you don’t already have a Adobe Groups account you will need to create one before you can RSVP:
https://www.adobe.com/cfusion/entitlement/index.cfm

While you are signing up – join the TACFUG Adobe Groups site:
http://groups.adobe.com/groups/911243f4d1/summary

PLEASE RSVP for the Adobe User Group event – we expect this to be a HUGE crowd and need to get an accurate count:
http://groups.adobe.com/posts/398525e60f