<?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>ThinkRobot &#187; Tutorials</title>
	<atom:link href="http://think-robot.com/category/tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://think-robot.com</link>
	<description>Design &#38; Development Blog</description>
	<lastBuildDate>Sun, 22 Apr 2012 23:58:32 +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>Edit BIOS in Lenovo ThinkPad x220t</title>
		<link>http://think-robot.com/2011/08/edit-bios-in-lenovo-thinkpad-x220t/</link>
		<comments>http://think-robot.com/2011/08/edit-bios-in-lenovo-thinkpad-x220t/#comments</comments>
		<pubDate>Tue, 09 Aug 2011 16:56:32 +0000</pubDate>
		<dc:creator>Joanna</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[bios]]></category>
		<category><![CDATA[Lenovo]]></category>
		<category><![CDATA[tablet]]></category>
		<category><![CDATA[ThinkPad]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://think-robot.com/?p=302</guid>
		<description><![CDATA[As it&#8217;s changed from the previous model it had me scratching my head for a few minutes. To enter the BIOS setup just use F1 during laptop startup. Related Articles:openSUSE 11 on Lenovo Thinkpad X61 (tablet pc)Autloading modular forms &#038; models in Zend Framework 1.8Server Error 500 - htaccess require valid-userWordPress NextGen gallery tweakInstalling Windows [...]]]></description>
			<content:encoded><![CDATA[<p>As it&#8217;s changed from the previous model it had me scratching my head for a few minutes. To enter the BIOS setup just use <strong>F1 during laptop startup</strong>.</p>
<div id="crp_related"><h2>Related Articles:</h2><ul><li><a href="http://think-robot.com/2008/08/opensuse-11-on-lenovo-thinkpad-x61-tablet-pc/" rel="bookmark">openSUSE 11 on Lenovo Thinkpad X61 (tablet pc)</a></li><li><a href="http://think-robot.com/2009/07/autloading-modular-forms-models-in-zend-framework-18/" rel="bookmark">Autloading modular forms & models in Zend Framework 1.8</a></li><li><a href="http://think-robot.com/2008/08/server-error-500-htaccess-require-valid-user/" rel="bookmark">Server Error 500 - htaccess require valid-user</a></li><li><a href="http://think-robot.com/2008/11/wordpress-nextgen-gallery-tweak/" rel="bookmark">WordPress NextGen gallery tweak</a></li><li><a href="http://think-robot.com/2010/12/installing-windows-7-guest-on-vmware-7-on-opensuse-113-host/" rel="bookmark">Installing Windows 7 Guest on VMWare 7 on OpenSuse 11.3 Host</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://think-robot.com/2011/08/edit-bios-in-lenovo-thinkpad-x220t/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using TextMate for easier CSS3</title>
		<link>http://think-robot.com/2010/09/using-textmate-for-easier-css3/</link>
		<comments>http://think-robot.com/2010/09/using-textmate-for-easier-css3/#comments</comments>
		<pubDate>Sun, 05 Sep 2010 19:54:15 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[os x]]></category>
		<category><![CDATA[textmate]]></category>
		<category><![CDATA[transform]]></category>

		<guid isPermaLink="false">http://think-robot.com/?p=236</guid>
		<description><![CDATA[Over the past couple of years Webkit has popularised many fancy new CSS tricks. Amongst these the ability to rotate an element is certainly one of the most useful. Fortunately it&#8217;s also widely supported in other browsers, even in lowly old IE right back to version 5.5. The &#8216;modern&#8217; browsers support this with a reasonably [...]]]></description>
			<content:encoded><![CDATA[<p>Over the past couple of years Webkit has popularised many fancy new CSS tricks. Amongst these the ability to rotate an element is certainly one of the most useful. Fortunately it&#8217;s also widely supported in other browsers, even in lowly old IE right back to version 5.5. The &#8216;modern&#8217; browsers support this with a reasonably simple syntax</p>
<p><span id="more-236"></span></p>
<pre><code>[-vendor-prefix-]transform: rotate([angle]deg);</code></pre>
<p>so to use this to rotate an element by 15 degrees in Webkit (e.g. Safari, Chrome), Mozilla and Opera you&#8217;d use</p>
<pre><code>-moz-transform: rotate(15deg);
-o-transform: rotate(15deg);
-webkit-transform: rotate(15deg);
transform: rotate(15deg); </code></pre>
<p>We include the rule without a vendor prefix so that once browsers start to implement this without requiring the use of it our CSS will be ready.</p>
<p>Sadly the syntax for Internet Explorer is a little more cumbersome. It uses the	DXImageTransform.Microsoft.Matrix filter which is a little cryptic, but fortunately quite well documented on <a href="http://msdn.microsoft.com/en-us/library/ms533014(VS.85).aspx">MSDN</a>. We also need 2 variations of this filter, one for IE &lt; 8 and another for IE ≥ 8.</p>
<p>To use the filter the first thing we need to do is convert our angle into radians (angle in radians = angle in degrees * π / 180) then we work with the sine and cosine of this angle:</p>
<pre><code>DXImageTransform.Microsoft.Matrix(sizingMethod='auto expand',M11=[cos(angle)],M12=[-sin(angle)],M21=[sin(angle)],M22=[cos(angle)]);</code></pre>
<p>So if we take our rotate by 15 degrees example from above we&#8217;d end up with the following to cover all IE versions:</p>
<pre><code>filter:progid:DXImageTransform.Microsoft.Matrix(sizingMethod='auto expand',M11=0.965925826289068,M12=-0.258819045102521,M21=0.258819045102521,M22=0.965925826289068);
-ms-filter:"progid:DXImageTransform.Microsoft.Matrix(SizingMethod='auto expand',M11=0.965925826289068,M12=-0.258819045102521,M21=0.258819045102521,M22=0.965925826289068)";</code></pre>
<p>Obviously we don&#8217;t really want to have to whip out a calculator and type 6 lines of CSS every time we want to rotate an element. To save myself a little time I created a <a href="http://www.macromates.com">TextMate</a> bundle that simplifies the process a bit. This bundle allows me to type the standard syntax.</p>
<pre><code>transform:rotate(-10deg)</code></pre>
<p>Then hit a keyboard shortcut to have TextMate fill in the rest.</p>
<p>To add this bundle go to Bundles &gt; Bundle Editor &gt; Show Bundle Editor</p>
<p>Select CSS from the list on the left and side of the editor and select Add new command from the buttons at the bottom. Paste the following into the Command(s) field</p>
<pre><code>#!/usr/bin/env ruby
line = $stdin.read
if line =~ /(\s*)transform\s*:\s*rotate\s*\(\s*(-?[0-9]+)\s*deg\s*\)/i
	rad = $2.to_i * Math::PI / 180
	cos = Math.cos(rad)
	sin = Math.sin(rad)

	print $`
	print $1 + "-moz-transform:rotate(" + $2 + "deg);\n"
	print $1 + "-o-transform:rotate(" + $2 + "deg);\n"
	print $1 + "-webkit-transform:rotate(" + $2 + "deg);\n"
	print $1 + "transform:rotate(" + $2 + "deg);\n"
	print $1 + "filter:progid:DXImageTransform.Microsoft.Matrix(sizingMethod='auto expand',M11=" + 	cos.to_s + ",M12=" + (sin * -1).to_s + ",M21=" + sin.to_s + ",M22=" + cos.to_s + ");\n"
	print $1 + "-ms-filter:\"progid:DXImageTransform.Microsoft.Matrix(SizingMethod='auto expand',M11=" + cos.to_s + ",M12=" + (sin * -1).to_s + ",M21=" + sin.to_s + ",M22=" + cos.to_s + ")\";\n"
	print $'
else
	print line
end</code></pre>
<p>Then select Save: Nothing, Input: Selected text or Line and Output: Replace Selected Text. Now you need to setup how you&#8217;ll trigger this. Select Activation: Key Equivalent and then enter the keyboard shortcut you&#8217;d like &#8211; I&#8217;m using <kbd>Shift + Cmd + R</kbd></p>
<p><img class="alignleft size-medium wp-image-237" style="margin-right: 1em; margin-bottom: 1em;" title="bundle-editor" src="http://think-robot.com/wp-content/uploads/2010/09/bundle-editor-300x180.png" alt="bundle-editor" width="300" height="180" /></p>
<p>Finally close the bundle editor and select Bundle &gt; Bundle Editor &gt; Reload Bundles and you should be good to go.</p>
<p>Of course there are many other CSS3 properties that up until now have been implemented using vendor prefixes in some browsers. We can simplify creating these with some more TextMate snippets. I&#8217;ll include a couple of examples here, firstly box-shadow. Webkit and Mozilla support this using a vendor prefix, Opera and Internet Explorer 9 use the standard property. The syntax is:</p>
<pre><code>[-vendor-prefix-]box-shadow: [x offset] [y offset] [blur radius] [color];</code></pre>
<p>So to create a drak grey shadow just offset slightly below an element we might use something like this:</p>
<pre><code>-moz-box-shadow: 0 2px 5px #333;
-webkit-box-shadow: 0 2px 5px #333;
box-shadow: 0 2px 5px #333;</code></pre>
<p>For the TextMate snippet we&#8217;ll use tab triggers and placeholders &#8211; this let you type a keyword and hit the tab key to insert the text of the snippet with placeholder values inserted with the first placeholder selected so you can fill in a value, tabbing again moves onto the next placeholder and so on. Open up the bundle editor from Bundles &gt; Bundle Editor &gt; Show Bundle Editor and select to add a new snippet under the CSS section. Paste the following into the snippet window:</p>
<pre><code>-moz-box-shadow: ${1:x offset} ${2:y offset} ${3:blur radius} ${4:color};
-webkit-box-shadow: ${1:x offset} ${2:y offset} ${3:blur radius} ${4:color};
box-shadow: ${1:x offset} ${2:y offset} ${3:blur radius} ${4:color};</code></pre>
<p>Select Activation: Tab Trigger and type in the word box as the trigger. Name this snippet box-shadow and exit the bundle editor. Relaod bundles to give it a try. In a CSS file now type box and hit the tab key. The following should be inserted:</p>
<pre><code>-moz-box-shadow: x offset y offset spread color;
-webkit-box-shadow: x offset y offset spread color;
box-shadow: x offset y offset spread color;</code></pre>
<p>with the x offset text highlighted. Starting to type will overwrite all the x offset placeholders, hitting tab again will move onto the y offset. Easy. You could add another snippet that provided box shadows using the inset modifier.</p>
<pre><code>[-vendor-prefix-]box-shadow: inset [x offset] [y offset] [blur radius] [color];</code></pre>
<p>border-radius might also be a good candidate for a time-saving snippet. Probably the most common use of this is where we want to specify equally rounded corners on all round our box. We could use the same style of tab triggered snippet as with the box-shadow example. The snippet would be very simple with just a single placeholder &#8211; something like this:</p>
<pre><code>-moz-border-radius: ${1:1em};
-webkit-border-radius: ${1:1em};
border-radius: ${1:1em};</code></pre>
<p>TextMate is a wonderful editor and snippets really do make this stuff a breeze.</p>
<div id="crp_related"><h2>Related Articles:</h2><ul><li><a href="http://think-robot.com/2011/06/wordpress-update-permission-issues/" rel="bookmark">WordPress update permission issues</a></li><li><a href="http://think-robot.com/2008/10/display-meetings-from-entourage-using-geektool/" rel="bookmark">Display Meetings From Entourage Using GeekTool</a></li><li><a href="http://think-robot.com/2008/11/wordpress-nextgen-gallery-tweak/" rel="bookmark">WordPress NextGen gallery tweak</a></li><li><a href="http://think-robot.com/2008/08/opensuse-11-on-lenovo-thinkpad-x61-tablet-pc/" rel="bookmark">openSUSE 11 on Lenovo Thinkpad X61 (tablet pc)</a></li><li><a href="http://think-robot.com/2010/08/mantis-theme-mock-up/" rel="bookmark">Mantis theme mock-up</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://think-robot.com/2010/09/using-textmate-for-easier-css3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Hitch. Object-oriented event handlers with jQuery</title>
		<link>http://think-robot.com/2009/06/hitch-object-oriented-event-handlers-with-jquery/</link>
		<comments>http://think-robot.com/2009/06/hitch-object-oriented-event-handlers-with-jquery/#comments</comments>
		<pubDate>Sun, 14 Jun 2009 20:21:51 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[bind]]></category>
		<category><![CDATA[event handling]]></category>
		<category><![CDATA[hitch]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[object oriented]]></category>

		<guid isPermaLink="false">http://think-robot.com/?p=187</guid>
		<description><![CDATA[Moving to jQuery from YUI has been a 99% positive experience. Probably the only thing I&#8217;ve really missed was the ability provided by YUI Event to control the object scope that an event handler was executed in. When you attach an event to an element in jQuery within the event handler function the this keyword [...]]]></description>
			<content:encoded><![CDATA[<p>Moving to jQuery from YUI has been a 99% positive experience. Probably the only thing I&#8217;ve really missed was the ability provided by <a href="http://developer.yahoo.com/yui/event/" target="_blank">YUI Event</a> to control the object scope that an event handler was executed in.</p>
<p><span id="more-187"></span></p>
<p>When you attach an event to an element in jQuery within the event handler function the this keyword always refers to the element that triggered the event.</p>
<pre><code>$('a').bind('click', function() {
    alert(this);
});</code></pre>
<p>Here this will be the a element that triggered the event. For the majority of the time this behaviour is absolutely ideal. However, if you&#8217;re using object oriented javascript and are trying to handle an event using a method of one of your classes, the chances are you&#8217;d want this to refer to the instance of your class instead of the DOM element.</p>
<pre><code>var Klass = function() {
    this.message = 'hello';
};
Klass.prototype.handleClick = function(e) {
    alert(this.message);
};
var obj = new Klass();

$('a').bind('click', obj.handleClick);</code></pre>
<p>The above fails because when Klass.prototype.handleClick is triggered from the click event this still refers to the a element that was clicked on. Hence this.message is undefined.</p>
<p>To solve this problem I made a small jQuery plugin called hitch that allows you to control the object scope. The above example would be rewritten as</p>
<pre><code>var Klass = function() {
    this.message = 'hello';
};
Klass.prototype.handleClick = function(e) {
    alert(this.message);
};
var obj = new Klass();

$('a').hitch('click', obj.handleClick, obj);</code></pre>
<p>If the handleClick method needs to access the DOM element that triggered the event, that can still be accessed through e.target. If the object scope argument is omitted then hitch should work in the same way as the standard bind method.</p>
<p>The plugin itself is just a few lines</p>
<pre><code>(function($) {
    $.fn.hitch = function(ev, fn, scope) {
        return this.bind(ev, function() {
            return fn.apply(scope || this, Array.prototype.slice.call(arguments));
        });
    };
})(jQuery);</code></pre>
<p>I believe similar functionality is scheduled to be included in an upcoming jQuery release, but for the time being I&#8217;m finding this plugin to be exceptionally useful.</p>
<div id="crp_related"><h2>Related Articles:</h2><ul><li><a href="http://think-robot.com/2011/03/jquery-multiple-events-without-default-behaviour/" rel="bookmark">jQuery Multiple Events Without Default Behaviour</a></li><li><a href="http://think-robot.com/2008/11/nested-sortable-using-jtree-clickable-links/" rel="bookmark">Nested sortable using jTree - clickable links</a></li><li><a href="http://think-robot.com/2011/01/enable-delayed-messages-in-zend_queue/" rel="bookmark">Enable delayed messages in Zend_Queue</a></li><li><a href="http://think-robot.com/2010/03/multiple-changes-and-a-delete-on-same-object-in-doctrine/" rel="bookmark">Multiple changes and a delete on same object in doctrine</a></li><li><a href="http://think-robot.com/2008/10/display-meetings-from-entourage-using-geektool/" rel="bookmark">Display Meetings From Entourage Using GeekTool</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://think-robot.com/2009/06/hitch-object-oriented-event-handlers-with-jquery/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Week of the Month in Mysql</title>
		<link>http://think-robot.com/2009/04/week-of-the-month-in-mysql/</link>
		<comments>http://think-robot.com/2009/04/week-of-the-month-in-mysql/#comments</comments>
		<pubDate>Sun, 26 Apr 2009 15:37:16 +0000</pubDate>
		<dc:creator>Joanna</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[Mysql]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[stackoverflow]]></category>
		<category><![CDATA[week]]></category>

		<guid isPermaLink="false">http://think-robot.com/?p=173</guid>
		<description><![CDATA[SELECT WEEK(my_date_field,5) - WEEK(DATE_SUB(my_date_field, INTERVAL DAYOFMONTH(my_date_field)-1 DAY),5)+1 Recently I needed to get the number of the week in a certain month. There is the handy WEEK() function, however it only gives you the week of the year. Obviously before we can go through the code above, a definition of the nth week of the month [...]]]></description>
			<content:encoded><![CDATA[<pre><code>SELECT WEEK(my_date_field,5) -
WEEK(DATE_SUB(my_date_field, INTERVAL DAYOFMONTH(my_date_field)-1 DAY),5)+1
</code></pre>
<p><span id="more-173"></span><br />
Recently I needed to get the number of the week in a certain month. There is the handy <strong>WEEK()</strong> function, however it only gives you the week of the year.</p>
<p>Obviously before we can go through the code above, a definition of the <strong>n<sup>th</sup></strong> week of the month is needed (as I realized after <a href="http://stackoverflow.com/questions/785206/function-for-week-of-the-month-in-mysql">asking the question on stackoverflow</a>&#8230;):</p>
<p>For me the week starts on a Monday, and the first week of the month does not have to be a full week &#8211; if a month starts on a Friday, the Friday to Sunday days count as the first week.</p>
<p>With this out of the way here is a quick explanation of what goes on above.</p>
<pre><code>WEEK(my_date_field,<strong>5</strong>)</code></pre>
<p>First we get the actual week number of the year for the specified date. The second parameter is there to define Monday as the first day of the week (<a href="http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_week">more details in Mysql manual</a>).</p>
<pre><code>DAYOFMONTH(my_date_field)</code></pre>
<p>Next we get the day of the month for the specified date.</p>
<pre><code>DATE_SUB(my_date_field, <strong>DAYOFMONTH(my_date_field)</strong>-1 DAY)</code></pre>
<p>We can use that number with <strong>DATE_SUB</strong> to get the date for the 1<sup>st</sup> day of the month. This in turn can be used to get the week number for the 1<sup>st</sup> week of the month.</p>
<pre><code>SELECT WEEK(my_date_field,5) -
WEEK(<strong>DATE_SUB(my_date_field, INTERVAL DAYOFMONTH(my_date_field)-1 DAY)</strong>,5)+1
</code></pre>
<p>Finally we subtract the first day&#8217;s week from the actual week number which should give us the month&#8217;s week number starting from 0. Thus the final <strong>+1</strong> if you want the count to start from 1.</p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" src="http://img.zemanta.com/pixy.gif?x-id=55c87db5-a5a4-45e9-92f1-43c731c03ece" /><span class="zem-script more-related pretty-attribution"><script type="text/javascript" src="http://static.zemanta.com/readside/loader.js" defer="defer"></script></span></div>
<div id="crp_related"><h2>Related Articles:</h2><ul><li><a href="http://think-robot.com/2008/06/atmedia-london-2008/" rel="bookmark">@media - London, 2008</a></li><li><a href="http://think-robot.com/2009/02/firefox-ignores-tabs-but-not-spaces-in-a-pre-tag/" rel="bookmark">Firefox ignores tabs but not spaces in a pre tag</a></li><li><a href="http://think-robot.com/2009/02/how-to-use-the-strong-ownership-list/" rel="bookmark">How To Use the Strong Ownership List</a></li><li><a href="http://think-robot.com/2009/12/zend_date-time-part-and-gmt/" rel="bookmark">Zend_Date time part and GMT</a></li><li><a href="http://think-robot.com/2011/03/jquery-multiple-events-without-default-behaviour/" rel="bookmark">jQuery Multiple Events Without Default Behaviour</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://think-robot.com/2009/04/week-of-the-month-in-mysql/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Zend_Db_Select multiple table joins explained</title>
		<link>http://think-robot.com/2009/04/zend_db_select-multiple-table-joins-explained/</link>
		<comments>http://think-robot.com/2009/04/zend_db_select-multiple-table-joins-explained/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 22:52:23 +0000</pubDate>
		<dc:creator>Joanna</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[ORM]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Zend]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[Zend_Db_select]]></category>
		<category><![CDATA[Zend_Db_Table_Abstract]]></category>

		<guid isPermaLink="false">http://think-robot.com/?p=156</guid>
		<description><![CDATA[It sounds like a simple task &#8211; retrieve the result from a join SQL query. Unusually you can even find documentation on the official Zend Framework site explaining how to put together a query that will return the results from a JOIN query. Unfortunately when it actually comes to putting theory into practice any Zend [...]]]></description>
			<content:encoded><![CDATA[<p>It sounds like a simple task &#8211; retrieve the result from a join SQL query. Unusually you can even find <a href="http://framework.zend.com/manual/en/zend.db.select.html" target="_blank">documentation on the official Zend</a> Framework site explaining how to put together a query that will return the results from a JOIN query. Unfortunately when it actually comes to putting theory into practice any Zend newcomer can run into several problems.<span id="more-156"></span></p>
<h2>You Think It&#8217;s Easy&#8230;</h2>
<p>For starters rather than use &#8220;raw&#8221; <strong>Zend_Db_Select</strong>:</p>
<pre><code>$select = $db-&gt;select();</code></pre>
<p>I wanted to derive the select from my <strong>Zend_Db_Table_Abstract</strong>, like so:</p>
<pre><code>
class Model_Db_Website extends Zend_Db_Table_Abstract {
	(...)
	public function fetchWebsites(){
		$select = $this-&gt;select();
		$select-&gt;join(array('whi' =&gt; 'website_has_images), 'whi.website_id = websites.website_id')
		return $this-&gt;fetchAll($select);
	}
}
</code></pre>
<p>This was more or less the example I found in the documentation. You might be wondering what is wrong with this picture. At first it seems like there is nothing missing. The table fields and the table name (for the FROM clause) are taken from the table class, and we have provided all the necessary JOIN details&#8230; However instead of the expected result, you an error message!</p>
<pre class="msg"><code><strong>Message:</strong> Select query cannot join with another table </code></pre>
<h2>The Solution</h2>
<p>Not to prolong any more here is the final bit, which we will walk-through below.</p>
<pre><code>
class Model_Db_Website extends Zend_Db_Table_Abstract {
	(...)
	public function fetchWebsites(){
		$select = $this-&gt;select();
		$select<strong>-&gt;setIntegrityCheck(false)</strong>
			<strong>-&gt;from($this-&gt;_name, '*')</strong>
			-&gt;join(
				array('whi' =&gt; 'website_has_images'),
				'whi.website_id = websites.website_id'<strong>, '*'</strong>
    			);
		return $this-&gt;fetchAll($select);
	}
}
</code></pre>
<p>The first thing you need to do is get rid of the error. This one has been mentioned online quite a lot and is easy to fix by applying:</p>
<pre class="msg"><code>-&gt;setIntegrityCheck(false)</code></pre>
<p>The code above makes your result set read only, but allows you to do joins.</p>
<p>Now for the less obvious bits. Once the above problem is fixed you will notice that your results only include the join table fields. To fix this add the final parameter to the list &#8211; either a &#8216;*&#8217; or an explicit list of fields.</p>
<p><strong>Many sites suggest using an empty array, though this causes the result set to return only main table fields&#8230;</strong></p>
<p>The &#8216;*&#8217; is not enough though. You still need the from declaration <strong>-&gt;from($this-&gt;_name, &#8216;*&#8217;)</strong>, as without you will still be getting just the join table fields.</p>
<p>So there you go, it took me quite a bit of fiddling and randomly changing the parameter set to arrive at the final solution. Hope it saves you the hassle too!</p>
<div id="crp_related"><h2>Related Articles:</h2><ul><li><a href="http://think-robot.com/2009/05/doctrine-many-to-many-with-extra-fields/" rel="bookmark">Doctrine Many To Many With Extra Fields</a></li><li><a href="http://think-robot.com/2011/03/jquery-multiple-events-without-default-behaviour/" rel="bookmark">jQuery Multiple Events Without Default Behaviour</a></li><li><a href="http://think-robot.com/2008/11/wordpress-nextgen-gallery-tweak/" rel="bookmark">WordPress NextGen gallery tweak</a></li><li><a href="http://think-robot.com/2009/04/week-of-the-month-in-mysql/" rel="bookmark">Week of the Month in Mysql</a></li><li><a href="http://think-robot.com/2011/01/enable-delayed-messages-in-zend_queue/" rel="bookmark">Enable delayed messages in Zend_Queue</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://think-robot.com/2009/04/zend_db_select-multiple-table-joins-explained/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Display Meetings From Entourage Using GeekTool</title>
		<link>http://think-robot.com/2008/10/display-meetings-from-entourage-using-geektool/</link>
		<comments>http://think-robot.com/2008/10/display-meetings-from-entourage-using-geektool/#comments</comments>
		<pubDate>Wed, 29 Oct 2008 00:04:02 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Entourage]]></category>
		<category><![CDATA[GeekTool]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[meetings]]></category>

		<guid isPermaLink="false">http://www.think-robot.com/?p=16</guid>
		<description><![CDATA[I&#8217;ve been a recent convert to GeekTool, a Mac application that can be used to display the output of shell commands directly on the desktop. After going through the usual cool little GeekTool ideas of displaying process lists, system uptime, and the currently playing song from iTunes etc. I decided to do something that was [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been a recent convert to <a href="http://projects.tynsoe.org/en/geektool/">GeekTool</a>, a Mac application that can be used to display the output of shell commands directly on the desktop. After going through the usual cool little GeekTool ideas of displaying process lists, system uptime, and the currently playing song from iTunes etc. I decided to do something that was genuinely useful for my day-to-day use <img src='http://think-robot.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> <span id="more-16"></span></p>
<p>At work we use MS Entourage for our email and calendaring. I thought it might be handy to be able to see at a glance what meetings I had scheduled without needing to switch away from my inbox. As a result I turned my hand to a little AppleScript to pull a list of forthcoming meetings from Entourage,</p>
<pre><code>set currentDate to current date
if application "Microsoft Entourage" is running then
    tell application "Microsoft Entourage"
        set selectedEvents to every event where its start time is greater than currentDate
        set eventString to ""
        repeat with currentEvent in selectedEvents
            set eventTitle to subject of currentEvent
            set eventDate to start time of currentEvent
            set eventString to eventString &amp; eventTitle &amp; " - " &amp; eventDate &amp; "\n"
        end repeat
        if eventString is not equal to "" then
            set eventString to "Upcoming...\n" &amp; eventString
        else
            set eventString to "Nothing upcoming...\n"
        end if
        eventString
    end tell
end if
</code></pre>
<p>Save this somewhere as meetings.scpt, then the GeekTool PrefPane add a new entry and in the command tab select the shell option and enter <code>osascript path/to/meetings.scpt</code> in the command field.</p>
<p>Done</p>
<div id="crp_related"><h2>Related Articles:</h2><ul><li><a href="http://think-robot.com/2009/02/how-to-use-the-strong-ownership-list/" rel="bookmark">How To Use the Strong Ownership List</a></li><li><a href="http://think-robot.com/2010/09/using-textmate-for-easier-css3/" rel="bookmark">Using TextMate for easier CSS3</a></li><li><a href="http://think-robot.com/2008/11/wordpress-nextgen-gallery-tweak/" rel="bookmark">WordPress NextGen gallery tweak</a></li><li><a href="http://think-robot.com/2009/12/zend_date-time-part-and-gmt/" rel="bookmark">Zend_Date time part and GMT</a></li><li><a href="http://think-robot.com/2009/06/hitch-object-oriented-event-handlers-with-jquery/" rel="bookmark">Hitch. Object-oriented event handlers with jQuery</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://think-robot.com/2008/10/display-meetings-from-entourage-using-geektool/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How to convert PDT projects into PHPEclipse projects</title>
		<link>http://think-robot.com/2008/10/how-to-convert-pdt-projects-into-phpeclipse-projects/</link>
		<comments>http://think-robot.com/2008/10/how-to-convert-pdt-projects-into-phpeclipse-projects/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 10:12:56 +0000</pubDate>
		<dc:creator>Joanna</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[PDT]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[PHPEclipse]]></category>
		<category><![CDATA[projects]]></category>

		<guid isPermaLink="false">http://www.think-robot.com/?p=14</guid>
		<description><![CDATA[If for some reason you decide to swap from one Eclipse based PHP IDE to another, rather than recreate the projects you can change their association, so that the project builders work correctly. This is basically what you need to do if you get the following error when trying to ctrl clicka function: &#8220;The resource [...]]]></description>
			<content:encoded><![CDATA[<p>If for some reason you decide to swap from one Eclipse based PHP IDE to another, rather than recreate the projects you can change their association, so that the project builders work correctly.</p>
<p>This is basically what you need to do if you get the following error when trying to ctrl clicka function:</p>
<p><strong>&#8220;The resource is not on the build path of a PHP project&#8221;</strong></p>
<p>To convert to a PHPEclipse compatible project you basically need to replace the buildSpec and natures sections of the<strong> .project</strong> file with the following:</p>
<pre>&lt;buildSpec&gt;
	&lt;buildCommand&gt;
		&lt;name&gt;net.sourceforge.phpeclipse.parserbuilder&lt;/name&gt;
		&lt;arguments&gt;
		&lt;/arguments&gt;
	&lt;/buildCommand&gt;
&lt;/buildSpec&gt;
&lt;natures&gt;
	&lt;nature&gt;net.sourceforge.phpeclipse.phpnature&lt;/nature&gt;
&lt;/natures&gt;</pre>
<p>If you need to convert the other way, or to something else, simply grab the appropriate section from a working project and paste it into the<strong> .project</strong> file you need to fix.</p>
<div id="crp_related"><h2>Related Articles:</h2><ul><li><a href="http://think-robot.com/2008/12/strong-ownership-list-approach/" rel="bookmark">Strong ownership list approach</a></li><li><a href="http://think-robot.com/2009/02/how-to-use-the-strong-ownership-list/" rel="bookmark">How To Use the Strong Ownership List</a></li><li><a href="http://think-robot.com/2008/11/nested-sortable-using-jtree-clickable-links/" rel="bookmark">Nested sortable using jTree - clickable links</a></li><li><a href="http://think-robot.com/2008/10/display-meetings-from-entourage-using-geektool/" rel="bookmark">Display Meetings From Entourage Using GeekTool</a></li><li><a href="http://think-robot.com/2009/02/improving-design-by-using-a-grid-system/" rel="bookmark">Improving Design by Using a Grid System</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://think-robot.com/2008/10/how-to-convert-pdt-projects-into-phpeclipse-projects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to use special characters in FPDF</title>
		<link>http://think-robot.com/2008/09/how-to-use-special-characters-in-fpdf/</link>
		<comments>http://think-robot.com/2008/09/how-to-use-special-characters-in-fpdf/#comments</comments>
		<pubDate>Wed, 24 Sep 2008 12:45:49 +0000</pubDate>
		<dc:creator>Joanna</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[FPDF]]></category>
		<category><![CDATA[iconv]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[UTF8]]></category>

		<guid isPermaLink="false">http://www.think-robot.com/?p=12</guid>
		<description><![CDATA[FPDF is a nice little library for php that allows you to create PDFs on the fly. It&#8217;s great for all sorts of document, amongs them invoices. Until you try to use say a pound (£) or euro (€) sign. Basically the library itself does not support utf-8, so the moment you need to insert [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.fpdf.org" target="_blank">FPDF</a> is a nice little library for php that allows you to create PDFs on the fly. It&#8217;s great for all sorts of document, amongs them invoices. Until you try to use say a pound (£) or euro (€) sign. Basically the library itself does not support utf-8, so the moment you need to insert anything extra into your document a conversion needs to be done.</p>
<p>To save you some searching and a masive panic attack here is the easy way to do it:</p>
<pre>iconv("UTF-8", "ISO-8859-1", "£");</pre>
<p>You could also use the same command to do the whole text rather than just the pound sign itself.  Example below:<br />
<span id="more-12"></span><br />
You can use the iconv function at any point, however probably the easiest solution is to put it inside functions of the class you use to extend FPDF:</p>
<pre>class myPdf extends FPDF {
    [...]
    public function showMoney($money){
        $this-&gt;cell(10,10,<strong>iconv("UTF-8", "ISO-8859-1", "£").</strong> $money,0);
    }
}</pre>
<div id="crp_related"><h2>Related Articles:</h2><ul><li><a href="http://think-robot.com/2011/01/enable-delayed-messages-in-zend_queue/" rel="bookmark">Enable delayed messages in Zend_Queue</a></li><li><a href="http://think-robot.com/2009/05/doctrine-many-to-many-with-extra-fields/" rel="bookmark">Doctrine Many To Many With Extra Fields</a></li><li><a href="http://think-robot.com/2008/11/nested-sortable-using-jtree-clickable-links/" rel="bookmark">Nested sortable using jTree - clickable links</a></li><li><a href="http://think-robot.com/2009/04/zend_db_select-multiple-table-joins-explained/" rel="bookmark">Zend_Db_Select multiple table joins explained</a></li><li><a href="http://think-robot.com/2010/09/using-textmate-for-easier-css3/" rel="bookmark">Using TextMate for easier CSS3</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://think-robot.com/2008/09/how-to-use-special-characters-in-fpdf/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
	</channel>
</rss>

