Download the project here: CouchDB for Coldfusion on RIAForge
A recent Twitter by Mingo Hagen inspired me to start my first open-source project on RIAForge: CouchDB for Coldfusion. This project is basically a CFC wrapper for CouchDB operations.
CouchDB is a fairly new concept. It is a document-oriented database that uses a RESTful HTTP/JSON API for interactions. You should read more about it yourself, but here are just a few reasons why it is cool:
* Schema-free storage
* Data is stored as JSON
* All document revisions are saved
* You can interact with the DB directly through the browser via the built-in API
* Built-in web-based admin
CouchDB for Coldfusion is still in the early stages, but already I find it is an easy way to interact with CouchDB. I'll be using this project as a way to learn more about CouchDB. If you'd like to contribute please let me know and I'll give you SVN access.
Saturday, July 11, 2009
CouchDB for Coldfusion
Posted by
Russ
at
10:24 PM
9
comments
Monday, June 8, 2009
db4o in Coldfusion, anyone?
DB4O is an object database. It allows you to store objects (at whatever state they happen to be in) and retrieve them for use later.
This can be really useful if:
1. You want a simple, quick way to store data
2. You want to create an application that can run without an SQL database
3. You hate SQL (or SQL hates you)
I did some research and found a guy named Todd Sharp who installed db4o for Coldfusion. He hasn't released his code, so that got me thinking: "Hey, I know some Java and I know how to install Java classes in Coldfusion. Why don't I do it myself?"
So I tried it, and it worked! But... I've run into a couple serious issues that I can't seem to figure out.
Firstly, after about four or five "save" operations, the database becomes corrupt. No matter how simple the objects are, this always happens. If I can't figure this out, my experiment is basically a failure.
Second, I cannot store CFCs. If I try, my CPU goes full throttle until I kill Coldfusion. I'm guessing this is due to the underlying complexity of CFCs, but it sure puts a damper on things. I've been using CF 8's JSON functions to "simplify" my Coldfusion objects like so: DeserializeJSON(SerializeJSON(myCFCinstance))
Does anyone else have any experience with db4o? I'll provide my source code and installation instructions to anyone who wants to try it.
Here is a great tutorial for db4o
My system specs:
Java version: Open JDK 1.6.0_0
CF Version: 8,0,1,195765
OS: Ubuntu 9.04 (2.6.28-11-generic)
Hardware: Dell Vostro 1000
Posted by
Russ
at
11:00 PM
4
comments
Labels: cfcs, coldfusion, db4o
Saturday, January 10, 2009
Copy to Clipboard SWF button (cross browser compatible)
Since Flash 10, there have been security enhancements that prevent data being copied to the clipboard without an event being initiated by the user.
See: http://blogs.pcmag.com/securitywatch/2008/09/adobe_to_plug_clipboardjacking.php and http://www.adobe.com/devnet/flashplayer/articles/fplayer10_uia_requirements.html).
This means that Jeffothy’s Keyings Clipboard Copy trick no longer works :-(
NEW DEVELOPMENT: jhuckaby provided a better solution. Check it out:
Zero Clipboard
I've developed a simple new way to get the job done.
My method uses a basic flash button that says "COPY" on it. Clicking it will copy to the clipboard any text provided via FlashVars parameters in the object/embed tags. The flash file then executes javascript as a callback function. This javascript is also provided via FlashVars.
Actionscript 2.0 Code
on (release) {
System.setClipboard(_level0.txtToCopy);
getURL('javascript:'+_level0.js+';');
}
HTML/JS Code
<script type="text/javascript">
<!--
function alertUser(){
alert('copied');
}
-->
</script>
<div style="border:solid 1px black; width:60px; height:20px;">
<object width="60" height="20">
<PARAM NAME=FlashVars VALUE="txtToCopy=cfRuss.blogspot.com&js=alertUser()">
<param name="movie" value="copyButton.swf">
<embed src="copyButton.swf" flashvars="txtToCopy=cfRruss.blogspot.com&js=alertUser()" width="60" height="20">
</embed>
</object>
</div>
Download the required flash file here: copyButton.swf
FlashVars
txtToCopy - the text that you wish to copy to the clipboard
js - javascript to be executed upon clicking the COPY button
Note
You may get a warning dialog from your flash player if you try to run this script locally. This dialog will not appear when you run the script on your server.
Posted by
Russ
at
10:07 PM
19
comments
Thursday, May 1, 2008
JQuery: powerful, easy, amazing!
The for the past month I've really been exploring what JQuery can do and I have to say: wow. If you want to spruce up your site's user experience, this is a great way to go. Not only is it easy to understand, but there is a large number of ready-made plugins for it (with good documentation, too!)
For example, you can easily transform a list into a slick drop down menu complete with animation. Or add a image gallery with carousel navigation. Or add a touch of AJAX with a search-box auto-complete feature. Web 2.0, ahoy!
Part of the power behind JQuery is how it uses "selectors" to identify (and objectify) HTML page elements. Once "objectified" in your javascript, you can then use the expansive JQuery function library on selected element(s). Here is a list of JQuery selectors: http://docs.jquery.com/Selectors . Seem familiar? If so, it's because JQuery borrows and expands upon CSS selectors.
And while I'm giving you good links, here is some documentation for the JQuery function library: http://www.visualjquery.com/1.1.2.html (keep in mind that this is mildly outdated: there are a few more cool functions added in 1.2)
If you want to see what I've done with it lately, check out the product search on: http://www.emilystrange.com/beware/getlostengine.cfm (try searching for cat)
I used JQuery's auto-complete AJAX feature, the TableSorter and associated Paging plugin, and I even created my own widget for the TableSorter plugin that adds alternating row colors to the results table. The search filtering is all done with custom JQuery code too.
For the better part of my web-career I've distanced myself from javascript because it was unreliable and most of it just seemed chunky. Plus, the web didn't start to pick up enough speed (literally) until a few years ago when broadband became standard issue. All of these factors kept me from ever using javascript for anything serious, much less depending on it for site functionality. But that has changed. With browser standardization and high-speed internet came "Web 2.0", and slicker user functionality has become vital.
Posted by
Russ
at
11:25 PM
2
comments
