Best of Talk (4/4/03)

 
May 02, 2003
by Dina Hess

Title: Clearing All Sessions in an Application
Date: 04/04/03      10 Posts
Summary: Need to clear all sessions in an application? Try the code snippet included in this thread, which uses CreateUUID() to set an application- and session-scoped UUID. Session variables are then reset if the application-scoped UUID is different than the session-scoped UUID.
 
Title: Count(*) Query
Date: 04/04/03      10 Posts
Summary: Use the COUNT() aggregate with a GROUP BY clause to get a count of distinct items in a table column:

   SELECT number, COUNT(*) AS total
   FROM table
   GROUP BY number
   ORDER BY number
 
Title: Hiding Javascript Codes
Date: 04/04/03      15 Posts
Summary: There is really no way to hide the JavaScript code used on a website. You can prevent the code from displaying in View | Source by using the SRC attribute of the SCRIPT tag, but the code can still be found in the browser's internet cache.
 
Title: How can I "ORDER BY RANDOM" ?
Date: 04/04/03      23 Posts
Summary: How would you sort by one table column, yet return a randomized sort on another? If you are using SQL Server, here is a simple, yet effective, solution:

   SELECT col_1, col_2
   FROM table
   ORDER BY col_1, NewID()
In MS Access, you can do this:

   SELECT col_1, col_2
   FROM table
   ORDER BY col_1, rnd(primary_key)
 
Title: Time Format Question
Date: 04/04/03      12 Posts
Summary: Several developers suggest offering users select list options as opposed to letting them specify a time mask. Alternately, to strip off all characters that are not part of the allowable time mask character set, you might use a regular expression like this:

   REReplaceNoCase(str,"[^tmhs:]","","all")
 

Privacy | FAQ | Site Map | About | Guidelines | Contact | Advertising | What is ColdFusion?
House of Fusion | ColdFusion Jobs | Blog of Fusion | AHP Hosting