Can anyone help me understand how to turn a process into a function or make make into a variable. I'm not sure I'm using the the right words. I have the following xml sketch which uses twitter's search feature to pull tweets. Currently, you can only use one search term. I would like to replicate code some how in order to search different terms simultaneously and draw them in different colors. I've mess around with a code for a while but haven't had much success. Would greatly appreciate any tips.
Thanks,
Bo
Code:
// Display a twitter feed in scrolly text, along with a bar that shows how many tweets we've seen
PFont font_zigg; int newmills; int oldmills; int j = 0; int textpos = 25;
String str_tweets[]; XML xml;
void setup(){
xml = loadXML("http://search.twitter.com/search.atom?q=life"); // life
// xml = loadXML("http://search.twitter.com/search.atom?q=life"); // death
XML tweets[] = xml.getChildren("entry/title"); XML users[] = xml.getChildren("entry/author/name");
/// Now lets convert this to a String array, so we can work with the results as strings.
str_tweets = new String[tweets.length]; for(int i = 0; i < tweets.length; i++){ str_tweets[i] = users[i].getContent() + ": " + tweets[i].getContent(); }
// Initialize the time we started running. oldmills = millis(); // don't initialize where you declare it. millis() gives a strange answer there.
println("tweet " + j + " should be " + str_tweets[j]); // just for debugging.
}
void draw(){
// Draw tweet contents
if (j < str_tweets.length) {
// newmills represents the current time, which we can check against the last time check. newmills = millis();
// this creates a delay in betweeen displaying each tweet (in milliseconds). if (newmills > oldmills + 4000) {
textpos = 25; oldmills = newmills; j++;
if (j < str_tweets.length) { // stop it from crashing on the last increment
println("tweet " + j + " should be " + str_tweets[j]); // just for debugging. }
} // end if newmills..
else {
// scroll the text to the left background(0); fill(255, 255, 0); rect(25, 20, (j+1) * 10, 20); textpos = textpos - 1; text(str_tweets[j], textpos, 70);
I'm trying to embed my processing sketch applet into my Wordpress site using the Java Applet Embed plugin. To use the plugin I need to provide it with the following information:
your.applet.ClassName
I used Processing 1.5 and used the export feature to create the applet. I don't anything java or applets.
Can somebody point me in the right direction. I've been trying to research this for a little too long now.
Am I just missing something basic here? When I export my sketch no HTML file is generated. I get get 6 folders generated but there is no HTML file to be found.