arrgh 22 Posting Whiz

Well you're talking about a totally different error now. It sounds like a db error. I can't see the query code from here ;) But with datasources it could be anything from missing permissions, wrong user account used to connect, to a datasource pointing to the wrong db.

arrgh 22 Posting Whiz

Well I think I figured out after the posts you, arrgh, and Shalinko posted. I didnt have a <cfset SESSION.login = "No"> on my adminLogin.cfm template

But you shouldn't have to! That's the whole point of using CFPARAM. It sets a default for a variable only if that variable doesn't exist ;-) As long as your other page is in covered by your Application.cfm, it should work without having to set the variable manually.

Sorry. I don't use DW.

arrgh 22 Posting Whiz

Where are you setting the session variables? I'd also check the obvious things like is sessionManagement enabled in the application.cfm/cfc.

IIRC, there used to be an issue with setting session variables and using cflocation on the same page. Don't know if it still applies though.

arrgh 22 Posting Whiz

No, but there's lots of threads about recommendations on both adobe's forums and www.houseoffusion.com

arrgh 22 Posting Whiz

Thanks for the updates. Glad to see things are progressing. I'm surprised about the cause though. The "maintain connections.." setting caused problems in CF8, though IIRC it caused a null pointer error or something. But thought they fixed that. Guess not!

arrgh 22 Posting Whiz

They said they had noticed some spikes in the server logs

Is that code for ".. we saw bunches of errors in the logs and realized it might not be your code at fault but our networks and/or hardware"? ;-)

arrgh 22 Posting Whiz

Yeah, I don't know about moving someone else's db without their permission. But more importantly, why did they suggest that and what issue did they think it would solve?

arrgh 22 Posting Whiz

Sporadic errors are always the hardest to work through with any tech support dept. You should document it when it happens again (time, script, etc..) and definitely take a full screen shot!

arrgh 22 Posting Whiz

I hate godaddy!

From the many threads and blogs I've read .. you're not alone there.

arrgh 22 Posting Whiz

Yes, that's why I'd sift through the google threads on those phrases. You're obviously not the 1st person to have the problem. So there might be an answer somewhere in them. That's what I always do when I have a weird problem I can't solve. Find similar threads and see if someone found a fix for it ;)

arrgh 22 Posting Whiz

>>> Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database 'rlb'

The first one looks like a wrong database name. The others seem like some kind of network problem. Not sure if it's network or driver related. But google shows lots of threads on these two phrases.

1.
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

2.
Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.

arrgh 22 Posting Whiz

Always jump to the end 1st ;)

arrgh 22 Posting Whiz

Is there a way to check my local server logs?

No, you almost certainly can't check the host's logs. But if it happens locally too, you can check your own logs, sure. On the default install there are logs in 2 places {cfinstall}\logs and {cfinstall}\runtime\logs. {cfinstall} being something like c:\coldfusion8\

Totally unrelated, but this forums styles for "quotes" are hard to read, not to mention distinguish from the rest of the response. Whatever happened to indenting people?? ;)

arrgh 22 Posting Whiz

I haven't a clue about that one. It could be a driver issue. There was one a while back with NPE's and mySQL. But this is probably something different. Only thing I can think of is to check the server logs. Maybe they show moredetails.

arrgh 22 Posting Whiz

You can use most any tag you want within a query. The only thing that's important is the variables used are valid and the end result is valid sql.

, oldPage=<cfif IsDefined("FORM.oldPage") AND #FORM.oldPage# NEQ "">
<cfqueryparam value="#FORM.oldPage#" cfsqltype="cf_sql_clob" maxlength="255">
<cfelse>
''
</cfif>
[/quote]

Most of the generated DW code is garbage and the logic is pretty pointless. Fields like text boxes always exist. So the IsDefined("FORM.textBoxName") statements are useless for those types of form fields because they're always defined. You only need isDefined() is for fields that may not always exist. Like checkboxes, radio buttons or multiple select lists. But you can also use <cfparam ..> to define default values. That keeps the code cleaner IMO.

<cfif #FORM.oldPage# NEQ "">
<cfqueryparam value="#FORM.oldPage#" cfsqltype="cf_sql_clob" maxlength="255">
<cfelse>
''
</cfif>

Now even if you eliminate the unnecessary IsDefined()'s, what you're left with still doesn't make much sense. It's equivalent to saying if the value is not an empty string, use the value. Otherwise, still use the value. See what I mean? Just say it directly, without all the extra pound # signs, and using the correct data type. There's no reason to use CLOB for varchar fields.

, oldPage= <cfqueryparam value="#FORM.oldPage#" cfsqltype="cf_sql_varchar" maxlength="255">

The one place CFIF does make sense is if you need to insert NULL for some reason. Alternatively, you could use the "null" attribute instead

, brandID= <cfqueryparam value="#FORM.brandID#" cfsqltype="cf_sql_numeric"
      null="#not isNumeric(FORM.brandID)#">
arrgh 22 Posting Whiz

No problem. Happens to all of us. Though it's a good reason to get rid of that DW code. If it weren't for all those IsDefined() statements, it would've thrown the right error ;) ie Form field not defined.

arrgh 22 Posting Whiz

I have CF debugging enabled. Is ther a different debugger for MySQL??

No, it should show at the bottom of the page by default unless you've a) disabled debugging on that page b) have restricted the output by IP OR c) you're redirecting the debug output it elsewhere. Try the "result" attribute. Any difference?

arrgh 22 Posting Whiz

Sorry I didn't see your "I didnt see any generated sql" comment. My bad. But as I mentioned, you have to enable debugging in the CF Administrator. OR try adding the result attribute to the cfquery. I think it will include the sql too...

<cfquery name="theResult" ...>
INSERT INTO ... blah blah
</cfquery>

<cfdump var="#theResult#">

arrgh 22 Posting Whiz

Did you see my comments about enabling debugging and looking at the generated sql? There's no point guessing what's going on when you can see what SQL CF is generating and sending to your db ;) So enable debugging and look at the sql statements at the bottom of the page.

What value is used for that field?

arrgh 22 Posting Whiz

Well data can't just disappear ;) So either

A) You're looking at a cached page instead of the latest data OR
B) The value never being updated at all OR
C) something is overwriting it

When you have a problem like this the first thing to do is confirm the data is actually being updated. Enable debugging in the CF Admin. Temporarily remove the <cflocation url="bulbView.cfm">. Then test your UPDATE and look at the generated sql. What's the UPDATED value for that field?


On a side note, do yourself a favor and don't use Dreamweaver generated code. Honestly it's poor code and is hard to read and debug.

arrgh 22 Posting Whiz

You could track the previous value yourself using a variable. Simply initialize it before your query loop starts. Inside the loop perform your comparison. Then update the variable with the current value the end of each loop.

<cfset previousWorkshop = "">
<cfoutput query="yourQuery">
   <cfif (some comparison with previousWorkshop here ...)>
       ... do stuff ...
   </cfif>

  <cfset previousWorkshop = currentWorkShop>
</cfoutput>

Alternately, you can access any valid query row using array notation #queryname["columnname"][ rownumber]#

arrgh 22 Posting Whiz

The problem is the "filter". Using *.* will filter out most directories because they don't have a "." in the name. Remove the filter and cfdirectory will return everything (files and subdirectories).

arrgh 22 Posting Whiz

Found one article suggesting you return objects instead. I haven't tried it. Let us know if it works.
http://coldfusion.sys-con.com/node/47199

arrgh 22 Posting Whiz

From the little I've read there are some compatibility issues w/.net and soap. I haven't seen any success stories. Just suggestions to use xml instead.
http://stackoverflow.com/questions/1132536/consuming-apachesoapmap-complex-datatype-in-webservice-using-net

arrgh 22 Posting Whiz

By default cfdirectory lists both files and subdirectories. If you're only seeing files it suggests you're using a filter or some combination of attributes that excludes them. Please post your code.

http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7f99.html

arrgh 22 Posting Whiz

... a pdf in cfm page.
It needs to run the standard program (acrobat reader ,...) and then, open my PDF file

Just to be clear, you can't control what happens on the user's computer from the CF server. What you *can* do is serve the pdf in such a way that it will most likely be opened by Acrobat. However, for that to happen, the user must have Acrobat installed on _their_ computer. Most people do have it installed - but again, that's not something you can control.

Anyway, if you already have an _existing_ pdf, use <cfcontent> with the correct mime type to serve the pdf to the user's browser.

<cfcontent type="application/pdf" file="c:\pathTo\yourFile.pdf">

If you prefer, you can use <cfheader> (first) to tell the browser whether the pdf should be treated as an "attachment" or displayed "inline" ie witin the browser window.

<cfheader name="content-disposition" value="attachment; filename="desiredFileName.pdf"/>
<cfcontent type="application/pdf" file="c:\pathTo\yourFile.pdf">

You can read more about both tags in the online documentation
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_c_11.html

arrgh 22 Posting Whiz

Good Luck

-----------
Cast not pearls before swine

arrgh 22 Posting Whiz

<cfqueryparam value="#form.selDate#" cfsqltype="cf_sql_timestamp">

In case it wasn't obvious, that was just to demonstrate the relation between your columns/fields and the example. In the real code you'd need use LSParseDateTime() on the form fields first.

arrgh 22 Posting Whiz

First, those dates aren't going to work the way you're thinking. The regular CF date functions use U.S. date formatting rules ie mm/dd/yyyy. It will be able to figure out some values like 27/05/2010. But when you say "07/05/2010", you're going to get July 5th, not May 7th.

If your CF instance is using a locale where dd/mm/yyyy is the standard (like in the UK, etc..) then use LSParseDateTime() on your date string first. LSParseDateTime will parse FORM.SelDate into a date _object_ using your locale's rules. (Obviously, nothing will change if your machine is using the English (US) locale.)

<cfset parsedDate = LSParseDateTime(FORM.SelDate)>

If you're not sure what locale you're running, check:

<cfdump var="#getLocale()#">
<cfset #CalDate# = #DateFormat( DateAdd( 'd', #FORM.SelDays#, #FORM.SelDate# ), 'dd/mm/yyyy' )#>

Don't use DateFormat(). It's for display purposes only because it returns a string, not a date object like LSParseDateTime(), dateAdd(), etc... When you use strings, unexpected things can happen (like getting July 5th instead of May 7th). So always use date objects unless you're displaying output.

As far as the query from the link, just convert the example to fit the columns in your form and table. So the subquery would find all rooms that _are_ reserved between your two dates: FORM.SelDate and CalDate.

Totally untested, but something like

<!--- Legend

       SD = startdate, ED = enddate    (BookingDateIN and BookingDateOut)
       FS = filter startdate, FE = filter enddate (FORM.SelDate and CalDate)

       where FE >= SD and FS <= ED
      ---> 

       ie .... …
arrgh 22 Posting Whiz

I need to show all the rooms that are NOT booked between two dates entered.

I would approach it another way- with a subquery.

The query in the link I posted earlier would give you the _reserved_ rooms. Obviously that's the opposite of what you want. But if you use it as subquery, and add in a NOT EXISTS clause, it should return the results you want: ie Rooms that are not reserved

--- get unique rooms
SELECT r.RoomName, etc...
FROM YourRoomTable r
--- that are NOT in the set of RESERVED rooms
WHERE NOT EXISTS (
... select query from the other thread ....
)

arrgh 22 Posting Whiz

Application then lists all the rooms. Room status will be shown beside room, either availiable or occupied.
The application will run a query for each room using the current date to find out what rooms are booked.

Instead of doing most of the logic in CF, you would be better off using SQL. Run a query against your "reservations" table to find out which rooms are available during the desired date periods. But that's all db logic:

http://forums.devshed.com/ms-sql-development-95/filtering-on-startdate-and-enddate-question-277324.html

You're going to have to know some SQL, in addition to CF. It's not hard. But if your course doesn't cover SQL, definitely start with a tutorial like this one first:
http://www.w3schools.com/sql/default.asp

The db structure you described so far is not bad. You'll have to build on it for pricing, etc. But the basics are right

TABLE: Rooms (Unique rooms)
TABLE: Reservations (RoomID, StartDate, EndDate)

Example:

<cfset #myNumber# = 3>
<cfset #first# = 1>
<cfset #last# = 7>

<cfif #myNumber# GTE #first# AND #myNumber# LTE #last#>
Your number is between the range
...
</cfif>

Get rid of all the extra pound signs in those lines. You don't need them, and the code looks more professional without them.

ie Use <cfset myNumber = 3>
Instead of #myNumber# = 3>

arrgh 22 Posting Whiz

(What you describe would be bad in a real application) But it sounds like you have already mapped out an algorithm. So how about showing some good faith effort first.

What code have you tried, what problems are you having, etc...?

aww can be bothered... just gawna show

Just a bit of advice, your .. erm... initiative, grammar, and lack of any code whatsoever - are not exactly motivating us to want to help here .. ;-)

arrgh 22 Posting Whiz

I am not sure what you're asking here. Are you asking how to perform some validation on the client side (javascript), how to save the information to a database, or something else?

arrgh 22 Posting Whiz

I keep getting redirected to the FailedLogin.cfm script.

<cfif IsDefined(HTMLEditFormat("FORM.j_username"))>

      <cfif MM_rsUser.RecordCount NEQ 0>
           .....
     <cfelse>
         .....
     </cfif>

      [B]<cflocation url="#MM_redirectLoginFailed#" addtoken="no">[/B]

<cfelse>
.... 
</cfif>

Well ...look at your code. That is exactly what you're telling CF to do ... always redirect to login failed.

Did you actually test this code? Because it doesn't look right ...

arrgh 22 Posting Whiz

Take a look at the documentation for cfquery and cfoutput. The examples are very easy to understand:
http://livedocs.adobe.com/coldfusion/8/htmldocs/Tags_m-o_16.html

arrgh 22 Posting Whiz
arrgh 22 Posting Whiz

You would have to test it out, but it seems like you need to track 3 things:

1) the number of consecutive bad logins
2) the date and time of the last bad login
3) a boolean flag indicating whether the user is permanently locked out

When a user attempts to log in, you could retrieve those three fields for supplied user name:

1. If the user does not exist, display an error and abort.
2. Next, check if they are permanently logged out. If yes, display an error and abort
3. Check the current time against the date of temporary lockout. If the date is not null and within 20 minutes, display an error and abort.

If they pass those checks, verify their login information:

1. if the passwrd is valid, reset the bad login information
a) reset bad login count = 0
b) reset last bad login date = NULL

2. Otherwise, update the bad login information
a) increment the bad login count
b) if new login count is = 4, display a message that the next attempt will lock them out for for 20 minutes. Suggest they use your application's "Forgot your password" option.
c) if new login count is = 5, update the temporary lockout date and time.
Display a message that they are locked out for 20 minutes.
c) if the login count >= 10, set the permanent lockout flag to true

HTH

arrgh 22 Posting Whiz

It is rare that there is not a better error message. The only thing that comes close, in my experience is a plain "500" error. But again, that is unusual.

- Did you enable debugging in the ColdFusion Administrator?
- What does is the error in the stack trace?
- Check the log files, what is the error message there?

arrgh 22 Posting Whiz

what happen is after the execution half of the data transfer successfully but during the process i face this problem
Error Occurred While Processing Request
50

That is just the error header. What is the rest of the error message?

arrgh 22 Posting Whiz

I doubt cfimage can generate image maps. But if you know the coordinates when the images are rendered, just save them in variables (array, structure, etc..). Then use those values to generate the image map coordinates.