<?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>David Truxall</title>
	
	<link>http://blog.davidtruxall.com</link>
	<description>Fishing for Code</description>
	<lastBuildDate>Sat, 20 Apr 2013 19:17:56 +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/DavidTruxall" /><feedburner:info uri="davidtruxall" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Michigan Google Developers DevFest 2013</title>
		<link>http://feedproxy.google.com/~r/DavidTruxall/~3/sIOOgHpU6Jw/</link>
		<comments>http://blog.davidtruxall.com/2013/03/13/michigan-google-developers-devfest-2013/#comments</comments>
		<pubDate>Wed, 13 Mar 2013 16:37:01 +0000</pubDate>
		<dc:creator>davetrux</dc:creator>
				<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Speaking]]></category>

		<guid isPermaLink="false">http://blog.davidtruxall.com/?p=253</guid>
		<description><![CDATA[I will be speaking at this event on Saturday, March 23rd. I will be talking about how to consume web services using Android, covering two different patterns for doing this. This is a hands-on event, so I&#8217;ll have starter code ready for participants and even web services ready for consumption. I&#8217;m looking forward to another [...]]]></description>
				<content:encoded><![CDATA[<p>I will be speaking at <a href="http://detroitgdgdevfest.wordpress.com/">this event</a> on Saturday, March 23rd. I will be talking about how to consume web services using Android, covering two different patterns for doing this. This is a hands-on event, so I&#8217;ll have starter code ready for participants and even web services ready for consumption. I&#8217;m looking forward to another round of public speaking. You can <a href="http://www.meetup.com/Detroit-Google-Developers-Group/events/103247482/">register here</a>.<br />
<img alt="" src="http://detroitgdgdevfest.files.wordpress.com/2013/02/gdg_detroit_940x160.png" width="470" height="80" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.davidtruxall.com/2013/03/13/michigan-google-developers-devfest-2013/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.davidtruxall.com/2013/03/13/michigan-google-developers-devfest-2013/</feedburner:origLink></item>
		<item>
		<title>Hospice of Michigan Mobile App</title>
		<link>http://feedproxy.google.com/~r/DavidTruxall/~3/pe--M4Z40Yk/</link>
		<comments>http://blog.davidtruxall.com/2013/02/21/hospice-of-michigan-mobile-app/#comments</comments>
		<pubDate>Thu, 21 Feb 2013 14:49:44 +0000</pubDate>
		<dc:creator>davetrux</dc:creator>
				<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">http://blog.davidtruxall.com/?p=248</guid>
		<description><![CDATA[My team built an app for Hospice of Michigan to help families stay connected when they have a loved one in hospice. The app keeps them connected with the care their loved one is receiving. Read about it at CBS Detroit. You can also see a demo video on YouTube.]]></description>
				<content:encoded><![CDATA[<p>My team built an app for <a href="http://www.hom.org/">Hospice of Michigan</a> to help families stay connected when they have a loved one in hospice. The app keeps them connected with the care their loved one is receiving. <a href="http://detroit.cbslocal.com/2013/02/20/hospice-of-michigan-unveils-mobile-app-to-connect-caregivers-patients-family/">Read about it at CBS Detroit</a>. You can also see a <a href="http://www.youtube.com/watch?v=wv7RoYsRRys&amp;feature=youtu.be">demo video on YouTube</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.davidtruxall.com/2013/02/21/hospice-of-michigan-mobile-app/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.davidtruxall.com/2013/02/21/hospice-of-michigan-mobile-app/</feedburner:origLink></item>
		<item>
		<title>Browser Stats</title>
		<link>http://feedproxy.google.com/~r/DavidTruxall/~3/VMBNqRtbTuo/</link>
		<comments>http://blog.davidtruxall.com/2013/02/15/browser-stats/#comments</comments>
		<pubDate>Fri, 15 Feb 2013 18:05:00 +0000</pubDate>
		<dc:creator>davetrux</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">http://blog.davidtruxall.com/?p=247</guid>
		<description><![CDATA[Here are the browser stats for my site from Jan 15 2013 to Feb 14 2013: Browser Percent Chrome 47.35 IE 26.41 Firefox 22.49 Safari 2.36 Opera 0.98 Android 0.41 And more detail for IE: Version Percent 10.0 12.65 9.0 42.9 8.0 38.58 7.0 5.56 6.0 0.31 I am still seeing a lot of IE8, [...]]]></description>
				<content:encoded><![CDATA[<p>Here are the browser stats for my site from Jan 15 2013 to Feb 14 2013:</p>
<table style="border-bottom: black 1px solid; border-left: black 1px solid; border-top: black 1px solid; border-right: black 1px solid" border="0" cellspacing="2" cellpadding="3" width="400">
<tbody>
<tr style="background: #e0e0e0">
<td valign="top" width="200"><strong>Browser</strong></td>
<td valign="top" width="200"><strong>Percent</strong></td>
</tr>
<tr>
<td valign="top" width="200">Chrome</td>
<td valign="top" width="200">47.35</td>
</tr>
<tr>
<td valign="top" width="200">IE</td>
<td valign="top" width="200">26.41</td>
</tr>
<tr>
<td valign="top" width="200">Firefox</td>
<td valign="top" width="200">22.49</td>
</tr>
<tr>
<td valign="top" width="200">Safari</td>
<td valign="top" width="200">2.36</td>
</tr>
<tr>
<td valign="top" width="200">Opera</td>
<td valign="top" width="200">0.98</td>
</tr>
<tr>
<td valign="top" width="200">Android</td>
<td valign="top" width="200">0.41</td>
</tr>
</tbody>
</table>
<p>And more detail for IE:</p>
<table style="border-bottom: black 1px solid; border-left: black 1px solid; border-top: black 1px solid; border-right: black 1px solid" border="0" cellspacing="2" cellpadding="3" width="400">
<tbody>
<tr style="background: #e0e0e0">
<td valign="top" width="200"><strong>Version</strong></td>
<td valign="top" width="200"><strong>Percent</strong></td>
</tr>
<tr>
<td valign="top" width="200">10.0</td>
<td valign="top" width="200">12.65</td>
</tr>
<tr>
<td valign="top" width="200">9.0</td>
<td valign="top" width="200">42.9</td>
</tr>
<tr>
<td valign="top" width="200">8.0</td>
<td valign="top" width="200">38.58</td>
</tr>
<tr>
<td valign="top" width="200">7.0</td>
<td valign="top" width="200">5.56</td>
</tr>
<tr>
<td valign="top" width="200">6.0</td>
<td valign="top" width="200">0.31</td>
</tr>
</tbody>
</table>
<p>I am still seeing a lot of IE8, and more 7 than I expected.</p>
<p>And lastly, mobile devices:</p>
<table style="border-bottom: black 1px solid; border-left: black 1px solid; border-top: black 1px solid; border-right: black 1px solid" border="0" cellspacing="2" cellpadding="3" width="400">
<tbody>
<tr style="background: #e0e0e0">
<td valign="top" width="200"><strong>Browser</strong></td>
<td valign="top" width="200"><strong>Percent</strong></td>
</tr>
<tr>
<td valign="top" width="200">iPad</td>
<td valign="top" width="200">48</td>
</tr>
<tr>
<td valign="top" width="200">iPhone</td>
<td valign="top" width="200">26</td>
</tr>
<tr>
<td valign="top" width="200">Android</td>
<td valign="top" width="200">19</td>
</tr>
<tr>
<td valign="top" width="200">Blackberry</td>
<td valign="top" width="200">4</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://blog.davidtruxall.com/2013/02/15/browser-stats/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.davidtruxall.com/2013/02/15/browser-stats/</feedburner:origLink></item>
		<item>
		<title>Getting Started in Enterprise Mobility</title>
		<link>http://feedproxy.google.com/~r/DavidTruxall/~3/1rTvovyiFuU/</link>
		<comments>http://blog.davidtruxall.com/2013/02/14/getting-started-in-enterprise-mobility/#comments</comments>
		<pubDate>Thu, 14 Feb 2013 17:47:43 +0000</pubDate>
		<dc:creator>davetrux</dc:creator>
				<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">http://blog.davidtruxall.com/?p=246</guid>
		<description><![CDATA[If you are thinking about building enterprise mobile apps, you should be thinking about something else first: Web Services You are going to need a way to move data to and from devices, and you’ll need the services before you can build those apps. Start planning on those services now, leverage your existing team to [...]]]></description>
				<content:encoded><![CDATA[<p>If you are thinking about building enterprise mobile apps, you should be thinking about something else first:</p>
<p><em>Web Services</em></p>
<p>You are going to need a way to move data to and from devices, and you’ll need the services before you can build those apps. Start planning on those services now, leverage your existing team to build out WCF or JAX-RS APIs for the data you to need to share or accept. All that talk a few years back about SOA is now coming to fruition with an expanding new generation of consumers of web services.</p>
<p>Here’s another hint on that front: </p>
<p><em>JSON + REST</em></p>
<p>Unfortunately, most of that talk about SOA a few years back focused on SOAP services, and things like WS-*. Mobile devices have a constrained network pipe, so you want the smallest message possible. Sorry XML. Also, mobile devices tend to be CPU constrained, so you don’t want to do a bunch of parsing either. Sorry XML. As an added bonus, web apps are good at consuming JSON as well.</p>
<p>Start with services, then move on to the mobile apps.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.davidtruxall.com/2013/02/14/getting-started-in-enterprise-mobility/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://blog.davidtruxall.com/2013/02/14/getting-started-in-enterprise-mobility/</feedburner:origLink></item>
		<item>
		<title>BYOD is Not Just Mobile</title>
		<link>http://feedproxy.google.com/~r/DavidTruxall/~3/fDwdPj-rqF8/</link>
		<comments>http://blog.davidtruxall.com/2013/01/21/byod-is-not-just-mobile/#comments</comments>
		<pubDate>Mon, 21 Jan 2013 14:33:58 +0000</pubDate>
		<dc:creator>davetrux</dc:creator>
				<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">http://blog.davidtruxall.com/?p=238</guid>
		<description><![CDATA[I’m seeing more and more business units buying servers and services in the cloud in order to circumvent their internal IT. Obviously there is some additional risk here, but I think the main message is that traditional IT is not keeping up with the pace of change that the business wants. This is an expansion [...]]]></description>
				<content:encoded><![CDATA[<p>I’m seeing more and more business units buying servers and services in the cloud in order to circumvent their internal IT. Obviously there is some additional risk here, but I think the main message is that traditional IT is not keeping up with the pace of change that the business wants.</p>
<p>This is an expansion of my thoughts on part of <a href="http://techcrunch.com/2013/01/19/the-changing-of-the-enterprise-guard/" target="_blank">this article</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.davidtruxall.com/2013/01/21/byod-is-not-just-mobile/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.davidtruxall.com/2013/01/21/byod-is-not-just-mobile/</feedburner:origLink></item>
		<item>
		<title>jQuery Mobile or Sencha Touch for Hybrid Development</title>
		<link>http://feedproxy.google.com/~r/DavidTruxall/~3/Xz10pWK3DNw/</link>
		<comments>http://blog.davidtruxall.com/2012/08/01/jquery-mobile-or-sencha-touch-for-hybrid-development/#comments</comments>
		<pubDate>Wed, 01 Aug 2012 20:50:00 +0000</pubDate>
		<dc:creator>davetrux</dc:creator>
				<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Reviews]]></category>

		<guid isPermaLink="false">http://blog.davidtruxall.com/?p=226</guid>
		<description><![CDATA[I decided to try both jQuery Mobile + PhoneGap and Sencha Touch 2 to create a simple hybrid application to see how they stack up, and record my initial impressions for building a simple app. I assume a complex app would magnify these issues, although experience with each platform would also improve the experience at that point. I am [...]]]></description>
				<content:encoded><![CDATA[<p>I decided to try both <a href="http://jquerymobile.com/">jQuery Mobile</a> + <a href="http://phonegap.com/">PhoneGap</a> and <a href="http://www.sencha.com/products/touch/">Sencha Touch 2</a> to create a simple hybrid application to see how they stack up, and record my initial impressions for building a simple app. I assume a complex app would magnify these issues, although experience with each platform would also improve the experience at that point. I am evaluating the install experience, and the development experience. I wanted to know how easy I could create a simple app that displays a list and has a simple form to add items into the list. I didn&#8217;t use any back-end technologies for this, the app is self-contained.</p>
<p>I used a Mac for this experiment, and at this point I am sure it would be a different experience on a PC.</p>
<h2>jQuery Mobile + PhoneGap</h2>
<h3>Install</h3>
<p>The install of this is very easy. Download the .zip files, extract them to wherever you would like. I used Eclipse for my IDE. Following the tutorials on both the PhoneGap and jQuery Mobile sites was simple enough to get up and running.</p>
<h3>Development</h3>
<p>Since I am experienced at both web development and Android development, getting going was pretty easy. I simply imported the necessary files into my project. The tutorials and docs were fairly easy to follow, and I had my demo app running before lunch. Debugging is a bummer if you use the app on the emulator or a device. You are better of using a browser to develop with and debug on, and then deploying to the emulator or device for testing. The code/debug cycle with the browser is very quick and efficient. But you still have to go back to the emulator/device a fair amount which is pretty slow. I didn&#8217;t use PhoneGap for anything but being a container, so if you were integrating with any native plugins the browser for debugging might be out.</p>
<p>Given it&#8217;s roots, jQuery Mobile will integrate well with server-side frameworks like ASP.NET or JSPs. jQuery Mobile doesn&#8217;t have a broad set of controls or features. For instance I wanted a date picker, but I needed to go and search for one because the platform I was targeting didn&#8217;t support the HTML5 date input control. I ran into a similar issue with data binding. You will need plugins and other libraries. jQuery plugins are abundant, and it&#8217;s not easy to separate the good ones from the bad.</p>
<p>For me, one of the downsides of jQuery Mobile is the UI. It looks like an iPhone app. If I&#8217;m building a hybrid solution, I don&#8217;t want my Android or WP7 apps to look like iOS apps. There is a terrific ThemeRoller tool, but in the end it still looks like what it is. I&#8217;m sure if you delved into the CSS you could get it to look more styled. If you have a high design component to your app, it could be hard to get there.</p>
<h2>Sencha Touch 2</h2>
<p>Sencha Touch was initially a mobile-web solution, but with version 2 Sencha has introduced the ability to package the app for iOS and Android.</p>
<h3>Install</h3>
<p>The install experience for this was frustrating to say the least. You need to download the SDK <em>and</em> a SDK tools package. This was really not clear on the download page, and I didn&#8217;t figure this out until trying to use the tutorial. The tutorials want these items to be installed in very specific places, so if you have a &#8220;standard&#8221; way of setting up projects this isn&#8217;t going to work for you. Also, you need to install Compass, and that isn&#8217;t documented anywhere except in the video, so if you are not inclined to watch a video (like me), you&#8217;ll have issues. I&#8217;m an experienced developer, it shouldn&#8217;t be this hard to get something up and working. As with any framework, there are often more than one way to accomplish tasks, and this is no different in ST2. In general the code used in the tutorial didn&#8217;t match up well with the task paradigm in the documentation, so that was frustrating as well.</p>
<h3>Development</h3>
<p>Since Sencha Touch 2 (ST2) is purely text file development, I used my favorite web editor <a title="WebStorm" href="http://www.jetbrains.com/webstorm/">WebStorm</a>. Any editor would work fine, so this is a bonus for not being tied to Eclipse. You have to do more with the command-line, and I&#8217;m sure there are folks who want the IDE experience and folks who want the text editor experience. The command-line tool creates a project structure with all the dependencies set (like Rails, Maven, etc.), so getting going was quick once I got the tool working.</p>
<p>Getting to know the framework for ST2 is certainly harder if you are not a JavaScript guru. Most of how ST2 works is for you to write JavaScript that renders into HMTL at run time. You see this when starting up the app/site, there is an ellipsis on a blue background that displays while the rendering is going on. This makes the code/debug cycle slow. And if you make a mistake, this screen never clears. You have to have a JavaScript dev tool running at the time to know what went wrong.</p>
<p>The paradigm for ST2 is very different, heavy on the JavaScript. If you are a traditional web developer, this will be a tough shift. ST2 does not lend itself to integration with server-side frameworks because you would need to be emitting tons of JavaScript instead of HTML. For ST2 you need to embrace generating you content via JavaScript and writing Ajax web services to get the data from the server. I actually like this paradigm, but it&#8217;s going to be tough going for the .Net crowd to adopt this paradigm. This paradigm fits well with native mobile development, because you have to develop the services for data. So now you aren&#8217;t completely locked in to the hybrid platform if you want to make a change later. I&#8217;ll try to explore writing more HTML with ST2 and less JavaScript and see if it can work more like traditional web development.</p>
<p>I tried to use the command-line tool to build the hybrid Android app, but could never get it to work. I&#8217;m certain it is a permissions problem (remember I&#8217;m using a Mac), and from here it would probably be a better solution to wrap the ST2 app in PhoneGap. The tool also only took one image for the app icon. I&#8217;m not sure how that would work out for the other device sizes on the Android platform. Packaging ST2 this way felt like maybe it was a rushed feature.</p>
<p>ST2 has tons of controls, lots of great functionality like data binding built right in. It&#8217;s a steep learning curve though. ST has been criticized in the past for feeling slow, version 2 is supposed to improve upon that. Still, everything is rendering in the browser layer on a memory and processor-constrained device. I predict user&#8217;s experiences with speed will vary.</p>
<h2>Conclusion</h2>
<p>I think neither one of these are a clear winner. jQuery Mobile will force you to spend time to find other solutions to features you need, while ST2 will force you to spend time with its steep learning curve. I think this only further rebukes the myth that mobile web or hybrid is somehow cheaper than building a native app. PhoneGap is clearly a necessity for either of these for a hybrid solution, so you will still need separate projects and hardware platforms to get the work done for a cross-platform app. And as soon as you start using images in your designs, the effort for the creative team will quickly equal the need for creative work in a native development environment. You will need to spend significant time with CSS media queries and <a title="Modernizr" href="http://modernizr.com/">Modernizr</a> to deal with the slight differences you will encounter between platforms and browsers. If I was forced to choose today between these two solutions, I would choose ST2 + PhoneGap, simply for the sheer amount of functionality built into ST2, despite the steep learning curve. I don&#8217;t believe either of these is THE solution for hybrid or mobile web development. I&#8217;m still looking&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.davidtruxall.com/2012/08/01/jquery-mobile-or-sencha-touch-for-hybrid-development/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://blog.davidtruxall.com/2012/08/01/jquery-mobile-or-sencha-touch-for-hybrid-development/</feedburner:origLink></item>
		<item>
		<title>Critical Thinking in Software Design</title>
		<link>http://feedproxy.google.com/~r/DavidTruxall/~3/17OgxNWopmQ/</link>
		<comments>http://blog.davidtruxall.com/2012/05/09/critical-thinking-in-software-design/#comments</comments>
		<pubDate>Wed, 09 May 2012 20:40:16 +0000</pubDate>
		<dc:creator>davetrux</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Reviews]]></category>

		<guid isPermaLink="false">http://blog.davidtruxall.com/?p=219</guid>
		<description><![CDATA[There is a great article published at Inc which enumerates four secrets of great critical thinkers. I find this is totally relevant to designing software or software architecture. So I’m adding my take on these four secrets: Slow DownOne of my main gripes about meetings is making a decision on the spot. At least for [...]]]></description>
				<content:encoded><![CDATA[<p>There is a great article <a href="http://www.inc.com/paul-schoemaker/4-secrets-of-great-critical-thinkers.html?utm_source=twitterfeed&amp;utm_medium=twitter&amp;utm_campaign=Feed%3A+inc%2Fheadlines+%28Inc.com+Headlines%29">published at Inc</a> which enumerates four secrets of great critical thinkers. I find this is totally relevant to designing software or software architecture. So I’m adding my take on these four secrets:</p>
<ol>
<li><strong>Slow Down<br /></strong>One of my main gripes about meetings is making a decision on the spot. At least for me, my best thinking occurs somewhere else after the fact. I need time to consider the implications and possibly see alternatives before I can be certain it’s the correct decision. So to make the most effective decisions, postpone immediate decisions as often as possible. Make the time to explore the alternatives.</li>
<li><strong>Break from the Pack<br /></strong>This is the basis of one of the main arguments by Ted Neward in his keynote at Codemash 2012 that <a href="http://blog.davidtruxall.com/2012/01/15/codemash-nuggets/">I already covered</a>. The “best practices” are found in books, on the web, in corporate documents. Generally, these can get the job done. But I doubt it’s always the best or right solution to a problem. It’s certainly the safest. If that’s the goal, then go that way. But in business we are always looking for the advantage, and I doubt the best practice gives you the advantage. More likely, it’s a starting point which you should use to find the best solution. Slow down and think about how the best practice solves the problem and if that is really the solution you need.</li>
<li><strong>Encourage Disagreement<br /></strong>I have long used this as a metric in <a href="http://blog.davidtruxall.com/2011/11/14/technical-resumes-and-interviews/">my interview process</a>. I want team members who will express their opinions. Usually the best answer to a problem is not the result of the idea of a single person, but an amalgamation of ideas or compromise between multiple ideas. If no one can disagree with the boss/tech lead/manager then you might as well adopt only the best practices and call it done.</li>
<li><strong>Engage with Maverics<br /></strong>I think this one is a little harder in an enterprise environment, since often a big corporation is not the home for maverics. I think what you need to do here is actively engage with people whose viewpoints are not aligned with yours. People who think differently about a problem may provide you with some insight you may have missed or not considered properly. I have always thought of code reviews as a source for this. I approach them as a way to see someone else’s problem solving at work. I’m not interested in telling them how they did it wrong, but seeing what they did well and adapt that to my problem solving toolkit. </li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.davidtruxall.com/2012/05/09/critical-thinking-in-software-design/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://blog.davidtruxall.com/2012/05/09/critical-thinking-in-software-design/</feedburner:origLink></item>
		<item>
		<title>Cross-Domain Calls for a WCF Service</title>
		<link>http://feedproxy.google.com/~r/DavidTruxall/~3/gneFa5cd1xc/</link>
		<comments>http://blog.davidtruxall.com/2012/03/12/cross-domain-calls-for-a-wcf-service/#comments</comments>
		<pubDate>Mon, 12 Mar 2012 13:42:51 +0000</pubDate>
		<dc:creator>davetrux</dc:creator>
				<category><![CDATA[JavaScript/AJAX]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://blog.davidtruxall.com/?p=215</guid>
		<description><![CDATA[As I develop more services for mobile devices (and mobile web in particular), cross-domain calls are becoming more frequent. Essentially, a cross-domain call happens when a web page uses JavaScript to access resources at a different URL. This can be as complex as hosting services completely separate from the app in another web site, or [...]]]></description>
				<content:encoded><![CDATA[<p>As I develop more services for mobile devices (and mobile web in particular), cross-domain calls are becoming more frequent. Essentially, a cross-domain call happens when a web page uses JavaScript to access resources at a different URL. This can be as complex as hosting services completely separate from the app in another web site, or in another subdomain or on another port, and also can happen simply because the web page is calling a service over SSL.</p>
<p>The problem occurs because the browser only trusts calls from the exact same domain, unless the server says that it trusts your domain (or all domains). This is by design.</p>
<p>So the resolution is to have the server tell the clients what domains it trusts for cross-site calls. Seems simple, but of course there is more to it than that.</p>
<p>When the browser detects a cross-domain call, it behaves differently if your service is configured correctly. If you were expecting your JavaScript code to perform a POST to a REST URL, that is no longer what happens, at least initially. Instead of performing the POST, the browser actually sends an OPTIONS verb call to your REST URL. This is called a <a href="http://www.w3.org/TR/2008/WD-access-control-20080912/#preflight-request">preflight request</a>. Your service needs to respond to the preflight request containing the OPTIONS verb and let the browser know which parameters are acceptable on a cross-site call. If everything matches up and your client is in an allowed domain, then the browser performs the original POST that you expected and everything continues on normally.</p>
<p>If your service is not configured correctly, the browser doesn’t cooperate and you don’t see anything at all. Again, this is by design.</p>
<h2>Configuring The Service</h2>
<p>From an HTTP point of view, what we need to do in code is add the following name/value headers to our HTTP responses:</p>
<ul>
<li>Access-Control-Allow-Origin</li>
<li>Access-Control-Allow-Methods</li>
<li>Access-Control-Allow-Headers</li>
<li>Access-Control-Max-Age</li>
</ul>
<p>The first, Access-Control-Allow-Origin, needs to be added to any request so the browser knows to use the OPTIONS verb for cross-site calls, which just error out otherwise with an XmlHttpReqeust Error 101 in JavaScript. The other three need to be added in response to the OPTIONS verb request.&nbsp; </p>
<p>The Access-Control-Allow-Origin header can be added with one or more values. If you expect any client anywhere to call your services, like Google Maps does, you want to add * for the value, allowing all callers. Otherwise, the most secure way to use Access-Control-Allow-Origin is to set it for the specific domains you want to accept. Say your services are at https://service.yoursitehere.com, and your client site is http://www.yousitehere.com, you want to set the value to http://www.yoursitehere.com.</p>
<p>The code adds the Access-Control-Allow-Methods header to tell the browser which HTTP verbs your calls will accept as cross-domain.</p>
<p>By adding the Access-Control-Allow-Headers header, you control exactly which HTTP headers are allowed in the actual request which follows the preflight request.</p>
<p>The Access-Control-Max-Age header tells the browser how long to cache the preflight call result before doing it again during this browser session. I set this long to avoid multiple preflight requests.</p>
<p>In my case, I’m using configuration-less WCF services <a href="http://geekswithblogs.net/michelotti/archive/2010/08/21/restful-wcf-services-with-no-svc-file-and-no-config.aspx">as described here</a>. In my experience much of the pain with WCF in the past has been with the complex configurations, and this option circumvents that problem substantially.</p>
<h2>The C# Code</h2>
<p>So this is how it’s done programmatically, in Global.asax in my case:</p>
<div style="width: 99.5%; color: black; font-size: 0.9em; overflow: auto">
<pre style="margin: 0em"> <span style="color: #0000ff">protected</span><span style="color: #000000"> <span style="color: #0000ff">void</span> Application_BeginRequest(<span style="color: #0000ff">object</span> sender, <span style="color: #2b91af">EventArgs</span> e)</pre>
<pre style="margin: 0em"> {</pre>
<blockquote><pre style="margin: 0em"> <span style="color: #000000"> <span style="color: #2b91af">HttpContext</span><span style="color: #000000">.Current.Response.AddHeader(<span style="color: #a31515">"Access-Control-Allow-Origin"</span><span style="color: #000000"> , ”http://www.yoursitehere.com”);</pre>
<p><span style="color: #000000"><span style="color: #000000"></p></blockquote>
<blockquote><pre style="margin: 0em"> <span style="color: #0000ff">if</span><span style="color: #000000"> (<span style="color: #2b91af">HttpContext</span><span style="color: #000000">.Current.Request.HttpMethod == <span style="color: #a31515">"OPTIONS"</span><span style="color: #000000"> )</pre>
<pre style="margin: 0em"> <span style="color: #000000">{</span></pre>
</blockquote>
<blockquote><pre style="margin: 0em"> <span style="color: #008000">//These headers are handling the "pre-flight" OPTIONS call sent by the browser</span><span style="color: #000000"></pre>
<pre style="margin: 0em"> <span style="color: #2b91af">HttpContext</span><span style="color: #000000">.Current.Response.AddHeader(<span style="color: #a31515">"Access-Control-Allow-Methods"</span><span style="color: #000000"> , <span style="color: #a31515">"GET, POST"</span><span style="color: #000000"> );<span style="color: #000000"></pre>
<pre style="margin: 0em"> <span style="color: #2b91af">HttpContext</span><span style="color: #000000">.Current.Response.AddHeader(<span style="color: #a31515">"Access-Control-Allow-Headers"</span><span style="color: #000000"> , <span style="color: #a31515">"Content-Type, Accept"</span><span style="color: #000000"> );</pre>
<pre style="margin: 0em"> <span style="color: #000000"></pre>
<pre style="margin: 0em"> <span style="color: #000000"></pre>
<pre style="margin: 0em"> <span style="color: #2b91af">HttpContext</span><span style="color: #000000">.Current.Response.AddHeader(<span style="color: #a31515">"Access-Control-Max-Age"</span><span style="color: #000000"> <span style="color: #a31515">"1728000"</span><span style="color: #000000"> );</pre>
<pre style="margin: 0em"> <span style="color: #2b91af">HttpContext</span><span style="color: #000000">.Current.Response.End();</pre>
</blockquote>
<blockquote><pre style="margin: 0em"> <span style="color: #000000">}</span></pre>
</blockquote>
<pre style="margin: 0em"><span style="color: #000000"> <span style="color: #000000">}</span></span></pre>
<pre style="margin: 0em"> </pre>
</div>
<p>I put it Global.asax in order to avoid having each request handle multiple verbs and calling the handler in each service call. The downside to this is that any non-service request also gets the additional header and processing as well. For me, there are only service requests in this app so this is not a big deal.</p>
<h2>The Client</h2>
<p>I’ve regularly used jQuery to access services from client HTML code. It’s not complicated, the important parts are formatting the call to send JSON properly in response to our preflight request, which includes the dataType, contentType and data parameters to the $.ajax call.</p>
<div style="width: 99.5%; color: black; overflow: auto">
<pre style="margin: 0em"> $.ajax(<span style="color: #000000">{</span></pre>
<blockquote><pre style="margin: 0em"> url: "<span style="color: #800000">https://www.yoursitehere.com/person/add"</span>,<span style="color: #000000"></pre>
<pre style="margin: 0em"> type: <span style="color: #800000">"POST"</span><span style="color: #000000"> ,</pre>
<pre style="margin: 0em"> dataType: <span style="color: #800000">"json"</span><span style="color: #000000"> ,</pre>
<pre style="margin: 0em"> contentType: <span style="color: #800000">"application/json"</span><span style="color: #000000"> ,</pre>
<pre style="margin: 0em"> data: JSON.stringify(personObject),</pre>
<pre style="margin: 0em"> success: <span style="color: #0000ff">function</span><span style="color: #000000"> (data) <span style="color: #000000">{</span></pre>
<pre style="margin: 0em"> <span style="color: #006400">//Process success here</span><span style="color: #000000"> </pre>
<pre style="margin: 0em"> <span style="color: #000000">}</span>,</pre>
<pre style="margin: 0em"> error: <span style="color: #0000ff">function</span><span style="color: #000000"> (jqXHR, textStatus, errorThrown) <span style="color: #000000">{</span></pre>
<pre style="margin: 0em"> <span style="color: #006400">//process errors here</span><span style="color: #000000"> </pre>
<pre style="margin: 0em"> <span style="color: #000000">}</span></pre>
</blockquote>
<pre style="margin: 0em"> <span style="color: #000000">}</span>);</pre>
<pre style="margin: 0em"> </pre>
</div>
<p><span style="color: #000000"><span style="color: #000000"><span style="color: #000000"><span style="color: #000000"><span style="color: #000000"><span style="color: #000000"><span style="color: #000000"><span style="color: #000000"><br />
<h2>Tools</h2>
<p>If you are debugging REST services, you need some good tools. I have used <a href="http://www.fiddler2.com/fiddler2/">Fiddler</a>, the <a href="http://code.google.com/chrome/devtools/docs/overview.html">Chrome Developer Tools</a> (the Network panel in particular) and the Chrome app <a href="https://chrome.google.com/webstore/detail/hgmloofddffdnphfgcellkdfbfbjeloo">Advanced REST Client Application</a> successfully. </p>
<h2>References</h2>
<p><a href="http://www.codeproject.com/Articles/128478/Consuming-WCF-REST-Services-Using-jQuery-AJAX-Call">This post</a> is the basis of the fix I’m describing</p>
<p><a href="http://www.w3.org/TR/2008/WD-access-control-20080912/#access-control-max-age">W3C description</a> of how the HTTP process works</p>
<p><a href="https://developer.mozilla.org/En/HTTP_access_control">FireFox and CORS</a>, also a lot of good info on HTTP headers</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.davidtruxall.com/2012/03/12/cross-domain-calls-for-a-wcf-service/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://blog.davidtruxall.com/2012/03/12/cross-domain-calls-for-a-wcf-service/</feedburner:origLink></item>
		<item>
		<title>Hybrid QR Code/NFC Tag</title>
		<link>http://feedproxy.google.com/~r/DavidTruxall/~3/cP5kHlNmTnM/</link>
		<comments>http://blog.davidtruxall.com/2012/03/08/hybrid-qr-codenfc-tag/#comments</comments>
		<pubDate>Thu, 08 Mar 2012 15:25:02 +0000</pubDate>
		<dc:creator>davetrux</dc:creator>
				<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">http://blog.davidtruxall.com/?p=211</guid>
		<description><![CDATA[My colleague Melissa Duckworth implemented a great idea: the hybrid QR Code/NFC tag. She superimposed a QR code on top of an NFC tag. Since NFC adoption is slow, you can still begin to take advantage of the rich possibilities of NFC while still supporting users with older devices.]]></description>
				<content:encoded><![CDATA[<p>My colleague <a href="http://www.pandoraink.com/">Melissa Duckworth</a> implemented a great idea: the hybrid QR Code/NFC tag. She superimposed a QR code on top of an NFC tag. Since NFC adoption is slow, you can still begin to take advantage of the rich possibilities of NFC while still supporting users with older devices.</p>
<p><a href="http://blog.davidtruxall.com/wp-content/uploads/2012/03/hybridQRNFC.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="hybridQRNFC" border="0" alt="hybridQRNFC" src="http://blog.davidtruxall.com/wp-content/uploads/2012/03/hybridQRNFC_thumb.png" width="124" height="117"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.davidtruxall.com/2012/03/08/hybrid-qr-codenfc-tag/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.davidtruxall.com/2012/03/08/hybrid-qr-codenfc-tag/</feedburner:origLink></item>
		<item>
		<title>CodeMash Nuggets</title>
		<link>http://feedproxy.google.com/~r/DavidTruxall/~3/sqsITKfQcYk/</link>
		<comments>http://blog.davidtruxall.com/2012/01/15/codemash-nuggets/#comments</comments>
		<pubDate>Sun, 15 Jan 2012 22:13:18 +0000</pubDate>
		<dc:creator>davetrux</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Reviews]]></category>

		<guid isPermaLink="false">http://blog.davidtruxall.com/?p=199</guid>
		<description><![CDATA[This year I was fortunate enough to attend CodeMash in Ohio. Just like last time, it was an amazing experience. The speakers, the venue, the food, the folks in attendance. All of it made for a great experience. I learned, I laughed, I left exhausted. General Observations I went to mostly mobile-oriented talks, and over [...]]]></description>
				<content:encoded><![CDATA[<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px" title="codemash2010" border="0" alt="codemash2010" src="http://blog.davidtruxall.com/wp-content/uploads/2012/01/codemash2010.png" width="244" height="124">
<p style="align: left">This year I was fortunate enough to attend <a href="http://www.codemash.org/">CodeMash</a> in Ohio. Just like last time, it was an amazing experience. The speakers, the venue, the food, the folks in attendance. All of it made for a great experience. I learned, I laughed, I left exhausted.</p>
<h2>General Observations</h2>
<p>I went to mostly mobile-oriented talks, and over a two day period every single speaker I watched used a Mac. On top of that, all the presentations were very minimalist. I don’t know if that’s the tools on the platform or folks finally rejecting the glitz of PowerPoint and focusing on content. I hope it’s the latter. Sales folks take note.</p>
<p>Mobile developers are actively rejecting the BlackBerry platform. One even pointed out how his company just stopped accepting work for that platform. Another who was building a mobile product pointed out that the expense of supporting the BlackBerry platform across three different active versions was too much. Has any technology died so publicly?</p>
<p>In the Java-oriented talks I saw, there was very little <a href="http://www.eclipse.org">Eclipse</a>. Mostly I saw <a href="http://www.jetbrains.com/idea/">IntelliJ Idea</a>. This was interesting for me, because I love <a href="http://www.jetbrains.com/resharper/">ReSharper</a> for .Net work, and have been using <a href="http://www.jetbrains.com/webstorm/">WebStorm</a> for HTML5/JavaScript coding.</p>
<h2>Notable Quotes</h2>
<p>As always, there were a number of notable quotes that summed up so many aspects of what was being conveyed.</p>
<h3><a href="http://www.tedneward.com/">Ted Neward</a>, Keynote Address</h3>
<p>“Reject the Goal of Reuse”</p>
<p>I’ve been seeing this message more and more lately. Reuse happens so rarely unless you are actually building a library, that otherwise you are probably wasting effort and introducing bugs by striving for reuse in code that was not necessarily intended for reuse.</p>
<p>“Best practices are merely average”&nbsp; “Best practices == avoid thinking”</p>
<p>The bigger the company, the more they care about best practices. So there will be fewer risks, fewer rewards, and overall mediocre results. Seen it, sadly still living it.</p>
<p>“Reject the temptation of the familiar”</p>
<p>I’ve been working on this one for almost the last year. I’m learning the mobile paradigm, learning Java, writing services in something other than .Net. I am very surprised how much I had blinders on when I was immersed in Microsoft-only development.</p>
<h3><a href="https://twitter.com/#!/wpugh">Bill Pugh</a>, Effective Use of <a href="http://findbugs.sourceforge.net/">FindBugs</a> in Large Software Development Efforts</h3>
<p>“The challenge for FindBugs is to find the intersection of stupid and important.”</p>
<p>I have long been a fan of automated tools for helping me tighten up code. His quote sums up the intent perfectly, finding the stupid mistakes you may have made that could result in important problems in your code.</p>
<h3><a href="https://twitter.com/#!/tedneward">Ted Neward</a>, Android: Where You Can Stick Data</h3>
<p>Answering questions about SQLite on Android: “It’s not Oracle, and if you treat it like it is you’re doing it wrong.”</p>
<p>Understand your platform and user paradigm. Enough said.</p>
<h3><a href="https://twitter.com/#!/BruceEckel">Bruce Eckel</a>, Polyglot Programming: The Power of Hybridization</h3>
<p>“You don’t know where the difficult parts will be”</p>
<p>So don’t plan to optimize anywhere, you won’t be right ahead of time. I have seen this myself more than once. The real trouble isn’t visible at the beginning. See any article on estimating for another aspect of this issue.</p>
<p>“Typing is noise”</p>
<p>Bruce favors languages with minimalist syntax, believing those languages express your solutions clearly for those who come after to read your code. This has inspired me to start learning Python.</p>
<p>“Go will replace C++ as the low-level language used in high performance applications”</p>
<p>I’m recording this for posterity. Bruce says he’s remarkably good at predicting these things, even though no one listens. I’ve read some of his work and have faith, so you read it here first.</p>
<h3><a href="http://www.reinventing-business.com/">Bruce Eckel</a>, Reinventing Business</h3>
<p>“The best people would be leaving companies all around you to come work for you if you were hiring <em>the best</em>”</p>
<p>There is a metric for your recruiting staff.</p>
<h2>Geeks Are Funny</h2>
<p>After dinner on Thursday, there was a <a href="http://en.wikipedia.org/wiki/Pecha_Kucha">Pecha Kucha</a> competition which was great entertainment, hosted by the inimitable <a href="http://www.hanselman.com/blog/">Scott Hanselman</a>, with a geek celebrity panel of judges consisting of <a href="https://twitter.com/#!/tedneward">Ted Neward</a>, <a href="https://twitter.com/#!/julielerman">Julie Lerman</a>, and <a href="https://twitter.com/#!/keithelder">Keith Elder</a>. The winner was <a href="https://twitter.com/#!/rubybuddha">Leon Gersing</a>, the heartfelt and real @rubybudda. Here are a couple cell phone videos of the event:</p>
<p><a href="https://twitter.com/#!/jonskeet">Jon Skeet</a> <a href="http://www.youtube.com/watch?v=xDTJ6iVgMWs">Coding in the Style of Glee</a></p>
<p><a href="http://www.youtube.com/watch?v=BrcC2nhXExI&#038;feature=youtu.be">Mel Grubb Urinal Rules</a></p>
<p><a href="https://twitter.com/#!/rubybuddha">Leon Gersing</a> <a href="http://www.youtube.com/watch?v=0fm-Qnt4bYc">On Love</a>&nbsp;&nbsp;<a href="http://www.youtube.com/watch?v=GwqaXoQWJ1s&amp;list=UUAYF64PsCJI01QR8iIZIPdQ&amp;index=1&amp;feature=plcp">Tiebreaker</a> (Talking to a set of slides he’s never seen before)</p>
<p>Just as good as the talks was the Twitter stream on the big screen behind the presenters. You see a brief glimpse of it at the beginning of Jon’s talk. <a href="https://twitter.com/#!/davetrux/status/157625020590469120">Geeks are funny</a>.<a href="http://www.codemash.org/"></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.davidtruxall.com/2012/01/15/codemash-nuggets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.davidtruxall.com/2012/01/15/codemash-nuggets/</feedburner:origLink></item>
	</channel>
</rss>
