<?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>Brian Wigginton</title>
	<atom:link href="http://www.bwigg.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bwigg.com</link>
	<description>Lab and Nerdery</description>
	<lastBuildDate>Sat, 16 Mar 2013 19:14:46 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Share localhost with SSH &amp; Apache</title>
		<link>http://www.bwigg.com/2012/10/share-localhost-with-ssh-apache/</link>
		<comments>http://www.bwigg.com/2012/10/share-localhost-with-ssh-apache/#comments</comments>
		<pubDate>Tue, 23 Oct 2012 07:11:34 +0000</pubDate>
		<dc:creator>bawigga</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[DevOps]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://www.bwigg.com/?p=434</guid>
		<description><![CDATA[There's been a lot of services released lately that aim to assist developers share their local development environments over the internet. localtunnel, showoff.io and pagekite come to mind, just to name a few. However, you can roll your own forwarding service if you have SSH access to a server running Apache fairly easily. The Big [...]]]></description>
				<content:encoded><![CDATA[<p>There's been a lot of services released lately that aim to assist developers share their local development environments over the internet. localtunnel, showoff.io and pagekite come to mind, just to name a few. However, you can roll your own forwarding service if you have SSH access to a server running Apache fairly easily.</p>
<h2>The Big Picture</h2>
<p>First, setup a webserver to listen for connections to demo.example.com. When a user connects to the webserver, it will attempt to proxy their request to port 1337 (demo.example.com port 1337).</p>
<p>Second, a reverse proxy initiated with SSH on your localhost creates a connection to demo.example.com, and then has all traffic on demo.example.com port 1337 forwarded to localhost port 80.</p>
<pre>User =&gt; demo.example.com:80 &lt;=&gt; demo.example.com:1337 &lt;=&gt; localhost:80</pre>
<h2>Requirements</h2>
<h3>Server</h3>
<ul>
<li>Apache Web Server</li>
<li>Apache mod_proxy module</li>
<li>OpenSSH</li>
</ul>
<h3>Client</h3>
<ul>
<li>Local web application</li>
<li>SSH client</li>
<li>SSH public/private keys to login to the remote server</li>
</ul>
<h3>Server Setup (Ubuntu)</h3>
<p><em>You should be able to login to your server over SSH using public/private key authentication. How to do that is out of scope for this post, however there are plenty of guides available online that explain in detail how to do this.</em></p>
<h3>Apache: Enable mod_proxy</h3>
<p>$ sudo a2enmod proxy_http</p>
<h3>Apache: Configure VirtualHost</h3>
<p>Setup Apache to use a VirtualHost for URL you want to use for sharing your work:</p>
<p>&lt;VirtualHost *:80&gt;<br />
ServerName "demo.example.com"<br />
ProxyPass / http://127.0.0.1:1337/<br />
ProxyPassReverse / http://127.0.0.1:1337/<br />
&lt;/VirtualHost&gt;</p>
<p>The <a href="http://httpd.apache.org/docs/2.2/mod/core.html#servername"><code>ServerName</code></a> Directive tells Apache to listen for client requests for demo.example.com. <a href="http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypass"><code>ProxyPass</code></a> and <a href="http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypassreverse"><code>ProxyPassReverse</code></a> configure Apache to forward all requests to the local port 1337.</p>
<h3>Apache: Restart to load VHost</h3>
<p>$ sudo apachectl restart</p>
<h2>Localhost Setup</h2>
<h3>Make sure you're running a local web application</h3>
<p>This should be pretty obvious <img src='http://www.bwigg.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  It doesn't matter what port it's running, you can configure that when you start the SSH reverse proxy.</p>
<h3>Create an SSH Reverse Proxy</h3>
<p>To actually enable the connection form your public web server to your localhost, you have to create a reverse proxy using SSH. The reverse proxy will create a connection from your localhost to the remote server (demo.example.com), then have all traffic from a designated remote port forwarded to a local port.</p>
<p>$ ssh -fNR 1337:localhost:80 demo.example.com</p>
<ul>
<li><code>-f</code> puts ssh into the background. If you want to be able to easily kill the Proxy later, omit the -f and use <code>ctrl + c</code>.</li>
<li><code>-N</code> disables all output keeping things clean. If you omit this, you'll see SSH connect to your remote server.</li>
<li><code>-R 1337:localhost:80</code> Tells SSH to create a reverse proxy and that all traffic on the remote port 1337 should be forwarded to localhost's port 80.</li>
<li><code>demo.example.com</code> is the remote server you want SSH to connect to.</li>
</ul>
<p><em>You may need to change your localhost port depending on what port your local environment is running on. For example: if you're developing a rails application using the builtin webserver, you might need to use port 3000 instead of port 80.</em></p>
<p>You should now be able to hit demo.example.com in your browser, and see your application load.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bwigg.com/2012/10/share-localhost-with-ssh-apache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>npm jshint &#8211; command not found after install</title>
		<link>http://www.bwigg.com/2012/10/npm-jshint-command-not-found/</link>
		<comments>http://www.bwigg.com/2012/10/npm-jshint-command-not-found/#comments</comments>
		<pubDate>Sun, 21 Oct 2012 05:06:27 +0000</pubDate>
		<dc:creator>bawigga</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.bwigg.com/?p=430</guid>
		<description><![CDATA[I was getting a new machine up and running and decided to play with zsh. Later that evening I was going to write some JavaScript and wanted to lint my code with the handy jshint tool. So I installed it with NPM: $ npm install jshint -g And was then greeted with a command not [...]]]></description>
				<content:encoded><![CDATA[<p>I was getting a new machine up and running and decided to play with zsh. Later that evening I was going to write some JavaScript and wanted to lint my code with the handy jshint tool. So I installed it with NPM:</p>
<pre>$ npm install jshint -g</pre>
<p>And was then greeted with a command not found error:</p>
<pre>$ jshint
zsh: correct jslint to slit [nyae]? n
zsh: command not found: jslint</pre>
<p>Turns out I needed to add the npm bin directory to my PATH, as it didn't get added there automatically since I installed zsh after node/npm.</p>
<pre>export PATH="/usr/local/share/npm/bin:${PATH}"</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.bwigg.com/2012/10/npm-jshint-command-not-found/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Jenkins &amp; JSHint &#8211; Integrating with Checkstyles and Violations</title>
		<link>http://www.bwigg.com/2012/10/jenkins-jshint-integrating-with-checkstyles-and-violations/</link>
		<comments>http://www.bwigg.com/2012/10/jenkins-jshint-integrating-with-checkstyles-and-violations/#comments</comments>
		<pubDate>Fri, 05 Oct 2012 01:41:40 +0000</pubDate>
		<dc:creator>bawigga</dc:creator>
				<category><![CDATA[Continuous Integration]]></category>
		<category><![CDATA[Jenkins]]></category>

		<guid isPermaLink="false">http://www.bwigg.com/?p=420</guid>
		<description><![CDATA[Prerequisite You need to have some form of jshint installed on your server. Instructions of how to do that are out of scope for this post, and should be able to be easily found on the internet. I used the version that installed with npm. Jenkins Build Tasks This is a very simple setup that [...]]]></description>
				<content:encoded><![CDATA[<h2><strong>Prerequisite</strong></h2>
<p>You need to have some form of jshint installed on your server. Instructions of how to do that are out of scope for this post, and should be able to be easily found on the internet. I used the version that installed with npm.</p>
<h2>Jenkins Build Tasks</h2>
<p>This is a very simple setup that uses 2 Build &gt; Execute Shell tasks. In the first shell task I created the checkstyle output:</p>
<pre>jshint --checkstyle-reporter app/webroot/javascripts/mdc/ &gt; build/logs/checkstyle-jshint.xml || exit 0</pre>
<p>In the second, I created the jslint output:</p>
<pre>jshint --jslint-reporter app/webroot/javascripts/mdc/ &gt; build/logs/jslint.xml || exit 0</pre>
<p><img class="wp-image-422 alignnone" title="Build Task Settings" src="http://www.bwigg.com/wp-content/uploads/2012/10/Screen-Shot-2012-10-04-at-7.28.24-PM.png" alt="Build Task Settings" width="572" height="340" /></p>
<h2>Checkstyle Plugin</h2>
<p>Configure the checkstyles plugin to reference the created checkstyle-jshint.xml file:</p>
<p><a href="http://www.bwigg.com/wp-content/uploads/2012/10/Screen-Shot-2012-10-04-at-7.37.12-PM.png"><img class="wp-image-423 alignnone" title="Checkstyle Settings" src="http://www.bwigg.com/wp-content/uploads/2012/10/Screen-Shot-2012-10-04-at-7.37.12-PM.png" alt="Checkstyle Settings" width="580" height="111" /></a></p>
<h2>Violations Plugin</h2>
<p>Configure the violations plugin to reference the created checkstyle-jshint.xml and the jslint.xml file:</p>
<p><a href="http://www.bwigg.com/wp-content/uploads/2012/10/Screen-Shot-2012-10-04-at-7.38.20-PM.png"><img class="wp-image-424 alignnone" title="Violations Setup" src="http://www.bwigg.com/wp-content/uploads/2012/10/Screen-Shot-2012-10-04-at-7.38.20-PM.png" alt="Violations Setup" width="567" height="223" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bwigg.com/2012/10/jenkins-jshint-integrating-with-checkstyles-and-violations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SVN Remove &amp; Ignore Causing Tree Conflict</title>
		<link>http://www.bwigg.com/2012/09/svn-remove-ignore-causing-tree-conflict/</link>
		<comments>http://www.bwigg.com/2012/09/svn-remove-ignore-causing-tree-conflict/#comments</comments>
		<pubDate>Mon, 10 Sep 2012 18:27:35 +0000</pubDate>
		<dc:creator>bawigga</dc:creator>
				<category><![CDATA[Subversion]]></category>

		<guid isPermaLink="false">http://www.bwigg.com/?p=406</guid>
		<description><![CDATA[We has some files that were being tracked in SVN that we needed to be untracked and ignored, specifically a web.config file, which was being dynamically generated. We removed and ignored the file in a feature branch. We then merged the feature branch into trunk. Then ran svn update on our servers, which caused a [...]]]></description>
				<content:encoded><![CDATA[<p>We has some files that were being tracked in SVN that we needed to be untracked and ignored, specifically a web.config file, which was being dynamically generated. We removed and ignored the file in a feature branch. We then merged the feature branch into trunk. Then ran svn update on our servers, which caused a tree conflict.</p>
<p>After some googling, the resolution was the following command on the server:</p>
<pre>svn resolve --accept working -R .</pre>
<p>Thanks to http://www.learnaholic.me/2009/10/04/subversion-resolve-for-tree-conflict/ for the answer.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bwigg.com/2012/09/svn-remove-ignore-causing-tree-conflict/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Filename Cache Busting with CakePHP</title>
		<link>http://www.bwigg.com/2012/07/filename-cache-busting-with-cakephp/</link>
		<comments>http://www.bwigg.com/2012/07/filename-cache-busting-with-cakephp/#comments</comments>
		<pubDate>Thu, 19 Jul 2012 02:38:14 +0000</pubDate>
		<dc:creator>bawigga</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.bwigg.com/?p=389</guid>
		<description><![CDATA[This assumes you're using CakePHP 2.x CakePHP let's you use timestamp based cache busting on your assets by enabling Asset.timestamp in your core.php file. By enabling this and using the builtin HtmlHelper::css and HtmlHelper::script methods, your assets will have a timestamp appended to them as a query string. For example: /app.js?123456789 However, older squid proxies [...]]]></description>
				<content:encoded><![CDATA[<p><em>This assumes you're using CakePHP 2.x</em></p>
<p>CakePHP let's you use timestamp based cache busting on your assets by enabling <code>Asset.timestamp</code> in your <code>core.php</code> file. By enabling this and using the builtin <code>HtmlHelper::css</code> and <code>HtmlHelper::script</code> methods, your assets will have a timestamp appended to them as a query string. For example:</p>
<pre>/app.js?123456789</pre>
<p>However, older squid proxies will not cache anything that has a query string, thus preventing your files from being cached. An alternative solution is to move the timestamp into the filename, and then use htaccess or similiar rewrite rule system to map those files back to the actual files on disk. The end output would be something like the following:</p>
<pre>/app.123456789.js</pre>
<p>To implement this in CakePHP, you need to override the assetTimestamp in AppHelper.php</p>
<script src="https://gist.github.com/3140348.js?file=AppHelper.php"></script><noscript><pre><code class="language-php php">&lt;?php

class AppHelper extends Helper {

	/**
	 * Override so that the timestamp is added to the file instead of as a query parameter,
	 */
	public function assetTimestamp($path) {
		$parts = explode('?', parent::assetTimestamp($path));
		return substr_replace($parts[0], '.'.$parts[1], strrpos($parts[0],'.'), 0);
	}

}
</code></pre></noscript>
<p>Use the following in your .htaccess file. If you're not using Apache, see the <a title="HTML5 Boilerplate" href="http://html5boilerplate.com/">html5 boilerplate</a> for nginx or web.config files.</p>
<script src="https://gist.github.com/3140348.js?file=.htaccess"></script><noscript><pre><code class="language-apacheconf apacheconf">&lt;IfModule mod_rewrite.c&gt;
    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.+)\.(\d+)\.(js|css|png|jpg|gif)$ $1.$3 [L]

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php [QSA,L]
&lt;/IfModule&gt;</code></pre></noscript>
<p>Read more about filename cache busting at the Html5 Boilerplate Wiki <a title="Cachebusting w. HTML5 Boilerplate" href="https://github.com/h5bp/html5-boilerplate/wiki/cachebusting" target="_blank">entry on cache busting</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bwigg.com/2012/07/filename-cache-busting-with-cakephp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Content Switching with HAProxy</title>
		<link>http://www.bwigg.com/2012/04/content-switching-with-haproxy/</link>
		<comments>http://www.bwigg.com/2012/04/content-switching-with-haproxy/#comments</comments>
		<pubDate>Mon, 09 Apr 2012 16:08:07 +0000</pubDate>
		<dc:creator>bawigga</dc:creator>
				<category><![CDATA[DevOps]]></category>

		<guid isPermaLink="false">http://www.bwigg.com/?p=339</guid>
		<description><![CDATA[Content Switching Content-switching is an OSI layer 7 application switching technique, which in lamans terms means that it has access to the HTTP requests and responses of your application. By inspecting each request and response, it make decision on where to send those requests and how to handle responses. HAProxy is an open source load [...]]]></description>
				<content:encoded><![CDATA[<h3>Content Switching</h3>
<p>Content-switching is an OSI layer 7 application switching technique, which in lamans terms means that it has access to the HTTP requests and responses of your application. By inspecting each request and response, it make decision on where to send those requests and how to handle responses.</p>
<p>HAProxy is an open source load balancing tool that also has the ability to implement content switching.</p>
<h3>Proxies &amp; Reverse Proxies</h3>
<p>You might be familiar with a Proxy, which is basically something that sits between the client and the server. When the client makes a request it first goes through the proxy then to the server. The response from the server then goes back through the proxy  to the client. These are usually implemented by the client and completely transparent to the server. A great example of this is when someone configures their browser to use a proxy to access the internet, with a tool such as Tor.</p>
<p>A Reverse Proxy is the same thing except it acts on behalf of the server. One example of a Reverse Proxy is a load balancer, which receives requests from a users and usually proxies them to one of several backend servers. This process is completely transparent to the client. Content switching is also a form of Reverse Proxy.</p>
<h2>Content-Switching Scenario</h2>
<p>Let's say you're in charge of a large social bookmarking application, http://delicioso.com. The shelf life for that system has come to and end and you're team has decided to rewrite everything in Rails. It's going to take a long time to migrate everything over to the new application, and you want to reduce the risk involved with a huge release cycle. Instead you want to take an agile approach and roll out bits and pieces over time in the following order:</p>
<ol>
<li>Configure HAProxy as a Reverse Proxy</li>
<li>Phase in user profiles - http://delicioso.com/profile/...</li>
<li>...</li>
</ol>
<p>For the purpose if this example, let's call the current application <em>Legacy</em>. Image your current infrastructure is setup like the following:</p>
<pre>                        +-------------------+
                        |    example.com    |
  User  +----------&gt;    |-------------------|
                        |     legacy:80     |
                        +-------------------+</pre>
<h3></h3>
<h3>Step 1: Configure HAProxy as a Reverse Proxy</h3>
<p>The first step is to setup HAProxy to be reverse proxy for <em>Legacy</em>, so later we can implement content-switching. You'll need to have HAProxy installed.</p>
<pre>                      +-------------------+
                      |    example.com    |
User  +----------&gt;    |-------------------|
                      |    HAProxy:80     |
                      |     legacy:8001   |
                      +-------------------+</pre>
<p>Here's the config file to configure HAProxy in this way:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">global
  <span style="color: #666666; font-style: italic;">#debug                                   # uncomment to enable debug mode for HAProxy</span>
&nbsp;
defaults
  mode http                                <span style="color: #666666; font-style: italic;"># enable http mode which gives of layer 7 filtering</span>
  timeout connect 5000ms                   <span style="color: #666666; font-style: italic;"># max time to wait for a connection attempt</span>
                                           <span style="color: #666666; font-style: italic;">#  to a server to succeed</span>
  timeout client 50000ms                   <span style="color: #666666; font-style: italic;"># max inactivity time on the client side</span>
  timeout server 50000ms                   <span style="color: #666666; font-style: italic;"># max inactivity time on the server side</span>
&nbsp;
backend legacy                             <span style="color: #666666; font-style: italic;"># define a group of backend servers</span>
  server legacy_server 127.0.0.1:<span style="color: #000000;">8001</span>      <span style="color: #666666; font-style: italic;"># add a server to this backend</span>
&nbsp;
frontend app <span style="color: #000000; font-weight: bold;">*</span>:<span style="color: #000000;">80</span>                          <span style="color: #666666; font-style: italic;"># define what port to listed to for HAProxy</span>
  default_backend legacy                   <span style="color: #666666; font-style: italic;"># set the default server for all request</span></pre></td></tr></table></div>

<h3></h3>
<h3>Step 2: Phase in User Profiles</h3>
<p>All of your user's profile pages have a URL format as follows: /profile/username. Your team finished implementing this in the new Rails framework and it's time to roll it out. The rails app is running on port 8002.</p>
<pre>                      +-------------------+
                      |    example.com    |
User  +----------&gt;    |-------------------|
                      |    HAProxy:80     |
                      |     legacy:8001   |
                      |      rails:8002   |
                      +-------------------+</pre>
<p>Here's the new config file for content-switching all requests starting with /profile to the new rails application</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">global
  <span style="color: #666666; font-style: italic;">#debug</span>
&nbsp;
defaults
  mode http
  option httpclose                         <span style="color: #666666; font-style: italic;"># close the tcp connection after every request</span>
  timeout connect 5000ms
  timeout client 50000ms
  timeout server 50000ms
&nbsp;
backend legacy
  server legacy_server 127.0.0.1:<span style="color: #000000;">8001</span>
&nbsp;
backend rails                              <span style="color: #666666; font-style: italic;"># define a group of backend servers</span>
  server rails_server 127.0.0.1:<span style="color: #000000;">8002</span>       <span style="color: #666666; font-style: italic;"># add a server to this backend</span>
&nbsp;
frontend app <span style="color: #000000; font-weight: bold;">*</span>:<span style="color: #000000;">80</span>
  default_backend legacy
  acl rails_path path_beg <span style="color: #000000; font-weight: bold;">/</span>profile         <span style="color: #666666; font-style: italic;"># acl rule for rails supported paths</span>
  use_backend rails <span style="color: #000000; font-weight: bold;">if</span> rails_path          <span style="color: #666666; font-style: italic;"># use rails if the rules match.</span></pre></td></tr></table></div>

<p>Check out the HAProxy documentation for more keywords your can use to route requests. This was a pretty simple example, this get's more challenging when you need to handle session state across the legacy and new systems.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bwigg.com/2012/04/content-switching-with-haproxy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web.config User Specific appSettings</title>
		<link>http://www.bwigg.com/2012/03/web-config-user-specific-appsettings/</link>
		<comments>http://www.bwigg.com/2012/03/web-config-user-specific-appsettings/#comments</comments>
		<pubDate>Tue, 20 Mar 2012 21:27:51 +0000</pubDate>
		<dc:creator>bawigga</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://www.bwigg.com/?p=364</guid>
		<description><![CDATA[On an MVC.NET project at work, we came across the need to be able to override the web.config's appSettings uniquely on each of our local environments. Turns out there's a very easy way to do just that inside the web.config file. Just add the file attribute to the &#60;appSettings&#62; node in your web.config, and add [...]]]></description>
				<content:encoded><![CDATA[<p>On an MVC.NET project at work, we came across the need to be able to override the web.config's appSettings uniquely on each of our local environments. Turns out there's a very easy way to do just that inside the web.config file.</p>
<p>Just add the file attribute to the &lt;appSettings&gt; node in your web.config, and add a local.config file to the project root.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- WEB.CONFIG --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  ...
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;appSettings</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;local.config&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    ...
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/appSettings<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  ...
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- LOCAL.CONFIG --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;appSettings<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;add</span> <span style="color: #000066;">key</span>=<span style="color: #ff0000;">&quot;MySQLConnectionString&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;...&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/appSettings<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Now when your app loads, it will check to see if there's a local.config file relative to the web.config file. If there is a file, then it overrides any web.config settings it finds duplicates for in the local.config. If the local.config file does not exist, then it is ignored.</p>
<p>Pro tip: Keep local.config out of your code repo and boom! Easily manageable local dev environment settings.</p>
<p>See Also:</p>
<ul>
<li><a title="MSDN: appSettings Element (General Settings Schema)" href="http://msdn.microsoft.com/en-us/library/ms228154.aspx" target="_blank">MSDN: appSettings Element (General Settings Schema)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.bwigg.com/2012/03/web-config-user-specific-appsettings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu 11.10 Blank Screen with underline after boot with VMWare Fusion</title>
		<link>http://www.bwigg.com/2012/03/ubuntu-11-10-blank-screen-with-underline-after-boot-with-vmware-fusion/</link>
		<comments>http://www.bwigg.com/2012/03/ubuntu-11-10-blank-screen-with-underline-after-boot-with-vmware-fusion/#comments</comments>
		<pubDate>Mon, 19 Mar 2012 04:36:23 +0000</pubDate>
		<dc:creator>bawigga</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Virtualization]]></category>

		<guid isPermaLink="false">http://www.bwigg.com/?p=358</guid>
		<description><![CDATA[After installing the latest version of Ubuntu Server with VMWare Fusion, I wasn't able to get to a terminal. The machine would boot and then just give me a blank line with a single underscore. Turns out all I needed to do was switch from TTY7. CMD + OPT + CTL + [F1 - F7]]]></description>
				<content:encoded><![CDATA[<p>After installing the latest version of Ubuntu Server with VMWare Fusion, I wasn't able to get to a terminal. The machine would boot and then just give me a blank line with a single underscore. Turns out all I needed to do was switch from TTY7.</p>
<pre>CMD + OPT + CTL + [F1 - F7]</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.bwigg.com/2012/03/ubuntu-11-10-blank-screen-with-underline-after-boot-with-vmware-fusion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django Fixtures: JSON Formatting</title>
		<link>http://www.bwigg.com/2012/01/django-json-fixtures/</link>
		<comments>http://www.bwigg.com/2012/01/django-json-fixtures/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 04:25:41 +0000</pubDate>
		<dc:creator>bawigga</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[fixtures]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.bwigg.com/?p=318</guid>
		<description><![CDATA[Came across an issue with Django Fixtures using the JSON format. Here was my fixture: Here's the error I was getting: The fix was simple, wrap the object in an array. Found the fix thanks to the following StackOverflow post: http://stackoverflow.com/a/4939147]]></description>
				<content:encoded><![CDATA[<p>Came across an issue with Django Fixtures using the JSON format. Here was my fixture:</p>
<script src="https://gist.github.com/d71de9702a353ebe37b7.js?file=initial_data_broken.json"></script><noscript><pre><code class="language-json json">{
	&quot;pk&quot;: 1,
	&quot;model&quot;: &quot;core.wine&quot;,
	&quot;fields&quot;: {
		&quot;name&quot;: &quot;Juan Gil&quot;,
		&quot;vintage&quot;: 2009
	}
}
</code></pre></noscript>
<p>Here's the error I was getting:</p>
<script src="https://gist.github.com/d71de9702a353ebe37b7.js?file=error.txt"></script><noscript><pre><code class="language- ">Problem installing fixture '.../core/fixtures/initial_data.json': Traceback (most recent call last):
  File &quot;.../python2.6/site-packages/django/core/management/commands/loaddata.py&quot;, line 169, in handle
    for obj in objects:
  File &quot;...python2.6/site-packages/django/core/serializers/json.py&quot;, line 35, in Deserializer
    for obj in PythonDeserializer(simplejson.load(stream), **options):
  File &quot;...python2.6/site-packages/django/core/serializers/python.py&quot;, line 84, in Deserializer
    Model = _get_model(d[&quot;model&quot;])
TypeError: string indices must be integers</code></pre></noscript>
<p>The fix was simple, wrap the object in an array.</p>
<script src="https://gist.github.com/d71de9702a353ebe37b7.js?file=initial_data_fixed.json"></script><noscript><pre><code class="language-json json">[
	{
		&quot;pk&quot;: 1,
		&quot;model&quot;: &quot;core.wine&quot;,
		&quot;fields&quot;: {
			&quot;name&quot;: &quot;Juan Gil&quot;,
			&quot;vintage&quot;: 2009
		}
	}
]
</code></pre></noscript>
<p>Found the fix thanks to the following StackOverflow post: <a title="Type error trying to load fixtures with Content_type natural keys in Django" href="http://stackoverflow.com/a/4939147" target="_blank">http://stackoverflow.com/a/4939147</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bwigg.com/2012/01/django-json-fixtures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript Closures</title>
		<link>http://www.bwigg.com/2011/12/javascript-closures/</link>
		<comments>http://www.bwigg.com/2011/12/javascript-closures/#comments</comments>
		<pubDate>Tue, 27 Dec 2011 01:12:19 +0000</pubDate>
		<dc:creator>bawigga</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[closures]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.bwigg.com/?p=289</guid>
		<description><![CDATA[Javascript closures can be confusing at first. They're not, and hopefully this analogy will help drive home the concept. A Man's Secret - An Analogy A man possess a secret book, which he cannot let anyone else know about. He decides the only way to keep the book truly secret is to memorize the entire [...]]]></description>
				<content:encoded><![CDATA[<p>Javascript closures can be confusing at first. They're not, and hopefully this analogy will help drive home the concept.</p>
<p><strong>A Man's Secret - An Analogy</strong></p>
<p>A man possess a secret book, which he cannot let anyone else know about. He decides the only way to keep the book truly secret is to memorize the entire thing and then bury the book so no one can find it. Later in his years he bears a son. Once his son grows old enough, the father digs up the book and begins having his son commit the entire book to memory. Years later, he has his son rewrite the entire book cover to cover from memory on paper. When the son successfully completes the task, and the father is satisfied that his son truly has the book memorized in it's entirety, the book and the copy of the book the son just wrote are thrown into a fire, completely eliminating any evidence that the book actually existed. A few years later the father dies, leaving the son on his own, with the book committed to memory.</p>
<p>This is similiar to how a javascript closure works. See the following code.</p>
<p><strong>Code Example</strong></p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">var</span> father <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// this is declared as a private variable</span>
    <span style="color: #000066; font-weight: bold;">var</span> secretBook <span style="color: #339933;">=</span> <span style="color: #3366CC;">'Book of Secrets'</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">bearSon</span> <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#123;</span>
            whatWasTheBookYourFatherTaughtYou<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                alert<span style="color: #009900;">&#40;</span>secretBook<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// the father won't tell anyone about the book he has</span>
alert<span style="color: #009900;">&#40;</span>father.<span style="color: #660066;">secretBook</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// undefined</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// the father bears a son</span>
son <span style="color: #339933;">=</span> father.<span style="color: #660066;">bearSon</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// the father dies</span>
father <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">undefined</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// the son still knows the book his father taught him</span>
son.<span style="color: #660066;">whatWasTheBookYourFatherTaughtYou</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// Book of Secrets</span></pre></td></tr></table></div>

<p>secretBook was declared inside the father function and is a private variable, inaccessible to anything outside the father function. The father function <em>closes </em>around the variables declared inside of it. Anything defined inside the father function has access to it, even once the father function has executed and been undefined. The bearSon method returns a new object that contains a function called whatWasTheBookYourFatherTaughtYou.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bwigg.com/2011/12/javascript-closures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
