arrgh 22 Posting Whiz

Sorry, I got tied up with work too.

would have been nice to know that 2 weeks ago!

Ugh.. hate when that happens. It is like wasting hours trying to get a simple API example to work, only to find out it doesn't work due to a typo in the documenation, lol. Well at least now there's a working option.

(BTW, tell them to save the next guy some headaches and put the incompatibilities in the documenation under "known issues").

arrgh 22 Posting Whiz

1) /opt/coldfusion10/cfusion/wwwroot/WEB-INF/classes or
2) /opt/coldfusion10/cfusion/runtime/lib
Using CF 8, we always had them in location 1, but someone on adobe forum told me to try them in location 2. I've tried both and neither work. Does it really matter, as long as where you have the files matches what it says in the CLASSPATH on the Java/JVM page inside the ColdFusion Adminstrator?

It can be placed anywhere really, as long it's in the CF CLASSPATH. All of these directories are in the default class path ie places CF automatically checks for jars

  • .../runtime/lib
  • .../WEB-INF/classes
  • .../WEB-INF/lib

Though .../WEB-INF/classes is typically used for individual class files, not jars.

I don't have a unidata database, but I think I can download a trial version.

I'm wondering if this driver is really compatible your jvm. Like the name says getJDBCMajorVersion() is checking the jvm version: ie 1.5, 1.6, 1.7. The fact that error occurs there suggests maybe it does not like your jvm version. Have you tried it with jvm 1.6, just to see if there's any change ?

arrgh 22 Posting Whiz

Well like I said, there's no reason it should not work. Maybe there's an error in your code. Can you post it?

arrgh 22 Posting Whiz

Worked fine for me. Maybe you've got an error in your code? Also what's your CF version?

arrgh 22 Posting Whiz

I don't think the trace telsl us anything new

Arrgh.. that should be "I don't think the trace tells us anything new".

arrgh 22 Posting Whiz

coldfusion.sql.Executive.verifyDatasource

Unfortunately, I don't think the trace telsl us anything new. Just that a problem occurred while trying to verify the dsn .. which you already knew.

Is the driver jar public? If yes, can you point me to the api/download link? I'll give it a try. Maybe I can gleen a little more info.

arrgh 22 Posting Whiz

Depends on what else the stack trace says. All we can tell from that is that something goes wrong when checking your jvm version. What's the rest of the trace? Check the logs if needed.

arrgh 22 Posting Whiz

I doubt there is anything built in, but you could roll your own. Grab the textarea value, split it on some sort of word boundary (space, etcetera) and validate.

arrgh 22 Posting Whiz

BTW, did either of you actually test the query...? If yes, what were your results and what version of CF/mySQL are you running?

arrgh 22 Posting Whiz

MySQL requires the strings to be enclosed with single quotes... that may be the cause.

Not strictly true. FWIW, MySQL accepts either single or double quotes. But changing them is worth a try, since single quotes are more standard for string literals in jdbc anyway.

Agreed, it's a SQL error. But like I said, that exact code works perfectly from CF10. So something is different on their end.

arrgh 22 Posting Whiz

Here's the code that's producing it.

What you posted works perfectly w/CF10 and mySQL. Are you 100% positive that's the SQL you're using? Because a common cause of that error is forgetting the comma before the date mask ie

    DATE_FORMAT(Events.event_date "%W") 

instead of

    DATE_FORMAT(Events.event_date  , "%W")
arrgh 22 Posting Whiz

The loop is exactly what you need to do. The only thing I see wrong is adding that cfelse in the middle. Get rid of it. This is what your code is actually saying. It doesn't make any sense.

<cfif IsDefined("btn_add")>
     form WAS submitted, check the array for FORM.ID value
<cfelse>
     when form WASN'T submitted, add form fields that don't even 
     exist to the session array? this makes no sense.
</cfif>
arrgh 22 Posting Whiz

does this new id already exist in the array

If you're looking for a magic function, there isn't one. You must loop through the array elements one by one. Pull out each structure, check it's ID. If it matches throw an error. It's as simple as that.

arrgh 22 Posting Whiz

You're welcome.

I doubt you'll have any problems. CF is pretty intuitive. But if you do, post back.

arrgh 22 Posting Whiz

In theory it's a single query to get the old values:

<cfquery name="getUsers" datasource="yourDSN">
      SELECT TheUniqueID, OldPassword
      FROM   UserTableName
</cfquery>

Then a query loop to generate the new password & update the database.

<!--- untested --->
<cfloop query="getUsers">
   <cfset decryptedString = decrypt(oldPassword, "oldKey)>
   <cfset reEncrypted = encrypt(decryptedString, "newAESkey", "AES/ECB/PKCS5Padding", "base64")>
    <cfquery name="updateUsers" datasource="yourDSN">
          UPDATE UserTableName 
          SET    NewPassword = <cfqueryparam value="#reEncrypted#" cfsqltype="cf_sql_varchar">
          <!--- assumes unique ID is integer  --->
          WHERE  TheUniqueID = <cfqueryparam value="#TheUniqueID#" cfsqltype="cf_sql_integer">
    </cfquery>

</cfloop>

Until you're sure everything's working ok, I'd keep the old password around in a separate column. Since it's a lot of db updates, you may need to increase the page timeout ie yourpage.cfm?requesttimeout=7000. Normally I'd do it in batches, but it's not worth it for a one time script.

arrgh 22 Posting Whiz

Well I was suggesting you do a one time convert on the CF side instead of trying to figure out how to replicate an outdated algorithm in .net. It's only 2 or 3 lines of CF in a loop.

  `decryptedString = decrypt(oldString, "oldKey);`
     `reEncrypted = encrypt(decryptedString, "key", "AES", ...)`
arrgh 22 Posting Whiz

decrypt(ToString(toBinary(strBase64Value)),"keycode")

If there are only 2 arguments, it's not AES. It defaults to a legacy algorithm called CFMX_COMPAT. Most CF apps don't use that anymore. I wouldn't bother trying to replicate it in c#. Better to decrypt and re-encrypt with whatever algorithm you plan to use in the new app. Anything beyond CF7 supports the standards aes, blowfish, etc...

arrgh 22 Posting Whiz

ROFL .. I wish! Too bad code always does what we tell it to do, instead of what we want it to do ;-)

arrgh 22 Posting Whiz

Try a regular expression like ReFind("[^\d]", form.theFieldName)

If the value's required, check the LEN(...) too.

arrgh 22 Posting Whiz

It happens. That is why I suggested printing out the value. Don't feel bad, I once spent an hr chasing my tail only to find out the problem was extra white space. Kept thinking I was right about the code, lol. Didn't figure out my mistake until I went character by character.. Lesson learned ;-)

arrgh 22 Posting Whiz
  1. What are the circumstances you would use it.
  2. What are the advantages and disadvantages to using it over HTML?
  3. Is it compatible with CSS,Javascript, PHP, and MySQL?

If you've used PHP (which I think you have) then you already know the answers to most of those questions. HTML is static and limited. At the core, server side languages like PHP, ColdFusion, ASP/ASP.NET, etc.. are used to generate HTML dynamically. They can do a lot more obviously, but their main purpose is dynamic web applications.

As far as CSS and Javascript, again you can fall back on your PHP experience. CSS and Javascript are client side code that can be generated by PHP scripts. ColdFusion, ASP/ASP.NET, etc.. are no different. They generate HTML/CSS/Javascript and send it back to the browser for rendering.

PHP may query a database, such as MySQL, to gather data and include it in html content. For example, to generate a calendar of events for the current month. Most server side languages can interact a variety of db's, using a standard like JDBC, ODBC, etc.. ColdFusion can interact with any database that has JDBC driver, or that supports ODBC.

arrgh 22 Posting Whiz

The # signs are still off. But I'm guessing it's just a copy paste error, or you'd be getting a syntax error.

Anyway, you didn't answer my question. What's the actual value of #rsProfile.Image#?

The value of rsProfile.Image = <cfoutput>#rsProfile.Image#</cfoutput><br />
<!--- check the length, not the value --->
<cfif len(trim(rsProfile.Image))>
   <cfoutput><img src="#rsProfile.Image#" /> </cfoutput>
</cfif>
arrgh 22 Posting Whiz

Aside from missing # signs around your variable, I'm not sure why it doesn't work.

What's the value of #rs.Image#? It should be a valid URL like:

 /mysite/path/to/myImage.png 
 ../images/myImage.png
 myImage.png
arrgh 22 Posting Whiz

Ok, I didn't know that was your issue. Glad you figured it out. Just one thing - #FILE# is deprecated. Use #CFFILE.serverFile# instead.

arrgh 22 Posting Whiz

Arrgh... the site ate my response. Anyway, that's a sql UPDATE. The basic syntax is:
http://www.w3schools.com/SQl/sql_update.asp

        <cfquery ...>
            UPDATE TheTableName
            SET    ImagePathColumnName = <cfqueryparam value="#variableWithPath#"
                                                  cfsqltype="(your type here)">
            WHERE  PrimaryKeyColumn = <cfqueryparam value="#variableWithPrimaryKey#"
                                                  cfsqltype="(your type here)">

        </cfquery>

If you need specifics, post your table structure and form code.

arrgh 22 Posting Whiz

ColdFusion supports several persistent scopee. Take a look at the documentation for the session (per user) and application (entire app) scoopes.

arrgh 22 Posting Whiz

It doesn't make sense to use both in the same block. As jsmall26 said cflocation always wins because it runs first - on the server. The browser never even sees the javascript.

The javascript belongs on the form page. It should execute before the form is submitted. Save the cflocation for the action page - as b/u validation.

arrgh 22 Posting Whiz

Use CFFILEUPLOAD.

.. which IS flash :P But yep it's simpler if you're on CF9+

arrgh 22 Posting Whiz

HTML file inputs do not allow multiple file selection. AFAIK you need flash, etc. Take a look at a control like swfupload
http://webdeveloperplus.com/jquery/multiple-file-upload-with-progress-bar-using-jquery/

arrgh 22 Posting Whiz

I need to loop over the first 5 arrays, then have another loop to output any remaining data greater than 5

If you elements, can't you just loop twice? Loop from 1-5, if there are enough elements

   <cfset firstLoopMax = Min(variables.albumEdit.albumCnt, 5)>
   <cfset lastShownIndex  = 1>
   <cfloop from="1" to="#firstLoopMax#" index="i">       
       ... show element ...
       <!--- track displayed index --->
       <cfset lastShownIndex = lastShownIndex + 1>
   </cfloop>

Then loop again to show the remaining elements

   <cfloop from="#lastShownIndex#" to="#variables.albumEdit.albumCnt#" index="i">       
       ... show element ...
   </cfloop>
arrgh 22 Posting Whiz
arrgh 22 Posting Whiz

That would certainly improve the UX. But like always, you've still got to back it up with server side validation.

arrgh 22 Posting Whiz

Handling is basically the same in any language. Use an if/else to do the division when the value isn't 0. Otherwise, do something else like return 0.

arrgh 22 Posting Whiz

Not sure what you mean about divide by zero values.

You're using the variables in a division operation. Dividing by zero throws an error. If the final value is 0 the code will blow up. Likewise, if the result of your regex is an empty string, like if the user entered nothing or all letters.

arrgh 22 Posting Whiz

I found that by using a direct query, rather than a QoQ, it is less sensitive to what it thinks the datatype is.

Good. A direct query offers the most control anyway.

What you say about the IN operator makes sense, but from what I've read elsewhere on this CF passes the multiple values over as a list.

If you're using cfqueryparam list="true" it does. ie

        WHERE field IN ( <cfqueryparam value="x,y,z" cfsqltype="(your type)" list="true"> )
arrgh 22 Posting Whiz

Also what's the data type of the paid_date column?

arrgh 22 Posting Whiz

And I get this error:

Invalid parameter type.

It's hard to follow all of that without seeing the values. Can you put together a small concrete example of the QoQ that's failing (with the values)? Btw, do you really have to use a QoQ? Couldn't you use INSERT ... SELECT.

the WHERE statement generated drops an extra single quote

Probably because you're using dynamic sql? CF always escapes single quotes. It guards against sql injection. Only way to avoid it is disable the protection altogether by using PreserveSingleQuotes.

field IN ('#form.field#')'

You need to quote each value inside the variable. ie

  `field IN ( 'x', 'y', 'z' )`

... by putting quotes around the whole thing you're searching for a single value instead ie

  `field =  'x,y,z' 
arrgh 22 Posting Whiz

Yeah, that's what I figured. But you'll still need additional validation to handle common math errors
(divide by zero, value is completely non-numeric, etc..)

arrgh 22 Posting Whiz

Oh well you are missing a closing single quote. I thought it was just a pasting error.

<cfset lampVolts = REReplaceNoCase(url.lampVoltage, '[^a-z0-9]', '(missing here), 'all')>

But you should use the debugger too. That's where all the juicy error messages are when using ajax features ;-)

arrgh 22 Posting Whiz

Enable debugging by adding 'cfdebug' to your URL parameters to see more information

And when you did what it said, what was the real error message? Note, ajax debugging has to be enabled in the CF Admin too.

<cfset actualVolts = url.socketVoltage>

A couple observations
- you're only validating the 1st parameter, not all of them.
- even with the regex, you still need to validate the final value is a number. it could be an empty string which would fail when you tried to use math on it
- you have to guard against divide by zero exceptions

arrgh 22 Posting Whiz

What is the error message?

arrgh 22 Posting Whiz

I don't know which query variable that proc relates to, but yeah, it doesn't include DTRAN in the results.

Since there're 2 query variables in the CF code, the likely possibilities are a) the codes using the wrong query in the wrong place b) the code's using the wrong column name or c) the procedure is missing a column.

Knowing nothing about the app, I couldn't say which is most likely.

arrgh 22 Posting Whiz

I am having problems with pagination using cfloop and the grouping of cfoutput

Trying to combine cfloop start/endRow and a grouped output is just asking for pain. I honestly doubt it's possible. You either need to do real pagination ie only return x records in the query or drop the grouped output.

arrgh 22 Posting Whiz

The 1st option should have a VALUE too, ie <option value="0">Choose an order number</option>

But other than that it looks ok.
1) Is that the exact code used?
2) Maybe one of the query values is causing a problem. Do some debugging and ump the query values. Can you post a screen shot?

ie Just before your select list add:

<cfdump var="#gporder#" label="The query contents">

arrgh 22 Posting Whiz

Do not feed the trolls ...

arrgh 22 Posting Whiz

On what line does the error occur?

I don't know the app, so I'm guessing based on what I see. "dtRan" appears to be the name of a column in a query. There are 2 queries in the code (cfspExportInfo and cfspExport). The error suggests one of them does not contain the "dtRan" column. On which line does the error occur? The one doing the output:

<cfoutput query="cfspExport">
  <tr><td class="textRow">#DateFormat(dtRan, "mm/dd/yyyy")# .... 
</cfoutput>

Or the one generating the email:

<cfmail query="cfspExportInfo" ...>
    ...
    Run Time : #DateFormat(dtRan, "mm/dd/yyyy")# 

Tip, you can view the contents of any variable by using cfdump. Do not use it on a query w/100K rows because it'll take a really long time to display.

   <cfdump var="#cfspExport#"> 
   <cfdump var="#cfspExportInfo#">
arrgh 22 Posting Whiz

your code is very easy to hack and if you're using similar formed queries, I can do some dangerous things.

Sad there are still apps out there with this kind of unprotected code .. Makes you want to ask for the company web developer's credentials before doing business online.

arrgh 22 Posting Whiz

{Reaches for can of troll-spammer-be-gone}

arrgh 22 Posting Whiz

No, it has nothing to do with space characters ie ascii 32

arrgh 22 Posting Whiz

Well if the logins are used to access anything more important than "my bookmarks" I wouldn't use any of the other methods above. They all expose passwords in clear text (in url, html, ...) which violates even the most basic security tests ...