| By Bruce Van Horn | Article Rating: |
|
| August 8, 2001 12:00 AM EDT | Reads: |
8,935 |
I hope that all of you are enjoying your summer and getting in plenty of R&R. If you aren't, I hope you have at least upgraded to the new CF Server 5.0.
Not that this is better than a week at the beach, but it should certainly bring a little joy into your life because of some of the new features! Anyway, upgrade if you haven't already, start playing with the new features, and keep those questions coming. Here are some I've answered recently.
Q: How can I use CF to dynamically generate (out- put) special ASCII characters, such as the tab or line break characters?
A: The easiest way to do this is by using the Chr() function. Simply plug in the ASCII value of the character you want generated. For example, for a tab character, use #chr(09)# in your code. If you're not sure what the ASCII code is for the character you want, use this simple code to loop through all the values:
<cfoutput>Q: You said in your class to avoid using a text file as a data source, but I have a situation where I need to do that. How do I use a text file as a data source in CF?
<cfloop from="1" to="256" index="i">
ASCII Code #i#: #chr(i)#<br>
</cfloop>
</cfoutput>
A: Even though it's a bad situation, it's a good question. The first thing you need to understand is how to create the data source. When creating the data source in the CF Administrator, avoid the temptation to point it to the actual file. Create your data source so it's pointing only to the subdirectory that the file is in. If you point it to the actual file, the connection will fail.
Once the data source is created in CF, you can query the file using the CFQUERY tag as you would for any other database. The biggest difference is in the FROM clause in your SQL. Here's where you'll use the name of the file. For example:
<CFQUERY NAME="MyQuery" DATASOURCE="TextTest">Q: In CF Studio, when I go to click on one of the resource tabs (like the database tab), it frequently unlocks the tab from the rest of the resource area, which is really annoying. Is there a way to stop this?
SELECT Column1, Column2, etc...
FROM MyTextData.txt
</CFQUERY>
A: I know exactly what you mean and I agree that it's very annoying! If you're using Studio 4.5.2 there's a way to stop this "feature." Go to the Options menu and choose Settings. In the lower-right corner of the main screen there's an option called "Lock Tabs". If you check this box, your resource tabs will stay where they are and your life will be less stressful!
Q: I've upgraded to CF Server 5.0 and am trying to view the examples for the new CFGRAPH tag, but nothing ever shows up. What am I doing wrong?
A: The CFGRAPH tag is a cool addition to Cold-Fusion, but it doesn't work unless you start a separate service called the ColdFusion Graphing Server. By default this service is not started automatically. If you're running Windows NT or 2000, go to the Service Manager, start the service, and then try the examples. They should work now.
Q: What's the best way to clear out a cached query?
A: It depends on how you cached it. If you used the CACHEDWITHIN attribute of the CFQUERY tag, you can run the same query with CACHEDWITHIN="#CreateTimeSpan(0,0,0,0)#". This will refresh the query. If you cached the query using a persistent variable scope, such as session or application, you can use the StructDelete() function to remove the query from the scope. For example, if you cached the query using something like <cfquery name= "Application.MyQuery"...>, you can delete it using this statement:
<cfset tmp = StructDelete-(Application,"MyQuery")>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 8, 2001 Reads 8,935
Copyright © 2001 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.
- 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



































