Sched Task Checking

Since we have a lot of scheduled tasks and don’t often check the logs to see whether they’re running correctly, i’ve come up with a way to have the developers emailed if the scheduled task isn’t running.

Create a table called “Util_scheduledTaskRuntimes” (Create table SQL is at the bottom of this post).

set up your scheduled task(s) in this table – name, description.

Basically each time the task runs, you set it to “running” and each time it finishes you unset the “running” flag. The task will not run if the “running” flag is set, so things don’t go over top of each other. However, if the running flag has been set and the task hasn’t been run for a long time, the developers are notified.

Check the example...

0 comments

EXISTS instead of COUNT

if you just need to know whether something exists rather than needing the actual count, it is more efficient to use EXISTS.

OLD WAY (BAD):

SELECT *
FROM MyTable
WHERE myCondition = 1
AND (SELECT COUNT(*)
FROM myOtherTable
WHERE myFIeld = myOtherField) > 0

NEW WAY (GOOD):

SELECT *
FROM MyTable
WHERE myCondition = 1
AND EXISTS (SELECT TOP 1 *
FROM myOtherTable
WHERE myFIeld = myOtherField)

You can also use it in a Select subquery like this:

SELECT *
, CASE WHEN EXISTS (SELECT TOP 1 *
FROM mysubQTable
WHERE myField = myOtherField) THEN 1 ELSE 0 END AS myIndicator
FROM myTable


0 comments

Standard HTML sizes

When optimizing a site for viewing in 800 x 600 resolution, the dimensions should be:

774 x 420


0 comments

Auto Session Expiry on Browser Close

Need to create an application.cfc which will run.

It will turn off setting client session cookies in instead set it’s own client cookies without an expiry meaning they will only live as long as the browser instance does.

http://www.bennadel.com/blog/1131-Ask-Ben-Ending-ColdFusion-Session-When-User-Closes-Browser.htm

<cfcomponent
output=”false”>

<!— Define the application settings. —>
<cfset THIS.Name = “SessionOnlyCookiesTest” />
<cfset THIS.ApplicationTimeout = CreateTimeSpan( 0, 0, 5, 0 ) />
<cfset THIS.SessionManagement = true />
<cfset THIS.SessionTimeout = CreateTimeSpan( 0, 0, 1, 0 ) />

<!—
When creating session-only cookies so that the user’s
session ends when...

0 comments