HOME | FERGUSON Digital Blog

Entries for month: August 2011

QR Codes In The Local Media

General Topics · By Michael Ferguson 1 Comment »

I've known about QR codes (Quick Response) for a number of years now, but was surprised when the local news media broadcasted a report about them as though they were brand new. Worse yet, they spent less time informing the public about how they can be used to promote local business and more time in scare tactics.

QR codes, in case you didn't already know, where created by Toyota to track vehicle parts and soon became widespread in commercial advertising all over Japan. The square codes can be seen hardlinking on billboards, store signs, business cards, just about every flat surface. Here in the US, at least where I live, the symbols have not gained as much popularity.

In my local community, thanks to the media, I wouldn't be at all surprised if the townies feared the codes now. They were warned that scanning the codes with your smartphone could open your device to a myriad of viruses and other unwanted content. Nice tactics, the barcode reading software only translates the scanned code into the alphanumeric text embedded in the coding, it doesn't do anything with the translation; that's up to the human!

It is completely up the holder of the smartphone to click on any translated hyperlink and follow the address with their mobile browser. Much more useful information would be to advise the public to be comfortable scanning QR codes from trusted sources, ie store chains, professional billboards, city metro advertising, but if you do not recognize the web address that the code is wanting you to visit, then don't go there!

Using cfstoredproc, cfprocparam, and cfprocresult

ColdFusion , MS SQL2008 · By Dustin Brisson 4 Comments »

I recently attended a ColdFusion certification course. One of the things I learned in the course was the use of Stored Procedures(SP). SP are a great way to move your SQL statements out of your code and allows for code re-use. It also takes the strain off your ColdFusion server and forces your SQL server to crunch all the calculations/numbers (which is what it is intended for). This practice will help speed up your process time for your page.

One of the features of the cfstoredproc command is the cfprocresult command. The cfprocresult returns the resultset of your stored procedure as a query. If you have more than one resultset, the cfprocresult has an attribute to set which resultset you want.

For example, you create a stored procedure for finding the employees who are male or female in your organization. The stored procedure might look something like this:

BEGIN
   SET NOCOUNT ON;

   --Get Males

   SELECT   FirstName, LastName
   FROM   TableEmployee
   WHERE   Gender = 'M'

   --Get Females

   SELECT   FirstName, LastName
   FROM   TableEmployee
   WHERE   Gender = 'F'

   END

Within your code on your page, you can call these two results like this:

<cfstoredproc procedure="spEmployeesByGender" datasource="your_datasource">
      <cfprocresult name="Males">
      <cfprocresult name="Females" resultset="2">
   </cfstoredproc>

There is no need to put a resultset on the first cfprocresult. However, if you only wanted to return the Females in this example, you must include the resultset attribute.

You can also pass variables to your stored procedure using the cfprocparam attribute of the cfstoredproc tag. Here is an example of the cfstoredproc tag with cfprocparam and cfprocresult.

<cfstoredproc procedure="spEmployeesByGender" datasource="your_datasource">
      <cfprocparam cfsqltype="CF_SQL_VARCHAR" value="M">   <!--- Send M for Males --->
      <cfprocparam cfsqltype="CF_SQL_VARCHAR" value="F">   <!--- Send F for Females --->   
      <cfprocresult name="MaleEmployees">
      <cfprocresult name="FemaleEmployees" resultset="2">
   </cfstoredproc>

Now you can define vairables within your stored procedure to pass to your query statements.

@MyMaleGender VARCHAR(1), @MyFemaleGender VARCHAR(1)

   BEGIN
   SET NOCOUNT ON;

   --Get Males

   SELECT   FirstName, LastName
   FROM   TableEmployee
   WHERE   Gender = @MyMaleGender

   --Get Females

   SELECT   FirstName, LastName
   FROM   TableEmployee
   WHERE   Gender = @MyFemaleGender

   END

© Copyright 1997-2024, All Rights Reserved Coldfusion and MS SQL2008
Powered by Mango Blog.   Design by FERGUSON Digital