<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

 <title>Mind Junk</title>
 <link href="http://www.mindjunk.org/atom.xml" rel="self"/>
 <link href="http://www.mindjunk.org/"/>
 <updated>2013-09-13T04:06:09+00:00</updated>
 <id>http://www.mindjunk.org</id>
 <author>
   <name>Stephen Solka</name>
 </author>

 
 <entry>
   <title>Why Care About Vagrant</title>
   <link href="http://www.mindjunk.org/blog/2013/09/12/vagrant/"/>
   <updated>2013-09-12T10:59:00+00:00</updated>
   <id>http://www.mindjunk.org/blog/2013/09/12/vagrant</id>
   <content type="html">&lt;p&gt;I have become a big fan of &lt;a href=&quot;http://www.vagrantup.com/&quot;&gt;Vagrant&lt;/a&gt; and &lt;a href=&quot;http://puppetlabs.com/&quot;&gt;Puppet&lt;/a&gt;. They really change how you think about application development. If you are scratching your head about what these tools are here is a quick overview.&lt;/p&gt;

&lt;h1&gt;Vagrant&lt;/h1&gt;

&lt;p&gt;Vagrant is a tool that plugs into &lt;a href=&quot;https://www.virtualbox.org/&quot;&gt;VirtualBox&lt;/a&gt;* and with a simple configuration can create, suspend and destory machines. For instance the vagrant box that I am developing this blog on right now was created using a configuration that looks like this&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Vagrant.configure(&quot;2&quot;) do |config|

  config.vm.box = &quot;precise64&quot;

  config.vm.provision :puppet do |puppet|
    puppet.manifests_path = &quot;puppet/manifests&quot;
    puppet.module_path = &quot;puppet/modules&quot;
    puppet.manifest_file = &quot;init.pp&quot;
    puppet.options = &quot;--verbose --debug&quot;
  end
end
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Ignore the stuff about puppet because we are going to talk about that next. The &lt;code&gt;config.vm.box=&lt;/code&gt; line is saying that when I ask vagrant to create the machine for this project use Ubuntu 12.04. After the machine comes up it dynamically maps in the projects source code into a folder on that machine. This allows one to run linux commands in that directory on the guest machine vagrant created and it will affect the code on the host machine. I don&amp;rsquo;t even have to be on a Linux host machine for this to work. Vagrant can run on Windows and Mac OS X as well.&lt;/p&gt;

&lt;p&gt;*It plugs into various virtualization frameworks including both vmware and virtualbox. It even can build boxes on remote virtualization systems including aws, openstack and rackspace.&lt;/p&gt;

&lt;h1&gt;Puppet&lt;/h1&gt;

&lt;p&gt;By running &lt;code&gt;vagrant up&lt;/code&gt; you get an almost instant development box to play with. But to do anything interesting you are going to need a whole lot of packages and enviroment settings that are normally manually placed on the developers machine. This is where puppet come in. Using a declarative ruby based language you can state expectations on what this new machine must have for you to do your job. Vagrant kicks off puppet on the way up and by the time you are ready to ssh into the machine it is has everything you need to start your application.&lt;/p&gt;

&lt;p&gt;Here is the puppet manifest file for the vagrant machine this blog was built on:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;package{&quot;curl&quot;:
    ensure=&amp;gt;&quot;present&quot;
}
package{&quot;libxslt-dev&quot;:
    ensure=&amp;gt;&quot;present&quot;
}
package{&quot;libxml2-dev&quot;:
    ensure=&amp;gt;&quot;present&quot;
}

@exec { '/usr/bin/sudo apt-get update':
   tag =&amp;gt; update
}
Exec &amp;lt;| tag == update |&amp;gt; -&amp;gt; Package &amp;lt;| |&amp;gt;

exec { 'install-rvm':
  command =&amp;gt; &quot;/bin/su -l --command='/usr/bin/curl -L https://get.rvm.io | bash -s stable' vagrant&quot;,
  creates =&amp;gt; &quot;/home/vagrant/.rvm&quot;,
  require =&amp;gt; Package['curl']
}

exec {'install-ruby':
  command =&amp;gt;&quot;/bin/su -l --command='rvm install $(cat /vagrant/.ruby-version)' vagrant&quot;,
  require =&amp;gt; Exec['install-rvm']
}

exec {'bundle-install':
  command =&amp;gt;&quot;/bin/su -l --command='cd /vagrant;bundle install' vagrant&quot;,
  require =&amp;gt; Exec['install-ruby']
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The package directives are things that I need puppet to &lt;code&gt;apt-get install&lt;/code&gt;. Then we have a couple exec directives. These setup rvm, install the version of ruby I need and then bundle install the gems for my project. After puppet is done running I should be able to execute &lt;code&gt;jekyll build&lt;/code&gt; on my blog without any errors. This is a really simple case but hopefully you can see the utility.&lt;/p&gt;

&lt;p&gt;At work we have vagrant and puppet configurations that will spawn an ubuntu box, install mysql, rvm, phantomjs and ruby; configure all required users and directories; set up the machine to be able to capistrano deploy and finally start the application server and database. These are all things developers normally do on their host machines on their first day at a job. By installing vagrant and going to the break room for a cup of coffee a developer can have a &amp;ldquo;ready to code&amp;rdquo; development virtual machine by the time she gets back!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Why Git</title>
   <link href="http://www.mindjunk.org/blog/2011/09/10/why-git/"/>
   <updated>2011-09-10T08:57:00+00:00</updated>
   <id>http://www.mindjunk.org/blog/2011/09/10/why-git</id>
   <content type="html">&lt;p&gt;This post is meant to capture why we transitioned to Git from Subversion and what we learned along the way.&lt;/p&gt;

&lt;h2&gt;Code Reviews&lt;/h2&gt;

&lt;p&gt;The main reason I started to consider switching version control systems was we had a work flow issue that was causing members of our team to be non productive for days at a time. As a team we had instituted mandatory code reviews to try to maintain a high level of code quality. Our software was deployed into the pentagon network so it was important to know what was being built and how it was being built.&lt;/p&gt;

&lt;p&gt;The work flow with subversion was:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Tasking came into a senior developer.&lt;/li&gt;
&lt;li&gt;The senior developer assigns the task to a team member.&lt;/li&gt;
&lt;li&gt;Team member emails a patch with the requested changes.&lt;/li&gt;
&lt;li&gt;A senior developer reviews the patch.&lt;/li&gt;
&lt;li&gt;If accepted the team member commits his changes to Subversion.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;The sticking point was step 4 &amp;ldquo;A senior developer reviews the patch.&amp;rdquo; If the senior developer was busy with her own tasking or not in the office the team member could not continue to make changes for other tasks. This waiting period could last for hours to days. We tried to allow commits prior to review but we were finding that changes were slipping through the cracks unreviewed.&lt;/p&gt;

&lt;h2&gt;Distributed Version Control&lt;/h2&gt;

&lt;p&gt;Git separates the concept of committing changes and sharing those changes with a remote repository. Committing is a local action that adds your changeset to your complete clone of the remote repository. When you are ready to share one or more commits you execute a push.&lt;/p&gt;

&lt;p&gt;Because commits were local actions it allowed team members to commit changes prior to a code review and to continue there work even in the absence of a senior developer. As time permitted, patches would be reviewed and the team members would then be permitted to push changes to the remote repository.&lt;/p&gt;

&lt;p&gt;Local commits fixed a very specific work flow issue we were having with code reviews and improved the productivity of our team.&lt;/p&gt;

&lt;h2&gt;Initial Commit&lt;/h2&gt;

&lt;p&gt;When a new project was created a developer would would work on that project till it got to a point where it was ready to be put in Subversion. At that point she would create a new folder in Subversion, checkout that folder, add all her local files to the fresh checkout and commit her changes to the remote repository.&lt;/p&gt;

&lt;p&gt;The result of this was every project had this mystery commit with the message of &amp;ldquo;initial commit.&amp;rdquo; There would be no information how it got to that state, it just was.&lt;/p&gt;

&lt;p&gt;By executing a git init command, you can turn any folder in your filesystem into a Git repository. This project will be unattached from any remote repository ready for  you to begin making local commits. At the time you are ready to share your project with the team you can create a remote git repository, attach your local git repository to the remote repository and push all your commits to the remote repository.&lt;/p&gt;

&lt;p&gt;Being able to instantly create a repository in any folder greatly minimized the amount of history lost from the &amp;ldquo;initial commit.&amp;rdquo;&lt;/p&gt;

&lt;h2&gt;Missing Files&lt;/h2&gt;

&lt;p&gt;Ever forget to commit a file that is part of a change? This leads to those awkward commits in Subversion with a message like &amp;ldquo;Oops forgot to commit Xyz.java.&amp;rdquo; In Git local commits that have not been pushed to a remote repository can be modified without consequences. If you forgot a file amend your previous commit prior to pushing your changes to a remote repository.&lt;/p&gt;

&lt;h2&gt;Pitfalls&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Most developers do not know Git; staff will require training. I highly recommend the book &lt;a href=&quot;http://progit.org/book/&quot;&gt;Pro Git&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Window&amp;rsquo;s support is not as strong as Subversion but it is improving every day. &lt;a href=&quot;https://code.google.com/p/msysgit/&quot;&gt;Msysgit&lt;/a&gt; and &lt;a href=&quot;https://code.google.com/p/tortoisegit/&quot;&gt;TortoiseGit&lt;/a&gt; are the definitive windows clients.&lt;/li&gt;
&lt;li&gt;It is overly complex to get a Windows git server running. I recommend sticking with Linux for the server. Its a difference between minutes to setup to hours or days.&lt;/li&gt;
&lt;li&gt;Sometimes a developer will forget to push changes prior to deployment day; this is a training issue. Check the logs prior to deployment to verify expected changes.&lt;/li&gt;
&lt;li&gt;By default git allows developers to rewrite history and modify changes on the server if they execute push with a force option. This can be turned off with a &lt;a href=&quot;http://stackoverflow.com/questions/1754491/is-there-a-way-to-configure-git-repository-to-reject-git-push-force&quot;&gt;configuration change&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;There are sometimes more than one way to do things in Git. If this is the case then there isn&amp;rsquo;t a universally agreed upon way. I recommend picking a work flow and sticking with it. This is especially bad with rebase vs merge.&lt;/li&gt;
&lt;/ul&gt;

</content>
 </entry>
 
 <entry>
   <title>Markdown to PDF</title>
   <link href="http://www.mindjunk.org/blog/2011/08/13/markdown-to-pdf/"/>
   <updated>2011-08-13T19:46:00+00:00</updated>
   <id>http://www.mindjunk.org/blog/2011/08/13/markdown-to-pdf</id>
   <content type="html">&lt;p&gt;I wrote a Gradle script to convert a markdown file to a PDF. Despite being 38
lines it was quite a little challenge to discover which libraries needed to be
strung together and how to use them. Hopefully this can help someone in the
future.&lt;/p&gt;

&lt;script src='https://gist.github.com/1144384.js?file='&gt;&lt;/script&gt;


&lt;div&gt;&lt;noscript&gt;&lt;pre&gt;&lt;code&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/noscript&gt;&lt;/div&gt;

</content>
 </entry>
 
 <entry>
   <title>Kinect Is Amazing</title>
   <link href="http://www.mindjunk.org/blog/2011/08/12/kinect-is-amazing/"/>
   <updated>2011-08-12T10:59:00+00:00</updated>
   <id>http://www.mindjunk.org/blog/2011/08/12/kinect-is-amazing</id>
   <content type="html">&lt;p&gt;This demo out of siggraph is stunning. They use the kinect to create 3D models of entire rooms.&lt;/p&gt;

&lt;iframe width=&quot;560&quot; height=&quot;349&quot; src=&quot;http://www.youtube.com/embed/RSh8Voanp3c&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;

</content>
 </entry>
 
 <entry>
   <title>Domain Moved</title>
   <link href="http://www.mindjunk.org/blog/2011/08/11/domain-moved/"/>
   <updated>2011-08-11T13:17:00+00:00</updated>
   <id>http://www.mindjunk.org/blog/2011/08/11/domain-moved</id>
   <content type="html">&lt;p&gt;&lt;img class=&quot;left&quot; src=&quot;http://i.imgur.com/2Pagc.png&quot;&gt;
I love new toys. I decided to move my domain from pointing at blogger to pointing at github pages.
So, that means mindjunk.org has gone from wordpress on dreamhost to vpslink to blogger to
&lt;a href=&quot;http://pages.github.com/&quot;&gt;github pages&lt;/a&gt; powered by &lt;a href=&quot;http://octopress.org&quot;&gt;octopress&lt;/a&gt;. I decided not to try to bring over my old content
from blogger.&lt;/p&gt;

&lt;p&gt;I am playing alot with Amazon EC2. I spawned up a micro instance thats operating out of the free tier
to act as my private git server. Took about 20 minutes from account creation to cloning a project.
I work with git servers alot at work so it may take you longer to get going. The basic steps are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;sign up for a amazon web services account&lt;/li&gt;
&lt;li&gt;create a new micro instance. Defaults are fine. (Make sure its the one with the star)&lt;/li&gt;
&lt;li&gt;login using your new ssh key&lt;/li&gt;
&lt;li&gt;sudo yum update&lt;/li&gt;
&lt;li&gt;sudo yum install git&lt;/li&gt;
&lt;li&gt;sudo adduser git&lt;/li&gt;
&lt;li&gt;sudo su -l git&lt;/li&gt;
&lt;li&gt;mkdir ~/.ssh&lt;/li&gt;
&lt;li&gt;touch ~/.ssh/authorized_keys&lt;/li&gt;
&lt;li&gt;chmod 500 ~/.ssh&lt;/li&gt;
&lt;li&gt;chmod 500 ~/.ssh/authorized_keys&lt;/li&gt;
&lt;li&gt;add your public key to authorized_keys&lt;/li&gt;
&lt;li&gt;mkdir ~/repos&lt;/li&gt;
&lt;li&gt;git init &amp;ndash;bare ~/repos/test.git&lt;/li&gt;
&lt;/ol&gt;

</content>
 </entry>
 
 <entry>
   <title>Octopress Setup</title>
   <link href="http://www.mindjunk.org/blog/2011/08/02/octopress-setup/"/>
   <updated>2011-08-02T11:40:00+00:00</updated>
   <id>http://www.mindjunk.org/blog/2011/08/02/octopress-setup</id>
   <content type="html">&lt;p&gt;As you can see I got &lt;a href=&quot;http://octopress.org/&quot;&gt;Octopress&lt;/a&gt; working! Tried to do it twice so I could capture the steps.
This is by no means a definitive guide but this is exactly the order of commands I ran. I am
sure some steps could be removed or reordered. Enjoy!&lt;/p&gt;

&lt;script src='https://gist.github.com/1120457.js?file='&gt;&lt;/script&gt;


&lt;div&gt;&lt;noscript&gt;&lt;pre&gt;&lt;code&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/noscript&gt;&lt;/div&gt;

</content>
 </entry>
 

</feed>
