quotes! isDefined("application.slashDot")
Regards, Matthew Walker /* Easier, smarter forms: http://www.matthewwalker.net.nz/inform2 */ > -----Original Message----- > From: Timothy Heald [mailto:[EMAIL PROTECTED]] > Sent: Friday, 14 June 2002 4:04 p.m. > To: CF-Talk > Subject: RE: Slashdot/cfc > > > Ok, > Now this is bothering me. How is it that I have > isDefined wrapped around > each section of this code, but it still is saying that > slashDot is undefined > in application? I am trying to make it first see if the > struct exists, if > it does, see how old it is. If it is older than 30 minutes, > execute the web > service and get the latest feed. See anything glaring in the > code below? > > Tim > > <CFAPPLICATION name="slashDotFeed" clientmanagement="Yes" > sessionmanagement="Yes" setclientcookies="Yes" setdomaincookies="Yes"> > > <CFLOCK scope="APPLICATION" timeout="30"> > > <CFIF not isDefined(application.slashDot)> > > <!--- create the structure since it doesn't > exist right now ---> > <CFSET application.slashDot = structNew()> > > <!--- add the timestamp, but make it over > thirty seconds old so you will > pull the xml ---> > <CFSET application.slashDot.timeStam = > dateAdd("n", -31, now())> > > <CFINCLUDE template="slashDot.cfm">" > > <CFELSE> > > <!--- now check for the xmlObject to be older than 30 > minutes ---> > <CFIF dateDiff("n", now(), > application.slashDot.timestamp) gt 30> > > <!--- invoke the web service to get the xml object ---> > <cfinvoke > webservice="http://webservices.isitedesign.com/ws/slashdotnews > .cfc?wsdl" > method="getXMLNews" > returnvariable="xmlObject" > > > > <!--- parse the xmlObject into the application > scope to be reused for half > an hour ---> > <CFSET application.slashDot.xmlObject = > xmlParse(xmlObject)> > > </CFIF> > > <CFIF isDefined(application.slashDot)> > <CFSET xmlObject = application.slashDot.xmlObject> > </CFIF> > > </CFIF> > > </CFLOCK> > > -----Original Message----- > From: Timothy Heald [mailto:[EMAIL PROTECTED]] > Sent: Thursday, June 13, 2002 10:39 PM > To: CF-Talk > Subject: RE: Slashdot/cfc > > > Yes, > There is a web service to pull titles, links and images > from. You can > access it from: > > http://webservices.isitedesign.com/ws/slashdotnews.cfc?wsdl > > Now it returns an XML object. So I think I would > create structure, in the > application scope. One key would contain the XML object, the > other would > contain a timestamp from the last time you received the xml > feed from the > web service. Something like this in your Application.cfm > should do the > trick I think. Make sure it's below the cfapplication tag or > it won't run. > > <CFLOCK scope="APPLICATION" timeout="30"> > > <CFIF not isDefined(application.slashDot.xmlObject)> > > <!--- create the structure since it doesn't > exist right now ---> > <CFSET application.slashDot = structNew()> > > <!--- add the timestamp, but make it over > thirty seconds old so you will > pull the xml ---> > <CFSET application.slashDot.timeStam = > dateAdd("n", -31, now())> > > </CFIF> > > <!--- now check for the xmlObject to be older than 30 > minutes ---> > <CFIF dateDiff("n", now(), > application.slashDot.timestamp) gt 30> > > <!--- invoke the web service to get the xml object ---> > <cfinvoke > webservice="http://webservices.isitedesign.com/ws/slashdotnews > .cfc?wsdl" > method="getXMLNews" > returnvariable="xmlObject" > > > > <!--- parse the xmlObject into the application > scope to be reused for half > an hour ---> > <CFSET application.slashDot.xmlObject = > xmlParse(xmlObject)> > > </CFIF> > > </CFLOCK> > > Be aware I have not tested this. There may be mistakes (as > you well know > Crit). > > See you tomorrow :) > > Tim > > -----Original Message----- > From: John Paul Ashenfelter [mailto:[EMAIL PROTECTED]] > Sent: Thursday, June 13, 2002 9:41 PM > To: CF-Talk > Subject: Re: Slashdot/cfc > > > I think I missed something... do they have a *web service* > you can interact > with (like th Google Web Service API)? All I see is an XML > (and of course > the RDF) file that you can grab, parse/transform, and format. > That's great, > but its not a CFC (which is no surprise since /. is Perl). > > Doesn't change the question much ("How do I get my headlines > updated") but > wanted to see if there's actually a web service access to /. > I'm missing :) > > Regards, > > John Paul Ashenfelter > CTO/TransitionPoint > [EMAIL PROTECTED] > > ----- Original Message ----- > From: "Critz" <[EMAIL PROTECTED]> > To: "CF-Talk" <[EMAIL PROTECTED]> > Sent: Thursday, June 13, 2002 7:16 PM > Subject: Slashdot/cfc > > > > oi chatters > > > > > > SlashDot has a cfc that you can use, but on their faq they request > > that their xml file be hit only once every 30 minutes. So what would > > be a decent way to go about it? > > > > I was thinking cfhttp'ing the cfc, writing to a file. (if it's not > > there) then checking the date modified on that file, if it's greater > > than 30. grab fresh copy?? then handle parsing from the local file? > > > > any other suggestions? > > > > > > -- > > Best regards, > > > > Critter, MMCP > > Certified ColdFusion Developer > > > > Crit[s2k] - <CF_ChannelOp Network="EFNet" Channel="ColdFusion"> > > > > > > > ______________________________________________________________________ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists