The FileExists() method is want checks if the file exists. All you have to do is modify the @logfile. I made a mistake though... you can not name the file logYYMMDD as that is 9 characters, 8 characters is the MAX. Name the file something like LGYYMMDD.txt.
Understand the logic, i'm trying to modify the code for generate a new log.txt every day, do you have any example code for append the date to file name?? i'm trying but append more than 8 characters and not asigned the name... i'll continue trying.
do you have any example code for append the date to file name
All you have to do is fill in 6 characters; YYMMDD. There is an example of writing a date to RAM in HTTPServer. Remember, the file name must follow the 8.3 naming convention.
i do it this and works fine, i can write in the @logfile buffer, but i meant to do it automatically in base to @httpdate, i can do it manually but i think will be great if could be automally in base to the RTC date, understand the idea? I'll continue with my experiments.
i do it this and works fine, i can write in the @logfile buffer, but i meant to do it automatically in base to @httpdate, i can do it manually but i think will be great if could be automally in base to the RTC date, understand the idea? I'll continue with my experiments.
I understand the idea... you have all the code required to dynamically generate a file name with the current date. Look at the Response.spin object. The response object handles browser cache which requires the current date and time.
Today continue with my spinneret and i can generate automatically a TXT file in base to the RTC date, so now every day the software generate a new log.txt with the date reference and the data will not blend, great! but i have a new doubt, be possible indicate how often want save data in the log.txt, in this moment i save the data when i call the method but i would like do it every 1 minute automatically, do you have any idea??
Yes, there is an example in HTTPServer of starting a new process in a COG. Plus there are examples in the Propeller Manual. You'll need to use the system clock (CNT) to figure out when 60 seconds has past.
The Propeller has 8 COGs. This information is openly published in the Propeller manual. I'd initialize the a new COG process in the Initialize method of HTTPServer, right after the StatusMonitor starts.
Ok, understand. i'm learning about the cognew command for do it. one cuestion, in the command cognew(statusmonitor,@stackspace) understand that cognew enable other cog for parallel processing and the statusmonitor is a PRI function in the httpserver code, this funtion check the sockets of the W5100 rigth?, but what is the function of @stackspace??
ok, understand... today learning about the cognew command and now i can execute the appendlog method every 60 seconds using a new cog and works fine...now i'm checking the webpage for control led (i/o 23) and i would like add a gif image for represent the status of led on/off, i check the code and found the line:
in this line change the status with the "placeholder" variable when i click ON "placeholder" take a ON status and when click OFF place holder take a OFF status and print in my web page, is correct?? well, i do it a code for ask for the status of "placeholder" and in base to his status i'll change a gif image, this is the code :
the javascript code works when i stablish manually the status ex: placeholder="on" this is inside of the javascript code but when excute the code for take automatically the status of "placeholder" not work..... but in the line span id change the status to "on" and "off", what do you think? i'm in the correct way for do it or i'm in the wrong way??
The JavaScript is inline and only runs when the page loads. You must set the placeholder variable above the switch statement. The <span id="placeholder"></span> is not in any way connected to the switch.
Comments
Many thanks mike, greetings.
The FileExists() method is want checks if the file exists. All you have to do is modify the @logfile. I made a mistake though... you can not name the file logYYMMDD as that is 9 characters, 8 characters is the MAX. Name the file something like LGYYMMDD.txt.
Understand the logic, i'm trying to modify the code for generate a new log.txt every day, do you have any example code for append the date to file name?? i'm trying but append more than 8 characters and not asigned the name... i'll continue trying.
greetings.
All you have to do is fill in 6 characters; YYMMDD. There is an example of writing a date to RAM in HTTPServer. Remember, the file name must follow the 8.3 naming convention.
i do it this and works fine, i can write in the @logfile buffer, but i meant to do it automatically in base to @httpdate, i can do it manually but i think will be great if could be automally in base to the RTC date, understand the idea? I'll continue with my experiments.
Greetings, mike.
Today continue with my spinneret and i can generate automatically a TXT file in base to the RTC date, so now every day the software generate a new log.txt with the date reference and the data will not blend, great! but i have a new doubt, be possible indicate how often want save data in the log.txt, in this moment i save the data when i call the method but i would like do it every 1 minute automatically, do you have any idea??
thanks mike.
sounds Easy XD... The command for Start a new cog is @cognew rigth? I try to do it.
Do you have any example for do it something similar?
Thanks
Ok, understand. i'm learning about the cognew command for do it. one cuestion, in the command cognew(statusmonitor,@stackspace) understand that cognew enable other cog for parallel processing and the statusmonitor is a PRI function in the httpserver code, this funtion check the sockets of the W5100 rigth?, but what is the function of @stackspace??
greetings...
ok, understand... today learning about the cognew command and now i can execute the appendlog method every 60 seconds using a new cog and works fine...now i'm checking the webpage for control led (i/o 23) and i would like add a gif image for represent the status of led on/off, i check the code and found the line:
<p>status led: <span id="placeholder">
</span></p>
in this line change the status with the "placeholder" variable when i click ON "placeholder" take a ON status and when click OFF place holder take a OFF status and print in my web page, is correct?? well, i do it a code for ask for the status of "placeholder" and in base to his status i'll change a gif image, this is the code :
<p>status led: <span id="placeholder">
</span></p>
<script language="javascript" type="application/javascript">
switch(placeholder)
{
case "on":
document.write("<h2>on</h2>");
document.write('<img src="on.gif"/>');
break
case "off":
document.write("<h2>off</h2>");
document.write('<img src="off.gif"/>');
break
}
</script>
the javascript code works when i stablish manually the status ex: placeholder="on" this is inside of the javascript code but when excute the code for take automatically the status of "placeholder" not work..... but in the line span id change the status to "on" and "off", what do you think? i'm in the correct way for do it or i'm in the wrong way??
thanks for all...
If you are trying to use AJAX, then you must drop the inline document.write method and use document.getElementById. getElementByID allows dynamic updates of the Document Object Model (DOM) without reloading the web page. Examples, can be found in the tutorial.
http://spinneret.servebeer.com:5000/services/ajaxled.htm
http://spinneret.servebeer.com:5000/services/xmltime.htm
HTML/DOM tutorial
http://www.w3schools.com/htmldom/default.asp