<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet href="/serendipity/templates/default/atom.css" type="text/css" ?>

<feed 
   xmlns="http://www.w3.org/2005/Atom"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/">
    
    <link href="http://www.ketema.net/serendipity/feeds/atom.xml" rel="self" title="Ketema's Notes" type="application/atom+xml" />
    <link href="http://www.ketema.net/serendipity/"                        rel="alternate"    title="Ketema's Notes" type="text/html" />
    <link href="http://www.ketema.net/serendipity/rss.php?version=2.0"     rel="alternate"    title="Ketema's Notes" type="application/rss+xml" />
    <title type="html">Ketema's Notes</title>
    <subtitle type="html">My Random Thoughts...</subtitle>
    <icon>http://www.ketema.net/serendipity/templates/default/img/s9y_banner_small.png</icon>
    <id>http://www.ketema.net/serendipity/</id>
    <updated>2011-09-10T17:18:20Z</updated>
    <generator uri="http://www.s9y.org/" version="1.5.5">Serendipity 1.5.5 - http://www.s9y.org/</generator>
    <dc:language>en</dc:language>
    <admin:errorReportsTo rdf:resource="mailto:ketema@ketema.net" />

    <entry>
        <link href="http://www.ketema.net/serendipity/archives/108-Pgbouncer.html" rel="alternate" title="Pgbouncer" />
        <author>
            <name>Ketema J. Harris</name>
            <email>ketema@ketema.net</email>        </author>
    
        <published>2011-09-10T17:05:27Z</published>
        <updated>2011-09-10T17:18:20Z</updated>
        <wfw:comment>http://www.ketema.net/serendipity/wfwcomment.php?cid=108</wfw:comment>
    
        <slash:comments>1</slash:comments>
        <wfw:commentRss>http://www.ketema.net/serendipity/rss.php?version=atom1.0&amp;type=comments&amp;cid=108</wfw:commentRss>
    
            <category scheme="http://www.ketema.net/serendipity/categories/9-Computers" label="Computers" term="Computers" />
    
        <id>http://www.ketema.net/serendipity/archives/108-guid.html</id>
        <title type="html">Pgbouncer</title>
        <content type="xhtml" xml:base="http://www.ketema.net/serendipity/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                I had a little adventure today. &#160;I purchased orlandopostgresql.com so that I could have a domain for the Orlando Meet-Up group that I run here in town for PostgreSQL professionals. &#160;Our previous domain orlandopg.com was allowed to expire. Unfortunately I was not its owner. &#160;At any rate as I went to add the necessary MX records and test that the email address I set up worked I happened to notice that my gmail account was reporting that it was unable to retrieve email from my home mail server ( I will post about how I use Gmail for my various domains, yet still run my own mail server as well &#160;in a later post). &#160;Curious I looked and found that postfix was unable to connect to my Pg server due to &quot;Too many connections&quot;. &#160;Believe it or not I was pleasantly surprised. &#160;The fact that I was running out of connections meant that I am actually getting traffic to my website. &#160;A quick verification with lsof -i | grep postgres revealed that Apache had eaten up all my connections which were still at the default 100. &#160;This is a perfect opportunity to set up <a href="http://www.ketema.net/serendipity/exit.php?url_id=219&amp;entry_id=108"  onmouseover="window.status='https://github.com/markokr/pgbouncer-cvs';return true;" onmouseout="window.status='';return true;" target="_blank" title="Pgbouncer on Github">PgBouncer</a>&#160;which is my favorite connection pooler for PostgreSQL. &#160;Its config file is very simple and easy to follow, and 10 minutes later the site is back up and running faster than ever and I won't have to worry about running out of connections again. 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://www.ketema.net/serendipity/archives/107-Upgrading-to-Lion.html" rel="alternate" title="Upgrading to Lion" />
        <author>
            <name>Ketema J. Harris</name>
            <email>ketema@ketema.net</email>        </author>
    
        <published>2011-07-21T01:49:34Z</published>
        <updated>2011-07-23T01:48:40Z</updated>
        <wfw:comment>http://www.ketema.net/serendipity/wfwcomment.php?cid=107</wfw:comment>
    
        <slash:comments>1</slash:comments>
        <wfw:commentRss>http://www.ketema.net/serendipity/rss.php?version=atom1.0&amp;type=comments&amp;cid=107</wfw:commentRss>
    
            <category scheme="http://www.ketema.net/serendipity/categories/9-Computers" label="Computers" term="Computers" />
    
        <id>http://www.ketema.net/serendipity/archives/107-guid.html</id>
        <title type="html">Upgrading to Lion</title>
        <content type="xhtml" xml:base="http://www.ketema.net/serendipity/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>I have decided to document my upgrade to Lion on my Mac Pro 1,1. &#160;First of all I must say that I am quite happy with my computer. &#160;It's about 5 years old and is the best investment ever. &#160;The cost at purchase was about 5k and frankly it has LASTED. &#160;Which is really unheard of for a PC. &#160;I have had one HDD failure and that has been the only hardware issue. &#160;I started with 4 GB of RAM and have upgraded to 8GB. &#160;2 Dual Core Xeon processors are still kicking today. &#160;I do not do a log of gaming or video editing so they rock for me.&#160;</p> <br />
<p>So anyway I want to upgrade to Lion. &#160;In my eyes I still have plenty of RAM. &#160;If I need to I can get all the way up to 64 GB, but I doubt I will have the need for that. &#160;My biggest bottle necks in performance is the disk IO and graphics. &#160;With Lion's emphasis on animations I am going to try and get the Sapphire Radeon 4870 I bought a while back to work again. I never got it to work in SL, but I am hoping Lion may support it. &#160;Addressing the disk io there is really only adding an SSD drive. &#160;I have discovered that my onboard SATA controller only supports 3gb/sec transfer rates, so there is no point in getting a 6gb/sec drive. &#160;I also think I will only use it for a boot drive, but what size to get ? &#160;I need to know how much space Lion takes up and account for that plus the swap file to get maximum OS performance. &#160;I would get my home directory on my spindles, but what about the Applications dir ? &#160;That is by far my largest directory outside of home. &#160;Should I get a ssd drive big enough for both the OS and the Applications ? or should I move applications to the spindles ? &#160;Does the OS even support moving around these system directories ? &#160;Here is my current boot drive layout:</p> <br />
<p>/System : 4.98 GB</p> <br />
<p>/Library : 148.8 GB</p> <br />
<p>/Applications : 41.04 GB</p> <br />
<p>/Users : 804.54 GB</p> <br />
<p>/Developer : 10.36 GB</p> <br />
<p>/opt : 16.64 GB</p> <br />
<p>Plus I have 102.01 GB of data on the 500 GB drive that the SSD would replace. &#160;Gotta say I wonder if the speed is worth the drop in size.</p> <br />
<p>Well I am off to do some research as I need to know what besides /System HAS to be on the boot volume. &#160;This will determine the size (and cost) of the SSD I would have to get.&#160;</p> <br />
<p>UPDATE: I have decided to get the Crucial M4 CT128M4SSD2CCA 2.5&quot; 128GB SATA III MLC Internal Solid State Drive. &#160;I feel this is the fastest drive in my price range. &#160;At only 128GB though I am not willing to replace one of my 500 GB drives. &#160;So I'm going to stick in my lower optical bay and lose a Super Drive. &#160;This will allow me to stripe my remaining drives and use it as a 2 TB volume. &#160;I'll post more as I accomplish my goals.</p> <br />
<div class="vimiumHUD" style="right: 150px; "> zoom: 100%; opacity: 1; &quot;&gt;Insert mode</div> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://www.ketema.net/serendipity/archives/106-Google+.html" rel="alternate" title="Google+" />
        <author>
            <name>Ketema J. Harris</name>
            <email>ketema@ketema.net</email>        </author>
    
        <published>2011-07-10T01:43:27Z</published>
        <updated>2011-07-10T01:53:59Z</updated>
        <wfw:comment>http://www.ketema.net/serendipity/wfwcomment.php?cid=106</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://www.ketema.net/serendipity/rss.php?version=atom1.0&amp;type=comments&amp;cid=106</wfw:commentRss>
    
            <category scheme="http://www.ketema.net/serendipity/categories/11-Random" label="Random" term="Random" />
    
        <id>http://www.ketema.net/serendipity/archives/106-guid.html</id>
        <title type="html">Google+</title>
        <content type="xhtml" xml:base="http://www.ketema.net/serendipity/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                So I started using Google+ the other day, and I must say I like it much better than Facebook. &#160;I feel more in control of who gets to see what, plus it integrates into all the other services Google provides like Gmail and Reader seamlessly. &#160;I even stuck a statistics widget on my side bar. &#160;The friend race is on (at least until I get tired of it ). 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://www.ketema.net/serendipity/archives/105-OrlandoPg-6th-Meet-Up.html" rel="alternate" title="OrlandoPg 6th Meet-Up" />
        <author>
            <name>Ketema J. Harris</name>
            <email>ketema@ketema.net</email>        </author>
    
        <published>2011-04-15T18:31:58Z</published>
        <updated>2011-04-15T18:41:31Z</updated>
        <wfw:comment>http://www.ketema.net/serendipity/wfwcomment.php?cid=105</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://www.ketema.net/serendipity/rss.php?version=atom1.0&amp;type=comments&amp;cid=105</wfw:commentRss>
    
            <category scheme="http://www.ketema.net/serendipity/categories/9-Computers" label="Computers" term="Computers" />
    
        <id>http://www.ketema.net/serendipity/archives/105-guid.html</id>
        <title type="html">OrlandoPg 6th Meet-Up</title>
        <content type="xhtml" xml:base="http://www.ketema.net/serendipity/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>Here is a link to the recap of the 6th OrlandoPg Meet-Up group.&#160;<br /><br />
http://www.meetup.com/OrlandoPg/messages/13171818/</p> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://www.ketema.net/serendipity/archives/104-Now-running-Nginx.html" rel="alternate" title="Now running Nginx" />
        <author>
            <name>Ketema J. Harris</name>
            <email>ketema@ketema.net</email>        </author>
    
        <published>2011-04-15T18:25:11Z</published>
        <updated>2011-04-15T18:31:22Z</updated>
        <wfw:comment>http://www.ketema.net/serendipity/wfwcomment.php?cid=104</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://www.ketema.net/serendipity/rss.php?version=atom1.0&amp;type=comments&amp;cid=104</wfw:commentRss>
    
            <category scheme="http://www.ketema.net/serendipity/categories/9-Computers" label="Computers" term="Computers" />
    
        <id>http://www.ketema.net/serendipity/archives/104-guid.html</id>
        <title type="html">Now running Nginx</title>
        <content type="xhtml" xml:base="http://www.ketema.net/serendipity/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>Ketema.Net is now being served from Nginx. &#160;I have learned how to set up and configure Nginx on Gentoo and OS X. &#160;Its fast!</p> <br />
<p> </p> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://www.ketema.net/serendipity/archives/103-PostgreSQL-and-Lua.html" rel="alternate" title="PostgreSQL and Lua" />
        <author>
            <name>Ketema J. Harris</name>
            <email>ketema@ketema.net</email>        </author>
    
        <published>2011-01-14T06:00:24Z</published>
        <updated>2011-01-14T07:04:49Z</updated>
        <wfw:comment>http://www.ketema.net/serendipity/wfwcomment.php?cid=103</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://www.ketema.net/serendipity/rss.php?version=atom1.0&amp;type=comments&amp;cid=103</wfw:commentRss>
    
            <category scheme="http://www.ketema.net/serendipity/categories/9-Computers" label="Computers" term="Computers" />
    
        <id>http://www.ketema.net/serendipity/archives/103-guid.html</id>
        <title type="html">PostgreSQL and Lua</title>
        <content type="xhtml" xml:base="http://www.ketema.net/serendipity/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p><br />
			Today was the third meeting of the <a href="http://www.ketema.net/serendipity/exit.php?url_id=210&amp;entry_id=103"  onmouseover="window.status='http://www.orlandopg.com';return true;" onmouseout="window.status='';return true;" target="_blank" title="OrlandoPg">OrlandoPg</a> Meetup group that I host. &#160;A member Steven wanted to talk about how he could interact with PostgreSQL using Lua. &#160;I informed the group about PostgreSQL's architecture that allows stored procedures to be written in nearly any programming language. &#160;We also talked about how pretty much every language I can think of has a database interaction library of some sort.<br />
<br /><br /><br />
			That led to some quick googling and we spent the rest of the meeting in a coding dojo like environment to see if we could set up and work with PL/Lua and luasql-postgres. &#160;This post will detail how to set up the environment, create a simple stored procedure in PL/Lua, and write a program using the luasql-postgres package or &quot;rock&quot;.<br />
		<br /><br />	The set up: I'm using a mac for development. &#160;OS 10.6.6 to be exact.<br />
		<br /><br /><br />
			To install the Lua programming language I used Mac-Ports.<br /><span style="color: #222222; font-family: 'Courier New', Courier, Fixed, monospace; line-height: 17px; white-space: pre; ">&quot;sudo port install luarocks +curl openssl&quot;</span><br /><br />
			is the command I used. &#160;I actually already had lua installed, so I just installed the luarocks package manager. &#160;If you do not have lua installed, this command will install it as well.<br />
		<br /><br /><br />
			Next I needed to get the lua package (rock) luasql-postgres.<br /><span style="color: #222222; font-family: 'Courier New', Courier, Fixed, monospace; line-height: 17px; white-space: pre; ">&quot;sudo luarocks install --from=http://luarocks.org/repositories/rocks-cvs/ luasql-postgres POSTGRES_DIR=/usr/local/pgsql&quot;</span><br /><br />
			 makes that happen. &#160;This assumes you already have PostgreSQL installed. If you don't use macports to install that and adjust your POSTGRES_DIR accordingly. &#160;I always install PostgreSQL from source myself.&#160;<br />
		<br /><br /><br />
			Next we need to get the PL/Lua extension for PostgreSQL. &#160;It can be downloaded from: <a href="http://www.ketema.net/serendipity/exit.php?url_id=211&amp;entry_id=103"  onmouseover="window.status='http://pgfoundry.org/frs/download.php/2401/pllua-0.3.2.tar.gz';return true;" onmouseout="window.status='';return true;" target="_blank" title="PL/Lua">PgFoundry</a>&#160;Once you have it un-tar it&#160;and edit the Makefile. &#160;Adjust the lines:<br />
		<br /><br /><br />
			LUAINC = -I/opt/local/include&#160;<br /><br />
			LUALIB = -L/opt/local/lib -llua<br />
		<br /><br /><br />
			Save the file the run<br /><span style="color: #222222; font-family: 'Courier New', Courier, Fixed, monospace; line-height: 17px; white-space: pre; ">&quot;sudo make &amp;&amp; make install&quot;</span> <br /><br /><br />
			You now need to install the language into your database. &#160;Head over to your contrib directory, mine is:<br /><br />
			&quot;<span style="color: #222222; font-family: 'Courier New', Courier, Fixed, monospace; line-height: 17px; white-space: pre; ">/usr/local/pgsql/share/contrib/&quot;</span><br />and run<br /><br />
			&quot;<span style="color: #222222; font-family: 'Courier New', Courier, Fixed, monospace; line-height: 17px; white-space: pre; ">psql -f pllua.sql DATABASENAME&quot;.</span><br /> </p> <br />
<p>This registers the language handler within your database.<br />
		<br /><br /><br />
			Now you can create a stored procedure using Lua. Example:<br /><br /><span style="color: #222222; font-family: 'Courier New', Courier, Fixed, monospace; line-height: 17px; white-space: pre; ">	create or replace function hello(_name text) returns text as<br />	$$<br /><span class="Apple-tab-span" style="white-space: pre; "> </span>	return&#160;string.format(&quot;Hello, %s!&quot;, _name)<br />	$$ Language pllua;</span> <br /><br /><br />
			Now you can create a simple lua script to call this function. &#160;Example:<br /><br /><span style="color: #222222; font-family: 'Courier New', Courier, Fixed, monospace; line-height: 17px; white-space: pre; ">require &quot;luasql.postgres&quot;</span><br />
<br />
			env = assert ( luasql.postgres() )<br /><br />
			con = assert ( env:connect( &quot;DBNAME&quot;,&quot;USERNAME&quot;,&quot;PASS&quot;,&quot;DBHOST&quot; ) )<br /><br />
			cur = assert ( con:execute( &quot;SELECT * FROM hello('World!');&quot; ) )<br /><br />
			row = assert ( cur:fetch() )<br /><br />
			print(row)<br /> <br /><br /><br />
			One non-standard thing I had to do to get this script to &quot;see&quot; the luasql.postgres extension was to make a symlink:<br />
		<br /><br /><br />
		&quot;<span style="color: #222222; font-family: 'Courier New', Courier, Fixed, monospace; line-height: 17px; white-space: pre; ">sudo ln -s /opt/local/var/luarocks/lib/lua/5.1/luasql/postgres.so /opt/local/lib/lua/5.1/luasql.so&quot;&#160;<br />
			</span> <br /><br /><br />
			This is necessary because MacPorts and LuaRocks are not really working together.<br />
		<br /><br /><br />
			You can execute the lua script with the command &quot;<span style="color: #222222; font-family: 'Courier New', Courier, Fixed, monospace; line-height: 17px; white-space: pre; ">&quot;lua SCRIPTNAME&quot;</span> and get&#160;the expected output of:<br />
		<br /> <br /> <!-- s9ymdb:58 --><img class="serendipity_image_left" width="455" height="61" style="float: left; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-left: 5px; padding-right: 5px; " src="http://www.ketema.net/serendipity/uploads/Screenshot2011-01-14at1.41.53AM_1-14-2011_1-42-2.png" /> <br /><br /> </p> <br />
<p> </p> <br />
<p>References:<br /> <br />
<a href="http://www.ketema.net/serendipity/exit.php?url_id=212&amp;entry_id=103" title="http://www.nessie.de/mroth/lunit/"  onmouseover="window.status='http://www.nessie.de/mroth/lunit/';return true;" onmouseout="window.status='';return true;" target="_blank">http://www.nessie.de/mroth/lunit/</a><br /><br />
<a href="http://www.ketema.net/serendipity/exit.php?url_id=213&amp;entry_id=103" title="http://www.lua.org/manual/5.1/manual.htm"  onmouseover="window.status='http://www.lua.org/manual/5.1/manual.htm';return true;" onmouseout="window.status='';return true;" target="_blank">http://www.lua.org/manual/5.1/manual.htm</a>l<br /> <br />
<a href="http://www.ketema.net/serendipity/exit.php?url_id=214&amp;entry_id=103" title="http://pllua.projects.postgresql.org/"  onmouseover="window.status='http://pllua.projects.postgresql.org/';return true;" onmouseout="window.status='';return true;" target="_blank">http://pllua.projects.postgresql.org/</a><br /> <br />
<a href="http://www.ketema.net/serendipity/exit.php?url_id=215&amp;entry_id=103" title="http://www.keplerproject.org/luasql/index.html"  onmouseover="window.status='http://www.keplerproject.org/luasql/index.html';return true;" onmouseout="window.status='';return true;" target="_blank">http://www.keplerproject.org/luasql/index.html</a><br /> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://www.ketema.net/serendipity/archives/102-Come-Meet-Up-With-Me-and-discuss-PostgreSQL.html" rel="alternate" title="Come Meet Up With Me and discuss PostgreSQL" />
        <author>
            <name>Ketema J. Harris</name>
            <email>ketema@ketema.net</email>        </author>
    
        <published>2010-08-27T20:06:08Z</published>
        <updated>2010-08-27T20:07:22Z</updated>
        <wfw:comment>http://www.ketema.net/serendipity/wfwcomment.php?cid=102</wfw:comment>
    
        <slash:comments>1</slash:comments>
        <wfw:commentRss>http://www.ketema.net/serendipity/rss.php?version=atom1.0&amp;type=comments&amp;cid=102</wfw:commentRss>
    
            <category scheme="http://www.ketema.net/serendipity/categories/9-Computers" label="Computers" term="Computers" />
    
        <id>http://www.ketema.net/serendipity/archives/102-guid.html</id>
        <title type="html">Come Meet Up With Me and discuss PostgreSQL</title>
        <content type="xhtml" xml:base="http://www.ketema.net/serendipity/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <div style="text-align: center; width: 214px; font-family: tahoma, verdana, 'sans serif'; font-size: 12px; "><embed src="http://www.meetup.com/swf/membership_badge.swf?chapterid=1685481" width="214" height="142" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /><br /><a href="http://www.ketema.net/serendipity/exit.php?url_id=209&amp;entry_id=102" title="http://databasepro.meetup.com/70/?track=i3/mu_evkte7t1a3"  onmouseover="window.status='http://databasepro.meetup.com/70/?track=i3/mu_evkte7t1a3';return true;" onmouseout="window.status='';return true;">Click here to check out<br />The Orlando PG Meetup Group!</a></div> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://www.ketema.net/serendipity/archives/101-Working-with-Git-and-learning-about-pushd.html" rel="alternate" title="Working with Git and learning about pushd" />
        <author>
            <name>Ketema J. Harris</name>
            <email>ketema@ketema.net</email>        </author>
    
        <published>2010-05-02T17:39:38Z</published>
        <updated>2010-05-02T17:39:38Z</updated>
        <wfw:comment>http://www.ketema.net/serendipity/wfwcomment.php?cid=101</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://www.ketema.net/serendipity/rss.php?version=atom1.0&amp;type=comments&amp;cid=101</wfw:commentRss>
    
            <category scheme="http://www.ketema.net/serendipity/categories/9-Computers" label="Computers" term="Computers" />
    
        <id>http://www.ketema.net/serendipity/archives/101-guid.html</id>
        <title type="html">Working with Git and learning about pushd</title>
        <content type="xhtml" xml:base="http://www.ketema.net/serendipity/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>St my new job I have been exposed to Git version control. &#160;I had always used SVN, but never really used any of the advanced features like branching or tagging. &#160;I now like git. &#160;It has taken a little trial and error and some reading&#160;<a href="http://www.ketema.net/serendipity/exit.php?url_id=207&amp;entry_id=101"  onmouseover="window.status='http://progit.org/book/';return true;" onmouseout="window.status='';return true;" target="_blank" title="Git Book">http://progit.org/book/</a></p> <br />
<p>This post is about automating commits so I don't have to worry about it and I get an automatic &quot;go back in time&quot; versioning system.</p> <br />
<p>Reference: <a href="http://www.ketema.net/serendipity/exit.php?url_id=208&amp;entry_id=101"  onmouseover="window.status='http://www.spheredev.org/wiki/Git_for_the_lazy';return true;" onmouseout="window.status='';return true;" target="_blank" title="Git For the Lazy">http://www.spheredev.org/wiki/Git_for_the_lazy</a>&#160;Excerpt:</p> <br />
<p>Work in bits</p> <br />
<p>When dealing with git, it's best to work in small bits. Rule of thumb: if you can't summarise it in a sentence, you've gone too long without committing.</p> <br />
<p>Well I wanted to have the bits part, but not having to add a message every time. &#160;I usually code for a single specific purpose at any given time. &#160;But in the process of &quot;getting there&quot; there are many changes that happen and that I may want to go back to in the evolution. So here is what I did: &#160;I made the following cron job:</p> <br />
<p>#!/bin/bash<br /><br />
pushd ROOTPATHOFREPOSITORY<br /><br />
/FULLPATH/git commit -a -m &quot;auto commit&quot;</p><br />
<p>The key part here is the pushd command. &#160;It was a pain figuring that one out. &#160;executing from cron makes git not &quot;know&quot; where it is so I kept getting &quot;fatal: Not a git repository (or any of the parent directories): .git&quot; errors</p><br />
<p>Hopefully this little pushd command is useful to someone else.&#160;</p> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://www.ketema.net/serendipity/archives/100-Mac-Delivering-local-mail-to-external-address.html" rel="alternate" title="Mac Delivering local mail to external address" />
        <author>
            <name>Ketema J. Harris</name>
            <email>ketema@ketema.net</email>        </author>
    
        <published>2010-04-27T00:35:54Z</published>
        <updated>2010-04-27T00:35:54Z</updated>
        <wfw:comment>http://www.ketema.net/serendipity/wfwcomment.php?cid=100</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://www.ketema.net/serendipity/rss.php?version=atom1.0&amp;type=comments&amp;cid=100</wfw:commentRss>
    
            <category scheme="http://www.ketema.net/serendipity/categories/9-Computers" label="Computers" term="Computers" />
    
        <id>http://www.ketema.net/serendipity/archives/100-guid.html</id>
        <title type="html">Mac Delivering local mail to external address</title>
        <content type="xhtml" xml:base="http://www.ketema.net/serendipity/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>Today I decided to get rid of a small thing that has been annoying me for a while. &#160;On Mac OS X, because it is BSD UNIX based it has a local mail delivery agent, specifically Postfix. &#160;Whenever your computer has messages it needs to send to you it delivers them locally to /var/mail/SHORTUSERNAME &#160;This is all well and good, however unless your a Terminal user you'd never know you had any mail, and even if you happened to open the terminal and got the prompt &quot;You have mail&quot;</p><br />
<p>Once I took a second to think about it I did the following: &#160;change the file /private/etc/postfix aliases and include an entry for your local account shortname and enter the external email address you wish your mail to goto. &#160;run postalias hash:/private/etc/postfix/aliases then newaliases</p><br />
<p>Thats it. &#160;now mail destined for your local account will get sent to your normal email inbox.&#160;</p> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://www.ketema.net/serendipity/archives/99-Partitioning-applied-to-MS-SQL-Server-2008.html" rel="alternate" title="Partitioning applied to MS SQL Server 2008" />
        <author>
            <name>Ketema J. Harris</name>
            <email>ketema@ketema.net</email>        </author>
    
        <published>2010-02-01T07:03:27Z</published>
        <updated>2010-02-01T19:10:57Z</updated>
        <wfw:comment>http://www.ketema.net/serendipity/wfwcomment.php?cid=99</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://www.ketema.net/serendipity/rss.php?version=atom1.0&amp;type=comments&amp;cid=99</wfw:commentRss>
    
            <category scheme="http://www.ketema.net/serendipity/categories/9-Computers" label="Computers" term="Computers" />
    
        <id>http://www.ketema.net/serendipity/archives/99-guid.html</id>
        <title type="html">Partitioning applied to MS SQL Server 2008</title>
        <content type="xhtml" xml:base="http://www.ketema.net/serendipity/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>The purpose of this entry is to demonstrate an important RDBMS concept and how&#160;understanding&#160;the fundamental concept can be applied to different systems.</p> <br />
<p>Background: For the past 3 to 4 years I have used the PostgreSQL ORDMS extensively in web application development and consider myself an expert. &#160;I have studied&#160;database&#160;concepts extensively and used them in real world applications. &#160;Because I was free to choose over the last few years I chose to use PostgreSQL. One of the main reasons being cost, it's free to use. &#160;However I wish to illustrate that just because I used the particular system my skills in other systems, particularly MS SQL Server have not been diminished, but actually enhanced from years of practical applied&#160;database&#160;theory, and those theories can be quickly transferred between systems. </p> <br />
<p>The concept: Partitioning is a global database strategy for dealing with large unwieldy tables. &#160;Over time a heavily inserted table can grow so massive that working with it just becomes slow due to size despite correctly written queries. &#160;What I intend to show is how I understand partitioning and how I have used it in the past with Pg, and then show how in less than 6 hours I was able to translate that understanding into a working implementation using MS SQL Server 2008.</p> <br />
<p>Skills demonstrated: Understanding of database concepts, virtual machine proficiency, software installation of Windows Server 2003, software installation of MS SQL Server 2008, research skill, coding proficiency in Transact SQL and PL/PgSQL and technical writing.</p> <br />
<p>&#160;The demonstration background: &#160;One of my personal projects is a VOIP company: <a href="http://www.ketema.net/serendipity/exit.php?url_id=202&amp;entry_id=99"  onmouseover="window.status='http://www.tonerouter.com';return true;" onmouseout="window.status='';return true;" target="_blank" title="ToneRouter">www.tonerouter.com</a>, as well as in my last position our central technology was processing phone calls. &#160;All in all I have dealt with hundreds of millions if not billions of records representing phone calls. &#160;The application environment is high insert and typically summary reads over a known time period. &#160;Meaning when pulling data from this table it is typically for reporting on say the current months worth of calls. &#160; Over time we saw that older calls were hardly ever accessed except for large group reporting for example to see call trends over a past year. &#160;This scenario is perfect for partitioning.</p> <br />
<p>Pg implementation: In Pg partitioning is accomplished through&#160;inheritance&#160;and use of the rule and or trigger systems. &#160;A parent table is created and then rules or triggers redirect inserts destined to the parent table into the proper child table based on a column criteria. &#160;Integrity is maintained through check constraints. &#160;Queries need only reference the parent table name and the constraint exclusion feature allows the planner to choose the proper child table based on the where clause. &#160;That's the theory anyway. &#160;In practical application I have found that Pg does not handle complex or &quot;sliding&quot; partition parameters very well, such as dates and time. &#160;For simple comparisons though it works great. &#160;To work around the limitation I developed the following strategy: I chose to create partition column that is a computed column based on the month and year of the record being inserted. &#160;The data type is varchar and the values are simply strings in the format &quot;month_year&quot;. A string constant lends itself well to Pg's constraint checking. &#160;I used the trigger system to manage creation of the child tables so that they are created automatically upon insert and all the&#160;necessary&#160;rules are added to the parent table dynamically. &#160;The code to do this is <a href="/cdr_partition_trigger.txt" target="_blank" title="partition_trigger_sql">here</a>.</p> <br />
<p>SQL Server Implementation: &#160;Converting this technique to SQL Server was not very difficult. &#160;Because the concept and desired effect were known I simply needed to find the implementation details. &#160;The resources I used to do this were MSDN and specifically the following document: <a href="/MSSQLPartitioningStrategies.docx" target="_blank" title="MS SQL Partitioning Strategies.docx">MSSQL Partitioning Strategies.docx</a>. &#160;At first read I was tempted to use the Partitioned View strategy and it on the surface is very&#160;similar&#160;to what Pg was doing: &#160;Horizontal partitioning with multiple tables. &#160;However upon further reading it became apparent that technique would not be the best. &#160;Instead SQL Server 2008 has the ability to internally manage partitions within a single table. &#160;This technique is actually closer to what Pg's technique is doing because it allows the queries to reference one table name, handles inserts automatically and places them in the right place and allows the planner to select the proper partition based on a where clause. &#160;The steps needed to accomplish this were:</p> <br />
<p>1) Create a&#160;partitioning&#160;function.<br />2) Create a partition scheme.<br />3) Create the table and place it on the partition scheme.</p> <br />
<p>The following code samples and screen shots&#160;illustrate the above steps.</p> <br />
<pre>CREATE PARTITION FUNCTION cdr_by_month ( varchar(14) )<br />
AS RANGE LEFT<br />
FOR VALUES ( <span class="Apple-tab-span" style="white-space: pre; ">'november_2009', 'december_2009', <br />
'january_2010', 'february_2010','march_2010', 'april_2010', 'may_2010', 'june_2010', 'july_2010', <br />
'august_2010','september_2010', 'october_2010', 'november_2010', 'december_2010' ) ;</span><br />
<p>CREATE PARTITION SCHEME cdr_monthly<br />
AS PARTITION cdr_by_month ALL TO ([PRIMARY]) ;</p></pre> <br />
<p><!-- s9ymdb:53 --><!-- s9ymdb:53 --><img class="serendipity_image_left" width="955" height="348" style="float: left; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-left: 5px; padding-right: 5px; " src="http://www.ketema.net/serendipity/uploads/mssql_partition_projection_count.png" /></p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p><!-- s9ymdb:54 --><img class="serendipity_image_left" width="962" height="938" style="float: left; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-left: 5px; padding-right: 5px; " src="http://www.ketema.net/serendipity/uploads/mssql_unpartitioned_query.png" /></p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p><!-- s9ymdb:55 --><img class="serendipity_image_left" width="966" height="940" style="float: left; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-left: 5px; padding-right: 5px; " src="http://www.ketema.net/serendipity/uploads/mssql_partioned_query.png" /> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p> </p> <br />
<p>One thing I did not go into, but is extremely important is the disk management aspect of partitioning.<br />
Knowing the access and usage patterns of your queries and knowing that you need to put your highly accessed tables on fast<br />
disks is extremely important in db design.  In Pg this is accomplished through Tablespaces, in MS SQL Server it is through<br />
file groups.  Different terms for the same concept which is knowing where to place your tables to best take advantage of fast<br />
disks.</p> <br />
<p>Final Thoughts: Partitioning&#160;is an important database concept.  All major relational database systems implement it in some<br />
form.  Understanding the concept from a design point of view is important and being able to implement the strategy in<br />
different systems is also important.  You never know what tool you will be called upon to get a job done.  I hope to have shown<br />
how I am able to use and work with SQL Server 2008 because of my past experience with older SQL Server editions, as well as my ability to take a concept, research it for a different platform, and then implement it in that platform.</p> <br />
<p><a href="/createcdrtablemssqlserver.txt" target="_blank" title="Table Definition">Table Definition</a> <br /><a href="/get_partition_string_function.txt" target="_blank" title="Function Definition">Partition String Function</a></p> <br />
<p> </p> <br />
<p> </p> 
            </div>
        </content>
        
    </entry>

</feed>
