Skip navigation

Author Archives:

Ever wonder why an object data is never updated whenever you update the actual data via a cfquery tag and when you do a getData() from the Farcry frame work, the data doesn’t contain the changes you made previously via cfquery?

Well this is because the data you get from the getData() function are loaded from the Object Broker, which caches the data for fast retrival, therefore when you do an update manually via cfquery tag, this change was not registered in Object Broker. Here’s a handy little snippet of code that will do the trick!

<cfset application.fc.lib.objectbroker.RemoveFromObjectBroker(lObjectIDs=objectid,typename='dmHTML') />

The sample code above allows you to update the cache of a dmHTML object in the Object Broker cache.

Just came across an issue where my ajax response errored after performing a request to retrieve some data returned as a JSON object. The error returned was INVALID JSON. After a couple minutes of debugging I’ve nailed down the data issue. Turns out jQuery parser doesn’t like having single quotes in the response packet, even if the quotes are correctly escaped such as \’. So watch out!

I find it really frustrating sometimes trying to investigate why a schedule task is not executing correctly on a production server because we don’t get access to the CF admin and inspect each schedule task for ourselves. BUT luckily I’ve found this little snippet of code which gonna make our lives much brighter.

<cfset factory = createObject('java', 'coldfusion.server.ServiceFactory')>
<cfset allTasks = factory.CronService.listAll()/>
<cfloop index="i" from="1" to="#ArrayLen(allTasks)#">
    <cfdump var="#allTasks[i]#" />
</cfloop>

This script basically returns a list of schedule tasks on the server!

I was debugging an ajax issue in IE6 today and discovered the getJson() ajax function is not resonding and there were no Javascript error. I did some googling and found the issue in the An IE AJAX gotcha: page caching article. While the article gave us a detailed description of the issue and a solution, I have a simpler suggestion which is to replace the jQuery.getJson() function with jQuery.ajax() instead. Using the ajax() function you can set the dataType to ‘json’ and that will automatically clear the caching for you. Problem fixed!

Just found this cool online tool that allows you to quickly draw up a database schema with export function that output a script for you to import the tables and all of it’s attributes into your selected database type.

http://www.dbschemaeditor.com/OnlineDB.aspx

I’ve recently started building my first html based Air application using jQuery and have came across this very bizarre image issue. So here’s the scenario, I’ve got a text link with a image background attached with an onClick function, so when a click event occurred, the image background changes to another image. Now on a normal browser that would work fine but when I ran that in an air environment, the second image just wouldn’t load. I’ve double checked the syntax and even tried using a CSS class that contains the background image and using jQuery to add the class to the link upon onClick event. As expected that didn’t work!

After hours of testing and googling, I have came to a conclusion that jQuery can’t dynamically load images in an Air environment. So what I had to do was to pre-load all div elements with all the required classes on the page for the text link and that will pre-load all the images. Therefore when an onClick event occurs, the background images are displayed. Problem fixed!

Though this is not the best solution but developers should be keep this in mind when developing your Air application, because it would seriously affect how you’ll build/structure your application and could potentially save you hours of head scratching and frustration.

Ever wonder how great it would be if you can edit the content of an object that you have selected in the library? Well now you can! By adding a form tool attribute ‘ftAllowLibraryEdit’ into your CF property such as below, it allows you to individually edit each object.

<cfproperty ftSeq="15" ftwizardStep="Body" ftFieldset="Relationships" name="aRelatedIDs" type="array" required="no" default="" ftJoin="dmNavigation,dmHTML,dmNews,dmEvent,dmFacts,dmLink" ftLabel="Associated Content" ftAllowLibraryEdit="true" />

Once you have included the new attribute, update the application. You should see a new button named ‘Edit Item’ appearing next to the ‘Remove Item’ button.

Recently, I’ve discovered that some of the Firefox version 2 (in particular 2.0.0.20 on Window Vista) has an error in the mime type settings. Reasons for this is because when I uploaded a PDF document (using cffile tag) via the Firefox browser the mime type returns from the browser was ‘text/html’ instead of ‘application/pdf’. Patrick van Bergen wrote a detailed article about this issue and has concluded that this occurs due to the incorrectly configured mimetype.rdf file located in the Firefox profile folder. There’s no common solution for this issue so far and the best we can do is to perform checks for both the mime type and the file extension to determine the content of the file.

To ensure a successful execution of your schedule task, always include a small statement at the end of the script such as

<cfoutput>Script has been successfully executed</cfoutput>

This is because when Coldfusion executes the schedule task it wraps the script in a cfsavecontent tag and checks the length of the cfsavecontent variable. If the variable string has no length it errors and when Coldfusion server catches this error, it stops the execution of the schedule task.

An easy way to check if your schedule task is running correctly, go to Farcry Admin schedule task and select the View option for one of the schedule task. This will opens up a new window and the script is executed. If no error is produced, your script is working!

A quick and easy way to get the last day of the current month is by subtracting 1 from the first day of the next month. For example,

<cfset dStartDate = createDate(year(now()), month(now()), 1 ) />

<cfset dEndDate = dateAdd('d', -1, dateAdd('m', 1, dStartDate )) />

Follow

Get every new post delivered to your Inbox.