RSS 2.0 Creator for ColdFusion

I went looking for an easy already done for me CFC to create generic RSS feeds for a ColdFusion application. I couldn’t find any, at least that were stand alone. (I imagine there’s one in BlogCFC, but I didn’t want to download it, fearing that I would see how cool it was and decide I have to convert.)

Therefore, I made a little RSS cfc file that takes generic input and converts it to a RSS feed. It’s spits it out as a variable so a developer can decide to either display it to the user, or write it to a flat file themselves. It mostly conforms to the RSS 2.0 specification, but I omitted some obscure elements.

Hopefully someone out there can use it.

RSS 2.0 Creator for ColdFusion

Importing SSL Certificates with Keytool – Finally

From time to time I have had the desire to use SSL certificates from Certificate Authorities (CA’s) which are not included in the default build of Jrun. There are some tutorials on how to do this:

Despite these resources, I could never get the import to work. It would give me the message that it imported and the list test would reveal that it worked but then ColdFusion couldn’t connect to the secured resource. After repeated attempts, I would just figure out an alternate solution to my problem.

That is until today. I was trying it again, and to reduce my frustration, I created a batch file on the desktop of the server. When I ran the batch file, I saw that a cacerts file was created on my desktop. I did some digging, and relized that I was creating a new cacerts file every time I tried to do this, instead of appending the cert to the existing cacerts file.

So the solution was to run the keytool commands from the directory the cacerts file is located in. After you do that successfully, you need to restart the ColdFusion instance you wish to consume the secure services with.

I can’t believe I overlooked something that straightforward but then again, maybe someone else has, and could use this piece of information.

Movable Type 3.3

Following a full backup, I upgraded to Movable Type 3.3. If you are reading this, then posting from Word 2007 Beta works. There were absolutely no problems with this upgrade. It still generates my ColdFusion without errors. I did a complete rebuild, just a few errors related to a few bum plugins.

Great job on this release. Now if only the blog-spam blockers work better.

Asynchronous CFML without a Gateway

I came up with this while coming up with the wrong answer to a different question. My hope is that it is the wrong answer to someone else’s question

How do you run an asynchronous request for without having access to a Asynchronous CFML Gateway?

  1. Encapsulate the code to be run asynchronously into a CFFunction.
  2. Set the access for the function to “Remote”
  3. Put the function in a cfc.
  4. (Optional) Secure the method so that it is called only from server the code resides on.
  5. Call the code as a webservice using CFinvoke, with a timeout of “1”.
  6. Wrap the code in a cftry block.
  7. In the cfcatch add the code block below.

  8. That should do it.

<cfif not FindNoCase("Read timed out", cfcatch.Detail)>
<cfrethrow />
</cfif>

The CFcatch will prevent timeouts from being perceived as errors. The rethrow will ensure that other errors get treated as such.

Now there are some limitations to this. The process will take a minimum of 1 second. Which is slower than using the gateway method, but beats having to pay for the Enterprise version. Granted you don’t have a separate application and session scope like you do with the Gateway, but you can if you put the CFC in a subfolder with its own application.cfc or application.cfm. You also don’t get information back from the call, but neither do you with a CFML gateway.

Hopefully, this can be of use to someone.

Life is Good

I’m sitting in Mahogany, a cigar bar in Philadelphia, smoking a cigar, enjoying free WiFi and learning Model-Glue. That’s right Ryan… working and smoking a cigar. (I have to pretend I not unhappy that I’m not at CFUnited.)

It’s all part of my plan to spend one day a month working out of the office, but not at home. It’s actually been pretty good. Thanks to Ray Camden’s
11 part series on writing a Model-Glue application, I now understand view stacking a bit better.

Word 2007 and Movable Type

You can use Word 2007 (Beta) to edit your blog entries, even with tools other than the ones Microsoft says they support. I use mine to connect with my Movable Type Blog, and here’s how to do it:

  • Click the Big Button thing on the top left (they have a name for it, but I can’t remember it. )
  • Chose New
  • When the New Document interface comes up chose “New Blog Entry”
  • The stripped down blogging version of Word will appear.
  • Chose Manage Accounts on the ribbon.
  • Create a new Account.
  • It should ask you which Blog you wish to edit, and you’re done.

Note that it doesn’t handle categories, and I don’t think it will handle posting notifications, so I typically chose to “Publish as Draft” which is available by clicking the small triangle under the “Publish” command on the ribbon. Once that is done, I use Movable type to add categories, and publish. I recommend you do the same. The way I see it, this isn’t too bad because Word gives me excellent spell checking, grammar checking and undo. This all speeds up my blogging process immensely.

I also recommend you install the NaughtyWordChars plugin from Andy Yaco-Mink, as “smart quotes” might screw up your blog entries.

Unity Questions

I’ve been progressing for awhile with Model-Glue: Unity and I’m liking it more and more. I do have some questions about how to do certain things in it though. I figured I would ask here, instead of bugging Joe directly for a couple reasons:

  1. They might be basic, and someone could point me to a code sample that Google isn’t finding for me.
  2. They’re not basic, and other people could benefit from them.
  3. Somehow I made it to FullAsAGoog, and I’m giddy with Goog.

Question 1

Is there a good way to hold on to an event through an interrupting event like… say… a login request?

I’m going to event=object.edit?objectID=1. This requires a login, so the request gets passed on to a login form. Ideally the behavior after the login, would be to pass back to the original request.

I’ve tried a bunch of cludgy ways of doing that. I was wondering if there was a really elegant way of doing so?

Question 2

What is the best way to override the default events associated with scaffolds?

I’ve done a lot with using the reactor.xml file to connect records to reference tables like countries or states. In the list view, I would like to show the connected records.

I’m pretty sure I can write the right query using the query object syntax in Reactor, but I just don’t know where to do it. Build a new model cfc? Write a new function in one of the auto generated data cfc’s?

If anyone can point me to something I would be very appreciative.

Update: I think I’ve got a decent answer for 2. I created a view that I scaffolded only just for type=”list”. Then made the result of my object type=list scaffold objectView.list. Then I just rewrote the view for objectView.list to send edit,delete,and view requests to those methods in object, not objectView. Is there a better way though?

Unity Might Turn Me

Without wanting to start a whole frameworks argument, I will state that I traditionally don’t like them. I think I’ve had to work with too much bad code written in them. It took me a long time to figure out that there’s a difference between bad frameworks, and bad code written within a framework. Despite realizing that they weren’t the actual problem, I never really gotten into them. I guess I was set in my ways.

That is until I tried Model-Glue:Unity. I have to say, the lazy programmer in me is intrigued. If you aren’t into frameworks, I highly recommend that you give Unity a real look. If you don’t feel like looking at the code and documentation to get a feel for it, check out this video of building a blog in Unity. The cool thing is that it really is that simple once you get going with it. I think it will be enough to convince you to give it a download.

It certainly convinced me. I’m writing my next personal project in it, so that I can really wrap my mind around it.

Creating Exchange Items with ColdFusion

Recently, I was working on the tools that Wharton Computing uses to write from ColdFusion to our Exchange servers. I was getting them ready to be installed centrally on our development servers to open up this functionality to the rest of the developers here. I remembered that back in December Ben Forta posted on his blog about Exchange Integration with ColdFusion, and received a bit of interest in it. It hit me that maybe more people might find use for what I have been working on.

So, I componentized the code, and did my best to make it portable. I’m sharing it with the community.

Here’s what it does:

  • Creates contacts in a remote Exchange mailbox with a limited number of attributes.
  • Creates single or reoccurring appointments in a remote Exchange mailbox with a limited number of attributes.
  • Queries to determine the Exchange server of the user (acts a helper function.)

It does nothing on the client to do this. The communication is all between the ColdFusion server and the Exchange server. I make no guarantees that it will work in your environment, (however if you drop me a line, I’d be happy to help you troubleshoot within reason.) Feel free to modify it and use it to your heart’s content.

Enjoy: Exchange Item Creator.