Initial thoughts on jParallax

jQuery 2 Comments »

This week I came across jParallax, an inventive jQuery Plugin. It's quite simple to use. It was easy to customize an option to restrict movement to east and west. Prepping the photos actually turned out to be much harder than setting up my demo configuration. The hiccup I encountered was not caused by jParallax, but rather the inability to reduce photo-quality PNG-24 file sizes enough to make the page load quickly. I tried PNG-8 files, which were smaller, but they left a telltale white fringe along the transparent border.

Is it possible to shrink PNG-24 file sizes? I wish JPG had a transparent layer. I'll have to work on some other source files until I can find something worth using here.

Demo

οΎ 

How to test for a form submit using Coldfusion

Coldfusion No Comments »

The Problem

Ray Camden posted a Q&A today about how to test for a form submit using Coldfusion. He offered a couple of great solutions. Unfortunately, a fatal flaw was pointed out in my favorite method:

<cfif stuctKeyExists(form, "submit")>

...fails in Internet Explorer when you press enter. For some reason IE doesn't pass the 'submit' value unless you actually click the button. Running some tests, I determined that behavior is unique to IE. It was a nice method because it's concise and doesn't require modification of the form.

Looking for a new solution:

Based on the article I tested the following method by submitting a form pressing enter and clicking on the submit button.

The browsers:

  • Firefox 3
  • Safari 4 (Windows)
  • Chrome 1
  • IE 6
  • IE 7

The Methods:

1: <cfif structKeyExists(form, "submit")>

Fails in IE 6 & 7 when you press the "Enter" key to submit.

2: <cfif NOT StructIsEmpty(form)>

Fails in all browsers if you cfparam any form fields. I would recommend against this as it will be easy to break the form during future maintenance.

3. Test for an existing form field OTHER than 'submit': structKeyExists(form, "hiddenfield") or isDefined("form.hiddenfield")

This method works fine in all browsers, but unfortunately requires a specific field name. You should know the fields since you're processing the form anyway, but sometimes, that logic is abstracted away. For example:

<cfif structKeyExists(form, "hiddenfield")>

<cfset application.formwizard.save(form)>

</cfif>

If the hidden field wasn't required this code could be reused without concern.

4: isDefined("form.fieldNames") and len(form.fieldNames)

I'd never heard of this method, but after testing, it works reliably in all browsers when a form is submitted by clicking "submit" or pressing "enter". To my surprise, it even worked when form fields were param'd.

4b. isDefined("form.fieldNames")

This shortened version also appears to work reliably in all tested browsers when clicking 'submit' or pressing 'enter'.

Result:

After these tests, I plan to switch over to option 4, and preferably 4b. I plan to do more testing on 4b to determine if there are any cases where a browser creates this field before the form was posted.

Finally, getting onboard with Transfer...so far, so good.

Coldfusion 4 Comments »

I first heard about Transfer when Sean Corfield presented Model-Glue and Reactor to my local CFUG (Portland CFUG at the time, now it's the Portland Adobe Developer User Group). He mentioned a promising new project called "Transfer" that he was just looking into. (Having a procedural background, I asked some pretty naive OOP questions in the Q&A) Since then, I've followed Transfer blog posts and webcasts, but I've just recently had reason to dig into it.

Constructing an XML Object map doesn't seem worth the effort involved until I experienced the pain of building all those objects manually for a sizable project. For the small projects I worked on prior to that (4 tables max), Coldfusion's native proceedural methods with the occasional service cfc was a much faster route. (Both in building and final performance). However, once I started working on much larger projects I started to understand why tools like Transfer are useful.

I appreciate that Mark Mandel kept the XML Object Map from being verbose, but here's a question: Why do all of these Coldfusion OOP tools use XML for configuration? I imagine it's easy to parse, and easy to read if you know what the valid format is SUPPOSED to be, and Eclipse allows for helper plugins.... yet, it's a stumbling block for many CF programmers. Why is that?

  • Coldfusion does not report XML parcing problems well.
  • XML can be case sensitive unlike CF.
  • Requires a separate config file; cannot modify configuration programatically.
  • The elements involved are already in either SQL or CF, why map it out again in XML?

I would think there would be a Coldfusion way of initilizing these frameworks. Either a config CFC (with built in error checking) or a struct. Yet, XML seems to be preferred.

In the case of ORMs, it would be really cool if a SQL script could be parced by a config CFC to build out the initial config which could then be modified as needed. (renaming columns, modifying relationships, etc.)

But since all of these frameworks were created by programmers much more experienced than I, I suspect these were considered but XML was chosen despite it's downsides. Frankly, it's not hard to manage once you get used to the specific syntax, I'm just thinking out loud.

Unfortunate Bad Luck With BlogCFC

Coldfusion 2 Comments »

Well my attempt to test BlogCFC has been a failure. The installation was easy enough, and the admin site works well, but the public site has errors without a clear solution:

ErrorCode: 1047 - Communication link failure: Unknown command
Error Executing Database Query.
Communication link failure: Unknown command
The error occurred in \org\camden\blog\blog.cfc: line 1341

Reading through the forums, some say it could be my hosting company HostMySite.com, so I've unfortunately had to switch gears. I'm now using MangoBlog, and it's working quite well, although I haven't figured out if I can upload sample files yet.

The Catchy Opener and Observations on Mango Blog

Coldfusion 3 Comments »

It is a truth universally acknowledged, that a single programmer in possession of a web development skills, must be in want of a blog...1

Alternately:

Call me Daniel2

This is a blog for occasional thoughts on Coldfusion programming by a part-time, Portland area programmer. I enjoy following the existing Coldfusion Blogs, but we all need a place for longer comments and off topic posts.

I'm also evaluating Blog applications, so this should be a good test. I've already looked into the following:

  • Blogger (Google Hosted)
  • Wordpress
  • Mango Blog (This site)
  • Blog.cfc

Quick thoughts on Mango Blog:

  • Good: Simple, straight forward installation. I was up and running very quickly!
  • Good: Simple, clean, user-friendly, interface.
  • Good: Nice set of useful plugins that are REALLY EASY to configure.
  • Undecided: Really basic rich text editor - probably a good thing. Good writing doesn't need too many bells and whistles.
  • Undecided: Caching seems a little bit agressive. Many changes, even blog post updates, seem to require a visit to the Cache page.
  • Undecided: The excerpt feature is useful, but seems unnecessarily redundant in implementation. I prefer Wordpress' use of a specific HTML comment to add a page break.
  • Bummer: Adding new categories cannot be done on the fly. (Like BlogCFC for an example).
  • Bad: It doesn't like to display Coldfusion code in a posting.
    • It strips Coldfusion tags in the HTML window
    • It escapes Coldfusion tags in the rich text window, but there is no Code format option so it applies HTML formatting which looks bad.
    • It's possible to break the escaping so that I end up with ugly gibberish:
      &amp;amp;amp;lt;cfscript&amp;amp;amp;gt;
    • Update: Mango Blog and Remote Synthesis each have work arounds to this behavior to make adjustments tolerable.

I'm looking forward to digging into the templating features and custom pages

1 Blatant rip off of Jane Austen's, Pride and Prejudice (1813)
2 and again for Herman Melville, Moby-Dick (1851)
From 100 best first lines from novels

Powered by Mango Blog. Design and Icons by N.Design Studio
RSS Feeds