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

IPSentry Variables for Alerts

IPSentrySupport
* KEYWORDS are Case Sensitive – use all lower case for keywords.

IPSentry utilizes a large set of key words to represent device, terminal, server, naming, statistics, states, and other information unique to a given event. These variables are useful for email messages, alpha pager messages, launching external commands, and SNMP trap descriptive, and some customization options within the detail reporting.

Here is a list of currently documented IPSentry keywords supported and a description of their translation.

Please note that version 4 keywords are currently supported – however, since they have been deprecated, they are no longer documented and may eventually become unsupported in future versions.

*Date / Time Formats: The date formats shown as long and short date / time format are based on your system date/time formatting...

0 comments