Sunday, 3 May 2009

Internetting

This morning I checked The Luminous Landscape, and read a few new posts/articles on there. They're having a half price offer on their DVDs, but they're still about $10 each. Even their 'Big Kahuna' boxset of all their Video Journals (17 issues) costs about $180. With tax and shipping to the UK, that would work out about £180 - expensive!

After that I started checking the canon lens forum on dpreview, then remembered about Sow Joan, and went on Animal Crossing until it was time to go to church.

After church I checked the canon lens forum on dpreview a bit more, then it was dinner time. After dinner I finished reading the canon lens forum on dpreview, and checked Moose News Blog and The Web Squeeze.

On the web squeeze someone had posted a question about foreign characters inserted into a page with javascript not appearing. After much testing I found the problem only occured when the javascript and the foreign character (it was a fixed string, not dynamic) being inserted were in an external .js file. The problem was that the webpage was being served up in UTF-8 encoding, while the .js file was saved in ANSI format. So I just opened the .js file in notepad, did a save as, and changed the encoding to UTF-8.

Also on the web squeeze, someone had answered my question about how to reference an object. I thought if I a variable that referenced an object, then any changes to that variable would actually happen on the object. This is correct up to a point, if you set the variable to equal something else, then the variable changes to point (or be) whatever you've just set it to, but the object it was previously referencing will stay as it was. James' explanation (who answered my question) is probably better than mine: Javascript variable references.

Then I did a bit of work on my website, still working on the jQuery/javascript for my category management section. I found that a button wasn't firing a function when clicked on. I couldn't work out why, but after messing about for a bit I found out. The problem was that the button was being created in a callback function from a $.getJSON() function. The getJSON callback function is asynchronous, so the rest of the script continues while the getJSON function is requesting and fetching the data from the server. This meant that I was setting my button's click event before the getJSON callback function had run and created the button, hence it couldn't assign the click event as the button didn't exist.

Luckily jQuery does let you do Synchronous HTTP requests, but unfortunately not from the getJSON function. So you could either do your JSON request using $.ajax instead of $.getJSON, or otherwise at the top of your script have $.ajaxSetup({"async" : false});, which is what I have done for the moment.

Later in the afternoon/early evening I took some photos of a siamese dandelion that I picked about a week ago. Unfortunately after picking it I put it in a vase in the kitchen, and I didn't realise that the kitchen didn't get any sunlight, so it stayed closed up all week. It was most obvious that it was a siamese/cojoined dandelion when it was open. But now it's started seeding, so I thought I better take some photos of it before it just turns into nothing.

I also went in the garden for a bit and there was a dead catterpillar in the pond. It seemed that Rigor Mortis had set in as it was completely stiff. Eventually I managed to flick it out the pond and put it on a leaf so a bird can eat it. I guess it was the caterpillar that's been eating the Yellow lilly plant growing at the pond's edge.

In the evening I did some more website stuff.

Food
Breakfast: Strawberry jam toast sandwich; cup o' tea.
Dinner: 1½ Spring rolls; chopped up omlette; rice; soy sauce. Pudding was Very creamy and delee strawberry gateaux. Coffee; Chocolate ball.
Afternoon snack: Scone with Flora fake butter and blackcurrant jam; cup o' tea.
Tea: Packet of roast chicken flavour crisps; apple; cup o' tea.

No comments: