<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Blogs on Brian Mehrman</title>
    <link>http://brianmehrman.com/blog/</link>
    <description>Recent content in Blogs on Brian Mehrman</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Sun, 13 Jan 2019 00:00:00 -0500</lastBuildDate>
    <atom:link href="http://brianmehrman.com/blog/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Ruby Code Blocks</title>
      <link>http://brianmehrman.com/blog/ruby-code-blocks/</link>
      <pubDate>Sun, 13 Jan 2019 00:00:00 -0500</pubDate>
      <guid>http://brianmehrman.com/blog/ruby-code-blocks/</guid>
      <description>&lt;h1 id=&#34;code-blocks&#34;&gt;Code Blocks&lt;/h1&gt;
&lt;p&gt;Ruby code blocks are from the closure family&lt;/p&gt;
&lt;p&gt;Ruby blocks are found throughout ruby. They are a powerful feature that allow
you to pass snippets of code to enumerable methods (e.g. each, select, detect)
as well as custom methods useing the yield keyword.&lt;/p&gt;
&lt;p&gt;Blocks are nothing new, they use the computer science concept called closures.
This concept was invented by Peter J. Landin in 1964. Closures were adopted by
a version of a Lisp called Scheme in 1975.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Postgresql Record Locking</title>
      <link>http://brianmehrman.com/blog/database-record-locking/</link>
      <pubDate>Sat, 23 Jun 2018 00:00:00 -0500</pubDate>
      <guid>http://brianmehrman.com/blog/database-record-locking/</guid>
      <description>&lt;h1 id=&#34;database-lock-modes&#34;&gt;Database Lock Modes&lt;/h1&gt;
&lt;p&gt;Postgresql provides different locking modes to control concurrency within the database.
Locks are automatically acquired by most Postgres commands to make sure tables are not
dropped or modified while a command is executed. Locks can also be acquired manually
for application level control.&lt;/p&gt;
&lt;p&gt;ActiveRecord provides the interface between the Rails application and the database.
Using ActiveRecord we can create these database level locks.&lt;/p&gt;
&lt;h2 id=&#34;setup&#34;&gt;Setup&lt;/h2&gt;
&lt;p&gt;For the examples in this post we will be using the following data setup with a new Rails application.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Optimistic vs Pessimistic Locking</title>
      <link>http://brianmehrman.com/blog/optimistic-vs-pessimistic-locking/</link>
      <pubDate>Tue, 29 May 2018 00:00:00 -0500</pubDate>
      <guid>http://brianmehrman.com/blog/optimistic-vs-pessimistic-locking/</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Data integrity is at risk once two sessions begin to work on the same records…&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Martin Fowler&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;optimistic-locking&#34;&gt;Optimistic Locking&lt;/h1&gt;
&lt;p&gt;Is a data access strategy where it is assumed that the chance of conflict between sessions is very low. Changes from one session are validated before being committed to the database.&lt;/p&gt;
&lt;h1 id=&#34;pessimistic-locking&#34;&gt;Pessimistic Locking&lt;/h1&gt;
&lt;p&gt;This an opposing data access strategy assumes that conflicts between sessions is highly likely. Conflicts are prevented by forcing all transactions to obtain a lock on the data (record or table) before it can start to use it.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Git Tips</title>
      <link>http://brianmehrman.com/blog/git-tips/</link>
      <pubDate>Tue, 06 Feb 2018 00:00:00 -0500</pubDate>
      <guid>http://brianmehrman.com/blog/git-tips/</guid>
      <description>&lt;h1 id=&#34;git&#34;&gt;Git&lt;/h1&gt;
&lt;p&gt;Git is a free version control system designed for both small and large projects.&lt;/p&gt;
&lt;h1 id=&#34;tips&#34;&gt;Tips&lt;/h1&gt;
&lt;h2 id=&#34;rebase&#34;&gt;Rebase&lt;/h2&gt;
&lt;p&gt;Whenever I am working on a project with other developers I find that I need to rebase
my feature branch with the common branch the rest of the team is using. This branch
is usually called &lt;code&gt;dev&lt;/code&gt; or &lt;code&gt;ci&lt;/code&gt;.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ git fetch
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To make sure I have the latest branches I run a &lt;code&gt;fetch&lt;/code&gt; to update all my local branches.&lt;/p&gt;</description>
    </item>
    <item>
      <title>class_eval vs define_method</title>
      <link>http://brianmehrman.com/blog/class-eval-vs-define-method/</link>
      <pubDate>Wed, 26 Apr 2017 00:00:00 -0500</pubDate>
      <guid>http://brianmehrman.com/blog/class-eval-vs-define-method/</guid>
      <description>&lt;h1 id=&#34;meta-programming&#34;&gt;Meta Programming&lt;/h1&gt;
&lt;p&gt;Having to write redundant methods can lead to hundreds of lines of code that can
be hard to maintain. Meta programming provides us with tools that allow us to write
code that writes its self.&lt;/p&gt;
&lt;h1 id=&#34;class-eval&#34;&gt;Class Eval&lt;/h1&gt;
&lt;p&gt;class_eval opens the class and adds the method to the class itself. While this takes
longer to define a method it puts the new method in the ancestor chain where it can
be accessed quicker than if you used define_method.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
