<?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>luminousmonkey.org</title>
	<atom:link href="http://luminousmonkey.org/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://luminousmonkey.org</link>
	<description>Just me, talking crap</description>
	<lastBuildDate>Fri, 28 May 2010 23:52:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Capitalism vs Corporatism</title>
		<link>http://luminousmonkey.org/?p=317</link>
		<comments>http://luminousmonkey.org/?p=317#comments</comments>
		<pubDate>Fri, 28 May 2010 23:52:43 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://luminousmonkey.org/?p=317</guid>
		<description><![CDATA[I&#8217;ve come across a tweet recently from PoisonTheMonkey, about the current BP abomination: This is what capitalism looks like: http://tumblr.com/xevam3dx2 It&#8217;s a disturbing image, and I agree with what she is trying to say, except for her usage of the word &#8220;capitalism&#8221;. From wikipedia: Capitalism is an economic system in which the means of production [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve come across a tweet recently from PoisonTheMonkey, about the current BP abomination:</p>
<blockquote><p>This is what capitalism looks like: <a href="http://tumblr.com/xevam3dx2">http://tumblr.com/xevam3dx2</a></p></blockquote>
<p>It&#8217;s a disturbing image, and I agree with what she is trying to say, except for her usage of the word &#8220;capitalism&#8221;.  From wikipedia:</p>
<blockquote><p>Capitalism is an economic system in which the means of production are privately owned; supply, demand and price are mostly set by market forces rather than economic planning; and profit is distributed to owners who invest in businesses. Capitalism also refers to the process of capital accumulation.</p></blockquote>
<p>It continues with &#8220;There is however no consensus on the definition of capitalism, nor how it should be used as an analytical category.&#8221;</p>
<p>So pretty much it seems to be a very general word that actually covers a few things, and that&#8217;s the problem.  Capitalism shouldn&#8217;t be a dirty word, there&#8217;s nothing inherit in capitalism that means companies should get away with killing flora and fauna.  It just means that people and buy and sell stuff they own.</p>
<p>The problem is that we are under a system of corporatism, now I will fully admit corporatism is a capitalist system, but it&#8217;s not the capitalism of the system that is causing the problem, it&#8217;s the fact the governments of the world give favour to companies/corporations.  So I feel PoisonTheMonkey&#8217;s statement is actually blaming the wrong thing.</p>
<p>She&#8217;s not being malicious at all, <a href="http://atoxique.tumblr.com/post/641825920/in-the-larger-scheme-of-things-bullshit-like">she knows the governments attitudes are the problem</a>. What she is describing is what I understand as corporatism, so I would think that is a much better word to use to describe the problem.</p>
<p>As far as the BP situation goes, the American government should be stepping in, and making BP pay for a 100% clean up, until it&#8217;s fixed, or BP have no more money left.  Corporations are all about profit, so if you make disasters like this cost them, they will make sure it&#8217;s fixed quickly and never happens again.</p>
]]></content:encoded>
			<wfw:commentRss>http://luminousmonkey.org/?feed=rss2&amp;p=317</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Moving from Windows to OSX</title>
		<link>http://luminousmonkey.org/?p=313</link>
		<comments>http://luminousmonkey.org/?p=313#comments</comments>
		<pubDate>Mon, 17 May 2010 12:54:01 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[OSX]]></category>

		<guid isPermaLink="false">http://luminousmonkey.org/?p=313</guid>
		<description><![CDATA[I&#8217;ve always liked developing software on a *nix based system, generally this means Linux, but I&#8217;ve recently been using OpenSolaris because, well, it&#8217;s better than Linux. Anyway, there has always been OSX, and I did used to own an iMac, which was nice. However, it&#8217;s very hard to upgrade the video hardware in any Mac, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve always liked developing software on a *nix based system, generally this means Linux, but I&#8217;ve recently been using OpenSolaris because, well, it&#8217;s better than Linux.  Anyway, there has always been OSX, and I did used to own an iMac, which was nice.</p>
<p>However, it&#8217;s very hard to upgrade the video hardware in any Mac, besides the lovely, but very expensive MacPros.  And as I do like gaming on my PC as well, it&#8217;s kinda something that is a bit important to me at times.</p>
<p>Anyway, I&#8217;ve managed to get OSX running on my PC hardware, there&#8217;s plenty of websites on how to go about it, so I&#8217;m not going to repeat them here, Google is your friend. So now I&#8217;m running OSX Snow Leopard, the only problem I seem to have is that I can&#8217;t enable my full 8GB of RAM, and I have to run at only 4GB.  Besides that however, everything else seems to work just fine.  Even my Geforce 295.</p>
<p>The only other problem is finding software that does certain tasks in a way that I&#8217;m used to on Windows, so I thought I would just mention a few in case it can help anyone else out.</p>
<h5>Games</h5>
<p><a href="http://steamgames.com/">Steam</a> has just come to the Mac, so I think that pretty much solves the problem for me. For the last few years, I have only ever used Steam to buy my PC games, and Valve&#8217;s recent support for Mac now means that I can do the same under OSX.  With the added advantage that when I buy a copy for my PC, I get the Mac version for free. With the support of Steam, I&#8217;m hoping that the Mac will get some more support from game developers.</p>
<h5>Music</h5>
<p>This is a pretty important one for me, I pretty much always have music playing when I&#8217;m at my computer, so it&#8217;s important that I can at least have a music player that I can live with.  On Windows, I always used <a href="http://www.foobar2000.org/">Foobar</a> as my music player of choice.  It supports pretty much all music formats under the sun you could think of, it&#8217;s pretty customisable, and supports <a href="http://en.wikipedia.org/wiki/Replay_Gain">ReplayGain</a>.</p>
<p>When it comes to OSX however, seriously, iTunes is probably the best option, all other music players just don&#8217;t seem as nice, which now gives me some problems.</p>
<h6>No FLAC support</h6>
<p>iTunes doesn&#8217;t (and probably never will, support FLAC <i>properly</i>. This actually isn&#8217;t much of a problem now. iTunes has always supported Apple Lossless, which, seems to me, produces a smaller file size than FLAC did.  So basically I can recode all my FLAC files to Apple Lossless.</p>
<p>Now this has always been an option, so why wasn&#8217;t I using iTunes on the PC then? Well, because I also have an iPhone. If I did have my entire music collection in iTunes, I would need to keep two copies of tracks about.  The lossless ones for playing on the desktop, and the lossy ones for syncing with my iPhone.  However, the new version of iTunes (at least on OSX) now supports encoding of lossless to lossy when syncing. So now all I have to do is manually manage tracks to sync on my iPhone, but don&#8217;t have to keep two copies, and re-encode tracks I want to sync.</p>
<h6>No replaygain support</h6>
<p>This one is kinda important for me, <a href="http://en.wikipedia.org/wiki/Replay_Gain">ReplayGain</a> addresses the issue of having a mixture of CDs that have been normalised to different levels, basically this is a problem when you have your music player set to random.  You will some find some tracks are really quiet, so you&#8217;ll turn up the volume, and then it will switch to a much louder track, and you&#8217;ll be deafened.</p>
<p>iTunes does have support for pre-calculated volume adjustment, it&#8217;s called Soundcheck. However, the problem with Soundcheck, is that it does per-track normalisation, this is bad.  On an album, say for example Pink Floyd&#8217;s <u>The Dark Side of the Moon</u>, you will find that with Soundcheck results in the volume of the tracks jumping all over the place. The volume should be normalised based over the whole album. iTunes does not support this&#8230;</p>
<p>However, with a bit of searching, I found <a href="http://www.mani.de/ivolume/">iVolume</a>. This program when set correctly, will calculate and set the Soundcheck setting so each track in an album is set to the same level. This means no jumping up and down in volume, and also that the normalisation will work across albums as well.</p>
<p>Well, that&#8217;s it for now.</p>
]]></content:encoded>
			<wfw:commentRss>http://luminousmonkey.org/?feed=rss2&amp;p=313</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Generating Statements for MYOB</title>
		<link>http://luminousmonkey.org/?p=251</link>
		<comments>http://luminousmonkey.org/?p=251#comments</comments>
		<pubDate>Wed, 17 Feb 2010 05:52:09 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[MYOB]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://luminousmonkey.org/?p=251</guid>
		<description><![CDATA[The statements that MYOB generates are inflexible, and in a word, crap. I&#8217;ve found that getting timely and informative statements out to customers goes a long way to helping keeping your customers close to their payment terms. So, in order to automate the process, I wrote up a script that generates statements, and any warning [...]]]></description>
			<content:encoded><![CDATA[<p>The statements that MYOB generates are inflexible, and in a word, crap. I&#8217;ve found that getting timely and informative statements out to customers goes a long way to helping keeping your customers close to their payment terms.</p>
<p>So, in order to automate the process, I wrote up a script that generates statements, and any warning letters I needed to go with them.  Keep in mind I&#8217;m using JRuby, as it gives me access to JDBC which is far easier to get working with the MYOB ODBC driver than trying to use the Ruby ODBC driver, and it requires no patching to get it to work.</p>
<p><span id="more-251"></span></p>
<p>It starts off simply enough with the following file:</p>
<pre><code><span class="Comment"># This little program is used to generate statements to customers.</span>

<span class="PreProc">require</span> <span class="Special">'</span><span class="Constant">rubygems</span><span class="Special">'</span>
<span class="PreProc">require</span> <span class="Special">'</span><span class="Constant">sequel</span><span class="Special">'</span>

<span class="Comment"># Setup our database connection</span>
<span class="Comment">#Sequel.single_threaded = true</span>
<span class="Type">DB</span> = <span class="Type">Sequel</span>.connect( <span class="Special">'</span><span class="Constant">jdbc:odbc:DirectComms_MYOB</span><span class="Special">'</span> )

<span class="Comment"># Load in our models</span>
<span class="PreProc">require</span> <span class="Special">'</span><span class="Constant">models/customer</span><span class="Special">'</span>
<span class="PreProc">require</span> <span class="Special">'</span><span class="Constant">models/job</span><span class="Special">'</span>
<span class="PreProc">require</span> <span class="Special">'</span><span class="Constant">models/terms</span><span class="Special">'</span>

<span class="Type">Customer</span>.with_open_invoices.each <span class="Statement">do</span> |<span class="Identifier">customer</span>|
  <span class="Comment"># For each customer, we get a list of their open invoices and process</span>
  <span class="Comment"># that list to create a statement and warning letters.</span>

  <span class="Comment"># There are 3 types of invoices:</span>
  <span class="Comment"># =&gt; Open - These show up on the normal statement</span>
  <span class="Comment"># =&gt; Overdue - These show up on the first warning letter</span>
  <span class="Comment"># =&gt; Really Overdue - These show up on the last letter with interest</span>
  <span class="Comment"># We only have to find the overdue and really overdue invoices because</span>
  <span class="Comment"># we already have all the open invoices.</span>
  overdue_invoices = []
  really_overdue_invoices = []
  customer_open_invoices = customer.open_invoices
  customer_open_invoices.each <span class="Statement">do</span> |<span class="Identifier">invoice</span>|
    <span class="Statement">if</span> invoice.overdue?
      <span class="Comment"># Overdue invoice, also includes invoices that are really overdue</span>
      <span class="Statement">if</span> invoice.really_overdue?
        <span class="Comment"># This invoice is really overdue, so treated differently</span>
        really_overdue_invoices &lt;&lt; invoice
      <span class="Statement">else</span>
        <span class="Comment"># This invoice is just overdue</span>
        overdue_invoices &lt;&lt; invoice
      <span class="Statement">end</span>
    <span class="Statement">end</span>
  <span class="Statement">end</span> <span class="Comment"># End Customer.open_invoices</span>

  <span class="PreProc">require</span> <span class="Special">'</span><span class="Constant">directcom/statement</span><span class="Special">'</span>
  <span class="Type">Statement</span>.create( customer_open_invoices,
                    overdue_invoices,
                    really_overdue_invoices )

<span class="Statement">end</span>

<span class="Type">DB</span>.disconnect</code></pre>
<p>The code uses Sequel, which makes working with the horrible fake SQL interface that MYOB provides a little nicer. As usual, I split all the logic up into other models.</p>
<p>Here is my &#8216;models/customer.rb&#8217; file:</p>
<pre><code><span class="Comment"># Customers, this includes both companies and individuals.</span>
<span class="PreProc">require</span> <span class="Special">'</span><span class="Constant">models/sale</span><span class="Special">'</span>
<span class="PreProc">class</span> <span class="Type">Customer</span> &lt; <span class="Type">Sequel</span>::<span class="Type">Model</span>
  set_primary_key <span class="Constant">:CustomerID</span>

  <span class="Comment"># Return all the customers that currently owe us money</span>
  <span class="PreProc">def</span> <span class="Constant">self</span>.<span class="Identifier">with_open_invoices</span>
    <span class="Constant">self</span>.order( <span class="Constant">:name</span> ).filter( <span class="Constant">:currentbalance</span> &gt; <span class="Number">0</span> ).all
  <span class="PreProc">end</span>

  <span class="Comment"># Return the database with this customers sales</span>
  <span class="PreProc">def</span> <span class="Identifier">invoices</span>
    <span class="Type">Sale</span>.order( <span class="Constant">:invoicenumber</span> ).filter( <span class="Constant">:cardrecordid</span> =&gt; <span class="Constant">self</span>[<span class="Constant">:customerid</span>] ).all
  <span class="PreProc">end</span>

  <span class="PreProc">def</span> <span class="Identifier">open_invoices</span>
    <span class="Type">Sale</span>.order( <span class="Constant">:invoicenumber</span> ).filter( <span class="Constant">:cardrecordid</span> =&gt; <span class="Constant">self</span>[<span class="Constant">:customerid</span>] ).and( <span class="Constant">:outstandingbalance</span> &gt; <span class="Number">0</span> ).all
  <span class="PreProc">end</span>

  <span class="Comment"># Get the name, MYOB has 3 name fields, this function will</span>
  <span class="Comment"># return a string of the name as you would expect it on a</span>
  <span class="Comment"># letter</span>
  <span class="PreProc">def</span> <span class="Identifier">name</span>
    <span class="Statement">if</span> <span class="Constant">self</span>[<span class="Constant">:isindividual</span>] == <span class="Special">'</span><span class="Constant">Y</span><span class="Special">'</span>
      <span class="Comment"># Individual customers have a first and last name</span>
      <span class="Statement">return</span> <span class="Special">&quot;</span><span class="Special">#{</span><span class="Constant">self</span>[<span class="Constant">:firstname</span>]<span class="Special">}</span><span class="Constant"> </span><span class="Special">#{</span><span class="Constant">self</span>[<span class="Constant">:lastname</span>]<span class="Special">}</span><span class="Special">&quot;</span>
    <span class="Statement">else</span>
      <span class="Comment"># Company</span>
      <span class="Statement">return</span> <span class="Constant">self</span>[<span class="Constant">:lastname</span>]
    <span class="Statement">end</span>
  <span class="PreProc">end</span>

  <span class="Comment"># Current A/R balance</span>
  <span class="PreProc">def</span> <span class="Identifier">current_balance</span>
    <span class="Constant">self</span>[<span class="Constant">:currentbalance</span>]
  <span class="PreProc">end</span>

  <span class="Comment"># Terms of payment in words</span>
  <span class="PreProc">def</span> <span class="Identifier">terms_in_words</span>
    <span class="Type">Terms</span>.filter( <span class="Constant">:termsid</span> =&gt; <span class="Constant">self</span>[<span class="Constant">:termsid</span>] ).all[<span class="Number">0</span>][<span class="Constant">:termsofpaymentid</span>]
  <span class="PreProc">end</span>
<span class="PreProc">end</span></code></pre>
<p>My sale.rb model:</p>
<pre><code><span class="PreProc">class</span> <span class="Type">Sale</span> &lt; <span class="Type">Sequel</span>::<span class="Type">Model</span>
  set_primary_key <span class="Constant">:SaleID</span>

  <span class="Comment"># This will return invoices that are open</span>
  <span class="PreProc">def</span> <span class="Constant">self</span>.<span class="Identifier">find_open</span>
    <span class="Constant">self</span>.filter( <span class="Constant">:invoicestatusis</span> =&gt; <span class="Special">'</span><span class="Constant">O</span><span class="Special">'</span> ).all
  <span class="PreProc">end</span>

  <span class="Comment"># Check the job class for a description</span>
  <span class="PreProc">def</span> <span class="Identifier">customer</span>
    <span class="Type">Customer</span>.filter( <span class="Constant">:customerid</span> =&gt; <span class="Constant">self</span>[<span class="Constant">:cardrecordid</span>] ).all[<span class="Number">0</span>]
  <span class="PreProc">end</span>

  <span class="Comment"># An invoice is overdue if the current date is greater than the due date</span>
  <span class="PreProc">def</span> <span class="Identifier">overdue?</span>
    <span class="Statement">if</span> <span class="Type">Date</span>.today &gt; <span class="Constant">self</span>.due_date
      <span class="Statement">return</span> <span class="Constant">true</span>
    <span class="Statement">end</span>
    <span class="Statement">return</span> <span class="Constant">false</span>
  <span class="PreProc">end</span>

  <span class="Comment"># An invoice is really overdue when it's 15 days past the due date</span>
  <span class="PreProc">def</span> <span class="Identifier">really_overdue?</span>
    <span class="Statement">if</span> ( <span class="Type">Date</span>.today - <span class="Constant">self</span>.due_date ) &gt; <span class="Number">14</span>
      <span class="Statement">return</span> <span class="Constant">true</span>
    <span class="Statement">end</span>
    <span class="Statement">return</span> <span class="Constant">false</span>
  <span class="PreProc">end</span>

  <span class="PreProc">def</span> <span class="Identifier">invoice_number</span>
    <span class="Constant">self</span>[<span class="Constant">:invoicenumber</span>]
  <span class="PreProc">end</span>

  <span class="PreProc">def</span> <span class="Identifier">purchase_order_number</span>
    <span class="Constant">self</span>[<span class="Constant">:customerponumber</span>]
  <span class="PreProc">end</span>

  <span class="PreProc">def</span> <span class="Identifier">created_at</span>
    <span class="Constant">self</span>[<span class="Constant">:invoicedate</span>]
  <span class="PreProc">end</span>

  <span class="PreProc">def</span> <span class="Identifier">due_date</span>
    <span class="Constant">self</span>[<span class="Constant">:invoicedate</span>] + <span class="Type">Terms</span>.filter( <span class="Constant">:termsid</span> =&gt; <span class="Constant">self</span>[<span class="Constant">:termsid</span>] ).all[<span class="Number">0</span>].balance_due_days
  <span class="PreProc">end</span>

  <span class="PreProc">def</span> <span class="Identifier">outstanding_balance</span>
    <span class="Constant">self</span>[<span class="Constant">:outstandingbalance</span>]
  <span class="PreProc">end</span>

  <span class="PreProc">def</span> <span class="Identifier">interest_charge</span>
    <span class="Statement">return</span> ( <span class="Type">Date</span>.today() + <span class="Number">1</span> - <span class="Constant">self</span>.due_date ) *
        ( <span class="Number">0.0006575</span> * <span class="Constant">self</span>.outstanding_balance )
  <span class="PreProc">end</span>
<span class="PreProc">end</span></code></pre>
<p>Job.rb is very simple:</p>
<pre><code><span class="PreProc">class</span> <span class="Type">Job</span> &lt; <span class="Type">Sequel</span>::<span class="Type">Model</span>
  set_primary_key <span class="Constant">:JobID</span>

  <span class="Comment"># We cannot use the built in Sequel associations, it seems MYOB is</span>
  <span class="Comment"># really picky about it's SQL, or something.</span>

  <span class="Comment"># Query the customer of the job</span>
  <span class="Comment"># MYOB doesn't support the LIMIT SQL command.</span>
  <span class="PreProc">def</span> <span class="Identifier">customer</span>
    <span class="Type">Customer</span>.filter( <span class="Constant">:customerid</span> =&gt; <span class="Constant">self</span>[<span class="Constant">:customerid</span>] ).all[<span class="Number">0</span>]
  <span class="PreProc">end</span>
<span class="PreProc">end</span></code></pre>
<p>Finally the terms.rb file:</p>
<pre><code><span class="PreProc">class</span> <span class="Type">Terms</span> &lt; <span class="Type">Sequel</span>::<span class="Type">Model</span>
  set_primary_key <span class="Constant">:TermsID</span>

  <span class="Comment"># Number of days for when the invoice becomes due.</span>
  <span class="PreProc">def</span> <span class="Identifier">balance_due_days</span>
    <span class="Constant">self</span>[<span class="Constant">:balanceduedays</span>]
  <span class="PreProc">end</span>
<span class="PreProc">end</span></code></pre>
<p>The actual statement generation and logic is done in the &#8216;directcom/statement&#8217; class I wrote up, however that just details how I like statements set up, and with the data provided in the 3 arrays you should be able to write your own code.</p>
]]></content:encoded>
			<wfw:commentRss>http://luminousmonkey.org/?feed=rss2&amp;p=251</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MYOB ODBC with Ruby</title>
		<link>http://luminousmonkey.org/?p=233</link>
		<comments>http://luminousmonkey.org/?p=233#comments</comments>
		<pubDate>Mon, 10 Aug 2009 08:54:37 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[MYOB]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://luminousmonkey.org/?p=233</guid>
		<description><![CDATA[I have previously written on how I was working on automating the invoice system between the sales database I wrote and MYOB.  I do have something written up, however it&#8217;s not code that I would want anyone to see, because I know it&#8217;s not high quality. Anyway, the statements MYOB prints, are, in a word, [...]]]></description>
			<content:encoded><![CDATA[<p>I have <a title="MYOB ODBC" href="/?p=110">previously written</a> on how I was working on automating the invoice system between the sales database I wrote and MYOB.  I do have something written up, however it&#8217;s not code that I would want anyone to see, because I know it&#8217;s not high quality.</p>
<p>Anyway, the statements MYOB prints, are, in a word, crap. So I wanted to write a system that would take the information out of MYOB and generate my own format of statements for either mailing or e-mailing.</p>
<p>Now the problem with MYOB and Rails, or to be correct, the problem with MYOB and ActiveRecord is that MYOB is not a vaild SQL database.  This problem is compounded by the fact that ActiveRecord expects the database schema to be a specific way (this can be changed). ActiveRecord can be nice to work with, however there are cases where it can be a bit of a pain, and this is one of those.</p>
<p>I&#8217;ve had a little play with <a title="Sinatra" href="http://www.sinatrarb.com/">Sinatra</a> and <a title="Sequel Database Library" href="http://sequel.rubyforge.org/">Sequel</a> and this looked like a good chance to give Sequel a try. The statement generator I&#8217;m writing is just something to run, once or twice a month, so it doesn&#8217;t need a web interface.</p>
<p>JRuby is currently my Ruby VM of choice, because I&#8217;ve found the Java integration very useful for printing and faxing for our internal sales application, so I&#8217;ve stuck with that, which, when it comes to MYOB is a good thing.  Why?</p>
<p>As mentioned in my previous post, I had found information on getting MYOB and Rails/Activerecord talking to each other at Pat Allan’s site, <a title="Freelancing Gods" href="http://freelancing-gods.com/posts/talking_to_myob_with_ruby">Freelancing Gods</a>.  The problem is the Rails ODBC driver doesn&#8217;t support MYOB (and I&#8217;m sure MYOB doesn&#8217;t have a 100% correct implementation), so you have to patch some files to get support.</p>
<p>However, JRuby allows you to use JDBC, so I figured that I could use the Java JDBC to connect to the MYOB ODBC driver.  It works, with no patching involved.</p>
<p>Ok, enough of the length explanation, how does it work?</p>
<p>First, get and install <a title="JRuby Homepage" href="http://jruby.codehaus.org/">JRuby</a>.</p>
<p>At the moment I&#8217;m using JRuby1.3.1, and I download the jruby-bin-1.3.1.zip file.  I&#8217;m going to assume you know how to get JRuby installed, and in your command path.</p>
<p>With that done, start up your command shell (I use Windows Powershell), and install the following gems:</p>
<ul>
<li>jruby-openssl</li>
<li>sequel</li>
</ul>
<p>That&#8217;s it! Next, you need to set up your MYOB ODBC datasource, again, I&#8217;m going to assume if you&#8217;re looking up this information then you know how.  There&#8217;s one thing however, if, like me, you&#8217;re using the 64bit version of Windows Vista, you need to run:</p>
<pre><code>C:\Windows\SysWOW64\odbcad32.exe</code></pre>
<p>Otherwise it will only list the MS SQL OSBC drivers.</p>
<p>With that done, we can then load up jirb and play with the database. Or you can write the following file and run it.</p>
<pre><code><span class="PreProc">require</span> <span class="Special">'</span><span class="Constant">rubygems</span><span class="Special">'</span>
<span class="PreProc">require</span> <span class="Special">'</span><span class="Constant">sequel</span><span class="Special">'</span>

<span class="Comment">#Setup the database connection</span>
<span class="Type">DB</span> = <span class="Type">Sequel</span>.connect( <span class="Special">'</span><span class="Constant">jdbc:odbc:MYOBTest</span><span class="Special">'</span> )

customer = <span class="Type">DB</span>[<span class="Constant">:customers</span>].all[<span class="Number">0</span>]

puts customer[<span class="Constant">:name</span>]

<span class="Type">DB</span>.disconnect</code></pre>
<p>Don&#8217;t forget the disconnect, otherwise JRuby will crash when you exit.</p>
<p>If you&#8217;re familar with Sequel, you might wonder why I do the bad thing, and go:</p>
<pre><code><span class="Type">DB</span>[<span class="Constant">:customers</span>].all[<span class="Number">0</span>]</code></pre>
<p>rather than:</p>
<pre><code><span class="Type">DB</span>[<span class="Constant">:customers</span>].first</code></pre>
<p>This problem is that the MYOB ODBC driver will complain about the SQL statement generated, best I can guess is that it doesn&#8217;t support the SQL option LIMIT.</p>
<p>Anyway, that&#8217;s it for now.</p>
]]></content:encoded>
			<wfw:commentRss>http://luminousmonkey.org/?feed=rss2&amp;p=233</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Coming Soon&#8230;</title>
		<link>http://luminousmonkey.org/?p=222</link>
		<comments>http://luminousmonkey.org/?p=222#comments</comments>
		<pubDate>Wed, 18 Mar 2009 07:33:46 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Solaris]]></category>

		<guid isPermaLink="false">http://luminousmonkey.org/?p=222</guid>
		<description><![CDATA[Well, our work OpenSolaris server has been giving me the shits.  After going down mysteriously I had to do a quick swapover job (basically I took the 3 drives out of it and plonked it into the new machine I had ready for the boss (quick note, it worked straight away, I was really surprised.)). [...]]]></description>
			<content:encoded><![CDATA[<p>Well, our work OpenSolaris server has been giving me the shits.  After going down mysteriously I had to do a quick swapover job (basically I took the 3 drives out of it and plonked it into the new machine I had ready for the boss (quick note, it worked straight away, I was really surprised.)).</p>
<p>I decided I&#8217;ve had enough with building my own servers, seems to be that I had a few problems with hardware recently, in particular, RAM.  The sudden loss of our e-mail server was enough motivation for me to get permission to spend some cash on a proper server.</p>
<p>Since (Open)Solaris is currently my OS interest at the moment, I figured I would check out what they&#8217;re offering, basically we&#8217;re a small business, we don&#8217;t need, and can&#8217;t afford something too hardcore.  My choice came down to either the <a title="Sun Fire X2200 M2" href="http://au.sun.com/products/x64/x2200m2.jsp">Sun Fire X2200 M2</a>, or the <a title="Sun Fire X2250" href="http://au.sun.com/products/x64/x2250.jsp">Sun Fire X2250</a>.  They&#8217;re the same price (currently AUD $2,350.00), so I basically went with X2250 because it&#8217;s faster (I think).</p>
<p>So now I&#8217;m waiting for it to arrive (via Sun&#8217;s Try &amp; Buy trial offer), when it arrives I&#8217;ll try and give a &#8220;review&#8221;.  I say &#8220;review&#8221;, but honestly it&#8217;s just going to be what I think about it, and this is my first (and probably only) proper server purchase, so don&#8217;t actually use it to make a decision.</p>
<p>Of course, if you are deciding on new server hardware, and like myself, this is your first time, keep in mind that these server boxes are pretty deep.  We had to purchase a new rack that was 1000mm deep, as the server is 633mm deep.</p>
]]></content:encoded>
			<wfw:commentRss>http://luminousmonkey.org/?feed=rss2&amp;p=222</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recent thoughts on religion and politics</title>
		<link>http://luminousmonkey.org/?p=219</link>
		<comments>http://luminousmonkey.org/?p=219#comments</comments>
		<pubDate>Fri, 27 Feb 2009 10:00:00 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://luminousmonkey.org/?p=219</guid>
		<description><![CDATA[Ask me what my religion was, hmm, say about two months ago.  I would have said &#8220;Agnostic&#8221;, however, I&#8217;ve recently been thinking about my views on religion.  I really can&#8217;t remember what made me start thinking about it, I think it was a YouTube clip, anyway, that&#8217;s not important. As a result, I&#8217;ve read &#8220;The [...]]]></description>
			<content:encoded><![CDATA[<p>Ask me what my religion was, hmm, say about two months ago.  I would have said &#8220;Agnostic&#8221;, however, I&#8217;ve recently been thinking about my views on religion.  I really can&#8217;t remember what made me start thinking about it, I think it was a YouTube clip, anyway, that&#8217;s not important.</p>
<p>As a result, I&#8217;ve read &#8220;The Blind Watchmaker&#8221; by Richard Dawkins, followed by &#8220;God is NOT Great&#8221;, by Christopher Hitchens.  I&#8217;ve managed to get hold of &#8220;Enemies of Reason&#8221;, and &#8220;The Root of Evil&#8221;, documentatries by Dawkins.  And again, I&#8217;ve been following athiest channels on YouTube.</p>
<p>My views have gone from &#8220;Agnostic&#8221; (which would have been more correct to say that I was an agnostic athiest, as I&#8217;ve never really believed in God), to athiest, to anti-thiest.  This is largely due to my reading of Hitchens, a point of view that had recently been firmly resolved by the recent bushfires in Victoria.</p>
<p>How? Simply, because a <a title="Catch the Fire - Sick fucks" href="http://catchthefire.com.au/blog/2009/02/10/media-release-abortion-laws-to-blame-for-bush-fires/" target="_self">ministry in Victoria proposed that abortion laws are the reason why God started the bushfires</a>, and recently Fred Phelps has said that the <a title="Fred Phelps - Sick Fuck" href="http://www.youtube.com/watch?v=QkjBEE5ugaQ" target="_self">fires are send by God to punish Australia</a>.  These are but two recent examples of how the religious will try to use fear of God as a means to push their agenda.</p>
<p>Now you may think, &#8220;These guys are pretty fucked up, but, well, it doesn&#8217;t really affect me&#8221;, and you may be right, for now.  The thing is, and what I&#8217;ve been starting to notice, is that this religious shit does affect us, there is a religious agenda out there that is trying to establish a control on the population.</p>
<p>For example, take the UN, there has been a resolution, that aims to <a title="Defamation of religion illegal" href="http://www.canada.com/topics/news/world/story.html?id=9b8e3a6d-795d-440f-a5de-6ff6e78c78d5" target="_self">make defamation of religion illegal</a>.  This is pretty old news, from November I think, however I believe at this stage, it&#8217;s optional.  Australia voted against it, as they should,  Australia is a secular government.  However, you can see the obvious attack on free speech here, something which you can&#8217;t allow a compromise on.  It&#8217;s a point that I am, unfortunately, not eloquient enough to present an argument for.  However, again, <a title="Hitchens on free expression" href="http://video.google.com/videoplay?docid=6379618149058958603" target="_self">Hitchens provides a wonderful speech on from June 2007</a> on free expression.</p>
<p>Unfortunately, I simply do not know how much free speech we have in Australia, but I think that this is something America has right.  All speech should unrestricted, even the fucked up shit like hate speech, because once you make a distinction between what is allowed, and what is not allowed, then you open a door, ever so slightly, for more speech to be policed.</p>
<p>Anyway, here&#8217;s some links that I suggest people to check out:</p>
<p><a title="Pharyngula" href="http://scienceblogs.com/pharyngula/" target="_blank">Pharyngula</a><br />
<a title="Refuting Atheistic Naturalism" href="http://www.youtube.com/watch?v=ALrA59-PhI4" target="_self">Refuting Atheistic Naturalism Episode 2</a> (This kid is like 14!)</p>
<p>Check out the videos by these guys on YouTube:<br />
<a title="Thunderf00t" href="http://www.youtube.com/user/Thunderf00t" target="_self">Thunderf00t</a><br />
<a title="AronRa" href="http://www.youtube.com/user/AronRa" target="_self">AronRa<br />
</a><br />
<a title="AndromedasWake" href="http://www.youtube.com/user/AndromedasWake" target="_self">AndromedasWake</a><br />
<a title="DonExodus2" href="http://www.youtube.com/user/DonExodus2" target="_self">DonExodus2</a><br />
<a title="cdk007" href="http://www.youtube.com/user/cdk007" target="_self">cdk007</a><br />
<a title="patcondell" href="http://www.youtube.com/user/patcondell">patcondell</a><br />
<a title="The Amazing Athiest" href="http://www.youtube.com/user/TheAmazingAtheist" target="_self">TheAmazingAthiest</a><br />
<a href="http://www.youtube.com/user/C0ct0pus" target="_self">C0ct0pus</a></p>
]]></content:encoded>
			<wfw:commentRss>http://luminousmonkey.org/?feed=rss2&amp;p=219</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>New Zealand, part 1</title>
		<link>http://luminousmonkey.org/?p=202</link>
		<comments>http://luminousmonkey.org/?p=202#comments</comments>
		<pubDate>Fri, 14 Nov 2008 03:41:41 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://luminousmonkey.org/?p=202</guid>
		<description><![CDATA[8th November Well, the flight was a bit of an endurance.  Starting at about 10pm Friday night (the 7th) and finishing on Saturday at 2pm Christchurch time.  For those (like me) that have to sit down and do the math, that&#8217;s about 10 hours, of course, flying took only about 5 hours.  The rest of [...]]]></description>
			<content:encoded><![CDATA[<p>8th November<br />
Well, the flight was a bit of an endurance.  Starting at about 10pm Friday night (the 7th) and finishing on Saturday at 2pm Christchurch time.  For those (like me) that have to sit down and do the math, that&#8217;s about 10 hours, of course, flying took only about 5 hours.  The rest of the time was taken up by waiting, or getting ready to fly out.</p>
<p>We didn&#8217;t get to sleep until 8pm, so that means we were up about, hmmm, lets see, 6am Friday to 4pm Saturday, so that&#8217;s about 22 hours without sleep.  I was half expecting to see fairys fly off the top of door frames, or non-existant kittens jumping out of peoples laps, thanks to sleep deprevation.  We were saved by my Aunty and Uncle, who, are excellent hosts.</p>
<p>9th November<br />
After a much needed 12 hour kip, we were refreshed and ready to go looking about Christchurch, with my cousin, nothing too major, just a quick look through the markets and a few shops.</p>
]]></content:encoded>
			<wfw:commentRss>http://luminousmonkey.org/?feed=rss2&amp;p=202</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.379 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2010-09-05 11:31:23 -->
