<?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>p3d.co.uk</title>
	<atom:link href="http://p3d.co.uk/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://p3d.co.uk/blog</link>
	<description></description>
	<lastBuildDate>Sat, 19 Nov 2011 09:45:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>rails 3.1 &#8211; link_to &#8216;Destroy&#8217; not working &#8211; fix</title>
		<link>http://p3d.co.uk/blog/?p=132</link>
		<comments>http://p3d.co.uk/blog/?p=132#comments</comments>
		<pubDate>Sat, 19 Nov 2011 09:45:37 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://p3d.co.uk/blog/?p=132</guid>
		<description><![CDATA[I discovered that my &#8216;destroy&#8217; links in a rails 3.1 app where routing to the show action of the relevant controller. It seemed that the javascript was not firing for some reason. I had the jquery-rails gem in my Gemfile ok but jquery was not being loaded. Eventually I worked out a solution (there may [...]]]></description>
			<content:encoded><![CDATA[<p>I discovered that my &#8216;destroy&#8217; links in a rails 3.1 app where routing to the show action of the relevant controller.</p>
<p>It seemed that the javascript was not firing for some reason.</p>
<p>I had the jquery-rails gem in my Gemfile ok but jquery was not being loaded.</p>
<p>Eventually I worked out a solution (there may be better solutions&#8230;)</p>
<p>In my application.html.erb layout file my javascript include was :</p>
<pre>&lt;%= javascript_include_tag :defaults %&gt;</pre>
<p>which meant that I was trying to load a defaults.js file which didn&#8217;t exist.</p>
<p>I changed this to</p>
<pre>&lt;%= javascript_include_tag :application %&gt;</pre>
<p>and suddenly everything is working, i.e. application.js is being loaded and destroy links are now doing what one would expect.</p>
<p>Simples.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://p3d.co.uk/blog/?feed=rss2&#038;p=132</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>/usr/bin/ld: cannot find -lstdc++ on ubuntu 9</title>
		<link>http://p3d.co.uk/blog/?p=124</link>
		<comments>http://p3d.co.uk/blog/?p=124#comments</comments>
		<pubDate>Thu, 28 Jul 2011 14:47:00 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[merb]]></category>

		<guid isPermaLink="false">http://p3d.co.uk/blog/?p=124</guid>
		<description><![CDATA[I recently had to get a merb site up and running on a ubunto 9.10 vps. I haven&#8217;t worked with merb before so there was something of a learning curve, but not too much. Anyway, the site uses image science for image manipulation. Once I had everything installed , trying to run merb in the [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had to get a merb site up and running on a ubunto 9.10 vps.</p>
<p>I haven&#8217;t worked with merb before so there was something of a learning curve, but not too much.</p>
<p>Anyway, the site uses image science for image manipulation.</p>
<p>Once I had everything installed , trying to run merb in the application root gave me the following error:</p>
<pre>/usr/bin/ld: cannot find -lstdc++</pre>
<p>From the trace this seemed to be related to ruby inline.</p>
<p>Anyway, short version is that once I installed <strong>libstdc++6-4.4-dev</strong> merb was able to start up ok.</p>
<p>I hope this helps someone else out there.</p>
]]></content:encoded>
			<wfw:commentRss>http://p3d.co.uk/blog/?feed=rss2&#038;p=124</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>wildcard ssl on cpanel</title>
		<link>http://p3d.co.uk/blog/?p=121</link>
		<comments>http://p3d.co.uk/blog/?p=121#comments</comments>
		<pubDate>Tue, 26 Jul 2011 18:11:53 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[cpanel]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://p3d.co.uk/blog/?p=121</guid>
		<description><![CDATA[A client asked me to install ssl certificates for two subdomains of one of their client&#8217;s sites. As they were restricted to one IP address I went down the wildcard ssl route. There is a lot of conflicting information out there about how to go about installing a wildcard ssl certificate in cpanel. Some sources [...]]]></description>
			<content:encoded><![CDATA[<p>A client asked me to install ssl certificates for two subdomains of one of their client&#8217;s sites.</p>
<p>As they were restricted to one IP address I went down the wildcard ssl route.</p>
<p>There is a lot of conflicting information out there about how to go about installing a wildcard ssl certificate in cpanel. Some sources say it&#8217;s not possible. Others say it is but you have to edit lots of cpanel config files by hand (which is never a nice thing to have to do).</p>
<p>In the end it was relatively straight forward.</p>
<p>I generated a key and csr by hand on the server by the usual methods. i.e. openssl genrsa etc etc.</p>
<p>The key here was specifying the domain as *.domain.com .</p>
<p>I then bought the wildcard ssl certificate.</p>
<p>Finally, I logged in to the client&#8217;s cpanel account, went in to the ssl/tls manage but, and then the Activate SSL on your website part.</p>
<p>I selected domain.com from the dropdown, pasted the contents of the crt file and the key I generated earlier, and clicked the Install Certificate.</p>
<p>And much to my surprise it worked.</p>
<p>ymmv, ianal, bbqrofl</p>
]]></content:encoded>
			<wfw:commentRss>http://p3d.co.uk/blog/?feed=rss2&#038;p=121</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>install a specific version of gem</title>
		<link>http://p3d.co.uk/blog/?p=118</link>
		<comments>http://p3d.co.uk/blog/?p=118#comments</comments>
		<pubDate>Thu, 07 Jul 2011 10:34:21 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://p3d.co.uk/blog/?p=118</guid>
		<description><![CDATA[Recently while working on an old 2.3.x rails app I found I was having problems with the version of rubygems installed. In the end I had to install rubygems version 1.6.2 to get a rails app version 2.3.11 to boot. The command to install this specific version of gem is gem update &#8211;system 1.6.2]]></description>
			<content:encoded><![CDATA[<p>Recently while working on an old 2.3.x rails app I found I was having problems with the version of rubygems installed. In the end I had to install rubygems version 1.6.2 to get a rails app version 2.3.11 to boot.</p>
<p>The command to install this specific version of gem is</p>
<p><strong>gem update &#8211;system 1.6.2</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://p3d.co.uk/blog/?feed=rss2&#038;p=118</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rake error: uninitialized constant Rake::DSL</title>
		<link>http://p3d.co.uk/blog/?p=115</link>
		<comments>http://p3d.co.uk/blog/?p=115#comments</comments>
		<pubDate>Thu, 07 Jul 2011 10:32:25 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://p3d.co.uk/blog/?p=115</guid>
		<description><![CDATA[While deploying to a new server recently I found myself confronted with the following error message: uninitialized constant Rake::DSL It would seem that this error is related to the version of rake installed on the server. I installed an older version and removed the latest version. gem install rake &#8211;version=0.8.7 gem uninstall rake &#8211;version=0.9.2 Everything [...]]]></description>
			<content:encoded><![CDATA[<p>While deploying to a new server recently I found myself confronted with the following error message:</p>
<p><strong>uninitialized constant Rake::DSL</strong></p>
<p>It would seem that this error is related to the version of rake installed on the server.</p>
<p>I installed an older version and removed the latest version.</p>
<p>gem install rake &#8211;version=0.8.7</p>
<p>gem uninstall rake &#8211;version=0.9.2</p>
<p>Everything is working ok now.</p>
<p>Hint found <a href="http://groups.google.com/group/heroku/browse_thread/thread/ddf423b9cbb19058">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://p3d.co.uk/blog/?feed=rss2&#038;p=115</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>undefined in string returned from javascript function</title>
		<link>http://p3d.co.uk/blog/?p=107</link>
		<comments>http://p3d.co.uk/blog/?p=107#comments</comments>
		<pubDate>Mon, 27 Sep 2010 15:28:28 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[memotoself]]></category>

		<guid isPermaLink="false">http://p3d.co.uk/blog/?p=107</guid>
		<description><![CDATA[This is probably really obvious, but I&#8217;m putting it here for my own reference. So I have a javascript function that builds a string and returns it to the caller. However, I had this problem where the returned string always started with undefined . It didn&#8217;t take me too long to work out what was [...]]]></description>
			<content:encoded><![CDATA[<p>This is probably really obvious, but I&#8217;m putting it here for my own reference.<br />
So I have a javascript function that builds a string and returns it to the caller.<br />
However, I had this problem where the returned string always started with <strong>undefined</strong> .<br />
It didn&#8217;t take me too long to work out what was wrong here; namely that I didn&#8217;t initialise the variable before I started appended to it, so it always started with undefined.</p>
<p>So something like:</p>
<pre name="code"  class="javascript">var return_string;
return_string += "Some stuff";
</pre>
<p>Wrong!</p>
<pre name="code" class="javascript">var return_string = "";
return_string += "Some stuff";</pre>
<p>Right!</p>
<p>Obvious really&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://p3d.co.uk/blog/?feed=rss2&#038;p=107</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>remove files older than x days</title>
		<link>http://p3d.co.uk/blog/?p=105</link>
		<comments>http://p3d.co.uk/blog/?p=105#comments</comments>
		<pubDate>Tue, 23 Mar 2010 17:28:03 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[memotoself]]></category>

		<guid isPermaLink="false">http://p3d.co.uk/blog/?p=105</guid>
		<description><![CDATA[find .* -mtime +14 -exec rm {} \;]]></description>
			<content:encoded><![CDATA[<p><code>find .* -mtime +14 -exec rm {} \;</code></p>
]]></content:encoded>
			<wfw:commentRss>http://p3d.co.uk/blog/?feed=rss2&#038;p=105</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>json and rails</title>
		<link>http://p3d.co.uk/blog/?p=93</link>
		<comments>http://p3d.co.uk/blog/?p=93#comments</comments>
		<pubDate>Sat, 20 Feb 2010 14:24:13 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[json]]></category>

		<guid isPermaLink="false">http://p3d.co.uk/blog/?p=93</guid>
		<description><![CDATA[The following is one way to handle json responses from a rails application. So, I have a ajax request in a script in my page. In this example I am using the jquery poll plugin to poll the status of a file import. $("#").poll({ url: "/mis_imports/import_state/&#60;%=import.id%&#62;", interval: 3000, type: "GET", success: function(data){ var return_data = [...]]]></description>
			<content:encoded><![CDATA[<p>The following is <strong>one</strong> way to handle json responses from a rails application.<br />
So, I have a ajax request in a script in my page. In this example I am using the jquery poll plugin to poll the status of a file import.</p>
<pre name="code" class="javascript">
$("#<%=import.id%>").poll({
    url: "/mis_imports/import_state/&lt;%=import.id%&gt;",
    interval: 3000,
    type: "GET",
    success: function(data){
                   var return_data = eval('(' + data + ')');
                   $("#<%=import.id%>").attr("class","mis_import_state_"+return_data.state);
		   $("#<%=import.id%>_message").html(""+return_data.status+"");
		   $("#<%=import.id%>_timestamp").html(""+return_data.timestamp+"");
		   if (return_data.state == 1){
		     $(this).stop();
		   }
    }
});
</pre>
<p>And on the server, my rails action method looks like this:</p>
<pre name="code" class="ruby">
def import_state
    import = MisImport.find(params[:id])
    render :text => {:state => import.state,:status => import.message,:timestamp => Time.now.strftime("%d:%b:%Y %H:%M:%S")}.to_json
  end
</pre>
<p>The key part to this working is line 6 of the javascript listing, where one &#8216;evals&#8217; the data returned from the server.<br />
This effectively rehydrates the data structure into a usable javascript object, and that&#8217;s the bit I keep forgetting!</p>
<p>There are probably smarter ways of doing this; I know there is a <a href="http://api.jquery.com/jQuery.getJSON/">jQuery.getJSON()</a> function, but in this case I couldn&#8217;t work out how to use that with jquery poll. Again, probably very simple&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://p3d.co.uk/blog/?feed=rss2&#038;p=93</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>symfony class::preInsert() should be compatible with that of Doctrine_Record::preInsert()</title>
		<link>http://p3d.co.uk/blog/?p=88</link>
		<comments>http://p3d.co.uk/blog/?p=88#comments</comments>
		<pubDate>Tue, 19 Jan 2010 11:21:18 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[memotoself]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://p3d.co.uk/blog/?p=88</guid>
		<description><![CDATA[I wanted to use the preInsert() method to do some calculations on a model class before it was saved. But I encountered the error: Strict Standards: Declaration of Blah::preInsert() should be compatible with that of Doctrine_Record::preInsert() in /PATH/lib/model/doctrine/Klass.class.php on line 14 The code I had in my class file looked something like this: public function [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to use the preInsert() method to do some calculations on a model class before it was saved. But I encountered the error:<br />
<strong>Strict Standards: Declaration of Blah::preInsert() should be compatible with that of Doctrine_Record::preInsert() in /PATH/lib/model/doctrine/Klass.class.php on line 14</strong></p>
<p>The code I had in my class file looked something like this:</p>
<pre name="code" class="php">
public function preInsert(Doctrine_Event $event)
{
$this-&gt;calculate_status();
}
</pre>
<p>This seemed correct, but I was getting this strict error.<br />
Anyway, short story shorter, I removed the Doctrine_Event (type hint?) from my method signature and the warning went away.<br />
New code looks like this:</p>
<pre name="code" class="php">
public function preInsert($event)
{
$this-&gt;calculate_status();
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://p3d.co.uk/blog/?feed=rss2&#038;p=88</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>symfony throws message &#8220;couldn&#8217;t get last insert identifier&#8221;</title>
		<link>http://p3d.co.uk/blog/?p=84</link>
		<comments>http://p3d.co.uk/blog/?p=84#comments</comments>
		<pubDate>Sat, 09 Jan 2010 19:49:04 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[memotoself]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tippage]]></category>

		<guid isPermaLink="false">http://p3d.co.uk/blog/?p=84</guid>
		<description><![CDATA[I&#8217;ve started using the Symfony PHP framework for my php projects, and while the learning curve has been steeper than I would have liked, I&#8217;m getting there. Anyway, one of the problems I&#8217;ve had a few times over the current project is the error &#8220;couldn&#8217;t get last insert identifier&#8221; So far, the problem has been [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve started using the <a href="http://www.symfony-project.org/">Symfony PHP framework</a> for my php projects, and while the learning curve has been steeper than I would have liked, I&#8217;m getting there.</p>
<p>Anyway, one of the problems I&#8217;ve had a few times over the current project is the error<br />
<strong>&#8220;couldn&#8217;t get last insert identifier&#8221;</strong></p>
<p>So far, the problem has been down to the object I have been trying to create didn&#8217;t have it&#8217;s id field set to autoincrement. Or perhaps more accurately, <strong>setting that model&#8217;s id field to autoincrement has sorted the problem</strong> so far.<br />
Hopefully once I get the hang of the schema file and the (what appears to be) the slightly different syntax for migrations, all my models should have autoincrement id fields and this shouldn&#8217;t be a problem anymore.</p>
]]></content:encoded>
			<wfw:commentRss>http://p3d.co.uk/blog/?feed=rss2&#038;p=84</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

