We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › start my app from last execution
Page Index Toggle Pages: 1
start my app from last execution? (Read 366 times)
start my app from last execution?
Sep 8th, 2008, 8:10am
 
Hello.
Im writing a web application, essentially is a sketch with a graphic development in time lapses. So users should be able to see something continuing what them saw last time instead of restart each time.

I'm trying to figure out how would I save all the variables of my sketch so that it starts from where it was last time,is that posible?

I couldn't use saveBits cause it don´t allow ints or floats. SaveStrings was discharged because variables are incompatible.

If U have any ideas I'll be very grateful.
Re: start my app from last execution?
Reply #1 - Sep 8th, 2008, 11:50am
 
In a Web application, you don't have much options to save stuff (unless the applet is signed, perhaps), because for security reasons, applets can't access underlying system.

Basically, I see two possibility, perhaps people will point to other ones:
- Let the applet access a PHP (or other server-side language) script which will store the data on the server, supposing the user has given some login credential (to name the data and allow to get it back).
- Let the applet set cookies on the user's computer, and read them back on next run. Advantage: no need of server-side script, local storage (if user allows it).
See, for example, Access Cookies from a Java Applet article on how to do it (never tried myself! use object tag, not deprecated applet one).
Re: start my app from last execution?
Reply #2 - Sep 8th, 2008, 7:29pm
 
Tnx PhiLho.
I wonder, is there any way to save numbers(int, float) to a string.
I guess my trouble seems too simple, but now thats the starting point of the whoole thing. thanks again.
Re: start my app from last execution?
Reply #3 - Sep 9th, 2008, 12:47pm
 
Java way:

int bar = 42;
float foo = 666.99;
String sBar = Integer.toString(bar);
String sFoo = Float.toString(foo);
println(sBar + "/" + sFoo);

Processing way: see str() function or nf() function and friends for a finer control.
Re: start my app from last execution?
Reply #4 - Sep 18th, 2008, 7:06am
 
great. thak you.
Page Index Toggle Pages: 1