Wednesday, 19 November 2008

Testing 450D with 100mm macro & javascript inserting form

This morning it was nice and sunny. I installed some windows updates and uninstalled some programs I don't use. That took quite a while. Then I did a quick autofocus test with my 100mm f/2.8 Macro and 450d, it seemed to work although I was shooting something quite near (so not further than 10m away which is where I had the focus problems with the 18-55mm IS lens before).

Then I googled to see if there was any info on fixing the problem of the camera thinking there is an external flash attached and so not popping up the internal flash. I found this useful thread that tells you how to fix it: Pop up flash won't pop up. There's just a little switch in the flash hot shoe that you have to get to pop up, so was quite easy to fix really.

After fixing the flash I went out on a short walk to test the Autofocus on the 450d/100mm f/2.8 Macro. I got back home, copied the pics to my comp and processed them (plus lots of other pics that were on the memory card). I checked HotUKDeals while I was waiting for them to process. After they finished processing I loaded up a couple of the pics and they looked pretty decent.

I opened them in Canon DPP (Digital Photo Professional) so I could see where the focus point was when I looked at them. I looked on the various menus and in the options but couldn't see an option anywhere to show the focus points, so I googled to find out. I found that DPP doesn't have an option to view the focus points, and you need Canon Zoom Browser EX to do this. So I googled for that, and found a download for it after a bit of searching, downloaded it and installed it.

By 12pm the sky had clouded over and was grey.

After lunch I loaded up Canon Zoom Browser EX, it did let you view the autofocus points, but wouldn't let you zoom in on the image unless you process it (save to TIFF), which takes ages and means you can't view the autofocus points anymore. I looked through the images, one was quite obviously front focused, while the rest generally looked okay. They probably did have a bit of front focus but you had to zoom in quite a bit and be look at the plane of focus on the ground to see it. So probably okay, especially since all the shots were at f/2.8 where DOF is pretty shallow. I will have to try some portraits of Ben with it and see how it does.

I checked devianart, Andy Rouse's blog and my email. I noticed that play.com are selling a swearing turtle, what a great idea.Then I checked hotukdeals again and the web squeeze.

After that I did the speed tests on my site for adding the pogInfo form to a page using javascript.



Form as javascript string in page
Variables as javascript in page and form created in external js file
Form in HTML comment tags in page
Run Javascript PHP
Javascript PHP
Javascript PHP
Load (Pogs series 1) 616 -0.857728
189 0.031177
61 0.027013
Refresh 256 0.030574
224 0.028019
219 0.025946
Refresh 269 0.028654
243 0.030197
270 0.024961
Change page (pogs series 1 France) 39 0.028038
40 0.025669
39 0.024771
Refresh 44 0.026172
30 0.023173
41 0.024883
Refresh 41 0.027052
29 0.025426
28 0.021829
Change page (Hawaiian milkcaps) 28 0.023727
33 0.025262
36 0.026263
Refresh 28 0.023162
29 0.025512
27 0.022368
Refresh 28 0.027198
30 0.027173
52 0.022493
Change page (Pogs series 1) 359 0.028812
184 0.028129
180 0.024817
Refresh 232 -0.974759
224 0.030610
283 0.023591
Refresh 268 0.029023
245 0.030709
141 0.028573
Average (calculated without timings in red): 144.73 0.027241
125 0.027588
119.64 0.024792
JS avg as secs, PHP avg as millisecs 0.14 27.241200
0.13 27.588000
0.12 24.792333



Although my tests weren't really comprehensive, I was surprised at the timing results for the javascript. The PHP timings don't vary much, as PHP has the same work to do in writing variables each time. When the form is written as a javascript string, PHP escapes the whole string, whilst when the form is written in an external .js file PHP escapes each variable seperately. I guess this test shows there's not a lot of difference between escaping one long string or lots of short strings. PHP is quite a bit faster when the form is written in HTML comment tags - this is probably because the variables don't need escaping when they're not passed to javascript.

All the methods take the longest time on the Pogs Series 1 page, probably because this has lots of images on it and the other 2 pages don't have any images on them (the javascript times from the first script block to after the last script has run after page onload).

I'm still not sure what method to use. I like the method of writing the variables to javascript in the page and then building the form in an external .js file best, just because it is tidy. There's not much difference in the time taken by javascript between them, and although it is quite a bit more work for php (11% longer than writing the form in HTML comment tags), php still does it very quickly (at least on my PC, might be different on the server).

After dinner I watched Lost with Maccy and Ben. Then I went on my comp again and re-ran the javascript speed tests, except timing only the function that inserts the HTML. All scripts ran about the same speed, which I surprised about since the script that builds the form (rather than just getting the ready built form from a variable or inside some HTML comment tags) I would have thought would run much slower since it has much more work to do.

I posted a new topic on the websqueeze to see what people's thoughts were there on writing clean looking code or fast executing code. I think the main thing slowing php down when the form is written as javascript variables/ a string is that it has to real escape the countries select box, which is quite large. Since the countries aren't going to be changed very often, it would make sense to hardcode this rather than create it using php/mysql, then it won't need to be escaped.

After that I read some other threads on thewebsqueeze, mainly design ones and looked at some nice design sites. The design of my site is pretty rubbish, so I'll probably do some work on that once the site is working properly.

Food
Breakfast: Grapefruit marmalade toast sandwich; cup o' tea.
Lunch: Mature cheddar cheese with iceberg lettuce sandwich; clementine; slice of Jamaica ginger cake; Tesco's fake caramel Rocky (not that nice, the caramel was all hard); cup o' tea.
Dinner: 2x sausages; potato; baked beans; brown sauce. Pudding was strawberry whip with tinned apricot halfs. Coffee; 2x malteasers; Roses.

No comments: