My Projects
Search Blog

Categories
Archives
Useful Links
Photo Albums
RSS

Powered by
BlogCFM v1.15

Vivio Technologies Dedicated Hosting
16 September 2010
CFFM 1.32 Released

 Okay, I've finished updating CFFM to version 1.32

 
- removed uploadify (flash based uploader), replaced with fileuploader jquery plugin
- added context menus for file actions (delete, copy, download, etc)
- fixed a "bug" where CFFM didn't work in BlueDragon 7.1 becaue bluedragon didn't auto-uppercase struct elements
 
Still compatible back to old versions of BD and CF (6.1) as far as I know ... 
 
Subversion:  http://svn.riaforge.org/cffm
 
 
Posted by rickroot at 8:20 AM | Link | 0 comments
15 September 2010
Example of using JavaCSV CSVReader class to read CSV files

 A discussion on cf-talk today led to suggest the use of CsvReader to someone, and since I'd never used it before, I thought I'd write some sample code (I've only used CsvWriter)

This code assumes you've put the csvreader library in the coldfusion classpath but you could use JavaLoader too.

More about the JavaCSV library: http://www.csvreader.com/java_csv.php

<cfset filename = "#replace(ExpandPath("."),"\","/","ALL")#/test.csv">
<cfset fileInput = createObject("java","com.csvreader.CsvReader")>
<cfset fileInput.init(filename)>

<cfset cnt = 0>
<cfloop condition="#fileInput.readRecord()#">
	<cfset cols = fileInput.getColumnCount()>
	<cfif not isDefined("result")>
		<cfset columnlist = "rowNum">
		<cfloop from="1" to="#cols#" step="1" index="col">
			<cfset columnlist = listAppend(columnList,"col#col#")>
		</cfloop>
		<cfset result = queryNew(columnlist)>
	</cfif>
	<cfset QueryAddRow(result)>
	<cfset querySetCell(result,"rowNum",col)>
	<cfloop from="1" to="#cols#" step="1" index="col">
		<cfset val = fileInput.get(javacast("int",col-1))>
		<cfset querySetCell(result,"col#col#",val)>
	</cfloop>
	<cfif cnt gt 100><cfbreak></cfif>
</cfloop>
<cfset fileInput.close()>
<cfdump var="#result#">

 

Posted by rickroot at 12:42 PM | Link | 0 comments