<?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>Sam Moffatt @ Pasamio.com &#187; programming</title>
	<atom:link href="http://pasamio.com/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://pasamio.com</link>
	<description>Sam Moffatt's Tech Blog: Writings on Technology</description>
	<lastBuildDate>Sat, 17 Mar 2012 03:24:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>ePrints Author ID</title>
		<link>http://pasamio.com/2009/08/28/eprints-author-id/</link>
		<comments>http://pasamio.com/2009/08/28/eprints-author-id/#comments</comments>
		<pubDate>Fri, 28 Aug 2009 10:47:03 +0000</pubDate>
		<dc:creator>pasamio</dc:creator>
				<category><![CDATA[eprints]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[university]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://pasamio.com/?p=560</guid>
		<description><![CDATA[One of the things I&#8217;ve been working on over the last month is the ability to create distinct and unique author identifiers for ePrints. ePrint&#8217;s is a really awesome Perl based repository that the University uses to handle its research papers but whilst it is great at handling ePrints, documents, users and a whole host [...]]]></description>
			<content:encoded><![CDATA[<p>One of the things I&#8217;ve been working on over the last month is the ability to create distinct and unique author identifiers for ePrints. ePrint&#8217;s is a really awesome Perl based repository that the University uses to handle its research papers but whilst it is great at handling ePrints, documents, users and a whole host of other things it really falls over when you try to treat authors as individuals.</p>
<p><span id="more-560"></span>Currently ePrints lists authors by using the creator field of an ePrint. This is usually entered as the cited name of the author. If you have a small number of authors with different names this works reasonably well as the system can differentiate between people without much issues. The problem comes in when people are cited differently or have very similar names but are distinct people. Then it becomes bad.</p>
<p>One way of solving the problem is really quite ugly: you go through and change the cited author to make it look &#8220;neater&#8221;. In fact one of our library staff decided that they would do that greatly damaging the value of the data stored with in the system, tainting it horribly and creating more work for themselves. The cynic in me wonders that they&#8217;re just creating more work for themselves later to go back through and fix it all up. So there is a solution, non technical and pretty ordinary.</p>
<p>So our solution was to turn authors into a first class data set within ePrints. They&#8217;re not some unidentifiable free text field with no great purpose (there was a creator ID field but email address was suggested to be used for it) but in fact they are now their own entity which is cool.</p>
<p>We&#8217;ve done some different stuff with the author ID project at USQ that I&#8217;d like to share:</p>
<div>
<dl id="attachment_564" style="text-align: center; background-color: #f3f3f3; padding-top: 4px; -webkit-border-top-right-radius: 3px 3px; -webkit-border-top-left-radius: 3px 3px; -webkit-border-bottom-left-radius: 3px 3px; -webkit-border-bottom-right-radius: 3px 3px; width: 264px; margin: 10px; border: 1px solid #dddddd;">
<dt><a href="http://pasamio.com/wp-content/uploads/2009/08/authorid-authoredit.png"><img style="padding: 0px; margin: 0px; border: 0px none initial;" title="Author ID - Author Editing Screen" src="http://pasamio.com/wp-content/uploads/2009/08/authorid-authoredit-254x300.png" alt="This screen depicts the edit view for an author." width="254" height="300" /></a></dt>
<dd style="font-size: 11px; line-height: 17px; padding-top: 0px; padding-right: 4px; padding-bottom: 5px; padding-left: 4px; margin: 0px;">This screen depicts the edit view for an author.</dd>
<div><span style="font-size: small;"><span style="line-height: 17px;"><br />
</span></span></div>
</dl>
</div>
<p>So an author has a name, they can be linked back to a user ID, they have an email address (both primary email address which should be used for contact and alternate addresses for aiding search), a biography and external identifiers. A cool feature of the primary email address is that when it is updated it automatically gets copied to the alternate email address list,  so you can easily update an email address and still retain the old one (you can still remove them from the alternate email address easily). The external identifiers section provides the ability to list useful identifiers for the author that mean something outside of ePrints. This could be stuff like a staff or student number that you record against the author to help with recognising your users. This is also a new field type developed called &#8216;Name-Value&#8217; to represent name value pairs of data and provide an editing interface.</p>
<p>But the problem with authors is that they don&#8217;t stay the same: they&#8217;re dynamic. So they might move around an organisation, shift faculties, join a research centre or even leave the organisation. Recording this in the author record is more than possible but it starts to get messy &#8211; we start talking about &#8216;versions&#8217; of the author but versions imply the wrong concept. A researcher might be working on papers in two different faculties, each paying for his time and each deserving of recognition. In our case we also need to use that information for reporting so that we can properly allocate funds based on research outcomes as well &#8211; for us it is important to know who paid for the research.</p>
<p>So to solve this problem I created a system called &#8220;author instances&#8221;. Author instances provide a subrecord of the authors that permits instances of specific data to be created and associated with the author. Then when an author creates a paper a link is created to this instance and not directly to the author. This allows the author record to contain information that is relatively static and data that might periodically change (such as department or even which institution someone is at) is then located in the author instance. As this isn&#8217;t &#8216;versioning&#8217; per se it also works well for when a researcher is concurrently producing papers for different parts of the institution (or even for bodies external to the institution).</p>
<div id="attachment_565" class="wp-caption alignnone" style="width: 310px"><a href="http://pasamio.com/wp-content/uploads/2009/08/authorid-authorinstance_edit.png"><img class="size-medium wp-image-565" title="Author ID - Editing an Author Instance" src="http://pasamio.com/wp-content/uploads/2009/08/authorid-authorinstance_edit-300x168.png" alt="This screen depicts the edit view for an author instance." width="300" height="168" /></a><p class="wp-caption-text">This screen depicts the edit view for an author instance.</p></div>
<p>The author instance is very light by default, it only contains the author that it is linked to, its display name and a preferred flag. The preferred flag is mutually exclusive within author instances &#8211; if one instance for an author sets the flag then it is cleared for all other authors. In the screen shot you will notice an untranslated field called &#8220;deptid&#8221;. This is another new metafield that has been developed called &#8220;Externalitemref&#8221; which is similar to the built in ItemRef field however it works on tables managed outside of ePrints. ExternalItemRef takes the params of a table name, a key field and a name field to operate in a similar manner to the ItemRef and link data back in.</p>
<p>The observant will notice that both the ExternalItemRef and the built-in ItemRef field also have a find entry button. This button has also been added to the ePrint item editing screen as well and triggers a popup window which allows easy searching for the particular item (user, author, author instance) that you are interested in.</p>
<div id="attachment_566" class="wp-caption alignnone" style="width: 310px"><a href="http://pasamio.com/wp-content/uploads/2009/08/authorid-eprint_edit_w-popup.png"><img class="size-medium wp-image-566" title="Author ID - ePrints Edit View with Instance selector popup" src="http://pasamio.com/wp-content/uploads/2009/08/authorid-eprint_edit_w-popup-300x104.png" alt="The standard ePrints creator fields have a &quot;Find Entry&quot; button as well." width="300" height="104" /></a><p class="wp-caption-text">The standard ePrints creator fields have a &quot;Find Entry&quot; button as well.</p></div>
<p>So as we can see there is now a &#8220;Find Entry&#8221; button that pops up with a new window allowing us to select an author instance for this author easily and not have to worry that we&#8217;re going to mistype their email address or similar.</p>
<p>This is just a quick introduction into some of the changes that the Author ID system which USQ has developed provides. Ideally we&#8217;d love to feed this back to the ePrints core so that everyone can use this, or a similar system, in a great way. If you want to read more you can check out the &#8220;<a title="Author ID Notes" href="http://sammoffatt.com.au/kb-downloads/doc/3/raw">Author ID Notes</a>&#8221; document on my <a title="Sam Moffatt Consulting Knowledge Base Downloads" href="http://sammoffatt.com.au/kb-downloads">knowledge base download site</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://pasamio.com/2009/08/28/eprints-author-id/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Putting Token Login to work</title>
		<link>http://pasamio.com/2009/02/22/putting-token-login-to-work/</link>
		<comments>http://pasamio.com/2009/02/22/putting-token-login-to-work/#comments</comments>
		<pubDate>Sun, 22 Feb 2009 09:07:00 +0000</pubDate>
		<dc:creator>pasamio</dc:creator>
				<category><![CDATA[authentication]]></category>
		<category><![CDATA[identity]]></category>
		<category><![CDATA[integration]]></category>
		<category><![CDATA[jauthtools]]></category>
		<category><![CDATA[joomla]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://pasamio.com/?p=272</guid>
		<description><![CDATA[So a few weeks ago I released JAuthTools 1.5.4 which features Token Login. Token Login was created to solve the need to generate a secure token that you can use for automatic login, for example with stuff like newsletters. Today I&#8217;m going to show you how you can write something simple with Token Login to [...]]]></description>
			<content:encoded><![CDATA[<p>So a few weeks ago I released JAuthTools 1.5.4 which features Token Login. Token Login was created to solve the need to generate a secure token that you can use for automatic login, for example with stuff like newsletters. Today I&#8217;m going to show you how you can write something simple with Token Login to handle automatic login with tokens in a unique problem case.<br />
<span id="more-272"></span><br />
The other day on the JAuthTools mailing list there was an email of a weird case where the user&#8217;s session was being created initially with the SSO system but as soon as they clicked around it appeared like they logged out. With a bit of work we managed to work out the initial hit was proxied and the session was being created for the proxy not for the actual user. So initially the user was being successfully authenticated which gave me an idea.</p>
<p>My solution was to use token login to handle the actual request. The process is a tad convoluted, but the diagram should explain how the system works:<br />
<a href="http://pasamio.com/wp-content/uploads/2009/02/tokenlogin-sample.png"><img src="http://pasamio.com/wp-content/uploads/2009/02/tokenlogin-sample-143x300.png" alt="" title="Workflow Diagram" width="143" height="300" class="alignnone size-medium wp-image-273" /></a><br />
So the user logs into a remote service, which proxies a username to the Joomla! which is picked up by SSO HTTP in a custom component which generates a token using the detected username, redirects the user to the token login component (not through the proxy) which then lets the user log in and continue through the site.</p>
<p>So what we need to create is a new component to handle detecting the user, creating the token and them redirecting them. We can use the SSO HTTP plugin to handle detecting the remote user perfectly fine (this has already been tested) and the Token Login component can handle validating tokens and redirecting users.</p>
<p><strong>Step 1: Prerequisites</strong><br />
I&#8217;m going to use the JAuthTools packages available from Joomla!Code. To install these, you will need to install the <a href="http://sammoffatt.com.au/os/index.php/joomla-15-products/10-advanced-tools">Advanced Tools</a> package first before you get started. The latest version is <a href="http://joomlacode.org/gf/download/frsrelease/6797/22390/com_advancedtools.tgz">Advanced Tools 1.5.1</a> available from JoomlaCode.</p>
<p>Once we&#8217;ve got the Advanced Tools installed, we&#8217;re going to need the <a href="http://joomlacode.org/gf/download/frsrelease/9530/36171/pkg_jauthtools_core.tgz">JAuthTools 1.5.4 Core package</a>. This will give us the SSO library that we&#8217;re going to use later on. We will also need the <a href="http://joomlacode.org/gf/download/frsrelease/9530/36175/pkg_jauthtools_ssoplugins.tgz">SSO plugins</a> package (for the SSO HTTP plugin in our case) and the <a href="http://joomlacode.org/gf/download/frsrelease/9530/36176/pkg_jauthtools_tokenlogin.tgz">Token Login package</a>. As we&#8217;re not using the user source plugins for this case (both LDAP and Session are provided by default) we don&#8217;t need to install them and since we&#8217;re going to write our own SSO detection component we don&#8217;t need to use the options offered by the SSO package.</p>
<p>Once we&#8217;ve got all of the prerequisites installed we can start building the component</p>
<p><strong>Step 2: Building the component</strong><br />
So we&#8217;ll start building our component with the basic few lines all components require:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;?php<br />
defined('_JEXEC') or die();</div></div>
<p>This basic check ensures that we&#8217;re within Joomla!&#8217;s confines or kills the execution if we&#8217;re not. From here, lets set up some basic variables:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$landingpage = 'index.php';<br />
$autocreate = false;</div></div>
<p>These are two variables we&#8217;re going to use later. The landing page is used for token login to redirect the user to a page once they&#8217;ve been authenticated successfully. The autocreate option is utilised by the SSO system to determine if it should automatically create the user. Keep these in mind as we&#8217;ll use them later on.</p>
<p>In this next phase we&#8217;re going to take a copy of the current user and then use the SSO system to attempt to do the login. If its successful, the user&#8217;s ID will change and we can then create a token for them and redirect so they can login, if not we&#8217;ll redirect them with an error message:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$user =&amp; JFactory::getUser();<br />
$oldid = $user-&gt;id;<br />
jimport('jauthtools.sso');<br />
jimport('jauthtools.usersource');<br />
$sso = new JAuthSSOAuthentication();<br />
$sso-&gt;doSSOAuth($autocreate);</div></div>
<p>So we get a reference to the user object, get a copy of the user ID, import the SSO library, create a new SSO authentication object and handle authentication. We see the $autocreate variable we initialised before used here. We could load the plugins ourselves and handle everything but the doSSOAuth call will handle this for us, create the users session and if requested attempt to create the user if they don&#8217;t exist. We can then check if the user ID&#8217;s are different and then create a token to direct the user back:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">if($oldid != $user-&gt;id) {<br />
&nbsp; &nbsp; &nbsp; &nbsp;jimport('jauthtools.token');<br />
&nbsp; &nbsp; &nbsp; &nbsp;$dbo =&amp; JFactory::getDBO();<br />
&nbsp; &nbsp; &nbsp; &nbsp;$token = new JAuthToolsToken($dbo);</div></div>
<p>A sizable chunk of code. So we check if the user ID has changed (typically from unauthenticated to authenticated, we could also just check if the user ID != 0 as well). We then import the token login library, grab a copy of the database object and then create a new token.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; &nbsp;$token-&gt;set('username', $user-&gt;username);<br />
&nbsp; &nbsp; &nbsp; &nbsp;$token-&gt;set('expiry', time() + 3600); // now + 1 hr (60 * 60)<br />
&nbsp; &nbsp; &nbsp; &nbsp;$token-&gt;set('logins', 1);<br />
&nbsp; &nbsp; &nbsp; &nbsp;$token-&gt;set('landingpage', $landingpage);<br />
&nbsp; &nbsp; &nbsp; &nbsp;$token-&gt;store();</div></div>
<p>So with the token, we set the username to be that of the currently authenticated user (which we know is correct), set the expiry to be the present time plus an hour. Since this data is only &#8216;temporary&#8217; we don&#8217;t bother with JDate and just use the server time. If the server transitions to or from daylight savings there could be an issue but since the user should be redirected rather quickly that seems like an unlikely possibility. We set the number of logins that the token is valid for, which for this case is only one and then we set the token&#8217;s landing page to be the value of $landingpage that we set before. Once we&#8217;ve set all of the data we call the &#8216;store&#8217; function to save all of this to the database which will also trigger the generation of the login token.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; &nbsp;$session =&amp; JFactory::getSession();<br />
&nbsp; &nbsp; &nbsp; &nbsp;$session-&gt;destroy();<br />
&nbsp; &nbsp; &nbsp; &nbsp;$app =&amp; JFactory::getApplication();<br />
&nbsp; &nbsp; &nbsp; &nbsp;$app-&gt;redirect($token-&gt;generateLoginUrl());</div></div>
<p>Since the session we&#8217;re currently in is invalid, we destroy it for a bit of extra security and then we redirect the user to the token login component. Since this request will get proxied as a redirect to the real site (hopefully the proxy doesn&#8217;t rewrite the redirect header coming back otherwise this will fail), token login can then authenticate the user (again) and create a session for them without the proxies&#8217; interference. There is however one last part of our component, which is the else case for if the user doesn&#8217;t get detected:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">} else {<br />
&nbsp; &nbsp; &nbsp; &nbsp;$app =&amp; JFactory::getApplication();<br />
&nbsp; &nbsp; &nbsp; &nbsp;$app-&gt;redirect('index.php', JText::_('Invalid SSO Request'));<br />
}</div></div>
<p>So if we don&#8217;t detect anything, redirect the user to index.php with the message &#8216;Invalid SSO Request&#8217;. Too easy almost!</p>
<p>So for reference below is the final completed component file, don&#8217;t forget to update the values of $landingpage and $autocreate:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;?php<br />
defined('_JEXEC') or die('nachos libre!');<br />
$landingpage = 'http://www.google.com';<br />
$autocreate = false;<br />
$user =&amp; JFactory::getUser();<br />
$oldid = $user-&gt;id;<br />
jimport('jauthtools.sso');<br />
jimport('jauthtools.usersource');<br />
$sso = new JAuthSSOAuthentication();<br />
$sso-&gt;doSSOAuth($autocreate);<br />
if($oldid != $user-&gt;id) {<br />
&nbsp; &nbsp; &nbsp; &nbsp;jimport('jauthtools.token');<br />
&nbsp; &nbsp; &nbsp; &nbsp;$dbo =&amp; JFactory::getDBO();<br />
&nbsp; &nbsp; &nbsp; &nbsp;$token = new JAuthToolsToken($dbo);<br />
&nbsp; &nbsp; &nbsp; &nbsp;$token-&gt;set('username', $user-&gt;username);<br />
&nbsp; &nbsp; &nbsp; &nbsp;$token-&gt;set('expiry', time() + 3600); // now + 1 hr (60 * 60)<br />
&nbsp; &nbsp; &nbsp; &nbsp;$token-&gt;set('logins', 1);<br />
&nbsp; &nbsp; &nbsp; &nbsp;$token-&gt;set('landingpage', $landingpage);<br />
&nbsp; &nbsp; &nbsp; &nbsp;$token-&gt;store();<br />
&nbsp; &nbsp; &nbsp; &nbsp;$session =&amp; JFactory::getSession();<br />
&nbsp; &nbsp; &nbsp; &nbsp;$session-&gt;destroy();<br />
&nbsp; &nbsp; &nbsp; &nbsp;$app =&amp; JFactory::getApplication();<br />
&nbsp; &nbsp; &nbsp; &nbsp;$app-&gt;redirect($token-&gt;generateLoginUrl());<br />
} else {<br />
&nbsp; &nbsp; &nbsp; &nbsp;$app =&amp; JFactory::getApplication();<br />
&nbsp; &nbsp; &nbsp; &nbsp;$app-&gt;redirect('index.php', JText::_('Invalid SSO Request'));<br />
}</div></div>
]]></content:encoded>
			<wfw:commentRss>http://pasamio.com/2009/02/22/putting-token-login-to-work/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Boycott Experts Exchange</title>
		<link>http://pasamio.com/2009/02/21/boycott-experts-exchange/</link>
		<comments>http://pasamio.com/2009/02/21/boycott-experts-exchange/#comments</comments>
		<pubDate>Sat, 21 Feb 2009 08:21:56 +0000</pubDate>
		<dc:creator>pasamio</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://pasamio.com/2009/02/21/boycott-experts-exchange/</guid>
		<description><![CDATA[Have you ever done a search for a problem you&#8217;ve had only to see tantalizingly something that looks like exactly the answer you wanted before painfully realising that it&#8217;s on Experts Exchange and the page you have just clicked on says it has the answer but you don&#8217;t have an account. Sure you could sign [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever done a search for a problem you&#8217;ve had only to see tantalizingly something that looks like exactly the answer you wanted before painfully realising that it&#8217;s on Experts Exchange and the page you have just clicked on says it has the answer but you don&#8217;t have an account. Sure you could sign up for their free trial for 30 days and you might even find the answer if you are lucky but what happens next time? It&#8217;s like a drug dealer: the first hit is free, but you pay for everything from then on.</p>
<p>Now the original design of Experts Exchange wasn&#8217;t too bad. You could ask questions if you had enough points. You could also assign points to different questions increasing in value for importance I guess. You acquired points by either paying or by successfully answering questions. The thing that annoyed me was that if you weren&#8217;t the person that was nominated as the one who answered it you got no tangible credit for your contribution even if it helps or even if the correct answer was actually wrong or perhaps not the best response. </p>
<p>But obviously at this point they feel that they have enough knowledge to justify not only spamming their pages with tonnes of ads but also starting to force people to pay for even more. And be aide they&#8217;ve been around for a while and have had a good reputation they&#8217;re using this plus close keyword matches on the question to continue to drive traffic. </p>
<p>So now with Google&#8217;s Search Wiki, we can fight back against Experts Exchange and it&#8217;s pointless entries in Google&#8217;s index. All you need to do is be logged in and when you see an Experts Exchange result in your Google search make sure you delete it from your results. My belief is that if we get enough people to blacklist and delete those entries, Google will take note and eventually lower the rank of the entries and we&#8217;ll stop seeing their results.    </p>
]]></content:encoded>
			<wfw:commentRss>http://pasamio.com/2009/02/21/boycott-experts-exchange/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Today: 05-Nov-2008: Kerberos and Joomla! 1.6&#8242;s Backup system</title>
		<link>http://pasamio.com/2008/11/05/today-05-nov-2008-kerberos-and-joomla-16s-backup-system/</link>
		<comments>http://pasamio.com/2008/11/05/today-05-nov-2008-kerberos-and-joomla-16s-backup-system/#comments</comments>
		<pubDate>Wed, 05 Nov 2008 09:51:16 +0000</pubDate>
		<dc:creator>pasamio</dc:creator>
				<category><![CDATA[joomla]]></category>
		<category><![CDATA[kerberos]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[today]]></category>

		<guid isPermaLink="false">http://pasamio.com/?p=55</guid>
		<description><![CDATA[Today had a lackadaisical start with me working on getting Dawn of War:Winter Assault to work on my Mac (once it was fully patched seems to have started working, yay for no copy protection!) after doing a whole heap of disk swapping last night to get the base installed only to see it complain it [...]]]></description>
			<content:encoded><![CDATA[<p>Today had a lackadaisical start with me working on getting Dawn of War:Winter Assault to work on my Mac (once it was fully patched seems to have started working, yay for no copy protection!) after doing a whole heap of disk swapping last night to get the base installed only to see it complain it couldn&#8217;t find a CD/DVD drive. After I installed the 1.50 patch it asked me if I wanted to start and for the first time it actually started the game without issues. I managed to load it up and play a quick game and fielded a call from my Mum before heading to work. I also added some projects to my list and categorised items, now on the todo list: an automated login key generator for Joomla! and a component to compliment the ban IP/address plugin. Now all I need is time!</p>
<p>The Kerberos keys that I had asked to be remade were ready for me by the time I got there. It took a bit of time to rebuild the different keytab files to support the vhost environment (need to merge the respective keytab files) but once that was done everything was working. Well, mostly working. Firefox on my Mac worked fine, Firefox on the Windows desktops I tried worked when they were configured (see http://grolmsnet.de/kerbtut/firefox.html for information on what you need to do to get Firefox to do negotiate), IE on most of the desktops worked fine however some installations weren&#8217;t getting SSO, all of the Citrix servers seem not to pass through authentication (they end up going in a weird loop where IE appears to keep loading the page) and Safari on my Mac doesn&#8217;t seem to want to play the game either. Perhaps I&#8217;ll sort that out over the next week or so but that consumed a reasonable amount of time going through and checking different IE versions and if they worked. The only machine not to play the game seems to be Firefox on my Linux desktop (it should be working) so I&#8217;ll have a look at the ones that don&#8217;t work and why they don&#8217;t want to work. For the Windows boxes I have the feeling that the Netware client is causing issues (which would explain Citrix) so hopefully when our network eradicates Novell we&#8217;ll be fine.</p>
<p>And that leads us to the afternoon&#8217;s fun of building Joomla! 1.6&#8242;s backup system. I&#8217;ve managed to get the system to export the sample database, reimport it and then delete the files afterwards so I&#8217;ve moved onto much larger goals. I&#8217;ve taken one of our internal websites and I&#8217;m trying to get it to important. Suffice to say that it has enough data to cause an issue with the system. For data loading I&#8217;m using a heavily modified version of Alexey Ozerov&#8217;s &#8220;<a title="Big Dump homepage" href="http://www.ozerov.de/bigdump.php">BigDump</a>&#8221; script, which has been used in the past in a less modified form for the Joomla! 1.5 migrator. It is slowly being converted to use the new Tasks system in 1.6 which is another concept borrowed from the 1.0 migrator. The Tasks system in 1.6 has two items: a task set which is a container for individual tasks. So considering backups, one task set might be a full backup run of the site with individual tasks being an SQL backup, a file backup (tar archive perhaps?) and maybe copying that to a remote FTP site or similar. So the one task set would have an &#8220;SQL backup&#8221; task and a &#8220;file backup&#8221; task. Extension package installation may do a similar item as well splitting the install into different parts.</p>
<p>A new part of this is the data load system that provides functionality to read and load data files, at the moment only supporting SQL but I&#8217;m hoping I&#8217;ll be able to create a CSV one as well some luck, again probably reusing Alexey&#8217;s code in part here as well. I&#8217;m mostly through building parts of this system though I&#8217;m experiencing a strange issue with my sample data (hence why the updates haven&#8217;t been committed to J!&#8217;s SVN repository today) where it loads the file up through to almost 2000 queries and seems to stop suddenly. I&#8217;m not quite sure whats going on but I&#8217;m happy enough that the task system is picking up and storing values for it to progress as far as it does.</p>
<p>Another successful day spent on my Mac as well, NetBeans doesn&#8217;t seem to want to look at my project any more crashing instead of loading it which is disappointing but I&#8217;ll work that out another day. And now its time to enjoy some Dawn of War.</p>
]]></content:encoded>
			<wfw:commentRss>http://pasamio.com/2008/11/05/today-05-nov-2008-kerberos-and-joomla-16s-backup-system/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bash to Phing to make</title>
		<link>http://pasamio.com/2008/02/10/bash-to-phing-to-make/</link>
		<comments>http://pasamio.com/2008/02/10/bash-to-phing-to-make/#comments</comments>
		<pubDate>Sun, 10 Feb 2008 01:56:59 +0000</pubDate>
		<dc:creator>Pasamio</dc:creator>
				<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://pasamio.com/?p=38</guid>
		<description><![CDATA[So most of my day I write code which is cool. I usually don&#8217;t have to redeploy things because I end up testing in the same environment that I work on it isn&#8217;t until I start a release cycle that I need to start to package things up that I really utilise build scripts. Initially [...]]]></description>
			<content:encoded><![CDATA[<p>So most of my day I write code which is cool. I usually don&#8217;t have to redeploy things because I end up testing in the same environment that I work on it isn&#8217;t until I start a release cycle that I need to start to package things up that I really utilise build scripts. Initially I used to just export from SVN and tar things up by hand. I had also recently heard a few proponents to suggest Phing, a PHP based build tool that uses XML files similar to ANT, as something to use with my build scripts. The scripting that I had done was all in Bash, a rather flexible shell environment but lacking in a few features that a dedicated build tool gives me.</p>
<p>What triggered a lot of this is a set of rather strange bash scripts that form the build tool for Joomla!. It handles building the packages, exporting the packages and building the patch packages (diff of new files and updated files from the old release). Wilco always says that we should use Phing instead because it has all of these features. So this project called JAuthTools that I work on started becoming big and it was a pain to build things for it by hand so I decided that now was the time to get into Phing.</p>
<p><strong>Phing</strong><br />
Phing (http://phing.info/) is as stated before a PHP based build tool. Its web site says it can do anything you can do with a traditional build system, which is really kind of your base expectation when you think about it. Why would you replace your build system with something that provides you less? Phing comes with by default all of the nice things you&#8217;d want from a build tool, tasks to do things, output things, make directories, move and copy things, call other tasks and a few other nice things. </p>
<p>Problem is that what I&#8217;m after is something to build tarballs, and these are marked as optional tasks for the system. This has some cool things like DbDeploy, which connects to a special DB and builds SQL delta files (version control for your DB), coverage analysis, PDO SQL executor, PHPUnit and my personal favourites, tasks for Zip, Tar and Subversion.</p>
<p>So I went to install Phing on my work box. Its a Linux machine so I decided that I wanted to avoid the PEAR path because that is just as good as installing things all over my system. Phing lived happily in my personal bin directory until I realised that to get SVN working I needed to get this thing from PEAR. I decided that I might as well fight PEAR (and my work proxy for that matter) and install it that way. It only took a few attempts to get PEAR to work through my work proxy, it appears that between the last time I was fighting it they fixed it up which is nice. CPAN is another one that is a pain as well because it wants to pull things left and right and my proxy decides that half of the files it wants are too big and it should ask for them after 5pm instead or use a special download request system. But I digress, Phing ends up being mostly unhappily installed via PEAR with a few complaints (I said, &#8220;yes download your dependencies&#8221; which bombed out when it figured out that its dependency was still marked unstable and refused to install it (so why err bother? why not ask me! I want to install it, I even said so, that is what &#8220;alldpes&#8221; means right?)). So now I have a SVN capable Phing! Shiny!</p>
<p>So I go off and build all sorts of things and suddenly the installer rejects the package I just built with Phing complaining its an invalid zip file. So I ended up by working around this with a Bash script that basically rebuilt the ZIP archive after Phing was done with its business. So I progress from Bash to&#8230;err&#8230;Bash via Phing! This is on a PHP 5.2.5 latest build so I&#8217;m not sure where the fault for this lays, but if I end up using the old tool then as far as I&#8217;m concerned it isn&#8217;t a replacement for my build system.</p>
<p>The next thing that I ended up finding is that the nested dependencies appeared not to be fully supported by the tool, which didn&#8217;t particularly bother me however as you&#8217;ll read later Make supported this perfectly fine. So I ended up having to alter my build file to handle Subversion check outs better because it would check it out for each sub dependencies. So I would have a top level one and then sub-dependencies so that each individual item wouldn&#8217;t have to do it themselves, especially for the targets that matched the same repository. I ended up just moving this into a common parent dependency and going from there.</p>
<p>And then I wanted to do some work on my Mac at home. I have a slightly out of date PHP, 5.2.0, which appears to have caused issues. This time I went straight to using PEAR to install things and again this caused issues, but given I was expecting some hassles I managed to get things working. I also don&#8217;t have a nasty proxy or firewall so that makes life easier for me as well when installing these things. I tried out my first build script and it spewed out a horrible amount of errors. For some reason on this combination SVN doesn&#8217;t want to work which dies <em>silently</em> which then causes the rest of the script to fail because it expects the SVN task to succeed and given I&#8217;m using a build tool to ensure that errors get properly trapped it doesn&#8217;t bail out or check that directories exist like I could do with a shell script.</p>
<p>Whilst this all sounds bad I did however like one feature that allowed me to control what the zip task (or selected other tasks) included and excluded which made things easier for building packages and controlling operations that are slightly harder in bash or make.</p>
<p><strong>Make</strong><br />
Today I started off making a few new scripts on my Mac to replace the non functional Phing scripts. It wasn&#8217;t too hard to go from Phing to Make but I ended up re-expanding out my SVN scripts now that I have a system where the dependencies work better. Strangely enough my zip files also started building properly which was nice to have. But this got me thinking: why do we reinvent the wheel?</p>
<p>Sure it is nice to have a fancy XML file that takes a lot of control away, but at the end of the day when I compare what I wrote to get SVN to export in Phing and what I have to do with Make or BASH, on sheer number of characters I end up finding that Phing loses again.</p>
<p>But here is the really simple thing: Phing&#8217;s SVN support is a wrapper around the regular command line SVN client. The advantage of using Make or BASH is their portability for myself. My primary environments are Mac and Linux, and when I have been on Windows for extended periods of time I ended up installing Cygwin. So at the end of the day my build system is portable between systems. Additionally the &#8220;Gotcha&#8217;s&#8221; page for Phing shows that it isn&#8217;t really a walk in the park to get it to work on Windows either. The question is that do you really want to play with your build system each time you want to change platforms or do you want to go and get up and go without too many issues. </p>
<p>Make and BASH are both staples of the Unix environment and have had years of testing. Whilst it is nice to have something with a whole heap of new features, the fact is that some of the basic functionality doesn&#8217;t work properly or is a pain to get working across platforms: I ended up replicating these features anyway.</p>
]]></content:encoded>
			<wfw:commentRss>http://pasamio.com/2008/02/10/bash-to-phing-to-make/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

