If you want to get CFEclipse up and runing on Windows then this what you need to do:
Installing Eclipse IDE
- Go to http://www.eclipse.org/downloads/
- Download Eclipse IDE for Java Developers (windows version)
- Extract the zip file to your Program File directory (you don’t install eclipse from an exe or msi file)
- Open the directory you extracted your files to
- Right click on the eclipse.exe file, hold and drag to your start menu to create a shortcut
Installing CFEclipse
- Run eclipse
- Accept the default Workspace (you can change it later)
- From the help menu, select Software Updates -> Find and Install
- Select the “Search for new features” radio button. Next.
- Click the “New Remote Site” button
- Enter CFEclipse as the name
- Enter http://www.cfeclipse.org/update for the URL. OK.
- Click the Finish Button
- Eclipse will now go off and check the CFEclipse site
- Tick all plugin boxes
- The next steps are self explainatory…
- …Restart Eclipse
Changing the font size and / or colours
- Windows menu -> preferences
- Expand General -> Appearance -> Colors and Fonts
- Expand the Basic folder in the dialog box
- Click on Text Font
- Click the Change button
- Choose your font
View line numbers
- Windows menu -> preferences
- Expand General -> Editors
- Tick the Show Line Numbers box
If you’re new to Eclipse then you should know that you can’t just open a file, first you need to create a new project.
- File -> New Project
- open the CFEclipse folder and select CFML Project. Next
- Enter your project name
- Untick the “use default option” box
- Browse to your project folder. Finish.
I’ve been using Fusebox 5.5 since it was released but have been a bit slow to check out the SES handling (I have been using my own URL parsing in Application.cfm and an ASAPI plugin). This didn’t work with the XML-free version on Fusebox 5.5. After much head scratching I worked out why.
First this is what the official Fusebox 5.5 release notes say:
Fusebox 5.1 did not process these URLs coming into the framework so you needed to add your own home-brewed SES URL parser. Fusebox 5.5 will attempt to parse SES URLs coming into the framework if the queryStringStart parameter is set to something other than the default “?”) in fusebox.xml or FUSEBOX_PARAMETERS.
All you need to do is add these lines into the pseudo constructor of your Application.cfc and job done!
// search engine safe parameters...
FUSEBOX_PARAMETERS.queryStringStart ="/"; // default: ?
FUSEBOX_PARAMETERS.queryStringSeparator ="/"; // default: &
FUSEBOX_PARAMETERS.queryStringEqual = "/"; // default: =
Don’t forget to reinitialise the application to make it work!
In my case I also had to use a different script name to the usual index.cfm to stop Fusebox’s URL handling conflicting with my server wide ASAPI plugin URL handling.
I posted a drag and drop example of sorting and saving a list using the jQuery sortables plugin. I was asked how this could be done with table rows. The jQuery TableDnD plugin comes to the rescue!
It doesn’t have serialize method so you need to get the new order yourself which can be done easily by looping through the rows and building a list in the correct order.
<html>
<head>
<script type="text/javascript" src="js/jquery-1.2.3.min.js"></script>
<script type="text/javascript" src="js/jquery.tablednd.js"></script>
<script type="text/javascript">
<!-- <![CDATA[
$(function(){
$("#sortable-tbl").tableDnD();
$('#frm-sort').submit(function(){
var sRowOrder = "";
$("#sortable-tbl tr").each(function(i,o){
if (sRowOrder.length) {
sRowOrder += "," + o.id;
} else {
sRowOrder = o.id;
}
});
$('#sort_order').val(sRowOrder);
});
});
// ]]> -->
</script>
</head>
<body>
<table id="sortable-tbl">
<tr id="section_id_1">
<td>One</td>
<td>Row A</td>
</tr>
<tr id="section_id_2">
<td>Two</td>
<td>Row B</td>
</tr>
<tr id="section_id_3">
<td>Three</td>
<td>Row C</td>
</tr>
<tr id="section_id_4">
<td>Four</td>
<td>Row D</td>
</tr>
</table>
<form id="frm-sort">
<input type="submit" name="save" id="save" value="save" />
<input type="hidden" name="sort_order" id="sort_order" value="" />
</form>
</body>
</html>
* UPDATE *
Someone asked how to update the database using ColdFusion, so here is the code:
<!--- strip the 'section_id_' from the list, so that we only have a list of ids --->
<cfset form.sort_order = ReplaceNoCase(form.sort_order, "section_id_", "", "all") />
<cfloop from="1" to="#ListLen(form.sort_order)#" index="ndx">
<cfquery name="qryOrder" datasource="#Request.Datasource#">
update [Sections] set
section_order = <cfqueryparam value="#ndx#" cfsqltype="cf_sql_integer" />
where section_id = <cfqueryparam value="#ListGetAt(form.sort_order, ndx)#" cfsqltype="cf_sql_integer" />
</cfquery>
</cfloop>
To force a file to download instead of opening in the browser use this code:
<cfset variables.filepath = ExpandPath('myfolder') & variables.myfile />
<cfswitch expression="#LCase(ListLast(variables.myfile, "."))#">
<cfcase value="avi">
<cfset variables.contentType = "video/x-msvideo" />
</cfcase>
<cfcase value="doc">
<cfset variables.contentType = "application/msword" />
</cfcase>
<cfcase value="exe">
<cfset variables.contentType = "application/octet-stream" />
</cfcase>
<cfcase value="gif">
<cfset variables.contentType = "image/gif" />
</cfcase>
<cfcase value="jpg,jpeg">
<cfset variables.contentType = "image/jpg" />
</cfcase>
<cfcase value="mp3">
<cfset variables.contentType = "audio/mpeg" />
</cfcase>
<cfcase value="mov">
<cfset variables.contentType = "video/quicktime" />
</cfcase>
<cfcase value="mpe,mpg,mpeg">
<cfset variables.contentType = "video/mpeg" />
</cfcase>
<cfcase value="pdf">
<cfset variables.contentType = "application/pdf" />
</cfcase>
<cfcase value="png">
<cfset variables.contentType = "image/png" />
</cfcase>
<cfcase value="ppt">
<cfset variables.contentType = "application/vnd.ms-powerpoint" />
</cfcase>
<cfcase value="wav">
<cfset variables.contentType = "audio/x-wav" />
</cfcase>
<cfcase value="xls">
<cfset variables.contentType = "application/vnd.ms-excel" />
</cfcase>
<cfcase value="zip">
<cfset variables.contentType = "application/zip" />
</cfcase>
<cfdefaultcase>
<cfset variables.contentType = "application/unknown" />
</cfdefaultcase>
</cfswitch>
<cfheader name="Content-disposition" value="attachment;filename=#variables.myfile#" />
<cfcontent type="#variables.contentType#" file="#variables.filepath#" />
Please can we have the same functionality as the cfoutput group attribute in cfloop. For example:
<cfloop query="qryFoo" group="mycolumn">
<cfloop>
</cfloop>
</cfloop>
Thanks Adobe!