<?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>Docile Tree &#187; Sysadmin</title>
	<atom:link href="http://www.dociletree.co.za/cat/sysadmin/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dociletree.co.za</link>
	<description>Aubrey Kilian explains, rants and raves</description>
	<lastBuildDate>Thu, 08 Jul 2010 08:50:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>MSSQL and ON UPDATE</title>
		<link>http://www.dociletree.co.za/mssql-and-on-update/</link>
		<comments>http://www.dociletree.co.za/mssql-and-on-update/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 09:17:15 +0000</pubDate>
		<dc:creator>aubrey</dc:creator>
				<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[mssql]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.dociletree.co.za/?p=170</guid>
		<description><![CDATA[I had to add a column to a database table on an MSSQL server today. It had to have the most recent update/insert time that the row was inserted/updated. MySQL has a very easy way of doing this with a TIMESTAMP column type, with a DEFAULT value of CURRENT_TIMESTAMP, and then also an additional ON &#8230; </p><p><a class="more-link block-button" href="http://www.dociletree.co.za/mssql-and-on-update/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>I had to add a column to a database table on an MSSQL server today.  It had to have the most recent update/insert time that the row was inserted/updated.  MySQL has a very easy way of doing this with a TIMESTAMP column type, with a DEFAULT value of CURRENT_TIMESTAMP, and then also an additional ON UPDATE CURRENT_TIMESTAMP clause in the column definition to auto-update the value when the row is updated.<br />
So I thought that if MySQL could do it, so should MSSQL be able too, right?  Wrong.  I&#8217;m not expert in MSSQL, I know MySQL fairly well, so my first surprise was to find out that the <a href="http://msdn.microsoft.com/en-us/library/aa260631(SQL.80).aspx">TIMESTAMP column type in MSSQL</a> is *so* not the same as in MySQL, and in fact is rather completely useless in this example.</p>
<p>The solution turned out to be external to the table definition, by using a trigger.<br />
So here&#8217;s how you update a column in your table with the current time whenever that row is update.  I&#8217;m assuming you know your way around MSSQL and it&#8217;s multitudes of tools available, so I won&#8217;t be giving you screenshots.</p>
<p>First, add a column to your table as either a DATETIME or SMALLDATETIME, make the default value be: <code>(GETDATE())</code><br />
The default value takes care of setting the value of the column to the current date/time when a new record is inserted.</p>
<p>Then, add a trigger onto your table, that looks similar to this:</p>
<blockquote><p>CREATE TRIGGER trg_updateLastUpdated ON [dbo].[your_table_name]<br />
FOR UPDATE<br />
AS<br />
if not update(last_updated)<br />
UPDATE your_table_name<br />
SET last_updated = GETDATE()<br />
FROM your_table_name<br />
INNER JOIN Inserted<br />
ON your_table_name.unique_id = Inserted.unique_id</p></blockquote>
<p>And that&#8217;s that.  The trigger makes sure to check that it&#8217;s not the last_updated column&#8217;s UPDATE that triggers the trigger, as without it, it will cause some nasty recursion to happen.<br />
Your INNER JOIN can be on multiple columns too, if you have more than one column that is required to uniquely identify the single row that you&#8217;re updating.</p>
<p>Yes, you could probably update the last_updated column&#8217;s value from within whatever code you&#8217;ve got, that is an alternative, depending on exactly what you use that column for.<br />
Anyway, this solution worked for me.  Did it work for you?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dociletree.co.za/mssql-and-on-update/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Hoops in the Air -OR- How I managed to upgrade Adobe Air to Version 1.5 on Ubuntu 8.10 and still get to use my favourite Air applications</title>
		<link>http://www.dociletree.co.za/hoops-in-the-air-or-how-i-managed-to-upgrade-adobe-air-to-version-15-on-ubuntu-8-10/</link>
		<comments>http://www.dociletree.co.za/hoops-in-the-air-or-how-i-managed-to-upgrade-adobe-air-to-version-15-on-ubuntu-8-10/#comments</comments>
		<pubDate>Tue, 30 Dec 2008 06:57:17 +0000</pubDate>
		<dc:creator>aubrey</dc:creator>
				<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[adobe air]]></category>
		<category><![CDATA[air]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[twhirl]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.dociletree.co.za/?p=135</guid>
		<description><![CDATA[UPDATE: I recently had issues with Air and Twhirl again, and thanks to @smmehadi I found there was two steps I didn&#8217;t do to *completely* get rid of all traces of Air. I added that step into the list below. For reference, here&#8217;s the official Adobe Air Linux troubleshooting page. Adobe recently released the final &#8230; </p><p><a class="more-link block-button" href="http://www.dociletree.co.za/hoops-in-the-air-or-how-i-managed-to-upgrade-adobe-air-to-version-15-on-ubuntu-8-10/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.dociletree.co.za/wp-content/uploads/2008/12/adobeairbadge.jpg" alt="Adobe Air" title="adobeairbadge" width="160" height="60" style="float:right" class="size-full wp-image-141" /><strong>UPDATE: </strong> I recently had issues with Air and Twhirl again, and thanks to <a href="http://twitter.com/smmehadi">@smmehadi</a> I found there was two steps I didn&#8217;t do to *completely* get rid of all traces of Air.  I added that step into the list below.  For reference, here&#8217;s the official <a href="http://blogs.adobe.com/air/2008/12/tips_on_resolving_application.html">Adobe Air Linux troubleshooting page</a>.</p>
<p>Adobe recently released the final version of their <a href="http://blogs.adobe.com/air/2008/12/adobe_air_15_now_available_for.html">Adobe Air 1.5 desktop web application framework for Linux</a>.  It was a great day, and a lot of people immediately upgraded.  Problems occurred immediately when people tried to run or upgrade their Air applications, and found Air was complaining about damaged applications or .air files.<br />
I had the same, I couldn&#8217;t install the latest version of <a href="http://www.twhirl.org/">Twhirl</a>, my number one choice for <a href="http://www.twitter.com/">Twitter</a> client.  After several attempts and to-ing and fro-ing on Google and reading forums and even bitching about it on Twitter, I finally managed to get Twhirl running on Ubuntu, using Adobe Air 1.5<br />
Here&#8217;s how I did it using Ubuntu (<a href="http://en.wiktionary.org/wiki/your_mileage_may_vary">YMMV</a>):</p>
<ul>
<li>Firstly, to make 100% that you&#8217;re going to succeed here, make peace with the fact that you&#8217;re going to have to reconfigure whatever Air applications you had.</li>
<li>Update your system&#8217;s repositories to the latest by running &#8220;sudo apt-get update&#8221; and then &#8220;sudo apt-get dist-upgrade&#8221;</li>
<li>Uninstall Adobe Air.  There&#8217;s an uninstall option on your Applications menu.</li>
<li>Delete any Air applications you may have installed, they usually reside in /opt/ on the disk.</li>
<li>Delete your ~/.appdata/ folder</li>
<li>Delete your ~/.adobe/AIR folder &#8211; <strong>NEW STEP</strong></li>
<li>Delete your ~/.macromedia/Flash_Player/www.macromedia.com/bin/air* folders &#8211; <strong>NEW STEP</strong></li>
<li>Make sure there is no /opt/Adobe/ folder, delete it if it&#8217;s there.</li>
<li>Run &#8220;sudo apt-get autoremove adobeair1.0&#8243; in a Terminal window.<br />
This will likely moan about packages having unmet dependencies.  This is fine.</li>
<li>Run &#8220;sudo apt-get -f install&#8221;, this will list the Adobe Air applications you remove in a previous step here, press Enter to allow Apt to clean up the files.</li>
<li>Your system should now be suitably void of all Adobe Air traces.</li>
<li>Head to <a href="http://get.adobe.com/air/">http://get.adobe.com/air/</a> and download the <strong>AdobeAIRInstaller.bin</strong> file.</li>
<li>In a Terminal window, make the file executable by running &#8220;chmod +x AdobeAIRInstaller.bin&#8221; in a Terminal window</li>
<li>Run the file with &#8220;./AdobeAIRInstaller.bin&#8221; or double-click the file in your Nautilus/File Browser window<br />
This will install the base Adobe Air 1.5 framework</li>
<li>After Air is finished installing, you need to make sure you have the latest Adobe Flash plugin installed.  In a Terminal window, run this &#8220;sudo apt-get install flashplugin-nonfree&#8221;</li>
<li>You are now ready to install your favourite Air applications.  I installed Twhirl.</li>
<li>Head to <a href="http://www.twhirl.org/">www.twhirl.org</a> &#8211; Notice that, as of writing, the Twhirl guys made a special Linux build of the Twhirl client (Currently it is here <a href="http://www.twhirl.org/files/twhirl-0.8.7-air11.air">http://www.twhirl.org/files/twhirl-0.8.7-air11.air</a>)</li>
<li>Allow Air to Open and install the application</li>
</ul>
<p>And that&#8217;s it, it might seem like many steps, but really, it&#8217;s just a simple way of cleansing your system from any unwanted Air leftovers of previous installations, and installing the latest version of Air and your favourite Air applications.<br />
It&#8217;s worth noting too, that this seems to only affect currently installed Air applications.  Any new applications that I installed after upgrading to Air 1.5 seemed to work just fine, so it seemed to have something to do with either leftover config files, or application files, or possibly the way Adobe Air interfaces with the Apt package management setup.  I have a suspicion it&#8217;s the latter, but I don&#8217;t know the system well enough to provide proof.  But at least what I did above worked.  <img src='http://www.dociletree.co.za/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.dociletree.co.za/hoops-in-the-air-or-how-i-managed-to-upgrade-adobe-air-to-version-15-on-ubuntu-8-10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing Windows MBR with Ubuntu 8.04.1 Live-CD</title>
		<link>http://www.dociletree.co.za/fixing-windows-mbr-with-ubuntu-8041-live-cd/</link>
		<comments>http://www.dociletree.co.za/fixing-windows-mbr-with-ubuntu-8041-live-cd/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 08:37:44 +0000</pubDate>
		<dc:creator>aubrey</dc:creator>
				<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[mbr]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.dociletree.co.za/?p=56</guid>
		<description><![CDATA[UPDATE: This works on Ubuntu 8.10 Live-CD too, just boot the livecd and execute the install-mbr command I&#8217;ve fixed MBRs before, using both the Windows install CD, and also using grub from an Ubuntu Live-CD. Today, neither of these worked on an HP 6710b laptop, where an Ubuntu partition (which contained grub) was removed (In &#8230; </p><p><a class="more-link block-button" href="http://www.dociletree.co.za/fixing-windows-mbr-with-ubuntu-8041-live-cd/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<p><strong>UPDATE: This works on Ubuntu 8.10 Live-CD too, just boot the livecd and execute the install-mbr command</strong></p>
<p>I&#8217;ve fixed MBRs before, using both the Windows install CD, and also using grub from an Ubuntu Live-CD.  Today, neither of these worked on an HP 6710b laptop, where an Ubuntu partition (which contained grub) was removed (In favour of running Ubuntu inside <a href="http://www.virtuabox.de/">Virtualbox</a>).  The Windows XP Professional CD didn&#8217;t detect any harddrives to fix, and grub kept on giving a &#8220;That is not a valid block device&#8221; error.</p>
<p>Many Google search results later, I found an <a href="http://www.arsgeek.com/2008/01/15/how-to-fix-your-windows-mbr-with-an-ubuntu-livecd/">article on arsgeek</a> that showed how to use an Ubuntu package called <strong>ms-sys</strong> to put the MBR back.  Boot the CD, add the universe repository, apt-get update, install ms-sys, run ms-sys.  Sounded simple.  After waiting for the update to happen, I finally try to install ms-sys, to no avail.</p>
<p>More Google search results, and it turns out that <a href="https://answers.launchpad.net/ubuntu/+source/ms-sys/+question/28349">ms-sys was removed</a> from Debian Unstable, and thus removed from Ubuntu Hardy&#8217;s repositories, due to &#8220;Unresolved licensing issues&#8221;.</p>
<p>Luckily, a comment on the <a href="https://bugs.launchpad.net/unetbootin/+bug/218914">bug entry</a> asking why ms-sys was removed, pointed me to the <strong>mbr</strong> Ubuntu package that provides the same functionality as ms-sys.</p>
<p>So, how *does* one fix a Windows MBR with an Ubuntu 8.04.1 Live-CD?  Simple (Works with older Live-CDs too, from Dapper onwards):</p>
<ul>
<li>Boot from the Live-CD</li>
<li>Open up a Terminal and run: sudo vi /etc/apt/sources.list<br />And uncomment the 6 &#8216;universe&#8217; repositories at the bottom</li>
<li>Run: sudo apt-get update<br />to update the local repositories</li>
<li>Run: apt-get install mbr<br />to install the mbr package</li>
<li>Run: install-mbr <em>/dev/sda</em><br />where <em>/dev/sda</em> is your primary boot drive<br />This installs a default MBR to that drive</li>
</ul>
<p>Easy.<br />
Reboot and you&#8217;re set.<br />
No hassling with grub or lilo or dd&#8217;ing some dodgy MBR downloaded from some site.<br />
Yet another example of how Ubuntu saved some other commercial OS from destruction.  (Previously Ubuntu helped me save a SUSE 10 machine&#8217;s harddrive&#8230;)</p>
<p>Pity about having to update to the universe repositories first, the mbr package really should be part of the live cd.<br />
<script type="text/javascript"><!--
google_ad_client = "pub-5340065287056754";
google_ad_slot = "1550825432";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dociletree.co.za/fixing-windows-mbr-with-ubuntu-8041-live-cd/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Perl, FreeTDS and Cron issues</title>
		<link>http://www.dociletree.co.za/perl-freetds-and-cron-issues/</link>
		<comments>http://www.dociletree.co.za/perl-freetds-and-cron-issues/#comments</comments>
		<pubDate>Fri, 11 Apr 2008 13:48:31 +0000</pubDate>
		<dc:creator>aubrey</dc:creator>
				<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[dbd]]></category>
		<category><![CDATA[freetds]]></category>
		<category><![CDATA[mssql]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://www.dociletree.co.za/?p=9</guid>
		<description><![CDATA[While converting some dodgy nagios-commands into cron scripts today, I came across an age-old issue when scheduling the final script in cron: The script works perfectly when running it on the command-line, but fails miserably when cron runs it. The usual answer here is &#8220;Check the environment variables&#8221;. The error I was getting was from &#8230; </p><p><a class="more-link block-button" href="http://www.dociletree.co.za/perl-freetds-and-cron-issues/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>While converting some dodgy nagios-commands into cron scripts today, I came across an age-old issue when scheduling the final script in cron:  The script works perfectly when running it on the command-line, but fails miserably when cron runs it.</p>
<p>The usual answer here is &#8220;Check the environment variables&#8221;.</p>
<p>The error I was getting was from perl&#8217;s DBD library when trying to connect to the MSSQL database:</p>
<blockquote><p>failed: (DBD: dbd_db_login/SQLSetConnectOption err=-2)</p></blockquote>
<p>Hunting around I wasn&#8217;t 100% sure what environment variables I needed.<br />
Turns out we&#8217;re using <a href="http://www.freetds.org/">FreeTDS</a> to get Linux to talk to an MSSQL server.</p>
<p>I tried several of the environment variables I found in my shell&#8217;s environment, and a mix of several, and as it turns out I was missing only one:</p>
<blockquote><p>PERL_DL_NONLAZY=1</p></blockquote>
<p>Seems the previous Windows Admin Guy came across the same problem, didn&#8217;t document it anywhere, but did add the variable to the Linux machine&#8217;s global profile.  This worked while Nagios was calling the perl-script, but cron runs with a nice clean environment, so didn&#8217;t help there.<br />
So just export the PERL_DL_NONLAZY variable before you run your perl-script, and voila, there it is.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dociletree.co.za/perl-freetds-and-cron-issues/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

