<?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>Always Get Better</title>
	
	<link>http://www.alwaysgetbetter.com/blog</link>
	<description>Never stop looking for ways to improve</description>
	<lastBuildDate>Mon, 27 May 2013 10:00:42 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/AlwaysGetBetter" /><feedburner:info uri="alwaysgetbetter" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Tweeting with Buffer</title>
		<link>http://feedproxy.google.com/~r/AlwaysGetBetter/~3/JNNHKC8LA4Y/</link>
		<comments>http://www.alwaysgetbetter.com/blog/2013/05/27/tweeting-buffer/#comments</comments>
		<pubDate>Mon, 27 May 2013 10:00:42 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[internet]]></category>
		<category><![CDATA[social media]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.alwaysgetbetter.com/blog/?p=535</guid>
		<description><![CDATA[I continue to have an on and off relationship with Twitter. It&#8217;s been fun to talk with other developers and reach people directly, but a huge part of the network is sorting through the signal-to-noise echo chamber. It doesn&#8217;t make sense to sit on Twitter all day trying to respond to everything; work needs to [...]<div class='yarpp-related-rss yarpp-related-none'>

No related posts.
</div>
]]></description>
				<content:encoded><![CDATA[<p><a href="http://c500335.r35.cf2.rackcdn.com/blog/wp-content/uploads/2013/05/glen_canyon_bridge__dam_page_arizona.jpg"><img src="http://c500335.r35.cf2.rackcdn.com/blog/wp-content/uploads/2013/05/glen_canyon_bridge__dam_page_arizona.jpg" alt="Glen Canyon Bridge &amp; Dam, Page, Arizona" width="1024" height="656" class="alignright size-full wp-image-537" /></a>I continue to have an on and off relationship with Twitter. It&#8217;s been fun to talk with other developers and reach people directly, but a huge part of the network is sorting through the signal-to-noise echo chamber. It doesn&#8217;t make sense to sit on Twitter all day trying to respond to everything; work needs to be done too!</p>
<p>Then there&#8217;s my reading. I read a lot. And I run into all kinds of cool stuff I want to share, and Twitter is the most natural place to share it, but of course that always ends up with Saturdays where I dump four dozen links in the span of a few hours&#8230; I hate it when other people do that, so rather than spamming everyone who follows me I&#8217;ve pretty much stopped sharing.</p>
<p>Until now.</p>
<p><strong>Buffer to Spread Around the Outbursts</strong><br />
I found an app called Buffer (<a href="http://bufferapp.com" rel="nofollow">bufferapp.com</a>) that sits in front of your twitter account and collects your tweets into a &#8220;buffer&#8221;, then sends them out on a schedule. So you can have a backlog of messages filter out slowly over a day instead of shoving them all out at once.</p>
<p>So my workflow with Twitter now is to monitor it (using Growl, of course) and have conversations where I can. I&#8217;ve met some incredible people using Twitter and made more than a few fun connections, and hope to keep building that over time. Whenever I read something interesting I&#8217;ll drop it into Buffer, and anyone who is interested can see those links without getting spammed all at once. I think it&#8217;s win-win.</p>
<p><strong>Present in More Time Zones</strong><br />
At first night times were lonely when I came out west, since 9pm for me is midnight for friends back home, it got pretty quiet fast. I&#8217;ve since made more friends on the west coast, but I came away with a fresh appreciation of how easy it is to get disconnected from our core tribes because of time zones.</p>
<p>Since I started using Buffer I&#8217;ve noticed more activity from my contacts in Europe and Australia. Of course I&#8217;m asleep when Buffer sends out one of my stored tweets at 3am, but sometimes it&#8217;s sparked conversations I&#8217;m able to pick up when I wake up in the morning. Although there is a high latency in those communications, I feel more connected than ever to some old friends who I might not have otherwise interacted with so frequently.</p>
<p><strong>In the End, Connections Matter Most</strong><br />
The strongest takeaway theme that seems to be cropping up again and again lately has been the difference between technology and communication. It&#8217;s very easy, especially coming from a technical background, to fall in love with a design, a language, a piece of software. The magic comes from the conversations that get enabled by these advances. There&#8217;s no reason to put up a web site or build an application if it doesn&#8217;t solve some problem &#8211; if we build something for the sake of doing it, are we building something that will last?</p>

						<div id="pdrp_endAttribution">
						photo by: 
						 
							<a href="http://flickr.com/80651083@N00/2101168562" target="_blank" class="pdrp_link pdrp_attributionLink">
								Thad Roan - Bridgepix</a>
						</div>
					<div style="width:468px;margin:0 auto">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-0410364841759590";
/* Homepage, 468x60 ads, After posts, created 12/19/08 */
google_ad_slot = "4210204644";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div><div class='yarpp-related-rss yarpp-related-none'>
<p>No related posts.</p>
</div>
<img src="http://feeds.feedburner.com/~r/AlwaysGetBetter/~4/JNNHKC8LA4Y" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.alwaysgetbetter.com/blog/2013/05/27/tweeting-buffer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.alwaysgetbetter.com/blog/2013/05/27/tweeting-buffer/</feedburner:origLink></item>
		<item>
		<title>2012 in Review</title>
		<link>http://feedproxy.google.com/~r/AlwaysGetBetter/~3/wBaC6Lt9ldM/</link>
		<comments>http://www.alwaysgetbetter.com/blog/2013/01/01/2012-review/#comments</comments>
		<pubDate>Tue, 01 Jan 2013 18:27:52 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[General Programming]]></category>

		<guid isPermaLink="false">http://www.alwaysgetbetter.com/blog/?p=518</guid>
		<description><![CDATA[This has been one of my busiest and most productive years, but you wouldn&#8217;t know it from the infrequency of my blog updates. The majority of my writing time was spent creating two books on Node.js which were released this year &#8211; Node: Up and Running and Building Node Applications with MongoDB and Backbone. I&#8217;ll [...]<div class='yarpp-related-rss yarpp-related-none'>

No related posts.
</div>
]]></description>
				<content:encoded><![CDATA[<p>This has been one of my busiest and most productive years, but you wouldn&#8217;t know it from the infrequency of my blog updates.</p>
<p>The majority of my writing time was spent creating two books on Node.js which were released this year &#8211; <a href="http://shop.oreilly.com/product/0636920015956.do">Node: Up and Running</a> and <a href="http://shop.oreilly.com/product/0636920026587.do">Building Node Applications with MongoDB and Backbone</a>. I&#8217;ll use that as my excuse for not updating here &#8211; I&#8217;m not planning to take on any major projects like this in the near future because I want to get some of my &#8220;smaller&#8221; ideas accrued over the year out in article form.</p>
<p>Apart from writing, I pulled up roots and moved to the West Coast; it was an epic move since we have a larger than normal family, but the new environment and business opportunities have been well worth it. Now that we live on a mountain next to the ocean, I&#8217;m going to feel very reluctant to go anywhere else.</p>
<p>At the end of 2011 I predicted that mobile development would become a necessary tool for serious developers. It&#8217;s certainly been my bread and butter this year, and will likely be even more so in 2013. Desktop development will remain important, but I can see future world where the majority of &#8220;normal&#8221; customers will be consuming content on a tablet or handheld device. There is going to be a greater dichotomy between content creators (think &#8211; developers on laptops) versus content consumers &#8211; designing for mobile first will position you for that economy by keeping your focus on ease of use.</p>
<p>The top three posts this year were:</p>
<ol>
<li><a href="http://www.alwaysgetbetter.com/blog/2012/05/20/datetime-play-framework/">Using DateTime in the Play! Framework</a></li>
<li><a href="http://www.alwaysgetbetter.com/blog/2012/01/30/setting-wordpress-nginx-fastcgi/"> Setting up WordPress with nginx and FastCGI</a></li>
<li><a href="http://www.alwaysgetbetter.com/blog/2012/02/29/log4php-performance/"> log4php Performance</a></li>
</ol>
<div class='yarpp-related-rss yarpp-related-none'>
<p>No related posts.</p>
</div>
<img src="http://feeds.feedburner.com/~r/AlwaysGetBetter/~4/wBaC6Lt9ldM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.alwaysgetbetter.com/blog/2013/01/01/2012-review/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.alwaysgetbetter.com/blog/2013/01/01/2012-review/</feedburner:origLink></item>
		<item>
		<title>Observations From Mobile Development</title>
		<link>http://feedproxy.google.com/~r/AlwaysGetBetter/~3/NBCRP2bfsdc/</link>
		<comments>http://www.alwaysgetbetter.com/blog/2012/09/10/observations-mobile-development/#comments</comments>
		<pubDate>Mon, 10 Sep 2012 10:00:39 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[internet]]></category>
		<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">http://www.alwaysgetbetter.com/blog/?p=511</guid>
		<description><![CDATA[With just a single mobile release under my belt now, I&#8217;m hardly what you might call an expert on the subject. What I can say for certain is the past year has been an eye opener in terms of understanding the capabilities and limitations of mobile platforms in general. So having gone from &#8220;reading about&#8221; [...]<div class='yarpp-related-rss yarpp-related-none'>

No related posts.
</div>
]]></description>
				<content:encoded><![CDATA[<p><a href="http://c500335.r35.cf2.rackcdn.com/blog/wp-content/uploads/2012/09/google_nexus_android_mobile_unboxing.jpg"><img class="alignright  wp-image-513" title="google nexus android mobile unboxing" src="http://c500335.r35.cf2.rackcdn.com/blog/wp-content/uploads/2012/09/google_nexus_android_mobile_unboxing.jpg" alt="" width="307" height="230" /></a>With just a single mobile release under my belt now, I&#8217;m hardly what you might call an expert on the subject. What I can say for certain is the past year has been an eye opener in terms of understanding the capabilities and limitations of mobile platforms in general.</p>
<p>So having gone from &#8220;reading about&#8221; to &#8220;doing&#8221; mobile development, these are some of the &#8220;aha&#8221; moments I&#8217;ve had:</p>
<p><strong>Design for Mobile First</strong><br />
The biggest revelation: Even if you&#8217;re not setting out to develop a mobile application, your design <em>absolutely must</em> start from the point of view of a handheld.</p>
<p>Think about it for a second &#8211; how much information can you fit on a 3.5&#8243; screen? Not much! So when you design for that form factor you have to go through a savage trimming exercise &#8211; everything from type, to layout, to navigation must communicate their intent in as tiny a space as possible. In other words, there&#8217;s no avoiding the need to effectively communicate your message.</p>
<p>When you build all of your applications this way, mobile or not, it&#8217;s hard not to come up with a user experience that has laser focus and goes straight for the mark. Once you have a bare minimum experience, <em>now</em> you can augment it with additional navigation and information (including advertising) for larger form factors like desktop and tablets.</p>
<p><strong>Don&#8217;t Fret the Framework</strong><br />
Just as in web development, frameworks are powerful tools that come with sometimes painful trade-offs. Especially when you&#8217;re getting started, don&#8217;t worry about which framework you choose &#8211; just pick the one that caters most to the style of development you&#8217;re already familiar with and jump in. If that means Adobe Air for ActionScript, cool. If it means PhoneGap for JavaScript, great.</p>
<p>Most of the new devices coming onto the market have more than enough memory and processing horsepower to handle the massive extra overhead incurred through cross-platform development tools. If you&#8217;re starting a new project or iterating a prototype, don&#8217;t hesitate to jump on board a tool that will get you to a product faster. This is one of those areas where the short term gain is worth the longer term pain&#8230;</p>
<p><strong>Native Wins</strong><br />
We&#8217;ve known since the 80s, when developers had to release to a boatload of PC platforms &#8211; IBM, Commodore, Amiga, Tandy, etc &#8211; that software written directly for a particular platform outperforms and outsells similar software written for a generic platform and ported across to others. The same idea is definitely the case now, even though our cross-platform tools are far more advanced, and our globally-usable app much higher in quality that what we could produce 30 years ago.</p>
<p>Some of the compelling reasons why you would want to take on the expense of building, testing and maintaining you app natively:</p>
<ul>
<li>The UI of your application will integrate seamlessly into the underlying operating system &#8211; iOS widgets look like they belong, Android layouts are laid out consistently compared to other applications</li>
<li>Raw speed &#8211; you don&#8217;t need to go through someone else&#8217;s API shim to get at the underlying operating system features, you don&#8217;t have to develop custom native code since all the code is native; all CPU cycles are devoted to your application, resulting in much higher performance, particularly for graphic-intensive applications</li>
<li>Operating system features &#8211; each mobile operating system has its own paradigm and set of best practices which cross-platform tools gloss over to give you as a developer a consistent response. So your application misses the subtleties of the user&#8217;s hardware experience &#8211; for example Android uses Activities as its interaction model, but the Adobe Air framework squashes that instead of forcing developers to program in an Activity-centric way</li>
</ul>
<p>In other words, cross-platform tools exist in order to give developers the best experience, not to give the user the best experience. Your customer doesn&#8217;t care if your app is available on Android, Windows, iPhone, Playbook and WebOS if all they have is an iPhone.</p>
<p>I believe cross-platform tools are the best way to get your project off the ground and usable fast, but right from the beginning you need to be thinking about converting your application to native code in order to optimize the experience for your customers.</p>
<p><strong>Market Fragmentation</strong><br />
I bought an Android phone and have been enjoying developing for it. But I don&#8217;t think I would enjoy developing for Android at large because of the massive amount of devices and form factors I would need to support. This is where Apple has an edge &#8211; although the learning curve for Objective-C is higher, once I have an iOS application, I know it will run on an iPod Touch, and iPhone or and iPad. Not only that, but my guess is people are more likely to want to spend small amounts of money on app purchases, since they&#8217;ve been trained to do so from years of iTunes.</p>
<p><strong>Backward Compatibility</strong><br />
Moving to the web was a huge advantage in terms of software support because if you ever found a bug in your program you could patch it and release it without affecting any of your users. No one has to upgrade a web page.</p>
<p>This isn&#8217;t true of mobile applications &#8211; ignoring mobile web applications &#8211; once someone downloads your app they may be slow to upgrade to newer verions, or they may never upgrade at all. This means any bugs that get released with your bundle are going to remain in the wild forever. If you have any kind of server-based presence, your server code needs to handle requests from all of those old app versions &#8211; so you need to make sure you get it right, and have good filtering and upgrade mechanisms in place.</p>
<p><strong>Choosing a Platform</strong><br />
One thing that held me back from diving into mobile development was my hesitation to start. This is totally my fault &#8211; instead of just programming for WebOS when I had the Palm Pre, I thought it would be better/more accessible to use a more open JavaScript toolset so I could deploy my app to other phones. But really, what would have been the point? I only had a Palm Pre to run my software on and I definitely wasn&#8217;t going to buy new hardware to test other versions. Instead of getting locked in analysis paralysis I should have just started programming for the Pre right away and transferred those skills to a more mainstream platform later.</p>
<p>So if you don&#8217;t have a smartphone, go get one &#8211; it will change your life, or at least the way you interact with your phone. Then start building apps for it. That&#8217;s all it takes to get into the game. Don&#8217;t wait another second.</p>

						<div id="pdrp_endAttribution">
						photo by: 
						 
							<a href="http://flickr.com/8764442@N07/4345988530" target="_blank" class="pdrp_link pdrp_attributionLink">
								osde8info</a>
						</div>
					<div class='yarpp-related-rss yarpp-related-none'>
<p>No related posts.</p>
</div>
<img src="http://feeds.feedburner.com/~r/AlwaysGetBetter/~4/NBCRP2bfsdc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.alwaysgetbetter.com/blog/2012/09/10/observations-mobile-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.alwaysgetbetter.com/blog/2012/09/10/observations-mobile-development/</feedburner:origLink></item>
		<item>
		<title>Using DateTime in the Play! Framework</title>
		<link>http://feedproxy.google.com/~r/AlwaysGetBetter/~3/OHNd_-MtAKw/</link>
		<comments>http://www.alwaysgetbetter.com/blog/2012/05/20/datetime-play-framework/#comments</comments>
		<pubDate>Sun, 20 May 2012 04:08:16 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Play Framework]]></category>
		<category><![CDATA[data types]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[play framework]]></category>
		<category><![CDATA[time]]></category>

		<guid isPermaLink="false">http://www.alwaysgetbetter.com/blog/?p=500</guid>
		<description><![CDATA[Which data type should you use for time information on your Java models? The Date class is mostly deprecated, pushing us into the direction of the heavyweight Calendar class. Storing the milliseconds since Epoch in a Long is both database-friendly and easy to perform math on and convert at runtime. But if you really want [...]<div class='yarpp-related-rss yarpp-related-none'>

No related posts.
</div>
]]></description>
				<content:encoded><![CDATA[<p>Which data type should you use for time information on your Java models? The <em>Date</em> class is mostly deprecated, pushing us into the direction of the heavyweight <em>Calendar</em> class. Storing the milliseconds since Epoch in a <em>Long</em> is both database-friendly and easy to perform math on and convert at runtime. But if you really want a good experience, you are using <em>Joda Time</em>.</p>
<p>Joda Time is built into the <a href="http://www.alwaysgetbetter.com/blog/2011/04/11/play-framework-saves-world/">Play! Framework</a>, and there really is no excuse to use anything else. But when it comes to saving dates in your JPA Models, there is a big &#8220;gotcha&#8221; in that there is no default type converter to move a DateTime object into and out of the database. Oops.</p>
<p>But that can be fixed with an annotation in your model, like this:<br />
<code><br />
    @Type(type="org.joda.time.contrib.hibernate.PersistentDateTime")<br />
    public DateTime created;<br />
</code></p>
<p>Unfortunately, Play does not ship with Hibernate support for the DateTime object. So to make this work you need to include the <a href="http://joda-time.sourceforge.net/contrib/hibernate/index.html">Joda-Time-Hibernate</a> library in your dependencies.yml file:</p>
<p><code><br />
require:<br />
    - play<br />
    - joda-time -> joda-time-hibernate 1.3<br />
</code></p>
<p>After updating the dependencies file, run the <strong>play deps &#8211;sync</strong> command to pull in the libraries from maven. Your models will now save their date and time into MySQL, and your programming experience will be smooth as silk &#8211; at least as far as time-based functionality is concerned.</p>
<div class='yarpp-related-rss yarpp-related-none'>
<p>No related posts.</p>
</div>
<img src="http://feeds.feedburner.com/~r/AlwaysGetBetter/~4/OHNd_-MtAKw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.alwaysgetbetter.com/blog/2012/05/20/datetime-play-framework/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.alwaysgetbetter.com/blog/2012/05/20/datetime-play-framework/</feedburner:origLink></item>
		<item>
		<title>Re-Learning How to Write</title>
		<link>http://feedproxy.google.com/~r/AlwaysGetBetter/~3/CTMgdPec290/</link>
		<comments>http://www.alwaysgetbetter.com/blog/2012/04/30/relearning-write/#comments</comments>
		<pubDate>Mon, 30 Apr 2012 20:01:16 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[Node.js]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[node.js]]></category>
		<category><![CDATA[o'reilly]]></category>
		<category><![CDATA[writing]]></category>

		<guid isPermaLink="false">http://www.alwaysgetbetter.com/blog/?p=495</guid>
		<description><![CDATA[In just two weeks, Node: Up and Running will be released by O&#8217;Reilly Media. Writing a book has been a lot of hard work but also a terrific learning experience that I would love to repeat. The biggest takeaway for me was how often I make stupid mistakes in my writing. As a developer and [...]<div class='yarpp-related-rss yarpp-related-none'>

No related posts.
</div>
]]></description>
				<content:encoded><![CDATA[<p>In just two weeks, Node: Up and Running will be released by O&#8217;Reilly Media. Writing a book has been a lot of hard work but also a terrific learning experience that I would love to repeat.</p>
<p>The biggest takeaway for me was how often I make stupid mistakes in my writing. As a developer and manager, I rely on my speaking and writing abilities every day &#8211; so I take my ability to express myself for granted because I have to do it every day.</p>
<p>When a professional editor takes a piece of writing, they aren&#8217;t looking at it in the same way a co-worker would. A co-worker knows me, understands some of the subtleties of the context I&#8217;m writing about, and can subconsciously apply meaning to ambiguities in the text or conversation. A casual reader doesn&#8217;t have the same context, and the copy editor is able to filter that out and make adjustments to the text that leave my meaning intact but change the delivery.</p>
<p>In other words, the text that came out of the editing process makes me look really smart (I wish!). I&#8217;ve learned the secret to clear communication is in keeping the message brief. Especially in a technical book, the audience can&#8217;t be expected to deconstruct prose &#8211; it&#8217;s up to the writer to make their point and get out of the way.</p>
<p>I&#8217;ve also learned that I use the same turns of phrases over and over again. Reading 50 pages of my own writing in a row with the same sentence transitions is boring as heck, and I&#8217;m able to see this strikingly clear when it&#8217;s annotated by a totally impartial writer.</p>
<div class='yarpp-related-rss yarpp-related-none'>
<p>No related posts.</p>
</div>
<img src="http://feeds.feedburner.com/~r/AlwaysGetBetter/~4/CTMgdPec290" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.alwaysgetbetter.com/blog/2012/04/30/relearning-write/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://www.alwaysgetbetter.com/blog/2012/04/30/relearning-write/</feedburner:origLink></item>
		<item>
		<title>log4php Performance</title>
		<link>http://feedproxy.google.com/~r/AlwaysGetBetter/~3/ltJk0KY93dM/</link>
		<comments>http://www.alwaysgetbetter.com/blog/2012/02/29/log4php-performance/#comments</comments>
		<pubDate>Wed, 29 Feb 2012 11:33:41 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://www.alwaysgetbetter.com/blog/?p=492</guid>
		<description><![CDATA[photo credit: U.S. Fish and Wildlife Service &#8211; Midwest Region We can take for granted that whenever we introduce a library or framework to our application, we incur an overhead cost. The cost varies depending on what we&#8217;re trying to do, but we generally accept that the lost performance is worth it for the increased [...]<div class='yarpp-related-rss yarpp-related-none'>

No related posts.
</div>
]]></description>
				<content:encoded><![CDATA[<div class=alignright><a href="http://www.flickr.com/photos/49208525@N08/6892108297/" title="log pile 2" target="_blank"><img src="http://farm8.static.flickr.com/7037/6892108297_14c01f3890_m.jpg" alt="log pile 2" border="0" /></a><br /><small><a href="http://creativecommons.org/licenses/by/2.0/" title="Attribution License" target="_blank"><img src="http://www.alwaysgetbetter.com/blog/wp-content/plugins/photo-dropper/images/cc.png" alt="Creative Commons License" border="0" width="16" height="16" align="absmiddle" /></a> <a href="http://www.photodropper.com/photos/" target="_blank">photo</a> credit: <a href="http://www.flickr.com/photos/49208525@N08/6892108297/" title="U.S. Fish and Wildlife Service - Midwest Region" target="_blank">U.S. Fish and Wildlife Service &#8211; Midwest Region</a></small></div>
<p>We can take for granted that whenever we introduce a library or framework to our application, we incur an overhead cost.  The cost varies depending on what we&#8217;re trying to do, but we generally accept that the lost performance is worth it for the increased maintainability, functionality or ease of use.</p>
<p>For many teams, logging is something that gets thrown in the mix at the last minute rather than through of all the way through. That&#8217;s a shame because a well-implemented logging solution can make the difference between understanding what is going on in your system and having to guess by looking at the code. It needs to be lightweight enough that the overall performance is not affected, but feature-rich enough that important issues are surfaced properly.</p>
<p>Java programmers have had log4j for a long time, and log4net is a similarly mature solution in the .NET world. I&#8217;ve been watching log4php for awhile and now that it has escaped the Apache Incubator it is impressively full-featured and fast. But how much do all its features cost?</p>
<p><strong>Benchmarks</strong><br />
I&#8217;ll be looking into different options as I go, but let&#8217;s consider a very basic case &#8211; you append all of your events to a text file. I&#8217;ve created a configuration that ignores all &#8216;trace&#8217; and &#8216;debug&#8217; events so only events with a severity of &#8216;INFO&#8217; or above are covered.</p>
<p>In 5 seconds, this is what I saw:</p>
<table>
<tr>
<th>Test</th>
<th>Iterations</th>
</tr>
<tr>
<td>BASIC (direct PHP)</td>
<td>45,421</td>
</tr>
<tr>
<td>INFO STATIC</td>
<td>45,383</td>
</tr>
<tr>
<td>INFO DYNAMIC</td>
<td>41,847</td>
</tr>
<tr>
<td>INFO STATIC (no check)</td>
<td>51,801</td>
</tr>
<tr>
<td>INFO DYNAMIC (no check)</td>
<td>47,756</td>
</tr>
<tr>
<td>TRACE STATIC</td>
<td>310,255</td>
</tr>
<tr>
<td>TRACE DYNAMIC</td>
<td>213,554</td>
</tr>
<tr>
<td>TRACE STATIC (no check)</td>
<td>271,043</tr>
<tr>
<td>TRACE DYNAMIC (no check)</td>
<td>196,653</tr>
</table>
<p><strong>Tests</strong><br />
What is all that? There are two ways to initialize the logger class &#8211; statically, meaning declared once and used again and again; and dynamically, meaning declared each time. With log4X, we typically perform a log level check first, for example isTraceEnabled() to determine whether to proceed with the actual logging work.</p>
<p><strong>Results</strong><br />
I was surprised by how little log4php actually lost in terms of speed versus raw PHP. The authors have clearly done a thorough job of optimizing their library because it runs at 90% of the speed of a direct access.</p>
<p>I&#8217;ve always intuitively used loggers as static variables &#8211; initialize once and use over and over. This seems to be the right way by a huge margin.</p>
<p>Checking for the log level before appending to the log was a big win for the INFO messages, which are always logged to the file due to the configuration settings. The intended use is to allow programmers to sprinkle their code with debug statements which don&#8217;t get processed &#8211; and therefore slow down &#8211; the production code. I would be very happen with this in my project. In the INFO metrics, the check slowed things down a bit &#8211; explained because the actual logging function performs the same check &#8211; so we are taking a double hit. But wait, there is a good reason&#8230;</p>
<p>The TRACE metric is interesting &#8211; these are events which are NOT appended to the log. In that case, when the check is not performed, we pass through the code more times. When the check is performed, the code has to execute deeper on the call stack before it figures out we aren&#8217;t doing any actual logging, taking more time.</p>
<p><strong>Conclusion</strong><br />
If you know you will be logging every single event, don&#8217;t do a check. Otherwise do the check &#8211; it will save a lot of wasted cycles.</p>
<div class='yarpp-related-rss yarpp-related-none'>
<p>No related posts.</p>
</div>
<img src="http://feeds.feedburner.com/~r/AlwaysGetBetter/~4/ltJk0KY93dM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.alwaysgetbetter.com/blog/2012/02/29/log4php-performance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.alwaysgetbetter.com/blog/2012/02/29/log4php-performance/</feedburner:origLink></item>
		<item>
		<title>Setting up WordPress with nginx and FastCGI</title>
		<link>http://feedproxy.google.com/~r/AlwaysGetBetter/~3/UPK971X-yh4/</link>
		<comments>http://www.alwaysgetbetter.com/blog/2012/01/30/setting-wordpress-nginx-fastcgi/#comments</comments>
		<pubDate>Mon, 30 Jan 2012 12:00:17 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[memcached]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[varnish]]></category>

		<guid isPermaLink="false">http://www.alwaysgetbetter.com/blog/?p=490</guid>
		<description><![CDATA[All web site owners should feel a burning need to speed. Studies have shown that viewers waiting more than 2 or 3 seconds for content to load online are likely to leave without allowing the page to fully load. This is particularly bad if you&#8217;re trying to run a web site that relies on visitors [...]<div class='yarpp-related-rss yarpp-related-none'>

No related posts.
</div>
]]></description>
				<content:encoded><![CDATA[<p>All web site owners should feel a burning need to speed. Studies have shown that viewers waiting more than 2 or 3 seconds for content to load online are likely to leave without allowing the page to fully load. This is particularly bad if you&#8217;re trying to run a web site that relies on visitors to generate some kind of income &#8211; content is king but speed keeps the king&#8217;s coffers flowing.</p>
<p>If your website isn&#8217;t the fastest it can be, you can take some comfort in the fact that the majority of the &#8220;top&#8221; web sites also suffer from page load times pushing up into the 10 second range (have you BEEN to Amazon lately?). But do take the time to download YSlow today and use its suggestions to start making radical improvements.</p>
<p>I&#8217;ve been very interested in web server performance because it is the first leg of the web page&#8217;s journey to the end user. The speed of execution at the server level is capable of making or breaking the user&#8217;s experience by controlling the amount of &#8216;lag time&#8217; between the web page request and visible activity in the web browser. We want our server to send page data as immediately as possible so the browser can begin rendering it and downloading supporting files.</p>
<p><a href="http://c500335.r35.cf2.rackcdn.com/blog/wp-content/uploads/2011/12/agb_new.png"><img class="alignright  wp-image-463" title="agb_new" src="http://c500335.r35.cf2.rackcdn.com/blog/wp-content/uploads/2011/12/agb_new.png" alt="" width="347" height="347" /></a>Not long ago, I described <a href="http://www.alwaysgetbetter.com/blog/2011/12/20/fastcgi-nginx-performance-vm/">my web stack</a> and explained why I moved away from the &#8220;safe&#8221; Apache server solution in favour of nginx. Since nginx doesn&#8217;t have a PHP module I had to use PHP&#8217;s FastCGI (PHP FPM) server with nginx as a reverse proxy. Additionally, I used memcached to store sessions rather than writing to disk.</p>
<p>Here are the configuration steps I took to realize this stack:</p>
<p><strong>1. Memcached Sessions</strong><br />
Using memcached for sessions gives me slightly better performance on my Rackspace VM because in-memory reading&amp;writing is hugely faster than reading&amp;writing to a virtualized disk. I went into a lot more detail about this last April when I wrote about <a href="http://www.alwaysgetbetter.com/blog/2011/04/09/memcached-session-handler/">how to use memcached as a session handler in PHP</a>.</p>
<p><strong>2. PHP FPM</strong><br />
The newest Ubuntu distributions have a package <strong>php5-fpm</strong> that installs PHP5 FastCGI and an init.d script for it. Once installed, you can tweak your php.ini settings to suit, depending on your system&#8217;s configuration. (Maybe we can get into this another time.)</p>
<p><strong>3. Nginx</strong><br />
Once PHP FPM was installed, I created a site entry that would pass PHP requests forward to the FastCGI server, while serving other files directly. Since the majority of my static content (css, javascript, images) have already been moved to a content delivery network, nginx has very little actual work to do.</p>
<p><code><br />
server {<br />
listen 80;<br />
server_name sitename.com www.sitename.com;<br />
access_log /var/log/nginx/sitename-access.log;<br />
error_log /var/log/nginx/sitename-error.log;<br />
# serve static files<br />
location / {<br />
root /www/sitename.com/html;<br />
index index.php index.html index.htm;</code></p>
<p># this serves static files that exists without<br />
# running other rewrite tests<br />
if (-f $request_filename) {<br />
expires 30d;<br />
break;<br />
}</p>
<p># this sends all-non-existing file or directory requests to index.php<br />
if (!-e $request_filename) {<br />
rewrite ^(.+)$ /index.php?q=$1 last;<br />
}<br />
}</p>
<p>location ~ \.php$ {<br />
fastcgi_pass 127.0.0.1:9000;<br />
fastcgi_index index.php;<br />
fastcgi_param SCRIPT_FILENAME /www/sitename.com/html$fastcgi_script_name;<br />
include fastcgi_params;<br />
}<br />
}</p>
<p>The <strong>fastcgi_param</strong> setting controls which script is executed, based upon the root path of the site being accessed. All of the requests parameters are passed through to PHP, and once the configuration is started up I didn&#8217;t miss Apache one little bit.</p>
<p><strong>Improvements</strong><br />
My next step will be to put a varnish server in front of nginx. Since the majority of my site traffic comes from search engine results where a user has not yet been registered to the site or needs refreshed content, Varnish can step in and serve a fully cached version of my pages from memory far faster than FastCGI can render the WordPress code. I&#8217;ll experiment with this setup in the coming months and post my results.</p>
<div class='yarpp-related-rss yarpp-related-none'>
<p>No related posts.</p>
</div>
<img src="http://feeds.feedburner.com/~r/AlwaysGetBetter/~4/UPK971X-yh4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.alwaysgetbetter.com/blog/2012/01/30/setting-wordpress-nginx-fastcgi/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://www.alwaysgetbetter.com/blog/2012/01/30/setting-wordpress-nginx-fastcgi/</feedburner:origLink></item>
		<item>
		<title>HP Releases Enyo 2.0</title>
		<link>http://feedproxy.google.com/~r/AlwaysGetBetter/~3/w_W6xngCfiQ/</link>
		<comments>http://www.alwaysgetbetter.com/blog/2012/01/25/hp-releases-enyo-20/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 01:56:27 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[WebOS]]></category>
		<category><![CDATA[enyo]]></category>
		<category><![CDATA[hp]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[webos]]></category>

		<guid isPermaLink="false">http://www.alwaysgetbetter.com/blog/?p=485</guid>
		<description><![CDATA[Now that WebOS is being made open source, HP has released a new version of the Enyo JavaScript framework. Whereas the first version of the framework only supported Webkit-based environments (like the HP Touchpad, or Safari or Chrome), the newer version has expanded support for Firefox and IE9 as well. Developers who created apps with [...]<div class='yarpp-related-rss yarpp-related-none'>

No related posts.
</div>
]]></description>
				<content:encoded><![CDATA[<p><img class="alignright" title="Enyo Logo" src="http://cdn.precentral.net/resources/images/000/106/057/large/enyo-html5-palm-logos.png" alt="" width="330" height="169" />Now that WebOS is being made open source, HP has released a new version of the Enyo JavaScript framework. Whereas the first version of the framework only supported Webkit-based environments (like the HP Touchpad, or Safari or Chrome), the newer version has expanded support for Firefox and IE9 as well. Developers who created apps with the old framework will have to wait a little while longer before all of the widgets and controls from Enyo 1.0 are ported over.</p>
<p>What does this mean for app developers? Now that Enyo is open-source, it means applications built on the platform will run on Android and iOS. But it&#8217;s not a disruptive technology &#8211; both Android and iOS have supported HTML5 applications for quite awhile; HP will be competing against mature frameworks like jQuery Mobile.</p>
<p>As a WebOS enthusiast I am definitely going to put some time into continuing my explorations of Enyo, but it&#8217;s getting harder and harder to justify the investment. My Pre is getting pretty old at this point, and hardware manufacturers have yet to express interest in making new devices to take advantage of WebOS. If I end up switching to Android with my next hardware purchase, it&#8217;s going to shift my priorities away from Enyo and its brethren.</p>
<div class='yarpp-related-rss yarpp-related-none'>
<p>No related posts.</p>
</div>
<img src="http://feeds.feedburner.com/~r/AlwaysGetBetter/~4/w_W6xngCfiQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.alwaysgetbetter.com/blog/2012/01/25/hp-releases-enyo-20/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.alwaysgetbetter.com/blog/2012/01/25/hp-releases-enyo-20/</feedburner:origLink></item>
		<item>
		<title>4 Year Blogiversary</title>
		<link>http://feedproxy.google.com/~r/AlwaysGetBetter/~3/YnmhVkAGjfs/</link>
		<comments>http://www.alwaysgetbetter.com/blog/2012/01/16/4-year-blogiversary/#comments</comments>
		<pubDate>Mon, 16 Jan 2012 10:00:39 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Blogging]]></category>

		<guid isPermaLink="false">http://www.alwaysgetbetter.com/blog/?p=481</guid>
		<description><![CDATA[photo credit: various brennemans It&#8217;s hard to believe but this site is four years old. Wow! Time has flown, and I&#8217;ve learned a lot &#8211; hopefully these years have been helpful for you too!<div class='yarpp-related-rss yarpp-related-none'>

No related posts.
</div>
]]></description>
				<content:encoded><![CDATA[<div class=alignright><a href="http://www.flickr.com/photos/58143970@N00/6515737041/" title="the first cut" target="_blank"><img src="http://farm8.static.flickr.com/7024/6515737041_cd6f82a3c2_m.jpg" alt="the first cut" border="0" /></a><br /><small><a href="http://creativecommons.org/licenses/by-sa/2.0/" title="Attribution-ShareAlike License" target="_blank"><img src="http://www.alwaysgetbetter.com/blog/wp-content/plugins/photo-dropper/images/cc.png" alt="Creative Commons License" border="0" width="16" height="16" align="absmiddle" /></a> <a href="http://www.photodropper.com/photos/" target="_blank">photo</a> credit: <a href="http://www.flickr.com/photos/58143970@N00/6515737041/" title="various brennemans" target="_blank">various brennemans</a></small></div>
<p>It&#8217;s hard to believe but this site is four years old. Wow! Time has flown, and I&#8217;ve learned a lot &#8211; hopefully these years have been helpful for you too!</p>
<div class='yarpp-related-rss yarpp-related-none'>
<p>No related posts.</p>
</div>
<img src="http://feeds.feedburner.com/~r/AlwaysGetBetter/~4/YnmhVkAGjfs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.alwaysgetbetter.com/blog/2012/01/16/4-year-blogiversary/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.alwaysgetbetter.com/blog/2012/01/16/4-year-blogiversary/</feedburner:origLink></item>
		<item>
		<title>Humans.txt – the Anti-Robots.txt</title>
		<link>http://feedproxy.google.com/~r/AlwaysGetBetter/~3/i5Gs2e01Yrk/</link>
		<comments>http://www.alwaysgetbetter.com/blog/2012/01/14/humanstxt-antirobotstxt/#comments</comments>
		<pubDate>Sun, 15 Jan 2012 01:21:24 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[attribution]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://www.alwaysgetbetter.com/blog/?p=450</guid>
		<description><![CDATA[photo credit: langfordw If you don&#8217;t want a search engine to read some or all of the files on your site, you can create a robots.txt file. (Looking through the blog archive, I realize I&#8217;ve never gone through the construction and contents of that important file, so this is a promise to one day return [...]<div class='yarpp-related-rss yarpp-related-none'>

No related posts.
</div>
]]></description>
				<content:encoded><![CDATA[<div class=alignright><a href="http://www.flickr.com/photos/24375810@N06/6611017007/" title="Mimbo - A Friendly Robot" target="_blank"><img src="http://farm8.static.flickr.com/7019/6611017007_94aec8ded9_m.jpg" alt="Mimbo - A Friendly Robot" border="0" /></a><br /><small><a href="http://creativecommons.org/licenses/by/2.0/" title="Attribution License" target="_blank"><img src="http://www.alwaysgetbetter.com/blog/wp-content/plugins/photo-dropper/images/cc.png" alt="Creative Commons License" border="0" width="16" height="16" align="absmiddle" /></a> <a href="http://www.photodropper.com/photos/" target="_blank">photo</a> credit: <a href="http://www.flickr.com/photos/24375810@N06/6611017007/" title="langfordw" target="_blank">langfordw</a></small></div>
<p>If you don&#8217;t want a search engine to read some or all of the files on your site, you can create a <em>robots.txt</em> file. (Looking through the blog archive, I realize I&#8217;ve never gone through the construction and contents of that important file, so this is a promise to one day return and fix that!)</p>
<p>When you want the opposite &#8211; accessible pages and author credit, create a <em>humans.txt</em> file. Although not an &#8220;official&#8221; standard, it is a fun way to acknowledge the (sometimes many) hardworking individuals behind the creation of a web site.</p>
<p>An example is:</p>
<pre>
/* TEAM */
Leader: Mike Wilson
Site: http://www.alwaysgetbetter.com
Twitter: HawkWilson
Location: Ottawa, ON

/* THANKS */
Seth Godin: http://www.sethgodin.com
Steve Pavlina: http://www.stevepavlina.com
Phil Haack: http://haacked.com

/* SITE */
Last Update: Jan 14, 2012
Standards: HTML5, CSS3
Software: WordPress
</pre>
<p>In most cases, you would want to include at least a TEAM and SITE section. Clearly the exact fields are left to your imagination, but it&#8217;s a very simple way to acknowledge the people who helps (directly or in spirit) a site to get to fruition.</p>
<p>For more information about humans.txt, check out the initiative&#8217;s home page at <a href="http://humanstxt.org/">http://humanstxt.org/</a>.</p>
<div class='yarpp-related-rss yarpp-related-none'>
<p>No related posts.</p>
</div>
<img src="http://feeds.feedburner.com/~r/AlwaysGetBetter/~4/i5Gs2e01Yrk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.alwaysgetbetter.com/blog/2012/01/14/humanstxt-antirobotstxt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.alwaysgetbetter.com/blog/2012/01/14/humanstxt-antirobotstxt/</feedburner:origLink></item>
	</channel>
</rss><!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using xcache
Database Caching 9/80 queries in 0.088 seconds using xcache
Content Delivery Network via Rackspace Cloud Files: c500335.r35.cf2.rackcdn.com

 Served from: alwaysgetbetter.com @ 2013-05-29 03:57:39 by W3 Total Cache -->
