Home | Projects | Contact Me

"Initializing" jQuery applications

I am currently working on a fun little side project that relies heavily on jQuery's $.getJSON() and $.ajax() calls. The project in question is a simple tile-based game and javascript/jQuery is used extensively to keep things running smooth. One of the first problems I had to contend with was making sure all the data I needed is loaded before rendering the player view.

[More]

Automatically start ColdFusion at boot (Ubuntu Linux) revisited

Quite a few months ago I did a blog post about starting ColdFusion on boot with Ubuntu Linux. When I originally wrote the post I did put a disclaimer on there that I was indeed new to Linux and there was probably a better way to do what I was attempting to do. I was right.

There is a very easy way to accomplish this in three steps and it does not require editing your system files or going through all the run levels and trying to figure out where to start and stop ColdFusion.

The first thing you need to do is make sure the chkconfig utility is installed on your system. I do not believe it is installed by default on Ubuntu distributions, but that is easy enough to remedy:

sudo apt-get install chkconfig

Next we need to copy our generated coldfusion script to /etc/init.d:

sudo cp /opt/coldfusionX/bin/coldfusion /etc/init.d

At the top of the file ColdFusion made for us are some special directives for the chkconfig utility. Chkconfig will look for these and automatically set where ColdFusion needs to be stopped and started. It looks something like this:

#!/bin/sh

# chkconfig: 345 90 14
# description: starts the ColdFusion MX server

Finally, run the chkconfig utility to add ColdFusion service to the list of services run at boot:

sudo chkconfig --add coldfusion

Enjoy.

Problems with UUID's

I ran into a problem this morning passing a UUID to ColdFusion using $.getJSON() in a login script. I am passing login credentials to a CFC, that CFC processes the login and returns a UUID back to me, which is the ID of the user.

The problem came about when I went to pass that UUID back to a CFC that was expecting a UUID as an argument. It took me a minute to finally figure out what was going on.

[More]

Detecting jQuery Ajax calls (and validating the session that sent it)

Ray recently wrote jQuery/Server Side Tip on Detecting Ajax Calls (and you are following InsideRIA, right?) that did strike a cord with me.

[More]

A javascript question

I am having some problems with some code I thought should be straight forward to write. I have tackled the problem from so many directions I have forgotten what the code originally looked like. Some times other points of view are just what the doctor ordered so I thought I would toss the code snippet out there and see if someone else might be able to make heads or tails of it.

[More]

A quick question for the jQuery Guru's

I've been working on some code for a demo application and I ran into a little bit of a problem. I was trying to load a JSON object with data using jQuery's $.ajax function, but when it loaded it was evaluated as text. Needless to say, it made the callback function processing the data very unhappy.

I finally did get the code in question working, but I don't know if I accomplished it the best way.

function getCache() {
   
var data = $.ajax({
      
      url: '/model/cache.cfm',
      type: 'get',
      data: dataString,
      datatype: 'json',
      async: false,
      cache: false
      
   }).responseText;
   
   cacheJSON = eval('('+data+')');
               
}

Basically I am just loading a JSON recordset and storing it for when we need it later. Is there a way to let jQuery know we are loading a JSON object without having to evaluate() it? I would have used the $.getJSON() function, but I need a synchronous connection as opposed to async.

I have migrated from MSSQL to MySQL

I have finished migrating the BlogCFC databases over from SQL Server to MySQL. If anyone notices anything funky could you please let me know? (No comments from the peanut gallery about my posts, either.. ;)

WhosOnCFC for Site Security

Most people who are familiar with WhosOnCFC know it is a useful tool seeing visitors who are currently viewing your web site. However, you may not know WhosOnCFC was designed first and foremost as a security tool. Being able to view web traffic is a necessity to make sure people are not going places they should not be. I have only documented the basics of WhosOnCFC, how to set it up and get it configured. Now I plan on going a little more in depth here so you can see the mechanics of it.

[More]

Running WhosOnCFC Under Railo

I have been working on migrating sites over to my new server which is running Railo. Very quickly I noticed WhosOnCFC appeared to be broken. It was not throwing an error and for the most part everything was running correctly. Looking at the WhosOn Stats page everything was showing as I would expect. However, when you went to pull a query of users currently online it was returning an empty query when it most definitely was not.

I spent a while troubleshooting everything and I finally found the culprit in the code. In whoson.cfc around the line 400 mark or so, in the WhosOnline function, the query needs to be modified a little:

<cftry>
<cfquery name="result" dbtype="query">
SELECT *
FROM myQuery
WHERE (0=0)
<cfif arguments.showAll is false>
AND LastUpdated Between '#c#' and '#n#'
</cfif>
<cfif arguments.showHidden is false>
AND hideClient=0
</cfif>
</cfquery>
<cfcatch><cfreturn myQuery /></cfcatch>
</cftry>

The difference being the single quotes around #c# and #n# which I had omitted before. I will update the code on RIAForge as soon as I get the chance.

Using GMail as Your SMTP Provider and Sending E-Mail as Another User

In an effort to simplify my life recently I shut down my mail server and moved all my e-mail hosting to Google Apps. I would have done it a long ago, but before ColdFusion 8 there was not an easy way to use SSL/TLS in CFMail. Now it is extremely easy to do.

Jamie Krug recently wrote this post on setting up Google SMTP using ColdFusion 8. I did have a little confusion about which port to use and whether or not to use SSL, TLS, or both which Jamie's post helped me clear up.

The next obstacle I had was sending e-mails under accounts other than my primary account. A while ago Doug Boude wrote a post about using Google SMTP on ColdFusion 7. In the comments, Paul Lovetech posted how to make sure the correct address is put in the "From" field instead of using the primary account holders e-mail address. Problem solved.

More Entries

Layout: Shane Zehnder ::: BlogCFC was created by Raymond Camden. ::: This blog is running version 5.9.