<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title><![CDATA[Jeremy's Programming Blog]]></title>
  <link href="http://www.jeremymorgan.com/atom.xml" rel="self"/>
  <link href="http://www.jeremymorgan.com/"/>
  <updated>2013-05-30T20:12:39-07:00</updated>
  <id>http://www.jeremymorgan.com/</id>
  <author>
    <name><![CDATA[Jeremy Morgan]]></name>
    
  </author>
  <generator uri="http://octopress.org/">Octopress</generator>

  
  <entry>
    <title type="html"><![CDATA[Dont Build El Caminos]]></title>
    <link href="http://www.jeremymorgan.com/blog/programming/dont-build-el-caminos/"/>
    <updated>2013-05-29T19:32:00-07:00</updated>
    <id>http://www.jeremymorgan.com/blog/programming/dont-build-el-caminos</id>
    <content type="html"><![CDATA[<p>The quickest way to disappoint everyone is by trying to please everyone and software is no different. Sometimes trying to make a &#8220;one size fits all&#8221; solution can get you into trouble.</p>

<h3>Remember the El Camino?</h3>

<p>Back in the late 60s GM made the El Camino, which was part car and part truck. While they were wildly popular with some, the fact is it wasn&#8217;t a car or a truck and didn&#8217;t do either very well.</p>

<p><img class="center" src="http://images.jeremymorgan.com/el-camino-1.jpg" title="El Camino" ></p>

<p>This isn&#8217;t an article to rag on the El Camino but instead talk about quality of &#8220;all in one&#8221; products, especially when it comes to software. One of the biggest problems a programmer creates for themselves is the one size fits all solution.</p>

<blockquote><p>The more features you add to a product the lower quality each feature has to be to meet your deadline.</p></blockquote>

<h3>Where the El Camino Disappoints</h3>

<p>Ok, so you have an idea for this vehicle, and it&#8217;s part car and part truck. The idea is simple, it drives like a car, is low comfortable and you can put a couple dirt bikes in the back of it. Everyone should be happy in reality it&#8217;s quite different.</p>

<p>Those who want it as a car find:</p>

<ul>
<li>It&#8217;s only a two seater.</li>
<li>It doesn&#8217;t have much room.</li>
<li>The bed makes road noise like a pickup</li>
<li>The fuel economy is close to a pickup</li>
<li>The rear of the vehicle is too light for ice and snow</li>
</ul>


<p>Those who want it as a pickup find:</p>

<ul>
<li>You can&#8217;t haul as much weight as a pickup</li>
<li>You can&#8217;t use campers (very popular in the 60s and 70s)</li>
<li>You can&#8217;t tow very much.</li>
<li>It rides low to the ground so it&#8217;s not as safe as a pickup.</li>
</ul>


<p>So as you see, nobody&#8217;s truly happy here. It&#8217;s no big surprise that cars and trucks were still outselling the El Camino. People want something that&#8217;s built for the job.</p>

<h3>How Can This Apply to Software?</h3>

<p>There are a few areas this can apply to software. First is interfaces and features. I&#8217;m no UI expert but I do know that cluttered interfaces are a big mistake. If you&#8217;re selling commercial software it will impact sales, and if you&#8217;re developing internally it will slow down your coworkers. I&#8217;ll give an example.</p>

<h4>Commercial Software</h4>

<p>You&#8217;re building a product that is an HTML editor for building web pages. You have a nice little WYSIWYG interface, file handling and version control. It also has an FTP client interface. These features please the web developers who purchase your software.</p>

<p>But your software is also an optimizing suite that compacts your registry and cleans out old files from your hard drive. It also has a TCP/IP optimizer to speed up your internet, and an image optimizer to make your images smaller and load faster on the web.</p>

<h5>Your software features:</h5>

<ul>
<li>HTML Editor</li>
<li>Registry Cleaner / Compactor</li>
<li>TCP/IP Optimizer</li>
<li>FTP Client</li>
<li>Version Control</li>
<li>Image Optimizer</li>
</ul>


<p>Fancy stuff, right? The software is great for people who want to build websites, and great for people who want a faster computer. Wherever these two intersect you&#8217;ve got some happy customers. But what if they don&#8217;t overlap?</p>

<p><img class="center" src="http://images.jeremymorgan.com/el-camino-2.jpg" title="El Camino" ></p>

<h5>Problem 1:</h5>

<ul>
<li><p>You&#8217;ll have users who only want to edit websites, not tinker with their computer.</p></li>
<li><p>You&#8217;ll have users who want to optimize their computer, not build websites.</p></li>
</ul>


<p>What happens is you have a bunch of features getting in the way for these two groups. Someone optimizing their computer couldn&#8217;t care less about all this web development stuff and won&#8217;t want to stumble through it to get to their registry cleaner. The opposite is true for the web developer.</p>

<h5>Problem 2:</h5>

<p>Because you tried to cram so many features into this one product you&#8217;re faced with a longer development cycle, or reduced quality. This is especially true if you&#8217;re one person. You have to make a choice to either spend 2 years developing a package with everything, or cut some corners.</p>

<p>This has existed in traditional manufacturing for ages. There&#8217;s a reason handcrafted furniture is more expensive than Ikea.</p>

<h5>Problem 3:</h5>

<p>Your focus has to be divided, not only in development but maintenance and updates as well. You&#8217;re either going to have to focus on the web developers or the system optimizers because they&#8217;re both going to want more features for their tasks.</p>

<h5>Problem 4:</h5>

<p>Your competition will likely focus on one group or the other to &#8220;out feature&#8221; your product as quick as they can. They&#8217;ll develop a web editor with a better WYSIWYG, macros and automatic file versioning and uploading. When a web developer does a direct comparison you&#8217;ll lose out.</p>

<p>Your best bet here is to narrow your focus. Photoshop has been around since 1990 and it&#8217;s the industry standard for a reason. You can&#8217;t compact your registry with it but when working with images there&#8217;s no close competitor. This is because they put all their eggs in one basket and focus on the basket.</p>

<h4>Internal Software</h4>

<p>If you write software for internal use at a company it&#8217;s no different. The purchasing agent is likely going to have needs and features that are far different from a sales rep or the CEO. So why should they all be using one interface?</p>

<p>The problem with building a one size fits all for a company is the fact that your company is full of people who aren&#8217;t very computer literate. It&#8217;s not that they&#8217;re stupid, they likely know their field far better than you do. Your job is to make their job easier. Your tool may make perfect sense to you, especially since you built it but it may be a huge cluttered mess for the person using it.</p>

<p><img class="center" src="http://images.jeremymorgan.com/el-camino-3.jpg" title="El Camino" ></p>

<p>It&#8217;s always best to have your software run from a common database, and even a common core behind the scenes. But the best thing you can do is extract &#8220;views&#8221; for each person to use. While the CEO and Purchasing agent are using the same database or even the same data, their presentation is much different and tailored to their job.</p>

<ul>
<li>internalsite.com/purchasing</li>
<li>internalsite.com/inventory</li>
<li>internalsite.com/shipping</li>
</ul>


<p>If you&#8217;re really good you can have a core that manages everything, but each person only sees and deals with the features they use for their job.</p>

<h3>Behind the Scenes</h3>

<p>When you&#8217;re writing code behind the application the same rules apply. You should always be using the <a href="http://www.jeremymorgan.com/blog/programming/single-responsibility-principle/">Single Responsibility Principle</a> wherever it best applies. Instead of making huge objects that try to do everything break down your tasks as much as possible. Bytes are cheap, and since this post has gone on long enough I&#8217;ll cover that in more detail later.</p>

<h3>Conclusion</h3>

<p>Focus is everything. There&#8217;s a reason marketing and software development are always so intertwined. Most of the basic rules of marketing apply to software just as well and focus matters. When you take one problem and solve it in the most elegant way possible and put time into it you have happy users.</p>

<p>When you try to solve too many problems with small effort you end up with an El Camino. Always create the right tool for the job and organize your efforts. Your boss or customers will thank you for it.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Sneak Peek at Android Studio]]></title>
    <link href="http://www.jeremymorgan.com/blog/programming/android-studio-sneak-peek/"/>
    <updated>2013-05-15T19:53:00-07:00</updated>
    <id>http://www.jeremymorgan.com/blog/programming/sneak-peek-of-android-studio</id>
    <content type="html"><![CDATA[<p>Today at the Google I/O conference they announced a bunch of new things, but one that caught my eye was Android Studio, a new development tool for Android Devices. I decided I had to download it and check it out.</p>

<h2>First Impressions</h2>

<p>I&#8217;ll start off by saying I&#8217;m not really an Android developer. I&#8217;ve toyed around with it, and built one app a couple years ago that&#8217;s basically a web wrapper. But after looking through this program I&#8217;m becoming inspired to pick it up again. Google is clearly trying to pay attention to the developers, who are the lifeblood of the Android platform.</p>

<p><img class="center" src="http://images.jeremymorgan.com/android-studio-download-01.jpg" title="Android Studio" ></p>

<p>One thing I noticed right away is this is clearly based off Eclipse, as many IDE&#8217;s are these days. That&#8217;s not really a bad thing, as Eclipse works really well in many ways and there isn&#8217;t any reason to reinvent the wheel. But if you don&#8217;t like Eclipse, you may not like Android Studio.</p>

<p>Here are some cool options right from the start:</p>

<p><img class="center" src="http://images.jeremymorgan.com/android-studio-download-02.jpg" title="Android Studio" ></p>

<p>This is the kind of stuff you&#8217;d expect for starting a project. There are some options here which version to compile with, and themes available. You also have your basic settings, minimum API, etc. Stuff that helps you so you don&#8217;t get in trouble later down the line. Here you have to make your choice whether to support more features, or be compatible with older devices.</p>

<p><img class="center" src="http://images.jeremymorgan.com/android-studio-download-03.jpg" title="Android Studio" ></p>

<p>Here we have some options, that I don&#8217;t really understand, other than it appears you can have a foreground image and adjust your padding. Probably something to play with later.</p>

<p><img class="center" src="http://images.jeremymorgan.com/android-studio-download-04.jpg" title="Android Studio" ></p>

<p>Here we have a set of templates, which is pretty awesome. Some of the more common ones you might run into are built for you. The options are</p>

<p><strong>Blank Activity</strong> - Creates a new blank activity, with an action bar and optional navigational elements such as tabs and vertical swipes.</p>

<p><strong>Fullscreen Activity</strong> - Creates a new activity that toggles the visibility of the system UI (status and navigation bars) and action bar upon user interaction</p>

<p><strong>Login Activity</strong> - Creates a new login activity, allowing users to enter an email address and password to log in to or register with your application</p>

<p><strong>Master / Detail Flow</strong> - Creates a new master/detail flow, allowing users to view a collection of objects as well as details for each object. This flow is presented using two columns on tablet-size screens and one column on handsets and smaller screens. This template creates two activities, a master fragment, and a detail fragment.</p>

<p><strong>Settings Activity</strong> - Creates a new application settings activity that presents alternative layouts on handset and tablet-sized screens.</p>

<p>These give you a nice set of options to start. The most intriguing to me is the Master / Detail flow, which I definitely want to learn more about.</p>

<h3>Note about Performance</h3>

<p>I noticed it&#8217;s a little sluggish loading and building, but I did run this on an older Centrino machine with 4 gigs of RAM. Keep in mind this is an early release, and it&#8217;s an old machine. When actually coding in the IDE it seems to run really well, and I haven&#8217;t had too many quirks.</p>

<p><img class="center" src="http://images.jeremymorgan.com/android-studio-download-05.jpg" title="Android Studio" ></p>

<p>I can&#8217;t say I&#8217;m thrilled with that memory usage though.</p>

<h3>Inside the IDE</h3>

<p>The IDE looks a bit familiar if you&#8217;ve ever used Eclipse, but it&#8217;s got a lot of nice features, and is clearly tailored for Android development.</p>

<p><img class="center" src="http://images.jeremymorgan.com/android-studio-download-06.jpg" title="Android Studio" ></p>

<p>It has everything where you&#8217;d expect it to be, and the syntax highlighting is pretty nice. Code collapsing and most of the features you&#8217;d expect are here.</p>

<p><img class="center" src="http://images.jeremymorgan.com/android-studio-download-07.jpg" title="Android Studio" ></p>

<p>One thing I noted that&#8217;s pretty awesome is the Version Control integration.</p>

<p>There are a lot of awesome tools in this IDE, too many to describe in one article, but the code analysis ones really stand out:</p>

<p><img class="center" src="http://images.jeremymorgan.com/android-studio-download-08.jpg" title="Android Studio" ></p>

<p>I ran some tests on my basic project and found a lot of things worth looking at:</p>

<p><img class="center" src="http://images.jeremymorgan.com/android-studio-download-09.jpg" title="Android Studio" ></p>

<p>Lots of refactoring options. This kind of stuff saves you a lot of time and can even help improve your coding.</p>

<p><img class="center" src="http://images.jeremymorgan.com/android-studio-download-10.jpg" title="Android Studio" ></p>

<p>Overall I think hardcore Android developers are really going to like what&#8217;s included here.</p>

<h3>A few issues</h3>

<p>I mentioned it&#8217;s a little sluggish, but that&#8217;s to be expected with bleeding edge software on old hardware. It&#8217;s only a little slower than Eclipse runs on this machine. But I noticed that I couldn&#8217;t get it to find my phone or my Kindle Fire when I tried:</p>

<p><img class="center" src="http://images.jeremymorgan.com/android-studio-download-11.jpg" title="Android Studio" ></p>

<p>And it wouldn&#8217;t let me run anything in the AVD:</p>

<p><img class="center" src="http://images.jeremymorgan.com/android-studio-download-12.jpg" title="Android Studio" ></p>

<p>Though this could be a configuration error. I couldn&#8217;t find where to change it and gave up, but I&#8217;ll come back to it soon.</p>

<h3>Conclusion</h3>

<p>I&#8217;m sure in the coming days you&#8217;ll hear some complaints and talk of it just being a &#8220;reskinned Eclipse&#8221; but I think Google is going in the right direction with this. There are tons of features I haven&#8217;t even dug into yet, and many I don&#8217;t know as I&#8217;m not really an Android developer at this time. But I did use the ADT environment for Eclipse and I do see some obvious improvments.</p>

<p>Google is showing that the see the value in their developers and are giving them some pretty awesome tools to succeed. There were also some great gaming APIs released today and what we&#8217;re seeing is Google preparing developers to take their popular platform to the next level. It&#8217;s an exciting time to be a programmer indeed.</p>

<p>Download it and try it out!</p>

<p><a href="http://developer.android.com/sdk/installing/studio.html" target="_new"><h3>Download Android Studio Here</h3></a></p>

<br />


<div class="subscribefooter">
<h4>Do you like articles like this?</h4>
<div class="rssbutton"></div>
I&#8217;m constantly hacking on stuff and writing about happenings in the programmer world. You can <a href="http://feeds.feedburner.com/jeremymorgan/NJwt"><strong>subscribe to my feed</strong></a> here, or you can <a href="http://www.feedblitz.com/f?sub=339769"><strong>get the programmer newsletter</strong> spam free!</a>
</div>



]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Intro to ASP.NET MVC 4]]></title>
    <link href="http://www.jeremymorgan.com/tutorials/c-sharp/how-to-asp-mvc/"/>
    <updated>2013-05-01T19:13:00-07:00</updated>
    <id>http://www.jeremymorgan.com/tutorials/c-sharp/intro-to-asp-dot-net-mvc-4</id>
    <content type="html"><![CDATA[<p>The ASP.Net MVC 4 framework was introduced in August of last year and it boasts tons of improvements over MVC 3. If you&#8217;re considering building a large application in .Net, you should consider MVC 4 for your project. Today we&#8217;re going to take a look at it and build a quick website in MVC 4.</p>

<!-- more -->


<h3>What you&#8217;ll need</h3>

<p>In order to complete this tutorial you will need Visual Studio. I have decided to use Visual Studio Express 2012 for Web to do this tutorial. I made this choice because it&#8217;s a free download and not everyone can afford the professional version of Visual Studio, but if you&#8217;re using Visual Studio 2010 or 2012 you can still go along as well.</p>

<h4>Software needed:</h4>

<p><strong><a href="http://www.microsoft.com/visualstudio/eng/downloads#d-2012-express" title="Microsoft Visual Studio Express for Web">Microsoft Visual Studio Express 2012 for Web</a></strong> (or a licensed version of Visual Studio 2010/2012)</p>

<p><strong><a href="http://www.microsoft.com/web/webmatrix/" title="Microsoft Web Matrix 2">Microsoft Web Matrix 2</a></strong> - This is a handy little stack to help organize your server and projects for development</p>

<p><a href="http://www.asp.net/mvc/mvc4" title="Microsoft MVC download"><strong>Microsoft ASP.Net MVC 4</strong></a> - The package you&#8217;ll need to install to deploy this on your website.</p>

<p>Keep in mind all of this is free! The MVC package is also Open Source. It&#8217;s nice to see Microsoft come around with stuff like this.</p>

<h3>Let&#8217;s get set up</h3>

<p>One of the things every Visual Studio has been raving about lately is the NuGet package manager, for good reason. It makes setting things up super easy. We want to make sure we have it installed for our project.</p>

<p>Go to <strong><em>Tools -> Extensions and Updates</em></strong></p>

<p><img src="http://images.jeremymorgan.com/how-to-mvc-asp-4.jpg" alt="How to Program ASP.Net MVC 4" /></p>

<p>And make sure the <strong>NuGet Package Manager</strong> is installed:</p>

<p><img src="http://images.jeremymorgan.com/how-to-mvc-asp-4-2.jpg" alt="How to Program ASP.Net MVC 4" /></p>

<p>This will enable you to install stuff into your website easily. They have a lot of great plugins and templates available.</p>

<h3>Create the Project</h3>

<p>Go to the start section and click &#8220;New Project&#8221; or select it from the File menu. You want make sure to select an ASP.NET MVC 4 Web Application.</p>

<p><img src="http://images.jeremymorgan.com/how-to-mvc-asp-4-3.jpg" alt="How to Program ASP.Net MVC 4" /></p>

<p>On the next screen, select &#8220;Internet Application&#8221;. As you can see there are various options here, feel free to play around with them and see what you come up with.</p>

<p><img src="http://images.jeremymorgan.com/how-to-mvc-asp-4-4.jpg" alt="How to Program ASP.Net MVC 4" /></p>

<p>Now you&#8217;ve created your new MVC application. Let&#8217;s take a look at it. If you press F5 you&#8217;ll see it&#8217;s already assembled into a site. But that doesn&#8217;t do much yet.</p>

<p><img src="http://images.jeremymorgan.com/how-to-mvc-asp-4-5.jpg" alt="How to Program ASP.Net MVC 4" /></p>

<h3>The parts of your MVC application.</h3>

<p>You&#8217;ll notice the controller is opened automatically. Let&#8217;s take a look at it and see what it does:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>public class HomeController : Controller
</span><span class='line'>    {
</span><span class='line'>        public ActionResult Index()
</span><span class='line'>        {
</span><span class='line'>            ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";
</span><span class='line'>
</span><span class='line'>            return View();
</span><span class='line'>        }
</span><span class='line'>
</span><span class='line'>        public ActionResult About()
</span><span class='line'>        {
</span><span class='line'>            ViewBag.Message = "Your app description page.";
</span><span class='line'>
</span><span class='line'>            return View();
</span><span class='line'>        }
</span><span class='line'>
</span><span class='line'>        public ActionResult Contact()
</span><span class='line'>        {
</span><span class='line'>            ViewBag.Message = "Your contact page.";
</span><span class='line'>
</span><span class='line'>            return View();
</span><span class='line'>        }
</span><span class='line'>    }</span></code></pre></td></tr></table></div></figure>


<p>As you can see this is the &#8220;Home&#8221; controller that extends the controller class. Since Home is your default route it will control what&#8217;s seen on your site root.</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>public ActionResult Index()
</span><span class='line'>    {
</span><span class='line'>        ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";
</span><span class='line'>        return View();
</span><span class='line'>    }</span></code></pre></td></tr></table></div></figure>


<p>This is the &#8220;Index&#8221; method, and it&#8217;s not too tough to guess it&#8217;s place. This is what shows up when you hit a root directory. Whatever you put in here gets shown on the page. But let&#8217;s look a little closer inside the method.</p>

<pre>
ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";
</pre>


<p>The ViewBag is a wrapper object used to store dynamic data for the ViewData dictionary object. There are some arguments circulating about which one to use, but since Visual Studio stuffs this in, we&#8217;ll use it. Let&#8217;s change it to something else:</p>

<pre>
ViewBag.Message = "This is my first MVC Project!";
</pre>


<p>Where does this data go? If you open up /Views/Home/Index.cshtml you&#8217;ll see where this object is used.</p>

<p><img src="http://images.jeremymorgan.com/how-to-mvc-asp-4-6.jpg" alt="How to Program ASP.Net MVC 4" /></p>

<p>First, at the top you&#8217;ll see where the ViewBag.Title property is assigned a value:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>@{
</span><span class='line'>    ViewBag.Title = "Home Page";
</span><span class='line'>}</span></code></pre></td></tr></table></div></figure>


<p>This is a part of the Razor engine and it&#8217;s how you change the title of the page when it loads. You can also change it later. Then further down the page you&#8217;ll see:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>&lt;h1>@ViewBag.Title.&lt;/h1>
</span><span class='line'> &lt;h2>@ViewBag.Message&lt;/h2></span></code></pre></td></tr></table></div></figure>


<p>As you can see, this is where the ViewBag.Message you changed earlier will go.</p>

<p>One advantage of this is you can make the text displayed dynamic, pulled from a database, object or other data source without touching the design. You can also use this for localization if needed. The Razor engine is pretty sweet, this is just scratching the surface of it.</p>

<h3>Creating a New Page</h3>

<p>By now you&#8217;ve probably figured out that the methods in the controller correlate with pages: Index(), About(), and Contact(). So let&#8217;s look at creating a new page. We will be creating a page located at &#8220;http://(your site url)/Home/Newpage&#8221;.</p>

<p><strong>1. Create a new ActionResult Method</strong></p>

<p>Inside your HomeController, create a new method:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>public ActionResult Newpage()
</span><span class='line'>{
</span><span class='line'>  ViewBag.Message = "This is a new page! ";
</span><span class='line'>  return View();
</span><span class='line'>}</span></code></pre></td></tr></table></div></figure>


<p>The home controller is found in /Controllers/HomeController.cs</p>

<p>What is this? The HomeController is the controller for your home directory and each ActionResult is a function of that controller or page. In our case the url would be</p>

<p>Http://www.yoursite.com/home/newpage</p>

<p>Each action must have a view, which we&#8217;ll create next.</p>

<p><strong>2. Create a view page</strong></p>

<p>A view is simply an HTML page that displays data and interacts with the controller. You create views for pages or parts of pages, such as menus.</p>

<p>In the /Views/Home/ folder, create a new view by right-clicking on the /Views/Home folder and selecting &#8220;New View&#8221;:</p>

<p><img src="http://images.jeremymorgan.com/how-to-mvc-asp-4-7.jpg" alt="How to Program ASP.Net MVC 4" /></p>

<p>You&#8217;ll see a dialog box that looks like this:</p>

<p><img src="http://images.jeremymorgan.com/how-to-mvc-asp-4-8.jpg" alt="How to Program ASP.Net MVC 4" /></p>

<p>As you can see, this dialog box has a few options. For the view engine, you can choose Razor or ASPX(C#). Choose Razor for this, and leave the rest of the options open. You can create a strongly typed view that&#8217;s based of an object, but we&#8217;ll leave that for another tutorial. Hit add.</p>

<p>You&#8217;ll see the page now in your views folder.</p>

<p><img src="http://images.jeremymorgan.com/how-to-mvc-asp-4-9.jpg" alt="How to Program ASP.Net MVC 4" /></p>

<p>Open up that page, and you&#8217;ll see the following code:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>@{
</span><span class='line'>    ViewBag.Title = "Newpage";
</span><span class='line'>}
</span><span class='line'>
</span><span class='line'>&lt;h2>Newpage&lt;/h2></span></code></pre></td></tr></table></div></figure>


<p>Add some html for fun in there. Also, add the following line:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>Hi! Today is @DateTime.Now.DayOfWeek</span></code></pre></td></tr></table></div></figure>


<p>Save the file, and press F5 to run.</p>

<h3>Your new MVC Page</h3>

<p>To load the page you just created, type in</p>

<p>/home/newpage</p>

<p>after the URL. For instance my local URL is http://localhost:59312/home/newpage but yours may vary. You should see something like this:</p>

<p><img src="http://images.jeremymorgan.com/how-to-mvc-asp-4-10.jpg" alt="How to Program ASP.Net MVC 4" /></p>

<p>This is your newly created view! Feel free to experiment with the views and the Razor view engine. The best way to learn is to break it!</p>

<h2>Summary</h2>

<p>In this tutorial we built a very basic MVC 4 page in ASP.Net. I hope it gets you excited enough to start really experimenting. The MVC package really does a lot of the work for you, you can actually create whole websites without a lot of code at all. But I do hope you will dig into the code, and get rid of some that atrocious HTML that&#8217;s generated and fiddle around.</p>

<p>In a future tutorial I&#8217;ll cover the Entity Framework and show you how easy it is to add data to your MVC Pages. Sign up for my newsletter and you&#8217;ll know right when it&#8217;s posted!</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Where to Find a Cheap Computer in Oregon]]></title>
    <link href="http://www.jeremymorgan.com/blog/portland/cheap-computers-oregon/"/>
    <updated>2013-04-21T14:39:00-07:00</updated>
    <id>http://www.jeremymorgan.com/blog/portland/where-to-find-a-cheap-computer-in-oregon</id>
    <content type="html"><![CDATA[<p>This post isn&#8217;t going to be much use for the majority of my audience, but I am creating this post because I am often referring people to these places, and wanted to create a nice page to send them to.</p>

<p>This is a small list of computer recyclers in my area that I&#8217;ll be updating and spreading around. I&#8217;m a huge fan of computer recycling and low cost computing, if you&#8217;re curious you should look around in your area for some similar non profit recyclers!</p>

<!-- more -->


<h3>Can I use a recycled computer?</h3>

<p>The answer to this isn&#8217;t always yes. If you&#8217;re looking for the latest and greatest, or you play games (real games not Facebook games) you won&#8217;t be able to find what you need here. But mostly what I get asked about is: &#8220;I need a computer for school but don&#8217;t want to pay a lot&#8221; and that&#8217;s one area where recycled computers shine. Here&#8217;s what you can use recycled computers for:</p>

<p><strong>Schoolwork</strong> - High School, college etc. Creating documents and reports, etc. A cheap computer running <a href="http://www.openoffice.org/">OpenOffice</a> will work just fine.</p>

<p><strong>Programming</strong> - A high end machine is nice for programming but not really necessary. You can do web development on just about anything for instance. I do most of the work for this website on a 2004 Powerbook, because it&#8217;s basic text editing. My Windows stuff is done on a 2007 Toshiba Laptop.</p>

<p><strong>Office Management</strong> - Again using a cheap older computer with <a href="http://www.openoffice.org/">OpenOffice</a> and you can do pretty much anything a high dollar new machine will do, only a bit slower. But if you&#8217;re saving $1000 it might be worth the price.</p>

<p><strong>Kid Computers</strong> - If you want a computer for your kids to browse the internet and play learning games an old computer works great. If you&#8217;re ready for the challenge, you can install Linux on it where most versions have TONS of educational software for free. Take <a href="http://www.edubuntu.org/">Edubuntu</a> for a spin and check out all the awesome stuff they have.</p>

<p>This list could be a lot longer but it&#8217;s not the purpose of the article. Basically if you aren&#8217;t playing online games, ripping videos or something of that sort you might notice that a new computer isn&#8217;t a whole lot better than an older one.</p>

<h3>Cheap Computer Recyclers in Oregon</h3>

<p>Here is a list of people I&#8217;ve dealt with personally and really like. You can walk in with a couple hundred bucks and come out with a decent desktop or laptop that works great. They test their equipment, set it up and don&#8217;t try to upsell your or rip you off.</p>

<hr>


<p><strong>Computer Drive Connection - Cornelius Oregon</strong></p>

<p><a href="http://computerdriveconnection.com/">Their Website</a></p>

<p><img class="right" src="http://images.jeremymorgan.com/cheap-computer-oregon.jpg" title="Where to find a cheap computer in Oregon" ></p>

<p>Since this one is closest to my hometown I&#8217;ve been sending a lot of people here. The guy running it is great, he&#8217;s very knowledgeable and honest. Just tell him what you need to use a computer for and he&#8217;ll steer you right. Great prices as well.</p>

<p>For instance, I picked up a 20&#8221; LCD flatpanel monitor there recently for $100. Worked great, no scratches or dead pixels. It&#8217;s the 3rd or 4th monitor I&#8217;ve picked up there that works great.</p>

<p><a href="https://maps.google.com/maps?q=909+N.+Freemont+Lane+%C2%A0%C2%A0%C2%A0Cornelius,+Oregon+97113&amp;ie=UTF8&amp;ll=45.524397,-123.060812&amp;spn=0.002161,0.004823&amp;hnear=909+N+Fremont+Ln,+Cornelius,+Oregon+97113&amp;gl=us&amp;t=h&amp;z=18">Map to their location</a></p>

<p><strong>Phone:</strong> (503) 992-0180</p>

<hr>


<p><strong>Eco Binary - Beaverton Oregon</strong></p>

<p><a href="http://www.ecobinary.com/">Their Website</a></p>

<p><img class="right" src="http://images.jeremymorgan.com/cheap-computer-oregon-1.jpg" title="Where to find a cheap computer in Oregon" ></p>

<p>I just recently discovered this place, and they treated me really well. I picked up a laptop for $100 (the Core2 Toshiba) and an old G4 machine for a server. The dusty old G4 had been sitting a while but he said &#8220;yes, it works if not bring it back&#8221;. Great policy, but the machine did work exactly as advertised.</p>

<p>Again it&#8217;s a good place with knowledgeable people and no sales pressure. It&#8217;s family run and they do a great service for the community and their customers.</p>

<p><a href="https://maps.google.com/maps?q=8240+SW+Nimbus+Ave.+Beaverton,+OR+97008&amp;hnear=8240+SW+Nimbus+Ave,+Beaverton,+Oregon+97008&amp;gl=us&amp;t=h&amp;z=16">Map to their location</a></p>

<p><strong>Phone:</strong> (503) 352-4991</p>

<hr>


<p><strong>Free Geek</strong></p>

<p><a href="http://www.freegeek.org/">Their Website</a></p>

<p><img class="right" src="http://images.jeremymorgan.com/cheap-computer-oregon-2.jpg" title="Where to find a cheap computer in Oregon" ></p>

<p>For those in the Portland Metro area this is another great service you gotta check out. They are a non profit that offers free computers (if you qualify) and free computer classes as well. But if you don&#8217;t qualify for a free one or you feel like supporting them you can visit their <a href="http://www.freegeek.org/thrift-store/">thrift store</a> and purchase items at a great price. All purchases support their mission.</p>

<p><a href="https://maps.google.com/maps?q=1731+SE+10th+Avenue,+Portland,+OR&amp;hnear=1731+SE+10th+Ave,+Portland,+Multnomah,+Oregon+97214&amp;gl=us&amp;t=h&amp;z=16">Map to their location</a></p>

<p><strong>Phone:</strong> (503) 232-9350</p>

<hr>


<h3>Recycled computers are awesome!</h3>

<p>I will be researching more of these types of companies locally and adding to this list. There&#8217;s many reasons getting a recycled computer makes sense, you save money and help keep this stuff from hitting landfills. You support families and volunteers rather than giant corporations.</p>

<p>If you&#8217;re not from the Northwest Oregon area, search for some recyclers in your area! Even if you already have your dream machine it may be worth getting a machine to tinker with for projects, media servers etc. Enjoy!</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[What is MVC?]]></title>
    <link href="http://www.jeremymorgan.com/blog/programming/what-is-mvc/"/>
    <updated>2013-04-10T18:04:00-07:00</updated>
    <id>http://www.jeremymorgan.com/blog/programming/what-is-mvc</id>
    <content type="html"><![CDATA[<p>The MVC or Model View Controller architecture is a software pattern that&#8217;s become very popular over the last few years. With this article we&#8217;ll take a look at MVC, how it works and how it&#8217;s used.</p>

<!-- more -->


<h3>What is MVC?</h3>

<p>MVC is not really a package or a tangible object but more of an idea or methodology. Microsoft has a software package for ASP.Net called <a href="http://www.asp.net/mvc" title="Microsoft MVC">Microsoft MVC</a> but it&#8217;s not really a product as much as an implementation of the pattern. There are other projects out there similar to this, but you can build a Model, View and Controller in any language.</p>

<p>It&#8217;s simply a way of building software that has many benefits, here&#8217;s a rough idea of how it works:</p>

<p><img class="center" src="http://images.jeremymorgan.com/what-is-mvc-1.jpg" title="What is MVC?" ></p>

<p>The MVC Model consists of three parts:</p>

<p><strong>Model</strong> - Usually tied to a database or other data source, this section only deals with raw data in the application.</p>

<p><strong>View</strong> - This is the display functionality of the application. Usually a web page or User Interface.</p>

<p><strong>Controller</strong> - This is what ties the other two together. It takes commands from the user, retrieves or updates data in the model and communicates information back through the view.</p>

<p>When these three parts work together you get a separation of concerns in your code. You have a model which only cares about itself, it merely processes requests and manipulates or sends data. The View is concerned only with displaying the data and providing a way for the user to communicate their next move. The controller merely coordinates the two.</p>

<h3>MVC on the Web</h3>

<p>So how is this applied in real life? Here&#8217;s a diagram of a web site using MVC:</p>

<p><img class="center" src="http://images.jeremymorgan.com/what-is-mvc-2.jpg" title="What is MVC?" ></p>

<p>First the visitor opens a web browser, and a command is sent to the controller to show a web page. The controller then contacts the model, which pulls raw data from the database and passes it back to the controller. The controller then passes it to the view which formats the data and mixes it with html to create a web page you can view.</p>

<h3>Advantages of MVC</h3>

<p>MVC frameworks do not offer any additional performance or features to your application, they exist primarily to help the programmer(s).</p>

<p><strong>Separation of Concerns:</strong> - This is a tenet of good design and encapsulates your functions and creates a defined interface. For example someone working on a model only has to worry about interfacing with a database and getting the right information, but doesn&#8217;t have to worry about browser compatibility at the same time.</p>

<p><strong>Code Reuse:</strong> - Because of the separation of concerns with MVC you can reuse your code easily. If you have a great view object that displays pages well on a phone for example, you can reuse that same code easily as a view in another application.</p>

<p><strong>Decoupling:</strong> - Another tenet of good design, keeping your software decoupled means easier changes down the road. For instance if you&#8217;re changing database servers from one vendor to another do you want to rewrite or modify your model, or the whole piece of software? With a well implemented MVC framework you can do it in a fraction of the time.</p>

<p><strong>Testability</strong> - While having your software decoupled and separated is good for programming, it&#8217;s great for testing. You can take a section of code and easily run various tests on specific parts of the program as you go along and those tests can be very focused. Are you looking for data integrity? Expected display? When functions are clearly grouped testing becomes far simpler and more organized.</p>

<h3>Disadvantages of MVC</h3>

<p>So if MVC is the greatest thing since sliced bread then why isn&#8217;t everyone doing it all the time? It&#8217;s a mistake to think MVC is a magic bullet that will cure all your software problems.</p>

<p><strong>Complexity</strong> - MVC adds a layer of complexity to any project. This is a cost that&#8217;s acceptable with a huge payoff and that usually comes from large projects that would be complex anyway. But a small app or widget is better off without such complexity. Sometimes MVC just adds more work to a task that would otherwise be simple.</p>

<p><strong>Can affect performance</strong> - If you have a simple widget that uses 20 lines of code and a simple task it could very well be slower when done in an MVC environment. Again it comes down to cost vs benefit, and MVC doesn&#8217;t always win.</p>

<p><strong>You may be using non MVC code in your project</strong> - You could be stuck with code that is already built with model and view functionality tightly integrated. Trying to mix and match in an MVC model can cause more problems than it solves.</p>

<p><strong>Additional Resource Usage</strong> - MVC frameworks are avoided in low resource environments such as embedded software and programs designed to run very lean. When you&#8217;re building a web app on a big server the fractional increase in memory usage is well worth the benefits but if you&#8217;re counting bytes or squeezing something onto a chip it&#8217;s best to avoid them.</p>

<h3>Summary</h3>

<p>I hope I&#8217;ve given you a general idea of what MVC is and you may even be considering it for your next project. Generally the following projects are best suited for MVC frameworks or design:</p>

<ul>
<li>Large web applications</li>
<li>Large projects</li>
<li>Projects with multiple programmers</li>
<li>Projects with separate designers and programmers</li>
<li>Anything that may scale larger in the future</li>
<li>Projects that will have an API</li>
</ul>


<p>In future articles I will go over how MVC is changing and being implemented in today&#8217;s application. It&#8217;s been around since the 80s and the classic MVC model is changing and adapting to new trends. I&#8217;ll also do a tutorial showing how to do a basic MVC design with PHP. Till then send me your comments and questions if you have them!</p>

<br />


<div class="subscribefooter">
<h4>Do you like articles like this?</h4>
<div class="rssbutton"></div>
I&#8217;m constantly hacking on stuff and writing about happenings in the programmer world. You can <a href="http://feeds.feedburner.com/jeremymorgan/NJwt"><strong>subscribe to my feed</strong></a> here, or you can <a href="http://www.feedblitz.com/f?sub=339769"><strong>get the programmer newsletter</strong> spam free!</a>
</div>



]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[How I improved the speed of my mobile app by over 1000%]]></title>
    <link href="http://www.jeremymorgan.com/blog/programming/making-firecom-faster/"/>
    <updated>2013-04-03T20:34:00-07:00</updated>
    <id>http://www.jeremymorgan.com/blog/programming/making-firecom-faster</id>
    <content type="html"><![CDATA[<p>A couple years ago I wrote an app called &#8220;FireCom&#8221; for the Android phone that&#8217;s basically just a listing of active Fire and EMS calls in Washington County, Oregon. I never expected too many people to use it and gave it away so I didn&#8217;t put a lot of time into it. As it turned out a lot of people started using it, so lately I decided to put a little more effort into it.</p>

<!-- more -->


<h3>What is FireCom?</h3>

<p><img class="right" src="http://images.jeremymorgan.com/firecom-android-app-5.jpg" title="FireCom Android App" > I created the application in February 2011, and it spawned from being a volunteer firefighter and looking up calls on our <a href="http://www.wccca.com/PITS/">Joint CAD Incident Tracking System</a> which a listing of calls in our local county plotted out on a Google map.</p>

<p>There is also a <a href="http://www.broadcastify.com/listen/feed/1102/web/?rl=rr">link to audio</a> there as well, and when I was in the Fire Academy I listened a lot to learn everything from radio etiquette to fireground strategy. Turns out there&#8217;s a lot you can learn by listening to this stuff.</p>

<p>But if you tried to look up any of this data on your phone, it was less than great. Sometimes curiosity takes over as well, when you see a speeding ambulance or fire truck you want to know where they are going or what&#8217;s going on.</p>

<p>This is why I created the <a href="https://play.google.com/store/apps/details?id=com.jeremymorgan.wccca&amp;hl=en">FireCom app</a>, I wanted to make something quick and easy someone could bring up on their phone that would show that information. After some research and digging around I found a script written by <a href="http://gary.moonrize.com/">Gary Kee</a> that scraped the calls from an RSS feed to post on Twitter. It was the perfect missing link.</p>

<h3>How the first FireCom worked.</h3>

<p>The first iteration of the FireCom app parsed the XML feed and displayed the results on the screen using Java. I found it to be pretty slow and really unreliable, so it didn&#8217;t last very long. I&#8217;m not an expert Java or Android programmer and didn&#8217;t want to mess with it very much. So instead I decided to stick with what I was good at, and created a PHP page on this site that scraped the data and formatted it into nice little page. Then I created a WebView wrapper that simply brought up the page.</p>

<p>It worked great for a couple years. As I said I didn&#8217;t expect many people to use it and I used it myself for quite a while. But after a while I would started getting emails from people about it, and talking to fellow firefighters who were using it all the time. The two complaints I kept hearing were how slow it was sometimes, and how the map function didn&#8217;t work well. It took a few seconds to load because it was basically set up like this:</p>

<p><img src="http://images.jeremymorgan.com/firecom-android-app-1.jpg" alt="FireCom Android App" /></p>

<p>Basically the WebView loaded up a PHP page on my server. The PHP page pulled the data from the output XML in realtime from the WCCCA server. It parsed it and created some HTML for the page formatted for the phone and did some cleanup of the text and station names. I decided using a WebView would be the best way so I could make updates and changes without making someone download the updates constantly.</p>

<p>The biggest problem was it was accessing this XML file every time someone loaded up the app, and sometimes it was quite slow. It&#8217;s a large XML file that&#8217;s dynamically generated and it puts out a lot of data that had to be parsed, and only a small portion is actually used. There were times when it really took a long time to load, and on a phone that can be even worse. Here was the average load time the night I upgraded the app:</p>

<p><img src="http://images.jeremymorgan.com/firecom-android-app-2.jpg" alt="FireCom Android App" /></p>

<p>As you can see the time isn&#8217;t that great. There are a few reasons, the slow XML process I described, plus the repeat view isn&#8217;t going to be any different. I turned off caching on this script because it&#8217;s live data that shouldn&#8217;t be cached. 4 seconds may not seem like much, but it&#8217;s really pretty sluggish and I think folks using the app just got accustomed to pressing the icon and waiting for the results. Could I fix that? I came up with a new way to solve that very problem.</p>

<h3>The new, improved FireCom</h3>

<p>For the second iteration, I decided to do a few things to speed it up.</p>

<ul>
<li><strong>Remove excess HTML</strong> - Anything that wasn&#8217;t absolutely required was removed. Should have done this a long time ago.</li>
<li><strong>Compressed HTML</strong> - I removed all returns and whitespace from the file. Just a single line of html was pushed out.</li>
<li><strong>Optimized the WCCCA image</strong> - This is a small thing, but on a mobile connection it can make a difference. I also set caching for this image.</li>
<li><strong>Refactored the application</strong> - This is the process I&#8217;ll detail below.</li>
</ul>


<p>I refactored the application by changing the way I pulled the data. Instead of accessing the XML file every time a user brought up the app, I created a script to pull the data, and generate the feed.php file.</p>

<p><img src="http://images.jeremymorgan.com/firecom-android-app-3.jpg" alt="Firecom Android App" /></p>

<p>The feed.php file is now actually only a single line of HTML. But since there are already about 2000 people pointing to that file, it wouldn&#8217;t be wise to change it. So now I have a feedloader that reads the xml and generates a static PHP file to read, so the load time is considerably faster:</p>

<p><img src="http://images.jeremymorgan.com/firecom-android-app-4.jpg" alt="FireCom Android App" /></p>

<p>Over 10 times faster in fact. The repeat view is a little faster as well due to the image caching. So now the app is way faster, and my job is done right? Not exactly.</p>

<h3>Now we have a new problem</h3>

<p>So if you&#8217;ve looked at the new system you&#8217;ve figured out that the feedloader does the heavy lifting and just generates a static PHP file for the app. This is where the majority of the speed improvements have come from. But this file has to be run pretty frequently, because with the old system feed.php was in realtime, now it is a static file. If I don&#8217;t update it then the users are stuck with old information.</p>

<p>Since I&#8217;m hosted on a Windows server, I can&#8217;t just whip up a quick CRON job for this. I set up Windows Scheduler to run this file every 2 minutes or so. After watching it very closely and doing some testing I found that it is very spotty. Sometimes it will run every two minutes consistently, and sometimes it will run every 5, or even ten minutes. Since I am not the admin of this server there isn&#8217;t much I can do.</p>

<h3>Let&#8217;s crowd source it!</h3>

<p><img class="right" src="http://images.jeremymorgan.com/firecom-android-app-6.jpg" title="FireCom Android App" >
I was thinking of having it randomly run the feedloader when someone loads the app. Maybe one out of every 100 people visiting would trigger the feedloader and that would refresh the feed.php for everyone. But this seemed like a terrible solution because I&#8217;m picking users at random to have a slow experience. While 99 people get a snappy page, that one person is stuck loading the file for the feed. Not a great solution.</p>

<p>I decided to let the scheduled task continue to run in it&#8217;s spotty fashion, and I put a &#8220;last updated&#8221; timestamp into the page. Then I put a &#8220;refresh data&#8221; button in that runs the feed loader. This also takes 4-5 seconds but at least the user is <em>choosing</em> to take that time in order to see the newest version of the page. I&#8217;m not springing it on people expecting people do it without their permission.</p>

<p>In the future I&#8217;m likely going to migrate this to a Linux server and set up a cron job. I&#8217;ve never really seen those fail, but Windows scheduler is a different story. I may even set up something on my Raspberry Pi to do the job who knows.</p>

<h3>Lessons Learned</h3>

<p>What I learned from this, is the value of making a WebView app when you can. This way you can do all kinds of stuff behind the scenes without bothering the user with updates all the time. Naturally not every app can be made into a WebView but if you can, it&#8217;s worth trying.</p>

<p>I also learned every little bit counts, and while moving feed.php to a static file was the big performance improvement, the little stuff like html compression helps too. When it comes to page speed, every tiny thing counts. When you&#8217;re dealing with mobile devices and varying amounts of bandwidth it does a lot of good to cut down the amount of data you&#8217;re transferring. For some people it&#8217;s even saving them on their bill.</p>

<p>Overall I&#8217;m glad people are using this app, and I hope the faster version works better for them.</p>

<br />


<div class="subscribefooter">
<h4>Do you want to be notified every time a new tutorial is posted?</h4>
<div class="rssbutton"></div>
If you want to see more tutorials like these <a href="http://www.feedblitz.com/f?sub=889026"><strong>subscribe to our spam free newsletter</strong></a> and get them instantly in your inbox or feed reader.
If you want to get all my updates, <a href="http://feedburner.google.com/fb/a/mailverify?uri=jeremymorgan/NJwt&amp;loc=en_US"><strong>subscribe to the main RSS feed</strong></a> here.
</div>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[How to Build C# apps on Your Raspberry Pi]]></title>
    <link href="http://www.jeremymorgan.com/tutorials/raspberry-pi/how-to-c-sharp-raspberry-pi/"/>
    <updated>2013-03-28T20:50:00-07:00</updated>
    <id>http://www.jeremymorgan.com/tutorials/raspberry-pi/how-to-run-net-on-your-raspberry-pi</id>
    <content type="html"><![CDATA[<p>Want to run and build .Net applications on your Raspberry Pi? In this article I&#8217;ll show you how. With Mono you can develop and run .Net applications on your Raspberry Pi. I got a few emails about this, so I decided to create a quick tutorial.</p>

<!-- more -->


<h3>What&#8217;s the Purpose here?</h3>

<p>If you&#8217;re thinking of running your favorite Windows .Net applications, or setup a fancy ASP.NET server, you may be disappointed. While Mono does a great job and the Raspberry Pi performs great for what it is, I wouldn&#8217;t say this solution is ready for the big leagues, and definitely not something you want to do in a production or commercial environment.</p>

<p>If you want to tinker around and learn C#, and maybe build a few cool apps this is a great way to do it. The Raspberry Pi is a great tool for learning, and that&#8217;s the purpose of this project.</p>

<p><img class="center" src="http://images.jeremymorgan.com/how-to-raspberry-pi-net-1.jpg" title="How to run .Net on Raspberry Pi" ></p>

<p>There are tons of MONO applications available in Raspbian but we&#8217;re only going to cover some basics.</p>

<h3>Install Mono</h3>

<p>Mono is an awesome project that brings .Net to Linux. It&#8217;s available for the Raspian image, and super easy to set up.</p>

<p>Update your repos:</p>

<pre>sudo apt-get update</pre>


<p>And install the Mono Runtime:</p>

<pre>sudo apt-get install mono-runtime</pre>


<p>This one could take a while. It updated a lot of stuff on my system.</p>

<pre>sudo apt-get install mono-mcs</pre>


<p>Note about MonoDevelop: You can install this on a soft float install of Raspian or Arch but it&#8217;s not the best performing application in these conditions. Mono still has a lot of problems with the Pi that need to be ironed out, and MonoDevelop is a long ways off.</p>

<h3>Build a quick application.</h3>

<p>Load up LeafPad (or whatever your favorite text editor is) and create a file called monotest.cs and save it somewhere where you&#8217;ll find it.</p>

<p>Enter the following code:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>using System;
</span><span class='line'>
</span><span class='line'>namespace Test
</span><span class='line'>{
</span><span class='line'>    class Program
</span><span class='line'>    {
</span><span class='line'>        public static void Main()
</span><span class='line'>        {
</span><span class='line'>            Console.WriteLine("Hello! This is a Mono app running on {0}", Environment.OSVersion);
</span><span class='line'>        }
</span><span class='line'>    }
</span><span class='line'>}</span></code></pre></td></tr></table></div></figure>


<p>Now, open up an LX Terminal and go to where this file is located (I just put it in a folder called monotest as well). Type in the following:</p>

<pre>
mcs monotest.cs
</pre>


<p>This should only take a couple seconds. Then list the files in your directory (using the ls command) you will see a new file:</p>

<pre>
monotest.cs
monotest.exe
</pre>


<p>Now, you can run the monotest.exe by typing in:</p>

<pre>
mono monotest.exe
</pre>


<p>You will see something like this:</p>

<p><img class="center" src="http://images.jeremymorgan.com/how-to-raspberry-pi-net-3.jpg" title="How to run .Net on Raspberry Pi" ></p>

<p>And you&#8217;re ready to go! If you see this, that means it worked.</p>

<h3>So what can you do now?</h3>

<p>You can write basic C# console applications all day with this setup. You can build neat automation items, and even some GUI stuff if you really want to dig into it. You can write .Net 1.0 - 4.0 applications with varying success. The most valuable thing you do is learn some C# basics and experiment like crazy.</p>

<p>C# is one of my favorite languages, so it&#8217;s awesome to see options for playing with it without being forced to use Windows and Visual Studio, which are great tools but expensive for hobbyists. As I said this is nowhere near something for production use, but excellent for tinkering and learning which is of course what the Raspberry Pi is all about!</p>

<br />


<div class="subscribefooter">
<h4>Do you like my Rasbperry Pi Tutorials? </h4>
<div class="rssbutton"></div>
I&#8217;m constantly hacking on stuff with the Raspberry Pi. If you want to get notified every time I post a new article <a href="http://feeds.feedburner.com/JeremyMorganRaspberryPi"><strong>subscribe to my Raspberry Pi feed</strong></a> here, or you can <a href="http://www.feedblitz.com/f?sub=883810"><strong>Sign up for the Raspberry Pi Newsletter</strong></a> spam free!  
</div>



]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[The Single Responsibility Principle]]></title>
    <link href="http://www.jeremymorgan.com/blog/programming/single-responsibility-principle/"/>
    <updated>2013-03-20T21:04:00-07:00</updated>
    <id>http://www.jeremymorgan.com/blog/programming/the-single-responsibility-principle</id>
    <content type="html"><![CDATA[<p>There&#8217;s a lot of genius in simplicity. This applies to many things in life and definitely in software development. SRP, or Single Responsibility Principle is one of the foundations building better software. It&#8217;s a good way to keep code working as expected, and to avoid painting yourself in a corner.</p>

<!-- more -->


<h3>Do one thing and do it well</h3>

<p>The Single Responsibility Principle guides simplicity, and the rule itself is strikingly simple: There should never be more than one reason for a class to change. This is easier said than done of course, but the idea is if you have more than one reason to change a class, then you should break it into two classes.</p>

<p>This goes for methods as well, as sometimes folks tend to cram a bunch of functions into a method. The problem with that is, when part of that method changes drastically, you may have to modify the signature or output of the method. Overloading can help there, but it&#8217;s still better to separate tasks as much as possible. Creating another class or method doesn&#8217;t cost a thing.</p>

<p>I know OOP design usually dictates getting as much done in an object as you can, but this can lead to growing pains down the road. This is where extending and inheritance can really come in handy.</p>

<h3>A SRP Violation</h3>

<p>Ok one of the biggest violators I have seen is mixing presentation with data. With the MVC movement in full swing you don&#8217;t see as much of it anymore, but it still happens. Take the following class from a blog app:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>class Page {
</span><span class='line'>
</span><span class='line'>  public function drawIndex() {
</span><span class='line'>      $this->getArticle($id);
</span><span class='line'>      // some code to output HTML
</span><span class='line'>  }
</span><span class='line'>  
</span><span class='line'>  private function getArticle($id){
</span><span class='line'>      // query the database for the latest article
</span><span class='line'>  }
</span><span class='line'>
</span><span class='line'>}</span></code></pre></td></tr></table></div></figure>


<p>Why is this bad? It looks pretty simple, and it&#8217;s pretty easy to use. The reason it&#8217;s bad is because it does two separate things, it gets and article from the database, then it outputs html. This is not only a violation of the Single Responsibility Principle but Separation of Concerns as well.</p>

<p>What happens when you change databases? This happens all the time. You have now made drastic changes to the getArticle function, and maybe even the output that comes from the database. This is bad design to have this coupled with your presentation code and even puts it at risk. Plus, let&#8217;s say you want to display the output to JSON as well. Where would that method go? Lumping it all together creates a huge mess later down the road.</p>

<p>Not to mention the fact that your designers and your DBA might both be dipping into the same class&#8230; is that something you really want?</p>

<h3>The Solution</h3>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>class Page {
</span><span class='line'>
</span><span class='line'>  public function drawIndex() {
</span><span class='line'>      $data = $model->getArticle($id);
</span><span class='line'>      // functions to output HTML
</span><span class='line'>  }
</span><span class='line'>}
</span><span class='line'>
</span><span class='line'>class Model {
</span><span class='line'>
</span><span class='line'>  public function getArticle($id){
</span><span class='line'>      // query the database for the latest article
</span><span class='line'>      
</span><span class='line'>  return $data;
</span><span class='line'>  }
</span><span class='line'>
</span><span class='line'>}</span></code></pre></td></tr></table></div></figure>


<p>Once you break it into two classes you create a Separation of Concerns. The Page class generates web pages, and the Model gets data from your database. The page doesn&#8217;t care what the model is doing as long as it takes in data (the article id) and outputs data (the article) as expected. You can change the model to connect to any data source you want, and the Page class doesn&#8217;t care.</p>

<p>And the Page class is now free to output data any way it wants. If you want to create some html, you can create a method to do that, output some JSON, XML whatever, with the same data from the model. By separating them you give yourself a lot more freedom down the road to change and modify.</p>

<blockquote><p>Just remember, if there is more than one reason to change, split it up.</p></blockquote>

<h3>When to implement the Single Responsibility Principle</h3>

<p>In theory you want to do this from the very beginning. As you&#8217;re designing your application you should always keep this in mind. In practice it&#8217;s not always easy and sometimes you just have to get your project finished. This is where refactoring comes in.</p>

<p>You should always go back and refactor your code at some point because business rules change, requirements change and things get added on and subtracted. Good code refactoring can really improve your development process. Remember, you&#8217;re optimizing for humans here, and the easier it is for you or another programmer to make changes the better off you&#8217;ll be down the road.</p>

<p>For more information about the Single Responsibility Principle, check out <a href="http://www.amazon.com/gp/product/0137208715/ref=as_li_ss_tl?ie=UTF8&camp=1789&creative=390957&creativeASIN=0137208715&linkCode=as2&tag=webfootcentra-20">Principles of Object Oriented Analysis and Design</a> by James Martin.</p>

<br />


<div class="subscribefooter">
<h4>Do you like articles like this?</h4>
<div class="rssbutton"></div>
I&#8217;m constantly hacking on stuff and writing about happenings in the programmer world. You can <a href="http://feeds.feedburner.com/jeremymorgan/NJwt"><strong>subscribe to my feed</strong></a> here, or you can <a href="http://www.feedblitz.com/f?sub=339769"><strong>get the programmer newsletter</strong> spam free!</a>
</div>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[How to Watch Netflix in Ubuntu Linux]]></title>
    <link href="http://www.jeremymorgan.com/tutorials/linux/how-to-netflix-ubuntu-linux/"/>
    <updated>2013-03-15T20:29:00-07:00</updated>
    <id>http://www.jeremymorgan.com/tutorials/linux/how-to-install-netflix-in-ubuntu-linux</id>
    <content type="html"><![CDATA[<p>One of the biggest hurdles to Linux adoption is getting stuff to work in Linux that works great in Windows. Microsoft has enjoyed a huge market share over the years, and because of that when companies develop commercial software they target Windows first, and maybe OSX. Linux is either an option for companies with a geekier application, or their product is either emulated or ported by dedicated Linux hackers. What this does is ensure you pretty much need a Windows box somewhere for some task. But this changes every day.</p>

<!-- more -->


<h3>Netflix in Linux - A long wait</h3>

<p>Netflix is something that Linux hackers have wanted for years. Netflix is written in Silverlight / .Net and it looks like that isn&#8217;t going to change anytime soon. The frequent requests for a Linux Native Netflix client have been ignored, as there would be a serious expenditure for them to build a different streaming system, and they&#8217;d have the problem of supporting two.</p>

<p>So the solution most used was to create a Virtual machine with a Windows and watch it that way. Not the best option, but at least a working one. Then along comes someone like <a href="http://www.compholio.com/" target="_blank">Erich E. Hoover, Ph.D</a> to create a more elegant and easier solution. That&#8217;s the solution I&#8217;ll be outlining here. It&#8217;s super easy, and doesn&#8217;t take as much horsepower as a dedicated Windows virtual machine either.</p>

<h3>How to Install The Tools to Watch Netflix in Linux</h3>

<p>Note that this is by no means an official Netflix solution, nor is it endorsed or encouraged by them. I&#8217;m using Ubuntu 13.04 Raring Ringtail for this installation, but it works in many Ubuntu versions and variants.</p>

<p>First, update your system:</p>

<pre>
sudo apt-get update
</pre>


<p>Then, add the repository:</p>

<pre>
sudo apt-add-repository ppa:ehoover/compholio
</pre>


<p>Now run the following:</p>

<pre>
sudo apt-get update && sudo apt-get install netflix-desktop
</pre>


<p>This may take a while, especially if you&#8217;re on a slow connection. You&#8217;ll see the following screen:</p>

<p><img src="http://images.jeremymorgan.com/how-to-netflix-linux-0.jpg" title="How to install Netflix in Linux" ></p>

<p>Agree to it (if you want to install this). After it installs a pile of stuff, you&#8217;ll see the Netflix icon on your start bar under &#8220;Sound and Video&#8221; (I&#8217;m using LXDE but it&#8217;s pretty easy to find with other Window managers).</p>

<p><img src="http://images.jeremymorgan.com/how-to-netflix-linux-1.jpg" title="How to install Netflix in Linux" ></p>

<p>The first time you run it, will get a window asking you to install Mono:</p>

<p><img src="http://images.jeremymorgan.com/how-to-netflix-linux-2.jpg" title="How to install Netflix in Linux" ></p>

<p>Then it will need to install Gecko (Firefox for watching)</p>

<p><img src="http://images.jeremymorgan.com/how-to-netflix-linux-3.jpg" title="How to install Netflix in Linux" ></p>

<p>Then you&#8217;re ready to go. You may get a few errors that pop up here and there but it will still work.</p>

<h3>The Final Result</h3>

<p>That&#8217;s it! This is all there is to installing Netflix in Linux.</p>

<p><img src="http://images.jeremymorgan.com/how-to-netflix-linux-4.jpg" title="How to install Netflix in Linux" ></p>

<p>My only complaint so far is not being able to put it into smaller window, but I&#8217;ll figure out how to do that and update this article soon. I noticed the Video quality and Sound are the same as they are in Windows, and you can go full screen and it works great! Thanks Erich for creating this awesome solution.</p>

<br />


<div class="subscribefooter">
<h4>Do you want to be notified every time a new tutorial is posted?</h4>
<div class="rssbutton"></div>
If you want to see more tutorials like these <a href="http://www.feedblitz.com/f?sub=889026"><strong>subscribe to our spam free newsletter</strong></a> and get them instantly in your inbox or feed reader.
If you want to get all my updates, <a href="http://feedburner.google.com/fb/a/mailverify?uri=jeremymorgan/NJwt&amp;loc=en_US"><strong>subscribe to the main RSS feed</strong></a> here.
</div>



]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[How to Set up the Ultimate PHP Dev Machine in Ubuntu 13.04]]></title>
    <link href="http://www.jeremymorgan.com/tutorials/linux/ultimate-php-ubuntu-13-04-raring-ringtail/"/>
    <updated>2013-03-07T19:55:00-08:00</updated>
    <id>http://www.jeremymorgan.com/tutorials/linux/how-to-set-up-the-ultimate-php-dev-machine-in-ubuntu</id>
    <content type="html"><![CDATA[<p>Today I&#8217;m going to tell you how to build the ultimate PHP development environment in Ubuntu 13.04 (Raring Ringtail). PHP has been getting a lot of flack lately, but there is still a lot of enterprise level professional development going on with this language. And hey, I love .Net programming but you can build solid, quality PHP applications with the right knowledge and the right tools. Today I&#8217;ll tell you how set that up.</p>

<!-- more -->


<h3>What we&#8217;ll need</h3>

<p>This is going to be a fairly long tutorial, but worth the trouble. In order to set up a this development environment, here is what we&#8217;ll need:</p>

<ul>
<li>A PHP 5 Installation.</li>
<li>A local instance of a Web Server.</li>
<li>An IDE</li>
<li>A debugger</li>
<li>A unit tester</li>
</ul>


<p>This is an enterprise class setup, and believe it or not the entire thing is free. That&#8217;s what makes this so much cooler than developing .Net in Visual Studio. All you need is a computer.</p>

<h3>Set up PHP and our Web Server</h3>

<p>The first thing we&#8217;ll want to do is set up our web server. What this will do is put a local server on your machine for development. You really don&#8217;t want to be saving and uploading to a server over and over, especially for a big project.</p>

<p>There are a few ways we can do this:</p>

<p><strong>Compile from Source</strong> - The best option for custom stuff and the most performance. It&#8217;s a great way to do it, but not how we&#8217;re going to set it up today.</p>

<p><strong>Install from apt-get or Software Center</strong> - Also a great option, super easy and a good way to get the latest and greatest. Also not the way we&#8217;re going to do it today.</p>

<p><strong>Install Zend Server </strong> because of the extra tools and nice integration, we&#8217;re going to be using the Zend Server Community edition. It&#8217;s an easy setup, and free.</p>

<p>Download <a href="http://www.zend.com/en/products/server/" title="Zend Server">Zend Server Here</a> and save it.</p>

<p><img src="http://images.jeremymorgan.com/php-development-in-ubuntu-13-04-raring-ringtail-1.png" alt="Install PHP in Ubuntu 13.04 Raring Ringtail" /></p>

<p>Now click on the home folder and go to downloads, and you&#8217;ll see it:</p>

<p><img src="http://images.jeremymorgan.com/php-development-in-ubuntu-13-04-raring-ringtail-2.png" alt="Install PHP in Ubuntu 13.04 Raring Ringtail" /></p>

<p>Double click it and extract it somewhere. I just put it in the download folder.</p>

<p><img src="http://images.jeremymorgan.com/php-development-in-ubuntu-13-04-raring-ringtail-3.png" alt="Install PHP in Ubuntu 13.04 Raring Ringtail" /></p>

<p>Sorry if some of this seems kind of basic, but I want to make sure everyone gets a chance to do this. If you have any questions feel free to comment.</p>

<h4>Install Zend Server</h4>

<p>To install this, we will run a script in the terminal. Zend provides a script for Ubuntu that sets up your repositories and downloads a fresh version and saves you a lot of work.</p>

<p>Click the launcher in the upper left corner of the screen, and type in &#8220;terminal&#8221;. Then click the terminal icon.</p>

<p><img src="http://images.jeremymorgan.com/php-development-in-ubuntu-13-04-raring-ringtail-4.png" alt="Install PHP in Ubuntu 13.04 Raring Ringtail" /></p>

<p>In the terminal, type in</p>

<pre>
sudo -s
</pre>


<p>and hit enter. This will make you root. Then go to your download folder and type in</p>

<pre>
./install_zs.sh 5.4
</pre>


<p><img src="http://images.jeremymorgan.com/php-development-in-ubuntu-13-04-raring-ringtail-5.png" alt="Install PHP in Ubuntu 13.04 Raring Ringtail" /></p>

<p>And the script will start. After it updates everything if it&#8217;s successful it will ask you:</p>

<pre>
Need to get 101 MB of archives
After this operation, 340 MB of additional disk space will be used. 
Do you want to continue [Y/n]?
</pre>


<p>Click Y to continue. If you have a slow connection or computer, go grab a soda.</p>

<p>If it&#8217;s successful, you&#8217;ll see this screen:</p>

<p><img src="http://images.jeremymorgan.com/php-development-in-ubuntu-13-04-raring-ringtail-6.png" alt="Install PHP in Ubuntu 13.04 Raring Ringtail" /></p>

<p>Now, open FireFox and go to the following web address:</p>

<pre>
http://localhost:10081/ZendServer
</pre>


<p>Agree to the terms of service and click next.</p>

<p>Select &#8220;Development&#8221; and click next.</p>

<p>Enter the password you want to use for the admin interface.</p>

<h3>How to make sure it&#8217;s the free version</h3>

<p>Once the web interface is open, you will see this is a &#8220;Zend Server Enterprise Trial&#8221;. If you want to use the full version during the trial, or even purchase it that&#8217;s great. But if you can&#8217;t afford the price tag or just need the bare features, go up to the upper right hand corner to your messages:</p>

<p><img src="http://images.jeremymorgan.com/php-development-in-ubuntu-13-04-raring-ringtail-7.png" alt="Install PHP in Ubuntu 13.04 Raring Ringtail" /></p>

<p>And then click details</p>

<p><img src="http://images.jeremymorgan.com/php-development-in-ubuntu-13-04-raring-ringtail-8.png" alt="Install PHP in Ubuntu 13.04 Raring Ringtail" /></p>

<p>And select &#8220;Use free edition&#8221;. Don&#8217;t worry, it will still have plenty of awesome stuff for us to use.</p>

<h3>Set up your web folder</h3>

<p>By default the website&#8217;s files are published to /var/www. Usually people either set up virtual user directories or point the web root. The simplest way, is just to add permissions for your account to access the web folder:</p>

<pre>
sudo chown -R [your username] /var/www
</pre>


<p>That way you can write to the /var/www folder. You can even create a symbolic link to a folder in your home folder. One thing I usually do is:</p>

<pre>
ln -s /var/www/ /home/jeremy/
</pre>


<p>This makes it a little quicker to get to my web folder after logging in.</p>

<h3>Create your php info page</h3>

<p>If you&#8217;re a php dev, you&#8217;ve likely done this a million times. In your web directory, create a file called phpinfo.php (or whatever you want). Inside that file put the following code:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>&lt;?php phpinfo(); ?></span></code></pre></td></tr></table></div></figure>


<p>And load it up in your browser. You can use this page to see all your PHP settings.</p>

<h3>Make your utilities usable system wide.</h3>

<p>Zend Server installs stuff like PEAR, PECL, etc but it&#8217;s not installed in the usual locations and it isn&#8217;t in your path. Run these commands to make them avaialable system wide.</p>

<pre>
sudo ln -s /usr/local/zend/bin/zendctl.sh /usr/sbin/zendctl
sudo ln -s /usr/local/zend/bin/pear /usr/sbin/pear
sudo ln -s /usr/local/zend/bin/pecl /usr/sbin/pecl
sudo ln -s /usr/local/zend/bin/php /usr/sbin/php
sudo ln -s /usr/local/zend/bin/phpize /usr/sbin/phpize
</pre>


<h3>Install XDebug</h3>

<p>We&#8217;re going to set up some Debuggers you can use to get a better idea of what&#8217;s going on with this program. Many PHP developers neglect debuggers for some reason, but they really are helpful and do save you a lot of time. The Zend Debugger is already installed with the Zend server, but we&#8217;re going to add XDebug too, in case you prefer that. There are valid reasons to use both of them.</p>

<pre>
sudo apt-get install m4
sudo apt-get install autoconf
sudo pecl install xdebug
</pre>


<p>After that completes, you&#8217;ll need to add the xdebug.so to your extention</p>

<pre>
sudo nano /usr/local/zend/etc/conf.d/debugger.ini 
</pre>


<p>add the following line at the TOP of the file:</p>

<pre>
zend_extension=/usr/local/zend/lib/php_extensions/xdebug.so
</pre>


<p>CTRL+X they &#8220;Y&#8221; to save. Then restart the server:</p>

<pre>
sudo /etc/init.d/zend-server restart
</pre>


<p>Now, you can check to see if xdebug installed properly:</p>

<pre>
php -i | grep xdebug
</pre>


<p>You should see output similar to this:</p>

<pre>
xdebug
xdebug support => enabled
xdebug.auto_trace => Off => Off
xdebug.cli_color => 0 => 0
xdebug.collect_assignments => Off => Off
xdebug.collect_includes => On => On
xdebug.collect_params => 0 => 0
xdebug.collect_return => Off => Off
xdebug.collect_vars => Off => Off
xdebug.coverage_enable => On => On
xdebug.default_enable => On => On
xdebug.dump.COOKIE => no value => no value
xdebug.dump.ENV => no value => no value
xdebug.dump.FILES => no value => no value
xdebug.dump.GET => no value => no value
xdebug.dump.POST => no value => no value
xdebug.dump.REQUEST => no value => no value
xdebug.dump.SERVER => no value => no value
xdebug.dump.SESSION => no value => no value
xdebug.dump_globals => On => On
xdebug.dump_once => On => On
xdebug.dump_undefined => Off => Off
xdebug.extended_info => On => On
xdebug.file_link_format => no value => no value
xdebug.idekey => no value => no value
xdebug.max_nesting_level => 100 => 100
xdebug.overload_var_dump => On => On
xdebug.profiler_aggregate => Off => Off
xdebug.profiler_append => Off => Off
xdebug.profiler_enable => Off => Off
xdebug.profiler_enable_trigger => Off => Off
xdebug.profiler_output_dir => /tmp => /tmp
xdebug.profiler_output_name => cachegrind.out.%p => cachegrind.out.%p
xdebug.remote_autostart => Off => Off
xdebug.remote_connect_back => Off => Off
xdebug.remote_cookie_expire_time => 3600 => 3600
xdebug.remote_enable => Off => Off
xdebug.remote_handler => dbgp => dbgp
xdebug.remote_host => localhost => localhost
xdebug.remote_log => no value => no value
xdebug.remote_mode => req => req
xdebug.remote_port => 9000 => 9000
xdebug.scream => Off => Off
xdebug.show_exception_trace => Off => Off
xdebug.show_local_vars => Off => Off
xdebug.show_mem_delta => Off => Off
xdebug.trace_enable_trigger => Off => Off
xdebug.trace_format => 0 => 0
xdebug.trace_options => 0 => 0
xdebug.trace_output_dir => /tmp => /tmp
xdebug.trace_output_name => trace.%c => trace.%c
xdebug.var_display_max_children => 128 => 128
xdebug.var_display_max_data => 512 => 512
xdebug.var_display_max_depth => 3 => 3
</pre>


<p>This means it installed properly and you can now use it for debugging!</p>

<div style="margin-left: auto; margin-right: auto; width: 480px;">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-8244625199628957";
/* JM in Article 468 */
google_ad_slot = "1362025951";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>


<br />


<h3>Install Composer</h3>

<p>Composer is one of the most awesome things to come to PHP. To install it, you will need curl to get the installer. If you don&#8217;t already have it, type</p>

<pre>
sudo apt-get install curl
</pre>


<p>And to get the Composer installer:</p>

<pre>
curl -sS https://getcomposer.org/installer | php
</pre>


<p>You should see something that looks like this:</p>

<p><img src="http://images.jeremymorgan.com/php-development-in-ubuntu-13-04-raring-ringtail-9.png" alt="Install PHP in Ubuntu 13.04 Raring Ringtail" /></p>

<p>Note where it shows composer.phar is. We want to move that to our path so we can call composer from anywhere.</p>

<pre>
sudo mv composer.phar /usr/local/bin/composer
</pre>


<p>That&#8217;s it!</p>

<h3>Install PHPUnit</h3>

<p>Now we want to install PHPUnit so we can do unit testing in our environment.</p>

<p>Here is how you do it:</p>

<pre>
sudo pear config-set auto_discover 1
sudo pear clear-cache
sudo Pear install pear.phpunit.de/PHPUnit
</pre>


<p>This will use pear to install PHP unit for you. If you would like you can <a href="http://www.phpunit.de/manual/3.0/en/writing-tests-for-phpunit.html">Build a test case for PHPUnit</a> to make sure it&#8217;s working properly.</p>

<h3>Install JRE</h3>

<p>You will need the JRE to run Eclipse, if you don&#8217;t already have it installed, you&#8217;ll need to download it from here:</p>

<ul>
<li><a href="http://download.oracle.com/otn-pub/java/jdk/7u17-b02/jre-7u17-linux-i586.tar.gz">JRE 32 bit</a></li>
<li><a href="http://download.oracle.com/otn-pub/java/jdk/7u17-b02/jre-7u17-linux-x64.tar.gz">JRE 64 bit</a></li>
</ul>


<p>Save the archive in your downloads folder.</p>

<p>I like to install this one fresh, especially with the latest Java Security issues going around. Run the following to remove any old versions:</p>

<pre>
sudo apt-get purge openjdk*
</pre>


<p>Now, go to where you saved the file (for me it was /home/jeremy/Downloads) and extract it:</p>

<pre>
tar -xvzf jre-7u17-linux-x64.tar.gz
sudo mkdir -p /usr/lib/jvm/jre1.7.0
sudo mv jre1.7.0_17/* /usr/lib/jvm/jre1.7.0/
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jre1.7.0/bin/java 0
</pre>


<p>While you&#8217;re here, you may as well set it up for Firefox as well:</p>

<pre>
mkdir ~/.mozilla/plugins 
ln -s /usr/lib/jvm/jre1.7.0/lib/i386/libnpjp2.so ~/.mozilla/plugins/
</pre>


<h3>Install Eclipse</h3>

<p>We&#8217;re going to install the Eclipse PDT plugin by Zend. You might notice we&#8217;re using a lot of Zend products: this is for consistency between the products but it&#8217;s by no means a requirement.</p>

<p><a href="http://www.zend.com/en/community/pdt/downloads">Eclipse PDT download Page</a></p>

<p>Click on your version (32 or 64 bit) and again, open with the archive manager. You might note that Eclipse is a standalone application, so it doesn&#8217;t have an &#8220;Installer&#8221; and you can put it anywhere.</p>

<p>I just extract mine into /home/jeremy and run it from there. Open the folder and click on the eclipse-php icon:</p>

<p><img src="http://images.jeremymorgan.com/php-development-in-ubuntu-13-04-raring-ringtail-10.png" alt="Install PHP in Ubuntu 13.04 Raring Ringtail" /></p>

<p>It will ask you to save a workspace. You will want to make this your web root.</p>

<p><img src="http://images.jeremymorgan.com/php-development-in-ubuntu-13-04-raring-ringtail-11.png" alt="Install PHP in Ubuntu 13.04 Raring Ringtail" /></p>

<p>And let&#8217;s create a new project. Go to the New button and select new -&gt; PHP Project.</p>

<p>I usually configure it something like this:</p>

<p><img src="http://images.jeremymorgan.com/php-development-in-ubuntu-13-04-raring-ringtail-12.png" alt="Install PHP in Ubuntu 13.04 Raring Ringtail" /></p>

<p>Now we have an open project we can work with. Create an index.php file and open it up. Put in the following code:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$somevar = "test";
</span><span class='line'>
</span><span class='line'>echo "This is a " . $somevar;</span></code></pre></td></tr></table></div></figure>


<p>Now we&#8217;ll set up Eclipse and play around with it a little.</p>

<h3>Configuring Eclipse</h3>

<p>The first thing we want to do is go to Project -&gt; Properties.</p>

<p><img src="http://images.jeremymorgan.com/php-development-in-ubuntu-13-04-raring-ringtail-13.png" alt="Install PHP in Ubuntu 13.04 Raring Ringtail" /></p>

<p>In the properties window, select <strong>PHP Debug</strong> and check &#8220;Enable project specific settings&#8221;.</p>

<p>You&#8217;ll notice here you can choose your debugger:</p>

<p><img src="http://images.jeremymorgan.com/php-development-in-ubuntu-13-04-raring-ringtail-14.png" alt="Install PHP in Ubuntu 13.04 Raring Ringtail" /></p>

<p>Click on:
&#8220;Enable CLI Debug&#8221;
&#8220;PHP Executables&#8221;
&#8220;Add&#8221;</p>

<p>In the next window, put the following information to point to your PHP executables.</p>

<p><img src="http://images.jeremymorgan.com/php-development-in-ubuntu-13-04-raring-ringtail-15.png" alt="Install PHP in Ubuntu 13.04 Raring Ringtail" /></p>

<p>Now you can do CLI debugging whenever you need to.</p>

<p>Let&#8217;s set up web debugging. Click on the little green bug and select &#8220;Debug Configurations&#8221;.</p>

<p><img src="http://images.jeremymorgan.com/php-development-in-ubuntu-13-04-raring-ringtail-16.png" alt="Install PHP in Ubuntu 13.04 Raring Ringtail" /></p>

<p>Set up this screen to look like this:</p>

<p><img src="http://images.jeremymorgan.com/php-development-in-ubuntu-13-04-raring-ringtail-17.png" alt="Install PHP in Ubuntu 13.04 Raring Ringtail" /></p>

<p>Then click &#8220;configure&#8221; and make sure it&#8217;s set up like this:</p>

<p><img src="http://images.jeremymorgan.com/php-development-in-ubuntu-13-04-raring-ringtail-18.png" alt="Install PHP in Ubuntu 13.04 Raring Ringtail" /></p>

<p>Save the settings.</p>

<h3>Do a test run</h3>

<p>Now you have it set up, so click on the green bug again and select &#8220;index&#8221;. You&#8217;ll see a screen that looks like this:</p>

<p><img src="http://images.jeremymorgan.com/php-development-in-ubuntu-13-04-raring-ringtail-19.png" alt="Install PHP in Ubuntu 13.04 Raring Ringtail" /></p>

<p>This, of course is your debug screen. This shows you all your variable data, and a lot more.</p>

<p>With this you are now ready to rock!</p>

<h3>Conclusion</h3>

<p>Ok so that was definitely a lot of setup, but I hope it at least gives an idea of what a professional level PHP development environment should look like. You should have debugging and Unit testing going with all of your PHP applications no matter what. Much of the bad reputation associated with PHP is from people &#8220;gluing&#8221; stuff together and hacking up nasty solutions and leaving them around for years. One way to improve the reputation of PHP is to start building better code, and I think this set up helps with that.</p>

<p>All the software in the world configured perfectly won&#8217;t make you write better code. THat&#8217;s up to you, and something I&#8217;ll cover in future tutorials as well, and I&#8217;ll show you some ways to make your PHP solutions solid, fast and enterprise ready.</p>

<br />


<div class="subscribefooter">
<h4>Do you want to be notified every time a new tutorial is posted?</h4>
<div class="rssbutton"></div>
If you want to see more tutorials like these <a href="http://www.feedblitz.com/f?sub=889026"><strong>subscribe to our spam free newsletter</strong></a> and get them instantly in your inbox or feed reader.
If you want to get all my updates, <a href="http://feedburner.google.com/fb/a/mailverify?uri=jeremymorgan/NJwt&amp;loc=en_US"><strong>subscribe to the main RSS feed</strong></a> here.
</div>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Raspberry Pi Programming For Beginners]]></title>
    <link href="http://www.jeremymorgan.com/tutorials/raspberry-pi/raspberry-pi-programming-python/"/>
    <updated>2013-02-26T19:09:00-08:00</updated>
    <id>http://www.jeremymorgan.com/tutorials/raspberry-pi/raspberry-pi-programming-for-beginners</id>
    <content type="html"><![CDATA[<p>Want to learn how to write some apps for the Raspberry Pi? Today I&#8217;m going to kick off a new series of tutorials related to the Raspberry Pi and programming. This is a series that will be aimed at beginners, but seasoned programmers may want to take a look as well. The Raspberry Pi was created for education, tinkering and bringing technology to the far parts of the world. This is a mission I firmly stand behind, so I&#8217;m doing my part to throw some new stuff out there to get people excited about becoming a programmer with this awesome device.</p>

<!-- more -->


<h3>Why Python?</h3>

<p>Python is arguably the biggest programming language on the Pi right now, for good reason. It has lots of tools, is well supported and development is really fast. Plus it&#8217;s easy to learn. It&#8217;s very powerful and you can even create simple games and graphics with it. I think it&#8217;s a great language to get started with as you&#8217;ll see some instant results.</p>

<h3>Tools we&#8217;ll be using</h3>

<p>We are going to be using Python and <a href="http://docs.python.org/2/library/idle.html" title="IDLE for Python">IDLE</a> for our first part of the tutorials, and these are already installed and present if you&#8217;re using the Raspian image. Here is what IDLE looks like:</p>

<p><img src="http://images.jeremymorgan.com/raspberry-pi-programming-python-1.png" alt="Raspberry Pi Programming" /></p>

<p>This is our Python console and editor. We&#8217;ll be using this extensively to create our programs. While there are many IDEs out there, it&#8217;s always good to start with the console, and learn a little how Python works. This is it! There&#8217;s no long list of tools to download, you can get started programming Python right away with the default Raspian image.</p>

<h3>Let&#8217;s get started!</h3>

<p>Let&#8217;s get comfortable with the Python environment. For this tutorial we&#8217;re only going to be covering some basics using Python version 3.2.3. We&#8217;ll run a few commands at the console to play with output, but we&#8217;ll want to create an file later to make programs that are actually useful.</p>

<p>At the prompt (where it shows &gt;&gt;&gt;) you&#8217;ll want to type in the commands I show and press enter.</p>

<h4>1. Using the prompt</h4>

<p>At the prompt you saw how you could output text, but you can also do arithmetic at the prompt. Type in the following and press enter:</p>

<pre>
3 + 2
</pre>


<p>As you can see, it outputs the answer. But you can also use multiple operators and expressions.</p>

<pre>
((3 + 2) * 5) -3
</pre>


<p>and you&#8217;ll see 22. It&#8217;s not terribly useful at this time, but it&#8217;s nice to know it&#8217;s available.</p>

<p><img src="http://images.jeremymorgan.com/raspberry-pi-programming-python-2.png" alt="Raspberry Pi Programming" /></p>

<p>Most of the time you&#8217;ll use the prompt for setting configuration parameters. For any real useful programs you&#8217;ll want to create a file containing a list of commands.</p>

<h4>2. Creating a file to run</h4>

<p>Let&#8217;s create a file and run some stuff. In the IDLE 3 window, select File -&gt; New Window</p>

<p><img src="http://images.jeremymorgan.com/raspberry-pi-programming-python-3.png" alt="Raspberry Pi Programming" /></p>

<p>You will see a new window that comes up, and that&#8217;s where you&#8217;re going to be putting your code. Then you can save it to a text file that Python can run.</p>

<p><img src="http://images.jeremymorgan.com/raspberry-pi-programming-python-4.png" alt="Raspberry Pi Programming" /></p>

<p>In this window, type in the following code:</p>

<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='python'><span class='line'><span class="c"># my first Python script</span>
</span></code></pre></td></tr></table></div></figure>


<p>then, go to File -&gt; Save</p>

<p>You should see a window that looks like this:</p>

<p><img src="http://images.jeremymorgan.com/raspberry-pi-programming-python-5.png" alt="Raspberry Pi Programming" /></p>

<p>Type in a file name like &#8220;myfirstprogram.py&#8221; and click save. Now everything you put into this file will be saved and interpreted by Python.</p>

<p>Python is an &#8220;interpreted&#8221; language, which means the Python program will read a text file line by line and act based on the commands you give it. This is different from a compiled language like C where you a compiler reads the code and creates a program. We&#8217;ll do some C programming later in the series and you&#8217;ll see the differences later.</p>

<h3>Input and output</h3>

<p>Now that you know how to create a file we can play with some input and output. First I should let you know that the file you just created won&#8217;t exactly do anything. That&#8217;s because all we did was put a comment in the file.</p>

<p>A comment is something that&#8217;s ignored by the Python interpreter. The purpose of a comment is to leave yourself notes, or leave notes for other programmers. This makes your program easier to understand.</p>

<p>Let&#8217;s make our file actually do something. Type in the following:</p>

<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='python'><span class='line'><span class="k">print</span> <span class="s">&quot;this is output&quot;</span>
</span></code></pre></td></tr></table></div></figure>


<p>Now, go up to the Run menu, and select &#8220;Run Module&#8221;</p>

<p><img src="http://images.jeremymorgan.com/raspberry-pi-programming-python-6.png" alt="Raspberry Pi Programming" /></p>

<p>Once you select this you&#8217;ll get the following message:</p>

<p><img src="http://images.jeremymorgan.com/raspberry-pi-programming-python-7.png" alt="Raspberry Pi Programming" /></p>

<p>This is a message telling you to save your file before running it. Click OK.</p>

<p>Now this file will close, and back in your terminal window you&#8217;ll see the following:</p>

<p><img src="http://images.jeremymorgan.com/raspberry-pi-programming-python-8.png" alt="Raspberry Pi Programming" /></p>

<p>Congratulations! You&#8217;ve created output. But that&#8217;s just the start.</p>

<h4>Ask for and display a name</h4>

<p>Go back to your editor window (it&#8217;s still open) and erase everything. Put in the following lines:</p>

<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class='python'><span class='line'><span class="n">name</span> <span class="o">=</span> <span class="nb">input</span><span class="p">(</span><span class="s">&#39;What is your name? &#39;</span><span class="p">)</span>
</span><span class='line'><span class="k">print</span> <span class="p">(</span><span class="s">&#39;Hi&#39;</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="s">&#39;how are you?&#39;</span><span class="p">)</span>
</span></code></pre></td></tr></table></div></figure>


<p>now, click on Run-&gt; Run Module again.</p>

<p>You will see a prompt that&#8217;s asking your name:</p>

<pre>
What is your name?
</pre>


<p>As you probably predicted, you should type in your name. Press enter.</p>

<p>You should see this:</p>

<p><img src="http://images.jeremymorgan.com/raspberry-pi-programming-python-9.png" alt="Raspberry Pi Programming" /></p>

<p>Pretty cool huh? So how does this work?</p>

<ol>
<li><p>You created a variable called &#8220;name&#8221;. A variable is a storage space for data. When you create a variable it sets aside some space for you to put things in and take them out, and gives this space a name so you can access it later.</p></li>
<li><p>When you created name, you assigned it the value from the input() method. The primary job of Input is to collect data from the keyboard. Inside the parentheses is a space where you can &#8220;pass&#8221; data to input. This text is what it displays <em>before</em> input tries to accept data. This is generally used for prompts like this.</p></li>
<li><p>You used print to output a string. When you &#8220;pass&#8221; data to print it gets output to the screen. So you passed in a string &#8216;Hi&#8217; which by itself would work. But by putting in a comma afterward you are adding to that string. You used something called concatenation.</p></li>
<li><p>You then appended (added on) the name variable. Notice how it has no quotes around name. This is how you tell Python that it&#8217;s a variable. You have quotes about &#8216;hi&#8217; and &#8216;how are you?&#8217; to let Python know that&#8217;s a string, and then you added the three together.</p></li>
<li><p>Lastly you output your newly built string.</p></li>
</ol>


<p>This is great example of input and output. Let&#8217;s do a little more, just for fun. Now type the following into your editor:</p>

<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
</pre></td><td class='code'><pre><code class='python'><span class='line'><span class="c">#my first python script</span>
</span><span class='line'>
</span><span class='line'><span class="n">name</span> <span class="o">=</span> <span class="nb">input</span><span class="p">(</span><span class="s">&#39;What is your name? &#39;</span><span class="p">)</span>
</span><span class='line'><span class="n">age</span> <span class="o">=</span> <span class="nb">input</span><span class="p">(</span><span class="s">&#39;How old are you? &#39;</span><span class="p">)</span>
</span><span class='line'><span class="n">city</span> <span class="o">=</span> <span class="nb">input</span><span class="p">(</span><span class="s">&#39;What city do you live in? &#39;</span><span class="p">)</span>
</span><span class='line'>
</span><span class='line'><span class="k">print</span> <span class="p">(</span><span class="s">&#39;The author of this program is &#39;</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="s">&#39;who is &#39;</span><span class="p">,</span><span class="n">age</span><span class="p">,</span> <span class="s">&#39;years old and lives in &#39;</span> <span class="n">city</span><span class="p">)</span>
</span></code></pre></td></tr></table></div></figure>


<p>Now, go to Run -&gt; Run Module.</p>

<p>You will see that it now asks you a series of questions, and once you fill it out, it will display a line back to you after putting all the data together:</p>

<p><img src="http://images.jeremymorgan.com/raspberry-pi-programming-python-10.png" alt="Programming Raspberry Pi" /></p>

<p>It&#8217;s that easy!</p>

<h3>Summary</h3>

<p>While we really didn&#8217;t dive that deep into programming the Pi, or even Python I hope this will at least give beginners a general idea of how to get started. I will be adding some more detailed tutorials in the future, but if you can&#8217;t wait and really want to keep going check out the <a href="http://docs.python.org/3/tutorial/">Python 3 Tutorials</a> at Python.org.</p>

<p>You don&#8217;t have to stick with Python 3 either. Python 2.6 is still in very active use and there are actually more packages available for it if that&#8217;s what you&#8217;d prefer. Both versions are very good and it doesn&#8217;t hurt to learn them both.</p>

<p>In future tutorials we&#8217;ll explore python deeper, and even get into some other languages such as C++ and assembler. I&#8217;ll also show some more useful things you can do to get you really pumped about programming on the pi.</p>

<p>If you have any questions, leave them in the comments!</p>

<br />


<div class="subscribefooter">
<h4>Do you like my Rasbperry Pi Tutorials? </h4>
<div class="rssbutton"></div>
I&#8217;m constantly hacking on stuff with the Raspberry Pi. If you want to get notified every time I post a new article <a href="http://feeds.feedburner.com/JeremyMorganRaspberryPi"><strong>subscribe to my Raspberry Pi feed</strong></a> here, or you can <a href="http://www.feedblitz.com/f?sub=883810"><strong>Sign up for the Raspberry Pi Newsletter</strong></a> spam free!  
</div>



]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[The Top 10 Raspberry Pi Blogs]]></title>
    <link href="http://www.jeremymorgan.com/tutorials/raspberry-pi/top-10-raspberry-pi-blogs/"/>
    <updated>2013-02-15T21:18:00-08:00</updated>
    <id>http://www.jeremymorgan.com/tutorials/raspberry-pi/raspberry-pi-blogs</id>
    <content type="html"><![CDATA[<p>Do you love the Raspberry Pi as much as I do? Ever since I first heard of it I&#8217;ve been trying to keep up on all the latest happenings with this device. Here is a list of great blogs and other places to get Raspberry Pi content.</p>

<!-- more -->


<p>And if you want to keep up with my Raspberry Pi tutorials and articles, you can <a href="http://feedburner.google.com/fb/a/mailverify?uri=JeremyMorganRaspberryPi">get notified when I create them</a> or you can <a href="http://feeds.feedburner.com/JeremyMorganRaspberryPi">follow my Raspberry Pi RSS feed</a>.</p>

<br />


<br />


<h3>The Top 10 Raspberry Pi Blogs</h3>

<div class="featuredlink" style="width: 600px; border: solid 1px #cccccc; padding: 15px; background-color: #f2f2f2;">
<div class="featuredlinkimage" style="float:right; margin-top: 0px;">
<a href="http://www.adafruit.com/blog/category/raspberry-pi/" target="_blank"><img src="http://images.jeremymorgan.com/raspberry-pi-blog-1.png" title="Best Raspberry Pi Blogs" ></a></div>

<h3>Adafruit Industries</h3>
By far one of the most thorough and technical of the Raspberry Pi blogs, this site is very unique in the sheer amount of great information it provides on many embedded devices. Run by Limor &#8220;Ladyada&#8221; Fried, one of the smartest and coolest bloggers out there. 
<br />
<br />
<a href="http://www.adafruit.com/blog/category/raspberry-pi/" target="_blank">View this blog</a><br />
<a href="http://www.adafruit.com/blog/feed/" target="_blank">Get the RSS Feed</a><br />
</div>




<div class="featuredlink" style="width: 600px; border: solid 1px #cccccc; padding: 15px; background-color: #f2f2f2;">
<div class="featuredlinkimage" style="float:right; margin-top: 0px;"><a href="http://lifehacker.com/raspberry-pi/" target="_blank"><img src="http://images.jeremymorgan.com/raspberry-pi-blog-2.png" title="Best Raspberry Pi Blogs" ></a></div>
<h3>Lifehacker Raspberry Pi Section</h3>
A site like Lifehacker needs no introduction for geeks, but their Raspberry Pi section is definitely awesome and useful.
<br />
<br />
<a href="http://lifehacker.com/raspberry-pi/" target="_blank">View this blog</a><br />
<a href="http://feeds.gawker.com/lifehacker/full" target="_blank">Get the RSS Feed</a><br />
<br />
</div>




<div class="featuredlink" style="width: 600px; border: solid 1px #cccccc; padding: 15px; background-color: #f2f2f2;">
<div class="featuredlinkimage" style="float:right; margin-top: 0px;"><a href="http://raspberrypikid.wordpress.com/" target="_blank"><img src="http://images.jeremymorgan.com/raspberry-pi-blog-5.png" title="Best Raspberry Pi Blogs" ></a></div>
<h3>Raspberry Pi Kid</h3>
This is an amazing blog about experimenting with the Raspberry Pi, and even better is the fact that it&#8217;s run by an 11 year old. This is what the Pi was created for!
<br />
<br />
<a href="http://raspberrypikid.wordpress.com/" target="_blank">View this blog</a><br />
<a href="http://raspberrypikid.wordpress.com/feed/" target="_blank">Get the RSS Feed</a><br />
<br />
</div>




<div class="featuredlink" style="width: 600px; border: solid 1px #cccccc; padding: 15px; background-color: #f2f2f2;">
<div class="featuredlinkimage" style="float:right; margin-top: 0px;"><a href="http://www.raspberrypi-spy.co.uk/" target="_blank"><img src="http://images.jeremymorgan.com/raspberry-pi-blog-17.png" title="Best Raspberry Pi Blogs" ></a></div>
<h3>Raspberry Pi Spy</h3>
This blog features a lot of clear, easy to complete projects and resources for the Raspberry Pi
<br />
<br />
<a href="http://www.raspberrypi-spy.co.uk/" target="_blank">View this blog</a><br />
<a href="http://www.raspberrypi-spy.co.uk/feed/" target="_blank">Get the RSS Feed</a><br />
<br />
</div>




<div class="featuredlink" style="width: 600px; border: solid 1px #cccccc; padding: 15px; background-color: #f2f2f2;">
<div class="featuredlinkimage" style="float:right; margin-top: 0px;"><a href="http://sirlagz.net/category/raspberry-pi/" target="_blank"><img src="http://images.jeremymorgan.com/raspberry-pi-blog-4.png" title="Best Raspberry Pi Blogs" ></a></div>
<h3>The Rantings and Ravings of a Madman</h3>
An interesting blog that explores some nifty uses for the Pi and is updated pretty frequently. 
<br />
<br />
<a href="http://sirlagz.net/category/raspberry-pi/" target="_blank">View this blog</a><br />
<a href="http://feeds.feedburner.com/TheRantingsAndRavingsOfAMadman" target="_blank">Get the RSS Feed</a><br />
<br />
</div>




<div class="featuredlink" style="width: 600px; border: solid 1px #cccccc; padding: 15px; background-color: #f2f2f2;">
<div class="featuredlinkimage" style="float:right; margin-top: 0px;"><a href="http://myraspberrypiexperience.blogspot.com/" target="_blank"><img src="http://images.jeremymorgan.com/raspberry-pi-blog-6.png" title="Best Raspberry Pi Blogs" ></a></div>
<h3>My Raspberry Pi Experience</h3>
This blog is great for keeping up on the latest happenings, and some cool experiments with the Pi. 
<br />
<br />
<a href="http://myraspberrypiexperience.blogspot.com/" target="_blank">View this blog</a><br />
<a href="http://myraspberrypiexperience.blogspot.com/feeds/posts/default" target="_blank">Get the RSS Feed</a><br />
<br />
</div>




<div class="featuredlink" style="width: 600px; border: solid 1px #cccccc; padding: 15px; background-color: #f2f2f2;">
<div class="featuredlinkimage" style="float:right; margin-top: 0px;"><a href="http://raspberry-fool.com/" target="_blank"><img src="http://images.jeremymorgan.com/raspberry-pi-blog-7.png" title="Best Raspberry Pi Blogs" ></a></div>
<h3>Raspberry Fool</h3>
A quirky and fun Raspberry Pi blog with some really useful information and experiments with the Pi. 
<br />
<br />
<a href="http://raspberry-fool.com/" target="_blank">View this blog</a><br />
<a href="http://myraspberrypiexperience.blogspot.com/feeds/posts/default" target="_blank">Get the RSS Feed</a><br />
<br />
</div>




<div class="featuredlink" style="width: 600px; border: solid 1px #cccccc; padding: 15px; background-color: #f2f2f2;">
<div class="featuredlinkimage" style="float:right; margin-top: 0px;"><a href="http://raspberrypihobbyist.blogspot.com/" target="_blank"><img src="http://images.jeremymorgan.com/raspberry-pi-blog-8.png" title="Best Raspberry Pi Blogs" ></a></div>
<h3>The Raspberry Pi Hobbyist</h3>
A great source of updates and experiments relating to the Raspberry Pi
<br />
<br />
<a href="http://raspberrypihobbyist.blogspot.com/" target="_blank">View this blog</a><br />
<a href="http://raspberrypihobbyist.blogspot.com/feeds/posts/default" target="_blank">Get the RSS Feed</a><br />
<br />
</div>




<div class="featuredlink" style="width: 600px; border: solid 1px #cccccc; padding: 15px; background-color: #f2f2f2;">
<div class="featuredlinkimage" style="float:right; margin-top: 0px;"><a href="http://www.rpiblog.com/" target="_blank"><img src="http://images.jeremymorgan.com/raspberry-pi-blog-9.png" title="Best Raspberry Pi Blogs" ></a></div>
<h3>Raspberry Pi Blog</h3>
Get Guides,Tips,Tricks And Information Related To Raspberry Pi. Very hardware centric, good stuff. 
<br />
<br />
<a href="http://www.rpiblog.com/" target="_blank">View this blog</a><br />
<a href="http://feeds.feedburner.com/rpiblog" target="_blank">Get the RSS Feed</a><br />
<br />
</div>




<div class="featuredlink" style="width: 600px; border: solid 1px #cccccc; padding: 15px; background-color: #f2f2f2;">
<div class="featuredlinkimage" style="float:right; margin-top: 0px;"><a href="http://raspi.tv/" target="_blank"><img src="http://images.jeremymorgan.com/raspberry-pi-blog-10.png" title="Best Raspberry Pi Blogs" ></a></div>
<h3>Raspi.TV</h3>
A very active Raspberry Pi blog that covers a lot of hardware related to the Pi. 
<br />
<br />
<a href="http://raspi.tv/" target="_blank">View this blog</a><br />
<a href="http://raspi.tv/feed" target="_blank">Get the RSS Feed</a><br />
<br />
</div>


<br />


<br />


<h3>Other Raspberry Pi Sites</h3>

<p>These are the blogs I try to keep up with frequently, but there are other great Raspberry Pi sites that are worth a mention as well:</p>

<div class="featuredlink" style="width: 600px; border: solid 1px #cccccc; padding: 15px; background-color: #f2f2f2;">
<div class="featuredlinkimage" style="float:right; margin-top: 0px;"><a href="http://www.raspihub.com/" target="_blank"><img src="http://images.jeremymorgan.com/raspberry-pi-blog-11.png" title="Best Raspberry Pi Blogs" ></a></div>
<h3>RaspiHub</h3>
Definitely a great daily read, it features all the latest news on the Raspberry Pi from several different sources. 
<br />
<br />
<a href="http://www.raspihub.com/" target="_blank">View this site</a><br />
<a href="http://www.raspihub.com/feeds/" target="_blank">RaspiHub RSS Feeds</a><br />
<br />
</div>




<div class="featuredlink" style="width: 600px; border: solid 1px #cccccc; padding: 15px; background-color: #f2f2f2;">
<div class="featuredlinkimage" style="float:right; margin-top: 0px;"><a href="http://elinux.org/RPi_Tutorials" target="_blank"><img src="http://images.jeremymorgan.com/raspberry-pi-blog-12.png" title="Best Raspberry Pi Blogs" ></a></div>
<h3>RPi Tutorials</h3>
Tons of great Tutorials for the Raspberry Pi. You can learn a lot from this section. 
<br />
<br />
<a href="http://elinux.org/RPi_Tutorials" target="_blank">View this site</a><br />
<br />
</div>




<div class="featuredlink" style="width: 600px; border: solid 1px #cccccc; padding: 15px; background-color: #f2f2f2;">
<div class="featuredlinkimage" style="float:right; margin-top: 0px;"><a href="http://www.recantha.co.uk/blog/" target="_blank"><img src="http://images.jeremymorgan.com/raspberry-pi-blog-13.png" title="Best Raspberry Pi Blogs" ></a></div>
<h3>Raspberry Pod</h3>
Another great RPi Resource, well written and useful.
<br />
<br />
<a href="http://www.recantha.co.uk/blog/" target="_blank">View this site</a><br />
<a href="http://www.recantha.co.uk/blog/?feed=rss2" target="_blank">Get the RSS Feed</a><br />
<br />
</div>




<div class="featuredlink" style="width: 600px; border: solid 1px #cccccc; padding: 15px; background-color: #f2f2f2;">
<div class="featuredlinkimage" style="float:right; margin-top: 0px;"><a href="http://blog.makezine.com/category/electronics/raspberry-pi/" target="_blank"><img src="http://images.jeremymorgan.com/raspberry-pi-blog-3.png" title="Best Raspberry Pi Blogs" ></a></div>
<h3>Make Raspberry Pi Section</h3>
Make is another staple of the Geek information diet and they have a great Raspberry Pi section as well. 
<br />
<br />
<a href="http://blog.makezine.com/category/electronics/raspberry-pi/" target="_blank">View this blog</a><br />
<a href="http://blog.makezine.com/category/electronics/raspberry-pi/feed/" target="_blank">Get the RSS Feed</a><br />
<br />
</div>




<div class="featuredlink" style="width: 600px; border: solid 1px #cccccc; padding: 15px; background-color: #f2f2f2;">
<div class="featuredlinkimage" style="float:right; margin-top: 0px;"><a href="http://www.raspberrypi.org/phpBB3/" target="_blank"><img src="http://images.jeremymorgan.com/raspberry-pi-blog-14.png" title="Best Raspberry Pi Blogs" ></a></div>
<h3>Raspberry Pi Forums</h3>
The official forums for the Raspberry Pi, tons of great information there. 
<br />
<br />
<a href="http://www.raspberrypi.org/phpBB3/" target="_blank">View this site</a><br />
<br />
</div>




<div class="featuredlink" style="width: 600px; border: solid 1px #cccccc; padding: 15px; background-color: #f2f2f2;">
<div class="featuredlinkimage" style="float:right; margin-top: 0px;"><a href="https://plus.google.com/communities/113390432655174294208" target="_blank"><img src="http://images.jeremymorgan.com/raspberry-pi-blog-15.png" title="Best Raspberry Pi Blogs" ></a></div>
<h3>Raspberry Pi Google+ Community</h3>
With over 12,000 members, this fast growing community has a lot of great content on it. Must join if you&#8217;re on Google+ (and you should be).
<br />
<br />
<a href="https://plus.google.com/communities/113390432655174294208" target="_blank">View this site</a><br />
<br />
</div>




<div class="featuredlink" style="width: 600px; border: solid 1px #cccccc; padding: 15px; background-color: #f2f2f2;">
<div class="featuredlinkimage" style="float:right; margin-top: 0px;"><a href="http://www.reddit.com/r/raspberry_pi/" target="_blank"><img src="http://images.jeremymorgan.com/raspberry-pi-blog-16.png" title="Best Raspberry Pi Blogs" ></a></div>
<h3>Raspberry Pi Reddit</h3>
One of the most popular sites on the internet has a Raspberry Pi section, loaded with good info!
<br />
<br />
<a href="http://www.reddit.com/r/raspberry_pi/" target="_blank">View this site</a><br />
<br />
</div>


<br />


<h3>Summary</h3>

<p>This is a list of my daily reads for Raspberry Pi information. If you know of any others, please post them in the comments! Stay tuned on my blog for even more Raspberry Pi articles in the future!</p>

<br />


<div class="subscribefooter">
<h4>Do you like my Rasbperry Pi Tutorials? </h4>
<div class="rssbutton"></div>
I&#8217;m constantly hacking on stuff with the Raspberry Pi. If you want to get notified every time I post a new article <a href="http://feeds.feedburner.com/JeremyMorganRaspberryPi"><strong>subscribe to my Raspberry Pi feed</strong></a> here, or you can <a href="http://www.feedblitz.com/f?sub=883810"><strong>Sign up for the Raspberry Pi Newsletter</strong></a> spam free!  
</div>



]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[How To Set Up Wireless Networking with Ubuntu on a G4 PowerBook]]></title>
    <link href="http://www.jeremymorgan.com/tutorials/linux/how-to-wireless-networking-linux-ppc-powerbook-g4/"/>
    <updated>2013-02-12T17:33:00-08:00</updated>
    <id>http://www.jeremymorgan.com/tutorials/linux/how-to-set-up-wireless-networking-with-ubuntu-on-a-powerbook</id>
    <content type="html"><![CDATA[<p>Today I&#8217;m going to explain how to set up wireless networking on G4 PowerBook running Ubuntu. It&#8217;s an oddly specific post that will probably help around two people a year, but since I had to do it recently I figured I would share my process that I use getting this thing working. There&#8217;s a lot of mixed instructions on the internet, but many of them don&#8217;t work. Also there are several ways to do it, this way is the simplest and easiest way I know of.</p>

<!-- more -->


<h3>This may not work for everyone!</h3>

<p>I should say right off that this may not work for everyone. There is a variety of hardware combinations in these old PowerBooks, and it seems like no two are the same. I made notes and did some trial and error a couple years ago on setting this up and that&#8217;s where this comes from, but if you have trouble feel free to contact me I&#8217;ll try to help.</p>

<p>Also, I&#8217;m using Ubuntu Linux 10.04 so instructions will vary with different versions of Linux. I noticed it is easier to set up in 10.04 and new versions of Ubuntu.</p>

<h3>Step 1: Find out what kind of card you have</h3>

<p>The majority of the cards that come in Apple Powerbooks are Broadcom 4xxx chipsets. To find out which one you have, open a terminal and type in</p>

<pre>
sudo lspci -vnn -d 14e4:
</pre>


<p>My machine looks like this:</p>

<p><img src="http://images.jeremymorgan.com/how-to-linux-wireless-g4-powerbook.png" title="&#34;How To Set Up Wireless Networking with Ubuntu on a G4 PowerBook&#34;" alt="&#34;How To Set Up Wireless Networking with Ubuntu on a G4 PowerBook&#34;"></p>

<p>From this I can see my chip is a BCM 4306 and My PCI ID is 14e4:4320 which a fairly common b43legacy device. Look up your PCI ID on <a href="http://wireless.kernel.org/en/users/Drivers/b43#line-37" target="_blank" rel="nofollow">this table on Kernel.org</a> to see what type of driver you need to use.</p>

<p>To install this, I&#8217;ll need to extract the firmware from a Windows driver. I&#8217;ll use b43-fwcutter for this purpose:</p>

<pre>
sudo apt-get install b43-fwcutter
</pre>


<p>During the installation you&#8217;ll see the following screen:</p>

<p><img src="http://images.jeremymorgan.com/how-to-linux-wireless-g4-powerbook-2.png" title="&#34;How To Set Up Wireless Networking with Ubuntu on a G4 PowerBook&#34;" alt="&#34;How To Set Up Wireless Networking with Ubuntu on a G4 PowerBook&#34;"></p>

<p>Select &#8220;Yes&#8221; and the script will download and extract your firmware.</p>

<p>Now go to</p>

<p><strong>System &gt; Administration &gt; Hardware/Additional Drivers</strong></p>

<p>And you&#8217;ll see the following:</p>

<p><img src="http://images.jeremymorgan.com/how-to-linux-wireless-g4-powerbook-3.png" title="&#34;How To Set Up Wireless Networking with Ubuntu on a G4 PowerBook&#34;" alt="&#34;How To Set Up Wireless Networking with Ubuntu on a G4 PowerBook&#34;"></p>

<p>Restart your computer.</p>

<p>Once you reboot, you will that there are a couple arrows at the top right corner of the screen (Ubuntu 10.04) and once you click on it, it will drop down your menu:</p>

<p><img src="http://images.jeremymorgan.com/how-to-linux-wireless-g4-powerbook-4.png" title="&#34;How To Set Up Wireless Networking with Ubuntu on a G4 PowerBook&#34;" alt="&#34;How To Set Up Wireless Networking with Ubuntu on a G4 PowerBook&#34;"></p>

<p>From there you want to either click on your network if you see it, or click to connect to hidden wireless network.</p>

<p>Once you select your network you&#8217;ll see the following screen:</p>

<p><img src="http://images.jeremymorgan.com/how-to-linux-wireless-g4-powerbook-5.png" title="&#34;How To Set Up Wireless Networking with Ubuntu on a G4 PowerBook&#34;" alt="&#34;How To Set Up Wireless Networking with Ubuntu on a G4 PowerBook&#34;"></p>

<p>Enter your information and you&#8217;re ready to go! It&#8217;s that easy.</p>

<h3>Summary</h3>

<p>It&#8217;s definitely a bit more difficult with other cards and operating systems, but out of the 3 Ubuntu G4s I&#8217;ve set up like this they both used this process. In Yellow Dog I had to install a few apps and build a shell script on startup to accomplish this same task. Fun Stuff!</p>

<p>If you have an questions, leave them in the comments and I&#8217;ll attempt to help out.</p>

<p><a href="https://help.ubuntu.com/community/WifiDocs/Driver/bcm43xx#b43%20-%20No%20Internet%20access" rel="nofollow" target="_new">More info on driver installation options for Ubuntu</a></p>

<br />


<div class="subscribefooter">
<h4>Do you want to be notified every time a new tutorial is posted?</h4>
<div class="rssbutton"></div>
If you want to see more tutorials like these <a href="http://www.feedblitz.com/f?sub=889026"><strong>subscribe to our spam free newsletter</strong></a> and get them instantly in your inbox or feed reader.
If you want to get all my updates, <a href="http://feedburner.google.com/fb/a/mailverify?uri=jeremymorgan/NJwt&amp;loc=en_US"><strong>subscribe to the main RSS feed</strong></a> here.
</div>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Raspberry Pi how to: Set up a SVN Server]]></title>
    <link href="http://www.jeremymorgan.com/tutorials/raspberry-pi/raspberry-pi-how-to-svn-server/"/>
    <updated>2013-02-11T22:44:00-08:00</updated>
    <id>http://www.jeremymorgan.com/tutorials/raspberry-pi/raspberry-pi-how-to-set-up-a-svn-server</id>
    <content type="html"><![CDATA[<p>Today we&#8217;re going to go thru the process of turning your Raspberry Pi into an SVN server. While this may not be the most practical use of your Pi, it&#8217;s an excellent learning experience. SVN is a pretty good way to manage your code, especially if you&#8217;re juggling lots of projects.</p>

<p>This isn&#8217;t going to be a &#8220;how to use SVN&#8221; tutorial but more of a guide for setting it up on a Raspberry Pi. If you&#8217;re not familiar with SVN <a href="http://svnbook.red-bean.com/" target="_blank" rel="nofollow">Here is an excellent free guide</a> to get you started.</p>

<!-- more -->


<br />


<div class="subscribefooter">
<h4>Do you like my Rasbperry Pi Tutorials? </h4>
<div class="rssbutton"></div>
I&#8217;m constantly hacking on stuff with the Raspberry Pi. If you want to get notified every time I post a new article <a href="http://feeds.feedburner.com/JeremyMorganRaspberryPi"><strong>subscribe to my Raspberry Pi feed</strong></a> here, or you can <a href="http://www.feedblitz.com/f?sub=883810"><strong>Sign up for the Raspberry Pi Newsletter</strong></a> spam free!  
</div>


<br /><br />


<h3>Getting Started</h3>

<p>The first thing we want to do is ssh into the Raspberry Pi or open up a terminal. We&#8217;re going to do all of this from the Linux prompt.</p>

<p>Then, we&#8217;ll install Subversion:</p>

<pre>
sudo apt-get install subversion
</pre>


<p>Now let&#8217;s create a folder to put our repositories in:</p>

<pre>
mkdir -p /home/pi/repos
</pre>


<p>Now, we need to create a project:</p>

<pre>
svnadmin create /home/pi/repos/helloworld
</pre>


<p>With that created, you should see a folder that looks like this:</p>

<p><img src="http://images.jeremymorgan.com/raspberry-pi-how-to-svn-server-1.png" title="&#34;Raspberry Pi how to setup SVN server&#34;" alt="&#34;Raspberry Pi how to setup SVN server&#34;"></p>

<p>Let&#8217;s create a project that we&#8217;ll add to SVN.</p>

<pre>
mkdir /home/pi/projects/helloworld
cd /home/pi/projects/helloworld
</pre>


<p>create a file called main.cpp:</p>

<pre>
sudo nano main.cpp
</pre>


<p>add the following to the file:</p>

<figure class='code'><figcaption><span>main.cpp </span></figcaption>
 <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
</pre></td><td class='code'><pre><code class='c'><span class='line'><span class="c1">// main.cpp v .1</span>
</span><span class='line'><span class="cp">#include &lt;iostream&gt;</span>
</span><span class='line'><span class="n">using</span> <span class="n">namespace</span> <span class="n">std</span><span class="p">;</span>
</span><span class='line'>
</span><span class='line'><span class="kt">int</span> <span class="nf">main</span> <span class="p">()</span>
</span><span class='line'><span class="p">{</span>
</span><span class='line'>  <span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;Hello World!&quot;</span><span class="p">;</span>
</span><span class='line'>  <span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>


<p>And save it.</p>

<p>Now we&#8217;ll want to import it into svn:</p>

<pre>
sudo svn import /home/pi/projects/helloworld/ file://localhost/home/pi/repos/helloworld/
</pre>


<p>You should see a screen that looks like this.</p>

<p><img src="http://images.jeremymorgan.com/raspberry-pi-how-to-svn-server-2.png" title="&#34;Raspberry Pi how to setup SVN server&#34;" alt="&#34;Raspberry Pi how to setup SVN server&#34;"></p>

<p>Enter a message for committing this file. CTRL+X exits this screen.</p>

<p>You should see:</p>

<pre>
Adding /home/pi/projects/helloworld/main.cpp

Committed revision 1.
</pre>


<h3>Set up Remote Access</h3>

<p>Now, we&#8217;ll need to set up the server part of it so you can access it remotely:</p>

<pre>
sudo apt-get install apache2 libapache2-svn
</pre>


<p>(If you already have Apache installed you won&#8217;t need to reinstall it)</p>

<p>Now let&#8217;s edit the dav_svn.conf:</p>

<pre>
sudo nano /etc/apache2/mods-available/dav_svn.conf
</pre>


<p>Add this to the bottom of the file:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>&lt;Location /svn>
</span><span class='line'>  DAV svn
</span><span class='line'>  SVNParentPath /home/pi/repos
</span><span class='line'>  AuthType Basic
</span><span class='line'>  AuthName "Subversion Repo"
</span><span class='line'>  AuthUserFile /etc/apache2/dav_svn.passwd
</span><span class='line'>  &lt;LimitExcept GET PROPFIND OPTIONS REPORT>
</span><span class='line'>    Require valid-user
</span><span class='line'>  &lt;/LimitExcept>
</span><span class='line'> &lt;/Location>
</span><span class='line'>&lt;/pre></span></code></pre></td></tr></table></div></figure>


<p>Quit and save the file, then restart apache:</p>

<pre>
sudo /etc/init.d/apache2 restart
</pre>


<p>Now we need to change the permissions of this folder:</p>

<pre>
sudo chown -R www-data:www-data /home/pi/repos
</pre>


<p>We&#8217;re changing this so the SVN server can access these files. Don&#8217;t modify these files by hand anymore! Always use SVN.</p>

<p>Now you need to create an SVN user:</p>

<pre>
sudo htpasswd -c /etc/apache2/dav_svn.passwd jeremy
</pre>


<p>Remember <strong>only use -c the first time you add a user</strong>. If you run this with -c again it will delete existing users! This is for the first time only!</p>

<p>Now you can check your repo thru a web browser on your machine using the IP of your Raspberry Pi (probably different than mine)</p>

<p>http://192.168.254.18/svn/helloworld/</p>

<p>You should see a screen like this:</p>

<p><img src="http://images.jeremymorgan.com/raspberry-pi-how-to-svn-server-3.png" title="&#34;Raspberry Pi how to setup SVN server&#34;" alt="&#34;Raspberry Pi how to setup SVN server&#34;"></p>

<p>Go back to your main computer and check out the repo.</p>

<h3>Check out the repository in Linux</h3>

<p>Open up a terminal window, and type the following:</p>

<pre>
svn co --username jeremy http://192.168.254.18/svn/helloworld
</pre>


<p>You should see:</p>

<pre>
A helloworld/main.cpp
Checked out revision 1.
</pre>


<p>Now go into that folder and edit the file again:</p>

<pre>
cd helloworld
nano main.cpp
</pre>


<p>And make the following changes:</p>

<figure class='code'><figcaption><span>main.cpp </span></figcaption>
 <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
</pre></td><td class='code'><pre><code class='c'><span class='line'><span class="c1">// main.cpp v .2</span>
</span><span class='line'><span class="cp">#include &lt;iostream&gt;</span>
</span><span class='line'><span class="n">using</span> <span class="n">namespace</span> <span class="n">std</span><span class="p">;</span>
</span><span class='line'>
</span><span class='line'><span class="kt">int</span> <span class="nf">main</span> <span class="p">()</span>
</span><span class='line'><span class="p">{</span>
</span><span class='line'>    <span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;Hello World! Version 2&quot;</span><span class="p">;</span>
</span><span class='line'>    <span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>


<p>Quit and save the file.</p>

<p>Now do a diff on the file:</p>

<pre>
svn diff main.cpp
</pre>


<p>A diff shows you the difference between the file you&#8217;re editing, and what&#8217;s stored in SVN.</p>

<p>You will see a screen that looks like this:</p>

<p><img src="http://images.jeremymorgan.com/raspberry-pi-how-to-svn-server-4.png" title="&#34;Raspberry Pi how to setup SVN server&#34;" alt="&#34;Raspberry Pi how to setup SVN server&#34;"></p>

<p>Now, let&#8217;s commit that file with the message &#8220;version 2&#8221;</p>

<pre>
sudo svn commit -m "version 2" main.cpp
</pre>


<p>You should see:</p>

<pre>
Sending main.cpp
Transmitting file data .
Committed revision 2.
</pre>


<p>Now, if you check your repo browser again:</p>

<p><img src="http://images.jeremymorgan.com/raspberry-pi-how-to-svn-server-5.png" title="&#34;Raspberry Pi how to setup SVN server&#34;" alt="&#34;Raspberry Pi how to setup SVN server&#34;"></p>

<p>You will see that your change has been committed. It&#8217;s that easy!</p>

<h3>Check out the repository in Windows</h3>

<p>Let&#8217;s say you&#8217;re a Windows user (not that there&#8217;s anything wrong with that) and you want to connect to your Pi from Windows. I recommend using <a href="http://tortoisesvn.net/downloads.html" rel="nofollow">Tortiose SVN</a> for the task. It&#8217;s a great free program that works well.</p>

<p>Once it&#8217;s installed, create a folder on your Desktop called &#8220;repos&#8221;. Then, right click inside that box and select &#8220;SVN Checkout&#8221;.</p>

<p><img src="http://images.jeremymorgan.com/raspberry-pi-how-to-svn-server-6.png" title="&#34;Raspberry Pi how to setup SVN server&#34;" alt="&#34;Raspberry Pi how to setup SVN server&#34;"></p>

<p>In that window, put in the URL to your repository:</p>

<p><img src="http://images.jeremymorgan.com/raspberry-pi-how-to-svn-server-7.png" title="&#34;Raspberry Pi how to setup SVN server&#34;" alt="&#34;Raspberry Pi how to setup SVN server&#34;"></p>

<p>For me it is http://192.168.254.18/svn/helloworld but yours may be different.</p>

<p>Click OK, and you should see the main.cpp file in there.</p>

<p>Edit it and make the following changes:</p>

<figure class='code'><figcaption><span>main.cpp </span></figcaption>
 <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
</pre></td><td class='code'><pre><code class='c'><span class='line'><span class="c1">// main.cpp v .2</span>
</span><span class='line'><span class="cp">#include &lt;iostream&gt;</span>
</span><span class='line'><span class="n">using</span> <span class="n">namespace</span> <span class="n">std</span><span class="p">;</span>
</span><span class='line'>
</span><span class='line'><span class="kt">int</span> <span class="nf">main</span> <span class="p">()</span>
</span><span class='line'><span class="p">{</span>
</span><span class='line'>    <span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;Hello World! Version 2&quot;</span><span class="p">;</span>
</span><span class='line'>    <span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>


<p>Save the file. Then right click on the file and select &#8220;SVN Commit&#8221;.</p>

<p><img src="http://images.jeremymorgan.com/raspberry-pi-how-to-svn-server-8.png" title="&#34;Raspberry Pi how to setup SVN server&#34;" alt="&#34;Raspberry Pi how to setup SVN server&#34;"></p>

<p>Enter a message and commit the file. It will ask for your login, then you You will see the following screen:</p>

<p><img src="http://images.jeremymorgan.com/raspberry-pi-how-to-svn-server-9.png" title="&#34;Raspberry Pi how to setup SVN server&#34;" alt="&#34;Raspberry Pi how to setup SVN server&#34;"></p>

<p>And you&#8217;re done!</p>

<h3>Conclusion</h3>

<p>I hope this has helped you with setting up an SVN server on your Raspberry Pi. It&#8217;s not incredibly practical but it seems to work well for me, as I&#8217;m the only developer using it. I also store my repos on an external drive, as the SD cards seem to flake out quite a bit.</p>

<p>If you have any questions, leave me a comment!</p>

<br />


<div class="subscribefooter">
<h4>Do you like my Rasbperry Pi Tutorials? </h4>
<div class="rssbutton"></div>
I&#8217;m constantly hacking on stuff with the Raspberry Pi. If you want to get notified every time I post a new article <a href="http://feeds.feedburner.com/JeremyMorganRaspberryPi"><strong>subscribe to my Raspberry Pi feed</strong></a> here, or you can <a href="http://www.feedblitz.com/f?sub=883810"><strong>Sign up for the Raspberry Pi Newsletter</strong></a> spam free!  
</div>



]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[How to install Linux on a PowerBook G4]]></title>
    <link href="http://www.jeremymorgan.com/tutorials/linux/how-to-install-linux-ppc-powerbook-g4/"/>
    <updated>2013-02-10T15:43:00-08:00</updated>
    <id>http://www.jeremymorgan.com/tutorials/linux/how-to-install-linux-on-a-powerbook-g4</id>
    <content type="html"><![CDATA[<p>Do you want to breathe life back into your old PowerBook or PowerPC machine? Want some modern software on it? In this tutorial I&#8217;ll show how you can put Ubuntu Linux on a PowerBook G4 and resurrect one of these durable old laptops from the dead.</p>

<!-- more -->


<p>Running an old version of OSX leopard in 2013 just doesn&#8217;t make sense. Even with everything updated simple things like checking Gmail or Facebook are nearly impossible. Every software package is ancient because  Using Linux will get you into a more modern environment.</p>

<h3>What version of Linux am I using and why?</h3>

<p>For my machine I chose Ubuntu 10.04. As I have <a href="https://plus.google.com/u/0/+JeremyMorgan/posts/ZNyuKYWg3GX" target="_blank">opined in the past</a> I feel 10.04 is a very stable version of Ubuntu and not too bloated or buggy. I also despise the Unity interface no matter how much they improve it. I couldn&#8217;t find any compelling advantages to the newer distributions but if you choose to install one of them the instructions should be the same.</p>

<p>Other distributions of Linux/Unix are available for the PPC platform as well. Here are the ones I&#8217;ve tried:</p>

<p><strong>Debian PPC (<a href="http://www.debian.org/ports/powerpc/" target="_blank" rel="nofollow">Link</a>)</strong> - This distro works very well but some software doesn&#8217;t update, the system clock has problems and there is a screen flicker / blank out problem that drove me nuts. You could switch to a new terminal to fix it, but it&#8217;s annoying.</p>

<p><strong>Yellow Dog Linux (<a href="http://www.yellowdoglinux.com/" target="_blank" rel="nofollow">Link</a>)</strong> - A very respectable Linux distribution but it isn&#8217;t being updated much anymore. I found I could get a lot of newer software on it but it was a lot of configuration and compiling.</p>

<p><strong>FreeBSD for PPC (<a href="http://www.freebsd.org/platforms/ppc.html" target="_blank" rel="nofollow">Link</a>)</strong> - This is a well reviewed option for PPC machines, but I just couldn&#8217;t get it working properly and didn&#8217;t have the patience for it. If you have a lot of time it will probably get you a good setup, but I got frustrated cleaning up errors.</p>

<p><strong>Gentoo for PPC (<a href="http://www.gentoo.org/doc/en/handbook/handbook-ppc.xml" target="_blank" rel="nofollow">Link</a>)</strong> - Awesome distro but it takes forever and a week to set up. I got mine setup and dialed in after about 30 hours of work, used it for quite a while and the hard drive went out. I haven&#8217;t had the time to redo this install and didn&#8217;t back it up. Also had the screen flicker problem though not as frequent as Debian</p>

<p>Depending on how much time you invest you can get any of these distributions working well, but the fastest and easiest setup for mine is using Ubuntu 10.04. A few hours of work and it produces a nice stable machine you don&#8217;t have to mess with. If that&#8217;s your goal keep reading.</p>

<h3>Install</h3>

<p>Download <a href="http://cdimage.ubuntu.com/ports/releases/10.04/release/ubuntu-10.04-desktop-powerpc.iso" target="_blank" rel="nofollow">The Ubuntu 10.04 PPC iso</a> and burn it to a CD. USB installs are pretty tricky with the powerbook.</p>

<p>Hold down the &#8220;C&#8221; button while booting to boot from the CD.</p>

<p>At the prompt, press enter to boot.(Be patient the startup time is pretty long)</p>

<h4>1. Start Installer</h4>

<p>Click on the &#8220;Install Ubuntu 10.04 LTS&#8221; link on the desktop.</p>

<p><img src="http://images.jeremymorgan.com/how-to-install-linux-ppc-powerbook-g4-1.png" title="&#34;how to install linux on PPC G4 Powerbook&#34;" alt="&#34;how to install linux on PPC G4 Powerbook&#34;"></p>

<h4>2. Select Language</h4>

<p>You should see a screen that looks like this:</p>

<p><img src="http://images.jeremymorgan.com/how-to-install-linux-ppc-powerbook-g4-2.png" title="&#34;how to install linux on PPC G4 Powerbook&#34;" alt="&#34;how to install linux on PPC G4 Powerbook&#34;"></p>

<p>Select English and click Forward.</p>

<h4>3. Time Zone</h4>

<p><img src="http://images.jeremymorgan.com/how-to-install-linux-ppc-powerbook-g4-3.png" title="&#34;how to install linux on PPC G4 Powerbook&#34;" alt="&#34;how to install linux on PPC G4 Powerbook&#34;"></p>

<p>Select your timezone in the next window and click Forward.</p>

<h4>4. Keyboard Layout</h4>

<p>In the next window you&#8217;ll see a screen to test your keyboard layout. USA works great, so select that and click Forward</p>

<p><img src="http://images.jeremymorgan.com/how-to-install-linux-ppc-powerbook-g4-4.png" title="&#34;how to install linux on PPC G4 Powerbook&#34;" alt="&#34;how to install linux on PPC G4 Powerbook&#34;"></p>

<h4>5. Partitioning</h4>

<p>In the next screen you&#8217;ll see something like this. My laptop did not have an OS, but yours might.</p>

<p><img src="http://images.jeremymorgan.com/how-to-install-linux-ppc-powerbook-g4-5.png" title="&#34;how to install linux on PPC G4 Powerbook&#34;" alt="&#34;how to install linux on PPC G4 Powerbook&#34;"></p>

<p>The best option here is to Erase and use the entire disk. Click Forward.</p>

<h4>6. Set your Username Info</h4>

<p>In this screen you will set your username. Type in your full name and the username you will use to log in.</p>

<p><img src="http://images.jeremymorgan.com/how-to-install-linux-ppc-powerbook-g4-6.png" title="&#34;how to install linux on PPC G4 Powerbook&#34;" alt="&#34;how to install linux on PPC G4 Powerbook&#34;"></p>

<p>Set the name of the computer, and select &#8220;Require my password to log in&#8221;. Do not allow it to log in automatically, this is a big security risk.</p>

<p>You may also choose to encrypt your home folder. This is a good idea, however it will slow your system down quite a bit. I opted not to do this, but if you do the procedure is nearly identical.</p>

<h3>7. Ready to Install</h3>

<p>You will see this screen, which allows you to verify the info you submitted.</p>

<p><img src="http://images.jeremymorgan.com/how-to-install-linux-ppc-powerbook-g4-7.png" title="&#34;how to install linux on PPC G4 Powerbook&#34;" alt="&#34;how to install linux on PPC G4 Powerbook&#34;"></p>

<p>Click advanced, and make sure &#8220;Install boot loader&#8221; is checked.</p>

<p><img src="http://images.jeremymorgan.com/how-to-install-linux-ppc-powerbook-g4-8.png" title="&#34;how to install linux on PPC G4 Powerbook&#34;" alt="&#34;how to install linux on PPC G4 Powerbook&#34;"></p>

<p>Click install.</p>

<h4>8. Installation Complete</h4>

<p>Once the installation is completed you&#8217;ll see the following screen:</p>

<p><img src="http://images.jeremymorgan.com/how-to-install-linux-ppc-powerbook-g4-9.png" title="&#34;how to install linux on PPC G4 Powerbook&#34;" alt="&#34;how to install linux on PPC G4 Powerbook&#34;"></p>

<p>Reboot the machine. It will eject the CD and ask you to click enter.</p>

<p>That&#8217;s it! If you don&#8217;t want to do any crazy partitioning or anything like that this is the easiest method to install it. If you want to dual boot operating systems that&#8217;s possible too and I might write a tutorial about that in the future. There is also some configuration to be done, and I&#8217;ll cover that in future tutorials as well.</p>

<h4>9. Fresh Install Updates</h4>

<p>The first thing you should do after installing is update everything. Run the following commands from the terminal (Applications - Accessories - Terminal)</p>

<pre>
sudo apt-get update
sudo apt-get upgrade
</pre>


<p>There aren&#8217;t many updates but it&#8217;s nice to get it started.</p>

<h4>10. Speed up the system</h4>

<p>There isn&#8217;t a lot you can do to make this any faster, after all this is old hardware and a dead architecture. But a couple things have helped with my machine and might help yours as well.</p>

<p>Go to system - preferences - startup applications</p>

<p>Here you can change which applications come up on startup. Whatever ones you don&#8217;t need, remove them.</p>

<p><img src="http://images.jeremymorgan.com/how-to-install-linux-ppc-powerbook-g4-10.png" title="&#34;how to install linux on PPC G4 Powerbook&#34;" alt="&#34;how to install linux on PPC G4 Powerbook&#34;"></p>

<p>There is also a text based application you can use with a few more options:</p>

<pre>
sudo apt-get install rcconf
</pre>


<p>This allows even more options for turning off startup services.</p>

<p><img src="http://images.jeremymorgan.com/how-to-install-linux-ppc-powerbook-g4-11.png" title="&#34;how to install linux on PPC G4 Powerbook&#34;" alt="&#34;how to install linux on PPC G4 Powerbook&#34;"></p>

<p>Common ones I disable are</p>

<ul>
<li>bluetooth</li>
<li>brltty</li>
<li>cups</li>
<li>ondemand</li>
<li>pcmciautils</li>
<li>ppd-dns</li>
</ul>


<p>You can play around with these, and disable whatever you don&#8217;t need. Since you&#8217;re dealing with limited hardware it&#8217;s always a good idea to trim the fat any way you can.</p>

<h4>Set swappiness</h4>

<p>The linux kernel has a setting called swappiness. This is a number from 0-100 that sets how much of your memory is left before going to swap. It is set at a default of 60, which means when 40% of your ram is in use it will start swapping. This can kill performance on your G4 pretty quick, as well as increase disk thrashing.</p>

<p>You can check your current setting here:</p>

<pre>
cat /proc/sys/vm/swappiness
</pre>


<p>This will show what your current swappiness is. I generally like to set mine at 10. When I&#8217;m getting that close to full I need the swap, but I don&#8217;t want it swapping all the time.</p>

<p>To set it, open your sysctl.conf:</p>

<pre>
sudo nano /etc/sysctl.conf
</pre>


<p>and at the bottom of the file, add</p>

<pre>
vm.swappiness = 10
</pre>


<p>Your results may vary, but generally 10-15 does pretty well. A setting of zero will never hit the swap and a setting of 100 always will. Where you find in between that works best depends on what you&#8217;re doing with it.</p>

<h3>Summary</h3>

<p>I hope this has been a good guide to setting up Ubuntu on a PPC machine. It&#8217;s super easy, with comparison to other operating systems. It&#8217;s a great way to recycle a computer for your kids, or even yourself rather than throwing it away. Besides it&#8217;s efficient, how else can you get a desktop that only uses 116mb of memory?</p>

<p><img src="http://images.jeremymorgan.com/how-to-install-linux-ppc-powerbook-g4-12.png" title="&#34;how to install linux on PPC G4 Powerbook&#34;" alt="&#34;how to install linux on PPC G4 Powerbook&#34;"></p>

<p>I am typing out this article on this very machine, I enjoy writing on it as it leaves me free of distractions and I can focus on what I&#8217;m doing. It&#8217;s also neat to carry around and hack up stuff when I need to.</p>

<p>If you have any questions, please leave them in the comments! I have done quite a few of these installs and there are some snags that come up occassionally. If you&#8217;re using an old PPC linux system for something cool, let me know about that too!</p>

<br />


<div class="subscribefooter">
<h4>Do you want to be notified every time a new tutorial is posted?</h4>
<div class="rssbutton"></div>
If you want to see more tutorials like these <a href="http://www.feedblitz.com/f?sub=889026"><strong>subscribe to our spam free newsletter</strong></a> and get them instantly in your inbox or feed reader.
If you want to get all my updates, <a href="http://feedburner.google.com/fb/a/mailverify?uri=jeremymorgan/NJwt&amp;loc=en_US"><strong>subscribe to the main RSS feed</strong></a> here.
</div>



]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[We're here to put a dent in the universe]]></title>
    <link href="http://www.jeremymorgan.com/blog/general/a-dent-in-the-universe/"/>
    <updated>2013-02-04T22:29:00-08:00</updated>
    <id>http://www.jeremymorgan.com/blog/general/were-here-to-put-a-dent-in-the-universe</id>
    <content type="html"><![CDATA[<p>The famous words of Steve Jobs have been ringing in my head a lot since my Dad passed away last week. He and Steve Jobs were not very much alike, in fact probably complete opposites. Dad wasn&#8217;t much of a dreamer or rock the boat kind of guy, and believed in treating everyone with respect. His style was not pushing people to be great but encouraging them to want it on their own. But they both shared one thing: wanting to make people&#8217;s lives better. Steve wanted to help strangers, but Dad made sure he took care of those around him.</p>

<!-- more -->


<p></p>

<p><img class="right" src="http://images.jeremymorgan.com/russ-peckham-1.png" title="Russ Peckham" > I will definitely write more on this subject soon, as you might imagine I have more pressing matters going on right now than my blog. I have tried to use it as a distraction though, and maybe that&#8217;s what this post is but the point I&#8217;d like to get across tonight is pretty simple: make your dent. Make a difference.</p>

<p>If you&#8217;re reading this blog it&#8217;s probably because you&#8217;re a programmer or an SEO to start with. That means you create things. And creating things is just a small part of making a dent. It&#8217;s not the items you create, the software you build or the successful marketing campaigns that define you. It&#8217;s what the things you build do for others that really matters. It&#8217;s how you make the world better with what you do.</p>

<h3>My Dad was a fixer</h3>

<p>The way my Dad made his dent was helping others. He worked with his hands and his mind in way that&#8217;s tough to replicate. He could look at any piece of machinery and figure out how it worked, fix it or make it better every time. And most of the time he was doing it for someone else. It was just what he did.</p>

<p>The same hands that assembled a cackling top fuel dragster or pull an axle from his semi truck were the same hands he used to hug his wife, kids and grandkids. Whether it was welding a &#8220;stack of dimes&#8221; ten feet long or patting you on the back it was always heartfelt and done with purpose. While he wasn&#8217;t always a man of many words he always meant what he said and always tried to build us up.</p>

<h3>The greatest thing he ever built</h3>

<p><img class="left" src="http://images.jeremymorgan.com/russ-peckham-3.png" title="Russ Peckham" > I don&#8217;t have enough space on this website to list the machinery Dad built. From his 32 Ford to those top fuel dragsters to the custom part on my Mercedes that&#8217;s still there (&#8220;damn German cars! he said) there are tons of things out there he built.</p>

<p>These things will live on, the little outlaw cars he loved so much and helped build will be tearing up the tracks in the Northwest next summer. But they will rust away and become forgotten over time. Dad never will.</p>

<p>What won&#8217;t be forgotten was the things he built that really mattered. He gave almost 3 decades to my mom, treating her how her kids thought she should be treated, with respect and dignity. My mother is one of the greatest people I know, and truly special. Russ saw that right away. And he raised 4 kids with a set of values that are already carrying on to his grandchildren.</p>

<p>The greatest thing he ever built was the people he touched. He always built us up in every way he could. Growing up all of us kids went through our phases and we all had dreams and aspirations, and when we shared them with Dad, he always told us we could do it, and encouraged us. I chose a path of technology and computers, which was something he never fully understood but he respected my goals and always tried to give advice with what he knew. His words will always ring in my head.</p>

<h3>What really matters</h3>

<p>He taught me early on that what really matters is gaining happiness by helping others around you. If you have a talent, use it. If you are dreaming of something, build it. This website where I put up all this free info helping people with SEO and Technology is here because he taught me when you know something you shouldn&#8217;t keep it hidden away from others. Share what you know and if someone takes that and makes something better with it don&#8217;t be jealous or envious be happy for them.</p>

<p><img class="right" src="http://images.jeremymorgan.com/russ-peckham-2.png" title="Russ Peckham" >And if you have something you love to do, follow it. He made his dent by building up everyone around him. So many people had a great amount of respect for him, not just because of his intelligence and talent but the fact that he had it and was willing to share it, and tempered it with humility like nobody I know. I try to emulate that in my daily life, and I still have a ways to go.</p>

<p>I will miss that man for the rest of my life, just as we all will but I will honor him by carrying on his values and trying to do things the way he did.</p>

<p>You should do the same. You probably didn&#8217;t know my Dad but you know someone like him. Go out and make a difference and do something that matters. Life is not about chasing dollars and buying fancy toys it&#8217;s about doing what you love and taking care of others. That can apply to building software or fancy websites just as much as it applies to fixing a leaky faucet for your Grandmother. Just do something meaningful and make your dent.</p>

<p>One way I am going to honor him is by sharing what I learned from him over the last 27 years. I will be starting a series of articles and pages dedicated to these lessons, and I hope people steal it and copy it and use it for their own lives. Stay tuned.</p>

<p>Rest in peace big guy, I&#8217;ll continue to try to make you proud.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[C# .Net Tutorials - How to Learn C# Part 6 - Iteration Statements]]></title>
    <link href="http://www.jeremymorgan.com/tutorials/c-sharp/how-to-learn-c-sharp-6-iteration-statements/"/>
    <updated>2013-02-01T20:24:00-08:00</updated>
    <id>http://www.jeremymorgan.com/tutorials/c-sharp/c-number-net-tutorials-how-to-learn-c-number-part-6-iteration-statements</id>
    <content type="html"><![CDATA[<p>In part 6 of my learning C# tutorial series we&#8217;re going to talk about Iteration Statements in C#. In part 5 we went over <a href="http://www.jeremymorgan.com/tutorials/c-sharp/how-to-learn-c-sharp-5-selection-statements/">C# selection statements</a>, which control program flow with true and false values using statements that execute a statement once based on a criteria. This is great for statements that need to execute in a sequence, but Iteration statements simplify statements that need to be executed in repetition.</p>

<!-- more -->


<h3>What exactly is an Iteration?</h3>

<div class="tutorialbox">
<h3>C# Tutorials: How to Learn C#</h3>
<ol>
<li><a href="http://www.jeremymorgan.com/tutorials/c-sharp/how-to-learn-c-sharp-part-1/">C# Introduction</a></li>
<li><a href="http://www.jeremymorgan.com/tutorials/c-sharp/how-to-learn-c-sharp-part-2-namespaces/">C# Namespaces</a></li>
<li><a href="http://www.jeremymorgan.com/tutorials/c-sharp/how-to-learn-c-sharp-part-3-coding-basics/">C# Coding Basics</a></li>
<li><a href="http://www.jeremymorgan.com/tutorials/c-sharp/how-to-learn-c-sharp-part-4-variables-and-types/">C# Variables and Types</a></li>
<li><a href="http://www.jeremymorgan.com/tutorials/c-sharp/how-to-learn-c-sharp-5-selection-statements/" rel="prev">C# Selection Statements</a></li>
<li>C# Iteration Statements</li>
</ol>
<a href="http://feedburner.google.com/fb/a/mailverify?uri=JeremyMorganTutorials&amp;loc=en_US" rel="nofollow"><strong>Get notified when new C# tutorials are released!</strong></a>
</div>


<p>An Iteration is just a fancy word for a loop. An Iteration statement will perform operations a set number of times until you tell it to stop, with a true or false value.</p>

<p>Iteration statements also depend on an expression being evaluated until a that expression evaluates to false. This is called &#8220;loop termination criteria&#8221; and depends on Boolean values being evaluated.</p>

<p>I&#8217;ll explain with some code. Let&#8217;s write something that counts ten items procedurally.</p>

<br />


<br />


<br />




<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
</pre></td><td class='code'><pre><code class='c'><span class='line'><span class="n">using</span> <span class="n">System</span><span class="p">;</span>
</span><span class='line'>
</span><span class='line'><span class="n">namespace</span> <span class="n">tutorials</span> <span class="p">{</span>
</span><span class='line'>
</span><span class='line'>  <span class="n">public</span> <span class="n">class</span> <span class="n">TestDoWhile</span>
</span><span class='line'>  <span class="p">{</span>
</span><span class='line'>      <span class="n">public</span> <span class="k">static</span> <span class="kt">void</span> <span class="n">Main</span> <span class="p">()</span>
</span><span class='line'>      <span class="p">{</span>
</span><span class='line'>          <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">&quot;Count is 0&quot;</span><span class="p">);</span>
</span><span class='line'>          <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">&quot;Count is 1&quot;</span><span class="p">);</span>
</span><span class='line'>          <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">&quot;Count is 2&quot;</span><span class="p">);</span>
</span><span class='line'>          <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">&quot;Count is 3&quot;</span><span class="p">);</span>
</span><span class='line'>          <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">&quot;Count is 4&quot;</span><span class="p">);</span>
</span><span class='line'>          <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">&quot;Count is 5&quot;</span><span class="p">);</span>
</span><span class='line'>          <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">&quot;Count is 6&quot;</span><span class="p">);</span>
</span><span class='line'>          <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">&quot;Count is 7&quot;</span><span class="p">);</span>
</span><span class='line'>          <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">&quot;Count is 8&quot;</span><span class="p">);</span>
</span><span class='line'>          <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">&quot;Count is 9&quot;</span><span class="p">);</span>
</span><span class='line'>      <span class="p">}</span>
</span><span class='line'>  <span class="p">}</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>


<blockquote><p>You might be wondering why we aren&#8217;t counting from 1 to 10. That&#8217;s because computers start counting at zero, not one and you have to start getting used to that idea if you&#8217;re a beginner. There are ten elements here, but since we started at zero the last digit is 9.</p></blockquote>

<p>While it&#8217;s pretty easy to understand what&#8217;s going on here you can tell right away there is a need for optimization. Part of being a &#8220;lazy programmer&#8221; is not wanting to repeat yourself. This adds time and increases the amount of mistakes.</p>

<p>Look how much cleaner and easier this code is:</p>

<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
</pre></td><td class='code'><pre><code class='c'><span class='line'><span class="n">using</span> <span class="n">System</span><span class="p">;</span>
</span><span class='line'>
</span><span class='line'><span class="n">namespace</span> <span class="n">tutorials</span> <span class="p">{</span>
</span><span class='line'>
</span><span class='line'>  <span class="n">public</span> <span class="n">class</span> <span class="n">TestDoWhile</span>
</span><span class='line'>  <span class="p">{</span>
</span><span class='line'>      <span class="n">public</span> <span class="k">static</span> <span class="kt">void</span> <span class="n">Main</span> <span class="p">()</span>
</span><span class='line'>      <span class="p">{</span>
</span><span class='line'>          <span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">limit</span> <span class="o">=</span> <span class="mi">10</span><span class="p">;</span>
</span><span class='line'>          <span class="k">do</span>
</span><span class='line'>          <span class="p">{</span>
</span><span class='line'>              <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">&quot;Count: &quot;</span> <span class="o">+</span> <span class="n">i</span><span class="p">);</span>
</span><span class='line'>              <span class="n">i</span><span class="o">++</span><span class="p">;</span>
</span><span class='line'>          <span class="p">}</span> <span class="k">while</span> <span class="p">(</span><span class="n">i</span> <span class="o">&lt;</span> <span class="n">limit</span><span class="p">);</span>
</span><span class='line'>      <span class="p">}</span>
</span><span class='line'>  <span class="p">}</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>


<p>This code produces the same output yet it&#8217;s much less to write and easier to understand. The expression &#8220;do&#8221; executes and outputs a number (represented by i) then increments that number by adding 1 to it. This <strong>do</strong> statement would run forever if we let it, so the 2nd part of it is the <strong>while</strong> statement that evaluates the expression &#8220;i &lt; limit&#8221;. While checks to see if i is smaller than the limit we specified, and if it is then it returns to execute do again.</p>

<p>Next I&#8217;ll explain the Iteration Statements available in C#, and how they work.</p>

<blockquote><p><b>Note</b>: Like my other tutorials I will be eliminating the using statements and namespace / class declarations because you shouldn&#8217;t repeat yourself in tutorials either ;)</p></blockquote>

<h3>While statement</h3>

<p>The while statement is frequently used in code due to it&#8217;s simplicity and speed. In the example above I used a combination of do and while to create a do-while loop, but while can operate on it&#8217;s own. Let&#8217;s do the count to 10 with just a while loop and see how it works:</p>

<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
</pre></td><td class='code'><pre><code class='c'><span class='line'><span class="k">static</span> <span class="kt">void</span> <span class="nf">Main</span><span class="p">()</span>
</span><span class='line'><span class="p">{</span>
</span><span class='line'>  <span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">limit</span> <span class="o">=</span> <span class="mi">10</span><span class="p">;</span>
</span><span class='line'>    <span class="k">while</span> <span class="p">(</span><span class="n">i</span> <span class="o">&lt;</span> <span class="n">limit</span><span class="p">)</span>
</span><span class='line'>    <span class="p">{</span>
</span><span class='line'>      <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">&quot;Count: &quot;</span> <span class="o">+</span> <span class="n">i</span><span class="p">);</span>
</span><span class='line'>      <span class="n">i</span><span class="o">++</span><span class="p">;</span>
</span><span class='line'>    <span class="p">}</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>


<p>This loop is pretty much as simple as it gets. The while simply runs while the expression evaluates to <strong>true</strong> .</p>

<p>In plain English:</p>

<ul>
<li>While our value (i) is less than another value (limit) execute,</li>
<li>Write out the value (i)</li>
<li>Increment the value (i)</li>
</ul>


<p>This loop will repeat until the expression (i &lt; limit) evaluates to false. If it is already set to false, nothing in the while loop will execute. Type the following in and run it:</p>

<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
</pre></td><td class='code'><pre><code class='c'><span class='line'><span class="k">static</span> <span class="kt">void</span> <span class="nf">Main</span><span class="p">()</span>
</span><span class='line'>        <span class="p">{</span>
</span><span class='line'>            <span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">10</span><span class="p">,</span> <span class="n">limit</span> <span class="o">=</span> <span class="mi">10</span><span class="p">;</span>
</span><span class='line'>            <span class="k">while</span> <span class="p">(</span><span class="n">i</span> <span class="o">&lt;</span> <span class="n">limit</span><span class="p">)</span>
</span><span class='line'>            <span class="p">{</span>
</span><span class='line'>                <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">&quot;Count: &quot;</span> <span class="o">+</span> <span class="n">i</span><span class="p">);</span>
</span><span class='line'>                <span class="n">i</span><span class="o">++</span><span class="p">;</span>
</span><span class='line'>            <span class="p">}</span>
</span><span class='line'>        <span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>


<p>When you run this, you&#8217;ll notice nothing happens. This is because (i) is not less than (limit) so the loop never runs. This is ideal for most situations, but you may want your loop to run at least once, which brings us to the next loop.</p>

<h3>Do statement (with while)</h3>

<p>I used the do statement in the first example in combination with the while statment. Do executes a statement or block of statements until a specified expression evaluates to FALSE. You can use do without braces if it&#8217;s only a single statement:</p>

<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='c'><span class='line'><span class="k">do</span> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">&quot;Count: &quot;</span> <span class="o">+</span> <span class="n">i</span><span class="p">);</span> <span class="k">while</span> <span class="p">(</span><span class="n">i</span> <span class="o">&lt;</span> <span class="n">limit</span><span class="p">);</span>
</span></code></pre></td></tr></table></div></figure>


<p>but if you need to execute more than one statement you&#8217;ll need to enclose them in braces:</p>

<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class='c'><span class='line'><span class="k">do</span>
</span><span class='line'>  <span class="p">{</span>
</span><span class='line'>      <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">&quot;Count: &quot;</span> <span class="o">+</span> <span class="n">i</span><span class="p">);</span>
</span><span class='line'>      <span class="n">i</span><span class="o">++</span><span class="p">;</span>
</span><span class='line'>  <span class="p">}</span> <span class="k">while</span> <span class="p">(</span><span class="n">i</span> <span class="o">&lt;</span> <span class="n">limit</span><span class="p">);</span>
</span></code></pre></td></tr></table></div></figure>


<p>The mechanics of this should be fairly obvious: in plain English we want to:</p>

<ul>
<li>write a value (i) to the console</li>
<li>increment the value</li>
<li>repeat while that value is less than another (limit)</li>
</ul>


<p>This is pretty simple, but take a note of the order of operations with this loop. The thing to remember about a do-while loop such as the one above is this:</p>

<blockquote><p>A do-while loop will always execute then evaluate an expression to see if it needs to continue looping. The statement will always be executed at least once, while a while loop will only execute if a condition is evaluated as true. This is an important distinction.</p></blockquote>

<p>We can break out of a while loop early if needed:</p>

<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
</pre></td><td class='code'><pre><code class='c'><span class='line'><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">limit</span> <span class="o">=</span> <span class="mi">10</span><span class="p">;</span>
</span><span class='line'>  <span class="k">do</span>
</span><span class='line'>  <span class="p">{</span>    
</span><span class='line'>      <span class="k">if</span> <span class="p">(</span><span class="n">i</span> <span class="o">==</span> <span class="mi">7</span><span class="p">)</span>
</span><span class='line'>      <span class="p">{</span>
</span><span class='line'>      <span class="k">break</span><span class="p">;</span>
</span><span class='line'>      <span class="p">}</span><span class="k">else</span>
</span><span class='line'>      <span class="p">{</span>
</span><span class='line'>          <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">&quot;Count: &quot;</span> <span class="o">+</span> <span class="n">i</span><span class="p">);</span>
</span><span class='line'>      <span class="p">}</span>
</span><span class='line'>      <span class="n">i</span><span class="o">++</span><span class="p">;</span>
</span><span class='line'>  <span class="p">}</span>
</span><span class='line'>  <span class="k">while</span> <span class="p">(</span><span class="n">i</span> <span class="o">&lt;</span> <span class="n">limit</span><span class="p">);</span>
</span></code></pre></td></tr></table></div></figure>


<p>When you run this you will see the following output:</p>

<pre>
Count: 0
Count: 1
Count: 2
Count: 3
Count: 4
Count: 5
Count: 6
</pre>


<p>This is because you put in a condition that evaluated whether i was 7 and if so, terminate the loop. This can come in pretty handy. You can also use goto, return and flow to break out of this loop as well. There are times where you may want to check for something in each iteration and if it happens, break out of it to correct it or stop the process.</p>

<h3>For Statement</h3>

<p>The for loop is a little more tricky to understand at first, but it performs the same function as a while loop. The for loop isn&#8217;t faster or any more powerful, but it is easier to construct and read so it&#8217;s mostly a programmer advantage (very important).</p>

<p>Here&#8217;s an example of a for loop that counts to 10:</p>

<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
</pre></td><td class='code'><pre><code class='c'><span class='line'><span class="n">public</span> <span class="k">static</span> <span class="kt">void</span> <span class="nf">Main</span> <span class="p">()</span>
</span><span class='line'><span class="p">{</span>
</span><span class='line'>  <span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="mi">10</span><span class="p">;</span> <span class="n">i</span><span class="o">++</span><span class="p">)</span>
</span><span class='line'>  <span class="p">{</span>
</span><span class='line'>      <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">i</span><span class="p">);</span>
</span><span class='line'>  <span class="p">}</span>            
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>


<p>When you compile and run this it should look pretty familiar to you. The output is the same, but as you can see constructing the loop is easier and there is less code to look at. Let&#8217;s explain how it works in plain English:</p>

<ul>
<li>test to see if our initial value (i) is less than ten</li>
<li>if so, increment it and execute next expression</li>
<li>write out the value (i)</li>
</ul>


<p>This is my preferred method of looping most of the time because it&#8217;s so easy to set up. Here is how the function works:</p>

<p><img src="http://images.jeremymorgan.com/c-sharp-net-tutorial-iteration-1.png" title="C# .Net Tutorials" >
<img src="http://images.jeremymorgan.com/c-sharp-net-tutorial-iteration-2.png" title="C# .Net Tutorials" >
<img src="http://images.jeremymorgan.com/c-sharp-net-tutorial-iteration-3.png" title="C# .Net Tutorials" >
<img src="http://images.jeremymorgan.com/c-sharp-net-tutorial-iteration-4.png" title="C# .Net Tutorials" >
<img src="http://images.jeremymorgan.com/c-sharp-net-tutorial-iteration-5.png" title="C# .Net Tutorials" >
<img src="http://images.jeremymorgan.com/c-sharp-net-tutorial-iteration-6.png" title="C# .Net Tutorials" >
<img src="http://images.jeremymorgan.com/c-sharp-net-tutorial-iteration-7.png" title="C# .Net Tutorials" ></p>

<p>I hope this has helped clear up how the <strong>for</strong> loop works. This is a really quick way to iterate through a finite number fairly quick.</p>

<h3>Foreach statement</h3>

<p>The foreach statement is a little different than for in that it repeats a group of statements <strong>for each</strong> element in an array, object or collection. It is used for reading those elements in the sequence defined by the foreach statement.</p>

<p>Here is an example of our count to 10 app with a foreach statement:</p>

<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
</pre></td><td class='code'><pre><code class='c'><span class='line'> <span class="n">public</span> <span class="k">static</span> <span class="kt">void</span> <span class="nf">Main</span> <span class="p">()</span>
</span><span class='line'>    <span class="p">{</span>
</span><span class='line'>      <span class="kt">int</span><span class="p">[]</span> <span class="n">ourArray</span> <span class="o">=</span> <span class="n">new</span> <span class="kt">int</span><span class="p">[]</span> <span class="p">{</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">8</span> <span class="p">,</span> <span class="mi">9</span> <span class="p">};</span>
</span><span class='line'>      
</span><span class='line'>      <span class="n">foreach</span> <span class="p">(</span><span class="kt">int</span> <span class="n">i</span> <span class="n">in</span> <span class="n">ourArray</span><span class="p">)</span>
</span><span class='line'>      <span class="p">{</span>
</span><span class='line'>          <span class="n">System</span><span class="p">.</span><span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">i</span><span class="p">);</span>
</span><span class='line'>      <span class="p">}</span>
</span><span class='line'>  <span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>


<p>As you can see in this example it&#8217;s a little different because we&#8217;re creating an array on line 3 that we iterate though. Since this is an integer array we create the int(i) to represent the element of the array. Then we execute everything in the brackets each time a new element in the array is found. While there are new elements in i we will display them, then as soon as there are no more we exit from the loop.</p>

<p>But this doesn&#8217;t just work on integer arrays, it works on all types of arrays and objects where you use an iterator. Here&#8217;s an example with strings:</p>

<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
</pre></td><td class='code'><pre><code class='c'><span class='line'><span class="n">public</span> <span class="k">static</span> <span class="kt">void</span> <span class="nf">Main</span> <span class="p">()</span>
</span><span class='line'>      <span class="p">{</span>
</span><span class='line'>        <span class="n">string</span><span class="p">[]</span> <span class="n">ourArray</span> <span class="o">=</span> <span class="n">new</span> <span class="n">string</span><span class="p">[]</span> <span class="p">{</span> <span class="s">&quot;C# Tutorials&quot;</span><span class="p">,</span> <span class="s">&quot;Python Tutorials&quot;</span><span class="p">,</span> <span class="s">&quot;Underwater Basket Weaving&quot;</span> <span class="p">};</span>
</span><span class='line'>      
</span><span class='line'>        <span class="n">foreach</span> <span class="p">(</span><span class="n">string</span> <span class="n">s</span> <span class="n">in</span> <span class="n">ourArray</span><span class="p">)</span>
</span><span class='line'>        <span class="p">{</span>
</span><span class='line'>            <span class="n">System</span><span class="p">.</span><span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">s</span><span class="p">);</span>
</span><span class='line'>        <span class="p">}</span>
</span><span class='line'>      <span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>


<p>Notice how the variable (s) is pulled from the array and displayed until there are no more in the array. This is a great way to iterate through arrays, lists, collections and objects.</p>

<blockquote><p>Note that you should generally only use this for read only operations. If you start messing with items of an array as it&#8217;s being traversed you get some pretty unexpected results.</p></blockquote>

<p>The foreach statement is great for working with data objects, and is extremely powerful and easy to use.</p>

<h3>Conclusion</h3>

<p>In this tutorial we explored four kinds of iterations in C#:</p>

<ul>
<li>while</li>
<li>do</li>
<li>for</li>
<li>foreach</li>
</ul>


<p>These are what I would consider very commonly used core parts of C# development, but it&#8217;s far from the only way to iterate data in C#. In many ways LINQ is taking over this area pretty well, and I&#8217;ll cover that in future issues. But learning these statements well will help you on your way to becoming a better C# Programmer.</p>

<br />


<div class="subscribefooter">
<h4>Do you want to be notified every time a new tutorial is posted?</h4>
<div class="rssbutton"></div>
If you want to see more tutorials like these <a href="http://www.feedblitz.com/f?sub=889026"><strong>subscribe to our spam free newsletter</strong></a> and get them instantly in your inbox or feed reader.
If you want to get all my updates, <a href="http://feedburner.google.com/fb/a/mailverify?uri=jeremymorgan/NJwt&amp;loc=en_US"><strong>subscribe to the main RSS feed</strong></a> here.
</div>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[How to Build a Raspberry Pi File Server]]></title>
    <link href="http://www.jeremymorgan.com/tutorials/raspberry-pi/how-to-raspberry-pi-file-server/"/>
    <updated>2013-01-28T19:49:00-08:00</updated>
    <id>http://www.jeremymorgan.com/tutorials/raspberry-pi/how-to-build-a-raspberry-pi-file-server</id>
    <content type="html"><![CDATA[<p>So I found yet another cool use for a Raspberry Pi. You can actually use it as a file server, or more accurately a controller for a file server. All you need is your Pi and a nice external drive and you can serve files to anyone on your network. It&#8217;s pretty easy, I&#8217;ll show you how.</p>

<!-- more -->


<p></p>

<div class="tutorialbox">
<h3>Other Raspberry Pi Stuff</h3>
<ol>
<li><a href="http://www.jeremymorgan.com/tutorials/raspberry-pi/how-to-raspberry-pi-web-server/">Set up a Raspberry Pi Web Server</a></li>
<li><a href="http://www.jeremymorgan.com/blog/programming/raspberry-pi-web-server-comparison/">Raspberry Pi Web Server Speed Test</a></li>
<li><a href="http://www.jeremymorgan.com/tutorials/raspberry-pi/how-to-overclock-raspberry-pi/">How to Overclock Raspberry Pi</a></li>
<li><a href="http://www.jeremymorgan.com/tutorials/raspberry-pi/how-to-install-node-js-raspberry-pi/" rel="prev">How to Install Node.js on RPi</a></li>
<li>How to Build a Raspberry Pi File Server</a></li>
</ol>
<a href="http://feedburner.google.com/fb/a/mailverify?uri=JeremyMorganTutorials&amp;loc=en_US" rel="nofollow"><strong>Get notified when new tutorials are released!</strong></a>
</div>


<h3>What you&#8217;ll need.</h3>

<p>You need the Raspberry Pi set up and connected to your network. You&#8217;ll also need an external drive. I&#8217;m using a <a href="http://www.amazon.com/gp/product/B000XRK3LG/ref=as_li_ss_tl?ie=UTF8&camp=1789&creative=390957&creativeASIN=B000XRK3LG&linkCode=as2&tag=webfootcentra-20">Western Digital My Book 500 GB</a><img src="http://www.assoc-amazon.com/e/ir?t=webfootcentra-20&l=as2&o=1&a=B000XRK3LG" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> drive.</p>

<p>But this drive is a few years old, so if you&#8217;re going to buy one you can pick up a <a href="http://www.amazon.com/gp/product/B0042Z55RM/ref=as_li_ss_tl?ie=UTF8&camp=1789&creative=390957&creativeASIN=B0042Z55RM&linkCode=as2&tag=webfootcentra-20">3 Terabyte Model</a><img src="http://www.assoc-amazon.com/e/ir?t=webfootcentra-20&l=as2&o=1&a=B0042Z55RM" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> for around $120. Since your SD card doesn&#8217;t have a lot of space and doesn&#8217;t handle frequent reading and writing you&#8217;ll need to get an external USB drive.</p>

<p><img class="center" src="http://images.jeremymorgan.com/raspberry-pi-file-server.png" title="Raspberry Pi File Server" ></p>

<p>As with most of my tutorials, you&#8217;ll need an install of <a href="http://www.raspberrypi.org/downloads" target="_new" rel="nofollow">Raspian Wheezy</a> to do this tutorial.</p>

<br />


<div class="subscribefooter">
<h4>Do you like my Rasbperry Pi Tutorials? </h4>
<div class="rssbutton"></div>
I&#8217;m constantly hacking on stuff with the Raspberry Pi. If you want to get notified every time I post a new article <a href="http://feeds.feedburner.com/JeremyMorganRaspberryPi"><strong>subscribe to my Raspberry Pi feed</strong></a> here, or you can <a href="http://www.feedblitz.com/f?sub=883810"><strong>Sign up for the Raspberry Pi Newsletter</strong></a> spam free!  
</div>


<h3>Mount an external USB drive</h3>

<p>The first thing you need to do is make sure your Raspberry Pi can see the external drive. Before you plug it in, open up an LXTerminal (or get to the prompt through SSH) and type in</p>

<pre>
tail -f /var/log/messages
</pre>


<p>and watch the output. Now plug in the USB drive. You should see something like this come up:</p>

<p><img class="center" src="http://images.jeremymorgan.com/raspberry-pi-file-server-2.png" title="Raspberry Pi File Server" ></p>

<p>You want to look for a string identifying your USB device, but the [sda] is the part you want to pay attention to. Another thing to note: Some drives like the WD My Book come with a built in CD-ROM emulator as well for software installation. You don&#8217;t want to mount this, so look for the size of the device (in my case 499GB).</p>

<p>To escape this screen, press CTRL+C.</p>

<p>So first we want to create a location for this drive on the Raspberry Pi. This is done with the following command:</p>

<pre>
sudo mkdir /media/USBDRIVE
</pre>


<p>Now, you want to mount the drive:</p>

<pre>
sudo mount -t ntfs-3g -o uid=pi,gid=pi /dev/sda1 /media/USBDRIVE/
</pre>


<p>If you get a message saying ntfs-3g isn&#8217;t supported, install it:</p>

<pre>
sudo apt-get install ntfs-3g
</pre>


<p>This will enable you to mount it.</p>

<p><strong>If your drive is not NTFS</strong>
Simply replace ntfs-3g with vfat</p>

<pre>
sudo mount -t vfat -o uid=pi,gid=pi /dev/sda1 /media/USBDRIVE/
</pre>


<p>Now, you can cd to /media/USBDRIVE and see it, and it should also pop up in your file manager:</p>

<p><img class="center" src="http://images.jeremymorgan.com/raspberry-pi-file-server-3.png" title="Raspberry Pi File Server" ></p>

<h3>Mount the drive at startup</h3>

<p>This step is optional but if you want your drive to mount automatically on startup, here&#8217;s what you do:</p>

<p>Backup the fstab:</p>

<pre>
sudo cp /etc/fstab /etc/fstab.backup
</pre>


<p>Now open fstab:</p>

<pre>
sudo nano /etc/fstab
</pre>


<p>In the fstab file, add the mount information (yours may vary slightly)</p>

<pre>
/dev/sda1    /media/USBDRIVE    ntfs-3g    rw,defaults    0    0
</pre>


<p>Make sure you have write permissions to it:</p>

<pre>
sudo chmod 775 /media/USBDRIVE
</pre>


<p>Now, reboot your machine and make sure the drive automatically comes up.</p>

<h3>Share the drive on your network</h3>

<p>Next, we&#8217;ll install SAMBA to share this drive on your network.</p>

<pre>
sudo apt-get update
sudo apt-get install samba
sudo apt-get install samba-common-bin
</pre>


<p>Now that Samba is installed, let&#8217;s add a user:</p>

<pre>
sudo smbpasswd -a pi
</pre>


<p>Enter the password you want to use to log on.</p>

<p>Now, make a backup of the Samba config file</p>

<pre>
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.backup
</pre>


<p>and now we&#8217;re going to open that file and make some changes:</p>

<pre>
sudo nano /etc/samba/smb.conf
</pre>


<p>The first thing to look for is workgroup.</p>

<p>For Windows XP or Vista:</p>

<pre>
workgroup = WORKGROUP
</pre>


<p>(or the name of your network workgroup)</p>

<p>For Windows 7 or 8</p>

<pre>
workgroup = HOME
</pre>


<p>(or the name of your network workgroup)</p>

<p>Next, we want to enable user security. Remove the hash tag (#) so the entry looks like this:</p>

<pre>
security = user
</pre>


<p>For better performance, do the same with TCP_NODELAY</p>

<pre>
socket options = TCP_NODELAY
</pre>


<p>Now, we want to create our share. Under the &#8220;Share Definitions&#8221; line, add something like this:</p>

<pre>
[USB] 
path = /media/USBDRIVE
comment = My USB Drive 
valid users = pi 
writeable = yes 
browseable = yes
</pre>


<p>Save and Quit Nano. (CTRL + X and answer Yes)</p>

<p>Run a check on the config file:</p>

<pre>
testparm 
</pre>


<p>You should see something like this:</p>

<pre>
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[homes]"
Processing section "[USB]"
Processing section "[printers]"
Processing section "[print$]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
</pre>


<p>As long as it says &#8220;Loaded services file OK.&#8221; you won&#8217;t have a problem.</p>

<p>Now, restart the Samba Server:</p>

<pre>
sudo /etc/init.d/samba restart
</pre>


<p>You should see something like this:</p>

<p><img class="center" src="http://images.jeremymorgan.com/raspberry-pi-file-server-4.png" title="Raspberry Pi File Server" ></p>

<p>Now you&#8217;re on the network!</p>

<h3>Connect to your Pi from Windows</h3>

<p>To connect to your Raspberry Pi from Windows, you&#8217;ll need to know your hostname. Type in:</p>

<pre>
hostname
</pre>


<p>and check the output. For me my hostname is &#8220;raspberrypi&#8221; (I know, creative right?).</p>

<p>On your Windows machine, type in Start -> Run and type in</p>

<pre>
\\raspberrypi
</pre>


<p>(or whatever your hostname is)</p>

<p><img class="center" src="http://images.jeremymorgan.com/raspberry-pi-file-server-5.png" title="Raspberry Pi File Server" ></p>

<p>and you should see a screen like this:</p>

<p><img class="center" src="http://images.jeremymorgan.com/raspberry-pi-file-server-6.png" title="Raspberry Pi File Server" ></p>

<p>Double click on the USB folder. It will ask you for your password:</p>

<p><img class="center" src="http://images.jeremymorgan.com/raspberry-pi-file-server-7.png" title="Raspberry Pi File Server" ></p>

<p>Here you want to enter the username and password you set earlier with &#8220;smbpasswd&#8221;.</p>

<p>You&#8217;ll now see that you can browse the folder:</p>

<p><img class="center" src="http://images.jeremymorgan.com/raspberry-pi-file-server-8.png" title="Raspberry Pi File Server" ></p>

<p>Congratulations!</p>

<h3>Add this as a drive on your computer</h3>

<p>This step is also optional, but you can add this as a drive on your computer. Go to &#8220;My Computer&#8221; or Start -> computer and select the button at the top that says &#8220;Map Network Drive&#8221;.</p>

<p>In the next box, browse to your USB drive on your Raspberry Pi and add it:</p>

<p><img class="center" src="http://images.jeremymorgan.com/raspberry-pi-file-server-8.png" title="Raspberry Pi File Server" ></p>

<p>Now it will be added automatically as a drive on your computer!</p>

<h3>Some Notes:</h3>

<p>Make sure you have an additional power supply going to your USB drive. Don&#8217;t rely on the Raspberry Pi to power it, as that is too much of a drain for it. The drive I used has its own power supply and I haven&#8217;t had any problems with it.</p>

<p>You may also need to <a href="http://www.sevenforums.com/network-sharing/6128-cant-connect-samba-share.html" target="_blank" rel="nofollow">Change 128bit to 40-56 bit encryption for file shares under Advanced Sharing Options</a> to make it work with certain versions of Windows.</p>

<h3>Summary</h3>

<p>I hope this tutorial has shown you how to set up a file server on your network. I don&#8217;t keep a lot of stuff on this drive, but I don&#8217;t exactly want to lug it around and plug it in to every computer I want to pull the files on (first world problems, I know). So it&#8217;s nice that I can now grab files off here from any computer in the house with ease. I could do this with any Linux or Windows machine, but the idea of a big loud machine to do the same task is wasteful and more expensive.</p>

<br />


<div class="subscribefooter">
<h4>Do you like my Rasbperry Pi Tutorials? </h4>
<div class="rssbutton"></div>
I&#8217;m constantly hacking on stuff with the Raspberry Pi. If you want to get notified every time I post a new article <a href="http://feeds.feedburner.com/JeremyMorganRaspberryPi"><strong>subscribe to my Raspberry Pi feed</strong></a> here, or you can <a href="http://www.feedblitz.com/f?sub=883810"><strong>Sign up for the Raspberry Pi Newsletter</strong></a> spam free!  
</div>



]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Why Should You Use MySQL?]]></title>
    <link href="http://www.jeremymorgan.com/blog/programming/why-use-mysql/"/>
    <updated>2013-01-27T11:34:00-08:00</updated>
    <id>http://www.jeremymorgan.com/blog/programming/in-defense-of-mysql</id>
    <content type="html"><![CDATA[<p>The programming industry was dropped another bombshell blog post the other day, <a href="http://grimoire.ca/mysql/choose-something-else">Considering MySQL? Choose something else</a> and as expected it sparked discussion, rants and raves. I love posts like this because they foster discussion and get us talking and thinking about things we otherwise ignore or put out of our minds. But should we all turn our backs on MySQL and kill it? I don&#8217;t think we should.</p>

<!-- more -->


<h3>Were the accusations against MySQL unfounded?</h3>

<p>Let me be clear in saying I&#8217;m not going to try to counterpoint the article on a fact by fact basis, I read through it pretty carefully and it&#8217;s accurate. Much like the <a href="http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/">PHP: a fractal of bad design</a> article the person writing it did manage to point out some serious flaws in the design, but kept it very one sided. It&#8217;s still a decent tool for some jobs, and it really depends on what you&#8217;re using it for.</p>

<h3>The best doesn&#8217;t always win</h3>

<p><img class="right" src="http://images.jeremymorgan.com/why-use-mysql.png" title="Why use MySQL" >
If there&#8217;s one thing most of us already know about tech, it&#8217;s that the superior technology is not always adopted by the industry. In fact more often than not the better technologies fall to the wayside in favor of something that&#8217;s easier and cheaper to produce. We make money with software, and people often forget that.</p>

<p>Remember Betamax vs VHS? Betamax was in many ways superior because of higher resolution and better sound quality. Purists at the time absolutely loved the quality of Betamax over VHS.</p>

<p>Though it&#8217;s still debated decades later, most people acknowledge the lesser &#8220;VHS&#8221; format won because of longer recording time, and cheaper devices. Consumers didn&#8217;t care about higher quality when the price was so high, and movie studios didn&#8217;t want to split their movies between multiple tapes.</p>

<p>Simply put: VHS was lower quality but it solved the problem better, for cheaper. That&#8217;s the reason MySQL is still so ubiquitous today. It&#8217;s not about the programmers, its about the consumers. MySQL&#8217;s closest competitor is PostGreSQL which is far superior in many ways, but it&#8217;s struggling to fill a niche that&#8217;s already being filled, even if it&#8217;s filled poorly.</p>

<h3>10 reasons to use MySQL</h3>

<p>So here&#8217;s the reasons why someone would use MySQL and why we shouldn&#8217;t be making funeral plans for it just yet.</p>

<h4>1. It&#8217;s ubiquitous</h4>

<p>Go to any Linux or Windows based web host, and there it is. Download an open source project and most of time that&#8217;s what it&#8217;s connected to. If you&#8217;re in a shared hosting environment you can&#8217;t just go an install something else, but you can stick with MySQL and download just about any open source software and use it. That&#8217;s an advantage, especially for new folks.</p>

<h4>2. It&#8217;s easy to find help</h4>

<p>If you get stuck on something, there are countless places to find your solution. There are tens of thousands of tutorials, help docs and discussions about it. Chances are the problem you&#8217;re having isn&#8217;t anything new and someone has already solved it.</p>

<h4>3. It&#8217;s easy to learn</h4>

<p>Pretty much anyone can learn the basics and get up and running very quickly with MySQL. If you&#8217;re building something small and simple it&#8217;s very easy, and quite forgiving. While this builds poor programming practices it also gives people training wheels until they learn more and decide to get a real database.</p>

<h4>4. MySQL is considered proven</h4>

<p>While it may not be perfect, it is considered a proven technology in the industry. Vendors strive to have their applications and tools compatible with MySQL because it&#8217;s so frequently used successfully. There are plenty of applications that use MySQL in a smart way to solve their problems, and they work just fine.</p>

<h4>5. Less features mean less maintenance</h4>

<p>You don&#8217;t need to hire a group of certified DBAs to run a MySQL database. An ordinary programmer can learn enough to maintain their database servers for most applications. There are many features enterprise database vendors offer that you can&#8217;t find in MySQL, but you also don&#8217;t need. Most of the time those extra features mean more points of failure, and more education needed to keep the server running, which is wasteful if you aren&#8217;t actively using said features anyway. MySQL is very much &#8220;set it and forget it&#8221; in many applications.</p>

<h4>6. Total Cost of Ownership (TCO)</h4>

<p>How many startups out there want to fork out thousands of dollars for a Microsoft or Oracle solution? They&#8217;re operating on a shoestring so a free database solution is a no brainer. MySQL can be installed on as many servers as you need and it doesn&#8217;t require much in the way of hardware. And as I mentioned before the labor costs for maintaining it are far lower. Even large established companies love saving money, and MySQL saves money.</p>

<p>If you don&#8217;t need the extra features you aren&#8217;t going to pay through the nose for it, pure and simple.</p>

<h4>7. MySQL is scalable</h4>

<p>You and your brother in law decide to start a company in your garage. You choose MySQL based on price and build your application. Fast forward a year from now and things are growing good. You&#8217;ve added a couple more servers and things are fine. Another year goes by and you have some breakthrough and your business is 10 times larger overnight. You can use that money to build as much of an infrastructure as you need, and rather quickly. MySQL can handle everything from a megabyte of data to terabytes just fine. With good education about the system you can scale it up.</p>

<h4>8. Native support for the new stuff</h4>

<p>If you really want to be hip and cutting edge you wouldn&#8217;t consider using that stale and uncool MySQL right? Well actually you might considering how well it interfaces with things like Ruby and Python. It&#8217;s well supported out of the box, and ready for the latest and greatest technologies coming out, as well as great support for PHP.</p>

<h4>9. Great transactional support</h4>

<p>While MySQL may not be the greatest for data warehousing it&#8217;s hard to argue it&#8217;s bad as a transactional database. The web itself is highly transactional and MySQL meets that need well. It features ACID (atomic, consistent, isolated, durable) support, distributed transactions and server enforced referential integrity checks on transactions.</p>

<h4>10. RDBMS support for smaller businesses isn&#8217;t bad</h4>

<p>For small to medium sized businesses the reporting and analysis functionality is quite sufficient. It could use a lot of improvement but it works great for smaller applications. The same type of companies that benefit from cost savings are the same ones that won&#8217;t likely need complex analysis and in depth BI reporting offered in other databases. If you&#8217;re using it to run your company blog or a few shopping carts do you really need much more than MySQL offers? Probably not.</p>

<h3>When you&#8217;re ready to lose the training wheels</h3>

<p>Ok so if you&#8217;re a growing business or your blog gets huge you will probably want to shake MySQL at some point. There are many cases in which you don&#8217;t want to use it:</p>

<ul>
<li>If you have big data</li>
<li>Business Intelligence is more important than cost</li>
<li>You have a competent and highly technical staff</li>
<li>Data accuracy is extremely important</li>
<li>Your infrastructure is dependent on Microsoft or Java</li>
<li>You are a small business but have someone who can run PostGreSQL (chuckle)</li>
</ul>


<p>I have detailed the reasons you should consider MySQL for your solution, and why many people use it. If your objectives are to drop in an easy solution and save some money it&#8217;s great. But what about the exceptions? I&#8217;ll be writing an article about that soon, because there are plenty of reasons not to use it as well.</p>

<p>Personally I prefer <a href="http://www.postgresql.org/" rel="nofollow" target="_blank">PostGreSQL</a> over MySQL for a drop in replacement on Linux based systems. It&#8217;s far superior in many ways, and something you should consider if you&#8217;re able to. Personally if I were to start a new business or had a Linux based environment and was in the planning phase I would choose PostGreSQL from the start. But it&#8217;s not always the best option for most people.</p>

<h3>Conclusion</h3>

<p>I hope this helps shed some light on the fact that MySQL is ubiquitous and present for a reason. It&#8217;s not the best solution out there, but it&#8217;s the best solution for many people. As I said personally I prefer PostGreSQL or MS-SQL far above MySQL but I understand the reasoning behind choosing MySQL and I hope you&#8217;ll consider that too.</p>

<p>Should you use MySQL? The answer depends on what you&#8217;re using it for, and what your goals are. It&#8217;s not as simple as some are trying to make it.</p>

<p>I invite active discussion on this in the comments, as long as it doesn&#8217;t turn into a flamewar. Here are a couple other places where folks are discussing it:</p>

<p><a href="https://plus.google.com/u/0/110987122726818254657/posts/4VnWmmWGikH">Great thoughts from Kelvin Williams on the subject</a></p>

<p><a href="https://plus.google.com/u/0/+JeremyMorgan/posts/5SS9Ezmy7Vr">Google + discussion I posted</a></p>

<p><a href="http://news.ycombinator.com/item?id=5122299">Hacker News Discussion</a></p>

<p>It will be interesting to see what comes out of this latest discussion.</p>

<br />


<div class="subscribefooter">
<h4>Do you like articles like this?</h4>
<div class="rssbutton"></div>
I&#8217;m constantly hacking on stuff and writing about happenings in the programmer world. You can <a href="http://feeds.feedburner.com/jeremymorgan/NJwt"><strong>subscribe to my feed</strong></a> here, or you can <a href="http://www.feedblitz.com/f?sub=339769"><strong>get the programmer newsletter</strong> spam free!</a>
</div>



]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[My February blog challenge]]></title>
    <link href="http://www.jeremymorgan.com/blog/general/my-february-blog-challenge/"/>
    <updated>2013-01-26T21:21:00-08:00</updated>
    <id>http://www.jeremymorgan.com/blog/general/my-february-blog-challenge</id>
    <content type="html"><![CDATA[<p>I&#8217;m one of those people who has a million ideas a day. I&#8217;ve always been this way, and I believe it&#8217;s some form of adult ADD, but it&#8217;s gotten me through life pretty well. Today I had an idea to write a blog post every day for a month. Not an original idea by any means, but something I&#8217;ve never done before on any of my websites.</p>

<!-- more -->


<p></p>

<h3>What do I hope to achieve out of this?</h3>

<p>I don&#8217;t know exactly, but judging by how it&#8217;s gone for others, I should expect a few things should I succeed:</p>

<p><img class="right" src="http://images.jeremymorgan.com/jeremy-morgan-blog.png" title="Jeremy Morgans Programming Blog" ></p>

<ul>
<li>Improve my writing skills</li>
<li>Push myself outside of my comfort zone</li>
<li>Give myself new ideas to think about</li>
<li>Let fans of this site get to know me better</li>
<li>Win new fans with new content</li>
</ul>


<p>So if I&#8217;m able to succeed at this, I can expect at least some kind of change somewhere. I&#8217;ll have to push myself for ideas to write about and that might stir up my brain in a good way. I&#8217;ll probably annoy the heck out of people on my feed and newsletter list, I apologize in advance. But it could end up being better for everyone.</p>

<h3>What will I blog about?</h3>

<p>I&#8217;ll try to keep in the general subject matter areas of the website as I know that&#8217;s why people come here. It will be something that should fall within the major categories though I might stray a bit when I can&#8217;t come up with anything good to write with.</p>

<p>It will be geeky, artsy, or marketey stuff I&#8217;m sure.</p>

<p>Maybe I&#8217;ll blog about stuff like this awesome book I&#8217;m currently reading:</p>

<p><a href="http://www.amazon.com/gp/product/0553380958/ref=as_li_ss_tl?ie=UTF8&camp=1789&creative=390957&creativeASIN=0553380958&linkCode=as2&tag=webfootcentra-20"><img class="center" src="http://ecx.images-amazon.com/images/I/5192EnTxNQL._SL500_AA300_.jpg" title="&#34;Snow Crash&#34;" alt="&#34;Snow Crash&#34;"></a></p>

<p>The book <a href="http://www.amazon.com/gp/product/0553380958/ref=as_li_ss_tl?ie=UTF8&camp=1789&creative=390957&creativeASIN=0553380958&linkCode=as2&tag=webfootcentra-20">Snow Crash</a><img src="http://www.assoc-amazon.com/e/ir?t=webfootcentra-20&l=as2&o=1&a=0553380958" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> was recommended to me by a friend, and you might be surprised to learn I&#8217;ve avoided cyberpunk stuff most of my life, but am really enjoying this. Do you care? Probably not but I&#8217;ll still talk about it anyway.</p>

<p>Earlier last year I said I was going to start adding more content and exploring new stuff on the site, as well as making it mobile friendly. That turned out really, really well. I had to upgrade my hosting to handle the extra traffic and meeting lots of new people so I hope this experiment has a positive outcome as well.</p>

<h3>Conclusion</h3>

<p>So in a few days I&#8217;ll start blowing up the site with daily posts. Some may be a paragraph, some a novel. I&#8217;ll likely share some insights or something useful so stay tuned. Maybe in the comments you can place your bet for how long it will be until I break the streak. I won&#8217;t mind.</p>
]]></content>
  </entry>
  
</feed>
