how can I input data from a database into a sketch?
in
Programming Questions
•
2 years ago
Hello all,
I am putting together a website (using html, php, mySQL, javascript, jquery, and using the joomla system) and have been having trouble figuring out how to input data which is accessed from the website database for use in an applet which was built as a sketch in Processing and exported as an applet. I am a bit of a programming noob, but have managed to figure out this much:
- create a working sketch using the processing application (I'm making basically a replica of the facebook app Social Graph -- this part is working pretty well actually :) )
- export the sketch as an applet which runs successfully in my browser by opening index.html in the folder "applet"
- move the folder "applet" and its contents (including index.html) to a directory in my website
- display the applet on my website (currently hosted locally on my MacBook Pro) (I just call index.html)
Also, I do know how to access data from the database and use it for other purposes. Easy once you know how to do it, a pain in the ass to figure out the first time! ;)
What I have not figured out is how to pass data to my applet. Right not, I have a file data.txt which contains the relevant data (a list of users and a list of who is friends with whom), and when I run the sketch in Processing, the file is read successfully. So my first plan was to write some php or html code to modify the .txt file before the applet gets called by my website. However, I have found that once I've exported the applet, any changes I make to the .txt file (in the folder: data) are not reflected when I call the applet. So apparently, data.txt is accessed when I run the sketch in Processing, but the file is no longer needed once the sketch is exported as an applet.
I am sure there is a veeeerrrry simple way to do this, I just don't know it. Suggestions?
I am putting together a website (using html, php, mySQL, javascript, jquery, and using the joomla system) and have been having trouble figuring out how to input data which is accessed from the website database for use in an applet which was built as a sketch in Processing and exported as an applet. I am a bit of a programming noob, but have managed to figure out this much:
- create a working sketch using the processing application (I'm making basically a replica of the facebook app Social Graph -- this part is working pretty well actually :) )
- export the sketch as an applet which runs successfully in my browser by opening index.html in the folder "applet"
- move the folder "applet" and its contents (including index.html) to a directory in my website
- display the applet on my website (currently hosted locally on my MacBook Pro) (I just call index.html)
Also, I do know how to access data from the database and use it for other purposes. Easy once you know how to do it, a pain in the ass to figure out the first time! ;)
What I have not figured out is how to pass data to my applet. Right not, I have a file data.txt which contains the relevant data (a list of users and a list of who is friends with whom), and when I run the sketch in Processing, the file is read successfully. So my first plan was to write some php or html code to modify the .txt file before the applet gets called by my website. However, I have found that once I've exported the applet, any changes I make to the .txt file (in the folder: data) are not reflected when I call the applet. So apparently, data.txt is accessed when I run the sketch in Processing, but the file is no longer needed once the sketch is exported as an applet.
I am sure there is a veeeerrrry simple way to do this, I just don't know it. Suggestions?
2