Reducing server hits while debugging...

macman104

Member
So...with the use of the visit_url function, in a script that is being made, it may be run multiple times while writing it. However, depending on what url is being called and such, this could cause extra-needless server hits just for the purpose of debugging. How hard would be to implement a load_html("filename.html")? Or is there another option to reduce the unnecessary calls?
 

MagiNinjA

New member
How does this work? I don't exactly get what you want in the first place, mac. Besides less server hits. That's something we all need!
 
when writing scripts that deal directly with html during debugging you have server hits to test the script. What's been done is you are now allowed to save the html and reload it instead of having to get it from the server every time.
 

mmmk

New member
i wrote my own method/function to store html text in a map while my scripts run, with a boolean in case i need a refresh

so i take it you would have to replace all load_html calls with visit_url calls after debugging?
 

macman104

Member
[quote author=mmmk link=topic=1018.msg5557#msg5557 date=1187288795]
i wrote my own method/function to store html text in a map while my scripts run, with a boolean in case i need a refresh

so i take it you would have to replace all load_html calls with visit_url calls after debugging?
[/quote]

You could use a self-made function called call_html(string html), and then have a global variable called DEBUGGING. In the call_html function, you either call visit_url or load_html depending on whether you are debugging or not. This would reduce the need to switch out the html calls.
 

mmmk

New member
oh yea, well this is semi related since that map that i use to store text is used across scripts

Is there any reason why a map defined like that would have values that change in the other imported script?

so for clarity, say main script imports scripts 1, 2, ... 5. And say in 1, i have "int [string] someMap;". Then in main i have "someMap["coffee beans"] = 1;" Is there any reason when I use someMap in the other scripts (2, ..., 5), someMap["coffee beans"]'s value would change or be missing?

I'm not actually sure if this is a problem with my own text thing, since i'll probably switch to the load_html as macman104 suggested ... and i have it reload a url if its not in the map of course ...
 
Top