<?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>anomalous territory &#187; articles</title>
	<atom:link href="http://www.volved.com/index.php/category/articles/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.volved.com</link>
	<description>random blip on the radar of eternity</description>
	<lastBuildDate>Tue, 17 Nov 2009 17:19:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>CakePHP 1.2 GROUP BY with HAVING COUNT(*) HABTM associations (limit the query based on associated data)</title>
		<link>http://www.volved.com/index.php/2009/03/26/cakephp-12-group-by-with-having-count-habtm-associations-limit-the-query-based-on-associated-data/</link>
		<comments>http://www.volved.com/index.php/2009/03/26/cakephp-12-group-by-with-having-count-habtm-associations-limit-the-query-based-on-associated-data/#comments</comments>
		<pubDate>Thu, 26 Mar 2009 16:05:31 +0000</pubDate>
		<dc:creator>volve</dc:creator>
				<category><![CDATA[articles]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.volved.com/2009/03/26/cakephp-12-group-by-with-having-count-habtm-associations-limit-the-query-based-on-associated-data/</guid>
		<description><![CDATA[The problem: Your models look like this “Images HABTM Albums” so when you want to show 4 Albums, they come along with their Images too – great! BUT, what happens if some Albums don’t have any Images? You don’t want to show those to your users, but how do you filter them out? Well you [...]]]></description>
			<content:encoded><![CDATA[<p>The problem: Your models look like this “Images HABTM Albums” so when you want to show 4 Albums, they come along with their Images too – great! BUT, what happens if some Albums don’t have any Images? You don’t want to show those to your users, but how do you filter them out? Well you could do it after the find() has run, in which case you may end-up with less than 4 useable Albums – bad <img src='http://www.volved.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  To workaround that you could always ask find() to give you 8 Albums in the hope that at least 50% of them will be useable, but there’s no guarantee – still bad.</p>
<p>The solution below takes advantage of CakePHP 1.2’s bindModel() method to manually create an INNER JOIN in place of the pre-defined HABTM association. This allows us to execute the find() with a HAVING COUNT(*) in the group option. In the example below, this causes any Albums with 0 Images to be omitted from the results as they don’t meet the HAVING criteria. What’s more, the limit of 4 correlates exactly so 8-just-incase kludge needed.</p>
<p>This was driving me crazy so here&#8217;s the solution for anyone else that might be stuck in the same situation. (This method is in the Albums model.)</p>
<pre style="font-size: 1.2em; overflow: auto; background-color: #111; text-align: left">  function getAlbums($num=4) {
    $contain = array( <em><font color="#808080">// use Containable Behavior for efficiency</font></em>      'AlbumsImage',
      'FilterImage',<em><font color="#808080">// although part of the magic and required, this seems to confuse CakePHP a little - I'll try and resolve it and update the post</font></em>
      'Image',
      'Image'=&gt;array('ImageSize',
                     'fields'=&gt;array('Image.id','Image.title','Image.host','Image.path')),
      'User'=&gt;array('fields'=&gt;'User.id,User.username'));

    $this-&gt;bindModel(array('hasOne'=&gt;array('AlbumsImage',
                                           'FilterImage'=&gt;array( <em><font color="#808080">// FilterImage so as to distinguish between regular Image</font></em>
                                                 'className'=&gt;'Image',
                                                 'foreignKey'=&gt;false,
                                                 'type'=&gt;'INNER',
                                                 'conditions'=&gt;array(
                                                     'FilterImage.status = 0',
                                                     'FilterImage.id = AlbumsImage.image_id')
                                                 )
                                           )
                           ));

    $albums = $this-&gt;find('all', array('contain' =&gt; $contain,
                                    'conditions' =&gt; array('Album.status'=&gt;'0'),
                                        'fields' =&gt; array('Album.id','Album.user_id','Album.title'),
                                         'order' =&gt; 'Album.created DESC',
                                         'limit' =&gt; $num,
                                         'group' =&gt; array('Album.id','Album.title HAVING COUNT(*) &gt;= 1'))); <em><font color="#808080">// here's the clincher</font></em>

    return $albums;
  }</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.volved.com/index.php/2009/03/26/cakephp-12-group-by-with-having-count-habtm-associations-limit-the-query-based-on-associated-data/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>media server software rant update (mini review)</title>
		<link>http://www.volved.com/index.php/2006/02/06/media-server-software-rant-update-mini-review/</link>
		<comments>http://www.volved.com/index.php/2006/02/06/media-server-software-rant-update-mini-review/#comments</comments>
		<pubDate>Mon, 06 Feb 2006 04:00:28 +0000</pubDate>
		<dc:creator>volve</dc:creator>
				<category><![CDATA[articles]]></category>
		<category><![CDATA[media storage]]></category>
		<category><![CDATA[movies]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[ui]]></category>

		<guid isPermaLink="false">http://www.volved.com/wordpress/2006/02/06/media-server-software-rant-update-mini-review/</guid>
		<description><![CDATA[It appears that the sorry state of UIs in media server software doesn&#8217;t extend to the Mac platform. I&#8217;ve been surfing around reading a few obscure articles this week and although the software isn&#8217;t very mature, I&#8217;ve been quite impressed with several Mac projects. Namely: MediaCentral, CenterStage, iTheatre, and CoverFlow. The best part is that [...]]]></description>
			<content:encoded><![CDATA[<p>It appears that the sorry state of UIs in media server software doesn&#8217;t extend to the Mac platform. I&#8217;ve been surfing around reading a few obscure articles this week and although the software isn&#8217;t very mature, I&#8217;ve been quite impressed with several Mac projects. Namely: <a href="http://www.equinux.com/us/products/mediacentral/">MediaCentral</a>, <a href="http://www.centerstageproject.com/">CenterStage</a>, <a href="http://www.itheaterproject.com/">iTheatre</a>, and <a href="http://www.steelskies.com/coverflow/">CoverFlow</a>. The best part is that unlike some of the Windows appliations, these three for the Mac are free! (Try saying that ten times fast.)</p>
<p>Although <a href="http://www.equinux.com/us/products/mediacentral/">MediaCentral</a> is quite text-based for navigation, its presentation is definitely a lot sharper and more refined than any of the others. <a href="http://www.centerstageproject.com/">CenterStage</a> is intersting and has a lot of potential, but better be careful not to &#8216;over utilize&#8217; available space. It&#8217;s definitely the most mature of the projects. My main gripe is that if I&#8217;m browsing a bunch of movie covers (which BackStage &#8211; the <a href="http://www.centerstageproject.com/">CenterStage</a> backend component sucsessfully downloaded for me), why do I need a text title underneath them? I don&#8217;t; it simply wastes space. Also the cover browsing section seems awfully small, but as I didn&#8217;t poke too deeply, one might be able to turn off the preview area to the right (that would be handy). <a href="http://www.itheaterproject.com/">iTheatre</a> is at RC1 currently and has quite a few pieces of missing functionality, but could be nice although is heavily text-based like MediaCentral. <a href="http://www.steelskies.com/coverflow/">CoverFlow</a> is purely for browsing your music but it is such a simple, obvious UI that it merits mentioning. Hopefully its ideas can be intergrated into a more encompassing media browser.</p>
<div align="center">
<div>
<table width="340">
<tr>
<th>MediaCentral</th>
</tr>
<tr>
<td><a target="_blank" href="http://files.volved.com/images/articles/mediacentral_01_lg.jpg"><img width="320" height="180" border="0" align="middle" src="http://files.volved.com/images/articles/mediacentral_01_sm.jpg" /></a></td>
</tr>
<tr>
<td align="center">(<a target="_blank" href="http://files.volved.com/images/articles/mediacentral_01_lg.jpg">lg</a>, <a target="_blank" href="http://files.volved.com/images/articles/mediacentral_01_xl.jpg">xl</a>)</td>
</tr>
</table>
</div>
<div>
<table width="340">
<tr>
<th>CenterStage</th>
</tr>
<tr>
<td><a target="_blank" href="http://files.volved.com/images/articles/centerstage_01_lg.jpg"><img width="320" height="180" border="0" align="middle" src="http://files.volved.com/images/articles/centerstage_01_sm.jpg" /></a></td>
</tr>
<tr>
<td align="center">(<a target="_blank" href="http://files.volved.com/images/articles/centerstage_01_lg.jpg">lg</a>, <a target="_blank" href="http://files.volved.com/images/articles/centerstage_01_xl.jpg">xl</a>)</td>
</tr>
</table>
</div>
<div>
<table width="340">
<tr>
<th>iTheatre</th>
</tr>
<tr>
<td><a target="_blank" href="http://files.volved.com/images/articles/itheatre_01_lg.jpg"><img width="320" height="180" border="0" src="http://files.volved.com/images/articles/itheatre_01_sm.jpg" /></a></td>
</tr>
<tr>
<td align="center">(<a target="_blank" href="http://files.volved.com/images/articles/itheatre_01_lg.jpg">lg</a>, <a target="_blank" href="http://files.volved.com/images/articles/itheatre_01_xl.jpg">xl</a>)</td>
</tr>
</table>
</div>
<div>
<table width="340">
<tr>
<th>CoverFlow</th>
</tr>
<tr>
<td><a target="_blank" href="http://files.volved.com/images/articles/coverflow_01_lg.jpg"><img width="320" height="180" border="0" align="middle" src="http://files.volved.com/images/articles/coverflow_01_sm.jpg" /></a></td>
</tr>
<tr>
<td align="center">(<a target="_blank" href="http://files.volved.com/images/articles/coverflow_01_lg.jpg">lg</a>, <a target="_blank" href="http://files.volved.com/images/articles/coverflow_01_xl.jpg">xl</a>)</td>
</tr>
</table>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.volved.com/index.php/2006/02/06/media-server-software-rant-update-mini-review/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RDP over SSH</title>
		<link>http://www.volved.com/index.php/2006/01/19/rdp-over-ssh/</link>
		<comments>http://www.volved.com/index.php/2006/01/19/rdp-over-ssh/#comments</comments>
		<pubDate>Thu, 19 Jan 2006 04:00:54 +0000</pubDate>
		<dc:creator>volve</dc:creator>
				<category><![CDATA[articles]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://www.volved.com/wordpress/2006/01/19/rdp-over-ssh/</guid>
		<description><![CDATA[I&#8217;d been having some annoyances with RDP (Remote Desktop) over SSH. The primary source of annoyance stemmed from the Win2k/XP client not allowing you to connect to your local IP regardless of port, forwarded or otherwise. Luckily,  it isn&#8217;t actually clever enough to know that the 127.0.0.2 address is also tied to the loopback [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;d been having some annoyances with RDP (Remote Desktop) over SSH. The primary source of annoyance stemmed from the Win2k/XP client not allowing you to connect to your local IP regardless of port, forwarded or otherwise. Luckily,  it isn&#8217;t actually clever enough to know that the 127.0.0.<strong>2</strong> address is also tied to the loopback device (one of Microsoft&#8217;s little liberties that turns out to actually be handy &#8211; who knew?!). So, here&#8217;s a solution that&#8217;ll save you time struggling and cash from buying an application such as WiSSH that is entirely unnecessary.</p>
<p><span id="more-33"></span></p>
<p>You&#8217;ll need to go and get <a href="http://the.earth.li/~sgtatham/putty/latest/x86/plink.exe">plink.exe</a> from <a title="A Free Telnet/SSH Client" href="http://www.chiark.greenend.org.uk/~sgtatham/putty/">PuTTY</a>, but that&#8217;s about it.</p>
<p>To open the tunnel, run the following:</p>
<div class="code"><code>plink.exe -ssh -2 -batch -v -L 127.0.0.2:<<em>any available local port to listen on</em>>:<<em>IP address of machine running RDP behind SSH server</em>>:3389 -pw <<em>password</em>> -P <<em>port SSH is listening on [default is 22] </em>> <<em>user</em>>@<<em>SSH server IP address or hostname</em>> "sleep 30"</code></div>
<p class="noteItalic">NOTE: The first time you run this, do <strong>not</strong> include the &#8220;-batch&#8221; parameter or the &#8220;sleep 30&#8243; command on the end because you have to manually accept the SSH server&#8217;s key so it gets added to your Windows registry for future use, and then type &#8220;exit&#8221; to disconnect.</p>
<p>For example, the command looks like this for me:</p>
<div class="code"><code>plink.exe -ssh -2 -batch -v -L 127.0.0.2:<strong>3390</strong>:<strong>192.168.0.100</strong>:3389 -pw <strong>feedmepie</strong> -P <strong>2222</strong> <strong>wibbles</strong>@<strong>volved.com</strong> "sleep 30"</code></div>
<p><code class="codeSmall">"sleep 30"</code> is required (including quotes) as this keeps the channel open for 30 seconds, which should be long enough for you to open your RDP connection with 127.0.0.2:3390 as the server address.</p>
<p>Use the following command to open your RDP connection from a batch file, or the Start->Run dialog (the parameters in bold are for screen Width and Height, and obviously optional):</p>
<div class="code"><code>mstsc.exe /v:127.0.0.2:3390 <strong>/w:1280 /h:1024</strong></code></div>
<p>Here&#8217;s a screenshot of what the plink.exe command looks like. On the last line, it&#8217;s indicating that it has just run the <code class="codeSmall">sleep 30</code> command and then it sits waiting for the open port forwarding to be used:<br />
<img class="screenshot screenshotPadTopLeft" src="/images/rdp_over_ssh.png" /></p>
<p>To simplify all of this, I cleaned-up a VBS script I <abbr title="I wish I could remember where...">found</abbr> that prompts for all of the parameters in turn so you don&#8217;t have to keep them saved in an insecure batch file or anything. Grab a copy of <a href="/rdp_connect.vbs">rdp_connect.vbs</a> and put it in the same directory as <a href="http://the.earth.li/~sgtatham/putty/latest/x86/plink.exe">plink.exe</a> and after connecting, it&#8217;ll automatically run the RDP client and attempt to connect for you. To create a shortcut to this script, you&#8217;ll want to prefix it with the <code class="codeSmall">wscript</code> command as simply double-clicking a .vbs file does nothing but open a text editor (not entirely helpful really).</p>
<div id="footerNotes">
<hr width="30%" size="1" noshade="noshade" align="left" />Further information about the terms used in this article can be found at <a href="http://www.wikipedia.org/">Wikipedia.org</a>: <a href="http://en.wikipedia.org/wiki/Ssh">SSH</a>, <a href="http://en.wikipedia.org/wiki/Remote_Desktop_Protocol">RDP</a>, <a href="http://en.wikipedia.org/wiki/PuTTY">PuTTY</a>, <a href="http://en.wikipedia.org/wiki/VBScript">VBS</a>, <a href="http://en.wikipedia.org/wiki/Loopback">Loopback</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.volved.com/index.php/2006/01/19/rdp-over-ssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

