| By Bruce Van Horn | Article Rating: |
|
| August 23, 2002 12:00 AM EDT | Reads: |
8,902 |
September means summer is over and we all get back to work or back to school.
And for those of us who have been out of school for a very long time, I hope you always look for opportunities to learn something new. Send me your questions if you get stuck!
Q:I have a CF Scheduler question: How do I schedule the execution of a template to run at 6 a.m. on weekdays (Mon-Fri) only? I know how to schedule it at 6 a.m. every day, but I don't want it to run on Saturday or Sunday. Any suggestions?
A:Unfortunately, there's no way to get the CF Scheduler to do this for you (at least none that I'm aware of). There is, however, an easy way to accomplish this. Schedule the template to run at 6 a.m. every day, which you already know how to do, but put a CFIF block in your template to test for the day of the week. If the current day is a Saturday or Sunday, don't execute the code. The template is still executed by the scheduler, but none of the code executes on those days. Here's the code you need to wrap around the existing code in your page:
<CFIF DayOfWeek(Now()) gt 1 AND DayOfWeek(Now()) lt 7>
...this will only run Mon-Fri!
</CFIF>
Q: I want to assign a user a password using a randomly generated string of letters and numbers without repeating any characters. How can I do this?
A: Great question. The solution is in the following code. Let's assume that the password will be eight characters long using both letters and numbers. First, assign a variable that contains all the possible characters (I like to omit the letters "L" and "O" because they're often confused with the numbers 1 and 0). Next, initialize your password to null. Then loop from 1 to 8. For each iteration of the loop, pick a random number between 1 and the length of your character list. Select the character from the list based on the random number and append it to the password. Last, delete that character from the list so it won't get picked again.
<CFSET charList =
"a,b,c,d,e,f,g,h,i,j,k,m,n,p,q,r,s,t,u,v,w,x,y,z,0,1,2,3,4,5,6,7,8,9">
<CFSET Password = "">
<CFLOOP FROM="1" TO="8" INDEX="i">
<CFSET RandNum = RandRange(1,ListLen(charList))>
<CFSET Password = Password & ListGetAt(charList,RandNum)>
<CFSET charList = ListDeleteAt(charList,RandNum)>
</CFLOOP>
<CFDUMP VAR="#Password#">
Q: We recently received an e-mail from one of our customers explaining that attaching the following code (mode= debug) to the URL of a ColdFusion file (for example, listings.cfm? mode=debug) will reveal most, if not all, of our network information (IP address, server information, OS information, etc). Obviously, this is a potential security threat and has shaken us. What can we do about it?
A:It's funny (ironic) that when this was first introduced (in version 4, I think), it was actually billed as a "feature"! Appending "?mode=debug" to the URL does reveal the execution time of a page and all of the Form, URL, and CGI variables that were available to the page when it was processed. At times when debugging an application it's helpful to a developer to get this info on-the-fly by applying this URL string. But, as you mention, it can be very dangerous to your site if a good hacker gets this information! Fortunately, you can prevent this from happening by placing one line of code in your Application.cfm file:
<CFSETTING SHOWDEBUGOUTPUT="No">
With this tag in Application. cfm, nobody (including yourself) will be able to see any of this debug information. When developing an application, I leave this setting set to "Yes," but when I put the application into production, I set it to "No."
Please send your questions about ColdFusion (CFML, CF Server, or CF Studio) to AskCFDJ@sys-con.com. Please visit our archive site at www.NetsiteDynamics.com/AskCFDJ.
Published August 23, 2002 Reads 8,902
Copyright © 2002 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Bruce Van Horn
Bruce Van Horn is president of Netsite Dynamics, LLC, a certified ColdFusion developer/instructor, and a member of the CFDJ International Advisory Board.
![]() |
shane schmidt 09/08/02 07:35:00 PM EDT | |||
As a very new-comer to coldfusion, I am perplexed with their variables. To build a user defined database query based upon variables passed, I have cut my code into 3 forms. I can pass form variables A to form B and form variables B to form C . However I cannot pass form variables A to C. Can you assist ? |
||||
- Adobe’s Aiming ColdFusion at Multiple Clouds
- Cloud Computing Journal: Adobe to Deliver ColdFusion in the Cloud
- Adobe Reader Sued
- Adobe May Cooperate with Apple to Transplant Flash Player to iPhone
- Adobe Flex Developer Earns $100K in New York City
- Adobe LiveCycle Enterprise Suite 2 for Cloud Computing
- Adobe Cans Another 9% of its Workforce
- Adobe Betas Target RIAs and Cloud Computing
- Adobe MAX 2009 Online
- Thinking of Flex in London
- Moyea DVD4Web Converter V2.0 Converts DVD to FLV Fast and Synchronously with Watermarks
- Adobe & Salesforce Cut Cloud Deal
- Adobe’s Aiming ColdFusion at Multiple Clouds
- Eval JavaScript in a Global Context
- Fig Leaf Software to Exhibit at Government IT Conference & Expo
- Is Microsoft as Free as Open Source?
- Cloud Computing Journal: Adobe to Deliver ColdFusion in the Cloud
- Adobe Reader Sued
- The Planet Named “Bronze Sponsor” of Cloud Computing Expo
- Microsoft Expression Web Has Got Game
- Adobe May Cooperate with Apple to Transplant Flash Player to iPhone
- Bruce Chizen Joins Voyager Capital as Venture Partner
- My Top Seven Wishes From Adobe MAX 2009
- Adobe Flex Developer Earns $100K in New York City
- The Next Programming Models, RIAs and Composite Applications
- Where Are RIA Technologies Headed in 2008?
- Constructing an Application with Flash Forms from the Ground Up
- AJAX World RIA Conference & Expo Kicks Off in New York City
- CFEclipse: The Developer's IDE, Eclipse For ColdFusion
- Personal Branding Checklist
- Adobe Flex 2: Advanced DataGrid
- Has the Technology Bounceback Begun?
- Building a Zip Code Proximity Search with ColdFusion
- i-Technology Viewpoint: We Need Not More Frameworks, But Better Programmers
- The Asynchronous CFML Gateway
- Web Services Using ColdFusion and Apache CXF





































