Night[9]2012-09-16T01:59:00-07:00http://chrislundquist.github.comChris LundquistChrisMLundquist@gmail.comSetting up SSH to a Windows 7 virtual box2012-09-16T00:00:00-07:00hhttp://chrislundquist.github.com/2012/09/16/SSH-Windows-7-Virtual-Box<p>I Learned these first steps from the most reliable source ever. For a step by step video. http://www.youtube.com/watch?v=HoSebbqBQQo</p>
<p>I found another guide while writing this that explains the second part http://www.howtogeek.com/howto/41560/how-to-get-ssh-command-line-access-to-windows-7-using-cygwin/</p>
<h1 id='making_the_box'>Making The Box</h1>
<ul>
<li>Download VirtualBox ( https://www.virtualbox.org/wiki/Downloads )</li>
<li>Get an ISO of Windows 7 ( http://www.youtube.com/watch?v=HoSebbqBQQo )</li>
<li>In VirtualBox create a new machine after the Windows 7 Template.</li>
<li>Use ICH9 and Enable IO APIC, Otherwise the box segfaults on boot.</li>
<li>Mount the Windows 7 ISO as an IDE DVD drive. It will not detect it as SATA</li>
<li>Install windows 7</li>
</ul>
<h1 id='getting_ssh_working'>Getting SSH Working</h1>
<ul>
<li>Download Cygwin ( http://cygwin.com/install.html )</li>
<li>Install OpenSSH via Cygwin</li>
<li>Run ssh-host-configas Adminstrator. This will make a new user account to run SSHd as a windows service.</li>
</ul>
<h1 id='getting_msvc_working'>Getting MSVC working</h1>
<ul>
<li>Download and install Visual Studio 2010</li>
<li>Source this shell script in your cygwin .bashrc https://gist.github.com/3717601</li>
</ul>
<p>Success</p>an outside perspective on razor2012-07-05T00:00:00-07:00hhttp://chrislundquist.github.com/2012/07/05/an-outside-perspective-on-razor<h2 id='caveat'>Caveat</h2>
<p>I have only spent a week going through this, so I am by no means an expert. Much of this I am piecing together and making educated guesses. If you have corrections, please let me know as I would love to improve my understanding.</p>
<p>Also note that Razor is a fast moving project and this will be quickly outdated. Think of it as alpha review. I can only hope all my gripes are untrue in six months.</p>
<h2 id='overview'>Overview</h2>
<a href='https://github.com/puppetlabs/Razor'> Project Razor </a>
<p>is a piece of software that aims to simplify bare metal server deployments to bring them up to speed with various virtual server platforms.</p>
<h2 id='who_is_writing_razor'>Who Is Writing Razor</h2>
<p>First let me start out saying that people working on razor are really great. They have spent a lot of time working on the project and solving issues. They certainly are responsive and even help when it <a href='https://github.com/puppetlabs/Razor/issues/95'> isn't even their problem</a> I only wish <a href='https://github.com/benburkert/razor-vagrant-demo/pull/5'>other projects were as responsive</a> As I understand it EMC and PuppetLabs are the key companies pushing Razor forward</p>
<h2 id='what_razor_does'>What Razor Does</h2>
<p>Razor is aimed to take bare metal and load it up with an operating system. It does this based on “tags” it generated from rules run over <a href='http://projects.puppetlabs.com/projects/facter'>facter</a> data After that, razor says it will hand off to a “broker”, provisioning tool, such as Puppet or Chef. Currently it only supports Puppet as the project stems from PuppetLabs The internals are pretty complex, and we will take a look at them in a moment.</p>
<h2 id='why_write_razor'>Why Write Razor</h2>
<p>If you have ever loaded 20 machines remotely, you know the pain. It really doesn’t scale. Even if you are using anaconda, PXE, and all that. Often you will have to KVM a machine to load it up. This just won’t work anymore.</p>
<h2 id='how_razor_works'>How Razor Works</h2>
<p>Razor is split up into several pieces called <a href='https://github.com/puppetlabs/Razor/wiki'> slices </a>. Razor’s key slices at the moment are: image, model, policy, node, and broker.</p>
<p>Using these slices it wraps a PXE boot environment with a state machine keyed of mac addresses.</p>
<p>When a node, server, is brought up and receives a DHCP offer from Razor, Razor will set the next address to Razor’s tftp server that will load <a href='https://github.com/puppetlabs/Razor/downloads'> microkernel </a> on to the node / server. This will cause the server to run facter and submit output to Razor, which razor will then register this node and apply any tags. These tags usually show memory, cpu core count, network card count, virtual machine type or hardware vendor. I believe you can even make your own rules to generate tags.</p>
<h3 id='image'><em>Image</em></h3>
<p>Razor basically keeps an unpacked ISO of whatever distribution(s) you are installing. Currently Razor likes to be in the middle of this, and (in my personal experience) dislikes net booting from remote resources. This is because doing so can easily break Razor’s callback chain.</p>
<p>In short, an image is an unpacked ISO, given a UUID and some descriptions.</p>
<h3 id='model'><em>Model</em></h3>
<p>A model is a shim as far as I can tell that provides a little more metadata on how to deploy an image. For instance is it virtual or physical, and things like that.</p>
<h3 id='policy'><em>Policy</em></h3>
<p>A policy is how Razor assigns a model to a node from tags. Basically you will say, “If a node has these tag(s) x,y,z, then use this model”, Currently I believe it is first match wins.</p>
<h3 id='node'><em>Node</em></h3>
<p>This is where the state of the server is kept. This will let Razor keep track of if the server. Keyed off mac address, this lets razor know if the host needs to be loaded, and what properties it has.</p>
<h3 id='broker'><em>Broker</em></h3>
<p>A Broker is something that razor can hand off to like Chef or Puppet. Currently only Puppet is supported.</p>
<h2 id='why_razor_doesnt_work_for_me'>Why Razor Doesn’t Work For Me</h2>
<p>For my use case at <a href='Bluebox.net'>Bluebox. </a> Razor just don’t feel like the right tool. It seems like it is trying to solve too many problems that Razor should delegate. Having a complete repository for every OS you might install is hard. Keeping a duplicate of it for Razor, since you might have custom packages in your own, is extra work. Maybe you can add your customized repositories later, but it is still one more bit of duplication.</p>
<p>Razor naturally is very Puppet centric. I have no problem with Puppet, I just learned Chef first. This was a great opportunity to learn a bit, and puppet has a few attractive features which I will explore. The promise of chef support feels tacked on at the moment.</p>
<p>Razor also feels like it is scratching an itch I just don’t have. It has lots of support for the VMware universe that I know almost nothing about. Things like LXC, and XEN have planned support, but Razor doesn’t seem like it is there yet.</p>
<p>Some of these things feel like they go against “Occom’s Razor” as was the <a href='http://nickapedia.com/2012/05/21/lex-parsimoniae-cloud-provisioning-with-a-razor/'> stated inspiration </a> for the name.</p>
<p>If your goal is “to be like AWS, but with dedicated hardware”, then these things are needed. Our goal was a little less ambitious. “To load hardware, automatically, and intelligently”. This just means we have to bring them up to an SSHable state.</p>everything you need to know to migrate from ree 1.8.7 to 1.9.32012-06-25T00:00:00-07:00hhttp://chrislundquist.github.com/Ruby On Rails/2012/06/25/everything-you-need-to-know-to-migrate-from-ree-187-to-193<h1 id='too_long_didnt_read'>Too Long Didn’t Read</h1>
<p>Most of your time will be spent updating gems to 1.9 versions then going through and replacing things like String#each with String#each_line</p>
<ul>
<li>YAML use YAML::ENGINE.yamler = ‘syck’</li>
<li>Use stdlib where possible</li>
<li>Time#parse</li>
<li>UTF-8 encode everything</li>
<li>next instead of return is syntax error now instead of Segfault</li>
<li>Rspec tests ending in Group</li>
<li>Nil, True, False classes are frozen, can’t dup them</li>
<li>“when :”, kill it</li>
<li>Rails 2.3.14 gotchya with 1.9.3 loading helpers</li>
<li>Range#include? -> Range#cover?</li>
<li>String#each -> String#each_line</li>
<li>Enumerable#choice -> Enumerable#sample</li>
</ul>
<h2 id='marshalling_params_or_bigdecimal_with_yaml'>Marshalling params or BigDecimal with YAML</h2>
<p>One of the more difficult things to track down was a bug in marshalling using the default serializer, yaml, and its default yamler.</p>
<p>The problem was that whenever you tried to to_yaml or Marshall#dump you got a big nasty error saying something like</p>
<p>“example of BigDecimal wrong number arugments 2 for 0”</p>
<p>Here was the fix I implemented in config/boot.rb <pre>
# FIXME remove the below hack when we at rails 3
# http://answerpot.com/showthread.php?2494452-Error+With+BigDecimal+To_yaml
# http://stackoverflow.com/questions/6530412/cant-define-singleton-method-encode-with-for-bigdecimal
if RUBY_VERSION.to_f == 1.9
require 'yaml'
YAML::ENGINE.yamler = 'syck'
# Set up gems listed in the Gemfile.
gemfile = File.expand_path('../../Gemfile', __FILE__)
end
</pre></p>
<h2 id='let_dead_gems_die_use_stdlib'>Let Dead Gems Die, Use Stdlib</h2>
<p>We were using several gems that were old and designed for 1.8.x For the most part the fixes were going through and removing colons after when statements or adding the <a href='www.example.com'> magic UTF-8 encoding tag</a>. However, one particularly nasty thing was the <a href='www.example.com'> ruby-aes-optimized</a>. It broke in 1.9.x because “string<span>n</span>” now returned a character “A” instead of the ascii value 65. It was also basically some C example implementation that was regexped into ruby. As such we found out later that it didn’t quite agree with how OpenSSL did things. After talking about it briefly, we looked at <a href='www.example.com'> ruby-fast-aes </a>, but saw that it only did weak encryption. We figured the best way to get this done would be to write ruby bindings to OpenSSL’s implementation. Coincidentally, someone had done just that in the <a href='www.example.com'> Stdlib </a>.</p>
<h2 id='time'>Time…</h2>
<p>In short… https://gist.github.com/873699</p>
<h2 id='systemtimer_its_dead_jim'>SystemTimer, It’s Dead Jim</h2>
<p>Because of how 1.8.7 used <a href='www.example.com'>Green threads</a> you had to use a gem to gem real interrupts. In Ruby 1.9.x the theading model is changed so this is no longer required. You can now use <a href='www.example.com'> Timeout::timout(seconds) </a></p>
<h2 id='ruby_193_and_rails_2314_includes_all_the_helpers'>Ruby 1.9.3 and Rails 2.3.14 includes all the helpers!</h2>
<p>Another sticking point that almost made us stick with ruby 1.9.2 was that there is an issue with trying to load helpers for every controller when ApplicationController says helpers :all. I poked at it a few times but was focused on the 1.9.2 issues. Fortunately as soon as I was ready with 1.9.2 <a href='www.example.com'>Mr.Arko published just the fix</a></p>
<h2 id='next_instead_of_return_is_syntax_error_now_instead_of_segfault'>next instead of return is syntax error now instead of Segfault</h2>
<p>Sometimes when refactoring code I have forgotten to remove a next or left in a return. In ree-1.8.7 this would cause a segfault when you reached the line. Now fortunately it will be a syntax error.</p>
<h2 id='rspec_tests_ending_in_group'>Rspec Tests Ending in Group</h2>
<p>We had a UserGroup model, so naturally we had user_group_spec.rb. In 1.8.7 this worked just fine. However in 1.9.x it tried to run it as a shared_behavior and blew up with some rather unhelpful stack trace. I ended up needing to look at the rspec source. I renamed the spec from describe UserGroup to describe User and that fixed it. ( I felt dirty so I wrapped it in a context ).I might hunt for a better solution later.</p>
<h2 id='nil_true_false_classes_are_frozen'>Nil, True, False classes are frozen</h2>
<p>This will only effect tests for the most part when you try to mock out nil objects. The easy fix is to mock one level lower too. Or create the data in a before / let block depending on what the data is.</p>
<h2 id='method_changes'>Method changes</h2>
<p>Range dropped include? for some reason and moved it to covers? it is important not to cast it to an array. Especially with time objects. Otherwise it will do a linear search through a giant array. <em>This change is not backwards compatible, you will have to switch on Ruby 1.9 / Ruby 1.8 and use the correct behavior</em></p>
<p>String#each -> String#each_line. On the plus side this guy is backwards compatible. I would guess the change was made because of the principal of least surprise. One might think String#each would yield characters.</p>
<p>Enumerable#choice -> Enumerable#sample. Both are only decent names. It returns a random element from the collection. <em>This change is not backwards compatible, you will have to switch on Ruby 1.9 / Ruby 1.8 and use the correct behavior</em></p>Everything You Were Never Told About Billing Code2012-05-24T00:00:00-07:00hhttp://chrislundquist.github.com/Development/2012/05/24/everything-you-were-never-told-about-billing-code<p>Most of these may seem fairly self evident when written here, but they are often easy to overlook when in the middle of coding.</p>
<p>The most important things about billing code are:</p>
<ul>
<li>Results are reproducible and consistent</li>
<li>Precision over Accuracy</li>
<li>Invoices always have sub items.</li>
</ul>
<h3 id='consistency_is_key'>Consistency is key</h3>
<p>The most common issue I see is having the price of an object change at some point in the future, which in turn causes the amount of every invoice in the past to change with it. Sometimes this happens because of sales or promotions, but usually it goes unnoticed until there is an issue with the purchase, then a nightmare follows when records are misaligned. A wise coworker once told me a great secret to not piss people off. “Don’t fuck with people’s money”. Words worth their weight in gold so to speak.</p>
<h3 id='precision_over_accuracy'>Precision over Accuracy</h3>
<p>Precision means getting the same answer each time, even if it is not quite the right answer. People will not care how you choose to round tax and the like as long as it looks close enough. They will care when you tell them their bill is a slightly different number each time.</p>
<p>The greatest example I have of this is a particular bit of software known as masteringphysics.com . MasteringPhysics pretends to value precision by telling you to round using significant figures, and nagging you whenever you enter too many digits of precision. Invariably, as soon as you follow what they say the answer was supposed to be for the next question in the series, they give you the helpful, “Your answer was close, but not quite right, check your rounding” when you used their supplied answers opposed to your more exact answers.</p>
<p>At the other end of the spectrum I, having learned this lesson from masteringphysics.com, and with working with an invoice similar to a phone bill decided to add the length of each phone call using millisecond precision and round it at the end to get the most accurate answer. This however lead to problems when the customer decided we were adding a few seconds to their bill since the invoice only displayed length up to the second. So all the few extra milliseconds here and there were not shown on the invoice.</p>
<p>Worse yet, if you took any subset and added them you would get a different total than displayed on the invoice. Again due to using more precision than shown.</p>
<h3 id='invoices_always_have_sub_items'>Invoices Always Have Sub Items</h3>
<p>Your phone bill has records of each call. Your grocery bill has records of each item. I am unable to think of an invoice not in this format. More importantly they never have more than one layer of sub items. People don’t want to resolve dependency trees. They just want to know what they were billed for and what credits they got.</p>
<p>The only exception there might be to this rule is the medical industry as there were talks given at RailsConf 2012 by a company that specialized in medical billing. Given that people are willing to pay someone else to bill for their services. It must be really painful to do.</p>Let's Talk About Data Types2012-05-21T00:00:00-07:00hhttp://chrislundquist.github.com/Tutorial/2012/05/21/lets-talk-about-data<h1 id='data_types'>Data types</h1>
<p>let’s talk about data.</p>
<p>Most data is really boils down to just a few types. There are strings, integers, and floats for the most part. Strings are, well, a string of characters or letters naturally. Integers are whole numbers. Floats are decimal numbers.</p>
<h2 id='some_examples_of_strings'>Some examples of strings.</h2>
<ul>
<li>
<p>”” an empty string</p>
</li>
<li>
<p>”a” a simple string</p>
</li>
<li>
<p>“hello world” my favorite string</p>
</li>
<li>
<p>“\n\t\e\d” a string of special characters. newline, tab, escape, backspace</p>
</li>
</ul>
<h2 id='some_examples_of_integers'>Some examples of integers</h2>
<ul>
<li>
<p>2 a positive whole number</p>
</li>
<li>
<p>0 zero</p>
</li>
<li>
<p>-5 a negative number</p>
</li>
</ul>
<h2 id='some_examples_of_floats'>Some examples of Floats</h2>
<ul>
<li>
<ol>
<li>123 some decimal</li>
</ol>
</li>
<li>
<ol>
<li>1415927 some of pi</li>
</ol>
</li>
<li>
<p>-1.0 a negative number that is equal to the integer -1</p>
</li>
</ul>
<h1 id='complex_data_types'>Complex Data Types</h1>
<p>Sometimes there is a certain type of data we use over and over again. Usually when this happens we make some standard for it. Some examples like this are Timestamps, Regexp, Arrays, Hashes</p>Railsconf 2012 Take Away (Day 3)2012-04-25T00:00:00-07:00hhttp://chrislundquist.github.com/Railsconf/2012/04/25/Railsconf-2012-Take-Away<h2 id='rails_the_next_five_years_by_yehuda_katz_from_tilde'>Rails: The Next Five Years by Yehuda Katz from Tilde</h2>
<p>The talk was focused on rails needs to go in a more JSON direction using serializers and presenters.</p>
<p>He exemplified a few techniques to make rails work cleanly with ember. He referenced Steven Klabnik’s talk.</p>
<p>He now has to convince people why rails is the right choice to do JSON heavy work.</p>
<h2 id='what_a_long_strange_trip_it_has_been_by_ezra_zygmuntowicz'>What a long Strange Trip it has been by Ezra Zygmuntowicz.</h2>
<p>Ezra details his history of 10 years working with Rails and Engine Yard. He then announced his new startup and transition to 3d Printing. He hopes to improve the tool chain to work with 3d printers to make it way more awesome.</p>
<h2 id='lightning_talks'>Lightning Talks</h2>
<ul>
<li>
<p>One about working asynchronously to be more efficient, E.G. Github</p>
</li>
<li>
<p>One about the interview gem.</p>
</li>
<li>
<p>Ryan Bigg clarifying good practices for engines.</p>
</li>
<li>
<p>Yehuda detailing his project about binary gems.</p>
</li>
</ul>Railsconf 2012 Take Away (Day 2)2012-04-24T00:00:00-07:00hhttp://chrislundquist.github.com/Railsconf/2012/04/24/Railsconf-2012-Take-Away<h2 id='keynote_by_aaron_patterson'>Keynote by Aaron Patterson</h2>
<p>He said we fail at everything, explained why people are scared of change and “mature” programmers have gotten that way for a reason.A Said we need an interface for everything. Most specifically for Queues like Rabbit, Zero, Sidekick, etc.</p>
<h2 id='taming_the_kraken_by_nathen_harvey_from_customink'>Taming The Kraken by Nathen Harvey from CustomInk</h2>
<p>They used Vagrant and chef and wrote the contiki project we did for a year.</p>
<h2 id='sustainable_productivity_with_rails_by_xavier_shay_from_square'>Sustainable Productivity with Rails by Xavier Shay from Square</h2>
<p>He talked about what I understand hexagonal architecture to be. Things like having one point of external dependency. Using tools like his implementation of Cane and the like to find code smell via scripts and applications.</p>
<h2 id='lets_make_the_web_faster_by_ilya_grigorik_from_google'>Lets Make the Web Faster by Ilya Grigorik from Google</h2>
<p>Demoed tools in chrome to see what takes so long with websites.</p>
<p>The average web page takes 10 seconds to completely load.</p>
<p>The average web page loads 84 resources.</p>
<p>Talked about optimizing the rest of the stack, not just that one slow sql query.</p>Railsconf 2012 Take Away (Day 1)2012-04-23T00:00:00-07:00hhttp://chrislundquist.github.com/Railsconf/2012/04/23/Railsconf-2012-Take-Away<h2 id='dhh_keynote'>DHH keynote</h2>
<p>DDH warns us about thinking old and being risk adverse.</p>
<p>says fuck 18 times.</p>
<p>Humorous and enjoyable talk overall.</p>
<h2 id='designing_hypermedia_apis_by_steve_klabnik'>Designing HyperMedia APIs by Steve Klabnik</h2>
<p>Rails REST is not the same as the original white paper REST.</p>
<p>Use the JSON response to render the GUI.</p>
<p>Return links in your JSON</p>
<p>good talk overall. He plays starcraft 2 and watches Day 9</p>
<h2 id='practical_machine_learning_by_cantino_and_stout'>Practical Machine Learning by Cantino and Stout</h2>
<p>Overview of machine learning.</p>
<p>effective techniques overview.</p>
<p>You could see if people are happy or upset based on emoticons in twitter messages.</p>
<h2 id='rails_engines_by_andy_maleh_from_groupon'>Rails Engines by Andy Maleh from Groupon</h2>
<p>In one sentence, use inheritance techniques with engines as you would with models or what not.</p>
<p>Detailed concrete practice learnings.</p>
<p>Talk would have been better using the intro of Ryan Bigg</p>
<h2 id='roomba_on_rails_by_charles_abbot_tail_end'>Roomba on Rails by Charles Abbot (tail end)</h2>
<p>Played the emperor’s march via midi on the roomba.</p>
<h2 id='use_the_source_luke_with_data_sourcing_events_by_keith_gaddis'>Use the Source Luke with Data Sourcing Events by Keith Gaddis</h2>
<p>Basically he said make your database like Git and store the events that lead to the changes.</p>
<p>Easier said than done, but it lets you replay events.</p>
<p>NOTE your actions must be deterministic</p>
<p>(CL) This is how starcraft 2 does replays. a SQL database of events</p>Video Encoding Terminology2012-03-05T00:00:00-08:00hhttp://chrislundquist.github.com/Video Encoding/2012/03/05/video-encoding-terminology<p>MB - Macro Block, a group of pixels, often square usually between 16 x 16 and 4 x 4, some encoders allow 8 x 4 and the like.</p>Leveraging Frameworks: dependent => :destroy2012-03-05T00:00:00-08:00hhttp://chrislundquist.github.com/Rails Development/2012/03/05/leveraging-frameworks-dependent--destroy<p>Maybe you have some code like</p>
<pre><code>model Foo < ActiveRecord::Base
has_many :bars
before_destroy :clean_up_bars
def clean_up_bars
self.bars.destroy_all
end
end</code></pre>
<p>My main gripe with this, is that Rails provides an awesome way to clean up any thing that doesn’t make sense without a parent. Fortunately it is even super simple.</p>
<pre><code>model Foo < ActiveRecord::Base
has_many :bars
before_destroy :clean_up_bars, :dependent => :destroy
end</code></pre>
<p>This will make it so that when your Foo instance is destroyed, it will also destroy each of the bars that belong to that Foo instance.</p>March Challenge2012-03-01T00:00:00-08:00hhttp://chrislundquist.github.com/Challenges/2012/03/01/march-challenge<h2 id='big_ideas'>Big Ideas</h2>
<ol>
<li><strong>Create an Open source load balancing API</strong></li>
</ol>
<p>Basically a wrapper around HA proxy and your application that needs it.</p>
<ol>
<li><strong>Write a WebGL graphing library.</strong></li>
</ol>
<p>Seems like the barrier to use WebGL could be lower.</p>
<ol>
<li><strong>Write a binary gem building system.</strong></li>
</ol>
<p>In reference to Katz’s speech at Ruby on Ales.</p>Small steps2012-02-29T00:00:00-08:00hhttp://chrislundquist.github.com/Development/2012/02/29/small-steps<p><em>Premature optimization and extension can cause many more problems than gains.</em></p>
<p>It is often the case where we try to extend or improve things before that are complete. This usually leads to the manifestation of many bugs. The root cause of this is <em>taking too many or too large of steps at a time</em>.</p>
<p>One way to tell when this is happening, is when you start writing many different functions at a time, but aren’t able to finish any of them. My strategy here is to find the separation of concerns and establish the minimum amount of work I need to do to accomplish this step. The three C’s of computer science can be an excellent guide.</p>
<ul>
<li>
<p>Correctness</p>
</li>
<li>
<p>Having a ugly function that works correctly, is better than a shorter one that has bugs.</p>
</li>
<li>
<p>Completeness</p>
</li>
<li>
<p>If you don’t account for half of your cases, then it is an obvious bug.</p>
</li>
<li>
<p>Compactness</p>
</li>
<li>
<p>It is a fairly common saying, something isn’t done when there is nothing left to add. It is done when there is nothing left to take away.</p>
</li>
</ul>
<p>The order of these guidelines is very important. You first need to do something correctly before it is time to extend it all the way. Likewise, an empty function is very compact, but not complete.</p>Faking it2012-02-28T00:00:00-08:00hhttp://chrislundquist.github.com/Development/2012/02/28/faking-it<p><em>Faking it is the opposite of mastery. Faking it is learning (hopefully)</em></p>
<h3 id='what_it_is'>What it is</h3>
<p>Sometimes you find yourself learning a new framework, tool, or language. Usually the first while is spent reading, and trying to gain some clarity. Eventually you gain enough confidence to try to do your task, but expressing what you mean to the new tool can be difficult. Often you will <em>copy paste a similar section</em> to what you want, using it as a template. Then you substitute your needs into the template, along the way fixing the minor errors that crop of from this process. Always with a clear goal, and gaining a little insight each time.</p>
<p>Another common method is <em>to pattern after a familiar language</em>. This is usually a better strategy, because it means you have more confidence in what you are actually doing. For example, when I was learning Java, patterning things after C++ let me cover more ground quickly. Since the syntax is so close, this can be a valid strategy, and even indicates a higher level of mastery than that of copy pasting a template and having at it.</p>
<p><em>Faking is not a bad thing. It is a great way to dive in and start to learn</em>, it only becomes a problem when faking it becomes a crutch.</p>
<h3 id='how_to_tell_when_when_you_really_mean_it'>How to tell when when you really mean it</h3>
<p>Usually you can tell when you aren’t faking it when you stop copy pasting from examples or when you aren’t switching tabs constantly to copy someone else’s code. There will always be times when you need a reference by running a quick search. This is distinctly different from switching back and forth between tabs or copy pasting large swaths of code.</p>
<p>Most of all, mastery is apparent when you can <em>express your goal in a clear and succinct manor</em> to or in your given tool or language, without needing a reference.</p>Panic Fire. How to recognize it and keep your coworkers from going postal2012-02-27T00:00:00-08:00hhttp://chrislundquist.github.com/Development/2012/02/27/panic-fire-how-to-recognize-it-and-keep-your-coworkers-from-going-postal<p>So maybe you have found yourself or seen someone else in a situation like this.</p>
<p>You are working on a project, without the time to get to know all the pieces. You are almost finished, there are just a few lines of code standing between you and getting lunch. There is just this one error you are stuck with. You try changing the problem line and get a wildly different error. Quickly, you change it again, to get another new error. You modify a few lines above with haste, hoping to stop the issue below, but that instead breaks in yet another new and interesting way.</p>
<p>This cycle continues, ever so slowly bringing you closer to your goal. Finally, after repeatedly and hastily running back in forth reactively pushing lines of code “back in place”. You have completed the goal. You pause for a moment and look back over your code, not quite sure why half of it is there. You just remember it fixed some error that cropped up from this other error over there… Actually you only have a vague idea how you accomplished this task. All you know is that it works now, some how.</p>
<p><em>This is panic fire</em></p>
<p>Next time you see yourself or someone you know in this situation here are some suggestions to help them break the cycle.</p>
<ul>
<li>Ask what they are trying to accomplish.</li>
</ul>
<p>If they can’t say what they are trying to do in 20 words or less, they need to take smaller steps.</p>
<ul>
<li>Ask how they are going to accomplish the goal.</li>
</ul>
<p>If they don’t have a game plan in English, then it is really hard to express that plan in code. Even in a language as poetic as Ruby.</p>
<ul>
<li>Ask why making a change will bring them closer to their goal</li>
</ul>
<p>If they don’t know why they are doing something, it is time to get a reality check</p>
<p>To summarize, ask:</p>
<p><em>What are they doing</em></p>
<p><em>How they are going to do it</em></p>
<p><em>Why it will work</em></p>