<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mike Bosch</title>
	<atom:link href="http://mikebosch.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://mikebosch.net</link>
	<description>Integrating web, mobile and enterprise software development with a pragmatic approach</description>
	<lastBuildDate>Mon, 23 Apr 2012 15:15:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Windows VPS Hosting Recommendation (if you&#8217;re on a budget)</title>
		<link>http://mikebosch.net/2012/04/best-windows-vps-hosting-budget/</link>
		<comments>http://mikebosch.net/2012/04/best-windows-vps-hosting-budget/#comments</comments>
		<pubDate>Mon, 23 Apr 2012 15:15:49 +0000</pubDate>
		<dc:creator>Michael Bosch</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[hosting]]></category>

		<guid isPermaLink="false">http://mikebosch.net/?p=943</guid>
		<description><![CDATA[I have been using shared web hosting services for several years now. As an early adopter of ASP.NET MVC &#8211; as far back as the first CTP &#8211; I needed to research several that met my requirements and beta-phase experimentation. One of my most popular blog posts was actually my recommendation for cheap shared hosting....<a href="http://mikebosch.net/2012/04/best-windows-vps-hosting-budget/">&#187;</a>]]></description>
			<content:encoded><![CDATA[<p>I have been using shared web hosting services for several years now. As an early adopter of ASP.NET MVC &#8211; as far back as the first CTP &#8211; I needed to research several that met my requirements and beta-phase experimentation. One of my most popular blog posts was actually <a href="http://mikebosch.net/2008/07/asp-net-hosting-recommendation-if-youre-on-a-budget/">my recommendation for cheap shared hosting</a>. Since then, I have been running several other sites and figured it was time to graduate to a Virtual Private Server (VPS).</p>
<p>I considered using a cloud solution, but I don&#8217;t think that kind of scaling will be necessary at this point.  It is also fairly expensive and may fluctuate depending on usage.  So I opted to use a fixed price VPS host.  There are many, many offering available but the most economical which still provide a full feature set, and the one I ultimately choose was  <a href="http://bit.ly/windows-vps-hosting">VPSLAND.com</a>.  Like I mentioned in my original shared hosting post, I wouldn&#8217;t post about a hosting company unless they really impressed me.  That is still true here.  I believe they have the best VPS hosting out there for any Windows-based projects.  I think a lot of it has to do with the fact that their main focus is VPS.</p>
<p>Their starter package costs a very reasonable $17.99 a month for a Windows 2008 Server and includes full root, remote desktop access, support, backups etc.  They also have promotions from time to time and I believe they currently have 50% off the first month.  Check them out:  <a href="http://bit.ly/windows-vps-hosting">http://www.vpsland.com</a>.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://mikebosch.net/2012/04/best-windows-vps-hosting-budget/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Search Stored Procedure Text for a Specific String</title>
		<link>http://mikebosch.net/2011/08/how-to-search-stored-procedure-text-for-a-specific-string/</link>
		<comments>http://mikebosch.net/2011/08/how-to-search-stored-procedure-text-for-a-specific-string/#comments</comments>
		<pubDate>Thu, 18 Aug 2011 19:25:04 +0000</pubDate>
		<dc:creator>Michael Bosch</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://mikebosch.net/?p=926</guid>
		<description><![CDATA[Thought this would be useful to some and for me to reference on future projects. DECLARE @SEARCHSTRING VARCHAR(255) SELECT @SEARCHSTRING = 'some string' SELECT DISTINCT sysobjects.name AS [Object Name] , case when sysobjects.xtype = 'P' then 'Stored Proc' when sysobjects.xtype = 'TF' then 'Function' when sysobjects.xtype = 'TR' then 'Trigger' end as [Object Type] FROM...<a href="http://mikebosch.net/2011/08/how-to-search-stored-procedure-text-for-a-specific-string/">&#187;</a>]]></description>
			<content:encoded><![CDATA[<p>Thought this would be useful to some and for me to reference on future projects.</p>
<p><code><br />
DECLARE @SEARCHSTRING VARCHAR(255)<br />
SELECT @SEARCHSTRING = 'some string'<br />
SELECT DISTINCT sysobjects.name AS [Object Name] ,<br />
case when sysobjects.xtype = 'P' then 'Stored Proc'<br />
when sysobjects.xtype = 'TF' then 'Function'<br />
when sysobjects.xtype = 'TR' then 'Trigger'<br />
end as [Object Type]<br />
FROM sysobjects,syscomments<br />
WHERE sysobjects.id = syscomments.id<br />
AND sysobjects.type in ('P','TF','TR')<br />
AND sysobjects.category = 0<br />
AND CHARINDEX(@SEARCHSTRING,syscomments.text)&gt;0<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://mikebosch.net/2011/08/how-to-search-stored-procedure-text-for-a-specific-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tips for Geographically Distributed Scrum Teams</title>
		<link>http://mikebosch.net/2011/02/tips-for-geographically-distributed-scrum-teams/</link>
		<comments>http://mikebosch.net/2011/02/tips-for-geographically-distributed-scrum-teams/#comments</comments>
		<pubDate>Tue, 22 Feb 2011 15:34:16 +0000</pubDate>
		<dc:creator>Michael Bosch</dc:creator>
				<category><![CDATA[Agile / Scrum]]></category>
		<category><![CDATA[Agile]]></category>
		<category><![CDATA[scrum]]></category>

		<guid isPermaLink="false">http://mikebosch.net/?p=899</guid>
		<description><![CDATA[Most agile practitioners have heard about the importance of having your scrum teams in a shared, co-located space. The team collaboration and high-level of communication that co-location provides is a large success factor for agile projects. But what if you live in the real world and your team is geographically distributed. Although it certainly poses...<a href="http://mikebosch.net/2011/02/tips-for-geographically-distributed-scrum-teams/">&#187;</a>]]></description>
			<content:encoded><![CDATA[<p>Most agile practitioners have heard about the importance of having your scrum teams in a shared, co-located space.  The team collaboration and high-level of communication that co-location provides is a large success factor for agile projects.  But what if you live in the real world and your team is geographically distributed.  Although it certainly poses unique challenges, you can still provide your team with a collaborative experience by implementing some simple practices.</p>
<h3>The Tele-Window</h3>
<p>If you have the bandwidth for it, I highly recommend setting up a high quality webcam conferencing solution to provide a window into each location&#8217;s department.  This should provide ample face-time with your team members and provide a great venue for impromptu meetings.  You can glance over at the &#8220;window&#8221; and see if team members are chatting.  You can chime in or they can call out to you when they see you back at your desk.  This window also comes in handy for the next tip, the roll-away scrum board.</p>
<h3>Roll-away Scrum Boards</h3>
<p>Depending on how many scrum teams you have, you can roll scrum boards within the viewport of your tele-window just before the daily standup for that project. At the end of the daily standup, you can take a screenshot of the scrum board and post it on a team wiki or other web-based tool.</p>
<h3>Virtual Pair-Programming</h3>
<p>As a big advocate of XP practices, I cannot overstate how important it is to have at least some pair-programming sessions with other team members.  Although difficult, it is possible to have a decent pair-programming session with geographically distributed team members.  If you&#8217;re on a Mac, you can use iChat to share the screen with your partner.  Make sure you&#8217;ve got some voice communication so you can decide who is driving and when.  Two people moving the mouse in all different directions simultaneouly is rather annoying.  On Windows, you can use the Windows Remote Assistance, <a href="http://connect.microsoft.com/site94">Microsoft SharedView</a> or download a third-party tool.</p>
<p>The most important factor to ensure success of your agile development projects in communication with your team members.  When your team is geographically distributed you&#8217;ll find challenges in your execution.  Make sure to be innovative and use the technology available to you in order to foster high levels of collaboration.</p>
]]></content:encoded>
			<wfw:commentRss>http://mikebosch.net/2011/02/tips-for-geographically-distributed-scrum-teams/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Develop Your Own Live Streaming API on ASP.NET</title>
		<link>http://mikebosch.net/2011/01/develop-your-own-live-streaming-api-asp-net/</link>
		<comments>http://mikebosch.net/2011/01/develop-your-own-live-streaming-api-asp-net/#comments</comments>
		<pubDate>Thu, 20 Jan 2011 13:39:20 +0000</pubDate>
		<dc:creator>Michael Bosch</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[streaming api]]></category>

		<guid isPermaLink="false">http://mikebosch.net/?p=784</guid>
		<description><![CDATA[In a previous post, we looked at how to consume a live streaming API from Twitter.  That was great and all, but you&#8217;re not going to become the next Twitter by consuming content &#8212; you need to have your own live streaming API.  In this post we&#8217;ll look at how to create a basic streaming...<a href="http://mikebosch.net/2011/01/develop-your-own-live-streaming-api-asp-net/">&#187;</a>]]></description>
			<content:encoded><![CDATA[<p>In a previous post, we looked at <a href="http://mikebosch.net/2011/01/processing-twitter-streaming-api-in-net/">how to consume a live streaming API from Twitter</a>.  That was great and all, but you&#8217;re not going to become the next Twitter by consuming content &#8212; you need to have your own live streaming API.  In this post we&#8217;ll look at how to create a basic streaming API that others can open a streaming connection to and get real-time updates.</p>
<p>So, what groundbreaking web service will we be exposing to the masses?  We&#8217;ll be streaming the web server&#8217;s current datetime!  Ingenious, I know!  Hopefully, you&#8217;ll be able to adapt this to a slightly more engaging experience.</p>
<p>To start, let&#8217;s just take an ASP.NET MVC project and code the default controller action.  We clear all the headers of the response and add the &#8220;application/json&#8221; header.  Since we won&#8217;t be returning a view in the traditional sense of ASP.NET MVC, we don&#8217;t have to create an actual view.  We&#8217;ll just pause the thread for 1 second and then return the current timestamp for as long as the service is running.</p>
<p><a href="http://mikebosch.net/wp-content/uploads/2011/01/sample.png"><img class="alignnone size-full wp-image-866" title="sample" src="http://mikebosch.net/wp-content/uploads/2011/01/sample.png" alt="" width="636" height="296" /></a></p>
<p>On the consumer side, we&#8217;ll just refactor the code we had in the previous post to connect to the URL of the project we just created.  I&#8217;m running in on the local development machine so your port will likely be different.</p>
<p><a href="http://mikebosch.net/wp-content/uploads/2011/01/sample-consumer.png"><img class="alignnone size-full wp-image-867" title="sample-consumer" src="http://mikebosch.net/wp-content/uploads/2011/01/sample-consumer.png" alt="" width="647" height="509" /></a></p>
<p>You&#8217;ll notice we added some exception handling logic in case we lose our connection to our streaming API.  In this case, we&#8217;ll just keep trying to re-connect to the stream.  I&#8217;ll show you a sample of this in the last part of the post.</p>
<p>Once we have all the bits in place, we run the ASP.NET MVC application first so it is ready to start handling requests.  Then, we create multiple instances of our consumer console application to simulate multiple clients connecting to the streaming API.  You&#8217;ll end up seeing something like this:</p>
<p><a href="http://mikebosch.net/wp-content/uploads/2011/01/console.png"><img class="alignnone size-full wp-image-868" title="console" src="http://mikebosch.net/wp-content/uploads/2011/01/console.png" alt="" width="362" height="355" /></a></p>
<p>To simulate what would happen on the consumer side if there was a broken connection or other exception on the server side, I killed the local development server for a few seconds and then restarted it.  Below you can see that we recovered after a few exception handling loops.</p>
<p><a href="http://mikebosch.net/wp-content/uploads/2011/01/kill-restore.png"><img class="alignnone size-full wp-image-869" title="kill-restore" src="http://mikebosch.net/wp-content/uploads/2011/01/kill-restore.png" alt="" width="445" height="313" /></a></p>
<p>Of course, this post was just intended to provide a possible option for implementing a streaming API with ASP.NET MVC.  For a more realistic scenario you would likely have a queue listener around our Thread.Sleep() code.  As messages are picked up from the queue, you could stream it out and immediately start listening for the next message on the queue.</p>
<p>In a follow-up post, I will demo this same concept using Node.js.</p>
<p>Hope this helps.</p>
]]></content:encoded>
			<wfw:commentRss>http://mikebosch.net/2011/01/develop-your-own-live-streaming-api-asp-net/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using the Twitter Streaming API for Real-time Analysis in .NET</title>
		<link>http://mikebosch.net/2011/01/using-twitter-streaming-api-real-time-analysis-net-sql/</link>
		<comments>http://mikebosch.net/2011/01/using-twitter-streaming-api-real-time-analysis-net-sql/#comments</comments>
		<pubDate>Wed, 12 Jan 2011 02:34:24 +0000</pubDate>
		<dc:creator>Michael Bosch</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Social Networking]]></category>
		<category><![CDATA[social media]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[streaming api]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://mikebosch.net/?p=796</guid>
		<description><![CDATA[In a previous post, we saw how easy it was to start consuming the Twitter Streaming API and display the messages on a console window. In this post, we&#8217;ll take it a step further and try to derive some useful information about the the activity stream on Twitter in real-time. I&#8217;ve given myself a hypothetical...<a href="http://mikebosch.net/2011/01/using-twitter-streaming-api-real-time-analysis-net-sql/">&#187;</a>]]></description>
			<content:encoded><![CDATA[<p>In a <a href="http://mikebosch.net/2011/01/processing-twitter-streaming-api-in-net/">previous post</a>, we saw how easy it was to start consuming the Twitter Streaming API and display the messages on a console window.  In this post, we&#8217;ll take it a step further and try to derive some useful information about the the activity stream on Twitter in real-time.  I&#8217;ve given myself a hypothetical goal of deriving an answer to the following question:</p>
<p><strong>Which Twitter users are mentioned most often when a given keyword is included in the tweet?</strong></p>
<p>How useful is this information?  One idea could be to identify influencers in real time when you&#8217;re expecting a sudden increase in a keyword or hashtag for a sponsored event or TV spot.  If people are mentioning a particular user over and over again with your brand in it, you could connect with that user and help spread your message.</p>
<h2>Let&#8217;s Get Started</h2>
<p>For demonstration purposes, the components I&#8217;ll be building include:</p>
<ol>
<li>twitter_stream_db (SQL Server Database) &#8211; This will store the mention count for individual users</li>
<li><del datetime="2011-01-05T16:17:48+00:00">MSMQ &#8211; I&#8217;ll be creating a queue that will be sent messages from the Twitter Streaming API.</del> I&#8217;m going to leave this for a future post since I&#8217;m just doing a POC at this point.  If I were to even consider using this in production I would definitely develop a queuing system but at this time it&#8217;s a bit of overkill.</li>
<li>TwitterReader (console) &#8211; A small application that will read the Twitter API and drop messages into an MSMQ channel.</li>
<li><del datetime="2011-01-05T16:19:23+00:00">TwitterWriter (console) &#8211; A small application that will read messages from MSMQ and update the database</del> No MSMQ as explained above so no need to read off the queue.  Again, I&#8217;ll write these components so we can scale in a later post.  For now, consider this just a POC</li>
</ol>
<h3>TwitterReader</h3>
<p>This will be a slightly modified version of the console application we created in the <a href="http://mikebosch.net/2011/01/processing-twitter-streaming-api-in-net/">previous post</a>.  Instead of writing to a console window, we&#8217;re going to parse the JSON objects using Json.net and then insert users mentioned in the tweet into a table using the SQL MERGE command.</p>
<p>Looking at the code, you&#8217;ll see we modified the stream URL slightly to include the keyword we want to track and sending that JSON result to a new method ParseJson.   In this case, let&#8217;s see who are the most popular users mentioned every time someone tweets something with the keyword &#8220;love&#8221; in it.   (I know it sounds corny but I needed something popular so that I can show off the results.)</p>
<p><a href="http://mikebosch.net/wp-content/uploads/2011/01/1-11-2011-9-16-24-PM1.png"><img class="alignnone size-full wp-image-860" title="modified code with stream" src="http://mikebosch.net/wp-content/uploads/2011/01/1-11-2011-9-16-24-PM1.png" alt="" width="596" height="295" /></a></p>
<p>We&#8217;re using <a href="http://james.newtonking.com/pages/json-net.aspx">Json.net&#8217;s Linq to Json feature</a> to navigate to the user_mentions array.  Once we have it, we just loop through all the users in the array and MERGE them into the database table through the stored procedure (see below).</p>
<h3>twitter_stream_db</h3>
<p>For simplicity, I&#8217;m going to create a single table to store the data as it comes in.  The primary key is the Twitter user&#8217;s id since there should be only one record per user at any given time.</p>
<p>I used the new MERGE command to perform an &#8220;upsert&#8221; of the data.  If its the first time the user has been mentioned, it will perform an insert and set the mention_count to 1.  Otherwise, we&#8217;ll update the record by setting mention_count to mention_count + 1.</p>
<p><a href="http://mikebosch.net/wp-content/uploads/2010/12/table_columns.png"><img class="alignnone size-full wp-image-807" title="SQL table design" src="http://mikebosch.net/wp-content/uploads/2010/12/table_columns.png" alt="" width="359" height="163" /></a></p>
<p>Since I&#8217;m using the MERGE command, I encapsulated it into a stored procedure as oppose to writing LINQ queries.  The stored procedure receives a user id and twitter name and performs the insert/update logic.</p>
<p><a href="http://mikebosch.net/wp-content/uploads/2010/12/stored_procedure.png"><img class="alignnone size-full wp-image-808" title="stored procedure" src="http://mikebosch.net/wp-content/uploads/2010/12/stored_procedure.png" alt="" width="485" height="301" /></a></p>
<p>The <a href="http://technet.microsoft.com/en-us/library/bb510625.aspx">MERGE command</a> is an incredibly useful feature introduced in SQL Server 2008.</p>
<h3>Parsing the JSON Result</h3>
<p>As mentioned above,  we&#8217;re just going to parse the JSON object and iterate through the users mentioned in the tweet.  As we do that, we&#8217;ll pass the users into the stored procedure above and MERGE the data into the SQL table.</p>
<p><a href="http://mikebosch.net/wp-content/uploads/2011/01/1-11-2011-9-10-45-PM.png"><img class="alignnone size-full wp-image-839" title="parsing json with json.net" src="http://mikebosch.net/wp-content/uploads/2011/01/1-11-2011-9-10-45-PM.png" alt="" width="709" height="310" /></a><br />
<strong>Important:  Since we&#8217;re not using a queuing system, the rate at which we can process tweets will depend largely on the speed of our SQL stored procedure.  If you&#8217;re considering something similar in a production environment, please implement a queuing system to handle the load</strong></p>
<h3>Results</h3>
<p>Once you start running the application, you&#8217;ll start to see Twitter ids and screen names appearing on the console window.  Let it run for a few minutes and, depending on the popularity of your search term, you should start to see some results.  You can then go to SQL Server Management Studio and run a simple query to get a view of the activity on Twitter for that keyword / user mention combination.</p>
<p><a href="http://mikebosch.net/wp-content/uploads/2011/01/1-11-2011-9-20-36-PM.png"><img class="alignnone size-full wp-image-846" title="sql results for twitter mentions" src="http://mikebosch.net/wp-content/uploads/2011/01/1-11-2011-9-20-36-PM.png" alt="" width="332" height="385" /></a></p>
<p>Hope you enjoyed this post and have some ideas for implementing something similar with your next social media and Twitter campaigns!</p>
]]></content:encoded>
			<wfw:commentRss>http://mikebosch.net/2011/01/using-twitter-streaming-api-real-time-analysis-net-sql/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Processing Twitter&#8217;s Streaming API in .NET (with under 10 lines of code!)</title>
		<link>http://mikebosch.net/2011/01/processing-twitter-streaming-api-in-net/</link>
		<comments>http://mikebosch.net/2011/01/processing-twitter-streaming-api-in-net/#comments</comments>
		<pubDate>Tue, 04 Jan 2011 14:31:31 +0000</pubDate>
		<dc:creator>Michael Bosch</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[streaming api]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://mikebosch.net/?p=775</guid>
		<description><![CDATA[Several social networking sites including Twitter and Digg have implemented some form of a streaming API. This is an emerging pattern with many high-volume content providers. At first glance, a streaming API may seem to be more resource intensive than traditional polling API, but as discussed here, it is actually much more streamlined. Most of...<a href="http://mikebosch.net/2011/01/processing-twitter-streaming-api-in-net/">&#187;</a>]]></description>
			<content:encoded><![CDATA[<p>Several social networking sites including Twitter and Digg have implemented some form of a streaming API. This is an emerging pattern with many high-volume content providers.  At first glance, a streaming API may seem to be more resource intensive than traditional polling API, but as discussed here, it is actually much more streamlined.</p>
<p>Most of these server implementations use some sort of queuing system and a long-lived HTTP connection which clients use to have data delivered in near-realtime.  In this post, I&#8217;m going to demonstrate just how easy it is to hook into the Twitter Streaming API.  Specifically, we&#8217;ll be using the <code>streaming/filter</code> method to consume any tweets which match a filter condition in realtime.  I&#8217;m sure you can think of some neat ideas that can leverage this concept!</p>
<p>To demonstrate, let&#8217;s just create a console application in Visual Studio.  We&#8217;re going to create a simple <code>WebRequest</code> to connect and just start reading the stream.  Then, we&#8217;ll just print out the json result to the console window.  I&#8217;ll leave it up to you to write some parsing logic to actually do something with the data.</p>
<p><a href="http://mikebosch.net/wp-content/uploads/2010/12/code.png"><img class="alignnone size-full wp-image-817" title="code for consuming stream" src="http://mikebosch.net/wp-content/uploads/2010/12/code.png" alt="" width="717" height="348" /></a></p>
<p>That&#8217;s all there is to it!   Your output on the console window will look like this:</p>
<p><a href="http://mikebosch.net/wp-content/uploads/2010/12/console.png"><img class="alignnone size-full wp-image-818" title="results in console window" src="http://mikebosch.net/wp-content/uploads/2010/12/console.png" alt="" width="679" height="340" /></a></p>
<p>What you do with the data is where the real magic happens.  The last I heard Twitter was producing somewhere in the range of 1000 tweets per second and I&#8217;m sure its much higher than that now.  You will probably want to implement message queuing system where you hand of the response as soon as possible for some other process to handle without blocking the incoming stream.</p>
<p>In a future post I&#8217;ll describe some neat ideas for what you can do with the data from the stream.</p>
<p>Hope this helps.</p>
]]></content:encoded>
			<wfw:commentRss>http://mikebosch.net/2011/01/processing-twitter-streaming-api-in-net/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to Implement a Load More Button on iPhone iOS with Three20 &#8211; Part 1</title>
		<link>http://mikebosch.net/2010/12/how-to-implement-load-more-button-iphone-ios-three20-1/</link>
		<comments>http://mikebosch.net/2010/12/how-to-implement-load-more-button-iphone-ios-three20-1/#comments</comments>
		<pubDate>Mon, 20 Dec 2010 15:19:03 +0000</pubDate>
		<dc:creator>Michael Bosch</dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[three20]]></category>

		<guid isPermaLink="false">http://mikebosch.net/?p=670</guid>
		<description><![CDATA[A common pattern in iPhone applications that load data remotely in a table is to utilize a button at the bottom of the table with a &#8220;Load More&#8221; label.  Typically, when you click on the Load More button, a request is made to the server to download additional items.  This form of lazy loading enhances...<a href="http://mikebosch.net/2010/12/how-to-implement-load-more-button-iphone-ios-three20-1/">&#187;</a>]]></description>
			<content:encoded><![CDATA[<p>A common pattern in iPhone applications that load data remotely in a table is to utilize a button at the bottom of the table with a &#8220;Load More&#8221; label.  Typically, when you click on the Load More button, a request is made to the server to download additional items.  This form of lazy loading enhances the user experience and improves application performance.</p>
<p>I knew Three20 handled this scenario but I couldn&#8217;t find a good example that walked through each component that was required to implement it.  It was a challenge to get all the bits to work together so here is my breakdown in case others are facing a similar challenge.  I&#8217;m going to divide the post into two parts.  In part 1 we&#8217;ll just hook up the classes with each other then in part 2 we&#8217;ll implement the actual request / response logic.</p>
<p>If you&#8217;re not familiar with the <a href="http://three20.info/">Three20 library</a>, I highly recommend you take a look at it for your iPhone / iPad projects.  For this example, I&#8217;ll assume you have integrated Three20 into your project already and are somewhat familiar with the library.</p>
<p>To demonstrate the load more feature we&#8217;ll be doing a simple integration to display my public Twitter timeline with paging.  Since my timeline doesn&#8217;t require authentication, we won&#8217;t have to get bogged down with implementing the OAuth protocol.  Now, let&#8217;s look at the players:</p>
<h4>TTTableViewController</h4>
<p>To start, let&#8217;s add a subclass of the TTTableViewController.  This will just provide us with a base controller with a table view to utilize for demonstration purposes.  In addition, we&#8217;re going to stub in a class which will serve as the datasource for this controller.</p>
<pre>MBTwitterController</pre>
<div id="attachment_759" class="wp-caption alignnone" style="width: 417px"><a href="http://mikebosch.net/wp-content/uploads/2010/12/Screen-shot-2010-12-18-at-3.46.51-PM.png"><img class="size-full wp-image-759" title="TTTableViewController" src="http://mikebosch.net/wp-content/uploads/2010/12/Screen-shot-2010-12-18-at-3.46.51-PM.png" alt="" width="407" height="195" /></a><p class="wp-caption-text">Subclass of TTTableViewController</p></div>
<p>That&#8217;s pretty much all you have to do within the tableviewcontroller thanks to Three20 encapsulating a lot of the delegate logic into the datasource object.  Now, let&#8217;s create the datasource for the table.</p>
<h4>TTListDataSource</h4>
<p>If you&#8217;ve worked with Three20 and table implementations, you&#8217;re probably familiar with this class.  Again, we&#8217;ll subclass it to create a new datasource object which will be consumed by our table view controller.  We&#8217;ll also add some code which will work with the TTURLRequestModel.</p>
<div id="attachment_765" class="wp-caption alignnone" style="width: 437px"><a href="http://mikebosch.net/wp-content/uploads/2010/12/Screen-shot-2010-12-18-at-3.55.51-PM.png"><img class="size-full wp-image-765" title="Subclass of TTListDataSource" src="http://mikebosch.net/wp-content/uploads/2010/12/Screen-shot-2010-12-18-at-3.55.51-PM.png" alt="" width="427" height="238" /></a><p class="wp-caption-text">Subclass of TTListDataSource</p></div>
<p>A few things are going on in this class.  First, we allocate the TTURLRequestModel which we&#8217;ll add in just a minute.  We also implement the model method which we&#8217;ll set to the TTURLRequestModel above.  This is <em>very important</em> if you want to keep your sanity trying to debug later on.  Below is the header file for the class.</p>
<pre>MBTwitterDataSource.h

@interface MBTwitterDataSource : TTListDataSource {
	  MBTwitterRequestModel* _twitterFeedModel;
}
@end
</pre>
<h4>TTURLRequestModel</h4>
<p>The last class we&#8217;re going to create will be a subclass of the TTURLRequestModel.  This class will encapsulate all the network operations to interact with the Twitter API.</p>
<pre>MBTwitterRequestModel

@interface MBTwitterRequestModel : TTURLRequestModel {
}
@end
</pre>
<p>These are all the classes involved in getting this to work.  In the next part, we&#8217;ll look at writing the code to interact with the Twitter API and how to actually add the &#8220;Load More&#8221; button to the table cells.</p>
]]></content:encoded>
			<wfw:commentRss>http://mikebosch.net/2010/12/how-to-implement-load-more-button-iphone-ios-three20-1/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Agile User Stories Tip: Always Include a Role Name</title>
		<link>http://mikebosch.net/2010/12/agile-user-stories-tip-always-include-role-name/</link>
		<comments>http://mikebosch.net/2010/12/agile-user-stories-tip-always-include-role-name/#comments</comments>
		<pubDate>Wed, 15 Dec 2010 14:32:51 +0000</pubDate>
		<dc:creator>Michael Bosch</dc:creator>
				<category><![CDATA[Agile / Scrum]]></category>
		<category><![CDATA[Agile]]></category>

		<guid isPermaLink="false">http://mikebosch.net/?p=686</guid>
		<description><![CDATA[One of the most popular formats for writing agile user stories follows this template: As a [role], I want to [feature] so that [goal] Many organizations translate this into a spreadsheet where each column represents a different field the story writer can fill in: I have used this template on almost every agile project I...<a href="http://mikebosch.net/2010/12/agile-user-stories-tip-always-include-role-name/">&#187;</a>]]></description>
			<content:encoded><![CDATA[<p>One of the most popular formats for writing agile user stories follows this template:</p>
<p><em>As a [role], I want to [feature] so that [goal]</em></p>
<p>Many organizations translate this into a spreadsheet where each column represents a different field the story writer can fill in:</p>
<p><a href="http://mikebosch.net/wp-content/uploads/2010/12/12-9-2010-4-29-29-PM.png"><img class="alignnone size-full wp-image-692" title="Excel template for user stories" src="http://mikebosch.net/wp-content/uploads/2010/12/12-9-2010-4-29-29-PM.png" alt="" width="464" height="225" /></a></p>
<p>I have used this template on almost every agile project I have participated in.  For the most part, it works very well.  It typically provides a great launch point for additional discussions before it makes it into a sprint.</p>
<p>One of the most common mistakes I see when introducing the template (and agile stories in general) to a new team is a tendency to define every role as just a generic &#8220;user&#8221;.  For example, I&#8217;ve seen user stories as generic as:</p>
<p>&#8220;As a user, I want to upload photos to a library so that I can use them on a post&#8221;</p>
<p>Although its syntactically correct, it is vital that we define a <em>role</em> and not a &#8220;seat&#8221; on the system.  A more valuable user story would look like this:</p>
<p>&#8220;As a <del datetime="2010-12-09T21:14:44+00:00">user</del> <del datetime="2010-12-09T21:14:44+00:00">designer</del> content author, I want to upload photos to a library so that I can use them on a post&#8221;</p>
<p>Notice how this story now has a better context of who will be using the feature and how.  This could provide valuable insight into the intended audience and how best to implement the feature &#8212; a designer may imply more advanced features while a content author would use the image as is.</p>
<p><strong>Always avoid the generic &#8220;user&#8221; role in your user stories.</strong></p>
<p>Hope this helps.</p>
]]></content:encoded>
			<wfw:commentRss>http://mikebosch.net/2010/12/agile-user-stories-tip-always-include-role-name/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Dell Launches &#8216;Social Media Listening Command Center&#8217;</title>
		<link>http://mikebosch.net/2010/12/dell-launches-social-media-listening-command-center/</link>
		<comments>http://mikebosch.net/2010/12/dell-launches-social-media-listening-command-center/#comments</comments>
		<pubDate>Fri, 10 Dec 2010 13:53:39 +0000</pubDate>
		<dc:creator>Michael Bosch</dc:creator>
				<category><![CDATA[Social Networking]]></category>
		<category><![CDATA[radian6]]></category>
		<category><![CDATA[social media]]></category>

		<guid isPermaLink="false">http://mikebosch.net/?p=703</guid>
		<description><![CDATA[These kinds of projects are surely a sign of things to come. More and more executives are realizing the value of social media as a robust, scalable and (relatively) inexpensive channel for marketing their brands and generating demand for their products.]]></description>
			<content:encoded><![CDATA[<p>These kinds of projects are surely a sign of things to come.  More and more executives are realizing the value of social media as a robust, scalable and (relatively) inexpensive channel for marketing their brands and generating demand for their products.  </p>
<p><object width="540" height="390"><param name="movie" value="http://www.youtube.com/v/w4ooKojHMkA&#038;hl=en_US&#038;feature=player_embedded&#038;version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.youtube.com/v/w4ooKojHMkA&#038;hl=en_US&#038;feature=player_embedded&#038;version=3" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="540" height="390"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://mikebosch.net/2010/12/dell-launches-social-media-listening-command-center/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASP.NET MVC &#8211; Dynamically Selecting ActionResult Format in JSON or XML</title>
		<link>http://mikebosch.net/2010/12/asp-net-mvc-actionresult-choose-json-xml/</link>
		<comments>http://mikebosch.net/2010/12/asp-net-mvc-actionresult-choose-json-xml/#comments</comments>
		<pubDate>Tue, 07 Dec 2010 14:30:51 +0000</pubDate>
		<dc:creator>Michael Bosch</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[REST]]></category>

		<guid isPermaLink="false">http://mikebosch.net/?p=580</guid>
		<description><![CDATA[I&#8217;ve always been a fan of how Twitter organized their API.  Particulary, I enjoyed being able to change the format of the response by just changing the extension of the URL from JSON to XML.  A typical Twitter API call looks like this: http://api.twitter.com/version/statuses/public_timeline.format So while this public timeline call will return XML: http://api.twitter.com/1/statuses/public_timeline.xml This...<a href="http://mikebosch.net/2010/12/asp-net-mvc-actionresult-choose-json-xml/">&#187;</a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve always been a fan of how Twitter organized <a href="http://apiwiki.twitter.com/w/page/22554679/Twitter-API-Documentation">their API</a>.  Particulary, I enjoyed being able to change the format of the response by just changing the extension of the URL from JSON to XML.  A typical Twitter API call looks like this:</p>
<p>http://api.twitter.com/<em>version</em>/statuses/public_timeline.<em>format</em></p>
<p>So while this public timeline call will return XML:<br />
<a href="http://api.twitter.com/1/statuses/public_timeline.xml" target="_blank">http://api.twitter.com/1/statuses/public_timeline.xml</a></p>
<p>This one would return JSON:<br />
<a href="http://api.twitter.com/1/statuses/public_timeline.json" target="_blank">http://api.twitter.com/1/statuses/public_timeline.json</a></p>
<p>The proper REST way to do this is by changing the headers in your request to ask for a particular file format.  Indeed, an implementation utilizing request headers has already been written.  However, I prefer Twitter&#8217;s implementation which coincidentally seems to be a feature of the Scala / Lift framework.  To accomplish this with ASP.NET MVC, we are going to build an attribute that checks the incoming request and then attempts to render the resulting model in the selected format.</p>
<p>First, some words of caution.  I don&#8217;t think this method will scale if your API / web application takes off.  Although it is a great example of the DRY (don&#8217;t repeat yourself), code-once software development practice, it does somewhat tightly couple your API to your front end.  Twitter <a href="http://groups.google.com/group/twitter-api-announce/browse_thread/thread/2b70bd6ea4aec175?pli=1">faced a similar situation</a> when their API was hosted on the same domain as the web application.  Eventually, Twitter moved the API to api.twitter.com.  This practice allows the API to evolve independently of the front-end of your application.  With that warning in mind, let&#8217;s dive into the code.</p>
<p>They way we&#8217;ll implement this functionaly is to develop a custom action attribute which will check for a &#8220;format&#8221; parameter on each request to decide whether to return the model as a JSON, XML or the default view that the controller will return. This is slightly different from Twitter&#8217;s implementation but it simplifies some of the routing issues we would have with ASP.NET MVC.  Using an API-driven development approach, I&#8217;ll start with an existing controller and add a (non-existent).  This gives me an idea of how it would work.</p>
<p><a href="http://mikebosch.net/wp-content/uploads/2010/12/12-4-2010-10-57-04-AM.png"><img class="alignnone size-full wp-image-652" title="Attribute" src="http://mikebosch.net/wp-content/uploads/2010/12/12-4-2010-10-57-04-AM.png" alt="" width="433" height="180" /></a></p>
<p>I could add some additional parameters at this point to restrict which formats to accept, but we&#8217;ll leave that out for now (KISS &#8211; Keep It Simple Stupid!).  Next we&#8217;ll just generate the class using the smart tag in Visual Studio which will create the stub for it.  We want this action filter to execute before the response is returned to the client but <em>after </em>the data model has been populated.  This implies we&#8217;ll be overriding the OnActionExecuted method:</p>
<p><a href="http://mikebosch.net/wp-content/uploads/2010/12/12-4-2010-11-05-13-AM.png"><img class="alignnone size-full wp-image-653" title="override method" src="http://mikebosch.net/wp-content/uploads/2010/12/12-4-2010-11-05-13-AM.png" alt="" width="739" height="174" /></a></p>
<p>At this point, everything should build.  Our next step is to create two custom ActionResult subclasses which will return either Xml or Json representations of the model you pass in.</p>
<p>ASP.NET MVC includes a JsonResult which we&#8217;ll use for the JSON format.  Although there is no XML equivalent, the MVCContrib library does have an XmlResult class.  You can download the bits <a href="http://mvccontrib.codeplex.com/wikipage?title=Download">here</a> to provide the XmlResult class (along with some other very useful features).  Add the assembly as a reference to your project.</p>
<p>Now we have the two ActionResult&#8217;s we need to implement the solution.  Below is a screenshot of the finished method.  Essentially, we&#8217;re looking into the filter context to find the file extension.  Depending on if it&#8217;s json or xml, we use a different action result serialization technique.</p>
<p><a href="http://mikebosch.net/wp-content/uploads/2010/12/12-4-2010-4-44-47-PM.png"><img class="alignnone size-full wp-image-665" title="final result" src="http://mikebosch.net/wp-content/uploads/2010/12/12-4-2010-4-44-47-PM.png" alt="" width="749" height="577" /></a></p>
<p>Notice that we need to set the JsonRequestBehavior in order for this to work.  There are several security vulnerabilities which you should explore before defaulting this behavior at such a broad level. Phil Haack details some of the issues with JSON Hijacking <a href="http://haacked.com/archive/2009/06/25/json-hijacking.aspx" target="_blank">here</a>.</p>
<p>That&#8217;s all there is to it.  Hope this helps!</p>
]]></content:encoded>
			<wfw:commentRss>http://mikebosch.net/2010/12/asp-net-mvc-actionresult-choose-json-xml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

