<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>emtek.net.nz &#187; Other</title>
	<atom:link href="http://www.emtek.net.nz/blog/category/other/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.emtek.net.nz/blog</link>
	<description></description>
	<lastBuildDate>Tue, 31 Jan 2012 08:03:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Simple threading example in C# / CSharp</title>
		<link>http://www.emtek.net.nz/blog/2011/06/17/simple-threading-example-in-c-csharp/</link>
		<comments>http://www.emtek.net.nz/blog/2011/06/17/simple-threading-example-in-c-csharp/#comments</comments>
		<pubDate>Fri, 17 Jun 2011 00:58:22 +0000</pubDate>
		<dc:creator>Steve Boyd</dc:creator>
				<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://www.emtek.net.nz/blog/?p=158</guid>
		<description><![CDATA[Threading example &#8211; 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() [...]]]></description>
			<content:encoded><![CDATA[<p>Threading example &#8211; idea is that you can copy and paste this code in to get you started quickly.</p>
<pre>
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<ThreadJobClass>();
      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);
      }
    }
  }</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.emtek.net.nz/blog/2011/06/17/simple-threading-example-in-c-csharp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing .NET 4 &#8211; Error 1719</title>
		<link>http://www.emtek.net.nz/blog/2011/03/01/installing-net-4-error-1719/</link>
		<comments>http://www.emtek.net.nz/blog/2011/03/01/installing-net-4-error-1719/#comments</comments>
		<pubDate>Tue, 01 Mar 2011 08:41:30 +0000</pubDate>
		<dc:creator>Steve Boyd</dc:creator>
				<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://www.emtek.net.nz/blog/?p=155</guid>
		<description><![CDATA[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: [...]]]></description>
			<content:encoded><![CDATA[<p>Was having a lot of trouble installing .NET 4 on to Windows 7 Home Premium 64 SP1</p>
<p>The solution was:</p>
<p>regedit</p>
<p>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\MSIServer</p>
<p>Change WOW64 from 1 to 0</p>
<p>cmd</p>
<p>%windir%\system32\msiexec.exe /unregister<br />
%windir%\syswow64\msiexec.exe /unregister<br />
%windir%\system32\msiexec.exe /regserver</p>
<p>And then it was fine <img src='http://www.emtek.net.nz/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>My error log looked like this</p>
<p>MSI (s) (DC:FC) [20:37:13:023]: Invoking remote custom action. DLL: C:\Windows\Installer\MSICE11.tmp, Entrypoint: SchedSecureObjects<br />
MSI (s) (DC:B8) [20:37:13:024]: Generating random cookie.<br />
MSI (s) (DC:B8) [20:37:13:051]: Created Custom Action Server with PID 1884 (0x75C).<br />
MSI (s) (DC:98) [20:37:13:092]: Running as a service.<br />
MSI (s) (DC:98) [20:37:13:094]: Custom Action Server rejected &#8211; Wrong Context<br />
MSI (s) (DC:B8) [20:37:13:097]: CA Server Process has terminated.<br />
Action start 20:37:13: SchedSecureObjects_x64.<br />
MSI (s) (DC:94) [20:37:13:098]: Note: 1: 1719<br />
CustomAction SchedSecureObjects_x64 returned actual error code 1601 (note this may not be 100% accurate if translation happened inside sandbox)<br />
MSI (s) (DC:94) [20:37:13:738]: Product: Microsoft .NET Framework 4 Client Profile &#8212; 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.</p>
<p>Error 1719. The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emtek.net.nz/blog/2011/03/01/installing-net-4-error-1719/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cloning arrays in python</title>
		<link>http://www.emtek.net.nz/blog/2010/04/11/cloning-arrays-in-python/</link>
		<comments>http://www.emtek.net.nz/blog/2010/04/11/cloning-arrays-in-python/#comments</comments>
		<pubDate>Sun, 11 Apr 2010 03:48:29 +0000</pubDate>
		<dc:creator>Steve Boyd</dc:creator>
				<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://www.emtek.net.nz/blog/?p=149</guid>
		<description><![CDATA[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]]></description>
			<content:encoded><![CDATA[<p>For single dimensions arrays:</p>
<p>a2 = a[:]<br />
non-scalers within array will be copied as references. Does the same thing as copy.copy()</p>
<p>For multi dimension arrays:</p>
<p>import copy<br />
a2 = copy.deepcopy(a)<br />
non-scalers within array will be cloned as new objects</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emtek.net.nz/blog/2010/04/11/cloning-arrays-in-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python print_r or var_dump</title>
		<link>http://www.emtek.net.nz/blog/2010/01/22/python-print_r-or-var_dump/</link>
		<comments>http://www.emtek.net.nz/blog/2010/01/22/python-print_r-or-var_dump/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 08:30:25 +0000</pubDate>
		<dc:creator>Steve Boyd</dc:creator>
				<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://www.emtek.net.nz/blog/?p=142</guid>
		<description><![CDATA[If you&#8217;re coming from PHP, you may be wondering how to do a print_r or var_dump. import pprint pprint.pprint(myobj)]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re coming from PHP, you may be wondering how to do a print_r or var_dump.</p>
<p>import pprint<br />
pprint.pprint(myobj)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emtek.net.nz/blog/2010/01/22/python-print_r-or-var_dump/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fix loud or stiff space-bar Microsoft Ergonomic Keyboard 4000</title>
		<link>http://www.emtek.net.nz/blog/2009/12/27/fix-loud-or-stiff-space-bar-microsoft-ergonomic-keyboard-4000/</link>
		<comments>http://www.emtek.net.nz/blog/2009/12/27/fix-loud-or-stiff-space-bar-microsoft-ergonomic-keyboard-4000/#comments</comments>
		<pubDate>Sun, 27 Dec 2009 04:11:56 +0000</pubDate>
		<dc:creator>Steve Boyd</dc:creator>
				<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://www.emtek.net.nz/blog/?p=135</guid>
		<description><![CDATA[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 &#8211; the spacebar.  It can be excessively loud and/or stiff to press.  Fortunately though you can easily fix it yourself! Loudness: The problem [...]]]></description>
			<content:encoded><![CDATA[<p>The Microsoft Natural Ergonomic Keyboard 4000 is an excellent product, no other keyboard really comes close to it for touch typing in my opinion.</p>
<p>However there can be one very annoying bit &#8211; the spacebar.  It can be excessively loud and/or stiff to press.  Fortunately though you can easily fix it yourself!</p>
<h2>Loudness:</h2>
<p>The problem is that the bottom of the plastic space bar connects with some plastic on the keyboard base.  To fix this you&#8217;ll want to add some cushioning to the base of the keyboard which you&#8217;ll find easy to do yourself.</p>
<p>First of all, you need to pull the spacebar off the keyboard, which is easiest if you pull from the top.  You&#8217;ll need to use a bit of force, though don&#8217;t worry your keyboard will be ok <img src='http://www.emtek.net.nz/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> .  Once the space bar is off you can put in your cushioning.  The image below shows where you&#8217;ll be attaching your cushions.</p>
<p><img class="alignnone size-full wp-image-136" title="base-bits" src="http://www.emtek.net.nz/blog/wp-content/uploads/2009/12/base-bits.jpg" alt="base-bits" width="400" height="300" /></p>
<p>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.</p>
<p><img class="alignnone size-full wp-image-137" title="cushion" src="http://www.emtek.net.nz/blog/wp-content/uploads/2009/12/cushion.jpg" alt="cushion" width="400" height="300" /></p>
<p>Once the cushioning is in, remount the space bar and you should be good to go!</p>
<h2>Stiffness:</h2>
<p>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 &#8216;V&#8217; key on the left and about halfway across the &#8216;N&#8217; 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.</p>
<p>If this doesn&#8217;t work, this you&#8217;ve basically got a dud that will only frustrate you, so return it to the shop and get another one!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emtek.net.nz/blog/2009/12/27/fix-loud-or-stiff-space-bar-microsoft-ergonomic-keyboard-4000/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Perl in_array()</title>
		<link>http://www.emtek.net.nz/blog/2009/12/17/perl-in_array/</link>
		<comments>http://www.emtek.net.nz/blog/2009/12/17/perl-in_array/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 22:29:39 +0000</pubDate>
		<dc:creator>Steve Boyd</dc:creator>
				<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://www.emtek.net.nz/blog/?p=133</guid>
		<description><![CDATA[Perl can use the grep function as the equivalent of PHP&#8217;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 &#8216;True&#8217; in [...]]]></description>
			<content:encoded><![CDATA[<p>Perl can use the grep function as the equivalent of PHP&#8217;s in_array() function.  Essentially</p>
<p>$found = grep $_ eq $my_value, @my_array</p>
<p>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 &#8216;True&#8217; in Perl.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emtek.net.nz/blog/2009/12/17/perl-in_array/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Python in_array()</title>
		<link>http://www.emtek.net.nz/blog/2009/12/17/python-in_array/</link>
		<comments>http://www.emtek.net.nz/blog/2009/12/17/python-in_array/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 22:26:33 +0000</pubDate>
		<dc:creator>Steve Boyd</dc:creator>
				<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://www.emtek.net.nz/blog/?p=131</guid>
		<description><![CDATA[Python uses the &#8220;in&#8221; statement as the equivalent to PHP&#8217;s in_array() my_boolean = my_value in my_list You can view more PHP-Python statements here.]]></description>
			<content:encoded><![CDATA[<p>Python uses the &#8220;in&#8221; statement as the equivalent to PHP&#8217;s in_array()</p>
<p>my_boolean = my_value in my_list</p>
<p>You can view more PHP-Python statements <a href="/language-reference">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emtek.net.nz/blog/2009/12/17/python-in_array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python str_replace()</title>
		<link>http://www.emtek.net.nz/blog/2009/12/17/python-str_replace/</link>
		<comments>http://www.emtek.net.nz/blog/2009/12/17/python-str_replace/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 22:20:43 +0000</pubDate>
		<dc:creator>Steve Boyd</dc:creator>
				<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://www.emtek.net.nz/blog/?p=127</guid>
		<description><![CDATA[Python uses a function on the str/unicode object instead of a standalone function new_s = s.replace(match, replacement) You can view more PHP-Python statements here.]]></description>
			<content:encoded><![CDATA[<p>Python uses a function on the str/unicode object instead of a standalone function</p>
<p>new_s = s.replace(match, replacement)</p>
<p>You can view more PHP-Python statements <a href="/language-reference">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emtek.net.nz/blog/2009/12/17/python-str_replace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python sprintf()</title>
		<link>http://www.emtek.net.nz/blog/2009/12/17/python-sprintf/</link>
		<comments>http://www.emtek.net.nz/blog/2009/12/17/python-sprintf/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 22:18:32 +0000</pubDate>
		<dc:creator>Steve Boyd</dc:creator>
				<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://www.emtek.net.nz/blog/?p=125</guid>
		<description><![CDATA[Python uses the % operator to do a sprintf() function. &#8220;The %s brown %s&#8221; % (&#8220;quick&#8221;, &#8220;fox&#8221;) Brackets can be omitted if there for single arguments &#8220;The %s brown fox&#8221; % &#8220;fast&#8221; You can view more PHP-Python statements here.]]></description>
			<content:encoded><![CDATA[<p>Python uses the % operator to do a sprintf() function.</p>
<p>&#8220;The %s brown %s&#8221; % (&#8220;quick&#8221;, &#8220;fox&#8221;)</p>
<p>Brackets can be omitted if there for single arguments</p>
<p>&#8220;The %s brown fox&#8221; % &#8220;fast&#8221;</p>
<p>You can view more PHP-Python statements <a href="/language-reference">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emtek.net.nz/blog/2009/12/17/python-sprintf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python error/exception handling</title>
		<link>http://www.emtek.net.nz/blog/2009/12/09/python-errorexception-handling/</link>
		<comments>http://www.emtek.net.nz/blog/2009/12/09/python-errorexception-handling/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 05:19:01 +0000</pubDate>
		<dc:creator>Steve Boyd</dc:creator>
				<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://www.emtek.net.nz/blog/?p=115</guid>
		<description><![CDATA[This code quickly shows how to do basic error handling in python try: # None + 1 raise ZeroDivisionError except ZeroDivisionError: print 'You cannot divide by zero!' except: print sys.exc_info()[0] else: print 'No errors raised' finally: print 'Run Clean up actions']]></description>
			<content:encoded><![CDATA[<p>This code quickly shows how to do basic error handling in python</p>
<pre>try:
  # None + 1
  raise ZeroDivisionError
except ZeroDivisionError:
  print 'You cannot divide by zero!'
except:
  print sys.exc_info()[0]
else:
 print 'No errors raised'
finally:
 print 'Run Clean up actions'</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.emtek.net.nz/blog/2009/12/09/python-errorexception-handling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

