<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Bacon and Tech &#187; Programming</title>
	<atom:link href="http://www.baconandtech.com/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.baconandtech.com</link>
	<description>Because everything's better with bacon</description>
	<lastBuildDate>Wed, 28 Jul 2010 23:08:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>pdx.pm code sprint #1</title>
		<link>http://www.baconandtech.com/2009/07/02/pdxpm-code-sprint-1/</link>
		<comments>http://www.baconandtech.com/2009/07/02/pdxpm-code-sprint-1/#comments</comments>
		<pubDate>Fri, 03 Jul 2009 05:38:35 +0000</pubDate>
		<dc:creator>gabrielle</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[beer]]></category>
		<category><![CDATA[community]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[perl mongers]]></category>

		<guid isPermaLink="false">http://www.baconandtech.com/?p=70</guid>
		<description><![CDATA[Hacking on 5.10.1 was the plan&#8230;that happened for a couple of us.  
Duke proposed a PDX.pm sprint to work on 5.10.1:
&#8220;I think if everyone learns how to
a) get a copy of the perl git repo
b) keep it in sync
c) run the perl test suite, including running a single test at a time
d) submit a [...]]]></description>
			<content:encoded><![CDATA[<p>Hacking on 5.10.1 was the plan&#8230;that happened for a couple of us. <img src='http://www.baconandtech.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://twitter.com/dukeleto">Duke</a> proposed a <a href="http://pdx.pm.org">PDX.pm</a> sprint to work on 5.10.1:<br />
&#8220;I think if everyone learns how to</p>
<p>a) get a copy of the perl git repo<br />
b) keep it in sync<br />
c) run the perl test suite, including running a single test at a time<br />
d) submit a small documentation patch</p>
<p>then we will have a great start.&#8221;</p>
<p>This is perfect for a first sprint: &#8220;<a href="http://opensourcebridge.org/2009/wiki/Effective_code_sprinting">small, solve-able tasks</a>&#8221; that will get everyone up &#038; running, plus have the potential to actually be productive. </p>
<p>Your first code sprint with a new group of people is like the first day on the job&#8230;except nobody realizes that we&#8217;re each FNGs*.  It can take some time to figure out how to work together.</p>
<p>It&#8217;s really great if people get the stuff that&#8217;s going to take time from the code sprint out of the way beforehand.  For example, cloning the perl5 git repo (step a):</p>
<p>:::=>git clone git://perl5.git.perl.org/perl.git</p>
<p>(Took me 13 minutes.)</p>
<p>Duke suggested some advance reading as well &#8211; how to use the repo (cd perl; perldoc pod/perlrepository.pod) (you will need to install perl-doc if you don&#8217;t have it;  it was not installed on ubuntu.)<br />
<span id="more-70"></span><br />
&#8211;</p>
<p>At the sprint:  I don&#8217;t have the necessary experience with git yet, so most of my time was spent learning that, specifically in regards to task b) Keeping your repo in sync.</p>
<p><code>git branch</code><br />
shows me that I am on the blead branch</p>
<p><code>git remote show</code><br />
just an interface into .git/config</p>
<p><code>git pull</code><br />
convenient combination of fetch (from remote) + merge (into local stuff)</p>
<p><code>git pull origin</code><br />
&#8230;by default pulls your current branch.<br />
<code>git pull</code><br />
&#8230;would have done the same thing (depending on your .git/config!)</p>
<p>The blead branch is NOT what perl 5.10.1 is going to be released from, so that&#8217;s not what we&#8217;re going to work with.</p>
<p>Side trip:<br />
Duke has an excellent graphic that he &#038; <a href="http://twitter.com/jhelwig">jhelwig</a> created that illustrates git as applied to the perl development process**.  (I think I convinced them to put it into an actual graphics program &#038; make it available&#8230;)  One of the tips I got from the diagram was that tags are immutable.  They should not move.  If they move, UR DOIN IT WRONG.</p>
<p>perldelta.pod &#8211; manually-maintained (!!!) filed that lists the changes in all versions of Perl.</p>
<p>OK back to work:<br />
How to check out maint 5.10:  (remember, blead is beyond 5.10 &#038; has changes we don&#8217;t need to be concerned with.)</p>
<p><code>git checkout -b</code><br />
&#8230;is a combination of checkout and branch</p>
<p><code>git branch -a</code><br />
&#8230;shows me all the branches I have locally.</p>
<p>I want to create a *local* tracking branch for 5.10 maint.</p>
<p>git branch [whatever I want to call it] [branch I want (or anything that can uniquely id a commit!)]<br />
eg:<br />
<code>git branch maint-5.10 origin/maint-5.10</code></p>
<p>Tip:<br />
<code>git config --global color.ui auto</code><br />
- git branch -a &#8211; local branch is white, currently checked-out is green, remotes are red.</p>
<p>THEN I need to actually check out the local tracking branch (ie switch to it)<br />
git checkout [name I gave it]<br />
eg:<br />
<code>git checkout maint-5.10</code></p>
<p>git checkout -b maint-5.10 origin/maint-5.10 is a shortcut for the above two steps.</p>
<p>&#8211;<br />
c) run the perl test suite, including running a single test at a time</p>
<p>For reference:<br />
:<code>::--> uname -a<br />
Linux princess 2.6.28-13-generic #45-Ubuntu SMP Tue Jun 30 19:49:51 UTC 2009 i686 GNU/Linux</code></p>
<p>First, you have to build (opts from <a href="http://twitter.com/schwern">Schwern</a>, modified)<br />
<code>sh Configure -Ode \<br />
 -DDEBUGGING \<br />
 -Dprefix=/usr/local/perl/maint-5.10 \<br />
 -Dusedevel \<br />
 -Duseithreads \<br />
 -Dccflags='-I/usr/local/include -I/opt/local/include -I/sw/include' -Dldflags='-L/usr/local/lib -L/opt/local/lib -L/sw/lib' \<br />
 -Dlibpth='/usr/local/lib /opt/local/lib /sw/lib /usr/lib' \<br />
 -Uversiononly \<br />
 -Uinstallusrbinperl $@</code></p>
<p>- DEBUGGING builds the debugging symbols<br />
- usedevel is required or configure will BITCHBITCHBITCH.<br />
- useithreads enables one interpreter thread to do something I hope I don&#8217;t ever have to deal with.  Or something.</p>
<p>Then:<br />
<code>TEST_JOBS=9; export TEST_JOBS #parallelizes your tests<br />
make test</code><br />
to compile perl and then run the tests.  This takes a while.  Grab a beer.  In fact, grab a pitcher.  Pay attention though, because a failing test here might be something interesting to patch.</p>
<p>make test TEST_FILES=[file] to run a single test.<br />
e.g.:<br />
<code>make test TEST_FILES=t/pod/podselect.t</code><br />
This turned out to be unreliable because it&#8217;s running through all the dependencies first.  Bleah.</p>
<p>This is a better method:<br />
<code>cd t; ./perl TEST ./pod/podselect.t</code><br />
Although Duke had problems with the debugger tests.</p>
<p>Remember TEST tries to cd to ./t, so you need to give your path relative to that.<br />
(@Theory has more about this in <a href="http://justatheory.com /computers/programming/perl/build-5.10-from-git.trackback">his blog</a>.)<br />
(This is actually covered in perlhack, we just didn&#8217;t find it in time.)</p>
<p>&#8211;<br />
Another tip:<br />
get the name of your branch on your prompt.  You need __git_ps1.  Which is&#8230;somewhere halfway through the second pitcher.</p>
<p>Then add that var to your bash prompt whereever you&#8217;d like it:<br />
$(__git_ps1 &#8220;(%s) &#8220;)<br />
&#8230;the (%s ) is just my preferred formatting.  The whole thing looks like this:<br />
PS1=&#8217;\n\u@\h\w/\n$(__git_ps1 &#8220;(%s) &#8220;):::&#8211;> &#8216;</p>
<p>You can get some pretty colored output with this:</p>
<p>https://launchpad.net/~git-core/+archive/ppa</p>
<p>&#8211;<br />
<code>git shortlog:</code><br />
shows you the commit messages, grouped by author.  Useless if you&#8217;re looking for anything other than &#8220;a bunch of people did things.&#8221;</p>
<p><code>git shortlog -se:</code><br />
number of commits, grouped by unique author + email.</p>
<p><code>git log --pretty=oneline maint-5.10..blead</code><br />
&#8230;shows you the differences between two versions.  In the perl source, there may be duplicates (different commit ID for same commit.)</p>
<p>&#8211;<br />
Now let&#8217;s actually *do* something.<br />
<a href="http://rt.perl.org/rt3/Public/Search/Simple.html?Query=MemberOf=66092%20AND%20Status!=%27Resolved%27">Stuff that&#8217;s holding up perl5.10.1</a> (I think)<br />
Other stuff is in perltodo, but I&#8217;m not seeing anything that I&#8217;m actually up for given my skillset &#038; current BAC.</p>
<p>I need to look for a doc to patch.</p>
<p>&#8211;<br />
Annnnnd we decided to go to whiffies for pies. <img src='http://www.baconandtech.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>More later!  This is going to be a regular event.</p>
<p>&#8211;<br />
<small><br />
* F&#8217;ing New Guy.<br />
** Keep in mind that I am slightly more familiar with the Postgres release process &#038; was expecting something similar.<br />
</small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.baconandtech.com/2009/07/02/pdxpm-code-sprint-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>When I get a TUIT&#8230;</title>
		<link>http://www.baconandtech.com/2009/06/06/when-i-get-a-tuit/</link>
		<comments>http://www.baconandtech.com/2009/06/06/when-i-get-a-tuit/#comments</comments>
		<pubDate>Sat, 06 Jun 2009 23:52:13 +0000</pubDate>
		<dc:creator>gabrielle</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://www.baconandtech.com/?p=66</guid>
		<description><![CDATA[I use Perl&#8217;s split function a lot more than I use join.  Every time I use join I go through an iteration like this:
my @things = split(/-/, $value);
[do cool stuff to @things]
my $new_value	= join(/:/, @things);	#D'oh!  Should be join(':', @things);
I understand why (split can take a regexp, join must be on a specific value) [...]]]></description>
			<content:encoded><![CDATA[<p>I use Perl&#8217;s <a href="http://perldoc.perl.org/functions/split.html">split</a> function a lot more than I use <a href="http://perldoc.perl.org/functions/join.html">join</a>.  Every time I use join I go through an iteration like this:</p>
<p><code>my @things = split(/-/, $value);<br />
[do cool stuff to @things]<br />
my $new_value	= join(/:/, @things);	#D'oh!  Should be join(':', @things);</code></p>
<p>I understand <i>why</i> (split can take a regexp, join must be on a specific value) but that doesn&#8217;t mean it still doesn&#8217;t trip me up.  When I get time, I&#8217;ll write something that will let me put my arrays back together the same way I took them apart.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.baconandtech.com/2009/06/06/when-i-get-a-tuit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adventures in QA &amp; Testing, Part I.</title>
		<link>http://www.baconandtech.com/2009/06/01/adventures-in-qa-testing-part-i/</link>
		<comments>http://www.baconandtech.com/2009/06/01/adventures-in-qa-testing-part-i/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 05:01:40 +0000</pubDate>
		<dc:creator>gabrielle</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://www.baconandtech.com/?p=62</guid>
		<description><![CDATA[A couple of weeks ago at PDX.pm we had a Quality Assurance Tools panel discussion.  I was invited to be on the panel for the &#8220;beginning tester&#8221; perspective.
QA concepts are already familiar to me from my time as a microbiologist/immunologist with the FDA.  We had a QA division that evaluated us quarterly in [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of weeks ago at <a href="http://pdx.pm.org">PDX.pm</a> we had a Quality Assurance Tools panel discussion.  I was invited to be on the panel for the &#8220;<a href="http://twitter.com/gorthx/statuses/1390649064">beginning tester</a>&#8221; perspective.</p>
<p>QA concepts are already familiar to me from my time as a microbiologist/immunologist with the FDA.  We had a QA division that evaluated us quarterly in the following areas*:<br />
Safety:<br />
- appropriate gear (lab goats, goggles, gloves appropriate for what you&#8217;re handling)<br />
- OSHA regs (aisle spacing, fire extinguishers, etc)<br />
- drills (fire, acid spill, etc)</p>
<p>Keeping things neat:<br />
- do we have expired chemicals hanging around<br />
- are we keeping our documentation up-to-date and readable<br />
- record-keeping (temperature records for fridges &#038; incubators)</p>
<p>Calibration:<br />
- solution &#038; culture standardization<br />
- instrument calibration (making sure all the lasers point the right way!)</p>
<p>Here&#8217;s how I relate this to software testing:</p>
<p>Safety equipment:<br />
Backups &#038; version control.  If you have these, you can get yourself out of anything.  Remember to practice restoring your backups.</p>
<p>Keeping things neat:<br />
perltidy &#038; perlcritic are your friends.  (I still say perlcritic needs to have a drinking game that goes along with it.)  Keep your code &#038; documentation fresh.</p>
<p>Calibration:<br />
Testing.  Making sure that, given a certain input/environment, your code will produce certain output.  For a while I confused testing with error handling &#8211; but error handling only deals with a certain set of inputs/$ENV.  You want to include error handling in your testing &#8211; make sure that something that should throw an error actually does.</p>
<p>Once I got a grip on what I wanted to do, I had to figure out how to accomplish it.  Learning how to use the tools was the hard part.  Hard enough, in fact, that it took me a year of sporadic false starts before I actually did anything productive.  I&#8217;m not blessed with a separate QA team for my programming tasks;  I have to do it myself, but that is no excuse for having crappy code.  </p>
<p>My largest project is my own fork of <a href="http://www.sins.com.au/nmis">NMIS</a>, which has no existing tests.  (It may now, I forked it a while ago.)  I went for the low-hanging fruit &#038; started by testing a simple subroutine that altered text input:</p>
<p><code>my $ifName	= "Serial1/0/0.0";<br />
is (convertIfName($ifName),<br />
	'serial1-0-0-0',<br />
	'convertIfName should replace non-alphanumeric chars with hyphens and lowercase the whole schmear'<br />
);</code></p>
<p>Over the course of 3 days, I wrote something like 200 tests.(<B>eta</B> actually I think I mean assertions.  I&#8217;m still learning the lingo.)  These were all simple unit tests (basically, does this one little block of code do what it&#8217;s supposed to do).  I haven&#8217;t started yet with integration testing (does it play well with others).</p>
<p>The Payoff:<br />
- I gained a much better understanding of how my code works.  And found some interesting glitches &#8211; edge cases that (in theory, anyway) would never be executed in the existing production environment, but should probably be tested for anyway in case I decide I want to use them somewhere else.<br />
- I found a lot of unused code &#038; duplicated code, and places I could use now-standard Perl modules (like I said, my fork is old).<br />
- Best of all, I can change my code (at least the parts I have tests for) at will and not worry that I&#8217;m going to screw something else up.</p>
<p>Glitches I hit:<br />
- I already have been bitten in the ass by an edge case.<br />
- Haven&#8217;t experienced any time savings yet, due to the learning curve.<br />
- I&#8217;m about even with aggravation savings at this point &#8211; I am taking the next steps (mocking objects, getting ready to test an actual script^Wprogram instead of a module) and it&#8217;s like starting all over.</p>
<p>Places I&#8217;ve found answers to my burning testing questions:<br />
- <a href="http://perlmonks.org/">perlmonks archives</a><br />
- <a href="http://stackoverflow.com/">stackoverflow</a><br />
- <a href="http://perl-qa.hexten.net/wiki/index.php/Main_Page">Perl-QA wiki</a><br />
- my local .pm IRC</p>
<p>&#8212;</p>
<p>* artificial categories which made it easier to draw parallels with software testing;  thanks to Peter Eschright for the great idea from <a href="http://2009.barcampportland.com/notes/wx2">his talk</a> at the recent BarCamp Portland.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.baconandtech.com/2009/06/01/adventures-in-qa-testing-part-i/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Survey of Perl Modules I Can&#8217;t Live Without, Part II</title>
		<link>http://www.baconandtech.com/2009/05/28/survey-of-perl-modules-i-cant-live-without-part-ii/</link>
		<comments>http://www.baconandtech.com/2009/05/28/survey-of-perl-modules-i-cant-live-without-part-ii/#comments</comments>
		<pubDate>Fri, 29 May 2009 02:32:24 +0000</pubDate>
		<dc:creator>gabrielle</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://www.baconandtech.com/?p=61</guid>
		<description><![CDATA[Part I covered modules specific to the network management part of my job.  These are my favorite general-purpose modules.
1.  Viewing data structures:
Data::Dumper::Simple 
with:
$Data::Dumper::Indent = 1;  #JMO
I learned a lot about references using this module, too.
2.  Saving myself from the tyranny of Microsoft:
Spreadsheet::ParseExcel automates what would be a daily, very tedious task. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.baconandtech.com/2008/05/31/survey-of-perl-modules-i-cant-live-without/trackback/">Part I</a> covered modules specific to the network management part of my job.  These are my favorite general-purpose modules.</p>
<p>1.  Viewing data structures:<br />
<a href="http://search.cpan.org/~ovid/Data-Dumper-Simple-0.11/lib/Data/Dumper/Simple.pm">Data::Dumper::Simple </a><br />
with:<br />
$Data::Dumper::Indent = 1;  #JMO<br />
I learned a lot about references using this module, too.</p>
<p>2.  Saving myself from the tyranny of Microsoft:<br />
<a href="http://search.cpan.org/~jmcnamara/Spreadsheet-ParseExcel-0.49/lib/Spreadsheet/ParseExcel.pm">Spreadsheet::ParseExcel</a> automates what would be a daily, very tedious task.  (Don&#8217;t ask unless you are willing to buy me a beer in order to hear the story behind this.)</p>
<p>3.  Automating version control:<br />
<a href="http://search.cpan.org/~stephenca/Cvs-Simple-0.06/lib/Cvs/Simple.pm">CVS::Simple</a>, which I&#8217;m in the process of replacing with <a href="http://search.cpan.org/~hdp/Git-Wrapper-0.005/lib/Git/Wrapper.pm">Git::Wrapper</a>.  I&#8217;m learning git at the same time, so it&#8217;s quite a wild ride.</p>
<p>4.  I&#8217;m writing tests, try not to faint:<br />
<a href="http://search.cpan.org/~ovid/Test-Most-0.21/lib/Test/Most.pm">Test::Most</a> and <a href="http://search.cpan.org/~chromatic/Test-MockObject-1.09/lib/Test/MockObject.pm">Test::Mockobject</a> </p>
<p>5.  Enforcing coding standards:<br />
<a href="http://http://search.cpan.org/~elliotjs/Perl-Critic-1.098/lib/Perl/Critic.pm">Perl::Critic</a>  </p>
<p>6.  Having fun at my co-workers&#8217; expense:<br />
<a href="http://search.cpan.org/~mching/Lingua-Bork-0.03/Bork.pm">Lingua::Bork</a>. Pass the daily reports through this, and see who&#8217;s actually reading them.</p>
<p>7.  And of course, <a href="http://search.cpan.org/~timb/DBI-1.608/DBI.pm">DBI</a>.  Don&#8217;t leave home without it.</p>
<p>Update on some others I mentioned:</p>
<p><a href="http://search.cpan.org/~muir/Cisco-Reconfig-0.9/Reconfig.pod">Cisco::Reconfig</a> is <a href="http://www.baconandtech.com/2008/06/20/ciscoreconfig/trackback/.">still intriguing</a>.  I&#8217;ve encountered a couple of quirks and am trying to figure out if It&#8217;s Just Me &#8482; or they&#8217;re actual bugs.</p>
<p><a href="http://www.baconandtech.com/2008/05/31/survey-of-perl-modules-i-cant-live-without/trackback/">Last time</a> I worked with <a href="http://search.cpan.org/~oliver/Net-MAC-1.5/lib/Net/MAC.pm">Net::MAC</a> was v1.2, and I encountered what I thought might be a bug when iterating over an array of mac addresses.  I didn&#8217;t need it for any heavy lifting (just converting macs to cisco format), so instead of filing a bug report, I stuck with my hand-rolled solution.  The problem has been fixed in 1.5.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.baconandtech.com/2009/05/28/survey-of-perl-modules-i-cant-live-without-part-ii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Replicating cvs&#8217;s -I option in git.</title>
		<link>http://www.baconandtech.com/2009/05/22/replicating-cvss-i-option-in-git/</link>
		<comments>http://www.baconandtech.com/2009/05/22/replicating-cvss-i-option-in-git/#comments</comments>
		<pubDate>Sat, 23 May 2009 00:27:20 +0000</pubDate>
		<dc:creator>gabrielle</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://www.baconandtech.com/?p=60</guid>
		<description><![CDATA[I&#8217;m a fairly recent convert to git, and have been moving a bunch of my coding &#038; doc projects to it.  It&#8217;s been mostly seamless, but I had one kinda tricky piece left:  the daily commit (automated, of course) of any notable changes to my Cisco router &#038; switch configs.  The tricky [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m a fairly recent convert to git, and have been moving a bunch of my coding &#038; doc projects to it.  It&#8217;s been mostly seamless, but I had one kinda tricky piece left:  the daily commit (automated, of course) of any notable changes to my Cisco router &#038; switch configs.  The tricky part is handling certain lines in the configs that change each time, but aren&#8217;t necessarily of interest (for example, ntp clock-period), and I don&#8217;t want to kick off a commit if that&#8217;s all that&#8217;s changed.</p>
<p>cvs has this nifty -I cli option, similar to the -I option to gnu diff &#8211; it allows you to specify a regexp and the cvs diff will ignore all lines that match that regexp.</p>
<p>Here&#8217;s a sampling of what I had:<br />
<code>cvs diff \<br />
-I 'clock-period' \<br />
-I '#time' \<br />
-I 'set.spantree.port.*cost' \<br />
[filename]<br />
</code></p>
<p>(Note that you can&#8217;t have spaces in the regexp you pass to cvs.)</p>
<p>git doesn&#8217;t have a cli switch for this;  I was having a tough time figuring out how to make it use gnu diff.  <a href="http://code.google.com/p/msysgit/issues/detail?id=106">This</a> gave me the tip I needed.</p>
<p>So, here we go!</p>
<p>0. If you don&#8217;t have gnu diff on your machine, install it.  (I got mine from sunfreeware.com.)  You can just run diff without any args to see the options &#8211; if you&#8217;re missing &#8220;I&#8221;, you don&#8217;t have the right diff.</p>
<p>1. Set up a wrapper script that uses gnu diff:<br />
<code>:::-->cat /home/gabrielle/bin/ciscodiff.sh<br />
#!/usr/bin/bash<br />
#make git use gnu diff and ignore certain lines<br />
/path/to/gnu/diff \<br />
-I 'clock-period' \<br />
-I '#time' \<br />
-I 'set spantree port.*cost' \<br />
$2 $5 | cat</code></p>
<p>Notes:<br />
- I don&#8217;t need the . instead of the space, like I did in the cvs regexp &#8211; so this is a more restrictive match. (Which I like.)<br />
- $2 and $5 specify which of the parameters for git diff actually are passed through to this diff.  See  the &#8220;git Diffs&#8221; section of <a href="http://http://www.kernel.org/pub/software/scm/git/docs/git.html">the manual</a>.</p>
<p>Make sure to make this executable. <img src='http://www.baconandtech.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>2. Then, back in my git repo, I added the following to .git/config:<br />
<code>[diff "ciscoconf"]<br />
    command = /home/gabrielle/bin/ciscodiff.sh</code></p>
<p>3. Then I created .gitattributes, like so:<br />
<code>*-confg diff=ciscoconf</code></p>
<p>git will now use my special diff wrapper *only* on files with names that match the *-confg glob pattern.</p>
<p>Voila.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.baconandtech.com/2009/05/22/replicating-cvss-i-option-in-git/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fun with ctags</title>
		<link>http://www.baconandtech.com/2009/02/26/fun-with-ctags/</link>
		<comments>http://www.baconandtech.com/2009/02/26/fun-with-ctags/#comments</comments>
		<pubDate>Fri, 27 Feb 2009 04:26:35 +0000</pubDate>
		<dc:creator>gabrielle</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.baconandtech.com/?p=51</guid>
		<description><![CDATA[A while back I&#8217;d created a Perl module to hold two &#8220;odds &#038; ends&#8221; subroutines that I used in a lot of my programs.  I gave it the unfortunate name of &#8220;Misc.pm&#8221;.  Of course, it lived up to its name &#038; grew over time to contain many more functions;  I should have [...]]]></description>
			<content:encoded><![CDATA[<p>A while back I&#8217;d created a Perl module to hold two &#8220;odds &#038; ends&#8221; subroutines that I used in a lot of my programs.  I gave it the unfortunate name of &#8220;Misc.pm&#8221;.  Of course, it lived up to its name &#038; grew over time to contain many more functions;  I should have just named it JunkDrawer.pm and been done with it.  I decided it was time for a cleanup, and I split everything out into more appropriately-named modules.  But then I had the problem of what to do with existing programs that referenced Misc.pm.  I could have just loaded all the new modules, but that seemed messy.  I had to have a way to figure out which functions each program used &#038; thus track them back to their shiny new module.  <a href="http://search.cpan.org/~jshirley/">jshirley</a>  suggested I try ctags.<br />
<span id="more-51"></span></p>
<p>First, install <a href="http://ctags.sourceforge.net/">exuberant ctags</a> if you don&#8217;t already have it.</p>
<p>Make sure it supports Perl:<br />
<code>:::-->ctags --list-languages | grep -i perl<br />
Perl</code></p>
<p>Then, cd to the directory containing the modules you want to tag, and then create your tags file:<br />
<code>:::-->ctags *.pm</code></p>
<p>Too easy.  There should be a new file called &#8220;tags&#8221; in that directory &#8211; check it out.  All the subs that ctags found are listed here, along with the file it found them in, including duplicates (this could bite you in the ass if you&#8217;re not paying attention; see below).</p>
<p>Open up the Perl program you want to edit in vim.  Load your new tags file with this command:<br />
<code>:set tags=/path/to/tags</code></p>
<p>Now when you find a questionable function, put your cursor on top of it &#038; type ctrl-].  This will open up the module file &#038; take you directly to the subroutine you&#8217;re looking for.  (This is where having duplicate entries in your tags file could bite you &#8211; you&#8217;re going to get the first instance in the tags file.)</p>
<p>Navigate back to the original file with ctrl-t or :e#.</p>
<p>If you have a lot of files/subroutines, you may want something a bit more robust.  I had about 20, spread over 5 modules, and about 30 programs that referenced them, so tracking them through this way didn&#8217;t take me too long.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.baconandtech.com/2009/02/26/fun-with-ctags/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>git on Solaris</title>
		<link>http://www.baconandtech.com/2009/02/25/git-on-solaris/</link>
		<comments>http://www.baconandtech.com/2009/02/25/git-on-solaris/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 01:36:41 +0000</pubDate>
		<dc:creator>gabrielle</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[oh_ffs]]></category>
		<category><![CDATA[solaris]]></category>

		<guid isPermaLink="false">http://www.baconandtech.com/?p=50</guid>
		<description><![CDATA[Boy howdy, was this a trial.  Sheesh.  (I am in no way pointing fingers at git for this mess&#8230;really, it&#8217;s this server [that I don't have admin rights on] that doesn&#8217;t behave the way I expect.)
Solaris 10 on x86.  (uname -a: SunOS princess 5.10 Generic_125101-10 i86pc i386 i86pc)
git 1.5.6.2
Here&#8217;s what I had [...]]]></description>
			<content:encoded><![CDATA[<p>Boy howdy, was this a trial.  Sheesh.  (I am in no way pointing fingers at git for this mess&#8230;really, it&#8217;s this server [that I don't have admin rights on] that doesn&#8217;t behave the way I expect.)</p>
<p>Solaris 10 on x86.  (uname -a: SunOS princess 5.10 Generic_125101-10 i86pc i386 i86pc)<br />
git 1.5.6.2</p>
<p>Here&#8217;s what I had to do, gathered from various places around the web (the Makefile editing was gleaned mainly from <a href="http://discuss.joyent.com/viewtopic.php?pid=175313">http://discuss.joyent.com/viewtopic.php?pid=175313</a>).</p>
<p>First, I had to install my own gmake, openssl, curl, and a couple of other required libraries.</p>
<p>Then:<br />
<code>./configure --prefix=/home/gabrielle/usr/local \<br />
--with-openssl=/home/gabrielle/usr/local/include \<br />
--without-tcltk \<br />
--without-expat</code></p>
<p>Edit the makefile:<br />
<code>:::-->diff Makefile Makefile.orig<br />
167,168c167,168<br />
< CFLAGS = -g -O2 -Wall -I/home/gabrielle/usr/local/include<br />
< LDFLAGS = -L/home/gabrielle/usr/local/lib<br />
---<br />
> CFLAGS = -g -O2 -Wall<br />
> LDFLAGS =<br />
172d171<br />
< CURLDIR=/home/gabrielle/usr/local<br />
891d889<br />
< NO_ICONV=1</code></p>
<p>Make sure we're using gnu make:<br />
<code>:::-->/home/gabrielle/usr/local/bin/make -v<br />
GNU Make 3.81<br />
Copyright (C) 2006  Free Software Foundation, Inc.<br />
This is free software; see the source for copying conditions.<br />
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE.</p>
<p>This program built for i386-pc-solaris2.10</code></p>
<p>Then install like so:<br />
<code>/home/gabrielle/usr/local/bin/make INSTALL=/usr/ucb/install<br />
/home/gabrielle/usr/local/bin/make INSTALL=/usr/ucb/install install</code></p>
<p><em>Voila</em> doesn't really seem the appropriate thing to say here.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.baconandtech.com/2009/02/25/git-on-solaris/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>vim tidbits of the day</title>
		<link>http://www.baconandtech.com/2009/02/13/todays-vim-tip/</link>
		<comments>http://www.baconandtech.com/2009/02/13/todays-vim-tip/#comments</comments>
		<pubDate>Fri, 13 Feb 2009 20:49:44 +0000</pubDate>
		<dc:creator>gabrielle</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[tidbits]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.baconandtech.com/?p=46</guid>
		<description><![CDATA[:::&#8211;&#62;vim
:grep [regexp] [file list]
vim will then load the files that match the regexp &#38; position the cursor on the matching line.
use :cn and :cp to move between instances of the match.
]]></description>
			<content:encoded><![CDATA[<p>:::&#8211;&gt;vim</p>
<p>:grep [regexp] [file list]</p>
<p>vim will then load the files that match the regexp &amp; position the cursor on the matching line.</p>
<p>use :cn and :cp to move between instances of the match.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.baconandtech.com/2009/02/13/todays-vim-tip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>patch</title>
		<link>http://www.baconandtech.com/2008/12/09/patch/</link>
		<comments>http://www.baconandtech.com/2008/12/09/patch/#comments</comments>
		<pubDate>Tue, 09 Dec 2008 17:37:06 +0000</pubDate>
		<dc:creator>gabrielle</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[command-line]]></category>
		<category><![CDATA[tidbits]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.baconandtech.com/?p=43</guid>
		<description><![CDATA[(This is on solaris, no -N option to diff for me!)
This produces the easiest-to-read diff IMO:
diff -btu [oldfile] [newfile] &#62; patchfile
-b = ignore blanks
-t = preserve source indentation
-u = 3 lines of context with the + and &#8211; in front of changed lines
But the -t option interferes with proper patch application, so just use:
diff -u [...]]]></description>
			<content:encoded><![CDATA[<p>(This is on solaris, no -N option to diff for me!)</p>
<p>This produces the easiest-to-read diff IMO:<br />
<code>diff -btu [oldfile] [newfile] &gt; patchfile</code><br />
-b = ignore blanks<br />
-t = preserve source indentation<br />
-u = 3 lines of context with the + and &#8211; in front of changed lines</p>
<p>But the -t option interferes with proper patch application, so just use:<br />
<code>diff -u [oldfile] [newfile] &gt; patchfile</code><br />
&#8230;where oldfile is the file you want to patch, and newfile is the file with the changes you want to apply.</p>
<p><code>patch -b -p0 &lt; patchfile</code><br />
-b = make a backup <img src='http://www.baconandtech.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>If you are asked for the filename to patch &#8211; you probably don&#8217;t have the depth set right with -p.  Try increasing it.</p>
<p>If you get the message &#8220;Reversed (or previously applied) patch detected!&#8221;, somebody messed with your stuff between creating the patch &amp; applying it, OR you did the diff backwards (common Monday morning mistake.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.baconandtech.com/2008/12/09/patch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NULL in Python and Perl</title>
		<link>http://www.baconandtech.com/2008/11/29/null-in-python-and-perl/</link>
		<comments>http://www.baconandtech.com/2008/11/29/null-in-python-and-perl/#comments</comments>
		<pubDate>Sat, 29 Nov 2008 17:14:15 +0000</pubDate>
		<dc:creator>selenamarie</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[null]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.baconandtech.com/?p=39</guid>
		<description><![CDATA[I&#8217;m learning a little Python for a side project. I wrote a SELECT statement that would produce NULLs and rather than use COALESCE to prevent returning NULLs, I wanted the application to be able to detect and then replace the value with a default.
In Perl, this is a no-brainer to me &#8211; the NULL value [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m learning a little Python for a side project. I wrote a SELECT statement that would produce NULLs and rather than use COALESCE to prevent returning NULLs, I wanted the application to be able to detect and then replace the value with a default.</p>
<p>In Perl, this is a no-brainer to me &#8211; the NULL value would be &#8216;undef&#8217;, and I could write something like:</p>
<pre>
$value = $default if (! defined $value);
</pre>
<p>So, after a bit of struggling, I found out that the &#8216;None&#8217; object is returned when a value is NULL in python. </p>
<p>To determine whether you&#8217;ve got a NULL, you write something like: </p>
<pre>
if $value is None:
    $value = $default
</pre>
<p>Generally speaking, Python considers an undefined object to be a rare occurrence.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.baconandtech.com/2008/11/29/null-in-python-and-perl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
