Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Caching variables as variables
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

ILLHILL
Junior Member

Netherlands
341 Posts

Posted - 14 May 2007 :  17:09:29  Show Profile
I hope I will be able to explain what I want to reach, if not then
please don't hesitate to ask.

I have a well-working cache script which allows me to write .txt files to my server, which the script either reads, or overwrites when the caching time is up.

I have fiddled around with the script and am able to write .asp files.

Now here comes the tricky part, in order to prevent as much database-connectivity as possible (I prefer none, if possible) I want to write variables as variables to the cache.

I have been able to write the following to the asp file:
<%

String = blablablablabla

%>


However, the reading part of the script displays this into
the main page as static text:
<% String = blablablablabla %>

It displays it as static text, instead of including
it as data from an external .asp file.
(meaning the visitor will literally see "String = blablablabla" instead of asp using this as a variable and hiding it)

Does anybody have any experience with this?

And - I guess not, but maybe - is it possible to have include files
included dynamically? Cause if so then I could do somthing like:

include = "cache_"
include = include & "" & id & ""
include = include & ".asp"

%>
<!--#include file="" & include & "" -->
<%


(I have tried but it doesn't work, but maybe someone found an alternative).

***Update***
I have also corrected the way the asp file was written (it was written as an unicode file and now as ASCII, which doesn't solve my problem yet, but will help along the way.)

Link to the cached asp file:
http://www.illhill.com/clppr/hjkg7889ghagjhsa/rh_1308.asp
(which shows that it indeed hides the asp data in there)


Greets & thanks,

Dominic

Edited by - ILLHILL on 14 May 2007 17:49:44

pdrg
Support Moderator

United Kingdom
2897 Posts

Posted - 14 May 2007 :  19:37:34  Show Profile  Send pdrg a Yahoo! Message
I think you may find this plan tough - the ISAPI filter parses the code out of the asp file before executing it, so by definition it cannot execute code generated dynamically using asp...at least as far as I can remember that's the case. Great idea, you're not the first to want to do this, so good luck, but I have doubts about it - sorry :(
Go to Top of Page

ILLHILL
Junior Member

Netherlands
341 Posts

Posted - 14 May 2007 :  19:45:24  Show Profile
Thanks, pdrg, I did a search on google and found that dynamic includes are sort of the holy grail of .asp, everybody wants it, but nobody succeeds.

However, I DO have a plan b)

I am able to write the cache as an xml file.
Then parse html from this file.
I noticed that the tags you add to the xml can be used as variables as I have done in the past
(if title = blablabla then blablablabla etc.)

The thing that made it plan B) was that I have no idea how much it takes from the server to parse
xml into html if it's done by hundreds of visitors at around the same time.
(It would be nonsense to get rid of all database connections but get something back that would eat up as much processor power from the server)

Anybody has any idea what the impact is of parsing xml into html for the server?

Greets & thanks,

Dominic

CLPPR.com - All The News Only Seconds Away
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 14 May 2007 :  20:59:13  Show Profile
Look into using server.execute or server.transfer as an alternative, these methods are available on any IIS version later than NT4.

======
Doug G
======
Computer history and help at www.dougscode.com
Go to Top of Page

AnonJr
Moderator

United States
5768 Posts

Posted - 14 May 2007 :  22:01:36  Show Profile  Visit AnonJr's Homepage
Honestly, I think you're taking this database connection minimization just a little too far - but that's another topic.

Everything I've read suggests that you aren't going to be able to do the dynamic include (esp. like what you posted above) because the <!-- #include --> is processed by the server before the ASP code. As Doug suggested, you can get close to what you want with Server.Execute and/or Server.Transfer

As to your other bit, you may want to look at a Eval (or maybe it was something else, I read it here a long time back). I seem to remember a discussion about something similar taking place quite a while back. As a matter of fact, I think you were the one to bring it up... but its the end of the day and I'm tired and my brain's a little fuzzy, so I could be mistaken.
Go to Top of Page

ILLHILL
Junior Member

Netherlands
341 Posts

Posted - 15 May 2007 :  04:19:11  Show Profile
The caching will guarantee faster loading times for the CMS, so I don't see nothing wrong with it :)
Somebody has to take it to far for others to find a solution that fits them (and may be less extreme :)

I have looked into the server.execute (without any luck) but not yet in server.transfer, so I will
do that today.

I might stick to plan B: writing the cache into xml, then use things like <title> <link> etc. as the variables.
Only remaining question for that is whether or not the writing and then parsing uses less server resources than a direct database connection.

Greets & thanks,

Dominic

CLPPR.com - All The News Only Seconds Away
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20595 Posts

Posted - 15 May 2007 :  04:46:32  Show Profile  Visit HuwR's Homepage
quote:
Only remaining question for that is whether or not the writing and then parsing uses less server resources than a direct database connection.
unlikely, grabbing data from a database uses very little web server resources and if an efficient db very little db resources either whereas string parsing using asp is probably the most resource intensive thing you could do with asp
Go to Top of Page

ILLHILL
Junior Member

Netherlands
341 Posts

Posted - 15 May 2007 :  06:11:03  Show Profile
Nevermind, I checked the parsing script and it's client side (and been like that all the time) and never had any complaints while using it in other apps (and I have a lot of non-technical users) so
I might go with that, but will still look into an alternative to load the variables from the cache.

If I find another solution I will post it here in case others are interested.

Greets & thanks for all the feedback,

Dominic

CLPPR.com - All The News Only Seconds Away
Go to Top of Page

AnonJr
Moderator

United States
5768 Posts

Posted - 15 May 2007 :  06:18:59  Show Profile  Visit AnonJr's Homepage
Assuming that you set your indexes right, and your data structures are well planned, etc. databases will always be faster than XML and/or string parsing. Its not that those things don't make sense in certain contexts, but here your DB is just a much more efficient system for finding and delivering the information.

As for Server.Execute - what is it that isn't working for you?
Go to Top of Page

ILLHILL
Junior Member

Netherlands
341 Posts

Posted - 15 May 2007 :  07:08:06  Show Profile
The cached asp files have dynamic names (named after the id) which hold the variables.
I have not found any way for server.execute or includes to plug in the cache pages dynamically.

But I will look into it again cause I might have missed something.

thanks!

D

CLPPR.com - All The News Only Seconds Away
Go to Top of Page

pdrg
Support Moderator

United Kingdom
2897 Posts

Posted - 15 May 2007 :  07:34:50  Show Profile  Send pdrg a Yahoo! Message
Parsing XML into HTML - XSLT is, I think, the technology you're after - it scares me a bit, but it is quite efficient using the MSXML engine for the transformation. No idea if that helps!

My own feeling is that you're overestimating the cost of the dbengine, and effectively writing your own using the filesystem. It's a cool, fun project, but I have a hunch you won't beat well-written db-accessing code for speed/cycles as MS, Oracle, Fox, Sybase, MySQL, Ingres, Borland, Postgres etc have sunk huge resources into optimisations...however I'll be fascinated to see your results if you do!

P
Go to Top of Page

ILLHILL
Junior Member

Netherlands
341 Posts

Posted - 15 May 2007 :  08:34:35  Show Profile
I agree that it is a very interesting project, no matter if it works out or not.
The XML part should not be an issue, I have experience with that and the right scripts
(most of them ready and modified for my needs). The Server.Execute AnonJr suggested seems
to make some progress, which could save me the hassle for the xml to html parsing.
(funny enough, would I have taken that approach I would have been already done, but
up till now this has been quite interesting and I have come across some new things
I might use in the future).

As far as XML into HTML parsing, I am about to post a beta version of something I'm working
on in the off-topic forum here, so try it out :)

Greets & thanks, D

CLPPR.com - All The News Only Seconds Away
Go to Top of Page

pdrg
Support Moderator

United Kingdom
2897 Posts

Posted - 15 May 2007 :  12:40:19  Show Profile  Send pdrg a Yahoo! Message
Cool - hope you find a way through!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.3 seconds. Powered By: Snitz Forums 2000 Version 3.4.07