<?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>Codedog.Net</title>
	<atom:link href="http://codedog.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://codedog.net</link>
	<description>An experiment in distributed insanity</description>
	<lastBuildDate>Tue, 15 May 2012 15:11:25 +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>How Chrome saved my bacon</title>
		<link>http://codedog.net/2012/05/15/how-chrome-saved-my-bacon/</link>
		<comments>http://codedog.net/2012/05/15/how-chrome-saved-my-bacon/#comments</comments>
		<pubDate>Tue, 15 May 2012 15:11:25 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://codedog.net/?p=349</guid>
		<description><![CDATA[I have a MacBook Pro and I have a &#8216;computer-all-my-life&#8217; background and know the importance of backups and keeping them secure.  The institution I work at is still predominately windows - and therefore has no backup solution for mac computers.  I&#8217;ve been hounding them for months to allow me to purchase an external drive so I can use Time Machine [...]]]></description>
			<content:encoded><![CDATA[<p>I have a MacBook Pro and I have a &#8216;computer-all-my-life&#8217; background and know the importance of backups and keeping them secure.  The institution I work at is still predominately windows - and therefore has no backup solution for mac computers.  I&#8217;ve been hounding them for months to allow me to purchase an external drive so I can use Time Machine to backup my system. This is my entire career of code here.  They dragged their feet and never came through.</p>
<div id="attachment_351" class="wp-caption alignright" style="width: 138px"><a href="http://www.cultofmac.com/50685/how-to-fix-common-mac-startup-problems-macrx/" target="_blank"><img class="size-full wp-image-351 " style="border-image: initial; border-width: 1px; border-color: black; border-style: solid; margin: 7px;" title="folder_question" src="http://codedog.net/wp-content/uploads/2012/05/folder_question.jpg" alt="Apple folder / question mark icon means you're probably screwed." width="128" height="102" /></a><p class="wp-caption-text">The icon of Death</p></div>
<p>Two weeks ago the inevitable happened.  My drive crashed.  On a mac, when it can&#8217;t find the filesystem, you don&#8217;t get a geeky message like you do on windows explaining what is wrong.  What do you get? This precious icon to the right.  Apparently that is the universal icon for &#8216;you&#8217;re screwed&#8217; with an Apple-esk design to it.  After much googling about this &#8211; it seemed that icon meant one of two things.</p>
<ol>
<li>The problem could be simply the mac couldn&#8217;t find the startup disk, and you <em>just</em> reconfigure it using the iOS boot disk. Or &#8211; more likely</li>
<li>You&#8217;re screwed, and your filesystem is so messed up &#8211; you might want to go back to paper and pencil and use a real folder like the one in the icon for storage.</li>
</ol>
<p>To make a long, depressing story short, my drive was toast, and I replaced it.  Out with the bad drive, in with the good drive.  We have an amazing disk image install process here &#8211; so all I had to do was plug in a network connection and power, hold down N and power it up.  The MacBook Pro then went out and found the image on our network and through a wizard &#8211; installed Lion (an upgrade even).</p>
<p>Data recovery efforts were grim.  I created a Knoppix CD and hooked the dead drive to an external SATA rig and attempted to get some specific code and MySQL databases off. These particular items were not in production anywhere, and were pretty important to me.  I was able to scavenge some code with no errors, but the databases I needed were all corrupt.  I&#8217;m guessing because they were opened when the drive hit the fan.  So I have code, but no database for it.  Yes, I can reconstruct the database from looking through the class files, determine the field names, etc &#8230; fun.</p>
<h3>Enter Chrome.</h3>
<p>Remember Chrome? That&#8217;s what this is all about  (we&#8217;ll come back to my database reconstruction efforts in a bit)  During the re-setup process of my laptop I had installed Chrome.  I prefer this browser over all others because its fast and doesn&#8217;t feel bloated like Firefox does (which used to be my favorite browser).  I now have a new appreciation for Chrome &#8211; because I learned something I had no idea about.  With a fresh iOS installation obviously I didn&#8217;t have a backup of anything, much less my bookmarks.  I open Chrome, sign into Gmail &#8211; and a little while later, I notice all of my bookmarks are there.  All organized like they were before the crash.  Not only that, but any site I had told to &#8220;Remember Me&#8221; for logging in &#8211; it did.  Very cool.  I even texted a friend and asked  - &#8216;How does chrome have all of my bookmarks!?&#8217;</p>
<p>I&#8217;ve since learned that Chrome is linked to your google account (or can be).  You can configure whatever you want stored by accessing Chrome Preferences .. or by entering <a title="Chrome Settings" href="chrome://settings/browser" target="_blank">chrome://settings/browser</a>.  From here select Personal Stuff from the left, and you can connect / disconnect your google account</p>
<p style="text-align: center;"><a href="http://codedog.net/wp-content/uploads/2012/05/chrome_personal_stuff.png"><img class="aligncenter size-full wp-image-355" title="chrome_personal_stuff" src="http://codedog.net/wp-content/uploads/2012/05/chrome_personal_stuff.png" alt="Chrome Settings : Personal Stuff" width="748" height="137" /></a></p>
<p>You can also choose to manage your synced data on Google Dashboard &#8211; this webpage (once you log in) allows you to stop the sync and delete the data that has been synced, along with a host of other google settings not related to Chrome.</p>
<p>Clicking advances settings gives you options to choose what you want synced.  From here you can also choose to encrypt all data that is sent &#8211; default is &#8216;encrypt passwords&#8217; and change the passphrase &#8211; might be a good idea &#8211; depending how paranoid you are.</p>
<p><a href="http://codedog.net/wp-content/uploads/2012/05/chrome_advanced.png"><img class="aligncenter size-full wp-image-356" title="chrome_advanced" src="http://codedog.net/wp-content/uploads/2012/05/chrome_advanced.png" alt="Chrome Settings | Advanced" width="527" height="444" /></a></p>
<h3>Database reconstruction</h3>
<p>We&#8217;re back to my database woes.  Because I had the ever so controversial autofill checked to sync my forms, and since I originally hand built the MySQL database using PhpMyAdmin &#8211; when I got MAMP all set back up &#8211; I went in to build my database and tables.  Imagine my surprise when it did a drop down suggestion when I typed in the database name.    I created a new table and when I started entering field names again, it listed suggestions from when I had done it before.  Very cool.  So I was able to fudge my way through creating my tables again because I had some paper notes about the origianal names for things.</p>
<p>But what about the seed data I hand inserted using PhpMyAdmin?  Yep &#8211; that auto filled for me as well, the same data I had to think hard about when I put it in, just auto-suggested for me as I typed away names, and values.  So in a little less than an hour, I had my database and seed data setup and my salvaged code working.</p>
<p>Thank you Chrome and Google!</p>
<p>&nbsp;</p>
<div align='center'>
Code it right<br/>
<a style='text-decoration:none;' href='mailto:jonathan.wheat@codedog.net'>theCodeDog<br/>
<img style="border: 0px;" src="/codedog.gif" border="0" alt="theCodeDog" width="150" height="92" /></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://codedog.net/2012/05/15/how-chrome-saved-my-bacon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How web programmers should be more like lawyers</title>
		<link>http://codedog.net/2012/01/04/how-web-programmers-should-be-more-like-lawyers/</link>
		<comments>http://codedog.net/2012/01/04/how-web-programmers-should-be-more-like-lawyers/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 17:11:14 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://codedog.net/?p=334</guid>
		<description><![CDATA[I got to thinking the other day how I was similar to a lawyer, but really should leverage more lawyer-ish practices.  How did this pop into my mind?  Quickbooks.  The software I love to hate.  At this point in my life, I use it for invoicing, managing client information and tax reports.  Its way more [...]]]></description>
			<content:encoded><![CDATA[<p>I got to thinking the other day how I was similar to a lawyer, but really should leverage more lawyer-ish practices.  How did this pop into my mind?  Quickbooks.  The software I love to hate.  At this point in my life, I use it for invoicing, managing client information and tax reports.  Its way more software than I need, and I got to thinking what other service industry might have software that does what I do.  I&#8217;m not aware of something (cost effective) that will do the basics that I want, granted I haven&#8217;t really done much research because I own Quickbooks (so feel free to tweet <a href="http://twitter.com/#%21/thecodedog" target="_blank">@thecodedog</a> what you use for invoicing and book keeping).</p>
<p>When you set up Quickbooks, you choose a similar industry &#8211; and it goes off and sets up accounts and some of the ledgers, etc (stuff I don&#8217;t care about). Anyway I got to thinking how the functions of what I do are similar to a lawyer.  THEN I had an amazing idea that I think I&#8217;ll implement for 2012 &#8211; and we&#8217;ll see how it goes (I&#8217;ll get into that after these lists) -</p>
<p>Here&#8217;s how I&#8217;m similar -</p>
<ul>
<li>I AM AN EXPERT AT WHAT I DO</li>
<li>I charge hourly for my expertise and work (unless its a bug fix)</li>
<li>I take on projects, small and large</li>
<li>I meet with potential clients to determine if I can help</li>
<li>I advise people with my expertise (whether they follow it or not isn&#8217;t my issue)</li>
<li>I manage multiple projects at once</li>
<li>I research and learn all the time</li>
<li>I create structured documents</li>
<li>Occasionally I build and implement templates</li>
<li>I reuse items from other projects</li>
<li>I rarely produce a physical product</li>
<li>success is determined by the client, peers and typically the public</li>
<li>everything I do is to help the client</li>
<li>I have a pretty damn good success rate</li>
</ul>
<p>How I&#8217;m NOT like a lawyer</p>
<ul>
<li>I&#8217;m honest and not seedy (I know not all lawyers are bad)</li>
<li>I&#8217;m 100% up front with pricing and charges and my clients ALWAYS know what to expect when an invoice comes</li>
<li>I don&#8217;t charge for phone calls</li>
<li>I don&#8217;t charge for quick tasks that take more effort to create the invoice than the actual work performed</li>
<li>I probably do not charge enough (thus don&#8217;t overcharge) for the work I do</li>
<li>I don&#8217;t have an assistant to do my dirty work (book keeping / phone calls, research, etc)</li>
</ul>
<p>There is one thing that a lawyer does that is good that I don&#8217;t currently do, and it hit me and I&#8217;m curious if it will fly.  <strong>Keep me on retainer</strong>.  I looked it up and here&#8217;s a quick definition for a retainer -</p>
<blockquote><p>A <strong>retainer</strong> is a fee paid to an attorney or other professional in advance, for services. Often, retainers are paid monthly, based on an estimate of the amount of work to be done for the client each month.</p>
<p>A retainer might work like this: You would pay your attorney $500 a month for legal services during that month. If you have a question or need a matter handled, it comes off the retainer amount. If you don&#8217;t use the full amount of the retainer, in most cases you would not get a refund or a credit toward the next month. If you use more time than the retainer amount will cover, you will need to pay the additional fees.</p></blockquote>
<p>With that in mind, I&#8217;m wondering if any other programmer does this, and if clients would go for it.  In the past I&#8217;ve offered support contracts for an app I&#8217;ve built for a client.  If they wanted small changes, tweaks (all defined beforehand) they didn&#8217;t have to worry about it.  If a user had questions, needed training (again outlined specific hours) that was included.</p>
<p>The upside to a retainer agreement this is that you have reliable/consistent income each month, the client has the assurance you&#8217;re not going to walk away from the job.  They have the security in knowing that you&#8217;re there to call if anything comes up. They have a reliable budgeted amount to allocate for the project. And most importantly &#8211; if you have a retainer agreement with them, they would get preferential treatment and pop to the top of the workload (or as near as possible depending on what you have going on)</p>
<p>The downsides (two that I can think of) is that if you do this with too many clients, you might be overwhelmed with &#8216;high priority&#8217; work (which would probably happen regardless of a retainer agreement and the same number of clients).  The other (seems petty) is that you probably have to invoice them every month instead of hoping they remember to pay you (which you may not have to do if you didn&#8217;t do any work for them that month).</p>
<p>Deciding I&#8217;m going to offer this&#8230;what&#8217;s a fair rate then?</p>
<p>Figuring here in Pennsylvania the typical rate for what I do is $70-$100/hr &#8211; are clients seriously going to pay me 4-5 hours ($280 &#8211; $500) a month so I&#8217;m at their beck and call?  I personally don&#8217;t have any clients that large &#8211; I think they&#8217;d say &#8211; no, that&#8217;s ok, you can just invoice us for work performed. Maybe if they do put me on retainer &#8211; I lower my rates? Even 50% seems a bit steep for some of them and then you&#8217;re just screwing yourself because now you&#8217;re performing 5 hours of work for half the price you would be if you weren&#8217;t on retainer for them.</p>
<p>Its an interesting issue I&#8217;ve been pondering.  I like the idea of offing this to clients, I guess if they take it, its a win either way.  Especially if I get a month in there where they don&#8217;t use the 5 hours.</p>
<p>If you do this or have done this &#8211; feel free to comment below or shoot a tweet to <a href="http://twitter.com/#!/thecodedog" target="_blank">@thecodedog</a></p>
<p>and if you want me on retainer for you definitely contact me and we&#8217;ll talk &#8211; jonathan.wheat @ codedog.net <img src='http://codedog.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div align='center'>
Code it right<br/>
<a style='text-decoration:none;' href='mailto:jonathan.wheat@codedog.net'>theCodeDog<br/>
<img style="border: 0px;" src="/codedog.gif" border="0" alt="theCodeDog" width="150" height="92" /></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://codedog.net/2012/01/04/how-web-programmers-should-be-more-like-lawyers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Forcing SSL with PHP</title>
		<link>http://codedog.net/2011/11/29/forcing-ssl/</link>
		<comments>http://codedog.net/2011/11/29/forcing-ssl/#comments</comments>
		<pubDate>Tue, 29 Nov 2011 19:21:52 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://codedog.net/?p=327</guid>
		<description><![CDATA[Occasionally you have a registration form, login page or other php item that should be secured.  Its easy to link to something securely, however, some people play with urls ( I know, gasp ), search engines might get to the page with http, or users might somehow otherwise end up there unsecured.  Yes you can [...]]]></description>
			<content:encoded><![CDATA[<p>Occasionally you have a registration form, login page or other php item that should be secured.  Its easy to link to something securely, however, some people play with urls ( I know, gasp ), search engines might get to the page with http, or users might somehow otherwise end up there unsecured.  Yes you can accomplish this with an .htaccess file, but sometimes you don&#8217;t have the ability to edit / create one on a server.</p>
<p>Add this php code to the top of your php page to have it verify and flip to secure mode if needed -</p>
<p><code><code> &lt;?php<br />
if ($_SERVER['SERVER_PORT']!=443)<br />
{<br />
$url = "https://". $_SERVER['SERVER_NAME'] . ":443".$_SERVER['REQUEST_URI'];<br />
header("Location: $url");<br />
}<br />
?&gt; </code></code></p>
<p>Conversely if yiou have to pop back to http, you can alter the code to this -</p>
<p><code><code> &lt;?php<br />
if ($_SERVER['SERVER_PORT']!=80)<br />
{<br />
$url = "http://". $_SERVER['SERVER_NAME'] . ":80".$_SERVER['REQUEST_URI'];<br />
header("Location: $url");<br />
}<br />
?&gt; </code></code></p>
<p>That&#8217;s all, just wanted to share something I found when I need this behavior on an application form.</p>
<p>BTW if you want to do this via .htaccess &#8211; you can use something like this -</p>
<pre>RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://domain.com/$1 [R,L]</pre>
<div align='center'>
Code it right<br/>
<a style='text-decoration:none;' href='mailto:jonathan.wheat@codedog.net'>theCodeDog<br/>
<img style="border: 0px;" src="/codedog.gif" border="0" alt="theCodeDog" width="150" height="92" /></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://codedog.net/2011/11/29/forcing-ssl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debug Certificate expired &#8211; ugh</title>
		<link>http://codedog.net/2011/11/01/debug-certificate-expired-ugh/</link>
		<comments>http://codedog.net/2011/11/01/debug-certificate-expired-ugh/#comments</comments>
		<pubDate>Tue, 01 Nov 2011 17:44:12 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://codedog.net/?p=311</guid>
		<description><![CDATA[I decided to complete an app I&#8217;ve been working on and post it to the Droid Market.  After makiing a few changes, I fire off the commands to compile it &#8211; rake run:android after copiuos amounts of logging to the screen, I&#8217;m greeted with - THIS TOOL IS DEPRECATED. See &#8211;help for more information. Debug [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://codedog.net/wp-content/uploads/2011/11/android.jpg"><img class="alignright size-thumbnail wp-image-314" title="android" src="http://codedog.net/wp-content/uploads/2011/11/android-150x150.jpg" alt="" width="150" height="150" /></a>I decided to complete an app I&#8217;ve been working on and post it to the Droid Market.  After makiing a few changes, I fire off the commands to compile it &#8211; rake run:android</p>
<p>after copiuos amounts of logging to the screen, I&#8217;m greeted with -</p>
<p style="padding-left: 30px;"><strong>THIS TOOL IS DEPRECATED</strong>. See &#8211;help for more information.</p>
<p style="padding-left: 30px;">Debug Certificate expired on 27.10.11 08:10<br />
Error building APK file</p>
<p>Seriously?  Wonderful.</p>
<p>If or should I say WHEN you get this because apparently the debug certificates are valid for 365 days &#8211; here&#8217;s the solution -</p>
<p>Find and delete the file “<strong>debug.keystore</strong>”.  This is stored in your home directory under “<strong>~/.android</strong>” (OSX, Linux).  Similarly on Windows file resides in the “C:\Users\[user]\.android folder.</p>
<p>Just delete it, rm it, shred it, drag it to the trash, whatever.  Get it out of there.  A new one will regen much like I do in Black Ops when I get nailed by a zombie.  Its probably a good idea to do a <strong>rake clean:android</strong> as well, just to clean up from the failed compile, although this probably isn&#8217;t 100% necessary.</p>
<p>Now you&#8217;re good to go.</p>
<p>-Jon</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div align='center'>
Code it right<br/>
<a style='text-decoration:none;' href='mailto:jonathan.wheat@codedog.net'>theCodeDog<br/>
<img style="border: 0px;" src="/codedog.gif" border="0" alt="theCodeDog" width="150" height="92" /></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://codedog.net/2011/11/01/debug-certificate-expired-ugh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XCode and Rhodes Upgrading for iOS5</title>
		<link>http://codedog.net/2011/10/24/xcode-and-rhodes-upgrading-for-ios5/</link>
		<comments>http://codedog.net/2011/10/24/xcode-and-rhodes-upgrading-for-ios5/#comments</comments>
		<pubDate>Mon, 24 Oct 2011 19:24:34 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[Mobile Connection]]></category>
		<category><![CDATA[rhomobile]]></category>
		<category><![CDATA[XCode]]></category>

		<guid isPermaLink="false">http://codedog.net/?p=301</guid>
		<description><![CDATA[So I recently updated my iPhone to iOS5.  Its a 3GS &#8230; so it was less than exciting to see the end result.  Yea, there are some GUI enhancements, but nothing really worth the trouble its causing now.  What trouble?  When you build an app using XCode, and you want to deploy it to your [...]]]></description>
			<content:encoded><![CDATA[<p>So I recently updated my iPhone to iOS5.  Its a 3GS &#8230; so it was less than exciting to see the end result.  Yea, there are some GUI enhancements, but nothing really worth the trouble its causing now.  What trouble?  When you build an app using XCode, and you want to deploy it to your iPhone for testing purposes, the OS on your phone MUST match the SDK on your system.</p>
<p>So I&#8217;m plugging along building and testing 2 apps in the simulator, they&#8217;re working great.  I decided I&#8217;m to the point where I&#8217;d like to test them on my phone, so I fire up XCode (4.1 to something) and got a nice little message that said something like the Operating system on your device does not match the SDK version on this machine.  Click here to revert the device &#8230; WHAT?  Heck no.  So that mean I now have to go through the pain of updaing XCode.</p>
<p>This has happened multiple times to me as I&#8217;ve progressed up through OS versions on my phone, so this time I figured I&#8217;d document it &#8211; so next time its not so much guess work, and it might help someone else too.</p>
<ul>
<li>Download XCode : Log into your developer account at http://developer.apple.com click downloads, and download the latest SDK version (4.2 includes iOS5 SDK)</li>
<li>Install XCode.  This can take a while, so grab a book or make a sandwich.  DON&#8217;T listen to music on iTunes, because that&#8217;ll have to be closed during this upgrade.</li>
</ul>
<p>If you&#8217;re developing with Rhodes (http://rhomobile.com) you might possibly have to upgrade this as well.  Since you have your sandwich and a drink, you might as well.</p>
<p><strong>Rhodes Upgrade (optional)</strong></p>
<p>From a terminal prompt</p>
<ul>
<li>sudo gem update rhodes</li>
<li>rhodes-setup</li>
<li>set-rhodes-sdk (from your application&#8217;s root folder)</li>
<li>rake clean:iphone</li>
</ul>
<p>If you get an error like this -</p>
<pre><span style="color: #993300;"><strong>=== CLEAN NATIVE TARGET rhorubylib OF PROJECT rhorubylib WITH CONFIGURATION Distribution ===</strong></span>
<span style="color: #993300;"><strong>Check dependencies</strong></span>
<span style="color: #993300;"><strong>Unsupported compiler 'GCC 4.2' selected for architecture 'i386'</strong></span></pre>
<p>Welcome to the club.</p>
<p>It seems that XCode 4.2 removes the older 4.x simulators.  I found this out when I opened XCode trying to debug the message above, and there was only iPhone Simulator 5.0 listed.  So to fix the error above, you much edit your build.yml file and set these lines -</p>
<div>iphone:</div>
<div>  sdk: iphonesimulator5.0</div>
<div>  iphoneemulator: 5.0</div>
<div>Then you can run your rake commands and it&#8217;ll all work including rake run:iphone</div>
<div><strong>XCode usage</strong></div>
<div>To compile it in XCode run this from your project root</div>
<div>
<p>rake switch_app</p>
<p>Then from XCode you can choose your simulator and compile away for your simulator.</p>
<p>&nbsp;</p>
</div>
<div align='center'>
Code it right<br/>
<a style='text-decoration:none;' href='mailto:jonathan.wheat@codedog.net'>theCodeDog<br/>
<img style="border: 0px;" src="/codedog.gif" border="0" alt="theCodeDog" width="150" height="92" /></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://codedog.net/2011/10/24/xcode-and-rhodes-upgrading-for-ios5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>redirect with parameters</title>
		<link>http://codedog.net/2011/10/07/redirect-with-parameters/</link>
		<comments>http://codedog.net/2011/10/07/redirect-with-parameters/#comments</comments>
		<pubDate>Fri, 07 Oct 2011 19:28:46 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[rhomobile]]></category>

		<guid isPermaLink="false">http://codedog.net/?p=290</guid>
		<description><![CDATA[I posted a while back about passing parameters between views from within a link. Today I&#8217;ll post this code to remind myself how to do that from within a redirect. Sometimes in your view or controller, you might call a method to do something &#8211; say store something in the database and pop up a [...]]]></description>
			<content:encoded><![CDATA[<p>I posted a while back about <a title="Passing Parameters" href="http://codedog.net/2010/09/23/passing-parameters-with-rhodes/">passing parameters between views from within a link</a>.</p>
<p>Today I&#8217;ll post this code to remind myself how to do that from within a redirect.</p>
<p>Sometimes in your view or controller, you might call a method to do something &#8211; say store something in the database and pop up a message, and you might need to redirect to a new view/method after that.  Well sometimes you need to get some parameter(s) to that new page as well.  If you search the system-api-samples project Rhomobile has &#8211; you won&#8217;t find this in there. Ok, you might, I didn&#8217;t.</p>
<p>I had a &#8216;duh&#8217; moment when I got this to work, because its pretty dang near identical to passing parameters in a link.</p>
<p>Here it is in all its glory :</p>
<p>Where list_details is the destination method and we&#8217;re passing session_id with the variable @session_id</p>
<pre>redirect :action =&gt; :list_details, :query =&gt; {:session_id =&gt; @session_id}</pre>
<p>If you had more parameters, you&#8217;d separate them with a comma like this -</p>
<pre>:query =&gt; {:session_id =&gt; @session_id, :session_title =&gt; @my_title, :message =&gt; 'it worked'}

Easy, right?
</pre>
<div align='center'>
Code it right<br/>
<a style='text-decoration:none;' href='mailto:jonathan.wheat@codedog.net'>theCodeDog<br/>
<img style="border: 0px;" src="/codedog.gif" border="0" alt="theCodeDog" width="150" height="92" /></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://codedog.net/2011/10/07/redirect-with-parameters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PABUG Status &amp; Screenies</title>
		<link>http://codedog.net/2011/10/03/pabug-status/</link>
		<comments>http://codedog.net/2011/10/03/pabug-status/#comments</comments>
		<pubDate>Mon, 03 Oct 2011 14:48:24 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[rhomobile]]></category>

		<guid isPermaLink="false">http://codedog.net/?p=271</guid>
		<description><![CDATA[So &#8211; I&#8217;ve neglected to write posts as I&#8217;ve worked on this, mostly because I&#8217;ve been trying things, and need to complete this as soon as possible.  I&#8217;ve gotten a few emails asking about the progress, so instead of dragging out the time until the next post about it, I&#8217;ve decided to attach some screenshots [...]]]></description>
			<content:encoded><![CDATA[<p>So &#8211; I&#8217;ve neglected to write posts as I&#8217;ve worked on this, mostly because I&#8217;ve been trying things, and need to complete this as soon as possible.  I&#8217;ve gotten a few emails asking about the progress, so instead of dragging out the time until the next post about it, I&#8217;ve decided to attach some screenshots of what I have so far.</p>
<p>Still have some formatting / tweaks to do, but the bulk of this is now working.</p>
<p>Enjoy.</p>
<div id="attachment_276" class="wp-caption alignleft" style="width: 169px"><a href="http://codedog.net/wp-content/uploads/2011/10/pabug_102_03_floorplan1.png"><img class="size-medium wp-image-276 " title="pabug_102_03_floorplan" src="http://codedog.net/wp-content/uploads/2011/10/pabug_102_03_floorplan1-159x300.png" alt="" width="159" height="300" /></a><p class="wp-caption-text">Main Floorplan</p></div>
<div id="attachment_273" class="wp-caption alignleft" style="width: 169px"><a href="http://codedog.net/wp-content/uploads/2011/10/pabug_102_02_exhibitor_details.png"><img class="size-medium wp-image-273 " title="pabug_102_02_exhibitor_details" src="http://codedog.net/wp-content/uploads/2011/10/pabug_102_02_exhibitor_details-159x300.png" alt="" width="159" height="300" /></a><p class="wp-caption-text">Exhibitor Info</p></div>
<div id="attachment_272" class="wp-caption alignleft" style="width: 169px"><a href="http://codedog.net/wp-content/uploads/2011/10/pabug_102_01_mainscreen.png"><img class="size-medium wp-image-272 " title="pabug_102_01_mainscreen" src="http://codedog.net/wp-content/uploads/2011/10/pabug_102_01_mainscreen-159x300.png" alt="" width="159" height="300" /></a><p class="wp-caption-text">Home Screen</p></div>
<p>&nbsp;</p>
<div id="attachment_277" class="wp-caption alignleft" style="width: 169px"><a href="http://codedog.net/wp-content/uploads/2011/10/pabug_102_04_twitta1.png"><img class="size-medium wp-image-277 " title="pabug_102_04_twitta" src="http://codedog.net/wp-content/uploads/2011/10/pabug_102_04_twitta1-159x300.png" alt="" width="159" height="300" /></a><p class="wp-caption-text">Twitta Feed</p></div>
<div id="attachment_278" class="wp-caption alignleft" style="width: 169px"><a href="http://codedog.net/wp-content/uploads/2011/10/pabug_102_05_sessions.png"><img class="size-medium wp-image-278 " title="pabug_102_05_sessions" src="http://codedog.net/wp-content/uploads/2011/10/pabug_102_05_sessions-159x300.png" alt="" width="159" height="300" /></a><p class="wp-caption-text">Session Breakout</p></div>
<div id="attachment_279" class="wp-caption alignleft" style="width: 169px"><a href="http://codedog.net/wp-content/uploads/2011/10/pabug_102_06_session_details.png"><img class="size-medium wp-image-279 " title="pabug_102_06_session_details" src="http://codedog.net/wp-content/uploads/2011/10/pabug_102_06_session_details-159x300.png" alt="" width="159" height="300" /></a><p class="wp-caption-text">Session Details</p></div>
<p>&nbsp;</p>
<div align='center'>
Code it right<br/>
<a style='text-decoration:none;' href='mailto:jonathan.wheat@codedog.net'>theCodeDog<br/>
<img style="border: 0px;" src="/codedog.gif" border="0" alt="theCodeDog" width="150" height="92" /></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://codedog.net/2011/10/03/pabug-status/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Formatting Dates</title>
		<link>http://codedog.net/2011/09/28/formatting-dates/</link>
		<comments>http://codedog.net/2011/09/28/formatting-dates/#comments</comments>
		<pubDate>Thu, 29 Sep 2011 02:30:03 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[rhomobile]]></category>

		<guid isPermaLink="false">http://codedog.net/?p=262</guid>
		<description><![CDATA[Dates suck.  Simple fact, no matter what language you&#8217;re using, formatting, date-math, converting or parsing dates &#8230; it all sucks. So in an effort to try to limit the suck you have to go through if/when you have to deal with dates, I hope this helps. My app, when first loaded, pulls a feed from [...]]]></description>
			<content:encoded><![CDATA[<p>Dates suck.  Simple fact, no matter what language you&#8217;re using, formatting, date-math, converting or parsing dates &#8230; it all sucks.</p>
<p>So in an effort to try to limit the suck you have to go through if/when you have to deal with dates, I hope this helps.</p>
<p>My app, when first loaded, pulls a feed from our oracle database.  The date is listed in the &#8216;typical&#8217; format &#8211; 22-NOV-11, stores this in the device&#8217;s database (FixedSchema) (  property :session_date, :date ) &#8211; so you would think that would be the type date.  In my controller I do this little query -</p>
<pre>@days = Session.find_by_sql("SELECT distinct(session_date) _
   FROM Session ORDER BY session_date")</pre>
<p>In my view I loop through with something like this -</p>
<pre>&lt;% @days.each do |session| %&gt;</pre>
<pre>typical, nothing special</pre>
<p>so we essentially have session.session_date inside this loop &#8211; and I don&#8217;t want to display it in the default format (22-NOV-11).  So I endevored on a painful journy &#8211; pulling in 3 other developers on the rhomobile list. 10 emails later, I got it working.  I used this code -</p>
<div>
<pre>@display_date = Date.strptime(session_date,"%<wbr>d-%b-%y").strftime("%A, %B %d")</wbr></pre>
<p>This gets me really close to the format I wanted, &#8211; Monday, November 23</p>
</div>
<p>But I wanted what I&#8217;ve found is called the ordinal suffix on the end ( the &#8216;rd&#8217;,'st&#8217;,'nd&#8217;,'th&#8217;).  In rails there is an .ordinalize method &#8211; but that&#8217;s not available in ruby (maybe you could include a library or gem or something, but by this point, I&#8217;ve suffered 3 days to deal with this), so I created my own.</p>
<div>This is the final code I ended up with -</div>
<div><strong>in my index.erb :</strong></div>
<div>
<pre>session_date = session.session_date
@display_date = format_date(session_date)</pre>
</div>
<p><strong>in my session_controller.erb:</strong><br />
def format_date (date_in)<br />
prefix = Date.strptime(date_in,&#8221;%d-%b-%<wbr>y&#8221;).strftime(&#8220;%A, %B %d&#8221;)<br />
day = Date.strptime(date_in,&#8221;%d-%b-%<wbr>y&#8221;).strftime(&#8220;%d&#8221;).to_i<br />
if day == 11 or day == 12<br />
return prefix + &#8220;th&#8221;<br />
else<br />
case day % 10<br />
when 1 then return prefix + &#8220;st&#8221;<br />
when 2 then return prefix + &#8220;nd&#8221;<br />
when 3 then return prefix  +&#8221;rd&#8221;<br />
else return prefix + &#8220;th&#8221;<br />
end<br />
end<br />
end<br />
might be a little klunky coding, I&#8217;m sure I could just set the suffix and append / return them at the end, but this works, and I need to move on to another part of my app.</wbr></wbr></p>
<p>&nbsp;</p>
<div align='center'>
Code it right<br/>
<a style='text-decoration:none;' href='mailto:jonathan.wheat@codedog.net'>theCodeDog<br/>
<img style="border: 0px;" src="/codedog.gif" border="0" alt="theCodeDog" width="150" height="92" /></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://codedog.net/2011/09/28/formatting-dates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Appcelerator &#8211; a second chance</title>
		<link>http://codedog.net/2011/09/06/appcelerator-a-second-chance/</link>
		<comments>http://codedog.net/2011/09/06/appcelerator-a-second-chance/#comments</comments>
		<pubDate>Tue, 06 Sep 2011 14:43:19 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[Appcelerator]]></category>

		<guid isPermaLink="false">http://codedog.net/?p=248</guid>
		<description><![CDATA[I subscribe to the TechZing podcast and the two hosts, Justin Vincent and Jason Roberts have used Appcelerator for a couple projects of theirs and talk about it in many of the older episodes.  I had tried Appcelerator on my old windows box and it was a disaster. Could have been them, could have been [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://codedog.net/wp-content/uploads/2011/09/appcelerator.png"><img class="alignright size-medium wp-image-250" title="Appcelerator" src="http://codedog.net/wp-content/uploads/2011/09/appcelerator-300x237.png" alt="" width="300" height="237" /></a>I subscribe to the <a title="TechZing Podcast" href="http://techzinglive.com" target="_blank">TechZing</a> podcast and the two hosts, <a title="Justin VIncent cohost of TechZing" href="http://justinvincent.com/" target="_blank">Justin Vincent</a> and <a title="Jason Roberts cohost of TechZing" href="http://www.codusoperandi.com" target="_blank">Jason Roberts</a> have used <a title="Appcelerator" href="http://www.appcelerator.com/" target="_blank">Appcelerator</a> for a couple projects of theirs and talk about it in many of the older episodes.  I had tried Appcelerator on my old windows box and it was a disaster. Could have been them, could have been me &#8211; didn&#8217;t care.  Then I moved to Mac &#8211; and tried it.  I still had problems, think I even <a title="CodeDog titter account" href="http://twitter.com/#%21/thecodedog" target="_blank">tweeted</a> about that back in February.</p>
<p>Since I respect the guys from TechZing and with the on going praise, I figured I&#8217;d try it again.  I googled how to remove it completely from my mac, just to make sure the old broken / mis-configured stuff was gone, <a title="Titanium Appcelerator Installaion" href="https://my.appcelerator.com/auth/signup/offer/community" target="_blank">downloaded</a> and installed it.</p>
<p>To my amazement, it installed easily, and I was able to quickly open <a title="Titanium Studio overview" href="http://www.appcelerator.com/products/titanium-studio/" target="_blank">Titanium Studio</a> (essentially eclipse customized for Titanium) and run a new empty app.  Granted it wasn&#8217;t an exciting app, but it did open in the simulator.  After about 40 minutes of dinking around, I was able to get everything in order (thanks Apple) and deployed it to my iPhone.  Again, no awesomeness in that app, but still &#8211; a huge leap.  Titanium has an app called Kitchen Sink &#8211; where they add all of their features, and show off the framework.  I downloaded that, imported it, and was able to deploy that on my phone as well.  This rocked.  10 minutes later, I had it running in the Android simulator. It only took 10 minutes because I had to get the Android SDK stuff in order.</p>
<p>Within an hour of downloading, I had both created and imported apps, built them, tested them on the simulator and deployed them to my iPhone.  Amazing.</p>
<p>Appcelerator uses Javascript as a programming language, yea, not just a scripty thing you use on a webpage, as <span style="text-decoration: underline;">the</span> language. Pretty cool.  The code gets compiled using the device SDKs so so the deployed app runs natively on the phone.  This gives you access to the device&#8217;s features like calendar, GPS, accelerometer, camera, video, photo libraries, file system etc.</p>
<p>I have yet to really start playing around with it, but I&#8217;m planning on building an app for a friend, so keep watching this blog for that.</p>
<p>All in all &#8211; when I can go from download to deployment on my device in about an hour, that rocks. Titanium Appcelerator gets an A+ from me. Thanks Justin and Jason for influencing me to try it again.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div align='center'>
Code it right<br/>
<a style='text-decoration:none;' href='mailto:jonathan.wheat@codedog.net'>theCodeDog<br/>
<img style="border: 0px;" src="/codedog.gif" border="0" alt="theCodeDog" width="150" height="92" /></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://codedog.net/2011/09/06/appcelerator-a-second-chance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ezSQL &#8211; database wrapper/abstraction layer</title>
		<link>http://codedog.net/2011/08/15/ezsql-database-abstraction-layer/</link>
		<comments>http://codedog.net/2011/08/15/ezsql-database-abstraction-layer/#comments</comments>
		<pubDate>Tue, 16 Aug 2011 00:50:57 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://codedog.net/?p=229</guid>
		<description><![CDATA[I was looking for a database wrapper / abstraction layer to use for PHP a couple weeks ago.  I&#8217;m working on a large PHP project and its using Oracle.  I started out with the app using oci calls throughout.  Launched the beta &#8211; and its working pretty well.    Now I&#8217;m going through cleaning up sections [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://codedog.net/wp-content/uploads/2011/08/ezsql.jpeg"><img class="alignright size-full wp-image-244" title="ezsql" src="http://codedog.net/wp-content/uploads/2011/08/ezsql.jpeg" alt="" width="200" height="200" /></a>I was looking for a database wrapper / abstraction layer to use for PHP a couple weeks ago.  I&#8217;m working on a large PHP project and its using Oracle.  I started out with the app using oci calls throughout.  Launched the beta &#8211; and its working pretty well.    Now I&#8217;m going through cleaning up sections of code gearing up for a 1.1 release and thought I&#8217;d look for something to make the database coding easier.  Not that its difficult, but each database call is bloated with multiple lines of code for each call, I wanted something easier.  Enter ezSQL.</p>
<p><a title="ezSQL - Database Astraction for PHP" href="http://justinvincent.com/ezsql" target="_blank">ezSQL</a> was created by <a title="Justin VIncent - the coolest PHP coder I've never met" href="http://justinvincent.com" target="_blank">Justin Vincent</a> &#8211; and its nothing short of amazing. ezSQL can sit on a multitude of databases including &#8211; mySQL / Oracle8/9 / InterBase/FireBird / PostgreSQL / MS-SQL / SQLite / SQLite c++ &#8230; I mean WOW.  One thought I had was to possibly have a development version of the database as MySQL &#8211; and the production version as Oracle.  The data structure won&#8217;t change, I&#8217;m pretty much building screens off of that, so table changes would be minimal. But seriously, in practice who does that ?  Hmmm, maybe me.  We&#8217;ll see after I get out from under the mound of work I have.  My problem is &#8211; while I have VPN access to the Oracle database, if I don&#8217;t have a net connection &#8211; I can&#8217;t work on the app &#8211; since I have no database, not good.  So this may help me be more productive, if I&#8217;m sitting at the pool waiting for my kids to finish swim practice, I can code, or if I&#8217;m out in the park or at my mother-in-law&#8217;s place (yea &#8211; she&#8217;s got no wireless).  Anyway, the more I think about this &#8211; I could easily create a config option as to which database to use.</p>
<p>Back to ezSQL&#8230;</p>
<p>Once configured (which took a whole 2 minutes, and that was because I moved the files from the demo into my app) you can make calls like this -</p>
<pre><strong>$users = $db-&gt;get_results("SELECT name, email FROM users");</strong></pre>
<p>Typically, results are stored in an object, but you can alter the call to return associative arrays, or numerical arrays.</p>
<p>So using the example above, you&#8217;d pull out the name and email like this -</p>
<pre><strong>foreach ( $users as $user )
  {
      // Access data using object syntax
      echo $user-&gt;name;
      echo $user-&gt;email;
  }</strong></pre>
<p>If you have just one row you use get_row, if you&#8217;re simply getting 1 item like a count, you use get_var.  A simple to read <a title="ezSQL Introduction" href="http://jvmultimedia.com/docs/ezsql/ez_sql_help.htm" target="_blank">instruction page</a> explains it all.  There are many examples on that page to help get you started.</p>
<p>Probably the best feature is <strong>$db-&gt;debug();</strong>  this little gem (can&#8217;t thank Justin enough for this one) spits out a pile of information about the query, as well as the data that&#8217;s coming back.  So if you&#8217;re having a problem with the database call &#8211; toss in this command and it&#8217;ll help you out.</p>
<p>Another gem is the <strong>$db-&gt;vardump($users);</strong> which displays the contents and structure of the variable / object.  Again great for determining what is happening with a query.</p>
<p>I know I sound like a paid advertisement for this, but the support was amazing too.  I had a problem with the version I had downloaded, and emailed Justin.  The next day &#8211; he fixed it right away and posted a new version, which is currently posted on his site (<a title="Version 2.10 ezSQL" href="http://justinvincent.com/ezsql" target="_blank">2.10</a>)</p>
<p>Overall, this is a big win for me.</p>
<div align='center'>
Code it right<br/>
<a style='text-decoration:none;' href='mailto:jonathan.wheat@codedog.net'>theCodeDog<br/>
<img style="border: 0px;" src="/codedog.gif" border="0" alt="theCodeDog" width="150" height="92" /></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://codedog.net/2011/08/15/ezsql-database-abstraction-layer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

