Posted on Leave a comment

Ridiculous ColdFusion/Webserver behavior

Solved! I had a conditional statement that would insert the following code into the <head> on one template: <base href="http://<cfoutput>#application.gDomainName#</cfoutput>"> Still doesn’t explain why it breaks.

Original problem: I have a bizarre situation and I am clueless on how to fix it. I have written an application that works fine on my development server. On the production server urls with cgi variables are behaving strangely. I have set up two ways to test the behavior. The first is in the application structure of application.cfm->index.cfm->included_file_with_href.cfm The href submits to itself like this: <a href="index.cfm?this=that&you=me&foo=bar">the link</a> I have include a <cfdump var="#url#"> as line 1 of the application.cfm. When the link is clicked the dump shows:

struct
amp;foo bar
amp;you me
this that

Now I created a test.cfm under the same directory structure so that it is influenced by the same application.cfm (remember, the one with the cfdump at line 1): application.cfm->test.cfm and it submits to test2.cfm and the dump comes out as expected:

struct
foo bar
you me
this that

So what would cause ampersands & to remain as & in one scenario but translate to &amp; in another case on the same server? This makes no sense whatsoever!

The URL has to be getting screwed by either the web server or the ColdFusion MX7 server. Neither makes sense. Yes 7.0.2 hot fix 2 has been installed. IIS is current.

Other references: See also

Posted on Leave a comment

What kind programs do you write?

I often get asked, "Now, what do you do?" and when I try to explain it I get these blank stares and gapping mouths to which I pause then say, "I make web pages." Their eyes light, heads nod, and they declare, "OOooh!" Quickly followed by a subject change.

What do I really do? Right now I am writing an application that allows service providers to advertise their services. So someone seeking a service goes to the website and enters what they are looking for and the matching providers pop up. Sounds simple enough right? Well, if I do my job correctly it will appear amazingly simple to the end user. The behind the scenes programming complexity is awe inspiring. As a minor example, the administrator has to take requests from service providers to be apart of the website. Then the administrator has to create the service provider profile which implies an administrative website that only the staff can access (roles based security). A profile! That’s simple right? Just a database table with all the descriptions of the provider and services offered right? Not really. In actuality it is a very complex system of related lookup tables. Since I cannot predict all the variants of services and pieces of services that may be offered, the system was built to allow the administrator to dynamically add and remove qualities from the service profile. Certainly a detailed specification could have made that simpler but would have resulted in a limited application where as this one can grow to meet the future needs of the client (I know..the simpler approach would have produced more billable hours in the future..blah blah).

Of course, the service provider has to have their own website to be able to manage the details of their service without having to labor the administrator. However, the client does not want the service provider to be able to make certain changes to the profile without approval. So I have had to create a change request table in the database to accept pending changes from the service providers to be accepted or rejected by the administrator. Now there’s a level of complexity that echoes changes throughout the site!

I love my work!

Posted on 2 Comments

Tech Issue of the Day

Today’s terribly frustrating error causing a long delay in a short process is:

Parameter index out of range (1 > number of parameters, which is 0).

It is the result of this simple insert:

<cfquery name="createrole" datasource="#application.gDataSrc#">
    INSERT INTO #application.projectidentifier#_theroletable {
       fooASInt,
       barAsInt
    } VALUES {
       <cfqueryparam cfsqltype="CF_SQL_INTEGER" value="#fooAsIntValue#">,
       104
    }
</cfquery>

UPDATE: Whoops. I see the typo! There is a big difference between {} and (). Should have been:

<cfquery name="createrole" datasource="#application.gDataSrc#">
    INSERT INTO #application.projectidentifier#_theroletable (
       fooASInt,
       barAsInt
    ) VALUES (
       <cfqueryparam cfsqltype="CF_SQL_INTEGER" value="#fooAsIntValue#">,
       104
    )
</cfquery>

Posted on Leave a comment

And an afternoon of troubleshooting goes to one line

So IIS v6 wasn’t letting form variables post. <cfdump var="#form#"> would show an empty structure. CF’s built-in webserver on the development box worked fine. Changing the method from post to get made things even stranger with the query string using &amp; instead of &. I finally found the solution. I had used the obscure html tag <base"

<base href="http://domain.com/">

IIS v6 did not like this. Removing that one line fixed the problem. So much for trying to be the perfect coder.

Posted on Leave a comment

Today’s Technical Challenge

As a web application developer, I am often asked to put a WYSIWYG editor into the application so that the end-user can use the application without having to learn HTML and CSS. There are plenty of free and commercial wysiwyg editors available. (Note to developers: bookmark that link!)

These editors are designed to be customized for your application. You can typically control what buttons appear, what the interface looks like, and so forth. My challenge is to not only change the appearance of the editor, but when the end-user begins typing I need to have that type appear in a default font family (Arial), font size (12pt), and justified to the left. That means if they cut and paste content the defaults need to be applied.

The editor I chose for this project was TinyMCE. I find it far easier to implement than the ever popular FCKeditor (and no..those are the developer’s initials). My editor of choice is typically Xinha.

I have found numerous references to setting content_css : "defaultcontent.css" in the tinyMCE.init and this does change the text as the end-user is typing but the font family select and the font size select menus remain at their default values. When you save, the font family and font size are not saved. Very frustrating.

Interesting!

May 3, 2007 – Adobe, to embed FCKeditor in ColdFusion 8

Adobe has chosen FCKeditor as one of the great new features of its next major release of ColdFusion, code-named Scorpio. Some reviews of it can be found on the web.

For ColdFusion programmers, it will be as easy as defining a tag to see FCKeditor displaying all its power on their pages, right out of the box.
[Source]

Posted on 2 Comments

Like quicksand!

So today began with me frantically trying to complete one project so that I could try to finish another critical project and was interrupted with a client emergency which was put on hold until tomorrow. Part of wrapping up project 1 involved getting the data and structure out of a MS SQL 2k database and into a MySQL 5.03 database. Jumped some hoops on that one. The MySQL GUI Tools are fantastic! I still prefer SQLyog for developing queries since it uses the same shortcuts as MS Query Analyzer. Next I had to figure out how to get my CFMX7 server to actually connect a data source to the MySQL server.

Long and short I had to download the mysql-connector-java-5.0.6.zip then put the jar into the web-inf/lib directory. The CFservice had to be restarted of course. Worked like a charm!

Devpapers.com was invaluable although I skipped most of those instructions.

Ended up on a long tech support call trying to figure out why my Motorola v3xx has quit sending SMS text messages and will only send MMS messages. Seems the answer may be to empty everything from the inbox and outbox. That will take some doing!

Time to do more programming. What I’d really like to do is settle in with a scotch and a book or a movie and talk to Cathy.

Posted on 1 Comment

What is programming?

In essense, a client presents a challenge and I solve the problem.

Today’s challenge: a custom ordering system (shopping cart) written in ColdFusion is producing the wrong totals.
The system design: tax is built into the price of the items stored in the database except for certain non-taxable items. A flag indicates if an item has tax built into the price or not. At the bottom of the invoice, the amount of tax charged is shown.
The problem: The system allows for the administrator to apply a discount. Tax cannot be discounted but the total tax shown on the invoice is calculated off the discounted price.

How do you solve this kind of problem? I use my tools available to me. I could just jump into the code and start changing it but I can do a better job and document my efforts by using MS Excel and MS Word to help solve the problem.

  1. I pull up the sample invoice that the client used to show the incorrect figures.
  2. I reproduce the invoice in Excel.
  3. I open the database (in this case with MS Access) and find the products listed on the invoice so that I can be certain which items are taxed and which are not.
  4. I manipulate the spreadsheet to assure that I am using the correct math formulas to get the correct result.
  5. Find the code within the system that calculates the tax and change it to use the new formula for presentation.

Update: I think perhaps the end of this post was lost…

Posted on Leave a comment

Interpretting ColdFusion Error Messages

Everyone knows what Apple’s "Type 1" error message means. Well, you should. It means "something went wrong and we have no clue why!" Everything computer related has something like this. Even AdoMacrollaire’s ColdFusion has some strange ones.

Invalid token ‘\n’ found on line 40 at column 0.

This error message means you forgot to close a comment somewhere. ColdFusion comments are delineated the same as HTML comments (<!– html comment here –>) but with an extra dash (<!— cfml comment here —>). So if you open a comment and forget to close it perhaps even following it with another comment you will get the reference to a linefeed (\n) being an invalid token.

<!--- this is the messed up comment
<!--- and this is a valid comment --->

Posted on 1 Comment

Looking to go corp

I love working for myself. I love working from the house. I have worked the past 9 weeks for free because I was unable to collect on my last two major projects. My business practices have to change to prevent this from happening again.

There are five companies in the Knoxville area that could woo me back into corporate life: Scripps Networks, Jewelry Television, Bush Beans, SAIC (wow! SAIC IPO’d!), and Clayton Homes. I am sure there are others. I really know my stuff when it comes to ColdFusion. PHP, MS SQL and MySQL. ColdFusion is my love. I learned yesterday that Jewelry Television has a ColdFusion position available and I am applying. Wish me luck!