Friday, November 20, 2009

Back to processing ^^

I spoke with Andor and he showed me why it's in my best interest to save doing 3d functions for 0.3.
After going over the Mozilla Wiki Tasklist, I started freaking out

"OMG all the easy functions to work on are gone... Noooo!!" *mashing face on keyboard*

Then I got a bit positive and seen functions like:
saveBytes()
saveStrings()
loadBytes()
loadStrings()

None of the above functions were implemented into processing except loadStrings().
I looked in processing.js and found that loadStrings() was somewhat started because it accepted a URL, but it didn't have the JUICY part which is loading strings from a file.
       As most of you processing peeps know, you can't read/write to a file with JavaScript alone. So me being the brilliant computer science student I am, I started scheming,  trying to find a diabolically clever way to get around this (I don't know why my brain has to go against the grain. It screws me over in a lot of things.)

*I'm guessing this is about the point visitors lose interest  //posting picture*

*so are you refocused ;)  *

I started looking into PHP. I figured I can make javascript redirect to a .php page using the post method. Then in that post request I can stuff in a whole whack of data that I can then make .php store to a file.
To get the info back, I would repeat the process having the .php file send me the strings back using post.

I was so happy, I thought I had all the angles covered so I went to go speak to Dave  <- click it once

(thats when Chris Tyler helped me connect to the Mac. Thanks so much.)

I told em my idea all excited, thinking he would be like *wow... ya thats amazing, can't wait to see it.*
2.7 seconds later, Dave says "No no no, forget the php."






(he's not actually that mean)
Instead look into something called localStorage that is new in html5. Dave also directed me to another link and with that, I was off like a kid with A.D.D. in a Toy's-R-Us.
After randomly skimming pages with superfluous explanations, or so many dead ends, I stumbled on this amazing page.

*keep you engaged  Picture 2*















Now I started working on the saveStrings() and loadStrings() and I know I'm going to have to add a deleteString()
// to remove all/any of the items  accumulated into localStorage.removeItem('what ever');


I hope F1Lt3r doesn't hate the idea of using localStorage :(

No comments:

Post a Comment