<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>Various. This is about, who I am, what I do and things that are relevant to my interests :¬)</description><title>TWith2Sugars</title><generator>Tumblr (3.0; @twith2sugars)</generator><link>http://random.tonywilliams.me.uk/</link><item><title>Photo</title><description>&lt;img src="http://30.media.tumblr.com/tumblr_lpnglomIwx1qaguy0o1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;</description><link>http://random.tonywilliams.me.uk/post/8682237388</link><guid>http://random.tonywilliams.me.uk/post/8682237388</guid><pubDate>Tue, 09 Aug 2011 08:25:00 +0100</pubDate><category>tf2</category></item><item><title>Automatypewriter, an arduino project</title><description>&lt;iframe src="http://player.vimeo.com/video/15112974" width="400" height="533" frameborder="0"&gt;&lt;/iframe&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;&lt;span&gt;Automatypewriter, an arduino project&lt;/span&gt;&lt;/p&gt;</description><link>http://random.tonywilliams.me.uk/post/1471344778</link><guid>http://random.tonywilliams.me.uk/post/1471344778</guid><pubDate>Wed, 03 Nov 2010 16:16:21 +0000</pubDate><category>arduino</category></item><item><title>Inception explained for Mac Users
Image...</title><description>&lt;img src="http://24.media.tumblr.com/tumblr_l7pbaqrg8x1qaguy0o1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Inception explained for Mac Users&lt;/p&gt;
&lt;p&gt;Image from:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://twitpic.com/2hee34"&gt;&lt;a href="http://twitpic.com/2hee34"&gt;http://twitpic.com/2hee34&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://random.tonywilliams.me.uk/post/1008093430</link><guid>http://random.tonywilliams.me.uk/post/1008093430</guid><pubDate>Wed, 25 Aug 2010 10:20:49 +0100</pubDate><category>inception</category></item><item><title>graphicly:

ianbrooks:

geek-art: 8bitmonster: dr-8bit:



The...</title><description>&lt;img src="http://27.media.tumblr.com/tumblr_l4ii12sfW11qznzzoo1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;&lt;a href="http://couch.graphic.ly/post/807003700/evolution-gaming"&gt;graphicly&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;a href="http://ianbrooks.tumblr.com/post/806648157/evolution-gaming"&gt;ianbrooks&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;a href="http://geek-art.tumblr.com/post/802886740/evolution-gaming"&gt;geek-art&lt;/a&gt;: &lt;a href="http://8bitmonster.tumblr.com/post/802431052/evolution-gaming"&gt;8bitmonster&lt;/a&gt;: &lt;a href="http://dr8bit.com/post/801945927/evolution-gaming"&gt;dr-8bit&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;a href="http://www.flickr.com/photos/35699504@N00/4688382651/sizes/o/in/faves-82202517@N00/"&gt;The Evolution of Gaming&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/blockquote&gt;
&lt;/blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;I can’t wait for Mind Control to come out.&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://random.tonywilliams.me.uk/post/807025414</link><guid>http://random.tonywilliams.me.uk/post/807025414</guid><pubDate>Tue, 13 Jul 2010 17:38:54 +0100</pubDate></item><item><title>Hey Hey 16K!</title><description>&lt;a href="http://www2.b3ta.com/heyhey16k/"&gt;Hey Hey 16K!&lt;/a&gt;</description><link>http://random.tonywilliams.me.uk/post/634433770</link><guid>http://random.tonywilliams.me.uk/post/634433770</guid><pubDate>Wed, 26 May 2010 14:25:14 +0100</pubDate><category>b3ta</category></item><item><title>WPF 4 &amp; Spellchecking</title><description>&lt;p&gt;Using WPF 4?&lt;/p&gt;
&lt;p&gt;Want spell checking on your textbox?&lt;/p&gt;
&lt;p&gt;BAM: SpellCheck.IsEnabled=”True”&lt;/p&gt;
&lt;p&gt;I love it!&lt;/p&gt;</description><link>http://random.tonywilliams.me.uk/post/516146370</link><guid>http://random.tonywilliams.me.uk/post/516146370</guid><pubDate>Mon, 12 Apr 2010 19:04:02 +0100</pubDate><category>WPF4</category></item><item><title>Single instance app in WPF 4 with argument passing.</title><description>&lt;p&gt;I was building a WPF app that required the use of JumpLists; the thing with JumpLists is that it calls your app’s exe with an argument which in turn creates a new instance of your app.&lt;/p&gt;
&lt;p&gt;After a quick bit of googling I found a link [now dead] some code that restricts an app to a signle instance by using a mutex and passes the command argument supplied via named pipes.&lt;/p&gt;
&lt;p&gt;Only portions of the code was recoverable, the rest I created my self.&lt;/p&gt;
&lt;p&gt;Note that the code uses the .Net 4 Tasks, this can be replaced with threads if you want to use it in .Net 3.5. This also only passes the first argument through but can be easily changed to pass multiple.&lt;/p&gt;
&lt;pre class="brush: csharp"&gt;namespace Your.App
{
  using System;
  using System.IO;
  using System.IO.Pipes;
  using System.Threading;
  using System.Threading.Tasks;

  public class SingleInstance : IDisposable
  {
    private readonly bool ownsMutex;
    private Mutex mutex;
    private Guid identifier;

    /// &lt;summary&gt;
    /// Occurs when [arguments received].
    /// &lt;/summary&gt;
    public event EventHandler&lt;GenericEventArgs&lt;string&gt;&gt; ArgumentsReceived;

    /// &lt;summary&gt;
    /// Initializes a new instance of the &lt;see cref="SingleInstance"/&gt; class.
    /// &lt;/summary&gt;
    /// &lt;param name="id"&gt;The id.&lt;/param&gt;
    public SingleInstance(Guid id)
    {
      this.identifier = id;
      mutex = new Mutex(true, identifier.ToString(), out ownsMutex);
    }

    /// &lt;summary&gt;
    /// Gets a value indicating whether this instance is first instance.
    /// &lt;/summary&gt;
    /// &lt;value&gt;
    /// 	&lt;c&gt;true&lt;/c&gt; if this instance is first instance; otherwise, &lt;c&gt;false&lt;/c&gt;.
    /// &lt;/value&gt;
    public bool IsFirstInstance
    {
      get
      {
        return ownsMutex;
      }
    }

    /// &lt;summary&gt;
    /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
    /// &lt;/summary&gt;
    public void Dispose()
    {
      if (mutex != null &amp;&amp; ownsMutex)
      {
        mutex.ReleaseMutex();
        mutex = null;
      }
    }

    /// &lt;summary&gt;
    /// Passes the arguments to first instance.
    /// &lt;/summary&gt;
    /// &lt;param name="argument"&gt;The argument.&lt;/param&gt;
    public void PassArgumentsToFirstInstance(string argument)
    {
      using (var client = new NamedPipeClientStream(identifier.ToString()))
      using (var writer = new StreamWriter(client))
      {
        client.Connect(200);
        writer.WriteLine(argument);
      }
    }

    /// &lt;summary&gt;
    /// Listens for arguments from successive instances.
    /// &lt;/summary&gt;
    public void ListenForArgumentsFromSuccessiveInstances()
    {
      Task.Factory.StartNew(() =&gt;
                              {

                                using (var server = new NamedPipeServerStream(identifier.ToString()))
                                using (var reader = new StreamReader(server))
                                {
                                  while (true)
                                  {
                                    server.WaitForConnection();

                                    var argument = string.Empty;
                                    while (server.IsConnected)
                                    {
                                      argument += reader.ReadLine();
                                    }

                                    CallOnArgumentsReceived(argument);
                                    server.Disconnect();
                                  }
                                }
                              });
    }

    /// &lt;summary&gt;
    /// Calls the on arguments received.
    /// &lt;/summary&gt;
    /// &lt;param name="state"&gt;The state.&lt;/param&gt;
    public void CallOnArgumentsReceived(object state)
    {
      if (ArgumentsReceived != null)
      {
        if (state == null)
        {
          state = string.Empty;
        }

        ArgumentsReceived(this, new GenericEventArgs&lt;string&gt;() { Data = state.ToString() });
      }
    }
  }
}
&lt;/pre&gt;
&lt;p&gt;Here is the Generic Event Args class&lt;/p&gt;
&lt;pre class="brush: csharp"&gt;namespace Your.App
{
  using System;

  public class GenericEventArgs&lt;TEventDataType&gt; : EventArgs
  {
    /// &lt;summary&gt;
    /// Gets or sets the data.
    /// &lt;/summary&gt;
    /// &lt;value&gt;The data.&lt;/value&gt;
    public TEventDataType Data { get; set; }
  }
}
&lt;/pre&gt;
&lt;p&gt;To use this class create an instance with a GUID for your app like so:&lt;/p&gt;
&lt;pre class="brush: csharp"&gt;private static readonly SingleInstance SingleInstance = new SingleInstance(new Guid("24D910A1-1F03-44BA-85A0-BE7BC2655FFE"));
&lt;/pre&gt;
&lt;p&gt;Then on Application_Startup run your logic for it&lt;/p&gt;
&lt;pre class="brush: csharp"&gt;private void Application_Startup(object sender, StartupEventArgs e)
{
  if (SingleInstance.IsFirstInstance)
  {
    SingleInstance.ArgumentsReceived += SingleInstanceParameter;
    SingleInstance.ListenForArgumentsFromSuccessiveInstances();
	// Do your other app logic
  }
  else
  {
    // if there is an argument available, fire it
    if (e.Args.Length &gt; 0)
    {
      SingleInstance.PassArgumentsToFirstInstance(e.Args[0]);
    }
	
    Environment.Exit(0);
  }
}

static void SingleInstanceParameter(object sender, GenericEventArgs e)
{
  // Inform app of new arguments
}
&lt;/pre&gt;</description><link>http://random.tonywilliams.me.uk/post/483779269</link><guid>http://random.tonywilliams.me.uk/post/483779269</guid><pubDate>Tue, 30 Mar 2010 09:09:00 +0100</pubDate><category>.net,</category><category>WPF</category><category>WPF4</category><category>csharp</category></item><item><title>Brilliant….</title><description>&lt;iframe width="400" height="300" src="http://www.youtube.com/embed/32vpgNiAH60?wmode=transparent&amp;autohide=1&amp;egm=0&amp;hd=1&amp;iv_load_policy=3&amp;modestbranding=1&amp;rel=0&amp;showinfo=0&amp;showsearch=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Brilliant….&lt;/p&gt;</description><link>http://random.tonywilliams.me.uk/post/451991673</link><guid>http://random.tonywilliams.me.uk/post/451991673</guid><pubDate>Tue, 16 Mar 2010 10:19:54 +0000</pubDate></item><item><title>robnixon:

graphicly:

Thanks to Microsoft BizSpark One, here’s...</title><description>&lt;iframe width="400" height="300" src="http://www.youtube.com/embed/xIx_1_nJa8s?wmode=transparent&amp;autohide=1&amp;egm=0&amp;hd=1&amp;iv_load_policy=3&amp;modestbranding=1&amp;rel=0&amp;showinfo=0&amp;showsearch=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;&lt;a href="http://trixblog.com/post/450749261/graphicly-thanks-to-microsoft-bizspark-one"&gt;robnixon&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;a href="http://couch.graphic.ly/post/450705688/thanks-to-microsoft-bizspark-one-heres-a-demo-of"&gt;graphicly&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Thanks to Microsoft BizSpark One, here’s a demo of Graphic.ly for Win 7 Mobile from Microsoft Mix 2010!&lt;/p&gt;
&lt;p&gt;I’m with Kevin, you can almost see Tony’s nose hairs!&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/blockquote&gt;</description><link>http://random.tonywilliams.me.uk/post/451866394</link><guid>http://random.tonywilliams.me.uk/post/451866394</guid><pubDate>Tue, 16 Mar 2010 08:14:10 +0000</pubDate></item><item><title>No question...</title><description>&lt;img src="http://27.media.tumblr.com/tumblr_kz4nxlAxkA1qaguy0o1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;No question really….&lt;/p&gt;

&lt;p&gt;source: &lt;a href="http://thisisindexed.com/2010/03/fantasy-league/"&gt;&lt;a href="http://thisisindexed.com/2010/03/fantasy-league/"&gt;http://thisisindexed.com/2010/03/fantasy-league/&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://random.tonywilliams.me.uk/post/441470632</link><guid>http://random.tonywilliams.me.uk/post/441470632</guid><pubDate>Thu, 11 Mar 2010 17:15:00 +0000</pubDate><category>zombie</category></item><item><title>Want the directory of a .Net app?</title><description>&lt;p&gt;Then use this line:&lt;/p&gt;
&lt;p&gt;&lt;span&gt;
&lt;pre class="prettyprint"&gt;&lt;code&gt;&lt;span class="typ"&gt;AppDomain&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="typ"&gt;CurrentDomain&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="typ"&gt;BaseDirectory&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/span&gt;&lt;/p&gt;</description><link>http://random.tonywilliams.me.uk/post/406810211</link><guid>http://random.tonywilliams.me.uk/post/406810211</guid><pubDate>Tue, 23 Feb 2010 10:58:41 +0000</pubDate><category>.net</category><category>CSharp</category></item><item><title>likes 28 Weeks Later on Boxee</title><description>&lt;a href="http://bit.ly/AIFER"&gt;likes 28 Weeks Later on Boxee&lt;/a&gt;</description><link>http://random.tonywilliams.me.uk/post/395074962</link><guid>http://random.tonywilliams.me.uk/post/395074962</guid><pubDate>Wed, 17 Feb 2010 19:09:18 +0000</pubDate></item><item><title>Xml Serialisation (Serialization) in C#</title><description>&lt;a href="http://stackoverflow.com/questions/271398/what-are-your-favorite-extension-methods-for-c-net-codeplex-com-extensionover/271423#271423"&gt;Xml Serialisation (Serialization) in C#&lt;/a&gt;: &lt;p&gt;One thing I absolutely hate doing is reading xml, it bores me to bits. So to make this dreadful task a little more easier I use a nice little extension function that I found (and improved; then put up on stackoverflow). If you mark a class with the XmlSerialization attributes (XmlRoot/XmlElement) you can quickly take an xml string and turn it in to an object.&lt;/p&gt;</description><link>http://random.tonywilliams.me.uk/post/394422579</link><guid>http://random.tonywilliams.me.uk/post/394422579</guid><pubDate>Wed, 17 Feb 2010 09:01:00 +0000</pubDate><category>Serialisation</category><category>Xml</category><category>CSharp</category></item><item><title>ASP.Net Pager Control</title><description>&lt;a href="http://www.codeproject.com/KB/user-controls/ASPNETBasicPagerControl.aspx"&gt;ASP.Net Pager Control&lt;/a&gt;: &lt;p&gt;I built this quite a while ago - some one might find it useful.&lt;/p&gt;</description><link>http://random.tonywilliams.me.uk/post/394417806</link><guid>http://random.tonywilliams.me.uk/post/394417806</guid><pubDate>Wed, 17 Feb 2010 08:55:46 +0000</pubDate><category>ASP.Net</category><category>C</category><category>Control</category><category>Pager</category></item><item><title>Find the transparent pixels in an image - WPF</title><description>&lt;p&gt;The other day I had to create an image element that contained a png with transparent sections and have it display a hand cursor when the mouse was over the opaque sections.&lt;/p&gt;
&lt;p&gt;The first thing I tried (and failed) was to have an image element with the cursor property set to “Hand” like so:&lt;/p&gt;
&lt;p&gt;&lt;Image Source=”{Binding SomeImage}” Cursor=”Hand” /&gt;&lt;/p&gt;
&lt;p&gt;That obviously never worked so I was forced to look at each individual pixel and see if it was transparent. What I ended up with was a function that generated a bunch of coordinates.&lt;/p&gt;
&lt;p&gt;This is that function:&lt;/p&gt;
&lt;pre class="brush: csharp"&gt;private static Dictionary&lt;Point, object&gt; FindTransparentPixelCoordinates(BitmapSource source)
{
  var points = new Dictionary&lt;Point, object&gt;();

  // Convert the source if the pixel format is not what we expect
  if (source.Format != PixelFormats.Bgra32)
  {
    source = new FormatConvertedBitmap(source, PixelFormats.Bgra32, null, 0);
  }

  int width = source.PixelWidth;
  int height = source.PixelHeight;
  var bytes = new byte[width * height * 4];

  source.CopyPixels(bytes, width * 4, 0);

  var position = 0;

  for (var y = 0; y &lt; height; y++)
  {
    for (var x = 0; x &lt; width; x++)
    {
      var byteOffset = position;

      // The pixel format is stored as 32-bits (4 bytes) with the last byte being the alpha

      if (bytes[byteOffset + 3] == 0)
      {
        points.Add(new Point(x, y), null);
      }

      position += 4;
    }
  }

  return points;
}
&lt;/pre&gt;</description><link>http://random.tonywilliams.me.uk/post/392778744</link><guid>http://random.tonywilliams.me.uk/post/392778744</guid><pubDate>Tue, 16 Feb 2010 14:06:00 +0000</pubDate><category>Pixel</category><category>Transparent</category><category>WPF</category><category>CSharp</category></item><item><title>The Morning Brew</title><description>&lt;a href="http://blog.cwa.me.uk/"&gt;The Morning Brew&lt;/a&gt;: &lt;p&gt;Fantastic site that keeps me updated on all the goings on around .Net / Development.&lt;/p&gt;</description><link>http://random.tonywilliams.me.uk/post/357736994</link><guid>http://random.tonywilliams.me.uk/post/357736994</guid><pubDate>Thu, 28 Jan 2010 10:57:08 +0000</pubDate><category>.Net</category><category>Development</category></item><item><title>Chimp TV</title><description>&lt;a href="http://news.bbc.co.uk/earth/hi/earth_news/newsid_8472000/8472831.stm"&gt;Chimp TV&lt;/a&gt;: &lt;p&gt;The chimps chose a good score to accompany their film ;)&lt;/p&gt;</description><link>http://random.tonywilliams.me.uk/post/352439099</link><guid>http://random.tonywilliams.me.uk/post/352439099</guid><pubDate>Mon, 25 Jan 2010 11:04:52 +0000</pubDate><category>Chimpanzee</category><category>TV</category><category>Film</category></item><item><title>WPF 4 &amp; Touch</title><description>&lt;a href="http://blogs.msdn.com/jaimer/archive/2009/11/04/introduction-to-wpf-4-multitouch.aspx"&gt;WPF 4 &amp; Touch&lt;/a&gt;: &lt;p&gt;Invaluable resource for getting start with touch and WPF 4. Helped out greatly when developing the touch features of the graphic.ly WPF app.&lt;/p&gt;</description><link>http://random.tonywilliams.me.uk/post/350581654</link><guid>http://random.tonywilliams.me.uk/post/350581654</guid><pubDate>Sun, 24 Jan 2010 10:31:00 +0000</pubDate><category>WPF4</category><category>Touch</category><category>Graphic.ly</category></item><item><title>Amazing Lego Video - Cheers @kjfletch</title><description>&lt;iframe width="400" height="225" src="http://www.youtube.com/embed/OinrOnjzH_A?wmode=transparent&amp;autohide=1&amp;egm=0&amp;hd=1&amp;iv_load_policy=3&amp;modestbranding=1&amp;rel=0&amp;showinfo=0&amp;showsearch=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Amazing Lego Video - Cheers @kjfletch&lt;/p&gt;</description><link>http://random.tonywilliams.me.uk/post/342392162</link><guid>http://random.tonywilliams.me.uk/post/342392162</guid><pubDate>Tue, 19 Jan 2010 08:37:00 +0000</pubDate><category>lego</category><category>video</category></item><item><title>Day 0</title><description>&lt;p&gt;Until I can think of something to write for this I’ll start off by telling you all little about my self. In bullet form of course ;)&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Born and bred in the North East of England (Hartlepool to be exact)&lt;/li&gt;
&lt;li&gt;Software developer for numerous companies (current at &lt;a title="Graphic.ly" target="_blank" href="http://graphic.ly"&gt;Graphic.ly&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Former Ice-Cream man&lt;/li&gt;
&lt;li&gt;Big on Technology / .Net / WPF / C# and other various geek stuff&lt;/li&gt;
&lt;li&gt;Afraid of heights&lt;/li&gt;
&lt;li&gt;Love pizza&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;That’s it for now…&lt;/p&gt;
&lt;p&gt;Cheerio&lt;/p&gt;

&lt;p&gt;P.S.&lt;/p&gt;
&lt;p&gt;I’m also online else where:&lt;/p&gt;
&lt;p&gt;&lt;a title="Twitter" href="http://twitter.com/twith2sugars"&gt;Twitter&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a title="Facebook" href="http://www.facebook.com/twith2sugars"&gt;Facebook&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a title="LinkedIn" href="http://uk.linkedin.com/in/twith2sugars"&gt;LinkedIn&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a title="StackOverFlow" href="http://stackoverflow.com/users/35389/twith2sugars"&gt;StackOverFlow&lt;/a&gt;&lt;/p&gt;</description><link>http://random.tonywilliams.me.uk/post/326792287</link><guid>http://random.tonywilliams.me.uk/post/326792287</guid><pubDate>Sun, 10 Jan 2010 11:50:21 +0000</pubDate><category>day 0</category><category>me</category><category>rambling</category></item></channel></rss>

