<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>mitchitized</title> <link>http://www.mitchitized.com</link> <description>the online home for mitch pirtle</description> <lastBuildDate>Tue, 15 Dec 2009 02:04:04 +0000</lastBuildDate> <generator>http://wordpress.org/?v=2.9.1</generator> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Mitchitized" /><feedburner:info uri="mitchitized" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><title>Amazing ad by NYC Health Department</title><link>http://feedproxy.google.com/~r/Mitchitized/~3/UMkOKh0PN64/</link> <comments>http://www.mitchitized.com/random-blather/amazing-ad-by-nyc-health-department/#comments</comments> <pubDate>Tue, 15 Dec 2009 02:04:04 +0000</pubDate> <dc:creator>mitchy</dc:creator> <category><![CDATA[Random blather]]></category> <category><![CDATA[ad]]></category> <category><![CDATA[food]]></category> <category><![CDATA[nutrition]]></category> <category><![CDATA[nyc]]></category><guid isPermaLink="false">http://www.mitchitized.com/?p=100</guid> <description><![CDATA[
I&#8217;ve avoided sodas for years now, mainly because I think they taste too sweet &#8211; and then as I learned more about high fructose corn syrup and artificial ingredients, I was happy I came to that conclusion in the first place.
Watched Food Inc. last weekend with the wife, and am pretty amazed at how soda [...]]]></description> <content:encoded><![CDATA[<p><object
width="425" height="344"><param
name="movie" value="http://www.youtube.com/v/-F4t8zL6F0c&#038;color1=0x3a3a3a&#038;color2=0x999999&#038;hl=en_US&#038;feature=player_embedded&#038;fs=1"></param><param
name="allowFullScreen" value="true"></param><param
name="allowScriptAccess" value="always"></param><embed
src="http://www.youtube.com/v/-F4t8zL6F0c&#038;color1=0x3a3a3a&#038;color2=0x999999&#038;hl=en_US&#038;feature=player_embedded&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="425" height="344"></embed></object></p><p>I&#8217;ve avoided sodas for years now, mainly because I think they taste too sweet &#8211; and then as I learned more about high fructose corn syrup and artificial ingredients, I was happy I came to that conclusion in the first place.</p><p>Watched <a
href="http://www.mitchitized.com/random-blather/youll-never-look-at-dinner-the-same-way-again/">Food Inc.</a> last weekend with the wife, and am pretty amazed at how soda is now cheaper than clean water. &#8220;Clean&#8221; is relative sure, but modern standards leave us with clean water costing way, way more than soda.</p> <div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Mitchitized?a=UMkOKh0PN64:pN_ierDgAlA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Mitchitized?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Mitchitized?a=UMkOKh0PN64:pN_ierDgAlA:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Mitchitized?i=UMkOKh0PN64:pN_ierDgAlA:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Mitchitized?a=UMkOKh0PN64:pN_ierDgAlA:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Mitchitized?i=UMkOKh0PN64:pN_ierDgAlA:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Mitchitized?a=UMkOKh0PN64:pN_ierDgAlA:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/Mitchitized?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Mitchitized/~4/UMkOKh0PN64" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://www.mitchitized.com/random-blather/amazing-ad-by-nyc-health-department/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <feedburner:origLink>http://www.mitchitized.com/random-blather/amazing-ad-by-nyc-health-department/</feedburner:origLink></item> <item><title>Locked out of your Joomla?</title><link>http://feedproxy.google.com/~r/Mitchitized/~3/1BrS5500QFU/</link> <comments>http://www.mitchitized.com/nerdy-stuff/locked-out-of-your-joomla/#comments</comments> <pubDate>Fri, 06 Nov 2009 03:31:27 +0000</pubDate> <dc:creator>mitchy</dc:creator> <category><![CDATA[Nerdy stuff]]></category> <category><![CDATA[joomla]]></category><guid isPermaLink="false">http://www.mitchitized.com/?p=89</guid> <description><![CDATA[This was just asked on the NYPHP Joomla mailing list, so I thought I&#8217;d add it here for folks as a quick cheatsheet. Basically the problem is when you find yourself with a Joomla site and have no idea what the logins are. You need to find the admin user (or whatever the admin user&#8217;s [...]]]></description> <content:encoded><![CDATA[<p>This was just asked on the <a
href="http://lists.nyphp.org/mailman/listinfo/joomla">NYPHP Joomla</a> mailing list, so I thought I&#8217;d add it here for folks as a quick cheatsheet. Basically the problem is when you find yourself with a Joomla site and have no idea what the logins are. You need to find the admin user (or whatever the admin user&#8217;s username is) and reset the password to something you know, so you can login and start taking control of the site. This is how it can be done.<span
id="more-89"></span>In the top directory of your website&#8217;s files, you&#8217;ll find a file there called <em>configuration.php</em>.Take a look in this file and grab the following variables:</p><ul><li>$host</li><li>$user</li><li>$db</li><li>$password</li></ul><p>That is your database access information. Now to change your admin password. When you connect to your database (using the mysql command line client on your server most likely), go to a table called <em>jos_users</em> and look for the admin user:</p><p><code>select id, name, username, password from jos_users;</code></p><p>Somewhere in those results should be a user called &#8216;admin&#8217; in the &#8217;username&#8217; column. If not, you should probably see which account was acting as the admin superuser, and that is the one you want. Now change that password to &#8216;changeme&#8217; like this, and note that I had to run the string &#8216;changeme&#8217; through MD5 first as all passwords in Joomla are hashed:</p><p><code>update jos_users set password = '4cb9c8a8048fd02294477fcb1a41191a' where username = 'admin';</code></p><p>Now you can login to the Joomla backend as <em>admin</em> / <em>changeme</em>, and <strong>IMMEDIATELY</strong> change your password.</p><p>For this very reason I keep a simple PHP script on my laptop that has a form that posts a text field and echos the output after an MD5 hash. That way I can generate MD5 hashes of known strings when I need to reset a password, for instance.</p><p>Hope you find this useful, and please pipe up in the comments if this post needs more detail.</p> <div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Mitchitized?a=1BrS5500QFU:46gOjKJcqFI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Mitchitized?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Mitchitized?a=1BrS5500QFU:46gOjKJcqFI:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Mitchitized?i=1BrS5500QFU:46gOjKJcqFI:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Mitchitized?a=1BrS5500QFU:46gOjKJcqFI:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Mitchitized?i=1BrS5500QFU:46gOjKJcqFI:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Mitchitized?a=1BrS5500QFU:46gOjKJcqFI:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/Mitchitized?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Mitchitized/~4/1BrS5500QFU" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://www.mitchitized.com/nerdy-stuff/locked-out-of-your-joomla/feed/</wfw:commentRss> <slash:comments>2</slash:comments> <feedburner:origLink>http://www.mitchitized.com/nerdy-stuff/locked-out-of-your-joomla/</feedburner:origLink></item> <item><title>Joomla for blogging</title><link>http://feedproxy.google.com/~r/Mitchitized/~3/KA8eQOwMef4/</link> <comments>http://www.mitchitized.com/nerdy-stuff/joomla-for-blogging/#comments</comments> <pubDate>Sat, 24 Oct 2009 15:48:24 +0000</pubDate> <dc:creator>mitchy</dc:creator> <category><![CDATA[Nerdy stuff]]></category> <category><![CDATA[joomla]]></category> <category><![CDATA[wordpress]]></category><guid isPermaLink="false">http://www.mitchitized.com/?p=85</guid> <description><![CDATA[This site has been up in the current incarnation &#8211; that would be Wordpress &#8211; for several months now. That means time to tear it up and do something different.
Since I&#8217;ve been bemoaning the sorry state of Joomla as a blogging platform, I&#8217;ve been politely told that I can in fact use Joomla as a [...]]]></description> <content:encoded><![CDATA[<p>This site has been up in the current incarnation &#8211; that would be Wordpress &#8211; for several months now. That means time to tear it up and do something different.</p><p>Since I&#8217;ve been bemoaning the sorry state of Joomla as a blogging platform, I&#8217;ve been politely told that I can in fact use Joomla as a blogging platform, and it&#8217;ll actually work like, you know, a <strong>blog</strong>.<span
id="more-85"></span></p><p>So I&#8217;m investigating extensions and such to add the following features to a Joomla site:</p><ul><li>comments</li><li>trackbacks</li><li>pings</li><li>tags</li></ul><p>I know there are commercial platforms that can do some or all of these things, how about open source ones? The few things I HAVE tried were awful.</p><p>When I got it all figured out I&#8217;ll relaunch the blog, and document how it was done.</p><h2>What is it now?</h2><p>Right now this site is running Wordpress with a few additional goodies:</p><ul><li>Pyrmont V2 2.0.7 by <a
title="Click to visit author's website" href="http://imotta.cn/">motta</a></li><li><a
title="Click to visit the plugin's website" href="http://www.webdev3000.com/">About Me 3000</a></li><li><a
title="Self explanatory, huh?" href="http://seanys.com/2007/10/12/twitter-wordpress-widget/">Twitter Widget</a></li><li><a
title="Cool." href="http://www.pepijnkoning.nl/archief/wordpress-my-twitpics-plugin/">My TwitPics</a></li><li><a
href="http://contactform7.com/">Contact Form 7</a></li><li><a
title="Click to visit site" href="http://www.deanlee.cn/wordpress/code_highlighter_plugin_for_wordpress/">Dean&#8217;s Code Highlighter</a></li><li><a
title="Clickie the linkie" href="http://yoast.com/wordpress/analytics/#utm_source=wordpress&amp;utm_medium=plugin&amp;utm_campaign=google-analytics-for-wordpress">Google Analytics for Wordpress</a></li><li><a
title="Just click it, punk!" href="http://www.arnebrachhold.de/redir/sitemap-home/">Google XML Sitemaps</a></li><li><a
title="Sociable adds social media links to all of your posts." href="http://blogplay.com/plugin">Sociable</a></li></ul><p>I tried the Wordpress Events Calendar but it didn&#8217;t work; and ditto for my experience with a variety of book plugins, who either had absolutely horrific markup and display or broken code.</p><p>My favorite app in this whole experience ended up being the Wordpress for iPhone app &#8211; which does exactly what it says, and allows you to manage posts, pages and comments all from your iPhone. Best of all you can incorporate photos in your content, making it more than just a &#8220;in case of emergency&#8221; tool.</p><p>Once I figure out what I&#8217;m going to do for a Joomla-powered blog, I&#8217;ll post as well. And this time I&#8217;ll include some redirects for old URLs from the Wordpress instance, and keep the old content and comments. Wish me luck.</p> <div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Mitchitized?a=KA8eQOwMef4:jddwGFsV55M:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Mitchitized?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Mitchitized?a=KA8eQOwMef4:jddwGFsV55M:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Mitchitized?i=KA8eQOwMef4:jddwGFsV55M:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Mitchitized?a=KA8eQOwMef4:jddwGFsV55M:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Mitchitized?i=KA8eQOwMef4:jddwGFsV55M:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Mitchitized?a=KA8eQOwMef4:jddwGFsV55M:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/Mitchitized?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Mitchitized/~4/KA8eQOwMef4" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://www.mitchitized.com/nerdy-stuff/joomla-for-blogging/feed/</wfw:commentRss> <slash:comments>9</slash:comments> <feedburner:origLink>http://www.mitchitized.com/nerdy-stuff/joomla-for-blogging/</feedburner:origLink></item> <item><title>And the vaccination debate heats up some more</title><link>http://feedproxy.google.com/~r/Mitchitized/~3/fcSw7MwdqOQ/</link> <comments>http://www.mitchitized.com/random-blather/and-the-vaccination-debate-heats-up-some-more/#comments</comments> <pubDate>Fri, 23 Oct 2009 17:31:37 +0000</pubDate> <dc:creator>mitchy</dc:creator> <category><![CDATA[Random blather]]></category> <category><![CDATA[health]]></category> <category><![CDATA[pharmaceutical]]></category> <category><![CDATA[vaccines]]></category><guid isPermaLink="false">http://www.mitchitized.com/?p=82</guid> <description><![CDATA[Wow, reading up on the arguments between the pro-vaccination folks and the anti-vaccination folks, interspersed with the folks that just want to bring some common sense into the matter, has become a time consuming task. Here&#8217;s a great article titled &#8220;An Epidemic of Fear: How Panicked Parents Skipping Shots Endangers Us&#8221; at Wired.com that actually [...]]]></description> <content:encoded><![CDATA[<p>Wow, reading up on the arguments between the pro-vaccination folks and the anti-vaccination folks, interspersed with the folks that just want to bring some common sense into the matter, has become a time consuming task. Here&#8217;s a great article titled &#8220;<a
href="http://www.wired.com/magazine/2009/10/ff_waronscience/#comments">An Epidemic of Fear: How Panicked Parents Skipping Shots Endangers Us</a>&#8221; at Wired.com that actually is a pretty weak article; but provides a great source of information (and some amazingly incoherent rants) in the comments. I completely disagree with the article and think it looks like a pretty naive puff-piece for pro-vaccine folks (<a
href="http://en.wikipedia.org/wiki/Fear,_uncertainty_and_doubt">FUD</a>), but what do I know?</p><p>Pretty good reading, if you are into the topic of vaccination.</p><p>My favorite comment is this one (Posted by: LizP | 10/23/09 | 10:59 am), which pretty much sums up my opinion on the matter:</p><blockquote><p>Ignorance abounds…There is NO way to know from whence your illness arises &#8211; people are contageous LONG before they exhibit symptoms of disease! People all around you, who appear entirely healthy (including individuals who have been fully vaccinated), are shedding bacteria and virus’ with every cough, sneeze, and spittle-drenched “p.” WAKE UP! There are not enough vaccines in the world to prevent you from getting sick. What prevents you from getting sick from your exposure to all of the “bugs” is your intact immune system, good health derived from unpolluted whole foods, pure water, ample rest, and regular exercise, practicing hand-washing excellence, avoiding close contact with obviously ill people, and keeping your hands off of your face and out of your ears! Just because you choose to down Big Gulps full of corn syrup, devour food-like processed and “enriched” products, and couch-camp, rather than avail yourself of good health practices, don’t expect me pollute my body to possibly lessen YOUR risk; your lousy health outcomes, regarding virus’ and bacteria will be a direct result of your own conscious decisions. Further, for those of you who feel opting-out of some or all vaccines should disqualify families from receiving medical care and health insurance — think very carefully, it is our healthy families, paying into the insurance pool and NOT USING regular medical care, who are carrying the burden of your pharmaceutical lifestyle on our backs. Without us, the risk-pool is far deeper and your costs will sky-rocket! If we were not paying outrageous premiums, for insurance which we don’t use, we would have plenty of cash to pay out-of-pocket for emergency care, in the event of an accident.</p></blockquote><p>Note to site owner: Please turn on some sort of formatting capabilities in your comments &#8211; these huge jumbles of copy are tough to read and make all the responses look a bit hastily written.</p><p>So what&#8217;s your take? Is there a logical, reasoned angle that everyone will hopefully find, one way or the other? Or are there too many competing interests that don&#8217;t have our well-being as their top priority to allow that to happen?</p> <div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Mitchitized?a=fcSw7MwdqOQ:H4pH9GBS3E8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Mitchitized?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Mitchitized?a=fcSw7MwdqOQ:H4pH9GBS3E8:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Mitchitized?i=fcSw7MwdqOQ:H4pH9GBS3E8:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Mitchitized?a=fcSw7MwdqOQ:H4pH9GBS3E8:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Mitchitized?i=fcSw7MwdqOQ:H4pH9GBS3E8:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Mitchitized?a=fcSw7MwdqOQ:H4pH9GBS3E8:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/Mitchitized?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Mitchitized/~4/fcSw7MwdqOQ" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://www.mitchitized.com/random-blather/and-the-vaccination-debate-heats-up-some-more/feed/</wfw:commentRss> <slash:comments>13</slash:comments> <feedburner:origLink>http://www.mitchitized.com/random-blather/and-the-vaccination-debate-heats-up-some-more/</feedburner:origLink></item> <item><title>Here’s some presentation decks</title><link>http://feedproxy.google.com/~r/Mitchitized/~3/E-zzo6zWfNQ/</link> <comments>http://www.mitchitized.com/random-blather/heres-some-presentation-decks/#comments</comments> <pubDate>Thu, 22 Oct 2009 01:45:32 +0000</pubDate> <dc:creator>mitchy</dc:creator> <category><![CDATA[Random blather]]></category> <category><![CDATA[presentation]]></category> <category><![CDATA[slideshare]]></category> <category><![CDATA[widget]]></category><guid isPermaLink="false">http://www.mitchitized.com/?p=78</guid> <description><![CDATA[This is the slideshare player widget with my presentations as a playlist.]]></description> <content:encoded><![CDATA[<p>This is the stock slideshare widget that they provide, which pulls my presentations and presents a sort of playlist where you can select which of my decks you want to view.</p><p>Nice idea, going to plop it here just for giggles.</p><div
style="width: 577px; margin: auto;"><object
style="margin:0px" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="575" height="410" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param
name="allowFullScreen" value="true" /><param
name="allowScriptAccess" value="always" /><param
name="src" value="http://static.slidesharecdn.com/swf/multiwidget.swf" /><param
name="flashvars" value="feedurl=user/spacemonkeylabs&amp;widgettitle=My%20Presentation%20Decks" /><param
name="allowfullscreen" value="true" /><embed
style="margin:0px" type="application/x-shockwave-flash" width="575" height="410" src="http://static.slidesharecdn.com/swf/multiwidget.swf" flashvars="feedurl=user/spacemonkeylabs&amp;widgettitle=My%20Presentation%20Decks" allowscriptaccess="always" allowfullscreen="true"></embed></object></p><div
style="font-size: 11px; font-family: tahoma,arial; height: 26px; padding-top: 2px; text-align: left;"><a
title="SlideShare" href="http://www.slideshare.net/?src=multiwidget"><img
style="border:0px none;margin-bottom:-5px" src="http://static.slidesharecdn.com/swf/logo_embd.png" alt="SlideShare" /></a> | <a
title="Get your SlideShare Playlist" href="http://www.slideshare.net/widgets/playlist">Get your SlideShare Playlist</a></div></div> <div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Mitchitized?a=E-zzo6zWfNQ:gqWWMKzd4po:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Mitchitized?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Mitchitized?a=E-zzo6zWfNQ:gqWWMKzd4po:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Mitchitized?i=E-zzo6zWfNQ:gqWWMKzd4po:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Mitchitized?a=E-zzo6zWfNQ:gqWWMKzd4po:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Mitchitized?i=E-zzo6zWfNQ:gqWWMKzd4po:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Mitchitized?a=E-zzo6zWfNQ:gqWWMKzd4po:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/Mitchitized?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Mitchitized/~4/E-zzo6zWfNQ" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://www.mitchitized.com/random-blather/heres-some-presentation-decks/feed/</wfw:commentRss> <slash:comments>3</slash:comments> <feedburner:origLink>http://www.mitchitized.com/random-blather/heres-some-presentation-decks/</feedburner:origLink></item> <item><title>Are you naive? Good.</title><link>http://feedproxy.google.com/~r/Mitchitized/~3/U67dM-UJ2RQ/</link> <comments>http://www.mitchitized.com/random-blather/are-you-naive-good/#comments</comments> <pubDate>Fri, 28 Aug 2009 02:20:36 +0000</pubDate> <dc:creator>mitchy</dc:creator> <category><![CDATA[Random blather]]></category> <category><![CDATA[naive]]></category><guid isPermaLink="false">http://www.mitchitized.com/?p=66</guid> <description><![CDATA[In an earlier conversation today, a friend and confidant said (somewhat in exasperation), &#8220;You are too smart to really be this naive. You&#8217;re deliberately being naive, aren&#8217;t you?&#8221; At the time I presumed it was a sort of chiding, backhanded compliment. After some thought, I&#8217;d like to challenge everyone else to give it a try. [...]]]></description> <content:encoded><![CDATA[<p>In an earlier conversation today, a friend and confidant said (somewhat in exasperation), &#8220;You are too smart to really be this naive. You&#8217;re deliberately being naive, aren&#8217;t you?&#8221; At the time I presumed it was a sort of chiding, backhanded compliment. After some thought, I&#8217;d like to challenge everyone else to give it a try. Go ahead. Be a total homer.<span
id="more-66"></span>If you take me seriously, and on this one occasion you should, you will see your world change in front of your eyes.</p><blockquote><p>Yes, I am naive, and expect to stay that way.</p></blockquote><p>I live in NYC, and I am surrounded by humanity&#8217;s worst trash and refuse. Despite that, I have always had a reputation of being direct, honest, and never playing games (besides soccer).</p><p>Try it, and you&#8217;ll be making the world a slightly better place. No lies, no games, no politics. You&#8217;ll be happier, and folks around you will notice.</p><p>Sign me up, baby! This ride is one I&#8217;ll never get sick of.</p><p>Otherwise you can go back to a life of sulking, scheming and disappointment. Sucks to be you. And people like this do affect my day, as I still have to find ways to insulate myself from, well, jerks. That skill however was honed years ago on the playground &#8211; and so I put that long-lost knowledge to good practice.</p><p>And you should too. Go ahead, when you see someone do something that you think is awesome, don&#8217;t be <em>too cool for school</em> &#8211; walk up to them and tell them straight up that they just rocked in a special way. As you sit there on the subway, and you see someone playing with a new doodad that fascinates you, ask them how they like it, and why they got it in the first place. See someone in line at the register, and they are $0.45 short? Come on, man, lighten up your pockets and get that pesky metal out on the counter! Every three or four blocks or so, randomly high-five someone as they walk by.</p><p>Ok, this is not really <em>naive</em> in a strict sense, but these things are things you will start to do naturally when you practice deliberate naivete.</p> <div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Mitchitized?a=U67dM-UJ2RQ:u5loQHjKImg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Mitchitized?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Mitchitized?a=U67dM-UJ2RQ:u5loQHjKImg:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Mitchitized?i=U67dM-UJ2RQ:u5loQHjKImg:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Mitchitized?a=U67dM-UJ2RQ:u5loQHjKImg:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Mitchitized?i=U67dM-UJ2RQ:u5loQHjKImg:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Mitchitized?a=U67dM-UJ2RQ:u5loQHjKImg:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/Mitchitized?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Mitchitized/~4/U67dM-UJ2RQ" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://www.mitchitized.com/random-blather/are-you-naive-good/feed/</wfw:commentRss> <slash:comments>2</slash:comments> <feedburner:origLink>http://www.mitchitized.com/random-blather/are-you-naive-good/</feedburner:origLink></item> <item><title>PHP Frameworks Explained</title><link>http://feedproxy.google.com/~r/Mitchitized/~3/FHsiSDP_jmc/</link> <comments>http://www.mitchitized.com/nerdy-stuff/php-frameworks-explained/#comments</comments> <pubDate>Wed, 26 Aug 2009 03:36:52 +0000</pubDate> <dc:creator>mitchy</dc:creator> <category><![CDATA[Nerdy stuff]]></category> <category><![CDATA[cakephp]]></category> <category><![CDATA[code igniter]]></category> <category><![CDATA[drupal]]></category> <category><![CDATA[framework]]></category> <category><![CDATA[joomla]]></category> <category><![CDATA[kohanaphp]]></category> <category><![CDATA[php]]></category> <category><![CDATA[symfony]]></category> <category><![CDATA[zend]]></category><guid isPermaLink="false">http://www.mitchitized.com/?p=56</guid> <description><![CDATA[So there&#8217;s all this hubbub about PHP frameworks, and heated debate over which one is the one true framework to rule them all. And you wondered, &#8220;So what is all the fuss about, is there really one framework that solves all of my problems?&#8221; I&#8217;m not an author of any particular framework, nor do I [...]]]></description> <content:encoded><![CDATA[<p>So there&#8217;s all this hubbub about PHP frameworks, and heated debate over which one is <em>the one true framework to rule them all</em>. And you wondered, &#8220;<em>So what is all the fuss about, is there really one framework that solves all of my problems?</em>&#8221; I&#8217;m not an author of any particular framework, nor do I portray one on television. Let me take an unbiased swing at what I see as the lay of the land regarding frameworks and our favorite little programming language, PHP.</p><p><span
id="more-56"></span></p><p>Frameworks were created by developers, for developers &#8211; with the main intent to streamine the effort needed to create features and functions that were common across the vast majority of websites that they developed in their day to day work. Login, database access, caching, templating, session management, filtering of user input, the list goes on and on. However there are different approaches to how a framework can be used to your advantage, and the difference can be sometimes subtle.</p><p>NOTE: I&#8217;ve found another <a
title="Wikipedia entry, and a good one at that" href="http://en.wikipedia.org/wiki/Web_application_framework">good reference on web frameworks</a>, with a different view.</p><p>Now what was I saying? There are really two main kinds of frameworks: stack and glue.</p><h2>Stack &#8216;em up, bartender</h2><p>The concept of stack frameworks &#8211; sometimes referred to as scaffolding frameworks &#8211; is to generate the majority of the base code needed to produce a full-featured environment for the developer to be as productive as possible. The concept is to provide the full stack, with deep integration and workflow suited specifically to benefit the needs of the developer.</p><p>On the one hand, stack frameworks can be wicked fast for prototyping, and you can also take advantage of the stack to quickly add additional features to an existing application. As well, many developers appreciate the completeness of the stack approach as upgrades are easy to perform, and are usually done as one atomic operation.</p><p>On the other hand, stack frameworks are also referred to as <em>opinionated software</em>, meaning the framework has a strong opinion about how things are to be done; and if you have a different opinion then you&#8217;re not going to get along very well. It is commonly said &#8211; and commonly debated &#8211; that stack frameworks are more vulnerable to performance and scale issues as they attempt to do too much for too many&#8230; And ultimately fail to meet the needs of everyone to great satisfaction.</p><p>Notable stack frameworks are <a
title="Yeah I know, not PHP but worth mention" href="http://rubyonrails.org/">Ruby on Rails</a> (the real pioneer in this regard), <a
title="One of my faves 'cause Nate is the shiznit" href="http://cakephp.org/">CakePHP</a>, and <a
title="The second most misspelled PHP project in the universe" href="http://www.symfony-project.org/">Symfony</a>.</p><h2>Sniffing glue</h2><p>Glue frameworks are for the do-it-yourselfer &#8211; you glue together the parts specifically required by your application, and nothing more. This takes a much more hands-on approach for the developer, and usually means prototyping is not as insanely fast as a stack framework, however prototyping is still very rapid. Most importantly the performance and scaling of glue framework applications usually can be mitigated by extending an existing part of the framework, or replacing it altogether. For this reason a lot of developers prefer glue frameworks, having lived through painful customization efforts on less flexible platforms. Glue frameworks are usually very modular in nature, and that provides the additional benefit of having a large array of additional add-ons that developers can take advantage of.</p><p>The main drawback for glue frameworks is that they do require more effort from the developer. If you are light on development resources, or are more worried about the ongoing maintenance of your application once it is up and running, then this can be of significance.</p><p>Notable glue frameworks are <a
title="Go Matthew, go!" href="http://framework.zend.com/">Zend</a>, <a
title="It's a CMS! No, it's a framework! No, uh, er, um..." href="http://api.joomla.org/li_Joomla-Framework.html">Joomla! 1.5</a>, <a
title="PHP code that smokes!" href="http://codeigniter.com/">Code Igniter</a>, and <a
title="Modern, simple, powerful." href="http://kohanaphp.com/">KohanaPHP</a> (my current favorite).</p><h2>But wait, there&#8217;s more</h2><p>&#8220;<em>Joomla! 1.5 is a CMS</em>&#8220;, you say. Technically you&#8217;re right. However Joomla! 1.5 is actually two Joomla!&#8217;s &#8211; the framework, and the CMS. Speaking of <a
title="Nice entry at Wikipedia on CMS" href="http://en.wikipedia.org/wiki/Content_management_system">CMS</a>, we must include both <a
title="Clickie to go to the main sitie" href="http://www.joomla.org/">Joomla!</a> and <a
title="Fast growing competitor with enthusiastic supporters" href="http://drupal.org/">Drupal</a> here, as IMHO they provide an even bigger benefit to the client &#8211; software longevity and maintenance.</p><p>As a developer, you usually don&#8217;t worry about what happens after launch. For the folks that live and die by this application however, that is of paramount importance. For them, they need to know that their investment is protected from <em>bit rot</em>, or the slow decay of unmaintained software. What exactly does a CMS like Joomla! or Drupal do in this regard?</p><p>First, they provide a base platform that in essence is a finished and complete starting point for your application platform. That means you are able to run a basic website out of the box, with minimal or no modification. Additionally, each also boast a rich array of third party goodies that can be added for instant gratification &#8211; forums, integration with social media services, photo galleries, you name it.</p><p>If you are diligent about your development practices, you should also be packaging up your software as an extension to these environments. This provides the additional benefit of reuse, so software you write once might find a second life for another website or application purpose.</p><p>Finally, these are complete environments that are maintained by a group of folks dedicated to furthering that software project. This is <em>living software</em>, or software that takes on a life of its own as a variety of different people contribute to the evolution and maintenance of that software. By basing your website on one of these platforms, your client can take advantage of every update and enhancement this community produces for that software project.</p><p>There are a great many frameworks out there that are not covered, and that is merely because I cannot keep track of all of them. What other PHP frameworks deserve mention? Did I miss one that really deserves mad props?</p> <div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Mitchitized?a=FHsiSDP_jmc:T0x4TdXN1Qs:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Mitchitized?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Mitchitized?a=FHsiSDP_jmc:T0x4TdXN1Qs:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Mitchitized?i=FHsiSDP_jmc:T0x4TdXN1Qs:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Mitchitized?a=FHsiSDP_jmc:T0x4TdXN1Qs:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Mitchitized?i=FHsiSDP_jmc:T0x4TdXN1Qs:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Mitchitized?a=FHsiSDP_jmc:T0x4TdXN1Qs:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/Mitchitized?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Mitchitized/~4/FHsiSDP_jmc" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://www.mitchitized.com/nerdy-stuff/php-frameworks-explained/feed/</wfw:commentRss> <slash:comments>5</slash:comments> <feedburner:origLink>http://www.mitchitized.com/nerdy-stuff/php-frameworks-explained/</feedburner:origLink></item> <item><title>Cat runs over car</title><link>http://feedproxy.google.com/~r/Mitchitized/~3/F0-bkv3LtnY/</link> <comments>http://www.mitchitized.com/random-blather/cat-runs-over-car/#comments</comments> <pubDate>Wed, 19 Aug 2009 14:47:08 +0000</pubDate> <dc:creator>mitchy</dc:creator> <category><![CDATA[Random blather]]></category> <category><![CDATA[car]]></category> <category><![CDATA[cat]]></category> <category><![CDATA[humor]]></category><guid isPermaLink="false">http://www.mitchitized.com/random-blather/cat-runs-over-car/</guid> <description><![CDATA[Really just testing the iPhone app for wordpress. Can I add a picture? Let&#8217;s find out:]]></description> <content:encoded><![CDATA[<p>Really just testing the iPhone app for wordpress. Can I add a picture? Let&#8217;s find out:</p><p><a
href="http://www.mitchitized.com/wp-content/uploads/2009/08/l_1600_1200_53F88A0F-1139-4525-855D-D1D2D40C06A3.jpeg"><img
src="http://www.mitchitized.com/wp-content/uploads/2009/08/l_1600_1200_53F88A0F-1139-4525-855D-D1D2D40C06A3.jpeg" alt="" width="300" height="225" class="alignnone size-full wp-image-364" /></a></p> <div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Mitchitized?a=F0-bkv3LtnY:F28xhzhQ4lo:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Mitchitized?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Mitchitized?a=F0-bkv3LtnY:F28xhzhQ4lo:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Mitchitized?i=F0-bkv3LtnY:F28xhzhQ4lo:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Mitchitized?a=F0-bkv3LtnY:F28xhzhQ4lo:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Mitchitized?i=F0-bkv3LtnY:F28xhzhQ4lo:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Mitchitized?a=F0-bkv3LtnY:F28xhzhQ4lo:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/Mitchitized?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Mitchitized/~4/F0-bkv3LtnY" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://www.mitchitized.com/random-blather/cat-runs-over-car/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <feedburner:origLink>http://www.mitchitized.com/random-blather/cat-runs-over-car/</feedburner:origLink></item> <item><title>Goodbye, auto increment</title><link>http://feedproxy.google.com/~r/Mitchitized/~3/gl6ZphfcAdk/</link> <comments>http://www.mitchitized.com/nerdy-stuff/goodbye-auto-increment/#comments</comments> <pubDate>Thu, 13 Aug 2009 19:28:19 +0000</pubDate> <dc:creator>mitchy</dc:creator> <category><![CDATA[Nerdy stuff]]></category> <category><![CDATA[database]]></category> <category><![CDATA[mysql]]></category><guid isPermaLink="false">http://www.mitchitized.com/?p=44</guid> <description><![CDATA[You are going to see a lot more writing about non-relational databases from me in the near future, and I thought I&#8217;d start making the transition with a little ditty about auto increment columns in MySQL.
In short, they are bad. Not bad like mixing parachute pants with knitted sweaters, but bad like trying to eat [...]]]></description> <content:encoded><![CDATA[<p>You are going to see a lot more writing about non-relational databases from me in the near future, and I thought I&#8217;d start making the transition with a little ditty about auto increment columns in MySQL.</p><p>In short, they are bad. Not bad like mixing parachute pants with knitted sweaters, but bad like trying to eat a Volvo because you are hungry.</p><p>Auto increment, how much do I hate thee? Let me count the ways:</p><ol><li>Firstly they encourage lousy design. If you are going to use a relational database, you need to bother yourself with learning  basic relational theory.</li><li>They blow a hole in the push for a more semantic web. They are just numbers, and have no meaning.</li><li>They make sharding really really hard. Hope that site of yours never gets very successful.</li></ol><p>Put more bluntly, right now the only databases that use auto increment are MySQL and Microsoft Access. Yes, there is a reason, and it ain&#8217;t a good one.<span
id="more-44"></span></p><p>First lets cover the &#8216;lousy design&#8217; angle.</p><h2>Don&#8217;t forget your keys, honey.</h2><p>When you are building a table, you need a primary key.</p><p>(You&#8217;re still with me, right? Good.)</p><p>Now this key needs to be unique for every row. Maybe there is a user table in your website, and there is a column called username.</p><p><code><br
/> +----------+---------------------+<br
/> | id       | username                  |<br
/> +----------+---------------------+<br
/> |       62 | admin                     |<br
/> |       63 | amy                       |<br
/> |       64 | charlie                   |<br
/> |       65 | hasselhoff                |<br
/> |       66 | dracula                   |<br
/> |       68 | caroline                  |<br
/> |       69 | peter                     |<br
/> +----------+---------------------+<br
/> </code></p><p>That&#8217;s unique, right? Then why are you leveraging a number that has absolutely no meaning? In the good ol&#8217; days when I had to walk to school 20 miles each way in the ice and snow naked. disk space was expensive and RAM was even worse. Then this kind of approach would have ben appreciated as a cost cutting move. Nowadays? Fuhgeddaboudit.</p><p><strong>If you are building a relational database, you need to know what a relational database is in the first place.</strong> There are tons of free resources out there to help you along. Trust me, knowing how to take advantage of a relational database and actually using one is akin to getting a drivers license and actually driving. Otherwise, you&#8217;ll make no friends plowing into someone&#8217;s living room with their car.</p><p>The worst part about this approach is now whenever you insert a record into that table, you gotta make a second call to find out what the id was. Pretty sure it would be a lot more efficient to know when you inserted the row what the primary key was, now don&#8217;t you think?</p><h2>Say what you mean.</h2><p>Using the above example, when I am referring to a user on your website I am not going to say &#8220;<em>hey man, did you help out user #41432995?</em>&#8221; I&#8217;m going to ask you about the user &#8220;<em>funkychicken</em>&#8221; or &#8220;<em>the dude with the MIT email address</em>.&#8221; (For the record, anyone from MIT referring to themselves as <em>funkychicken</em> is okay in my book, &#8217;s all good with me.)</p><p>If you refer to a particular record by a column in that table, most likely that is your natural primary key. Why ignore that for an artificial one?</p><h2>Slicing and dicing, gone horribly wrong.</h2><p>When you start dealing with websites that got too big for their britches, the first point of major pain is almost always the database. Relational databases can be scaled, but it is hard, and can only go so far. Most big websites in this situation can either migrate to a different platform (more on that in subsequent posts) or chop their data into smaller chunks so it is easier to manage. This practice is called <a
title="Clickie-wickie to learnie-wearnie" href="http://en.wikipedia.org/wiki/Sharding">sharding</a>.</p><p>With that out of the way, sharding is really really hard when all of your information is linked with arbitrary numbers with no meaning. Sharding approaches are unique for every shop and website, so instead of making a passionate argument here, I&#8217;m going to leave you to your own devices. Try it yourself, and within a couple hours you will be nodding in complete understanding (and agreement).</p><h2>There&#8217;s always somebody who refuses to fit in.</h2><p>That&#8217;s right, there are plenty of scenarios where auto increment is doing you a favor. It was actually meant to do that favor for you. They just never envisioned an entire database schema littered with nothing but random numbers as primary keys.</p><p>Comments, for example. I&#8217;ve seen databases where articles go in one table, and comments go in another. The comments are not necessarily unique, maybe except for the timestamp and email of the person making the comment. Instead of making a composite key and additional index overhead, auto increment makes sense here. Besides, you are always going to be fetching based on the article_id or some such, right?</p><h2>But wait, it&#8217;s just not that easy.</h2><p><em>&#8220;Your users example is no good for me though, as I have multiple records with the same username (one is an old disabled account, or whatever). This doesn&#8217;t make sense to have a composite key of username and statu</em><em>s!&#8221;</em></p><p>You&#8217;re absolutely right. And that&#8217;s why I think you should consider a different datamodel. This one maybe makes sense if you are auto increment happy, and I&#8217;d say over-reliance on auto increment is what got you into this jam in the first place.</p><p>Try it &#8211; design a database from scratch, with absolutely zero auto increment columns. It is a good exercise, and I promise that even if the resulting database is worthless, you will have learned a few things.</p><p>Next up I&#8217;m going to talk about a couple different approaches that are leaving the realm of tomorrowland and starting to percolate in today&#8217;s consciousness.</p> <div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Mitchitized?a=gl6ZphfcAdk:Y3K6_6RTViU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Mitchitized?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Mitchitized?a=gl6ZphfcAdk:Y3K6_6RTViU:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Mitchitized?i=gl6ZphfcAdk:Y3K6_6RTViU:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Mitchitized?a=gl6ZphfcAdk:Y3K6_6RTViU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Mitchitized?i=gl6ZphfcAdk:Y3K6_6RTViU:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Mitchitized?a=gl6ZphfcAdk:Y3K6_6RTViU:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/Mitchitized?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Mitchitized/~4/gl6ZphfcAdk" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://www.mitchitized.com/nerdy-stuff/goodbye-auto-increment/feed/</wfw:commentRss> <slash:comments>3</slash:comments> <feedburner:origLink>http://www.mitchitized.com/nerdy-stuff/goodbye-auto-increment/</feedburner:origLink></item> <item><title>JTable and primary keys</title><link>http://feedproxy.google.com/~r/Mitchitized/~3/vveSF1pxm0w/</link> <comments>http://www.mitchitized.com/nerdy-stuff/jtable-and-primary-keys/#comments</comments> <pubDate>Sun, 19 Jul 2009 17:15:42 +0000</pubDate> <dc:creator>mitchy</dc:creator> <category><![CDATA[Nerdy stuff]]></category> <category><![CDATA[database]]></category> <category><![CDATA[joomla]]></category> <category><![CDATA[jtable]]></category> <category><![CDATA[juser]]></category><guid isPermaLink="false">http://www.mitchitized.com/?p=18</guid> <description><![CDATA[While integrating Joomla with a remote user source, I learned that JTable won't let you touch id columns (or the primary key, more specifically). I had to do some workarounds and this is my shameful story.]]></description> <content:encoded><![CDATA[<p>Been working like a maniac recently integrating a <a
href="http://www.joomla.org/">Joomla</a> 1.5 powered website with a remote user source via RESTful interface. <a
href="http://en.wikipedia.org/wiki/REST">REST</a> is a great thing, and makes it dead simple to scale and shard your applications at the network level. However Joomla has an attitude about primary keys, or more specifically <a
href="http://api.joomla.org/Joomla-Framework/Table/JTable.html">JTable</a>. So when it came time for me to stuff user ids from this remote REST source, JTable said &#8220;no way, amigo.&#8221;</p><p>JTable, in this specific instance, won&#8217;t let you change the values in the jos_users.id column. Unfortunately that was exactly what I needed to do. In the end, I had to hotrod my authentication plugin to check to see if the jos_users.id was the same as the id coming over from the REST calls &#8211; and if not, manually update jos_users and jos_acl_aro_map.<span
id="more-18"></span></p><p>I created an authentication plugin that consumes the REST service. In the <a
href="http://docs.joomla.org/Reference:User_Events_for_Plugin_System#5.3.4_onAuthenticate">onAuthenticate</a> method I take the results of the REST call and stuff them in the session thusly:</p><div
class="dean_ch" style="white-space: wrap;"><ol><li
class="li1"><div
class="de1"><span
class="re0">$session</span> =&amp;amp; JFactory::<span
class="me2">getSession</span><span
class="br0">&#40;</span><span
class="br0">&#41;</span>;</div></li><li
class="li1"><div
class="de1"><span
class="re0">$session</span>-&gt;<span
class="me1">set</span><span
class="br0">&#40;</span><span
class="st0">&quot;user&quot;</span>,<span
class="re0">$response</span>,<span
class="st0">&#8216;mynamespace&#8217;</span><span
class="br0">&#41;</span>;</div></li></ol></div><p>For the user plugin, I created an <a
href="http://docs.joomla.org/Reference:User_Events_for_Plugin_System#5.3.7_onAfterStoreUser">onAfterStoreUser</a> method that takes the values stuffed in the session above, and compares them to the existing JUser object properties. Right now all I am really looking for is the jos_users.id as that is what I cannot take care of with the stock facilities provided by Joomla. The method looks strikingly like this:</p><div
class="dean_ch" style="white-space: wrap;"><ol><li
class="li1"><div
class="de1"><span
class="kw2">function</span> onAfterStoreUser<span
class="br0">&#40;</span><span
class="re0">$user</span>, <span
class="re0">$isnew</span>, <span
class="re0">$success</span>, <span
class="re0">$msg</span><span
class="br0">&#41;</span></div></li><li
class="li1"><div
class="de1"><span
class="br0">&#123;</span></div></li><li
class="li1"><div
class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <a
href="http://www.php.net/global"><span
class="kw3">global</span></a> <span
class="re0">$mainframe</span>;</div></li><li
class="li1"><div
class="de1">&nbsp;</div></li><li
class="li2"><div
class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span
class="co1">// Get the correct user_id out of REST session object</span></div></li><li
class="li1"><div
class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span
class="re0">$session</span> =&amp;amp; JFactory::<span
class="me2">getSession</span><span
class="br0">&#40;</span><span
class="br0">&#41;</span>;</div></li><li
class="li1"><div
class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span
class="re0">$object</span> = <span
class="re0">$session</span>-&gt;<span
class="me1">get</span><span
class="br0">&#40;</span><span
class="st0">&quot;user&quot;</span>,<span
class="st0">&#8216;empty object&#8217;</span>,<span
class="st0">&#8216;mynamespace&#8217;</span><span
class="br0">&#41;</span>;</div></li><li
class="li1"><div
class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span
class="re0">$gid</span> = <span
class="re0">$object</span>-&gt;<span
class="me1">id</span>;</div></li><li
class="li1"><div
class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span
class="kw1">if</span><span
class="br0">&#40;</span><span
class="re0">$gid</span> != <span
class="re0">$user</span><span
class="br0">&#91;</span><span
class="st0">&#8216;id&#8217;</span><span
class="br0">&#93;</span><span
class="br0">&#41;</span></div></li><li
class="li2"><div
class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span
class="br0">&#123;</span></div></li><li
class="li1"><div
class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span
class="co1">// Now fix Joomla&#8217;s broken IDs in jos_users</span></div></li><li
class="li1"><div
class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span
class="re0">$db</span> =&amp;amp; JFactory::<span
class="me2">getDBO</span><span
class="br0">&#40;</span><span
class="br0">&#41;</span>;</div></li><li
class="li1"><div
class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span
class="re0">$sql</span> = <span
class="st0">&#8216;UPDATE #__users SET id = &#8216;</span> . <span
class="re0">$gid</span> . <span
class="st0">&#8216; WHERE id = &#8216;</span> . <span
class="re0">$user</span><span
class="br0">&#91;</span><span
class="st0">&#8216;id&#8217;</span><span
class="br0">&#93;</span>;</div></li><li
class="li1"><div
class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span
class="re0">$session</span>-&gt;<span
class="me1">set</span><span
class="br0">&#40;</span><span
class="st0">&#8216;auth_plugin_sql&#8217;</span>, <span
class="re0">$sql</span><span
class="br0">&#41;</span>;</div></li><li
class="li2"><div
class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span
class="re0">$db</span>-&gt;<span
class="me1">setQuery</span><span
class="br0">&#40;</span><span
class="re0">$sql</span><span
class="br0">&#41;</span>;</div></li><li
class="li1"><div
class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span
class="re0">$result</span> = <span
class="re0">$db</span>-&gt;<span
class="me1">query</span><span
class="br0">&#40;</span><span
class="br0">&#41;</span>;</div></li><li
class="li1"><div
class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span
class="co1">// Now update the ACL mapping for this user as the id is different</span></div></li><li
class="li1"><div
class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span
class="re0">$sql_acl</span> = <span
class="st0">&#8216;UPDATE #__core_acl_aro SET value = &#8216;</span> . <span
class="re0">$gid</span> . <span
class="st0">&#8216; WHERE value = &#8216;</span> . <span
class="re0">$user</span><span
class="br0">&#91;</span><span
class="st0">&#8216;id&#8217;</span><span
class="br0">&#93;</span>;</div></li><li
class="li1"><div
class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span
class="re0">$db</span>-&gt;<span
class="me1">setQuery</span><span
class="br0">&#40;</span><span
class="re0">$sql_acl</span><span
class="br0">&#41;</span>;</div></li><li
class="li2"><div
class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span
class="re0">$result_acl</span> = <span
class="re0">$db</span>-&gt;<span
class="me1">query</span><span
class="br0">&#40;</span><span
class="br0">&#41;</span>;</div></li><li
class="li1"><div
class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span
class="br0">&#125;</span></div></li><li
class="li1"><div
class="de1"><span
class="br0">&#125;</span></div></li></ol></div><p>Now you have a system that fetches user data from a RESTful service, and populates the Joomla tables to make JUser happy.</p><p>Look ma, no core hacks!</p><p>One ugly &#8216;feature&#8217; of this system is that on the first login, the user finds themselves in a state where they attempt to authenticate with one id and it gets updated. Since I have no way to tell JUser to reload itself, you have this strange experience of logging in twice and then everything is golden.</p><p>Interested in hearing how others have dealt with this problem.</p> <div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Mitchitized?a=vveSF1pxm0w:PAu-uKXwlMM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Mitchitized?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Mitchitized?a=vveSF1pxm0w:PAu-uKXwlMM:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Mitchitized?i=vveSF1pxm0w:PAu-uKXwlMM:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Mitchitized?a=vveSF1pxm0w:PAu-uKXwlMM:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Mitchitized?i=vveSF1pxm0w:PAu-uKXwlMM:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Mitchitized?a=vveSF1pxm0w:PAu-uKXwlMM:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/Mitchitized?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Mitchitized/~4/vveSF1pxm0w" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://www.mitchitized.com/nerdy-stuff/jtable-and-primary-keys/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <feedburner:origLink>http://www.mitchitized.com/nerdy-stuff/jtable-and-primary-keys/</feedburner:origLink></item> </channel> </rss><!-- This site's performance optimized by W3 Total Cache. Dramatically improve the speed and reliability of your blog!

Learn more about our WordPress Plugins: http://www.w3-edge.com/wordpress-plugins/

Minified using memcached
Page Caching using memcached
Database Caching using memcached

Served from: mitchitized.com @ 2010-01-23 17:14:26 -->
