Showing posts with label daniel shiffman. Show all posts
Showing posts with label daniel shiffman. Show all posts

7.5.09

little win

After a morning of trying to break HTML requests into strings and then into individual words, I have decided to abandon the BBC RSS feed and instead go with yahoo's less regularly updated one. Because the XML of the yahoo RSS feed looks like this:



Instead of the state of the weather being addressed in the description tag, almost each attribute of the weather is addressed in it's own little tag. Which makes it a lot easier to work with! It's what mister shiffman used in his script as well, so there's some documentation of how to use it well.

dirty XML

I've decided to look again at mister shiffmans simpleML library again, which I looked at briefly in my twitter top project, and found that not only am I a complete berk for not spotting the re-request HTML/XML command which I wanted so desperately and caused me annoyance when I couldn't figure it out myself, but that although it will save my program looking through the whole document, and therefore speed it up, it might still be not as useful as I'd like.

here's the BBC RSS feed for Leeds at the moment:



here's the bit that I'm interested in:



(Temperature: 9°C (48°F), Wind Direction: SW, Wind Speed: 40mph, Relative Humidity: 66%, Pressure: 987mB, rising, Visibility: Good)

Unfortunately, all the juicy bit I'm interested in is all in the same XML tag, so I can't use simpleML to all it's useful yummyness.

This causes a little problem with the words I'm using in my script. For example, "sunny" and "sunny intervals" both contain the word "sunny" so my script will see "sunny intervals" as "sunny". If that makes sense. The script I'm using at the moment is based on a script I used in my last project:


//pulling in feed of weather in stornoway

String[] tokens; //array
int counter;

void setup() {
size(100, 100);


//load file and split up words
String[] lines = loadStrings("http://news.bbc.co.uk/weather/forecast/373/ObservationsRSS.rss");
String allText = join(lines, " ");
tokens = splitTokens(allText, " ,.?!:;[]-");

}

//so it's now pulling in that sentence and splitting it up.

void draw() {
background(255);
fill(0);

String s = tokens[counter];
counter = (counter +1) % tokens.length;
//look at the words one at a time please



//is the word there?

if (s.equals("sunny")) {
println("sunny");
noLoop(); //DON'T LOOP IT BAHBEE.

}

if (s.equals("white")) {
println("white cloud");
noLoop(); //DON'T LOOP IT BAHBEE.

}

if (s.equals("grey")) {
println("grey cloud");
noLoop(); //DON'T LOOP IT BAHBEE.

}

if (s.equals("light")) {
println("light rain");
noLoop(); //DON'T LOOP IT BAHBEE.

}

if (s.equals("heavy")) {
println("heavy rain");
noLoop(); //DON'T LOOP IT BAHBEE.

}

if (s.equals("clear")) {
println("clear sky (night)");
noLoop(); //DON'T LOOP IT BAHBEE.

}

}


Now i just need to simpleML it up.

31.3.09

flash is starting to appeal to me

finally.

i'm now getting to the stage where i'm thinking about how i want the interactions with the floor to look and behave.

whilst doing a bit of research i came across daniel shiffman's lovely motion triggered lighting which made me whimper a bit as it's so simple but so nice.

Which got me interested in particles. Which i have now decided is far too mathy for me, and trying to teach myself maths just to make pretty particles would be useful in some sense, but in this project ultimately a waste of time. Although i would like to create an "oooh" reaction, it is not the aim of this project.

So i've decided to be a dirty cheat and instead make some movie clips in dirty flash and use some dirty actionscript. I'm not even planning to code animations at this stage, i'm just going to animate them in a nice simple-ish way.

Now i've just got to learn dirty actionscript.

5.2.09

finds big bright red thing right in front of it...

but still seems amazingly clever:



that little red dot is processing going "HEY! that's red!"

Found the code at daniel shiffman's site again. he seems to be the only person in the processing world that tells you how to do things in a simple straightforward way: ie. giving it to you minus the bollocks. YAY.

the lighting in my flat is crap.

6.11.08

getting somewhere....

I found some stuff on Daniel Shiffman's site about Bayesian Filtering, whilst i don't understand it completely i think it's what i've been looking for. Using Hashmaps you can search a document for words, and have the program state that it's found or how many times it's appeared etc. It's the system used to detect spam coming into your inbox.

I've found a relatively simple example in java, and a bit more complex version in Processing. i'm hoping to mush the two together to get a bit of code that works.