<?xml version="1.0" encoding="ISO-8859-1"?>
<feed version="0.3" xmlns="http://purl.org/atom/ns#" xml:lang="en-US">
	<title>Bug Features - Free bug report and feature request service for your Web site.</title>
	<link rel="alternate" type="text/html" href="http://bugfeatures.com/blog/index.php" />
	<modified>2008-11-21T08:07:38Z</modified>
	<author>
		<name>Dan</name>
	</author>
	<copyright>Copyright 2008, Dan</copyright>
	<generator url="http://www.sourceforge.net/projects/sphpblog" version="0.4.8">SPHPBLOG</generator>
	<entry>
		<title>Improved IE select trick</title>
		<link rel="alternate" type="text/html" href="http://bugfeatures.com/blog/index.php?entry=entry081118-173741" />
		<content type="text/html" mode="escaped"><![CDATA[I was experiencing problems with the blur handler not firing inside iframes so this is my new and improved version of the code below:<br /><br /><code><br />function grow_select(){<br />  if (document.all){<br />    $(&#039;product&#039;).style.width=&#039;auto&#039;;<br />    $(&#039;product&#039;).style.position=&#039;absolute&#039;;<br />    $(&#039;product&#039;).style.zIndex=100;<br />  }<br />}<br />function shrink_select(){<br />  $(&#039;product&#039;).style.position=&#039;relative&#039;;<br />  $(&#039;product&#039;).style.width=&#039;150px&#039;;<br />}<br /><br /><br />function checkLocation(e)<br />{<br />  if (e.srcElement)  {<br />    el = (e.srcElement);<br />  }<br />  else if (e.target)  {<br />    el = (e.target);<br />  }<br />  if (el != \$(&#039;product&#039;)){<br />    shrink_select();<br />  }<br />}<br /><br />Event.observe(document, &#039;mousemove&#039;, checkLocation);<br /></code>]]></content>
		<id>http://bugfeatures.com/blog/index.php?entry=entry081118-173741</id>
		<issued>2008-11-19T00:00:00Z</issued>
		<modified>2008-11-19T00:00:00Z</modified>
	</entry>
	<entry>
		<title>IE truncated select list workaround</title>
		<link rel="alternate" type="text/html" href="http://bugfeatures.com/blog/index.php?entry=entry081118-165321" />
		<content type="text/html" mode="escaped"><![CDATA[Ever had a drop down list that you needed to set the width for? Then you probably noticed that options that are longer than the desired width are cropped in IE (of course firefox handles this problem nicely - the select list is the correct width).<br /><br />Well under duress from a client I came up with a simple solution - set the width dynamically on rollover and reset it on the obblur event.<br /><br />Here&#039;s a simplified version of the javascript:<br /><br /><code><br />function grow_select(el){<br />  el.style.width=&#039;auto&#039;;<br />  el.style.position=&#039;absolute&#039;;<br />  el.style.zIndex=100;<br />}<br />function shrink_select(el){<br />  el.style.width=&#039;50px&#039;;<br />}<br /></code><br />And an example select list<br /><code><br />&lt;select name=&quot;amount&quot; style=&quot;width: 50px;&quot; onfocus=&quot;grow_select(this)&quot; onblur=&quot;shrink_select(this)&quot;&gt;<br />&lt;option value=&quot;1&quot;&gt;One&lt;/option&gt;<br />&lt;option value=&quot;1000000&quot;&gt;A Million&lt;/option&gt;<br />&lt;option value=&quot;1000000000000&quot;&gt;A Million Million!&lt;/option&gt;<br /></code><br /><br />Of course some improvements would be:<br /><br />* Store the old width in a variable<br />* Use a window timeout to auto-reset the element if a mouseover check fails<br /><br />]]></content>
		<id>http://bugfeatures.com/blog/index.php?entry=entry081118-165321</id>
		<issued>2008-11-19T00:00:00Z</issued>
		<modified>2008-11-19T00:00:00Z</modified>
	</entry>
	<entry>
		<title>IE7 Hack</title>
		<link rel="alternate" type="text/html" href="http://bugfeatures.com/blog/index.php?entry=entry081022-155318" />
		<content type="text/html" mode="escaped"><![CDATA[There&#039;s always some DHTML positioning that just doesn&#039;t work in all browsers... here&#039;s a nice little workaround for IE6, IE7, Safari and Firefox:<br /><br /><code><br />#products_menu{<br />  margin-left: -90px;           /* IE7 */<br />  _margin-left: 410px;          /* IE6 */<br />}<br /><br />*:lang(en) #products_menu{<br />  margin-left: 410px !important  /* FF */<br />}<br />#item:products_menu {<br />    margin-left: 410px !important /* SAFARI */<br />}<br /></code>]]></content>
		<id>http://bugfeatures.com/blog/index.php?entry=entry081022-155318</id>
		<issued>2008-10-22T00:00:00Z</issued>
		<modified>2008-10-22T00:00:00Z</modified>
	</entry>
	<entry>
		<title>Floatbox &amp;amp; Prototype</title>
		<link rel="alternate" type="text/html" href="http://bugfeatures.com/blog/index.php?entry=entry080923-165838" />
		<content type="text/html" mode="escaped"><![CDATA[Having trouble using floatbox AND prototype? Well I was until I found the offending code in floatbox and patched it. Basically, floatbox was trying to run prototype&#039;s onload handler by assuming it was a simple function...<br /><br />Change this:<br /><br /><code>fb_prevOnload = window.onload;<br />window.onload = function() {<br />	if (typeof fb_prevOnload === &#039;function&#039;) fb_prevOnload();<br />	initfb();<br />};</code><br /><br />To this:<br /><br /><code>Event.observe(window,&#039;load&#039;,function(){initfb();});</code><br /><br />There, much better :)]]></content>
		<id>http://bugfeatures.com/blog/index.php?entry=entry080923-165838</id>
		<issued>2008-09-23T00:00:00Z</issued>
		<modified>2008-09-23T00:00:00Z</modified>
	</entry>
	<entry>
		<title>sfGuard - adding email to the user profile</title>
		<link rel="alternate" type="text/html" href="http://bugfeatures.com/blog/index.php?entry=entry080917-185730" />
		<content type="text/html" mode="escaped"><![CDATA[There are lots of scattered bits of information about how to do this, so I thought I&#039;d write a quick all-in-one guide...<br /><br />1. Install sfPropelAlternativeSchemaPlugin from the command line php symfony plugin-install <a href="http://plugins.symfony-project.org/sfPropelAlternativeSchemaPlugin" target="_blank" >http://plugins.symfony-project.org/sfPr ... hemaPlugin</a> <br /><br />2. Update the plugin from the repository (no, the PEAR &#039;stable&#039; version doesn&#039;t work in Windows) <a href="http://svn.symfony-project.com/plugins/sfPropelAlternativeSchemaPlugin/" target="_blank" >http://svn.symfony-project.com/plugins/ ... emaPlugin/</a>  (copy the three files in the lib folder to your plugin lib folder)<br /><br />3. Create a sfGuardPlugin_schema.custom.yml in your config folder<br /><br />4. Enter your new sfGardUser fields:<br /><br /><code>propel:<br />  sf_guard_user:<br />    _attributes: { phpName: sfGuardUser }<br />    firstname:<br />      type: VARCHAR<br />      size: 255<br />    lastname:<br />      type: VARCHAR<br />      size: 255<br />    email:<br />      type: VARCHAR<br />      size: 255<br /></code><br /><br />5. Run symfony-propel-build-all<br /><br />6. Create a sfGuardUser module in your app<br /><br />7. Copy the generator.yml file from the plugins/sfGuardUser/config folder to your sfGuardUser/config folder<br /><br />8. Add your new fields to the config:<br /><br /><code><br />      display:<br />        &quot;NONE&quot;: [ _firstname, lastname, email, username, _password, _validate_password ]<br /></code><br /><br />9. You&#039;re done!]]></content>
		<id>http://bugfeatures.com/blog/index.php?entry=entry080917-185730</id>
		<issued>2008-09-18T00:00:00Z</issued>
		<modified>2008-09-18T00:00:00Z</modified>
	</entry>
	<entry>
		<title>IE Tester lets you run multiple versions of IE</title>
		<link rel="alternate" type="text/html" href="http://bugfeatures.com/blog/index.php?entry=entry080916-151534" />
		<content type="text/html" mode="escaped"><![CDATA[I usually use a VMWare machine to test Web sites on IE6 - but that&#039;s a whole lot of resources to dedicate to a single app. I recently discovered IETester and I have to say I&#039;m impressed - it runs IE5.5, 6, 7 and 8 all in the one app... now all I need is a FireFox tester and life will be complete!<br /><br /><img src="images/0006.JPG" width="512" height="521" border="0" alt="" />]]></content>
		<id>http://bugfeatures.com/blog/index.php?entry=entry080916-151534</id>
		<issued>2008-09-16T00:00:00Z</issued>
		<modified>2008-09-16T00:00:00Z</modified>
	</entry>
	<entry>
		<title>Ultra-lightweight Scriptaculous Horizontal Accordion</title>
		<link rel="alternate" type="text/html" href="http://bugfeatures.com/blog/index.php?entry=entry080819-000652" />
		<content type="text/html" mode="escaped"><![CDATA[After trying <a href="http://stickmanlabs.com/accordion/" target="_blank" >this one out</a> and having very little success on anything but the most simplest of pages, I decided that I had to go it alone...<br /><br />And what I got was a rock solid horizontal accordion in about 30 minutes and less than 100 lines of code - including CSS, HTML and JavaScript!<br /><br />So here it is: <br /><code><br />&lt;div class=&quot;acc_container&quot;&gt;<br />&lt;div class=&quot;acc_handle&quot; id=&quot;handle_1&quot;&gt;H1&lt;/div&gt;<br />&lt;div class=&quot;acc_panel&quot; id=&quot;panel_1&quot;&gt;Content 1&lt;/div&gt;<br />&lt;div class=&quot;acc_handle&quot;&gt;H2&lt;/div&gt;<br />&lt;div class=&quot;acc_panel&quot;&gt;Content 2&lt;/div&gt;<br />&lt;div class=&quot;acc_handle&quot;&gt;H3&lt;/div&gt;<br />&lt;div class=&quot;acc_panel&quot;&gt;Content 3&lt;/div&gt;<br />&lt;/div&gt;<br /><br />&lt;style&gt;<br />  .acc_container{<br />  height: 500px;<br />  min-height: 500px;<br />}<br /><br />.acc_handle{<br />  float: left;<br />  width: 55px;<br />  height: 500px;<br />  min-height: 500px;<br />  background-color: #dddddd;<br />  cursor: pointer;<br />  border: solid 1px #666666;<br />  font-size: 9px;<br />}<br /><br />.acc_handle:hover{<br />  background-color: #eeeeee;<br />}<br /><br />.acc_handle_active{<br />  float: left;<br />  width: 55px;<br />  height: 500px;<br />  min-height: 500px;<br />  cursor: pointer;<br />  border: solid 1px #66bb66;<br />  font-size: 9px;<br />  background-color: #ddeedd;<br />}<br /><br />.acc_panel{<br />  float: left;<br />}<br />&lt;/style&gt;<br />&lt;script&gt;<br /> function acc_open(event){<br />  var element = Event.element(event);<br />  x= get_nextsibling(element);<br />   $$(&#039;.acc_panel&#039;).each(function (el) {<br />     if (el != x &amp;&amp; el.style.display != &#039;none&#039;){<br />      new Effect.Squish(el);<br />     }<br />  });<br />  $$(&#039;.acc_handle_active&#039;).each(function (el) {<br />     el.className=&#039;acc_handle&#039;;<br />  });<br />  if (x.style.display == &#039;none&#039;){<br />    new Effect.Grow(x);<br />    element.className=&#039;acc_handle_active&#039;;<br />  }<br /> }<br /><br />function get_nextsibling(n){<br />  x=n.nextSibling;<br />  while (x.nodeType!=1){<br />   x=x.nextSibling;<br />   }<br />  return x;<br />}<br />Event.observe(window,&#039;load&#039;,function(){<br />  $$(&#039;.acc_handle&#039;).each(function (el) {<br />     el.observe(&#039;click&#039;, acc_open);<br />  });<br />  $$(&#039;.acc_panel&#039;).each(function (el) {<br />     el.style.display = &#039;none&#039;;<br />  });<br />  new Effect.Grow($(&#039;panel_1&#039;));<br />  $(&#039;handle_1&#039;).className=&#039;acc_handle_active&#039;;<br />});<br /><br />&lt;/script&gt;<br /></code><br /><br />Of course, you can style this with active and hover classes etc...]]></content>
		<id>http://bugfeatures.com/blog/index.php?entry=entry080819-000652</id>
		<issued>2008-08-19T00:00:00Z</issued>
		<modified>2008-08-19T00:00:00Z</modified>
	</entry>
	<entry>
		<title>Symfony propel select MAX()</title>
		<link rel="alternate" type="text/html" href="http://bugfeatures.com/blog/index.php?entry=entry080817-145036" />
		<content type="text/html" mode="escaped"><![CDATA[I know it&#039;s simple but it&#039;s one of those things you need to do often but not often enough to commit the technique to memory. So this is a code snippet for those times...<br /><code>    //get most recent sales date<br />    $connection = Propel::getConnection();<br />    $c = new Criteria();<br />    $query = &#039;SELECT MAX(%s) AS max FROM %s&#039;;<br />    $query = sprintf($query, PurchasePeer::FINISH_DATE,PurchasePeer::TABLE_NAME);<br />    $statement = $connection-&gt;prepareStatement($query);<br />    $resultset = $statement-&gt;executeQuery();<br />    $resultset-&gt;next();<br />    $this-&gt;sales_date = strtotime($resultset-&gt;get(&#039;max&#039;));<br /></code>]]></content>
		<id>http://bugfeatures.com/blog/index.php?entry=entry080817-145036</id>
		<issued>2008-08-17T00:00:00Z</issued>
		<modified>2008-08-17T00:00:00Z</modified>
	</entry>
	<entry>
		<title>Upload from one Symfony backend to another domain frontend</title>
		<link rel="alternate" type="text/html" href="http://bugfeatures.com/blog/index.php?entry=entry080815-205054" />
		<content type="text/html" mode="escaped"><![CDATA[I have a backend for 7 domains sitting on its own domain - with all 8 domains running inside the one Symfony installation.<br /><br />The problem we faced was how to upload files inside an FCKedtor in the backend domain and have the frontend domains pick up the files without exposing the backend domain in the image tag SRC attribute.<br /><br />For some of the sites we did this on an ad hoc basis using readfile within the view - but this was for images uploaded into the database, so we knew the record ID from the URL.<br /><br />When using FCKedit we don;t know anything about the files until we pull the HTML out of the database and parse it.<br /><br />After much deliberation the solution was to use a filter...<br /><br /><code>class backendAssetsFilter extends sfFilter<br />{<br />  public function execute ($filterChain)<br />  {<br /><br />    // execute next filter<br />    $filterChain-&gt;execute();<br /><br />    //sfLoader::loadHelpers(array(&#039;Url&#039;));<br />    $local_url = &quot;/uploads/assets/&quot;;<br />    $readfile = &#039;/home/asset?file=&#039;;<br />    $response = $this-&gt;getContext()-&gt;getResponse();<br />    $response-&gt;setContent(str_ireplace($local_url, $readfile, $response-&gt;getContent()));<br /><br /><br />  }<br />}</code><br /><br />This filter simply replaces the /uploads/assets string with a URL that performs the readfile. As the URL can contain subfolder names, the filter works for /uploads/assets/images as well as /uploads/assets/flash etc.<br /><br />And while it is a bit of a hit on the server, it works across the whole domain for all HTML content managed by FCKedit., which is worth it :)]]></content>
		<id>http://bugfeatures.com/blog/index.php?entry=entry080815-205054</id>
		<issued>2008-08-16T00:00:00Z</issued>
		<modified>2008-08-16T00:00:00Z</modified>
	</entry>
	<entry>
		<title>Using view helpers from a controller revisited</title>
		<link rel="alternate" type="text/html" href="http://bugfeatures.com/blog/index.php?entry=entry080805-225936" />
		<content type="text/html" mode="escaped"><![CDATA[Damn, I should have realised you can call url_for() from a controller - you just have to load the helper first!<br /><br /><code>sfLoader::loadHelpers(array(&#039;I18N&#039;, &#039;Url&#039;));<br /></code><code><br />url_for(&#039;@somerouting&#039;) <br /></code>]]></content>
		<id>http://bugfeatures.com/blog/index.php?entry=entry080805-225936</id>
		<issued>2008-08-06T00:00:00Z</issued>
		<modified>2008-08-06T00:00:00Z</modified>
	</entry>
	<entry>
		<title>JavaScript dupicate table row inside a table</title>
		<link rel="alternate" type="text/html" href="http://bugfeatures.com/blog/index.php?entry=entry080729-171939" />
		<content type="text/html" mode="escaped"><![CDATA[There are a lot of tips &#039;out there&#039; on how to add a table row to the end of a table, but I found an elegant way of duplicating a table row in the middle of a table...<br /><br /><code>function addRow(button)<br />{<br />  btn_row = button.parentNode.parentNode;<br />   x=btn_row.previousSibling;<br />    while (x.nodeType!=1){<br />      x=x.previousSibling;<br />    }<br />   row = x.cloneNode(true);<br />   btn_row.parentNode.insertBefore(row,btn_row);<br />}</code><br />Then you can trigger it from a table cell using:<br /><code><br />&lt;input type=&quot;button&quot; onclick=&quot;addRow(this);&quot; value=&quot;+&quot; /&gt;<br /></code><br /><br />Note the while() loop filters out white space nodes in Firefox (naughty Firefox).<br /><br /><br />]]></content>
		<id>http://bugfeatures.com/blog/index.php?entry=entry080729-171939</id>
		<issued>2008-07-30T00:00:00Z</issued>
		<modified>2008-07-30T00:00:00Z</modified>
	</entry>
	<entry>
		<title>Using view helpers from a controller in Symfony 1.0</title>
		<link rel="alternate" type="text/html" href="http://bugfeatures.com/blog/index.php?entry=entry080723-225650" />
		<content type="text/html" mode="escaped"><![CDATA[I wanted to use url_for() in a controller for a search and replace operation. It turns out the URL helper is a wrapper for a controller function!<br /><br /><code>sfContext::getInstance()-&gt;getController()-&gt;genUrl(&quot;click here&quot;,&quot;@route?id_id=&quot;.$id);</code><br /><br />too easy!]]></content>
		<id>http://bugfeatures.com/blog/index.php?entry=entry080723-225650</id>
		<issued>2008-07-24T00:00:00Z</issued>
		<modified>2008-07-24T00:00:00Z</modified>
	</entry>
	<entry>
		<title>Prototype radio button validation</title>
		<link rel="alternate" type="text/html" href="http://bugfeatures.com/blog/index.php?entry=entry080703-001320" />
		<content type="text/html" mode="escaped"><![CDATA[Have a required radio button and want to ensure one option is checked? Here&#039;s a one-liner for your troubles...<br /><br /><code>checked = $$(&#039;input:checked[type=&quot;radio&quot;][name=&quot;reward&quot;]&#039;).pluck(&#039;value&#039;).length</code><br /><br />Assuming your radio buttons have the name=&quot;reward&quot; attribute you can now do the following:<br /><br /><code>if (!checked ){<br />alert(&#039;select something!&#039;);<br />}</code><br /><br />That&#039;s it!<br /><br />PS: This was working great for me the other day but on another page I am getting an error parsing &quot;input:checked&quot;. Also it appears that no version of IE (including 8) supports the checked CSS selector. So here&#039;s my cross browser multi-line solution:<br /><br /><code>checked = false;<br />  try{<br />    radios = $$(&#039;input&#039;);<br />    radios.each(function(s,i){<br />      if (s.checked){<br />        checked = true;<br />      }<br />    });<br />  }catch(e){}</code>]]></content>
		<id>http://bugfeatures.com/blog/index.php?entry=entry080703-001320</id>
		<issued>2008-07-03T00:00:00Z</issued>
		<modified>2008-07-03T00:00:00Z</modified>
	</entry>
	<entry>
		<title>PHP copy/rename from FTP folder corrupts files when upload is in progress</title>
		<link rel="alternate" type="text/html" href="http://bugfeatures.com/blog/index.php?entry=entry080522-150851" />
		<content type="text/html" mode="escaped"><![CDATA[This took weeks to troubleshoot so maybe I can save you some time by relating the experience...<br /><br />I have an application that reads files from a FTP drop folder and moves them to a queue folder. If the move is successful, a queue record is put into the database.<br /><br />Now, you would have thought that is_file() would have been enough to detect if a file was ready (ie: not still being uploaded by a user). As it happens, the FTP server is &#039;clever&#039; enough to give you read access during the upload, allowing you to see its progress. And so my queue script was copying and unlinking files that were incomplete.<br /><br />So, I tried is_readable() - same thing.<br />Then I added is_writeable() - you&#039;d think this would do it. Surely files were locked during an upload? Nope, same problem.<br />Then I tried doing a filesize() followed by a sleep then another filesize() and compared them. Didn&#039;t work. Then I added a filesize() &gt; 0 check. No joy. I also made sure the stat data wasn&#039;t being cached by calling clearstatcache() each time. No difference.<br /><br />Finally, the only thing that seemed to work (and yes I am still uncertain the problem has completely gone away!) is comparing a stat() on the file with a sleep() in between.<br /><br />Anyway, here&#039;s the final moveFile function that appears to be working for now...<br /><br /><code> protected function moveFile($from, $to){<br />    clearstatcache();<br />    $this-&gt;write2log(&quot;Called moveFile &quot;.$from. &quot; &gt; &quot;.$to);<br />    $this-&gt;write2log(&quot;File &quot;.basename($from). &quot; is &quot; . intval(filesize($from)/(1024*1024/100))/100 .&quot;MB&quot;);<br /><br />    if (is_file($from)){<br />      if (is_readable($from)){<br />        if (is_writable($from)){<br />          //check for filesize change<br />          $size = filesize($from);<br />          $stat = stat($from);<br />          sleep(5);<br />          clearstatcache();<br />          if ($size == filesize($from) &amp;&amp; $size &gt; 0 &amp;&amp; $stat == stat($from)){<br />            if (copy($from, $to)){<br />              if (unlink($from)){<br />                $this-&gt;write2log(&quot;Successfully moved &quot;.$from. &quot; &gt; &quot;.$to);<br />                return true;<br />              }<br />              $this-&gt;write2log(&quot;FAILED to unlink &quot;.$from);<br />            }<br />            $this-&gt;write2log(&quot;FAILED to copy &quot;.$from. &quot; &gt; &quot;.$to);<br />          }<br />          $this-&gt;write2log(&quot;UPLOAD IN PROGRESS &quot;.$from);<br />        }<br />        $this-&gt;write2log(&quot;NOT WRITABLE &quot;.$from);<br />      }<br />      $this-&gt;write2log(&quot;NOT READABLE &quot;.$from);<br />    }<br />    $this-&gt;write2log(&quot;NOT A FILE &quot;.$from);<br />    return false;<br />  }</code>]]></content>
		<id>http://bugfeatures.com/blog/index.php?entry=entry080522-150851</id>
		<issued>2008-05-22T00:00:00Z</issued>
		<modified>2008-05-22T00:00:00Z</modified>
	</entry>
	<entry>
		<title>MySQL Workbench</title>
		<link rel="alternate" type="text/html" href="http://bugfeatures.com/blog/index.php?entry=entry080426-161552" />
		<content type="text/html" mode="escaped"><![CDATA[Nice little app for building MySQL databases under windows...<img src="images/workbench_visual_design_240px.gif" width="240" height="174" border="0" alt="" id="img_float_left" />]]></content>
		<id>http://bugfeatures.com/blog/index.php?entry=entry080426-161552</id>
		<issued>2008-04-26T00:00:00Z</issued>
		<modified>2008-04-26T00:00:00Z</modified>
	</entry>
	<entry>
		<title>Symfony build model errors (revised)</title>
		<link rel="alternate" type="text/html" href="http://bugfeatures.com/blog/index.php?entry=entry080221-175307" />
		<content type="text/html" mode="escaped"><![CDATA[If you reverse engineer your Symfony schema.yml from a database and you use the symfony plugins like sfGuard, chances are you&#039;ve come across this error:<br /><br /><code>Duplicate table found: propel</code><br /><br />The reason why this occurs is that your schema.yml will include the  other plugin tables - which are now duplicated from the plugin schema.yml<br /><br />The quick solution is to open your project database.yml and remove the plugin table definitions after running propel-build-schema and before running propel-build-model<br /><br />If you make a lot of database changes you might want to either empty/remove the plugin schema.yml file (it&#039;s only needed for the initial installation anyway) or write a wrapper class for propel... :)]]></content>
		<id>http://bugfeatures.com/blog/index.php?entry=entry080221-175307</id>
		<issued>2008-02-22T00:00:00Z</issued>
		<modified>2008-02-22T00:00:00Z</modified>
	</entry>
	<entry>
		<title>The best lightbox script just got better</title>
		<link rel="alternate" type="text/html" href="http://bugfeatures.com/blog/index.php?entry=entry080216-145051" />
		<content type="text/html" mode="escaped"><![CDATA[Ever wanted to load a PDF file inline? Maybe in a lightbox window? Well now you can. Michael J.I. Jackson&#039;s &quot;thrilling&quot; shadowbox loads all your media files, HTML pages etc with lovely effects sourced from prototype, scriptaculous, yahoo, mootools or your other AJAX library of choice. It does it using adapters and it is the slickest GUI enhancer I&#039;ve seen yet.<br /><br />But lo and behold it doesn&#039;t support acrobat PDF documents!<br />Well, it does if you make one very tiny change to the source code:<br /><br />Add &quot; pdf&quot; to the iframe array like so...<br /><br /><code>iframe:[&quot;pdf&quot;,&quot;asp&quot;,&quot;aspx&quot;,&quot;cgi&quot;,&quot;cfm&quot;,&quot;htm&quot;,&quot;html&quot;,&quot;pl&quot;,<br />&quot;php&quot;,&quot;php3&quot;,&quot;php4&quot;,&quot;php5&quot;,&quot;phtml&quot;,&quot;rb&quot;,&quot;rhtml&quot;,&quot;shtml&quot;,&quot;txt&quot;,<br />&quot;vbs&quot;]</code><br /><br />Now it loads PDF files just like your HTML pages in an IFRAME with all the benefits of the lightbox transitions, loading animation, navigation, captions etc]]></content>
		<id>http://bugfeatures.com/blog/index.php?entry=entry080216-145051</id>
		<issued>2008-02-16T00:00:00Z</issued>
		<modified>2008-02-16T00:00:00Z</modified>
	</entry>
	<entry>
		<title>DIY Symfony Propel Hydration with Pager</title>
		<link rel="alternate" type="text/html" href="http://bugfeatures.com/blog/index.php?entry=entry080206-153211" />
		<content type="text/html" mode="escaped"><![CDATA[It&#039;s a typical scenario - I have a search module that returns a bunch of objects that have related objects (and some of these have related objects as well). <br /><br />Ordinarily, you&#039;d use a doSelectJoinAll and let propel magically hydrate all your results - but that only works for parent objects, not child objects.<br /><br />So, rather than looping over each object and running separate queries to get each objects child objects, I wanted to do the equivalent of a doSelectJoinAll() but fully hydrate all the results with a minimum number of queries. Here&#039;s how I did it...<br /><br />Query 1 retrieves all the IDs of the matching records.<br /><br />Each of these search results has a location<br />Each location has a category<br /><br />Query 2 gets all the locations using  Criteria::IN on all result IDs.<br />Query 3 gets all the categories using Criteria::IN on all location IDs.<br /><br />Then I loop over the results of queries 2 and 3 and build the collections of results like so:<br /><br /><code>foreach ($results as $r) { $rs[$r-&gt;getResultId()]-&gt;addCollItem(&quot;ResultLocations&quot;,$r-&gt;getLocation());<br />}</code><br /><br />This nifty bit of code calls the following class function:<br /><br /><code>  function addCollItem($type,$item)<br />  {<br />    $init = &quot;init&quot;.$type;<br />    $property = &quot;coll&quot;.$type;<br />    if (!method_exists($this,$init)){<br />       $this-&gt;$property = array();<br />    }else{<br />      $this-&gt;$init(); <br />    }<br /> <br />    $class_property = $this-&gt;$property;<br />    $class_property[] = $item;<br />  }</code><br /><br />Whammo! You get to feed related objects into the master object&#039;s protected collections :)]]></content>
		<id>http://bugfeatures.com/blog/index.php?entry=entry080206-153211</id>
		<issued>2008-02-06T00:00:00Z</issued>
		<modified>2008-02-06T00:00:00Z</modified>
	</entry>
	<entry>
		<title>Javascript ParseInt(&amp;quot;08&amp;quot;);</title>
		<link rel="alternate" type="text/html" href="http://bugfeatures.com/blog/index.php?entry=entry080109-223802" />
		<content type="text/html" mode="escaped"><![CDATA[I thought I&#039;d seen it all until today. JavaScript is so &quot;intelligent&quot; that if you try to ParseInt() on &quot;08&quot; you get 0. Why? Because it thinks you&#039;re speaking in octal (base 8 numbers) instead of decimal (base 10).<br /><br />The solution is to either use parseFloat() or to force the use of decimal by passing 10 as the second parameter to parseInt().]]></content>
		<id>http://bugfeatures.com/blog/index.php?entry=entry080109-223802</id>
		<issued>2008-01-10T00:00:00Z</issued>
		<modified>2008-01-10T00:00:00Z</modified>
	</entry>
	<entry>
		<title>PHP File downloads - beware the multibyte encoding!</title>
		<link rel="alternate" type="text/html" href="http://bugfeatures.com/blog/index.php?entry=entry080107-124143" />
		<content type="text/html" mode="escaped"><![CDATA[Took me a day to work out why my fread() file transfers were failing - at almost exactly half way. It got me thinking - perhaps the output was being compressed. I turned off mod_deflate. Same problem. Then I started looking at the PHP buffer because I was doing something like this:<br /><br /><code>while(!feof($handle)){<br />                set_time_limit(0);<br />                print(fread($handle,1024*8));<br />                ob_flush();<br />                flush();<br />            }</code><br /><br />Then I checked the output handler and realised there was some multibyte encoding taking place, which was the key. This has to be turned off for binary data like so:<br /><br /><code>mb_http_output(&quot;pass&quot;);</code><br /><br />Seems strange noone has mentioned this on the PHP site under fread() - so I did.<br />]]></content>
		<id>http://bugfeatures.com/blog/index.php?entry=entry080107-124143</id>
		<issued>2008-01-07T00:00:00Z</issued>
		<modified>2008-01-07T00:00:00Z</modified>
	</entry>
</feed>
