<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Miscampbell dot com]]></title><description><![CDATA[A blog about code, whisky, sports and some other things we'll get to later.]]></description><link>http://miscampbell.com/</link><generator>Ghost 0.5</generator><lastBuildDate>Wed, 30 Dec 2020 01:21:25 GMT</lastBuildDate><atom:link href="http://miscampbell.com/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[Obscure Visual Studio Errors]]></title><description><![CDATA[<p>Recently, I attempted to install a NuGet package to a project in Visual Studio and received the following error:</p>

<p><code>Failed to add reference to 'System.Transactions'. Please make sure that it is in the Global Assembly Cache.</code></p>

<p>This would happen intermittently with various libraries (especially <code>System.Core</code> and <code>System.Transactions</code>).</p>

<p>Having recently read <a href='http://www.hanselman.com/blog/FixingSystemCore205FileLoadExceptionPortableLibrariesAndWindowsXPSupport.aspx' >this</a> post by Scott Hanselman, I checked that the libraries were indeed in the GAC using this command</p>

<p><code>gacutil /l | find /i "system.core"</code></p>

<p>which I ran from an elevated Visual Studio Command Prompt and, indeed, <code>System.Core</code> was there.</p>

<p>Some extensive Googling revealed nothing until I tried to add a reference to another project in the same solution, and received this error message:</p>

<p><img src='https://miscampbell.blob.core.windows.net/blog-downloads/visual-studio-error.png'  alt="" /></p>

<p>which lead me to <a href='http://nuget.codeplex.com/workitem/3996' >this</a> NuGet issue related to a particular version of Resharper.</p>

<p>I upgraded Resharper to 8.2.1 (from 8.2.0) and everything worked perfectly!</p>

<p>Just in case it saves anyone some time.</p>]]></description><link>http://miscampbell.com/obscure-visual-studio-errors/</link><guid isPermaLink="false">7632dc1e-419c-467b-b02c-33e410451a0e</guid><dc:creator><![CDATA[David Miscampbell]]></dc:creator><pubDate>Tue, 01 Jul 2014 08:48:00 GMT</pubDate></item><item><title><![CDATA[Angular JS Templates for Resharper]]></title><description><![CDATA[<p>I've been using quite a lot of <a href='http://angularjs.org/'  target="_blank">Angular JS</a> at work recently. Since I use Visual Studio and, therefore, JetBrains Resharper, I was disappointed at the lack of nice templates I could use to help speed things along.</p>

<p>This <a href='https://github.com/JetBrains/resharper-angularjs'  target="_blank">official plugin</a>, which adds some nice syntax highlighting and autocompletion, was a start but I was hoping for something that would layout my controller code for me in a nice way so I wouldn't have to keep typing <code>'use strict'</code> at the top of every file.</p>

<p>Inspired by the <a href='http://sidewaffle.com/'  target="_blank">Sidewaffle</a> templates, I decided to create some Resharper templates that I could add to their quick insert menu (<code>Alt+Insert</code>). I've put these up on <a href='https://github.com/DaveMiscampbell/angularjs-resharper-templates'  target="_blank">github</a> so other people can benefit.</p>

<p>To install, just go to Resharper > Templates Explorer inside Visual Studio. Select the File Templates tab and then Import the templates you want to use. You can add them to the quicklist by selecting a project Scope in the left pane of this window and dragging the appropriate template onto the quicklist.</p>

<p>If you have any questions, give me a shout <a href='http://twitter.com/DaveMiscampbell'  target="_blank">@DaveMiscampbell</a>.</p>]]></description><link>http://miscampbell.com/angular-js-templates-for-resharper/</link><guid isPermaLink="false">ee96c02a-c5d8-4611-bcc6-9a66e23e89e6</guid><dc:creator><![CDATA[David Miscampbell]]></dc:creator><pubDate>Mon, 13 Jan 2014 22:14:10 GMT</pubDate></item><item><title><![CDATA[Regular Expressions]]></title><description><![CDATA[<p>Inspired by <a href='http://xkcd.com/208/'  target="_blank">this</a> xkcd and the desire to purchase the <a href='http://store.xkcd.com/products/i-know-regular-expressions'  target="_blank">associated t-shirt</a> (and be truthful when wearing it), I've begun following the course on <a href='http://learncodethehardway.org/'  target="_blank">Learn Code The Hard Way</a> on Regular Expressions.</p>

<p>The course uses a custom Python regex matcher (called regetron) and builds you up through a series of lessons, teaching you to translate regular expressions into regular English and back. I found his setup instructions quite unhelpful though so I thought I would include my own here in case anyone else struggled!</p>

<p>Note that I'm using Windows 8.1 on my laptop and haven't tested this anywhere else so your experience may differ!</p>

<ol>  
    <li><h4>Install Python</h4><p>Header over to <a href='http://www.python.org/getit/'  target="_blank">http://www.python.org/getit/</a> and download the appropriate installer. Make sure to change the default settings to add Python to your PATH variable.</p></li>
    <li><h4>Install Pip</h4><p>According to what I could find online, Python ships without a package manager so we now need to install one - PIP. I found the instructions <a href='http://www.pip-installer.org/en/latest/installing.html'  target="_blank">here</a> to be the most helpful I could find. Download these 2 python files (<a href='https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py'  target="_blank">ez_setup.py</a> and <a href='https://raw.github.com/pypa/pip/master/contrib/get-pip.py'  target="_blank">get-pip.py</a>) and then run <code>python ez_setup.py</code> and <code>python get-pip.py</code> from a command prompt in the directory you saved the files into.</p><p>At this point, I found it helpful to add the Python scripts directory to my PATH too, meaning I can run pip from a command prompt anywhere. Go to This Computer, right click and choose Advanced System Settings, then Environment Variables. Find the one called PATH and add whatever your Python Directory is \Scripts (for me this was C:\Python33\Scripts).</p></li>
    <li><h4>Install Regetron</h4><p>Now we should be able to install the custom python program we need. Run <code>pip install regetron</code> in a command window and it should install! To run the program, you can then type <code>regetron</code> and you should be all set up to follow lesson 1!</p></li>
    <li><h4>Python 3</h4><p>If, like me, you knew very little to nothing before installing Python, you probably installed the latest version (at the time of writing 3.3), thinking that was the sensible thing to do. Apparently, there were a large number of breaking changes between Python 2.7 and Python 3 and so some older scripts need to be upgraded. Unfortunately, this includes regetron. If this is your situation, you have two choices:<ul>
    <li>Uninstall Python 3 and follow the steps above again with Python 2.7 (this is not what I chose to do)</li>
    <li>Edit the regetron code and get it working with Python 3.</li></ul></p>
    <p>I used the guide <a href='http://docs.python.org/3.0/whatsnew/3.0.html'  target="_blank">here</a> to figure out some of the errors. I also ended up removing some sections which didn't seem to be needed or work on Windows. You can download what I came up with <a href='https://miscampbell.blob.core.windows.net/blog-downloads/2014-01-12.7z'  target="_blank">here</a>. Once again, I'd like to stress that this works on my PC for me and may not work for you. </p>
<p>  
To install, you'll need to replace the regetron file in your python Scripts folder (for me this was C:\Python33\Scripts) with mine, and also replace the regetron engine.py file which should be in your python lib folder (for me this was C:\Python33\lib\site-packages\regetron\engine.py) with mine.</p></li>  
</ol>

<p>Having got all of that working I was then able to start following the lessons! So far, I've definitely found his way of writing the regular expression out in plain English and breaking it down symbol by symbol really helps.</p>

<p>Hopefully I'll now be able to at least understand some of the regexes I copy and paste regularly (for example, those to match US zip codes) and I might even trust myself to write my own.</p>]]></description><link>http://miscampbell.com/regular-expressions/</link><guid isPermaLink="false">449c1ff2-72e3-4bf3-a40d-692633883892</guid><dc:creator><![CDATA[David Miscampbell]]></dc:creator><pubDate>Sun, 12 Jan 2014 15:32:53 GMT</pubDate></item><item><title><![CDATA[Chromecasts, Windows 8 and Hyper-V]]></title><description><![CDATA[<p>As part of the recent winter festivities, I received a Chromecast. As I'm in the UK, this was an unofficial import with an American plug but I managed to get it some power and eventually managed to connect it to my wifi network. <br />
I was excited to see what I could do with it. I tried it out with my phone and found I could use it to share YouTube videos and play my Google Play Music through the TV. Pretty cool.</p>

<p>So far, so good.</p>

<p>When I tried to use the <a href='https://chrome.google.com/webstore/detail/google-cast/boadgeojelhgndaghljhdicfkmllpafd?hl=en'  target="_blank">Google Cast Chrome extension</a> on my laptop, however, I was disappointed. It was unable to find the Chromecast. Following the "<a href='https://support.google.com/chromecast/answer/3249268?hl=en'  target="_blank">No devices found?</a>" link, Google informed me that (for laptops running Windows 8.1) <em>Software that installs a virtual NIC - VMware, Win8 Hyper-V, but also some NAS drivers - may cause discovery issues between a laptop/desktop and the Chromecast.</em>. </p>

<p>I wasn't aware I had any of these things installed but it turns out, the default installation for the network card on my laptop was being virtualised through Hyper-V. I tried disabling the Hyper-V adapters but then found I couldn't get on the Internet.</p>

<p>So far, so bad.</p>

<p>Fortunately, there is a way to uninstall Hyper-V (which is software used to run virtual machines under Windows and therefore, not necessary for most users). Going to Control Panel, then Programs and Features and then clicking "Turn Windows features on or off" at the side, led me to a window where I could uncheck and uninstall Hyper-V. A quick restart and I was then able to find the Chromecast and share my tabs from my laptop.</p>

<p>Now to find something meaningful to share.</p>]]></description><link>http://miscampbell.com/chromecast/</link><guid isPermaLink="false">565b371d-4a49-4869-9a6f-539896ae3785</guid><dc:creator><![CDATA[David Miscampbell]]></dc:creator><pubDate>Tue, 07 Jan 2014 23:10:37 GMT</pubDate></item><item><title><![CDATA[What I'm reading at the moment]]></title><description><![CDATA[<p>The festive season is over already and a new year has begun. Thankfully, I was surrounded by some lovely people at Christmas time who took the time to choose me some books to read. Here is what I'm currently reading in case it points you to something you hadn't seen before or you think I could be reading something better.</p>

<ul>
<li><strong>The Simpsons and their Mathemtical Secrets</strong> (<em>Simon Singh</em>) - This looks to be quite interesting, although it hasn't held too many surprises so far. I'm hoping that it will turn up some interesting facts I can drop into conversation when I'm next watching The Simpsons. Also, it has given me an idea for an app (more on that another time).</li>
<li><strong>Elements of Reusable Object-Oriented Software</strong> (<em>Gamma, Helm, Johnson, Vlissides</em>) So not exactly light reading but when I've been taking a look at other books on software development, definitely one that I've found quoted very often. Haven't made too much progress with this so far but looks like it will hold quite a wealth of information. I will report back when I've read a little more.</li>
<li><strong>Grey Granite</strong> (<em>Lewis Grassic Gibbon</em>) This is the third part of "<em>A Scot's Quair</em>", the first part of which is <em>Sunset Song</em> which less fortunate readers may have been subjected to as part of an English Literature course at some stage. I read Sunset Song a few years ago and was really impressed with both the story and the telling of the story. Hopefully, Mr Gibbon will keep me entertained in this 3rd installment.</li>
</ul>

<p>That's it - I think having more than 3 books at a time could be a stretch. Especially when I'm also following some courses on Pluralsight. And writing a blog. But maybe there's something excellent I'm missing which you could recommend.</p>]]></description><link>http://miscampbell.com/what-im-reading-at-the-moment/</link><guid isPermaLink="false">d0bc551a-d4f9-48b9-a449-24ce756deaba</guid><dc:creator><![CDATA[David Miscampbell]]></dc:creator><pubDate>Tue, 07 Jan 2014 22:55:12 GMT</pubDate></item><item><title><![CDATA[Welcome to Miscampbell.com]]></title><description><![CDATA[<p>So I heard that some people write these things called blogs. Here goes ...</p>]]></description><link>http://miscampbell.com/welcome-to-miscampbell-com/</link><guid isPermaLink="false">86e3a23e-fffd-4ca2-bc63-052d1930525e</guid><dc:creator><![CDATA[David Miscampbell]]></dc:creator><pubDate>Mon, 06 Jan 2014 19:01:16 GMT</pubDate></item></channel></rss>