<?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>Beyond the Wheel</title>
	<atom:link href="http://beyondthewheel.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://beyondthewheel.com</link>
	<description>Web Development</description>
	<lastBuildDate>Fri, 04 Dec 2009 15:53:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Samsung Moment vs. HTC Hero</title>
		<link>http://beyondthewheel.com/samsung-moment-vs-htc-hero/</link>
		<comments>http://beyondthewheel.com/samsung-moment-vs-htc-hero/#comments</comments>
		<pubDate>Tue, 24 Nov 2009 20:18:18 +0000</pubDate>
		<dc:creator>turbodog</dc:creator>
				<category><![CDATA[Android]]></category>

		<guid isPermaLink="false">http://beyondthewheel.com/?p=43</guid>
		<description><![CDATA[// 



Just my two cents on Sprint&#8217;s two (so far&#8230;) Android phones&#8230;
As a longtime Sprint customer, I waited patiently for an Android phone to arrive.  The HTC Hero was finally announced and the Samsung Moment shortly after.  At first glance, the Hero was a much slicker device — both in hardware and software. [...]]]></description>
			<content:encoded><![CDATA[<div style="text-align: center; padding: 10px;"><script type="text/javascript">// <![CDATA[
google_ad_client = "pub-5345019024335620";
/* btw468x60, created 4/9/09 */
google_ad_slot = "7474785455";
google_ad_width = 468;
google_ad_height = 60;
// ]]&gt;</script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script></div>
<p><!-- google_ad_section_start --></p>
<p><iframe src="http://rcm.amazon.com/e/cm?t=big04d-20&#038;o=1&#038;p=9&#038;l=st1&#038;mode=wireless-phones&#038;search=samsung%20moment&#038;fc1=000000&#038;lt1=&#038;lc1=3366FF&#038;bg1=FFFFFF&#038;f=ifr" marginwidth="0" marginheight="0" width="180" height="150" border="0" frameborder="0" style="float: left; margin: 10px 10px 10px 0; border:none;" scrolling="no"></iframe></p>
<p>Just my two cents on Sprint&#8217;s two (so far&#8230;) Android phones&#8230;</p>
<p>As a longtime Sprint customer, I waited patiently for an Android phone to arrive.  The HTC Hero was finally announced and the Samsung Moment shortly after.  At first glance, the Hero was a much slicker device — both in hardware and software.   Coming from a Blackberry though, I was hoping for a real keyboard.</p>
<p><a href="http://thelostmonks.com">A friend</a> ( who owns some HTC Windoze phone with a slide out keyboard&#8230; ) convinced me that slide out keyboards weren&#8217;t worth the extra thickness, so I jumped on the Hero as soon as it was released.   And I was not disappointed.  The Hero is a very cool device with a nice interface.  HTC has done some cool things to pretty up the standard Android interface and give it some of the eye candy we&#8217;ve come to expect from modern OSes.</p>
<p>So, the day the Samsung Moment came out, I went and made the switch.  According to the sales rep, you can exchange ONCE in the first 30 days.   And boy am I glad I did.  The Samsung is MUCH faster!  It boots faster, loads apps and web pages faster, and it is much more responsive to screen gestures.</p>
<div style="text-align: center; padding: 10px;"><script type="text/javascript">// <![CDATA[
google_ad_client = "pub-5345019024335620";
/* btw468x60, created 4/9/09 */
google_ad_slot = "7474785455";
google_ad_width = 468;
google_ad_height = 60;
// ]]&gt;</script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script></div>
<p><strong>The Keyboard</strong> &#8212; I couldn&#8217;t get past the virtual keyboard on the Hero.  My gigantic thumbs didn&#8217;t quite get along with the little buttons &#8211; especially in portrait mode.  And the auto correction it rams down your throat was a saving grace in some instances, but a curse in others.   If you weren&#8217;t paying attention it would auto correct a word to something completely different and you might not notice until your message was long gone.</p>
<p><strong>The Screen</strong> &#8212; the <a href="http://en.wikipedia.org/wiki/AMOLED" target="_blank">AMOLED</a> screen on the Moment is as bright and vibrant as advertised.   The Samsung definitely wins with 16.7 million colors compared to 65k on the Hero.  AMOLED is supposed to consume less power too.  Check goes to the Moment.</p>
<p><strong></p>
<div id="attachment_59" class="wp-caption alignright" style="width: 210px"><strong><img class="size-full wp-image-59" title="hero" src="http://beyondthewheel.com/wp-content/uploads/2009/11/hero.jpg" alt="HTC Hero" width="200" height="209" /></strong><p class="wp-caption-text">HTC Hero</p></div>
<p>The Interface</strong> &#8212; HTC&#8217;s SenseUI is pretty cool.  The social networking integration was pretty nice &#8212; it was nice to connect my Google contacts to Facebook and have it use people&#8217;s profile pics, update their status in the contact list etc.  HTC wins in this category&#8230; if you care about that sort of thing.   I don&#8217;t.  Even on my desktop &#8212; I run a minimal desktop with all the eye candy stuff turned off.  Performance is much more important to me.  The Moment sports a plain ol&#8217; vanilla Android interface.</p>
<p><strong>The Camera</strong> &#8212; HTC wins here too &#8212; 5MP compared to 3.2MP on the Moment.  But again&#8230; not important to me.  I&#8217;ve  rarely used the camera on any phone I&#8217;ve owned.   Not sure why&#8230; I&#8217;ve probably missed some good memories.  If you take a lot of cell phone pics, check goes to the Hero.</p>
<p>So for me, the Samsung is the better phone &#8212; the speed, screen, improved reception and slide out keyboard win out over thickness, weight and a boring interface.</p>
<p><!-- google_ad_section_end --></p>
<div style="text-align: center; padding: 10px;"><script type="text/javascript">// <![CDATA[
google_ad_client = "pub-5345019024335620";
/* btw468x60, created 4/9/09 */
google_ad_slot = "7474785455";
google_ad_width = 468;
google_ad_height = 60;
// ]]&gt;</script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script></div>
]]></content:encoded>
			<wfw:commentRss>http://beyondthewheel.com/samsung-moment-vs-htc-hero/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CakePHP Models and requestAction</title>
		<link>http://beyondthewheel.com/cakephp-models-and-requestaction/</link>
		<comments>http://beyondthewheel.com/cakephp-models-and-requestaction/#comments</comments>
		<pubDate>Sun, 04 Oct 2009 20:26:49 +0000</pubDate>
		<dc:creator>turbodog</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://beyondthewheel.com/?p=33</guid>
		<description><![CDATA[






This may be kind of a &#8220;no duh&#8221; for some Cake veterans, but it was new to me, so I&#8217;ll share&#8230;
When it comes to accessing a different Model from a given Controller I had always wondered which was the better practice &#8211; include the other Model in the $uses array or using $this-&#62;requestAction() to get [...]]]></description>
			<content:encoded><![CDATA[<p><span style="float: right; padding: 10px;"><br />
<script type="text/javascript"><!--
google_ad_client = "pub-5345019024335620";
/* btw_large 300x250, created 12/2/09 */
google_ad_slot = "4689044608";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
</span></p>
<p><!-- google_ad_section_start --><br />
This may be kind of a &#8220;no duh&#8221; for some Cake veterans, but it was new to me, so I&#8217;ll share&#8230;</p>
<p>When it comes to accessing a different Model from a given Controller I had always wondered which was the better practice &#8211; include the other Model in the $uses array or using $this-&gt;requestAction() to get data from the other Model&#8217;s Controller.</p>
<p><iframe src="http://rcm.amazon.com/e/cm?t=big04d-20&#038;o=1&#038;p=8&#038;l=st1&#038;mode=books&#038;search=cakephp&#038;fc1=000000&#038;lt1=&#038;lc1=3366FF&#038;bg1=FFFFFF&#038;f=ifr" marginwidth="0" marginheight="0" width="120" height="240" border="0" frameborder="0" style="border:none; float: left; margin: 10px 10px 10px 0;" scrolling="no"></iframe></p>
<p>For example, let&#8217;s say in the classic blog example you are in the PostsController and need to access some data from the AuthorsController.   (Probably a bad example because in this case they would probably be joined by an Association, but pretend for a minute that they are not.)</p>
<p>I had always gone with this method &#8211; let the AuthorsController handle the Author data:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">class</span> PostsController <span style="color: #000000; font-weight: bold;">extends</span> AppController <span style="color: #009900;">&#123;</span>
     <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$name</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Posts'</span><span style="color: #339933;">;</span>
&nbsp;
     <span style="color: #000000; font-weight: bold;">function</span> someaction<span style="color: #009900;">&#40;</span><span style="color: #000088;">$pid</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
          <span style="color: #000088;">$post</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">findById</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pid</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          <span style="color: #000088;">$authname</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">requestAction</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/authors/getname/'</span> 
                              <span style="color: #339933;">.</span> <span style="color: #000088;">$post</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Post'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'author_id'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>And again, that&#8217;s a very simple example, you would obviously have an association here&#8230;</p>
<p>The alternative would be to add the Authors Model in the PostsController&#8217;s $uses array:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> PostsController <span style="color: #000000; font-weight: bold;">extends</span> AppController <span style="color: #009900;">&#123;</span>
     <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$name</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Posts'</span><span style="color: #339933;">;</span>
     <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$uses</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Post'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Author'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
     <span style="color: #000000; font-weight: bold;">function</span> someaction<span style="color: #009900;">&#40;</span><span style="color: #000088;">$pid</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
          <span style="color: #000088;">$post</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">findById</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pid</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          <span style="color: #000088;">$author</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Author</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">findById</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Post'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'author_id'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The requestAction() method is probably a cleaner choice for occasional use, but I had a project where an Object could have 20 different associations.  What I wanted to do though was let the user choose which &#8220;modules&#8221; to use.  So those 20 different assocations could vary &#8211; I didn&#8217;t want to hard code them in the Models.</p>
<p>So the user chooses their modules and they are stored in a table.  That table is then read and I was executing a loop through each of them and doing a requestAction for each of them to get the data from their respective Controllers.  But the page was taking 20+ seconds to load.   Looking at Cake&#8217;s debug output I noticed that for each of those requestAction&#8217;s, Cake was completely rebuilding the session data!  (I store sessions in the DB)</p>
<p>The point?   If you need to access data from multiple Controllers and can&#8217;t/don&#8217;t want to set up the appropriate associations for all of them, add them to the $uses array and turn on Model caching.</p>
<p>The Cake documentation clearly states that requestAction can lead to poor performance, but I guess I needed to see it for myself.</p>
<p><!-- google_ad_section_end --></p>
<div style="text-align: center; padding: 10px;">
<script type="text/javascript"><!--
google_ad_client = "pub-5345019024335620";
/* btw468x60, created 4/9/09 */
google_ad_slot = "7474785455";
google_ad_width = 468;
google_ad_height = 60;
// --></script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script></div>
]]></content:encoded>
			<wfw:commentRss>http://beyondthewheel.com/cakephp-models-and-requestaction/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Convert UPC-E Barcodes to UPC-A with PHP</title>
		<link>http://beyondthewheel.com/convert-upc-barcodes-with-php/</link>
		<comments>http://beyondthewheel.com/convert-upc-barcodes-with-php/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 00:44:22 +0000</pubDate>
		<dc:creator>turbodog</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://beyondthewheel.com/?p=16</guid>
		<description><![CDATA[



Recently I had the need to convert 8 digit UPC-E barcodes to 12 digit UPC-A barcodes for an inventory app I was working on.
After lots of Googling, I found this one written in Visual Basic: http://upcdata.info/?action=e2a
And did my best to convert it to PHP.  The results are below.  Let me know if it [...]]]></description>
			<content:encoded><![CDATA[<div style="text-align: center; padding: 10px;">
<script type="text/javascript"><!--
google_ad_client = "pub-5345019024335620";
/* btw468x60, created 4/9/09 */
google_ad_slot = "7474785455";
google_ad_width = 468;
google_ad_height = 60;
// --></script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script></div>
<p><!-- google_ad_section_start --></p>
<p>Recently I had the need to convert 8 digit UPC-E barcodes to 12 digit UPC-A barcodes for an inventory app I was working on.</p>
<p>After lots of Googling, I found this one written in Visual Basic: <a href="http://upcdata.info/?action=e2a" target="_blank">http://upcdata.info/?action=e2a</a></p>
<p>And did my best to convert it to PHP.  The results are below.  Let me know if it does/doesn&#8217;t work for you.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">      <span style="color: #000000; font-weight: bold;">function</span> fixedUPC<span style="color: #009900;">&#40;</span><span style="color: #000088;">$upc</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
           <span style="color: #000088;">$valid_digits</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$upc</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">6</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
           <span style="color: #000088;">$last_digit</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$valid_digits</span><span style="color: #339933;">,-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
           <span style="color: #b1b100;">switch</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$last_digit</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
               <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;0&quot;</span><span style="color: #339933;">:</span>
               <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;1&quot;</span><span style="color: #339933;">:</span>
               <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;2&quot;</span><span style="color: #339933;">:</span>
                   <span style="color: #000088;">$upc_a</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$valid_digits</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$last_digit</span>
                       <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;0000&quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$valid_digits</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                   <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
               <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;3&quot;</span><span style="color: #339933;">:</span>
                   <span style="color: #000088;">$upc_a</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$valid_digits</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span> 
                           <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;00000&quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$valid_digits</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">3</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                   <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
               <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;4&quot;</span><span style="color: #339933;">:</span>
                   <span style="color: #000088;">$upc_a</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$valid_digits</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span> 
                           <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;00000&quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$valid_digits</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">5</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                   <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
               <span style="color: #b1b100;">default</span><span style="color: #339933;">:</span>
                   <span style="color: #000088;">$upc_a</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$valid_digits</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span> 
                           <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;0000&quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$valid_digits</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">5</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
           <span style="color: #009900;">&#125;</span>
           <span style="color: #b1b100;">return</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$upc</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$upc_a</span> <span style="color: #339933;">.</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$upc</span><span style="color: #339933;">,-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
       <span style="color: #009900;">&#125;</span></pre></div></div>

<p><!-- google_ad_section_end --></p>
<div style="text-align: center; padding: 10px;">
<script type="text/javascript"><!--
google_ad_client = "pub-5345019024335620";
/* btw468x60, created 4/9/09 */
google_ad_slot = "7474785455";
google_ad_width = 468;
google_ad_height = 60;
// --></script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script></div>
]]></content:encoded>
			<wfw:commentRss>http://beyondthewheel.com/convert-upc-barcodes-with-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dynamic Database Connection with CakePHP</title>
		<link>http://beyondthewheel.com/dynamic-database-connection-with-cakephp/</link>
		<comments>http://beyondthewheel.com/dynamic-database-connection-with-cakephp/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 15:34:01 +0000</pubDate>
		<dc:creator>turbodog</dc:creator>
				<category><![CDATA[CakePHP]]></category>

		<guid isPermaLink="false">http://matthewanderton.com/beyondthewheel.com/?p=10</guid>
		<description><![CDATA[

// 





Recently I was working on a project where I had a central Cake application for a group of clients and each client had their own database.
I wanted to have all users sign into a central user&#8217;s table associated with the application, but then for the bulk of the controllers in the app have the [...]]]></description>
			<content:encoded><![CDATA[<div style="text-align: center; padding: 10px;"></div>
<p><span style="float: right; margin: 10px 0 10px 10px;"><br />
<script type="text/javascript">// <![CDATA[
google_ad_client = "pub-5345019024335620";
/* btw120x600, created 4/9/09 */
google_ad_slot = "6820270809";
google_ad_width = 120;
google_ad_height = 600;
// ]]&gt;</script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript">
</script><br />
</span></p>
<p><iframe src="http://rcm.amazon.com/e/cm?t=big04d-20&#038;o=1&#038;p=8&#038;l=st1&#038;mode=books&#038;search=cakephp&#038;fc1=000000&#038;lt1=&#038;lc1=3366FF&#038;bg1=FFFFFF&#038;f=ifr" marginwidth="0" marginheight="0" width="120" height="240" border="0" frameborder="0" style="border:none; float: left; margin: 20px 10px 10px 0;" scrolling="no"></iframe></p>
<p><!-- google_ad_section_start --><br />
Recently I was working on a project where I had a central Cake application for a group of clients and each client had their own database.</p>
<p>I wanted to have all users sign into a central user&#8217;s table associated with the application, but then for the bulk of the controllers in the app have the database config change based on a field in the user record.</p>
<p>So if Bob Smith from Company A signs in to our app, he needs to use database configuration &#8216;company_a&#8217;.</p>
<p>Since we are using Cake&#8217;s built in Auth component, we always have access to the user record in the Session from the controller. But for the life of me, I could not figure out how to get at the Session data from the Model!</p>
<p>I saw several comments in my search that said to just abandon the Cake MVC model and get what I needed from $_SESSION. I had no qualms about doing that, but $_SESSION had no data. I believe this is because Cake overrides PHP&#8217;s default session handlers so session data stored by Cake is not going to end up in $_SESSION. Feel free to comment if I am wrong about that.</p>
<p>So I had the data I needed in the controller, but at that point the model has already been instantiated.</p>
<p>But it became a timing issue &#8212; &#8216;mydatabase&#8217; had to be a valid database connection before the controller is even instantiated.</p>
<p>So to fix, a &#8216;dummy&#8217; database was needed to make the initial connection, then we can make our adjustments in the controller.<br />
<!-- google_ad_section_end --></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> beforeFilter<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     <span style="color: #000088;">$config</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
          <span style="color: #0000ff;">'login'</span>    <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'myusername'</span><span style="color: #339933;">,</span>
          <span style="color: #0000ff;">'password'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'mypassword'</span><span style="color: #339933;">,</span>
          <span style="color: #0000ff;">'database'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>Auth<span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>user<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'company_name'</span><span style="color: #009900;">&#41;</span>
     <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
     <span style="color: #000088;">$db</span> <span style="color: #339933;">=&amp;</span>amp<span style="color: #339933;">;</span> ConnectionManager<span style="color: #339933;">::</span><span style="color: #004000;">getDataSource</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;mydatabase&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #000088;">$db</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>disconnect<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #000088;">$db</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>setConfig<span style="color: #009900;">&#40;</span><span style="color: #000088;">$config</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #000088;">$db</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>connect<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://beyondthewheel.com/dynamic-database-connection-with-cakephp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drag and Drop with jQuery and CakePHP</title>
		<link>http://beyondthewheel.com/drag-and-drop-with-jquery-and-cakephp/</link>
		<comments>http://beyondthewheel.com/drag-and-drop-with-jquery-and-cakephp/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 15:32:04 +0000</pubDate>
		<dc:creator>turbodog</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://matthewanderton.com/beyondthewheel.com/?p=8</guid>
		<description><![CDATA[  Amazon.com Widgets
Recently I had a need for a data report with shopping cart-like behavior &#8212; let the user paginate through a list of items, drag items of interest to a &#8220;basket&#8221; and then take action on all items in the basket.
To do this, I used the &#8220;draggable&#8221; and &#8220;droppable&#8221; functionality in jQuery UI. [...]]]></description>
			<content:encoded><![CDATA[<p><center><OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" id="Player_2ae908eb-3629-4661-80e2-843f8f895e7f"  WIDTH="400px" HEIGHT="150px"> <PARAM NAME="movie" VALUE="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&#038;MarketPlace=US&#038;ID=V20070822%2FUS%2Fbig04d-20%2F8010%2F2ae908eb-3629-4661-80e2-843f8f895e7f&#038;Operation=GetDisplayTemplate"><PARAM NAME="quality" VALUE="high"><PARAM NAME="bgcolor" VALUE="#FFFFFF"><PARAM NAME="allowscriptaccess" VALUE="always"><embed src="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&#038;MarketPlace=US&#038;ID=V20070822%2FUS%2Fbig04d-20%2F8010%2F2ae908eb-3629-4661-80e2-843f8f895e7f&#038;Operation=GetDisplayTemplate" id="Player_2ae908eb-3629-4661-80e2-843f8f895e7f" quality="high" bgcolor="#ffffff" name="Player_2ae908eb-3629-4661-80e2-843f8f895e7f" allowscriptaccess="always"  type="application/x-shockwave-flash" align="middle" height="150px" width="400px"></embed></OBJECT> <NOSCRIPT><A HREF="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&#038;MarketPlace=US&#038;ID=V20070822%2FUS%2Fbig04d-20%2F8010%2F2ae908eb-3629-4661-80e2-843f8f895e7f&#038;Operation=NoScript">Amazon.com Widgets</A></NOSCRIPT></center></p>
<p>Recently I had a need for a data report with shopping cart-like behavior &#8212; let the user paginate through a list of items, drag items of interest to a &#8220;basket&#8221; and then take action on all items in the basket.</p>
<p>To do this, I used the &#8220;draggable&#8221; and &#8220;droppable&#8221; functionality in <a href="http://ui.jquery.com/">jQuery UI</a>.  jQuery makes drag and drop (and everything else) ridiculously easy.</p>
<p>The only trick here was managing the &#8220;basket&#8221; contents with CakePHP.</p>
<p>My data was laid out in a table, so I took the item name and wrapped it in a div with a &#8216;draggable&#8217; class like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;div class=&quot;draggable&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$item</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Item'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/div&gt;</pre></div></div>

<p>Then at the top of the page, I created my &#8220;basket&#8221; &#8212; just a stylized div with a &#8220;droppable&#8221; class or id, like so:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;div id=&quot;basket&quot; class=&quot;droppable&quot;&gt;Drag items of interest here.&lt;/div&gt;</pre></div></div>

<p>Then in the document ready function, just initialize the drag and drop:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.draggable'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">draggable</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span> revert<span style="color: #339933;">:</span> <span style="color: #3366CC;">'valid'</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#droppable'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">droppable</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
     accept<span style="color: #339933;">:</span> <span style="color: #3366CC;">'.draggable'</span><span style="color: #339933;">,</span>
     hoverClass<span style="color: #339933;">:</span> <span style="color: #3366CC;">'draggable-active'</span><span style="color: #339933;">,</span>
     drop<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #339933;">,</span> ui<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> doSomeFunction<span style="color: #009900;">&#40;</span>ui.<span style="color: #660066;">draggable</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Demo coming soon&#8230;</p>
<div style="text-align: center; padding: 10px;"><script type="text/javascript"><!--
google_ad_client = "pub-5345019024335620";
/* btw468x60, created 4/9/09 */
google_ad_slot = "7474785455";
google_ad_width = 468;
google_ad_height = 60;
// --></script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script></div>
]]></content:encoded>
			<wfw:commentRss>http://beyondthewheel.com/drag-and-drop-with-jquery-and-cakephp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Disable Pidgin Notifications in Ubuntu 9.04</title>
		<link>http://beyondthewheel.com/disable-pidgin-notifications-in-ubuntu-9-04/</link>
		<comments>http://beyondthewheel.com/disable-pidgin-notifications-in-ubuntu-9-04/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 15:30:37 +0000</pubDate>
		<dc:creator>turbodog</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Pidgin]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://matthewanderton.com/beyondthewheel.com/?p=6</guid>
		<description><![CDATA[


I love the new libnotify notifications in Ubuntu Jaunty Jackalope, but don&#8217;t really want my IM messages popping up on the top right of the screen &#8212; especially at work.
So how do you get Pidgin to just quietly blink in your system tray like it used to?
Pidgin uses libnotify as a plugin to make those [...]]]></description>
			<content:encoded><![CDATA[<div style="text-align: center; padding: 10px;">
<iframe src="http://rcm.amazon.com/e/cm?t=big04d-20&#038;o=1&#038;p=26&#038;l=ur1&#038;category=computers_accesories&#038;banner=12CKQQKWNWBNQ20V9X02&#038;f=ifr" width="468" height="60" scrolling="no" border="0" marginwidth="0" style="border:none;" frameborder="0"></iframe>
</div>
<p>I love the new libnotify notifications in Ubuntu Jaunty Jackalope, but don&#8217;t really want my IM messages popping up on the top right of the screen &#8212; especially at work.</p>
<p>So how do you get Pidgin to just quietly blink in your system tray like it used to?</p>
<p>Pidgin uses libnotify as a plugin to make those notification happens, and you can turn it off like any other.   Go to Tools-&gt;Plugins and find &#8220;Libnotify Popups&#8221; and uncheck it.</p>
<p>Then to get your old notifications back check the &#8220;Message Notification&#8221; plugin.  Then go to Tools-&gt;Preferences and set &#8220;Show system tray icon&#8221; to Always on the Interface tab.  Then you can right-click on your Pidgin icon in the system tray and check &#8220;Blink on New Message&#8221; so you at least know when someone is trying to chat with (distract) you.</p>
<div style="text-align: center; padding: 10px;"><script type="text/javascript"><!--
google_ad_client = "pub-5345019024335620";
/* btw468x60, created 4/9/09 */
google_ad_slot = "7474785455";
google_ad_width = 468;
google_ad_height = 60;
// --></script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script></div>
]]></content:encoded>
			<wfw:commentRss>http://beyondthewheel.com/disable-pidgin-notifications-in-ubuntu-9-04/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu &#8212; Upgrade Pidgin to fix Yahoo!</title>
		<link>http://beyondthewheel.com/ubuntu-upgrade-pidgin-to-fix-yahoo/</link>
		<comments>http://beyondthewheel.com/ubuntu-upgrade-pidgin-to-fix-yahoo/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 15:28:09 +0000</pubDate>
		<dc:creator>turbodog</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Pidgin]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://matthewanderton.com/beyondthewheel.com/?p=4</guid>
		<description><![CDATA[

I&#8217;m not a huge fan of Yahoo! IM, but I do have clients and co-workers that use it so I really need it to work in Pidgin.  A recent protocol upgrade at Yahoo! broke Pidgin 2.5.5.  I found several &#8216;fixes&#8217; out there that included changing the named pager server to an IP address. [...]]]></description>
			<content:encoded><![CDATA[<div style="text-align: center; padding: 10px;"><iframe src="http://rcm.amazon.com/e/cm?t=big04d-20&#038;o=1&#038;p=26&#038;l=ur1&#038;category=50mp3albums5each&#038;banner=1ARGSF5FJN5TPQZJC282&#038;f=ifr" width="468" height="60" scrolling="no" border="0" marginwidth="0" style="border:none;" frameborder="0"></iframe>
</div>
<p>I&#8217;m not a huge fan of Yahoo! IM, but I do have clients and co-workers that use it so I really need it to work in Pidgin.  A recent protocol upgrade at Yahoo! broke Pidgin 2.5.5.  I found several &#8216;fixes&#8217; out there that included changing the named pager server to an IP address.  But none of those worked for me.</p>
<p>In typical fashion I checked the official sources <em>last</em> but the Pidgin website has an updated version that has fixed the Yahoo! problem &#8212; http://www.pidgin.im/download/ubuntu/</p>
<p>In brief, we just need to get the latest version (2.5.7) from Pidgin rather than from Ubuntu sources.</p>
<p>Simply run these two commands in a terminal:</p>
<pre class="code">sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com \
    67265eb522bdd6b1c69e66ed7fb8bee0a1f196a8</pre>
<pre class="code">echo deb http://ppa.launchpad.net/pidgin-developers/ppa/ubuntu \
    `lsb_release --short --codename` main | \
    sudo tee /etc/apt/sources.list.d/pidgin-ppa.list</pre>
<p>And then update apt and upgrade pidgin:</p>
<pre class="code">sudo apt-get update

sudo apt-get install pidgin</pre>
<div style="text-align: center; padding: 10px;"><script type="text/javascript"><!--
google_ad_client = "pub-5345019024335620";
/* btw468x60, created 4/9/09 */
google_ad_slot = "7474785455";
google_ad_width = 468;
google_ad_height = 60;
// --></script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script></div>
]]></content:encoded>
			<wfw:commentRss>http://beyondthewheel.com/ubuntu-upgrade-pidgin-to-fix-yahoo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
