Getting the date next (Saturday)
I have a schedule function, where i need to display the date and time of hte next occurance of an event, that is scheduled every dayofweek at time for example, one event is every Saturday (day='7') at midnight. Another event is every Sunday (day=1') at 9pm. How can i calculate the date of the next occurrence of these events so I can display it as : coming up at time on date? -- Cheers Mike Kear Windsor, NSW, Australia Adobe Certified Advanced ColdFusion Developer AFP Webworks http://afpwebworks.com ColdFusion Enterprise, PHP, ASP, ASP.NET hosting from AUD$15/month ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357559 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Getting the date next (Saturday)
This should to the trick: http://cflib.org/udf/NextOccOfDOW On Sun, Feb 2, 2014 at 8:10 PM, Mike K afpwebwo...@gmail.com wrote: I have a schedule function, where i need to display the date and time of hte next occurance of an event, that is scheduled every dayofweek at time for example, one event is every Saturday (day='7') at midnight. Another event is every Sunday (day=1') at 9pm. How can i calculate the date of the next occurrence of these events so I can display it as : coming up at time on date? -- Cheers Mike Kear Windsor, NSW, Australia Adobe Certified Advanced ColdFusion Developer AFP Webworks http://afpwebworks.com ColdFusion Enterprise, PHP, ASP, ASP.NET hosting from AUD$15/month ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357560 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
cflocation mystery
Hi Folks I have a basic .html site that I have converted to a coldfusion site. since there are many old .html links out there I added the following to my notFound.cfm file: cfif notFoundUrl contains .html cfset newUrl=http://www.mydomain.com; replace(notFoundUrl,.html,.cfm) cfif fileExists(newUrl) is yes cflocation url=#newUrl# cfelse cflocation url=http://www.mydomain.com; /cfif /cfif Works fine if the file exists but throws an error if the file doesn't exist rather than redirecting. Also which log file would have the error in it as I can't find the error in any of the logs What am I missing? Thanks Rob ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357561 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: cflocation mystery
It's no mystery, that's the correct response. Trap the 404 error for html files at the web server and handle the cf side through either site wide or per application error handling. On Feb 2, 2014 11:42 AM, Rob Voyle robvo...@voyle.com wrote: Hi Folks I have a basic .html site that I have converted to a coldfusion site. since there are many old .html links out there I added the following to my notFound.cfm file: cfif notFoundUrl contains .html cfset newUrl=http://www.mydomain.com; replace(notFoundUrl,.html,.cfm) cfif fileExists(newUrl) is yes cflocation url=#newUrl# cfelse cflocation url=http://www.mydomain.com; /cfif /cfif Works fine if the file exists but throws an error if the file doesn't exist rather than redirecting. Also which log file would have the error in it as I can't find the error in any of the logs What am I missing? Thanks Rob ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357562 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: cflocation mystery
And that's not what you're asking at all On Feb 2, 2014 11:42 AM, Rob Voyle robvo...@voyle.com wrote: Hi Folks I have a basic .html site that I have converted to a coldfusion site. since there are many old .html links out there I added the following to my notFound.cfm file: cfif notFoundUrl contains .html cfset newUrl=http://www.mydomain.com; replace(notFoundUrl,.html,.cfm) cfif fileExists(newUrl) is yes cflocation url=#newUrl# cfelse cflocation url=http://www.mydomain.com; /cfif /cfif Works fine if the file exists but throws an error if the file doesn't exist rather than redirecting. Also which log file would have the error in it as I can't find the error in any of the logs What am I missing? Thanks Rob ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357563 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: cflocation mystery
What's the error message? On Feb 2, 2014 11:42 AM, Rob Voyle robvo...@voyle.com wrote: Hi Folks I have a basic .html site that I have converted to a coldfusion site. since there are many old .html links out there I added the following to my notFound.cfm file: cfif notFoundUrl contains .html cfset newUrl=http://www.mydomain.com; replace(notFoundUrl,.html,.cfm) cfif fileExists(newUrl) is yes cflocation url=#newUrl# cfelse cflocation url=http://www.mydomain.com; /cfif /cfif Works fine if the file exists but throws an error if the file doesn't exist rather than redirecting. Also which log file would have the error in it as I can't find the error in any of the logs What am I missing? Thanks Rob ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357564 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: cflocation mystery
Hi Timothy Instead of redirecting to: mydomain.com cflocation url=http://www.mydomain.com; It is throwing an error rather than redirecting. How do I redirect? Rob On 2 Feb 2014 at 11:56, Timothy Heald wrote: It's no mystery, that's the correct response. Trap the 404 error for html files at the web server and handle the cf side through either site wide or per application error handling. On Feb 2, 2014 11:42 AM, Rob Voyle robvo...@voyle.com wrote: cfif notFoundUrl contains .html cfset newUrl=http://www.mydomain.com; replace(notFoundUrl,.html,.cfm) cfif fileExists(newUrl) is yes cflocation url=#newUrl# cfelse cflocation url=http://www.mydomain.com; /cfif /cfif ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357565 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: cflocation mystery
What's the error? On Feb 2, 2014 12:09 PM, Rob Voyle robvo...@voyle.com wrote: Hi Timothy Instead of redirecting to: mydomain.com cflocation url=http://www.mydomain.com; It is throwing an error rather than redirecting. How do I redirect? Rob On 2 Feb 2014 at 11:56, Timothy Heald wrote: It's no mystery, that's the correct response. Trap the 404 error for html files at the web server and handle the cf side through either site wide or per application error handling. On Feb 2, 2014 11:42 AM, Rob Voyle robvo...@voyle.com wrote: cfif notFoundUrl contains .html cfset newUrl=http://www.mydomain.com; replace(notFoundUrl,.html,.cfm) cfif fileExists(newUrl) is yes cflocation url=#newUrl# cfelse cflocation url=http://www.mydomain.com; /cfif /cfif ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357566 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: cflocation mystery
you firstly are trying to use fileExists on a URL, so it will always fail, fileExists requires an absolute path on the server see here: https://learn.adobe.com/wiki/display/coldfusionen/fileexists secondly an html page will never reach coldfusion, because it is an html page, so cfml code will never run. You need to setup a 404 handler on the web server or use URL rewriting. On Sun, Feb 2, 2014 at 4:41 PM, Rob Voyle robvo...@voyle.com wrote: Hi Folks I have a basic .html site that I have converted to a coldfusion site. since there are many old .html links out there I added the following to my notFound.cfm file: cfif notFoundUrl contains .html cfset newUrl=http://www.mydomain.com; replace(notFoundUrl,.html,.cfm) cfif fileExists(newUrl) is yes cflocation url=#newUrl# cfelse cflocation url=http://www.mydomain.com; /cfif /cfif Works fine if the file exists but throws an error if the file doesn't exist rather than redirecting. Also which log file would have the error in it as I can't find the error in any of the logs What am I missing? Thanks Rob ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357567 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: cflocation mystery
Add the file. Like index.cfm our what ever On Feb 2, 2014 12:09 PM, Rob Voyle robvo...@voyle.com wrote: Hi Timothy Instead of redirecting to: mydomain.com cflocation url=http://www.mydomain.com; It is throwing an error rather than redirecting. How do I redirect? Rob On 2 Feb 2014 at 11:56, Timothy Heald wrote: It's no mystery, that's the correct response. Trap the 404 error for html files at the web server and handle the cf side through either site wide or per application error handling. On Feb 2, 2014 11:42 AM, Rob Voyle robvo...@voyle.com wrote: cfif notFoundUrl contains .html cfset newUrl=http://www.mydomain.com; replace(notFoundUrl,.html,.cfm) cfif fileExists(newUrl) is yes cflocation url=#newUrl# cfelse cflocation url=http://www.mydomain.com; /cfif /cfif ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357568 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: cflocation mystery
Hi Timothy Which log would the error be in. I can't find the error in any of the logs. The site is public and only displays a generic error template rather than the specific error. Rob On 2 Feb 2014 at 11:58, Timothy Heald wrote: What's the error message? On Feb 2, 2014 11:42 AM, Rob Voyle robvo...@voyle.com wrote: ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357569 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: cflocation mystery
We don't know what's on the variable, and it's working through the first half of the condition it sounds like. Can you cflocate to the tld or do you require a filename? On Feb 2, 2014 12:12 PM, Russ Michaels r...@michaels.me.uk wrote: you firstly are trying to use fileExists on a URL, so it will always fail, fileExists requires an absolute path on the server see here: https://learn.adobe.com/wiki/display/coldfusionen/fileexists secondly an html page will never reach coldfusion, because it is an html page, so cfml code will never run. You need to setup a 404 handler on the web server or use URL rewriting. On Sun, Feb 2, 2014 at 4:41 PM, Rob Voyle robvo...@voyle.com wrote: Hi Folks I have a basic .html site that I have converted to a coldfusion site. since there are many old .html links out there I added the following to my notFound.cfm file: cfif notFoundUrl contains .html cfset newUrl=http://www.mydomain.com; replace(notFoundUrl,.html,.cfm) cfif fileExists(newUrl) is yes cflocation url=#newUrl# cfelse cflocation url=http://www.mydomain.com; /cfif /cfif Works fine if the file exists but throws an error if the file doesn't exist rather than redirecting. Also which log file would have the error in it as I can't find the error in any of the logs What am I missing? Thanks Rob ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357570 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: cflocation mystery
What version of cf? On Feb 2, 2014 12:19 PM, Rob Voyle robvo...@voyle.com wrote: Hi Timothy Which log would the error be in. I can't find the error in any of the logs. The site is public and only displays a generic error template rather than the specific error. Rob On 2 Feb 2014 at 11:58, Timothy Heald wrote: What's the error message? On Feb 2, 2014 11:42 AM, Rob Voyle robvo...@voyle.com wrote: ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357571 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: cflocation mystery
fileExists() accepts a filename on the filesystem, not a URL. -Cameron On Sun, Feb 2, 2014 at 11:41 AM, Rob Voyle robvo...@voyle.com wrote: Hi Folks I have a basic .html site that I have converted to a coldfusion site. since there are many old .html links out there I added the following to my notFound.cfm file: cfif notFoundUrl contains .html cfset newUrl=http://www.mydomain.com; replace(notFoundUrl,.html,.cfm) cfif fileExists(newUrl) is yes cflocation url=#newUrl# cfelse cflocation url=http://www.mydomain.com; /cfif /cfif Works fine if the file exists but throws an error if the file doesn't exist rather than redirecting. Also which log file would have the error in it as I can't find the error in any of the logs What am I missing? Thanks Rob ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357572 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: cflocation mystery
Looks like newurl isn't a url, rather a path, it's appended to the domain name. On Feb 2, 2014 12:35 PM, Cameron Childress camer...@gmail.com wrote: fileExists() accepts a filename on the filesystem, not a URL. -Cameron On Sun, Feb 2, 2014 at 11:41 AM, Rob Voyle robvo...@voyle.com wrote: Hi Folks I have a basic .html site that I have converted to a coldfusion site. since there are many old .html links out there I added the following to my notFound.cfm file: cfif notFoundUrl contains .html cfset newUrl=http://www.mydomain.com; replace(notFoundUrl,.html,.cfm) cfif fileExists(newUrl) is yes cflocation url=#newUrl# cfelse cflocation url=http://www.mydomain.com; /cfif /cfif Works fine if the file exists but throws an error if the file doesn't exist rather than redirecting. Also which log file would have the error in it as I can't find the error in any of the logs What am I missing? Thanks Rob ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357573 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: cflocation mystery
Nope, read that wrong. On Feb 2, 2014 12:39 PM, timothy.he...@gmail.com wrote: Looks like newurl isn't a url, rather a path, it's appended to the domain name. On Feb 2, 2014 12:35 PM, Cameron Childress camer...@gmail.com wrote: fileExists() accepts a filename on the filesystem, not a URL. -Cameron On Sun, Feb 2, 2014 at 11:41 AM, Rob Voyle robvo...@voyle.com wrote: Hi Folks I have a basic .html site that I have converted to a coldfusion site. since there are many old .html links out there I added the following to my notFound.cfm file: cfif notFoundUrl contains .html cfset newUrl=http://www.mydomain.com; replace(notFoundUrl,.html,.cfm) cfif fileExists(newUrl) is yes cflocation url=#newUrl# cfelse cflocation url=http://www.mydomain.com; /cfif /cfif Works fine if the file exists but throws an error if the file doesn't exist rather than redirecting. Also which log file would have the error in it as I can't find the error in any of the logs What am I missing? Thanks Rob ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357574 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: cflocation mystery
Exception.log On 2/2/14, 12:18 PM, Rob Voyle robvo...@voyle.com wrote: Hi Timothy Which log would the error be in. I can't find the error in any of the logs. The site is public and only displays a generic error template rather than the specific error. Rob On 2 Feb 2014 at 11:58, Timothy Heald wrote: What's the error message? On Feb 2, 2014 11:42 AM, Rob Voyle robvo...@voyle.com wrote: ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357575 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: cflocation mystery- solved
Thanks guys needed the absolute path in fileExist Rob ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357576 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: cflocation mystery- solved
You should also be retiring a 301 status code to the client. This makes a difference for SEO purposes. In CF7 or before you would need to use the cfheader tag. CF8 and on, you can add the status code attribute to the cflocation tag. Sent from my iPhone On Feb 2, 2014, at 11:51 AM, Rob Voyle robvo...@voyle.com wrote: Thanks guys needed the absolute path in fileExist Rob ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357577 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm