<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>

_uacct = "UA-3746479-1";
urchinTracker();
</description><title>Subvert Normality</title><generator>Tumblr (3.0; @asenchi)</generator><link>http://asenchi.com/</link><item><title>Thirty Minute Solution with Vim</title><description>&lt;p&gt;Today on IRC a friend had an issue he was trying to solve using Vim. He had a
sed/awk solution but was interested in seeing if it could be solved in Vim.&lt;/p&gt;

&lt;p&gt;The problem was a common one, one that I&amp;#8217;ve run into before. I&amp;#8217;ve got this
giant list of data but all of the primary key&amp;#8217;s are &amp;#8216;1&amp;#8217;. How do I
automate the process of incrementing the primary key?&lt;/p&gt;

&lt;p&gt;Here&amp;#8217;s a sample of the data:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[
  {
    "pk": 1,
    "model": "app.model",
    "fields": {
      ..
    }
  },
  {
    "pk": 1,
    "model": "app.model",
    "fields": {
      ..
    }
  },
  {
    "pk": 1,
    "model": "app.model",
    "fields": {
      ..
    }
  },
  ...
]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;You can see there that all the &amp;#8220;pk&amp;#8221; lines contain a &amp;#8216;1&amp;#8217;.&lt;/p&gt;

&lt;p&gt;So how do we do this in Vim?&lt;/p&gt;

&lt;p&gt;First we looked at how to match the &amp;#8220;pk&amp;#8221; on each line, which can be done by
this search parameter in Vim:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;:g/pk/
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then we needed to get to the digit, so we added:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;:g/pk/s/\d\+
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The \d+ finds the digits on that line (the &amp;#8216;+&amp;#8217; just matches more than one
digit). We are putting this in a s/ since we eventually want to search and
replace the &amp;#8216;1&amp;#8217; with an incremented number.&lt;/p&gt;

&lt;p&gt;So far we are on the proper line, we&amp;#8217;ve matched the digits on that line, how
do we increment them?&lt;/p&gt;

&lt;p&gt;We need to start at one (at the top of the file) so lets add to our line
above:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;:let i=1|1,$g/pk/s/\d\+/
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Here we&amp;#8217;ve set the variable &amp;#8220;i&amp;#8221; to 1. We&amp;#8217;ve also stated in &amp;#8220;1,$&amp;#8221; that we want
to match the entire file. This can actually be shortened to &amp;#8220;%&amp;#8221;.&lt;/p&gt;

&lt;p&gt;Now we need to change \d+ to &amp;#8220;i&amp;#8221;, and then increment &amp;#8220;i&amp;#8221;.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;:let i=1|%g/pk/s/\d\+/\=i/g|let i=i+1
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Huh? Lets take a look at what we&amp;#8217;ve added.&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;We shortened our &amp;#8216;whole&amp;#8217; file setup to &amp;#8216;%&amp;#8217;&lt;/li&gt;
&lt;li&gt;We&amp;#8217;ve added the replacement value &amp;#8216;\=i&amp;#8217;&lt;/li&gt;
&lt;li&gt;We want to match the entire file &amp;#8216;/g&amp;#8217;&lt;/li&gt;
&lt;li&gt;And finally we increment &amp;#8220;i&amp;#8221; with &amp;#8216;let i=i+1&amp;#8217;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Lets run that on our example data and see what we get?&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[
  {
    "pk": 1,
    "model": "app.model",
    "fields": {
      ..
    }
  },
  {
    "pk": 2,
    "model": "app.model",
    "fields": {
      ..
    }
  },
  {
    "pk": 3,
    "model": "app.model",
    "fields": {
      ..
    }
  },
  ...
]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Bingo!&lt;/p&gt;</description><link>http://asenchi.com/post/6329275909</link><guid>http://asenchi.com/post/6329275909</guid><pubDate>Wed, 08 Jun 2011 16:18:54 -0400</pubDate></item><item><title>Photo</title><description>&lt;img src="http://24.media.tumblr.com/tumblr_l677lnSJET1qz8lzoo1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;</description><link>http://asenchi.com/post/864393937</link><guid>http://asenchi.com/post/864393937</guid><pubDate>Tue, 27 Jul 2010 00:10:19 -0400</pubDate></item><item><title>Innocence</title><description>&lt;img src="http://24.media.tumblr.com/tumblr_l5sd26J7Ri1qz8lzoo1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Innocence&lt;/p&gt;</description><link>http://asenchi.com/post/830387922</link><guid>http://asenchi.com/post/830387922</guid><pubDate>Sun, 18 Jul 2010 23:44:06 -0400</pubDate></item><item><title>The Lord's Prayer</title><description>&lt;p&gt;I found &lt;a href="http://everything2.com/e2node/The%2520Lord%2527s%2520Prayer%253A%2520l337"&gt;this&lt;/a&gt; today and thought it was worth repeating just the translated version.  Being a computer geek allows me to enjoy such things. :)

&lt;pre&gt;
Our sysadmin, who chills in Heaven,
feared be thy name.
Thy pwnage come, thy scripts be done in /earth as it is in /heaven.
Seed us this day our daily ROMs.
Forgive us our n00b exploits as we forgive script kiddies that hax0r against us.
Reveal to us not 0 day vulns, but save us from RIAA.
For thine is the network, and the rm -rf /, and all our base are belong to you, forever and ever.
Amen.
&lt;/pre&gt;&lt;/p&gt;</description><link>http://asenchi.com/post/32741201</link><guid>http://asenchi.com/post/32741201</guid><pubDate>Thu, 24 Apr 2008 10:46:00 -0400</pubDate></item><item><title>"If you say “Curtoogle” three times in the mirror in a dark bathroom, Bill Gates appears..."</title><description>““If you say “Curtoogle” three times in the mirror in a dark bathroom, Bill Gates appears with a broken Windows VPS””&lt;br/&gt;&lt;br/&gt; - &lt;em&gt;Rob in response to a horrible day dealing with Windows VPS and Severin alluding to using “curtgoogle” for an answer.&lt;/em&gt;</description><link>http://asenchi.com/post/31385043</link><guid>http://asenchi.com/post/31385043</guid><pubDate>Thu, 10 Apr 2008 15:48:00 -0400</pubDate></item><item><title>"You only get one life. Why not do something huge?"</title><description>“You only get one life. Why not do something huge?”&lt;br/&gt;&lt;br/&gt; - &lt;em&gt;Paul Graham, &lt;a href="http://www.paulgraham.com/heroes.html"&gt;Some Heros&lt;/a&gt;&lt;/em&gt;</description><link>http://asenchi.com/post/30995673</link><guid>http://asenchi.com/post/30995673</guid><pubDate>Sun, 06 Apr 2008 23:11:00 -0400</pubDate></item><item><title>"haha! :)  Believe me, smart people are not abundant."</title><description>“haha! :)  Believe me, smart people are not abundant.”&lt;br/&gt;&lt;br/&gt; - &lt;em&gt;Eric&lt;br/&gt;
(A friend I was talking to about about some of the stupid business decisions hosting companies make.)&lt;/em&gt;</description><link>http://asenchi.com/post/30727724</link><guid>http://asenchi.com/post/30727724</guid><pubDate>Thu, 03 Apr 2008 21:24:16 -0400</pubDate></item><item><title>Interesting...</title><description>&lt;p&gt;1. Focus on technique as opposed to outcome.&lt;br/&gt;
2. Set specific goals.&lt;br/&gt;
3. Get good, prompt feedback, and use it.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://freakonomics.blogs.nytimes.com/2008/03/11/how-did-a-rod-get-so-good/"&gt;http://freakonomics.blogs.nytimes.com/2008/03/11/how-did-a-rod-get-so-good/&lt;/a&gt;&lt;/p&gt;</description><link>http://asenchi.com/post/28597784</link><guid>http://asenchi.com/post/28597784</guid><pubDate>Tue, 11 Mar 2008 20:20:07 -0400</pubDate></item><item><title>I love it when Bruce Schneier comments on the absurd.</title><description>&lt;a href="http://www.schneier.com/blog/archives/2008/03/searching_for_t.html"&gt;I love it when Bruce Schneier comments on the absurd.&lt;/a&gt;</description><link>http://asenchi.com/post/28597501</link><guid>http://asenchi.com/post/28597501</guid><pubDate>Tue, 11 Mar 2008 20:14:00 -0400</pubDate></item><item><title>Um, yeah… this frickin rocks.</title><description>&lt;iframe width="400" height="300" src="http://www.youtube.com/embed/rmBG2HoG5kI?wmode=transparent&amp;autohide=1&amp;egm=0&amp;hd=1&amp;iv_load_policy=3&amp;modestbranding=1&amp;rel=0&amp;showinfo=0&amp;showsearch=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Um, yeah… this frickin rocks.&lt;/p&gt;</description><link>http://asenchi.com/post/28339976</link><guid>http://asenchi.com/post/28339976</guid><pubDate>Sat, 08 Mar 2008 23:42:25 -0500</pubDate></item><item><title>"We have to cauterize the retardedness"</title><description>“We have to cauterize the retardedness”&lt;br/&gt;&lt;br/&gt; - &lt;em&gt;Co-worker when talking about dealing with Windows as a server platform.&lt;/em&gt;</description><link>http://asenchi.com/post/28334473</link><guid>http://asenchi.com/post/28334473</guid><pubDate>Sat, 08 Mar 2008 21:48:58 -0500</pubDate></item><item><title>Some artists (songs) found on 'The Feel Good Initiative'</title><description>&lt;p&gt;Will have to look up more about these:&lt;br/&gt;
Fantastic Plastic Machine - Bachelor Pad&lt;br/&gt;
Nina Simone - Sinnerman&lt;br/&gt;
Moloko - Absent Minded Friends&lt;br/&gt;
Daft Punk - Face to Face / Short Circuit&lt;br/&gt;
Groove Armada - Paris&lt;br/&gt;
Basement Jaxx - Good Luck&lt;br/&gt;
Djuma Soundsystems - Les Djinns (Trentamoller Mix)&lt;br/&gt;
Adriana Calcanhoto - Fico Assim Sem Voce&lt;/p&gt;</description><link>http://asenchi.com/post/28334095</link><guid>http://asenchi.com/post/28334095</guid><pubDate>Sat, 08 Mar 2008 21:40:02 -0500</pubDate></item><item><title>Third time is a charm</title><description>&lt;p&gt;Today we found out that we are pregnant again&amp;#8230; lets hope this one hangs in there.&lt;/p&gt;</description><link>http://asenchi.com/post/28110975</link><guid>http://asenchi.com/post/28110975</guid><pubDate>Thu, 06 Mar 2008 07:54:26 -0500</pubDate></item><item><title>Company morals</title><description>&lt;p&gt;Why is it that companies treat their employees so poorly?  I&amp;#8217;ve seen it in every company I&amp;#8217;ve ever worked in, every company my wife has ever worked for and in most that my friends work in.&lt;/p&gt;

&lt;p&gt;Is it simply greed that drives such horrible internal customer service?  Employees, good employees, are more important than customers.  That is a fact that most never recognize.  Good employees cost more in wages but less in expenses, do more and make things less stressful, leaving you (the manager) time to get customers.  Good employees don&amp;#8217;t require your attention.&lt;/p&gt;

&lt;p&gt;The problem is, if you have good employees but you don&amp;#8217;t allow them to do their job or empower them with respect; you will fail.&lt;/p&gt;

&lt;p&gt;American companies (only because I don&amp;#8217;t have experience with international companies) fail most of the time.&lt;/p&gt;

&lt;p&gt;Such a shame.&lt;/p&gt;</description><link>http://asenchi.com/post/28023911</link><guid>http://asenchi.com/post/28023911</guid><pubDate>Wed, 05 Mar 2008 09:43:21 -0500</pubDate></item><item><title>My precioussssssss</title><description>&lt;img src="http://24.media.tumblr.com/SSI26XiyR6531cyfl0znaiB8_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;My precioussssssss&lt;/p&gt;</description><link>http://asenchi.com/post/27870767</link><guid>http://asenchi.com/post/27870767</guid><pubDate>Mon, 03 Mar 2008 16:22:05 -0500</pubDate></item></channel></rss>

