Tuesday 31 March 2009

Testing diffusion methods for the MT-24EX

This morning I woke up quite late, about 9.30am. After breakfast I checked my email, The Web Squeeze and read a couple of articles about how adhering to W3C standards and accessability guidlines isn't the be-all and end-all of web development, e.g. Giving them what they paid for: A (sort of) follow-up.

By the time I'd done that it was lunch time. After lunch I went on Animal, then I did some more macro flash diffusion testing in the back garden for most of the afternoon. Unfortunately a lot of time was just spent waiting as the flea beetles kept hiding, and the diffuser I was testing was large and seemed to keep scaring them.

After dinner I checked panoguide and looked at a great high res pano from Dorin and some 360° movies. Then I started watching 'The Manchurian Candidate' with Mac and Ben. A bit boring so far. After that I checked Juza Nature Photography forums, dpreview canon lens forum and John K's No Cropping Zone blog.

The weather was nice and sunny most of the day, though it did cloud over a bit in the afternoon.

Food
Breakfast: Pink grapefruit marmalade toast sandwich; cup o' tea.
Lunch: Ham with mustard and crunchy salad sandwich; 2x small clementines; piece of chocolate cereal/biscuit cake; cup o' tea.
Dinner: pasta; cheese sauce; meatballs; broccoli; ground black pepper. Pudding was chocolate swiss roll with chocolate custard and banana.

Monday 30 March 2009

Comparing using the DOM in PHP to my standard inline coding

Today I was just doing more website work, trying to make a page using DOMDocument in PHP. I had some xml/html like:
<div>
   <div>
      <div>
      </div>
   </div>
</div>

was trying to select the innermost nested div using an xpath query like $cats = $xpath->query("//fieldset[@id = 'categories']//div[last()]. But this would just return all the divs.

I was stumped for quite a while, though after a bit of googling I came across this page: XPath Expression syntax. What I needed to use was: $cats = $xpath->query("//fieldset[@id = 'categories']/descendant::div[last()].

Another way to do it would be to use xpath (or getElementsById if your id attributes are of the type id) to get the node with the id categories, and then use getElementsByTagName(), e.g. $cats = $xpath->query("//fieldset[@id = 'categories'];
$cats = $cats->item(0)->getElementsByTagName('div');
$cats = $cats->item($cats->length -1)


Generally the native DOM methods are much faster, as evidenced by the link I posted yesterday and Xpath vs getElementsByTagName.

In the evening as well as doing some website stuff I watched 'Pimp My Ride', which was totally funny. X-zibit always talks weirdly and waves his hands around all the time, and they put an electric fireplace in the back of the woman's car that they were 'pimping'. So weird and stupid that it's funny.

I also finished off getting the DOM version of my webpage to the same state as my non-DOM one (i.e. not anywhere near finished, but does have a bit of functionality). The page has an upload file input and a category select box. When you select a category and press the submit button the page will reload, but there will be an additional selectbox that lists the subcategories of the category you chose. If you chose to add a new category rather than an existing category, then the page will reload with the select boxes and a couple of text inputs for you to add a category with.

The reasons I decided to try out using the DOM in PHP are:
In a form normally you will need to have something like <p<php if($error['myEl']){echo ' class="error"';}?>><p> wrapped round each of your form inputs, so that if the form is submitted, and there is an error with the information that was submitted, the input that caused the error can be highlighted (e.g. the css class error might turn the text it is applied to red).
Using the DOM you can set the error as you do the error checking, though you must do the error checking after the element has been created in the DOM, e.g.

//Error with 'myEl'
$error['myEl'] = 'Error msg';
$xpath->query("//p[*[@id = 'myEl']]")->item(0))
$el->setAttribute('class', 'error');
This code assumes you wrap all your form elements in p tags.

Another thing is that normally in a form, in each input element you will need to write it in PHP like:
<input type="file" id="imgExif" name="imgExif"<?php if( isset($imgExif) ){ echo ' value="'.htmlentities($imgExif).'"'; }?>></input>
So that if there is an error with the form after it being submitted and you need to redisplay it, all the original information entered will still be there.
Using the DOM in PHP you could instead loop through all input elements to set their values, something like:

if($_POST)
{
   $inputs = $doc->getElementsByTagName('input');
   foreach($inputs as $input)
   {
      $input->setAttribute('value', htmlentities($_POST[$input->getAttribute('name')]));
   }
}


So basically using the DOM helps you eliminate a lot of inline if statements. Of course, when using inline if statements they do have the advantage that you can see where they are and they're easy to move around if you want and you can deal with each one indivdually.

The other advantage of using the DOM is that you can make your DOM manipulation code for users with javascript disabled in PHP, and write it very similarly as to how you write the javascript DOM manipulations.

So, while I thought that using the DOM should cut down on the code (and I used documentFragments with appendXML() quite a bit to avoid creating each element and setting attributes seperately (kind of like innerHTML/innerXML)), it actually turned out that my page using PHP's DOMDocument class was 205 lines long, whilst my normal PHP page was 176 lines.

I tested the pages by just selecting a category, selecting a sub category with no children, then clicking a button to make some inputs come up to input a new sub category. I then refreshed the page 20 times and made a note of how long the server took (just using a microtime(true) at the top and bottom of the page code). In the code I also looped through the POST values, and set an error for each one. The results were:

DOM 

Ifs 

0.0248391628265 

0.0386390686035 

0.0530791282654 

0.0402488708496 

0.0252490043640 

0.0212869644165 

0.0882880687714 

0.0478379726410 

0.0611557960510 

0.0531520843506 

0.0583279132843 

0.0559401512146 

0.0175540447235 

0.0525538921356 

0.0300509929657 

0.0476679801941 

0.0478260517120 

0.0563178062439 

0.0287899971008 

0.0217041969299 

0.0264458656311 

0.0223338603973 

0.0317590236664 

0.0215539932251 

0.0231108665466 

0.0558059215546 

0.0316941738129 

0.0375928878784 

0.0481081008911 

0.0272078514099 

0.0249459743500 

0.0101881027222 

0.0382578372955 

0.0334050655365 

0.0424761772156 

0.0217411518097 

0.0252931118011 

0.0393078327179 

0.0211040973663 

0.0389711856842 

0.0374177694321 

0.0371728420258 

       



So both methods are about the same speed (at least for this example) If I could get getElementById() to work, the DOM page should be quicker, though doubt it make any real difference. I think I will probably keep on doing inline coding without the DOM at the moment. If I do find I really would like to use the DOM, then I might try something like phpquery, which is meant to be jQuery, but for PHP.

The weather today was overcast all day except for about an hour around lunchtime when it was cloudy and sunny.

Food
Breakfast: Pink grapefruit marmalade toast sandwich; cup o' tea.
Lunch: Ham with mustard and crunchy salad sandwich; clementine; slice of iced lemon madeira layer cake; cup o' tea.
Afternoon snack: Bit of Ben's fudge flapjack he made at school; cup o' tea.
Dinner: Beef burger in a bun with tomato ketchup and grated cheese; fried mashed potato in a cob with tomato ketchup and grated cheese; baked beans; crunchy salad. Pudding was a piece of Ben's fudge flapjack he made at school; coffee.
Supper: Oreo; coffee.

Sunday 29 March 2009

blah de blah

This morning I went on Animal for a bit. Sow Joan didn't have any red turnip seeds, even though no-one else had bought one from her!

After church I went on Animal a bit more, then we had lunch.

After lunch I checked deviantart, Andy Rouse's blog, Moose Peterson's blog, The Luminous Landscape, my email and redBubble.

I tried setting up my 450D + MP-E with an SB800 + inflatable diffuser on a flash bracket. The results in terms of lack of highlight blowouts were excellent, but it was very unwieldy and when you're shooting at an angle at things on the ground, most of the flash is just going straight into the ground, rather than at the subject (unless you wanted to try and reposition the flash bracket all the time).

After that I tried making a bounce attachment for one of the MT-24EX flash heads, it seemed to work okay, though quite big and sticking out. Also all the shots I took were at f/5.6 rather than f/8 like my other diffusion test shots. There were still blown out areas, and I'm not sure if it's actually any better than any other diffusion methods. I was also using one of my larger home made diffusers on the other flash head, so it's hard to tell if any blown highlights are due to the bounce diffuser or the other diffuser.

After tea I watched 'Butch Cassidy and the Sundance Kid' on TV with Mac, Ben and Clare. It was on channel 5 and they had about 5 minutes of adverts every 15mins. Quite annoying.

After that I did some more trying to work with the DOM in PHP. I've been trying to get getElementById() to work, as getElementById() is much faster than using xpath. However, I couldn't get it to work, so I think I'll just have to use xpath instead. The problem and possible solutions are detailed here: GetElementById Pitfalls.

The weather today was quite cold (there was ice in the morning), it was mainly sunny with clouds also drifting along. In contrast to the past week it wasn't very windy today.

Food
Breakfast: Pink grapefruit marmalade toast sandwich; cup o' tea.
Dinner: Chicken curry; rice; peas; sultanas. Pudding was trifle. Coffee; Quality Street.
Tea: Packet of Barbeque flavour crisps; mandarin (or might have been a satsuma, small orange thing anyway); fruit scone with 'I cannae believe it's nae butter jimmy'; piece of chocolate cereal cake; cup o' tea.

Saturday 28 March 2009

Being bored

Today I was mainly working on my photo website again, trying to do a test page using PHP's DOMDocument class.

In the evening I also watched an episode of The Equalizer.

The weather today was mainly overcast with a strong cold wind. It rained a few times and even hailed once, and there were also a few sunny spells.

Food
Breakfast: Bowl of strawberry crisp cereal; ½ Pink Grapefruit marmalade toast sandwich; cup o' tea.
Morning snack: Oreo; cup o' tea.
Lunch: Mature cheddar cheese sandwich (made with posh bakery bread); clementine; slice of Iced lemon madeira layer cake; cup o' tea.
Afternoon snack: Oreo; cup o' tea.
Dinner: 2x spicy sausages; mashed potato; baked beans; sliced mushroom. Pudding was yuckslush that Ben and Mac made, so I didnae have any.
Supper: Pink grapefruit marmalade toast sandwich; cup o' tea.

Friday 27 March 2009

Doing more website work.

It must be quite cold today, I opened my window before I had a shower, then after breakfast I switched my computer on, and the temperature inside it was 6°C!

Today I just did some work on my photo website. I didn't get much done, just part of the work on adding new categories to the database without using javascript.

The weather today was mainly cloudy and a bit rainy, although it was sunny later in the afternoon.

Food
Breakfast: Pink grapefruit marmalade toast sandwich; cup o' tea.
Lunch: 2x cheese on toasts; black grapes; min chocolate sandwich biscuit; cup o' tea.
Afternoon snack: Crinkle crunch; choc chip cookie; orange juice.
Dinner: Battered fish portion; potatoes; peas; mushrooms. Pudding was a lil' apple pie warmed up in t' oven with custard. Coffee; Quality Street.

Thursday 26 March 2009

Website stuff

This morning I sorted through some pogs to get some swaps I might swap with someone from Brazil who emailed me. I put the washing out on the line even though it was very cloudy and a bit rainy, and then checked my email.

I did a bit of work on my photo website, but when I exported the SQL from MySQL Workbench and then imported it using phpMyAdmin, I got an error 'ERROR 1005: Can't create table (errno: 150)'.

After lunch I went on Animal Crossing, then tried to fix the sql import error I was getting. In MySQL Workbench I exported just one table. Then if that worked okay I would add another table and export again, and so on until I got the error when importing the database. I found I actually had quite a few errors - one of the foreign keys I had linked up the wrong way round, and a couple of foreign key field were SIGNED/UNSIGNED when the field they were refering to was UNSIGNED/SIGNED.

I also took a few more flash diffusion test pics in the afternoon. Unfortunately all diffusion methods I've tried don't seem to be any good at reducing areas of blown out highlights where the light from the flash is reflected.

After dinner I watched the latest episode of Lost, Flight Of The Conchords and The Office. Then I checked the web squeeze and did some more work on my photo website.

The weather today was mainly overcast and it rained a bit in the afternoon. It was still quite windy.

Food
Breakfast: Strawberry jam toast sandwich; cup o' tea.
Lunch: Mature cheddar cheese with sweet & crunchy salad sandwich; black grapes; High School Musical 3 Chocolate mini roll; cup o' tea; Sainsbury's caramel chocolate.
Dinner: Piece of chicken & ham pie; gravy; mixed veg; potatoes. Pudding was trifle. Coffee; 2x Oreos.
Supper: banana.
Trying to take away weird taste of toothpaste and banana snack: fruit sweet; white chocolate coin.

Wednesday 25 March 2009

reading website stuff

This morning I started checking my email, then one of my emails was from sitepoint and had a link to an interview with Chris Wilson, the Platform Architect of the IE8 team, so I started listenin to that. Then I googled about the IE8 meta tag, and found this blog that I read quite a bit of: Bb RealTech.

I also got an email from Warehouse Express advertising the new Canon EOS 500D, however it was priced at about £900!!! I would expect it to be around half that price, maybe £500 when new and then dropping to £450 soon after release. Unless Canon have changed the rebel series to the same (or better) level than their xxD series cameras, this seems extremely expensive.

I checked dpreview, which of course had a Canon EOS 500D hands on preview posted already. However, I also found the article about Canon releasing a new Speedlite 270EX quite interesting. It looks like it might work quite well using the MT-24EX flash attachment ring, with an adjustable hotshoe pointing pack towards the camera. Then you could mount the 270EX in the adjustable hot shoe and attach a bounce diffusion device to bounce the flash down in front of the lens.

After lunch I went on Animal Crossing, then read the dpreview EOS 500D preview and finished checking my email. I checked the web squeeze and also did a bit of work on my photo website.

After dinner I went on the pinternet for a bit and also watched Swordsman 2 with Mac. It had ninjas that go underground and can also fly around on giant shurikens, a bloke who could suck the life out of anyone (deflating them in the process), and a woman who could explode ninjas using a whip!

The weather today was cloudy and a bit rainy in the morning, then cloudy and a bit sunny in the afternoon.

Food
Breakfast: Grapefruit marmalade toast sandwich; cup o' tea.
Lunch: Mature cheddar cheese with sweet & crunchy salad sandwich; black grapes; mint chocolate sandwich biscuit; cup o' tea; Sainsbury's caramel chocolate.
Dinner: Spicy chicken pizza Ben made at school today; chips; sweet & crunchy salad. Pudding was rice pudding with sugary bean paste and strawberry jam. Quality Street; Coffee.
Supper: Oreo; coffee.

Tuesday 24 March 2009

Testing diffusion methods for the MT-24EX & serving XHTML correctly


This morning I checked my email, then went about modifying my small diffusers so they would fit on the MT-24EX's flash heads with velcro, rather than sellotaping them to the flash heads.

I thought what the problem might be with why the exposure was darker with the small diffusers (with no diffusion gel) than the bare flash heads might be that the diffuser was stopping the flash from going downwards. You can hopefully see what I mean in the image below. The focus point is on the pencil tip, but if you look at the diffuser, much more light will fall behind the pencil than on the tip or in front of it. Ideally you should probably have the amount of light in front and behind about equal. The light in front is useful as it can bounce back from whatever is in front of the subject and provide some fill.


I cut the bottom front of the diffusers and bent them downwards into a down facing lip, then tried shooting a flat stone again, and the exposure was about the same between the modified small diffusers (with no diffusion) and the bare flash heads. I went in the garden to try some real life shots with the small diffusers (with no diffusion), and 1/16th power seemed to work okay, when before I needed 1/8th power to get a decent exposure. The exposure isn't as bright as with my large diffusers though, which is a shame.

After downloading the test pics to my comp I decided to try the bare flash heads, but when I went in the garden there weren't any flea beetles around (I'm using them for my flash diffusion tests). I walked around and waited for a few minutes, but didn't see any so came back inside and wrote this blog post.

I just went in the garden again, and only saw one flea beetle, and he disappeared before I could find him in the viewfinder. I put the washing out, checked for flea beetles and didn't see any, then had lunch.

After lunch I went on Animal Crossing for a bit. I went in the garden again, and finally found a couple of flea beetles, so tested out the bare flash heads, and indeed need 1/16th power to get a reasonable exposure, just like the small diffusers without any diffusion. So now it seems the small diffusers in of themselves aren't causing any noticeable light loss, I can work on putting some actual diffusion material on them.

I plan on first trying just a piece of Hampton Frost (253) gel on the front of the diffusers, then if that works okay I will try sticking another piece of stronger diffusion material on top (probably White Diffusion (216) gel) to block the direct flash, like Lumniquest do: Lumniquest mini softbox. Then if that works okay, I'll try John K's method of elevating the top flash head using an adjustable hot shoe adapter.

Well, I tried the diffusers with a piece of 253 on the front, and the exposure at 1/16 power was still good, though the highlights still looked quite harsh. Next I stuck some 216 on the 253 to cover the flash, like so:

However, it didn't seem to reduce the harsh highlights at all and just resulted in around ½ - 1 stop light loss.

I kept experimenting with diffusers but didn't really get any satisfactory results. I didn't try elevtaing the main flash like John K, I'll have to try that tomorrow.

I checked my email, then modified my diffusers again. It was too dim outside to test them, so I just tidied my room a bit, then it was dinner time.

After dinner I read a bit about xhtml, and found that you need to serve it with a mime type of 'application/xhtml+xml'. So I tried that, but IE just gave me an error. Luckily I found a post that shows how to do it: PHP: sending correct Content-type header for XHTML. Though I used stripos rather than the more resource hungry preg_match.

I decided to see if it would be possible to send xml to IE rather than text/html, and found this blog post: How To Serve XHTML to Internet Explorer 6 And 7 as XML Using Content Negotiation.

However, after implementing that I was getting an error:
The server did not understand the request, or the request was invalid.
Error processing resource 'http://www.w3.org/TR/xhtm...
After doing some googling I found this post: w3.org DTD/xhtml1-strict.dtd blocks Windows IE users and this thread: IE fails on XHTML served as application/xml.

It seems the problem is that IE tries to parse the full DTD each time it loads a page, so W3C have had to block IE from viewing the DTD as obviously there must be quite a few pages being served as XML. First I tried just not sending the Doctype to IE, but of course, this triggers 'quirks mode'.

So I tried the trick mentioned in the thread above to use an xsl output declaration to set the doctype. However, now I needed to check whether the document was rendered using quirks mode or not. A bit of googling found this page: About Quirks-Mode, which suggests checking the value of document.compatMode using javascript.

However, when I tried this, it didn't work and I just got an error
Internet Explorer cannot download .
Unspecified error
So each time I want to check what compatibility mode the document was rendered in, I have to:
  1. open the MS Script debugger
  2. set it to break on next statement
  3. do something on the page that uses javascript
  4. then type document.compatMode in the script debugger command window

It's annoying how IE doesn't have anything like firebug available for it. I also wanted to see check what HTTP Headers IE was receiving. The MSDN Internet Explorer Developer Center suggests using a program called Fiddler to check the HTTP Headers.

Unfortunately when checking the compatibility mode, I found IE7 was still rendering the page in quirks mode, despite me setting the doctype using the xsl output declaration. Looking at the XSL tutorial on W3Schools, I realised I should be able to just output the doctype as normal tag, just like they output the different html tags in that tutorial. But when I tried it, the Doctype declaration wasn't valid xml, so it caused the page to fail.

After some googling I found this page: How do I generate a reference to a DTD using XSLT? After adding that to the XSLT I got an error saying 'Cannot have a DOCTYPE declaration outside of a prolog' (actually I was already getting that error when I stuck the doctype declaration in the XSLT as plain text). I deleted the xsl:output that I had tried to set a doctype with before, and that got rid of the error and the page rendered okay. I checked the compatibility mode, and it said 'CSS1Compat', so seems to be working okay.

I also tested the page in Lynx and FF3, and seems to be working okay. Of course I still haven't tested in all the other browsers yet and the page is very basic, so there may be more errors to overcome. I'm particularly concerned about what the XSLT will do to my page if it has non-html elements in it. The ability to include elements from other namespaces (particularly RDF) is the only reason I decided to try and code this site in XHTML (maybe useful experience as well). If it does cause problems maybe I can filter out the transformation by namespace or some xpath statement.

The weather in the morning was a mixture of cloud and sunny spells. In the afternoon it was still cloudy, but the sun shone for most of the afternoon until probably about 4pm when it clouded over. In the evening it rained a bit.

Food
Breakfast: Blackcurrant jam toast sandwich; cup o' tea.
Lunch: Mature cheddar cheese with sweet & crunchy salad sandwich; a few red grapes; banana; min chocoalte sandwich biscuit; cup o' tea.
Dinner: Slice of Ham, mushroom and chicken quiche; slice of tomato, sausage and bacon quiche; potatoes; peas. Pudding was a Mac and Ben cooked Japanese bean pancake thing, which I put some strawberry jam on. Would have been nicer with cream, but we didnae have any. Coffee.
Supper: Oreo; cup o' tea.

Monday 23 March 2009

Weather not as nice today

This morning I did a bit of work on my photo website making something work without javascript. I found a blog post that features a similar thing to what I wanted to do: Auto-populate multiple select boxes. However, they have a fixed number of select boxes, and the select boxes are hard coded into the page. I wanted my page to work so you click on the entry in the first select box, then it will load up a second select box with the sub categories, then you can again click on a category in that select box, then it will load up another select box with further sub categories and so on until you get to the bottom of the hierarchy and there are no more sub categories.

Also in the morning I vacuumed my room and checked my email.

After lunch I played on Animal Crossing for a bit, and also tried taking some more photos with my small diffusers. I found that I still needed 1/8th power at 3x magnification to get a decent exposure, even though I was only using quite a transparent diffuser. My big home made diffusers only needed between 1/32 and 1/16 power to get a good exposure.

I found this blog post that gives the light loss for different diffusion materials: Light Loss and Mired shift values for Gels and Diffusion. The Hampshire Frost "253" gel I was using is listed at only 1/4 stop light loss, so I was suprised since I was getting far more than a ¼ stop light loss.

I tried taking some photos of a flat gray stone, and found that it wasn't just the diffusion material causing the light loss - the foil wrapped cardboard that was between the diffuser and the flash head was actually causing light loss as well. I thought this was strange since theoretically it should focus the beam of light more. I also found that my big diffusers seemed to get more light on the subject than just the bare flash heads. I think this is because my big diffusers are quite long, the light only escapes from them when it is quite near the subject, and so does result in a more focused beam of light from the flash heads.

I didn't take many photos today as it was very windy and also rained quite a bit. I did some more work on my website, and found that my code wasn't validating as I was using nested paragraph "p" tags. I guess this makes sense, though I didn't know you couldn't use them. Getting my category selectors to work without javascript took quite a long time and a lot of extra code compared to the AJAX version. And this is only one tiny part of a page.

In the evening I watched 'Swordsman' with Mac, which was really good. The story was reasonably easy to follow, but I did get confused a couple of times. People keep flying in the air and can fire bullets out of thin air with their hands.

The weather today was mostly overcast, with a heavy shower and a few spells of sunshine. It was very windy.

Food
Breakfast: Multi grain hoops & honey shreddies; cup o' tea.
Lunch: Mature cheddar cheese with sweet & crunchy salad sandwich; banana; piece of Waitrose mini flapjack; One of Ben's chocolate squidge nidge truffles; cup o' tea.
Dinner: Pasta; tomato sauce stuff; bacon; paremgiannio or whatever it is cheese; ground black pepper. Pudding was ¼ of a strawberry cheesecake. Coffee.
Supper: Chocolate covered posh ginger biscuit that had big bits of ginger in it; crinckle crunch; hot chocolate with dooleys.

Sunday 22 March 2009

Watching an animal cruelty film

This morning I went on Animal, then me and Mac went to Church. After church I played on Animal a bit more.

After dinner, me, Mac and Ben watched Tarzan (1932) for a bit. Then did some googling about flash diffusion for macro shooting/the MT-24EX twin lite while Ben and Mac made some japanese bean cakes using Cooking Guide for the DS. I ate one of the cakes that Mac and Ben made, it was like 2 thick pancakes sandwiched together with sugary bean paste.

I modified some diffusers for the MT-24EX, then went in the back garden to test them.

After tea we finished watching the Tarzan film. It was quite funny. Some highlights were:
  • The white people's slaves are walking along a narrow ledge up a tall cliff and the slave driver is just whipping them for no reason.
  • The white people kill loads of hippos.
  • Tarzan's mate is someone in a bad ape costume.
  • After the white people kill Tarzan's ape mate, Tarzan kills some of the slaves who had nothing to do with it.
  • Jane is really annoying and whiney.
  • Tarzan kills a leopard and throws it down from a tree.
  • Tarzan kills lots of other animals.
  • An elephant who is Tarzan's mate picks him up and carrys him along by biting his head - it looks so funny seeing the elephant walk along with tarzan hanging from its mouth.
  • There is a race of midgets.
  • A giant ape in a pit smacks another smaller ape (who is Tarzan's mate) into the ground repeatedly, and then throws it out of the pit, but later on the small ape is okay!?!


After that I checked my email, Deviant art, TWS, Moose News Blog, Andy Rouse's blog, The Luminous Landscape and dpreview. Then I put some of my MT-24EX diffusion test pics together in a comparison file. Unfortunately I didn't have many shots using John K's technique, and I think I also need to try another method with a thicker piece of diffusion material covering the central part of the diffuser. Maybe tomorrow.

Food
Breakfast: Honey nut shreddies & multi-grain hoops; cup o' tea.
Dinner: Chicken curry; mixed veg; rice; Pita bread. Pudding was some bits of flapjack from Waitrose. Coffee.
Tea: Mature cheddar cheese with sweet & crunchy salad sandwich; black grapes; cup o' tea.

Saturday 21 March 2009

1920s Parkour and taking photos

This morning I went in the garden for a bit and took a few photos and also did some more work on my photo website.

After lunch I did some more work on my photo website and took some more photos in the garden, testing out different diffusion methods still.

After dinner I did a backup, went on Animal Crossing for a bit and then watched 'The Mark of Zorro' with Mac. The Mark of Zorro was skill and had 1920's Parkour.

Food
Breakfast: Grapefruit marmalade toast sandwich; cup o' tea.
Lunch: Mature cheddar cheese sandwich; packet of prawn cocktail flavour crisps; slice of golden syrup cake; cup o' tea.
Afternoon snack: Cheesecake pancake thing Mac and Ben made using cooking guide on the DS.
Dinner: rubbish sausage; posh delee cumberland sausage; mashed potato; spaghetti hoops; ground black pepper. Pudding was sliced kiwi fruit with strawberry whip and a bit of a Cheesecake pancake thing Mac and Ben made using cooking guide on the DS.
Supper: Crinckle crunch; choc chip cookie; hot chocolate with Dooleys.

Friday 20 March 2009

Testing diffusion methods for the MT-24EX

This morning I did some work on my photo website, then went in the garden for a bit. I saw my first Weevil and hoverfly of 2009. There were also a few ladybirds, pollen beetles, flea beetles and various flies around as well. I saw one or two bumblebees also.

After lunch I checked my email and then tried to make some diffusers like those that John K is using. The rest of the afternoon I tried taking photos with a couple of different diffuser methods. By about 5pm it was getting too dark to see through the viewfinder properly, so I'll have to test the other diffusion methods tomorrow. I also read a few threads on Juza Nature photography forums.

After dinner I went on Animal Crossing for a bit. Then I sorted/processed a few photos and did a bit of work on my photo website.

It was nice and sunny all day today.

Food
Breakfast: Grapefruit marmalade toast sandwich; cup o' tea.
Lunch: ½ beetroot sandwich; slice of thin crust pepperoni pizza; clementine; slice of golden syrup cake; cup o' tea.
Dinner: Battered fish portion; peas; potatoes; salt; vinegar. Pudding was Jamaica ginger cake with golden syrup and custard. Coffee.
Supper: Hot chocolate; American style chocolate brownie cookie.

Thursday 19 March 2009

Finishing off merging partitions

This morning my PC was still working on expanding the partitions that I told it to yesterday afternoon. I played on Animal for a bit, then went on a walk. I went down the old railway line towards Lubenham, then up the road towards East Farndon, then turned left down the footpath and walked down there towards the farm. Then I turned right and walked along the edge of the field where I walked about a week ago. There were lots of birds there last time I walked along there, but not many today. I did see a few sitting on the dead plants, but they flew away whenever I got near them.

Then I went back down the footpath across the middle of the field and went home. I didn't see much on my walk, just a few birds and a couple of butterflies - commas, I think.

When I got back home it was lunch time. After lunch I took some photos of a rhubarb leaf. Then my comp had finished changing the partitions (only took about 24hours!), but it said there were some links it couldn't move properly or sumat and to run my OS's error checking. I restarted the comp and it booted into Vista without me even having to use the installation DVD and fix the boot record.

I ran chkdsk c: /r, which needed to run when I restarted the PC. However, when I restarted the PC the chkdsk took about 2 seconds and said the Volume was 'clean'. I expected it to take ages doing all the checks. When I got into windows I ran chkdsk on the other partition, which is taking a long time, like I thought it should do. It's still checking at the moment.

While I was waiting for chkdsk to run on my e: I checked Andy Rouse's blog, Moose Peterson's blog, my email, the dpreview canon lens forum and the web squeeze.

After dinner I watched Lost and the last Blues Documentary with Mac.

The weather today was nice and sunny in the morning (though quite hazy), and overcast the rest of the day.

Food
Breakfast: Grapefruit marmalade toast sandwich; cup o' tea.
Lunch: 2x cheese on toasts; clementine; slice of golden syrup cake; cup o' tea.
Dinner: Spaghetti; meatballs; mixed veg; paremgiannio or sumat cheese. Pudding was a caramel milk jelly thing and an American style chocolate brownie cookie.

Wednesday 18 March 2009

Trying to expand/merge partitions in Vista

This morning I was trying to free up some space on my main hard drive as it's nearly full. I had a partition with another install of Vista on it, so I tried to delete that so I could increase the size of my main partition or use it as a seperate partition to store virtual machines on.

Unfortunately deleting/formatting the partition was much harder than I thought. After restarting my PC and fixing/breaking the Vista bootloader all morning I eventually managed to wipe it. The problem was that although the Vista being loaded was on the C:, the bootloader was on D: (where my unwanted Vista intsallation was). So if I wiped the D:, there was no bootloader. The other problem was that the D: was marked as the active partition, so whenever I tried to fix the bootloader, it would recreate it on the D:, not the C:.

So what I should have done to wipe the 2nd Vista partition is:
  • In disk management (right click on My Computer and choose 'Management'), right click on the partition you want Vista to boot from and choose 'Mark Partition as Active'
  • Restart the machine and boot from the Vista install DVD
  • Choose to install windows, when you get to the bit where you choose what partition to install on, click on the options for the partition you want to delete and choose delete.
  • Exit the install process (click the X), and then click on the Repair link
  • Choose the command prompt option and type bootrec /FixBoot
  • Restart the PC and hopefully should work okay


However, now I have a blank partition, which I need to merge with the C: or the other free space on the drive. In the morning I also saw a blue tit in the nest box pecking the entry hole, and a yellow butterfly.

After lunch I tried to merge the blank partitions, but couldn't figure out how to do it. I checked my email, then went in the garden for quite a while and took some macro photos as there were quite a few insects about. After that I played on Animal Crossing for a while and then did a quick sort of the photos I'd taken.

In the evening I watched a couple of episodes of Trashelstar and 'A Chinese Ghost Story' with Mac.

The weather was nice and sunny all day.

Food
Breakfast: Grapefruit marmalade toast sandwich; cup o' tea.
Lunch: Sliced pickled beetroot sandwich; 2x satsumas; plum; cup o' tea.
Dinner: Thin crust pepperoni pizza; peas; potatoes. Pudding was the rest of the fruit salad that Ben made at school the other day and strawberry whip.
Supper: Choc chip cookie; cup o' tea.

Tuesday 17 March 2009

Trying to work out how to write an XMP Schema

This morning I started checking my email, and then went to help Trevor with his computer as his printer wasn't working.

After that I finished checking my email and read a bit about RDF and writing RDF schemas. I'm still a bit confused though, as the way to write an RDF Schema described by W3Schools and by the W3C is different to how the Dublin Core and IPTC Core schemas are structured.

The W3 examples have xml:base= "http://thisNameSpaceURL#" as an attribute of the root <rdf:RDF> element. However the IPTC and Dublin Core Schemas don't include this.

The other difference is that the W3 examples use rdf:ID="myProperty" as an attribute of the <rdf:Description> element, whilst the Dublin and IPTC Core schemas use rdf:about="http://thisNameSpaceURL/myProperty" as an attribute of the <rdf:Description> element.

I noticed that many namespace URLs don't seem to actually exist, and it seems this quite normal: Old Ghosts: XML Namespaces, so I don't really understand what the point of writing a schema is if you don't need one.

This is also backed up by the XMP Specification:

An XMP Schema is a set of top level property names in a common XML namespace, along with data type and descriptive information. Typically, an XMP schema contains properties that are relevant for particular types of documents or for certain stages of a workflow. Chapter 4, “XMP Schemas”, defines a set of standard metadata schemas and explains how to define new schemas.

NOTE: The term “XMP Schema” used here to clearly distinguish this concept from other uses of the term “schema”, and notably from the W3C XML Schema language. An XMP Schema is typically less formal, defined by documentation instead of a machine readable schema file.

An XMP Schema is identified by its XML namespace URI. The use of namespaces avoids conflict between properties in different schemas that have the same name but different meanings. For example, two independently designed schemas might have a Creator property: in one, it might mean the person who created a resource; in another, the application used to create the resource.

The namespace URI for an XMP Schema must obey the rules for XML 1.1 namespaces. In addition, to operate well with RDF it must end with a ‘/’ or ‘#’ character. (See “Namespace URI termination” on page 29) The URI might or might not actually locate a resource such as a web page. XMP places no significance on the scheme or components of the namespace URI.

An XMP Schema will also have a preferred namespace prefix. Property names are often written in documentation with the prefix in the manner of XML qualified names, such as dc:creator. Following the rules of XML namespaces, use of this prefix is only a suggestion not a requirement. The actual prefix used when saving XMP might differ, and is local to the xmlns attribute that declares it.

Use of standard URI schemes is encouraged when creating namespace URIs. In order to avoid collisions, the URI should contain a component owned by the namespace creator such as an Internet domain name. Do not create namespaces in domains owned by others.


In the evening I watched the latest Futurama film, Flight Of The Conchords episode and Office episode. I thought both FOTC & The Office were better than usual this week. FOTC had a hilarious scene in it where Bret is in a pet shop wearing a kilt and a walkie talkie on loudspeaker, trying to impress the woman who works there while Dave and Jermaine shout stupid instructions through the walkie talkie (they're hiding in a car outside).

After that I checked my email again and the canon lens forum on dpreview.

The weather was overcast all day today except for a few minutes in the afternoon. It was quite cold in the morning as well.

Food
Breakfast: Grapefruit marmalade toast sandwich; cup o' tea.
Lunch: 2x Cheese on toasts; clementine; One of Ben's big chocolate truffles; cup o' tea.
Dinner: Beef pie; potatoes; carrots; peas; gravy. Pudding was microwave fruit sponge with custard and a bit of Golden syrup. Coffee; Quality Street.

Monday 16 March 2009

Trying to install something again

This morning I went in the garden and saw 2 ladybirds, tiny beetles inside some daffodils, and winged hymenopteran of some sort walking around on top of a daffodil.

After that I downloaded a couple of keywording tools to see what the XMP data they produced looked like. The first one I tried was ProStockMaster, which is free and has quite a lot of good features if you're interested in Selling stock/microstock. It has a keyword suggester and can also track how many downloads/money you make from images you upload to stok sites through it. It supports quite a few different Stock sites: istockphoto.com; shutterstock.com; dreamstime.com; 123rf.com; bigstockphoto.com; canstockphoto.com; fotolia.com; alamy.com; stockxpert.com; panthermedia.net.

Despite using a database, it does write the tags/title to the XMP metadata of the file. However, I didn't see the keywords being split into Essential Keywords, Major Keywords, and Comprehensive Keywords as Alamy requires (see Embed custom keyword fields in the file).

So I tried downloading Image Keyworder, which has a special 'Alamy Mode'. However, after installing it, it wouldn't work becuse MS SQL Server wasn't installed. So I installed this (which took ages), but then it still wouldn't work. It seems the program will only work with the x86 version of MS SQL Server 2005 Express. So if you're using an x64 OS, like me, then it won't work.

After getting annoyed by that I vacuumed my room, then I tried installing Image Keyworder on a Win XP Virtual Machine, again it took ages. While I was waiting for it to install I checked my email, deviant art and the canon lens forum on dpreview.

After lunch I checked the canon lens forum on dpreview a bit more and went on Animal Crossing. Despite my best efforts, I couldn't get Image Keyworder to install, even on an XP Virtual Machine. The installing bar for SQL Server 2005 Express Edition SP2 (x86) (which Image Keyworder tries to install) would just go to full, then go back to the start and start again. If you clicked the cancel button, it would carry on doing the same thing, and the only way to stop it was to end task/process using task manager. I did give it over an hour to install on one try, letting the install process go up to full then back to zero several times, but it still didn't work.

The rest of the afternoon I was looking at RDF and how to create and validate an RDF schema. I found this website that will validate xml, but it gives lots of validation errors for my RDF schema, which I don't think are correct. W3C has an RDF validator, but I think that's for validating RDF instances rather than RDF Schemas.

After dinner I watched an episode of Trashelstar and 'A Fistful of Dynamite' with Mac.

The weather was nice and sunny all day.

Food
Breakfast: Blackcurrant jam toast sandwich; cup o' tea.
Lunch: Grated cheddar cheese sandwich; clementine; slice of Genoa cake; cup o' tea.
Dinner: Sausage; bacon; baked beans; 2x tinned plum tomatoes; chips. Pudding was fruit salad that Ben made at school and an American Style Chocolate Brownie Cookie. Coffee; Sainsbury's caramel chocolate.

Sunday 15 March 2009

Not much

In the morning I went on Animal Crossing for a bit. Then I went to Church with Ben, Mac didn't go because he went to Mansfield/Worksop yesterday and is still there.

After church I went on Animal a bit more, then went in the garden for a couple of minutes and saw: a ladybird; 2 ladybirds mating; some flea beetles; a spider; an ant; and some little flies.

After dinner I had more trouble trying to install stuff. Eventually I gave up.

After tea Mac came home and we watched 'The Good, The Bad & The Ugly - Extended Edition'.

The weather today was sunny in the morning. In the afternoon it was overcast, but the cloud was thin enough to let quite a bit of light through, but thick enough for there not to be enough light to cause shadows.

Food
Breakfast: Grapefruit marmalade toast sandwich; cup o' tea.
Dinner: Chilli con carne; rice; Cheesey Tortilla chips; grated cheese. Pudding was ice cream with chocolate sauce. Coffee; piece of Cadbury's Dairy Milk Turkish.
Tea: Grated cheese sandwich; red grapes; slice of Genoa Cake; chocolate Wacko bar; cup o' tea.
Supper: Packet of Smokey bacon flavour crisps; cup o' tea; Choc chip cookie; malted milk.

Saturday 14 March 2009

Not doing much

I kept waking up last night and then taking ages to get to sleep again. I woke up again at 5.00am, but couldn't get back to sleep, so I got up at 6.30am.

In the morning I looked at setting up a custom XMP schema, then watched a bit more of 'Once Upon A Time In The West' with Mac. I also went in the garden a few minutes and saw a few flea beetles, a ladybird and a small fly with feathery antennae. I checked Andy Rouse's blog and Moose Peterson's blog.

After lunch I finished watching 'Once Upon A Time In The West' with Mac. The rest of the afternoon I was having trouble installing a program on my PC and I also went on The Sims 2 a bit.

In the evening I watched The Equalizer s01e05 - Lady Cop, it had a skill bloke hacking using a small computer on a public phone (remember this is 1985). Would be totally weird if you walked down the street and there was just someone with a computer connected to a public phone. I also watched a couple of other Equalizer episodes.

The weather today was overcast most of the day, then sunny later in the afternoon and there was probably a nice a sunset, but I think I missed it while I was eating dinner.

Lunch
Breakfast: Grapefruit marmalade toast sandwich; cup o' tea.
Lunch: Mature cheddar cheese sandwich made with fresh bread-maker-made bread; slice of fresh bread-maker-made bread with honey; red grapes; cup o' tea.
Dinner: 2x Sausage Rolls; mushrooms; baked beans; brown sauce; potatoes. Pudding was a Raspberry ripple mousse with hardly any raspberry ripple. Coffee; Quality Street.
Supper: Fig Roll; Cup o' tea.

Friday 13 March 2009

Not doing much

This morning I backed up my comp and took some flower photos. Then I read about storing hierarchical data, most info suggested storing in mysql using the nested sets method.

After lunch I went in the garden for a bit, I saw 2 flea beetles and heard a bee or sumat. Then I did some work on my photo website, just trying to sort out the different mysql tables I needed.

In the evening I watched an episode of Trashelstar and a bit of a Western film with Mac.

Food
Breakfast: Blackcurrant jam toast sandwich; cup o' tea.
Lunch: Ham with mustard and sweet & crunchy salad sandwich; red grapes; slice of Genoa cake; cup o' tea.
Dinner: Shepherd's pie; carrots; mushrooms; tomato ketchup. Pudding was chocolate cereal cake stuff. Coffee.

Thursday 12 March 2009

Trying to setup RSync

This morning I woke up at 9.30am, which is quite a bit later than I normally get up - I normally get up about 8am.

I tried listening to some .vtz Spectrum sound files, but they wouldn't play in Deli Player 2 or in Winamp. So I did some googling and found AY-3-8910/12 Emulator, which seems to work quite well at playing the tunes.

Then I tried setting up RSync so I could copy my website files from Ubuntu to Windows, and then back them up with all my other stuff in Windows. I did get it working eventually, although not with SSH. I worked on getting it working most of the morning and all afternoon. I found this tutorial useful for setting up RSync on windows: Rsync for Windows. And this tutorial was useful for the command needed to backup to Windows from Linux: A Tutorial on Using RSync.

In the afternoon I also went in the garden for a few minutes and saw 2 bumble bees (or maybe the same one twice), about 6 flea beetles on one plant (and I found out why they're called flea beetles - they jump), and a little shiny beetle.

After dinner I watched Trashelstar with Mac, then I checked my email and the web squeeze.

The weather today was overcast in the morning and sunny & cloudy in the afternoon again. There was a bit of a sunset.

Food
Breakfast: Lemon marmalade toast sandwich; ibuprofen; cup o' tea.
Lunch: Sliced pickled Beetroot sandwich; packet of Flamin' chilli flavour Doritos; clementine; Chocolate Wacko; cup o' tea; piece of Sainsbury's Caramel Chocolate.
Dinner: Battered fish portion; potatoes; peas; salt. Pudding was a slice of jam swiss roll with custard; Chocolate Mini roll; coffee.
Supper: Coffee; Malted Milk; Choc chip cookie.

Wednesday 11 March 2009

Hierarchical data models in SQL

This morning I was trying to find out how to work with hierarchial data (categories and subcategories) in SQL. I read quite a bit of stuff, but the articles I found most useful were:


The Nested Set / Modified Preorder Tree Traversal Model and the Lineage / Path Enumeration Model seem to be the two recommended models.

After lunch I went on Animal for a bit, then did a bit of work on my photo website. I think I will use the Nested Set / Modified Preorder Tree Traversal Model for my hierarchical categories, as the article about it on the mysql website seems quite comprehensive and relatively easy to understand.

A couple of books I should probably read are The MySQL Book and Joe Celko's Trees and Hierarchies in SQL for Smarties.

After dinner I watched 'Fighter In The Wind' with Mac, then did a bit more work on my photo website.

The weather today was overcast in the morning, then sunny and cloudy in the afternoon. Later in the afternoon it became overcast again.

Food
Breakfast: Lemon marmalade toast sandwich; cup o' tea.
Lunch: Farmy cheddar cheese with sweet & crunchy salad sandwich; ½ banana; slice of Madeira cake; cup o' tea.
Dinner: ½ jacket potato; mashed potato with cheese; grated cheese; baked beans; piece of quiche. Pudding was Jamaica Ginger cake with golden syrup and custard. Coffee.

Tuesday 10 March 2009

EXIF/Image metadata extraction comparison

This morning I was trying to figure out why PHP wouldn't parse the JSON produced by ExifTool. After much testing and messing about I eventually figured it out - there was a © sign in the EXIF data, and this was messing it up. Doing a UTF_encode() to the data before json_decode()ing it worked (and this is mentioned on the php.net JSON page). The © sign is now appearing with an accented A before it though, so I still have to figure out what's happening there.

I checked my email and saw that RED have announced some new lenses, though doesn't seem to be any price indication at the moment.

I sorted out the problem with the © symbol not displaying properly - I wasn't sending any html headers, so making the page a proper html page with the encoding set to UTF-8 fixed it. I made a page extracting the EXIF & IPTC using Evan Hunter's PHP JPEG Metadata Toolkit and another page that used the PHP iptcparse and exif_read_data functions.

After lunch I went on Animal for a bit. Then I ran each exif/iptc extracting page 10 times to see how they compared:

PHP-iptcparse-exif_read_data.php

PHP_JPEG_Metadata_Toolkit-Test.php

ExifTool-Perl-Module-Test.php

ExifTool-Command-line-Test.php

0.077036857605

0.166090011597

0.293696880341

0.269569873810

0.110205173492

0.141455888748

0.280531167984

0.207340955734

0.110219955444

0.106762886047

0.264120101929

0.257773876190

0.135658979416

0.182878017426

0.276825904846

0.275245904922

0.092431068420

0.164710998535

0.294065952301

0.259418964386

0.086300134659

0.178915023804

0.310618877411

0.257565021515

0.108342885971

0.176629066467

0.267220973969

0.268435955048

0.108730077744

0.183045148849

0.291265964508

0.248710870743

0.073312997818

0.129640102386

0.255465984344

0.326677083969

0.120223999023

0.143432855606

0.292721986771

0.190216064453

0.102246212959

0.157355999947

0.282653379440

0.256095457077



As you can see, Evan Hunter's PHP JPEG Toolkit is about 50% slower than PHP's built in methods, running a perl script that uses the ExifTool perl Module is about 280% slower than PHP's built in methods, and running the ExifTool perl script directly is about 250% slower than PHP's built in methods. So the built in PHP functions win on speed, but there are also other factors to consider.

  • Both ExifTool and Evan Hunter's PHP JPEG Toolkit can extract far more information than the built in PHP functions.
  • Both ExifTool and Evan Hunter's PHP JPEG Toolkit can write EXIF and other meta data.
  • ExifTool works with many image formats including RAW files.
  • ExifTool is being continuously developed
  • Assuming you are parsing the image metadata, then writing it to a database, this will only need to be done once, when initially uploading the file. So the speed differences between the different methods aren't particularly important.
  • Evan Hunter's PHP JPEG Toolkit presents data as HTML rather than an array. You could edit the code so it creates an array rather than html, but that would be a very big job.
  • The IPTC data produced by the PHP function iptcparse has unfriendly array key names e.g. the tags are $iptc['2#025']
  • The array produced by exif_read_data cannot be passed to utf8_encode (presumably because the array contains binary data), so I guess you would need to utf8_encode each piece of info you want to extract.


After that I checked the web squeeze, and asked a question there about whether most hosts have perl installed. I think CentOS is one commonly used OS for web servers, and it seems that includes perl.

There was a google car with the big camera(s) on top of it going up our street today (though I didn't see it myself), so our road should be on Google StreetMap whenever they get round to updating it with the data from today.

I checked the dpreview canon lens forum, and then took some photos of a daffodil. I found this time that lighting a white piece of card for the background with a gelled flash didn't work very well.

After dinner I watched 'Elite Squad' with Mac, which was good. I did a backup of some stuff, and then took some more daffodil photos.

The weather today was overcast in the morning, then brightened up in the afternoon and there was quite a nice sunset. I listened to Amiga chip music nearly all day.

Food
Breakfast: Toasted tea cake with butter; cup o' tea.
Lunch: Farmy cheddar with sweet & crunchy salad sandwich; plum; clementine; Chocolate Wacko (like a Rocky); cup o' tea; piece of Sainsbury's Caramel Chocolate.
Dinner: Thin & crispy pepperoni pizza; peas; chips; salt. Pudding was a piece of Tiramisu. Coffee; Quality Street; piece of Sainsbury's Mint Chocolate.

Monday 9 March 2009

Line breaks in Blogger working again!

This morning I did some more work testing the reverse geocoding with Yahoo maps and GeoNames.org. Then I did some googling to see if there were any comments on whether Google Maps or Yahoo Maps was best. There didn't seem to be many articles comparing them, though references to this popped up a lot: Yahoo CEO Likes Google Maps Better Than Yahoo Maps.

Probably the most important statement in that article is
CFO Blake Jorgensen, who resigned last week but is still on board, added that an online mapping service is very expensive to maintain, and that he doesn't foresee Yahoo pouring significant additional investments into Yahoo Maps in the near future.


In my testing so far the only thing I have found Yahoo Maps better at is that it is accurate with full UK postcodes. Google Maps could probably be fixed by looking up postcodes through GeoNames. The only thing I have found Google Maps better at is that it has built in reverse geocoding (and I prefer the amount and format of the data returned by Google to that returned by GeoNames). Of course, it should be possible to use Yahoo Maps API for displaying the map and Google Maps API for doing the reverse geocode if you wanted.

I prefer Google Maps because they are still actively developing it and they even have a full program (Google Earth), so it seems likely to me they will add more and better features than Yahoo and also probably have a larger dataset and more detailed satellite imagery than Yahoo.

I vacuumed my room, and then checked my ebay. The Manfrotto 410 Junior Geared head I was watching on ebay ended up going for £113.61 + £8.50 P&P. Although it was 'Mint & Unused', personally I'd rather pay a bit more to get it new from a retailer with a warranty (£122.99 + £9 P&P).

I checked my email, then made some changes to my exiftool/php scripts as I had received a reply from Phil (the writer of exiftool) on the cpan forum. I wanted to know why info was missing (the Latitude and Longitude) when calling exiftool from the command line compared to when using it as a perl module. The answer is that when calling it from the command line you need to use the -a option to allow duplicate tags. However when I tried this I found it didn't work when I was also using the -j option (to get results as JSON). Reading the exiftool notes I found the answer:
=item B<-j> (B<-json>)

Use JSON (JavaScript Object Notation) formatting for console output. This
option may be combined with B<-g> to organize the output into objects by
group, or B<-G> to add group names to each tag. List-type tags with
multiple items are output as JSON arrays unless B<-sep> is used. The B<-a>
option is implied if the B<-g> or B<-G> options are used, otherwise
it is ignored and duplicate tags are suppressed.


My other question I asked was how to use the -fast option when using Exiftool as a perl module. The answer there was to use $exifTool->Options(FastScan => 1);.

After lunch I tried taking some photos of a dead poppy, and using white card for the background, but changing the background colour by geling the flash.
Coloring background with flash

I found I needed to snoot the flash pointing at the flower or otherwise too much light would spill out onto the background. Geling the flash seemed to work at getting a coloured background. I used my Manfrotto 682B self standing monopod as a light stand, and I think it works well in this capacity due to its small footprint.

Then I wanted to get a spotlight on the background as well, I tried using an SB-800 zoomed to 105mm, but the flash size was still too large (I was doing a reasonably close-up shot of a flower, and the background was only about 50cm away from the flower, so the total background size in shot wasn't that big). So I tried snooting the flash, and that was better, but the flash made the background go white where it was hitting (and it was still hitting quite a large area). So I tried some coloured filters and a 1 stop ND filter. The 1 stop ND filter worked quite well, but I didn't really like the shape of the spotlight.

I really wanted a more rounded spotlight effect on the background, so I tried stuffing my Miranda 24mm/2.8 Macro lens in the end of the snoot. This didn't work too well as the snoot was too long and the lens too heavy, so I tried it with a shorter snoot. It did work, but the results were different to what I was expecting. Instead of casting a round shape, it cast a shape that looked like blinds. I tried adjusting the focus on the lens and reversing it, but it didn't seem to make much difference. It didn't give the round shape I was looking for anyway.

So I just made a round cone shape out of a piece of paper and stuck this in the end of the long snoot, and this gave me a nice round shape, though once I had it, I wasn't sure if it was actually any better than the non-round shape or even just a plain background with no spotlight.

I received the 'Videogames ruined My Life' CD by PIXELH8 today, which I had ordered a few days ago. It cost me £8 including postage. I was a bit disappointed by the packaging, it was just a CDR with a printed label, and packaged in a CD Wallet with a B&W cover/back slip. I put it in the computer and loaded up EAC, and it wasn't in the FreeDB database so I had to enter the tracklisting and details myself. I tried to update the FreeDB database to save anyone else who gets the CD some time, but the FreeDB database rejected my request.

Listening to it, I was a bit disappointed as well. It's not a bad album, but is a bit repetitive and really doesn't compare well with the awesome Amiga Chip tunes I've heard before. Being reminded of how good the Amiga Chip tunes are I decided to see if I could download any more.

I like the clever website design of chiptune.com. They have tracks available created on a range of systems. So far I've downloaded the amiga collection, ZX collection and famicom collection. I also visited chiptunes.org, which just has one archive you can download. Unfortunately when I tried to unzip it I got a message saying the archive was corrupted.

Then I noticed the archive was a tar.gz, so I downloaded it on Ubuntu and tried to unzip it there. But I couldn't get that to work either. After a bit of googling I found I needed to GUnzip it, and then untar it. After doing that I needed to copy it over to windows. However a few files wouldn't copy, one was a link and the other 2 had foreign characters. I spent ages googling about how to sort the problem. I think that the filename must have been encoded in something other than UTF-8 (in Nautilus the filename had a question mark in a black diamond instead of the foreign character).

I tried adding some stuff about character encoding to vsftpd.conf, which then broke it so I couldn't connect to Ubuntu via ftp at all. So I commented out the lines I'd added, and then the files all downloaded okay. Weird!

After that I tried playing the files in winamp, but it didn't work, they were all loads of different file types I'd never heard of, like .aon. Googling I couldn't find anything about playing .aon files, but on chiptunes.org it has a list of players on the left hand side. xmp sounded like a good player since it said it supported lots of players, and I'd like to limit my media players to as few as possible. I downloaded it and the plugin for the Audacious media player in Ubuntu. I also downloaded it and the winamp plugin for windows.

Unfortunately the winamp plugin didn't seem to work (it still wouldn't play the files), and I didn't want to be messing about on the commandline to play tracks. So I googled for something like Amiga chip player, and found a link to a player called DeliPlayer. I'm using it now, and it seems to work great (though only played .aon and .amad files so far).

After dinner I watched the first 2 episodes of season 4 of trashelstar with Mac. The first one was quite good, but in the second episode Trashelstar Trashlactica lived up to its name.

Then after that I did some more work on getting Exiftool working with PHP. I got it working okay where PHP called a perl script that used the Exiftool perl module and then returned a string in the form of an array that PHP could parse. However, when calling Exiftool directly from PHP, PHP couldn't decode the JSON that Exiftool generated. I think this is because of the single quote mark ' characters in the Geo co-ordinates. However I don't see why there should be a problem with these chars since they're wrapped inside a string surrounded with double quote marks ". I couldn't see anything on the PHP json_decode() page about this either.

I'll have to look into this more tomorrow.

The weather today was a mixture of clouds and sun with a very cold strong blustery wind. It rained for a few minutes in the afternoon and there wasn't much of a sunset as the sun set behind a bank of cloud.

Food
Breakfast: Lemon marmalade toast sandwich; cup o' tea.
Lunch: 2x cheese on toasts; French style salad; red grapes; slice of Madeira cake; cup o' tea.
Dinner: Pasta; tomato sauce for pasta stuff; bacon; green beans; small mushrooms; parmegiannio or sumat cheese. Pudding was forest fruits and custard strudel. Coffee; piece of Cadbury's Dairy Milk Turkish.

Sunday 8 March 2009

Blogger isn't inserting line breaks

This morning I went on Animal, then we went to Church.

After Church I checked my email and Deviant art, then it was jin the pinner time.

After dinner I watched 'In the Shadow Of The Moon' with Mac, Ben and Matthew, which was quite good. It was just interviews with astronauts who had been to the moon and archive footage. It was a bit boring, but I found it quite interesting really. After that I checked the Luminous Landscape, Moose Peterson's blog, dpreview canon lens forum and Juza Nature Photography forum.

Then I started to look at geocoding again, particularly reverse geocoding. The point of this is so that when you geocode your image it can automatically be tagged with the name of the place where you took it, as well as the lat/lon. The google maps API has this built in, but after some googling it seems that the Yahoo Maps API doesn't do reverse geocoding.

I found this Flickr dev blog post about how they've added reverse geocoding to Flickr. There they say they're using Yahoo! GeoPlanet to do the reverse geocoding.

I thought I'd look at how GPicSync looks up the place names when geocoding. They use a service called GeoNames, which is free to use.

After playing with the Yahoo! GeoPlanet for a bit, it seems you can't actually reverse GeoCode from that. You can only search by place name or WOEID. So I will have to look at GeoNames for reverse GeoCoding with Yahoo.

In the evening I watched the latest episode of Lost again with Mac and Ben, then we watched a programme where Heston Blumenthal made a Victorian style dinner for some people.

Then the rest of the evening I was trying to work out how to get the reversed geocode data from GeoNames.org. The answer was that rather than using XMLRequest, you have to just insert a <script> tag into your page and set the src of that script tag to the url you are using to request the data. In the url you specify a callback function. You have to do it this way as the normal XMLRequest AJAX method doesn't work cross domain. I also tried using an image with the src set to the url I was requesting the data from, but this didn't seem to do anything. And I tried an Iframe with the src set to the url I was requesting the data from, but this just prompted me to download the remote server's response. Here's a good guide to Using JSON to Exchange Data that explains both how it works and how to use it.

Blogger is being quite annoying today, and isn't inserting line breaks when I press enter, so I'm just having to write this as one big text block in the HTML view and typing <br> where I want line breaks. I guess I should probably use paragraphs really.

The weather today was nice first thing, then rainy when we came home from Church until about 2pm. Then it was a mixture of sun, clouds and showers the rest of the day.

Food
Breakfast: Maple & Pecan crunch cereal with Crunchy Nut Cornflakes; cup o' tea.
Dinner: Chicken Curry; rice; sultanas. Pudding was Ice cream with toffee sauce. Coffee; Quality Street; Happy Hippo.
Tea: Ibuprofen; Mature cheddar cheese with French style salad sandwich; Packet of Chilli flavour Doritos; Red grapes; Slice of home-made blackcurrant jam Victoria sandwich cake; cup o' tea.
Supper: Coffee with Dooleys; Dark chocolate digestive.

Saturday 7 March 2009

Google and Yahoo Maps APIs

This morning I took some photos of yellow tulips.

The rest of the day I was playing with the Yahoo and Google Maps APIs. In the evening I also watched the latest episode of the Office with Mac and a Star Trek TOS episode with Mac and Ben.

Unfortunately it seems that the Google Map Geocoder isn't accurate with UK postcodes. Apparently this is due to licensing restrictions by the Post Office. The Yahoo map geocoder worked accurately with a UK postcode though.

Food
Breakfast: Lemon marmalade toast sandwich; ibuprofen; cup o' tea.
Lunch: Grated mature cheese with French style salad sandwich made with fresh bread-maker-made bread; Crust of fresh bread-maker-made bread with honey; Red grapes; slice of Madeira cake; Chocolate Waver bar; cup o' tea.
Dinner: 2x Delee sausages; mashed potato; small mushrooms; peas; baked beans; tomato ketchup. Pudding was apple pie with custard and squirty cream. Coffee.
Supper: Dark chocolate digestive; cup o' tea.

Friday 6 March 2009

Nice weather so went on a walk

This morning I checked my email and the web squeeze, then the weather was too nice so I had to go out. I went up the footpath just after the bridge, then across the field towards Farndon. When I got to the hedge between that field and the next field I went right, and then along the edge of the field and back down to the muddy track. There were lots of birds along the edge of that field, perching in the trees. Unfortunately I didn't get any good photos because as soon as I got (not very) near them they would fly away.

If I stayed still for a while then sometimes birds might come and perch in the trees nearby, but they would be obscured by the tree branches and still too far away for a good photo. I used the D200 + 70-300mm VR lens and found that as well as being too short it would have trouble focusing on the birds and tended to focus on branches behind them.

I went down the muddy track towards Lubenham, and when I got to the bit where the track ends and becomes a footpath, there were lots of birds down that footpath bit as well. I saw Robins, Bluetits, Chaffinches, Bullfinches, Yellowhammers, Goldfinches, and other birds I didn't recognise, but I guess buntings of some sort.

Then I walked down the road towards Lubenham, and in the field that used to be full of Ragwort and thistles that the farmer has now cultivated, there were some orange crocuses growing in amongst the crop, which I thought was quite strange. I didn't see any birds in the long grass on the other side of the road.

Then I walked back towards home across the field full of black plastic wrapped haybales.

I got home about 12.30pm, in time for lunch. After lunch I checked the Luminous Landscape and my email, then I went to see Trevor whose computer wasn't switching on. Unfortunately I couldn't help him with the computer, but the problem was similar to one I had when my power supply was the cause. So I suggested he just do the same as I did when I had the similar problem, and get someone professional to look at the computer and they could see what the problem is.

After that I opened and ironed my sheets, which had arrived in the post today. That took quite a long time and I got quite worn out from standing up for so long.

Then I checked the web squeeze again and started checking my email again, then it was dinner time.

After dinner I watched The Blues: Red, White and Blues with Mac. It was about british blues artists, and was quite interesting as it had Van Morrison in it, who I didn't know was a blues singer. It also had a snippet of a performance by Sister Rosetta Tharpe (not from the UK though), who was great:


After watching that I went on Animal for a bit. Annoyingly I went into Nooks and he said 'Welcome Rusty' or whatever it is he said, then straight away he said it was closing time and I had to leave. What was the point in welcoming me and then telling me to leave straight away, eh Nook?

The weather was sunny most of the morning, then started to cloud over about 11.30am. In the afternoon it was a mixture of cloud and sun. It was cloudy in front of the sun at sunset, so there wasn't a sunset.

Food
Breakfast: Lemon marmalade toast sandwich; cup o' tea.
Lunch: Grated mature cheddar cheese with French style salad sandwich; banana; mince pie; chocolate waver bar; cup o' tea.
Dinner: 2x fish cakes; cheesey mashed potato; potato; peas; tomato ketchup. Pudding was a piece of Tiramisu with squirty cream. Coffee.

Thursday 5 March 2009

running exiftool/perl scripts from php

This morning I was trying to get my perl script to run in php. Googling for this I found a number of methods:
  1. Perl Extension for PHP
  2. Use the php function proc_open
  3. Use the php function exec
  4. Use the normal command to run the script from the command line as the value of a php variable, but surround it with backticks instead of quotes


I tried #3 and #4 out of those, of which #4 worked.

Next I tried to make it so I could pass the image filename from php to the perl script. I found out how to do that here: Passing parameters to perl script. You just call your script from php like $var = `/usr/bin/perl -T /home/brighto/public_html/photosite/cgi/test2.cgi '$file' 'EXIF'`; Then in the perl script you access your variables through @ARGV[0] for $file and @ARGV[1] for 'EXIF'.

I then modified my perl script so that it would output text in the format for a php array, then in the php file I eval'd the variable that called the perl script.

However, the eval wasn't working as there were some ' in the exif values, so this was messing up the array. I searched for how to escape quotes in perl, I thought there must be a function you could use but I couldn't find any other than in some modules you can add.

So I decided I might as well just use a basic string replacement. I found a couple of helpful tutorials on this: Search & Replace Strings in Perl and Substitution and translation in Perl. In both examples it seems you can only do the replacement when setting a variable value, unlike php where you can just print the str_replace() function.

After that I looked a bit at running perl through fastcgi to speed it up a bit. However it seems I would to re-build perl. Since my web host may well not have a fastcgi version of perl installed I don't think it's worth the trouble of trying it.

After lunch I went on Animal, then checked my spleenmail. Then I changed my php script to call exiftool directly rather than through my perl script. I got it working okay and also managed to get it working using the exec function - I needed to specify the location to perl (so /usr/bin/perl instead of just perl).

The only problem was that the output wasn't in a format easily convertible to a php array. I googled for 'exiftool php' and found this thread about using the exiftool library from php (in place of native php function). There the request is to get exiftool to output xml.

I played about with trying get PHP to parse the XML that exiftool output, then read that ExifTool can output JSON, so I tried that instead.

After dinner I watched Lost s05e08 with Mac and Ben, ultimate as usual, but I hope they have more about the time when there was a giant statue on the island in the future.

Then after that I did a bit more work on php script that calls exiftool directly. Using the -j parameter to get ExifTool to output the tags in JSON format it looked good, but there were some fields missing, like the GPS Longitude. So I got the two scripts working on the webserver, and then posted to the ExifTool forum so hopefully someone can help me there.

After that I checked my email, the canon lens forum on dpreview and the websqueeze.

The weather was cloudy but sunny again most of the day. It did sleet for a few minutes, but then soon stopped and became sunny again. There was a nice sunset today.

Food
Breakfast: Lemon marmalade toast sandwich; cup o' tea.
Lunch: Mature cheddar cheese with french style salad sandwich; clementine; mince pie; caramel Wacko (Michael Jackson endorsed fake Caramel Rocky); cup o' tea.
Dinner: chicken & mushroom in a white wine sauce pie; green beans; potato; swede. Coffee.
Supper: American style chocolate brownie cookie; milk chocolate digestive; cup o' tea.

Wednesday 4 March 2009

Perl script to run ExifTool on a web server

This morning I took some more flower photos, then I calibrated my monitor. Unfortunately the spyder kept falling off the screen even though I stuck it on as hard as I could. So I had to sit looking at the screen for a few minutes while the spyder did its job, then hold it in place when the top sucker came unstuck. It was still really hard to unstick after it was done though. Possibly it falling off may be because I cleaned the screen before attaching it, though I would have thought this should make it stick better.

After that I updated yesterday's blog post with some links to the stuff I was on about as I didn't have time to do that when I wrote it last night. In searching for the stuff I was on about I came across this nice article at Sitepoint: Open Source Image Archiving: Exif, IPTC, XMP and all that.

Then I restarted my PC as it had finished downloading some Windows updates. Next I started trying to get a perl script to run in my local web development environment. I was following the tutorial at and just copy and pasted the example there to make sure it works. Unfortunately it didn't, and after quite a bit fo testing and searching I found I needed AddHandler cgi-script .cgi .pl to my site config file. Thanks to How to Add Perl CGI Script Support to Your Apache 1.x Web Server on Windows for this info (It's the same for Linux and Apache2).

I had already added directory info to the site config


AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all



and changed the permissions on the .cgi file so that it could be executed.

After lunch I went on Animal, the after that I got my perl script working with EXIFtool to print the metadata, seperated by tag name. The script is quite slow, I think probably because I call the ExifTool->ImageInfo() function for each tag. it would be better to just call it once getting all metadata, and then seperate it out into the tag 'families'. Unfortunately I don't know enough about ExifTool or Perl to do this. Anyway, the script looks like this:

#!/usr/bin/perl -T

use 5.010;
use CGI;

use strict;
use warnings;

my $q = CGI->new();
say $q->header(), $q->start_html();

say "

Parameters

";
my $file = '../_DSC9229sRGB.jpg';
$file = '../Bitteswell Church _DSC4883.jpg';
use Image::ExifTool qw(:Public);
my $exifTool = new Image::ExifTool;
my @metaTags = qw(JPEG EXIF IPTC XMP GPS GeoTiff ICC_Profile PrintIM Photoshop Canon CanonCustom Casio FujiFilm HP JVC Kodak Leaf Minolta Nikon NikonCapture Olympus Panasonic Pentax Ricoh Sanyo Sigma Sony Unknown DNG CanonRaw KyoceraRaw MinoltaRaw SigmaRaw JFIF FlashPix APP12 AFCP CanonVRD FotoStation PhotoMechanic MIE Jpeg2000 BMP PICT PNG MNG MIFF PDF PostScript ID3 ITC Vorbis FLAC APE MPC MPEG QuickTime Flash Real RIFF AIFF ASF DICOM DjVu HTML EXE Rawzor ZIP Extra Composite Shortcuts);
my $info;
my $tag;
foreach $tag (@metaTags)
{
print "

$tag

";
$info = $exifTool->ImageInfo($file, "$tag:*");
foreach(keys %$info)
{print "$_ => $$info{$_}
\n";}
}
say $q->end_html();


The tags array is just a list of all available tags from ExifTool Tag Names.

After that I tried to get the script to work on the web server. The first problem I had was that it was just saying access forbidden. It said to check the site error logs, but there weren't any (other than a PHP error log and an access log).

I thought maybe it was the same problem that I had when I first running a cgi script in my local environment this morning - that is that the site config lists a script alias for /cgi-bin that points somewhere like /usr/bin/cgi-bin, so if you have a cgi-bin folder on your site it's pointless as /cgi-bin doesn't point there.

So I made a new folder called 'cgi' and added an .htaccess file to it so cgi scripts could be executed in that folder. It took me quite a while to get that working, mainly because I just copied the block to do with cgi from the site config and pasted it into an .htaccess file. Eventually I found out that <directory> directives can't be placed in .htaccess files.

After getting that working, the script was still giving a forbidden error. So I checked the web server directory structure for error logs again, but still couldn't find one. I also tried setting the errorLog directive in an .htaccess file, but the errorLog directive can't be set in .htaccess files either. Then I thought to try the site's cpanel, and indeed there was an error log option on there, which displays the last 300 errors.

There I could see what the error was - my script was requiring Perl 5.10.0, but my host only had version 5.8.8. Unfortunately I can't copy the exact error message now as the errorlog seems to have been wiped. I guess cpanel clears the log after you've looked at it or sumat stupid.

Anyway, I found out how to change what perl version you reuqire. I wrote the version in the form v5.8.8 since this seemed to work okay on both my localhost and the web server.

Then I got an error message something like
Can't locate xxx.pm in @INC (@INC contains...


I did some googling and read this useful article: What to do when Perl modules
aren't in their normal locations
. I changed my script by commenting out (Comment Out a Block of perl Code) all the exif stuff. Then I added the follwing to my perl script:

my $loc;
print '

@INC

';
foreach $loc (@INC)
{print "$loc
\n";}


So that prints a nice easy to read list of where perl is looking for modules. Using that I found out where the ExifTool module(s) were saved (it was /usr/local/share/perl/5.10.0/Image). I then copied the Image folder, and placed it in a folder called 'perlModules', which I created in my home folder below the site root. Then in the perl script I added use lib '/home/username/perlModules';.

I uploaded it all to the web server, and got a different error about 'RandomAccess.pm' not being found. I found that in the same directory as where the Image::ExifTool module was located, so copied that across to my perlModules folder, uploaded it to the web server, and now the script worked. Woohoo.

I'm not sure if I will use ExifTool for my photo site, but it's certainly nice to have it available.

After getting that working I started checking my email, then it was dinner time.

After dinner I checked my email a bit more, then watched Flight of the Chonchords s02e07. After that I finished checking my email. Then I checked dpreview where there had been quite a few announcements from PMA on the front page. In the canon lens forums a few people had responded to my question about shooting butterflies, and said that 1/200s should be high enough shutter speed to get them without motion blur. I guess I just need to practice my hand holding technique to avoid camera shake.
In the process of reading some threads in the dpreview fora, I followed a link through to Flickr. So I checked my own Flickr, and they said that you could now create as many sets as you want. So I created some sets and moved the appropriate images into them.

The weather was nice and sunny with a blue sky in the morning, then as the morning went on large textured clouds rolled in. It was a mainly cloudy blue sky (but still sunny) for the rest of the day.

Food
Breakfast: Lemon marmalade toast sandwich; cup o' tea.
Lunch: Cicken Tikka Sandwich spread with sweet & crunchy salad sandwich; clementine; mince pie; Chocolate Waver bar; cup o' tea; piece of Sainsbury's caramel chocolate.
Afternoon Snack: Cadbury's hot chocolate drink with Dooleys; hobnob; milk chocolate digestive.
Dinner: Beef burger with grated cheese, tomato ketchup and sweet & crunchy salad in a cob. Baked beans; Roast potato. Pudding was a peach & passion fruit creamy yoghurt. Coffee; piece of Cadbury's Dairy Milk Turkish.