Cobham Road – Twilight

November 2nd, 2011

Everyone knows that sunsets are beautiful. What a lot of people don’t realise is that a short time after sunset, the sky turns a deep saturated blue which looks beautiful when you shoot it with a camera. Our eyes usually don’t pick it up just how saturated a blue it is, but cameras can because we can tell them to leave the shutter open a little longer to pick up more light. Here’s a shot of a a colourful block sculpture shot during this time.

Twilight, also known as “blue hour” to photo enthusiasts, lasts for around 30 minutes and the sky changes a lot during this time. I took a number of photos during this session over about 15 minutes, and the one above had the right balance between the foreground blocks and the background sky. 5 minutes earlier the sky was a bit too light for my liking, and 5 minutes later it was bit too dark.

During blue hour you need a camera that either has a fast lens, a sensor capable of high ISO or a tripod. I’ve shot this with a Nikon D3100 with the stock 18-55mm lens which in itself isn’t fast, but the camera can comfortable shot ISO-3200 so I can do this handheld. Yay for modern sensors :-) Also anything in the foreground needs to be bright, it either needs to be lit up by artificial lights like the blocks were, or you need to use a flash. Otherwise you’ll be shooting silhouettes (which is also fine if that’s what you’re after). I used +0.7 exposure compensation to let more light in, highlights got majorly blown, but I didn’t care I was shooting colours, not details.

Once blue hour was over, I moved over the marina which was close by and busted out my tripod. The water was almost perfectly still which meant I was able to get a great reflection in the water and have the boats sit (mostly) still. I took a few shots at different ISO speeds because I wasn’t sure how long I could leave the shutter open for with the slight amount of bobbing up-and-down the boats were doing. I ended up liking the ISO-400 (6 seconds) shot the best, the ISO-100 (25 seconds) was too blurry.

Photo failure – red splotch

November 2nd, 2011

It was overcast yesterday so I was struggling to find something to take a photo of. Overcast days tend to make for boring light because there’s a lack of strong side shadows – the light comes from all directions and shadows are top to bottom. Found an area by the railway station by the large pillars out front that had some side shadows and a big splotch of red.

Unfortunately the photo still failed.

There are a couple of problems here. The focus on the picture is the big red splotch – though unfortunately the area with the most light is the top left hand corner which is NOT where the viewers focus should be. Also the big red splotch isn’t contained within the frame and leads the viewers eye out of the top.

Back to basics

October 31st, 2011

I’ve had a lull in my photography for a couple of weeks because I was doing work in photoshop instead of just taking photos. Photosop is great for making your photos look better, but it’s not photography. It’s not getting out to different places and looking at light and different perspectives. It’s just not as fun or as memorable. Photoshop will not make you better photographer. Also it feels too much like work.

Back of parliament

I needed to get back to basics. I took my trusty Ixus 130 for a little walk during lunch up to parliament to grab a few shots. I found this area at the back of parliament where there’s a very nice lawn and some seats where people eat their lunch.

Since I’m not doing any photoshop, I set the camera to vivid colours + cloudy white balance. Whatever comes out of the camera is what I use. Aaah, simple pleasures in life :-)

Front yard

Light was very nice around 5.30pm, decided to grab a few shots in the front yard. Definitely back to basics :)

This first show is of clover which is backlit, meaning that the sun in in front of me and therefore behind the subject. When vegetation is backlit it often shines through showing off subtle details.

The second show is a close-up shot of a something growing on our trellising shot against a lovely blue sky. I was initially attracted by the little red jewel like details on it.

Though upon closer inspection it turn out that the little red jewels aren’t part of the plant – they are insects! Loads of them! Click on the image to get a close up view.

I wonder if the insects know that it’s Halloween tonight?

Boathouse, Evans Bay Parade

October 31st, 2011

I was part way through a 23km long board around Wellington bays on a beautiful sunny day when I saw this boat house and I just had to take a quick stop to photograph it. I was attracted to it’s unusual, vivid colours. As a bonus got a nice reflection from the water. Makes me wonder how the stilts it stands on are driven in to the ground below it.

Two female longboarders went past me in the other direction while I was taking this which was really unusual, I’ve been along this road a few time but never seen other longboarders there. It’s also rare to see girls on longboards. Good on them :-)

Simple threading example in C# / CSharp

June 17th, 2011

Threading example – idea is that you can copy and paste this code in to get you started quickly.

using System;
using System.Threading;

class ThreadJobClass
  {
    public bool fetching = false;
    public bool fetched = false;
    public string value = null;

    protected int rand;

    public ThreadJobClass(int _rand)
    {
      rand = _rand;
    }

    public void run()
    {
      try
      {
        fetching = true;
        Console.WriteLine("Fetching from " + rand.ToString());
        Thread.Sleep(rand);
        value = rand.ToString();
      }
      catch (Exception e)
      {
        Console.WriteLine(e);
      }
      finally
      {
        fetching = false;
        fetched = true;
      }
    }
  }

  class Program
  {
    static void Main(string[] args)
    {
      var insts = new List();
      var my_random = new Random();
      for (var i = 0; i < 5; i++)
      {
        var rand = my_random.Next(2000);
        var inst = new ThreadJobClass(rand);
        insts.Add(inst);
      }
      var num_fetched = 0;
      var num_fetching = 0;
      var max_fetching = 2;
      while (num_fetched < insts.Count)
      {
        foreach (var inst in insts)
        {
          if (num_fetching == max_fetching) break;
          if (inst.fetching || inst.fetched) continue;
          var ts = new ThreadStart(inst.run);
          var thread = new Thread(ts);
          thread.Start();
          num_fetching++;
          break;
        }
        num_fetched = 0;
        num_fetching = 0;
        foreach (var inst in insts)
        {
          if (inst.fetching) num_fetching++;
          if (inst.fetched) num_fetched++;
        }
        Thread.Sleep(150);
      }
      Console.WriteLine("Done");
      foreach (var inst in insts)
      {
        Console.WriteLine(inst.value);
      }
    }
  }

Installing .NET 4 – Error 1719

March 1st, 2011

Was having a lot of trouble installing .NET 4 on to Windows 7 Home Premium 64 SP1

The solution was:

regedit

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\MSIServer

Change WOW64 from 1 to 0

cmd

%windir%\system32\msiexec.exe /unregister
%windir%\syswow64\msiexec.exe /unregister
%windir%\system32\msiexec.exe /regserver

And then it was fine :-)

My error log looked like this

MSI (s) (DC:FC) [20:37:13:023]: Invoking remote custom action. DLL: C:\Windows\Installer\MSICE11.tmp, Entrypoint: SchedSecureObjects
MSI (s) (DC:B8) [20:37:13:024]: Generating random cookie.
MSI (s) (DC:B8) [20:37:13:051]: Created Custom Action Server with PID 1884 (0x75C).
MSI (s) (DC:98) [20:37:13:092]: Running as a service.
MSI (s) (DC:98) [20:37:13:094]: Custom Action Server rejected – Wrong Context
MSI (s) (DC:B8) [20:37:13:097]: CA Server Process has terminated.
Action start 20:37:13: SchedSecureObjects_x64.
MSI (s) (DC:94) [20:37:13:098]: Note: 1: 1719
CustomAction SchedSecureObjects_x64 returned actual error code 1601 (note this may not be 100% accurate if translation happened inside sandbox)
MSI (s) (DC:94) [20:37:13:738]: Product: Microsoft .NET Framework 4 Client Profile — Error 1719. The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance.

Error 1719. The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support

Cloning arrays in python

April 11th, 2010

For single dimensions arrays:

a2 = a[:]
non-scalers within array will be copied as references. Does the same thing as copy.copy()

For multi dimension arrays:

import copy
a2 = copy.deepcopy(a)
non-scalers within array will be cloned as new objects

Python print_r or var_dump

January 22nd, 2010

If you’re coming from PHP, you may be wondering how to do a print_r or var_dump.

import pprint
pprint.pprint(myobj)

Fix loud or stiff space-bar Microsoft Ergonomic Keyboard 4000

December 27th, 2009

The Microsoft Natural Ergonomic Keyboard 4000 is an excellent product, no other keyboard really comes close to it for touch typing in my opinion.

However there can be one very annoying bit – the spacebar.  It can be excessively loud and/or stiff to press.  Fortunately though you can easily fix it yourself!

Loudness:

The problem is that the bottom of the plastic space bar connects with some plastic on the keyboard base.  To fix this you’ll want to add some cushioning to the base of the keyboard which you’ll find easy to do yourself.

First of all, you need to pull the spacebar off the keyboard, which is easiest if you pull from the top.  You’ll need to use a bit of force, though don’t worry your keyboard will be ok :-) .  Once the space bar is off you can put in your cushioning.  The image below shows where you’ll be attaching your cushions.

base-bits

I made my cushions from inexpensive heat-shrink tubing filled with some cotton wool and attached it to the keyboard with some double-sided tape, though you could easily substitute this with whatever else you have around, just as long as it is nice and squishy.  The image below show what it should it looks likes with one of the cushions.

cushion

Once the cushioning is in, remount the space bar and you should be good to go!

Stiffness:

The space-bar can sometimes be stiff to press, particularly on its side-edges.  The stiffness will usually go away after a period of normal use, though you can speed this natural process up a bit by simply tapping it a couple of thousand times where your thumbs normally press it.  For me this spot is underneath the ‘V’ key on the left and about halfway across the ‘N’ key on the right.  Just sit there and tap these spots really fast for several minutes.  You can also try pressing with very little pressure in order to get the key to stick, and then apply more pressure so that it rubs really hard inside the keyboard.  Press on the top corners of the space bar to get even more resistance.

If this doesn’t work, this you’ve basically got a dud that will only frustrate you, so return it to the shop and get another one!

Perl in_array()

December 17th, 2009

Perl can use the grep function as the equivalent of PHP’s in_array() function.  Essentially

$found = grep $_ eq $my_value, @my_array

Note, the grep() function is world unto its own, it can do quite a bit more than just this.  $found is actually $my_value if it finds it, which tends to evaluate to ‘True’ in Perl.