<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Quame&#039;s Rampant Rants (QRR)</title>
	<atom:link href="http://emmanuelbuah.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://emmanuelbuah.wordpress.com</link>
	<description>QRR</description>
	<lastBuildDate>Fri, 27 Jan 2012 22:45:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='emmanuelbuah.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Quame&#039;s Rampant Rants (QRR)</title>
		<link>http://emmanuelbuah.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://emmanuelbuah.wordpress.com/osd.xml" title="Quame&#039;s Rampant Rants (QRR)" />
	<atom:link rel='hub' href='http://emmanuelbuah.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Work successfully from home</title>
		<link>http://emmanuelbuah.wordpress.com/2012/01/27/work-successfully-from-home/</link>
		<comments>http://emmanuelbuah.wordpress.com/2012/01/27/work-successfully-from-home/#comments</comments>
		<pubDate>Fri, 27 Jan 2012 22:03:31 +0000</pubDate>
		<dc:creator>emmanuelbuah</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[time slots]]></category>
		<category><![CDATA[self discipline]]></category>
		<category><![CDATA[coffee in the morning]]></category>

		<guid isPermaLink="false">http://emmanuelbuah.wordpress.com/?p=232</guid>
		<description><![CDATA[Working successfully from home and over come the urge to slack off<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emmanuelbuah.wordpress.com&amp;blog=3572392&amp;post=232&amp;subd=emmanuelbuah&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>We all dream of working from home. Well, maybe not everyone but I like to think most people do. What&#8217;s not appealing about starting your day at 10:00am in your pjs @ your home desk, taking a walk when you feel like it,  firing up the Xbox to kill a few zombies around 2:30pm, catching up on Dexter at 6:12pm and so on. Yes, I know. It sounds like vacation right? Nooootttttttt!</p>
<p>Working from home effectively can be very difficult if you don&#8217;t have a good amount of self discipline. It took me about 1-2 weeks to get it right and I assume it will vary for others. We all have our temptations and some people have more self control and discipline than others.  Here are a few things that should help you get started with your journey to an effective home office.</p>
<p><strong>Know your value vs time</strong></p>
<p>Unless you are a millionaire or expect a rain fall of cash from your parent, working from home needs to translate into revenue or something of value. Figure out what that value is so you know what you are loosing when you are not really working. An easier way to figure out the  monetary value of your time is to ask yourself what you are worth in the corporate world. If your rate is $48/ h, then that&#8217;s your value per hour. Anytime you find yourself doing something not considered work, remind yourself you are loosing that value which should give you the motivation you need to get back on track.</p>
<p><strong>Get in a daily routine</strong></p>
<p>Having a  productivity routine increases your disciplinary bar.  Productive routines are different for everyone so you will need to discover yours. Figure our what time slots within a day you are most productive and make sure your routine has you working during those slots.  Make sure you also get the rest your body needs to be fully productive when you are awake. Lets sprinkle a &#8220;couple&#8221; of short rewarding time slots that takes your mind of work but keeps you in a &#8220;go-to&#8221; productive  mode like brewing coffee in the morning, reading the new papers or your favorite blogs, checking your email/mailbox, taking a short walk/30 min workout etc. Put all these time slots together to form your routine and stick with it. You will be amazed how well having a routine works.</p>
<p><strong>Dress the part</strong></p>
<p>Working in your pj&#8217;s is fun but it also sets your mental mode to relaxed, which is not what you want when you are working. Yes, you want to be comfortable but you also don&#8217;t want to be too relaxed to the point of wanting to take a 2-3 hrs nap or sitting on the couch with your favorite bag of chips. In the name of productive routine, dress the part. Dress like you are going to work and your mind will stay in that mode till you are ready to mentally go home. That will help separate your work persona from your home persona and increase your productivity.</p>
<p><strong>Inform potential external forces about your work routine</strong></p>
<p>Having a productive routine is not enough if you have external forces try to blow it away. Identify those external forces and let them know of your routine so they don&#8217;t distract you. If you have kids, try to communicate that you need to get work done so you can have time to play with them when you don&#8217;t have to work. If you have friends that tend to call on you during your productive time slots to go hang out, let them know about your routine so they don&#8217;t distract you.</p>
<p>With the above steps and some luck, you should be able to work successfully from home and over come the urge to slack off. I&#8217;m also a member of a co-working space so when I want to work away from home, I have somewhere to go. That allows me to fulfill my office mate requirement. You don&#8217;t need it to successfully work from home but I find it very effective to connect with peers of the same mindset.</p>
<p>Credit: Featured  image by Shogo at Odosketch.com.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/emmanuelbuah.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/emmanuelbuah.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/emmanuelbuah.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/emmanuelbuah.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/emmanuelbuah.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/emmanuelbuah.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/emmanuelbuah.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/emmanuelbuah.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/emmanuelbuah.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/emmanuelbuah.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/emmanuelbuah.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/emmanuelbuah.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/emmanuelbuah.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/emmanuelbuah.wordpress.com/232/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emmanuelbuah.wordpress.com&amp;blog=3572392&amp;post=232&amp;subd=emmanuelbuah&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://emmanuelbuah.wordpress.com/2012/01/27/work-successfully-from-home/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://emmanuelbuah.files.wordpress.com/2011/12/toolsforthetrade.png?w=150" />
		<media:content url="http://emmanuelbuah.files.wordpress.com/2011/12/toolsforthetrade.png?w=150" medium="image">
			<media:title type="html">toolsforthetrade</media:title>
		</media:content>

		<media:content url="http://0.gravatar.com/avatar/4535293c14b47285dc8a7d1980d14f54?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">emmanuelbuah</media:title>
		</media:content>
	</item>
		<item>
		<title>We Have Lift Off! part 2</title>
		<link>http://emmanuelbuah.wordpress.com/2012/01/26/we-have-lift-off-part-2/</link>
		<comments>http://emmanuelbuah.wordpress.com/2012/01/26/we-have-lift-off-part-2/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 22:42:24 +0000</pubDate>
		<dc:creator>emmanuelbuah</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[corporate job]]></category>
		<category><![CDATA[sad day]]></category>

		<guid isPermaLink="false">http://emmanuelbuah.wordpress.com/?p=250</guid>
		<description><![CDATA[Per part 1, I have still be working at EBC 2 days/week till&#8230;today. I&#8217;m excited to say today is my last and finally day at my corporate job. It is a happy and sad day for me.  Happy because its the day I&#8217;m being unleashed into the make-it-or-break-it world to see what I&#8217;m really made of and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emmanuelbuah.wordpress.com&amp;blog=3572392&amp;post=250&amp;subd=emmanuelbuah&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Per <a title="we have lift off part 1" href="http://emmanuelbuah.wordpress.com/2011/07/15/houston-we-have-lift-off/" target="_blank">part 1</a>, I have still be working at EBC 2 days/week till&#8230;today. I&#8217;m excited to say today is my last and finally day at my corporate job. It is a happy and sad day for me.  Happy because its the day I&#8217;m being unleashed into the make-it-or-break-it world to see what I&#8217;m really made of and sad, because I wont be seeing the great many peers at EBC on a  daily bases anymore.  Thanks again, to all those who made this possible. See you on Monday @ my home office.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/emmanuelbuah.wordpress.com/250/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/emmanuelbuah.wordpress.com/250/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/emmanuelbuah.wordpress.com/250/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/emmanuelbuah.wordpress.com/250/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/emmanuelbuah.wordpress.com/250/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/emmanuelbuah.wordpress.com/250/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/emmanuelbuah.wordpress.com/250/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/emmanuelbuah.wordpress.com/250/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/emmanuelbuah.wordpress.com/250/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/emmanuelbuah.wordpress.com/250/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/emmanuelbuah.wordpress.com/250/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/emmanuelbuah.wordpress.com/250/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/emmanuelbuah.wordpress.com/250/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/emmanuelbuah.wordpress.com/250/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emmanuelbuah.wordpress.com&amp;blog=3572392&amp;post=250&amp;subd=emmanuelbuah&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://emmanuelbuah.wordpress.com/2012/01/26/we-have-lift-off-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://emmanuelbuah.files.wordpress.com/2011/07/liftoff.png?w=150" />
		<media:content url="http://emmanuelbuah.files.wordpress.com/2011/07/liftoff.png?w=150" medium="image">
			<media:title type="html">liftoff</media:title>
		</media:content>

		<media:content url="http://0.gravatar.com/avatar/4535293c14b47285dc8a7d1980d14f54?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">emmanuelbuah</media:title>
		</media:content>
	</item>
		<item>
		<title>Storage usage stats by SpaceSniffer</title>
		<link>http://emmanuelbuah.wordpress.com/2011/12/06/tools-of-trade-spacesniffer-to-the-rescure/</link>
		<comments>http://emmanuelbuah.wordpress.com/2011/12/06/tools-of-trade-spacesniffer-to-the-rescure/#comments</comments>
		<pubDate>Tue, 06 Dec 2011 16:55:19 +0000</pubDate>
		<dc:creator>emmanuelbuah</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[space]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://emmanuelbuah.wordpress.com/?p=221</guid>
		<description><![CDATA[If you are an engineer like myself, you end up accumulating tools that make your working life easier over the cause of  the years. Yesterday, I spend sometime cleaning up my laptop and was shocked to discover the amounts of tools I have accumulated in my toolbox so I thought it would be great to blog about these [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emmanuelbuah.wordpress.com&amp;blog=3572392&amp;post=221&amp;subd=emmanuelbuah&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you are an engineer like myself, you end up accumulating tools that make your working life easier over the cause of  the years. Yesterday, I spend sometime cleaning up my laptop and was shocked to discover the amounts of tools I have accumulated in my toolbox so I thought it would be great to blog about these tools for they might be useful to someone as well.</p>
<p><img class="alignleft" src="http://www.uderzo.it/main_products/space_sniffer/media/spacesniffer_layered.jpg" alt="" width="432" height="356" />We all clean our computing machine (laptop, desktop etc) once in a while and sometime you like to know which folder/program is taking up space. There are a few tools to sniff out the space consumption on your machine but I have see or used any better than <a title="space sniffer" href="http://www.uderzo.it/main_products/space_sniffer/index.html" target="_blank">SpaceSniffer</a>. SpaceSniffer cruises through your machine in a few min and shows a graphical representation of your space usage. The good guys at Uderzo Software have been kind enough to give this away for free so click the link above and get sniffing.</p>
<p>Credit: Featured  image by nordhell at Odosketch.com.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/emmanuelbuah.wordpress.com/221/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/emmanuelbuah.wordpress.com/221/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/emmanuelbuah.wordpress.com/221/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/emmanuelbuah.wordpress.com/221/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/emmanuelbuah.wordpress.com/221/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/emmanuelbuah.wordpress.com/221/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/emmanuelbuah.wordpress.com/221/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/emmanuelbuah.wordpress.com/221/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/emmanuelbuah.wordpress.com/221/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/emmanuelbuah.wordpress.com/221/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/emmanuelbuah.wordpress.com/221/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/emmanuelbuah.wordpress.com/221/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/emmanuelbuah.wordpress.com/221/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/emmanuelbuah.wordpress.com/221/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emmanuelbuah.wordpress.com&amp;blog=3572392&amp;post=221&amp;subd=emmanuelbuah&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://emmanuelbuah.wordpress.com/2011/12/06/tools-of-trade-spacesniffer-to-the-rescure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://emmanuelbuah.files.wordpress.com/2012/01/storage2.png?w=150" />
		<media:content url="http://emmanuelbuah.files.wordpress.com/2012/01/storage2.png?w=150" medium="image">
			<media:title type="html">storage2</media:title>
		</media:content>

		<media:content url="http://0.gravatar.com/avatar/4535293c14b47285dc8a7d1980d14f54?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">emmanuelbuah</media:title>
		</media:content>

		<media:content url="http://www.uderzo.it/main_products/space_sniffer/media/spacesniffer_layered.jpg" medium="image" />
	</item>
		<item>
		<title>Evolution of how we consume music</title>
		<link>http://emmanuelbuah.wordpress.com/2011/10/22/evolution-of-how-we-consume-music/</link>
		<comments>http://emmanuelbuah.wordpress.com/2011/10/22/evolution-of-how-we-consume-music/#comments</comments>
		<pubDate>Sat, 22 Oct 2011 18:48:35 +0000</pubDate>
		<dc:creator>emmanuelbuah</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[evolution]]></category>
		<category><![CDATA[lastfm]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[pandora]]></category>
		<category><![CDATA[spotify]]></category>

		<guid isPermaLink="false">http://emmanuelbuah.wordpress.com/?p=215</guid>
		<description><![CDATA[I&#8217;m a very big fun of music and when I say big, I&#8217;m not talking about having background music when drinking at the bar or listening to music in the car when you have nothing else to do but enjoy rows and rows of corn fields whisking by. I&#8217;m talking about have an intimate quality session with your music [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emmanuelbuah.wordpress.com&amp;blog=3572392&amp;post=215&amp;subd=emmanuelbuah&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m a very big fun of music and when I say big, I&#8217;m not talking about having background music when drinking at the bar or listening to music in the car when you have nothing else to do but enjoy rows and rows of corn fields whisking by. I&#8217;m talking about have an intimate quality session with your music setup, soaking in a good hour or so of music. For people like me, discovering new artist/sounds is of great delight and it&#8217;s amazing how that discovery has evolved as the years go by.</p>
<p>Rewind to 1999, zoom in on the young me, and you will see me spending hours download musics from Napster, Kaza and the likes until these sources where place in shackles by the media piracy laws.  Then came the Ipod and Itunes which helped us discover and buy music for a reasonable price. That made a big impact on how people consumed music as they could just buy what they wanted while browsing a sea of music collection. I never owned an Ipod but did enjoy its huge collection of artists/music through Jennie&#8217;s account. I believe the rise of internet radios such as pandora, lastfm etc is what expanded my collection of artists and music alike. The discovery through internet radio was so good, at least for me, that I never found myself wanting. Then Spotify show up and added icing on to cake. With Spotify, I find myself discovering music with the help of friends and family linked to my account. I think Spotify is &#8220;currently&#8221; the most innovative ways for music lovers to discover and enjoy music and the best part, you wont be doing it along.</p>
<p>&nbsp;</p>
<p>Credit: Featured  image by Pcataldi at Odosketch.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/emmanuelbuah.wordpress.com/215/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/emmanuelbuah.wordpress.com/215/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/emmanuelbuah.wordpress.com/215/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/emmanuelbuah.wordpress.com/215/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/emmanuelbuah.wordpress.com/215/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/emmanuelbuah.wordpress.com/215/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/emmanuelbuah.wordpress.com/215/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/emmanuelbuah.wordpress.com/215/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/emmanuelbuah.wordpress.com/215/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/emmanuelbuah.wordpress.com/215/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/emmanuelbuah.wordpress.com/215/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/emmanuelbuah.wordpress.com/215/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/emmanuelbuah.wordpress.com/215/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/emmanuelbuah.wordpress.com/215/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emmanuelbuah.wordpress.com&amp;blog=3572392&amp;post=215&amp;subd=emmanuelbuah&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://emmanuelbuah.wordpress.com/2011/10/22/evolution-of-how-we-consume-music/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://emmanuelbuah.files.wordpress.com/2011/10/music.png?w=150" />
		<media:content url="http://emmanuelbuah.files.wordpress.com/2011/10/music.png?w=150" medium="image">
			<media:title type="html">music</media:title>
		</media:content>

		<media:content url="http://0.gravatar.com/avatar/4535293c14b47285dc8a7d1980d14f54?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">emmanuelbuah</media:title>
		</media:content>
	</item>
		<item>
		<title>Routing with crossroads.js + browser history(from backbone.js)</title>
		<link>http://emmanuelbuah.wordpress.com/2011/07/26/routing-with-crossroads-js-browser-historyfrom-backbone-js/</link>
		<comments>http://emmanuelbuah.wordpress.com/2011/07/26/routing-with-crossroads-js-browser-historyfrom-backbone-js/#comments</comments>
		<pubDate>Tue, 26 Jul 2011 15:05:17 +0000</pubDate>
		<dc:creator>emmanuelbuah</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://emmanuelbuah.wordpress.com/?p=205</guid>
		<description><![CDATA[It&#8217;s a very exciting time for developers, especially web developers. There has been a blow out of great cutting-edge web application thanks to the many javascript frameworks and plugins springing up. This is very good because as an engineer, you get to pick and choose what framework/plugin you want to use and the ability to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emmanuelbuah.wordpress.com&amp;blog=3572392&amp;post=205&amp;subd=emmanuelbuah&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s a very exciting time for developers, especially web developers. There has been a blow out of great cutting-edge web application thanks to the many javascript frameworks and plugins springing up. This is very good because as an engineer, you get to pick and choose what framework/plugin you want to use and the ability to extend it to fit your needs. Per last past, I started work on a personal project. One of my projects required a client-side routing engine. I looked at <a title="backbone.js router" href="http://documentcloud.github.com/backbone/#Router" target="_blank">Backbone.js</a> for its routing api which was great but it come with all the other api I didn&#8217;t wont/need.I looked at  <a title="crossroads.js" href="http://millermedeiros.github.com/crossroads.js/" target="_blank">Crossroads.js</a>  and was just perfect because it did exactly what I was looking for -routing, and no more that that. Apart from client-side routing, I also need a navigation engine to allowing for routing to bookmarks and application states. Backbone.js comes with a supporting api called History. Since I wanted crossroads.js routing but Backbone.js implementation of  application navigation mechanism, I got hacking and in 10 min, had an extended crossroad.js with history support by porting over the implementation from Backbone. You can find and grab the code from <a title="Add bookmark and application state navigation(port from backbone.js) to crossroads.js" href="https://gist.github.com/1106922" target="_blank">github</a>. You will need jquery to use this extension. Another thing you need to know is during hash navigation, crossroads is called with the relative path of the page and not just the hash. Thus if you navigate to &#8220;#3:edit&#8221; using crossroads.navigator at &#8220;www.test.com/people&#8221;, you will be navigated to &#8220;www.test.com/people#3:edit&#8221; and the request passed to crossroads for routing will be &#8220;people#3:edit&#8221;.</p>
<p>&nbsp;</p>
<p>Credit: Feature <a title="extension" href="http://sketch.odopod.com/sketches/402020" target="_blank">sketch</a> by ekubochan at Odosketch</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/emmanuelbuah.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/emmanuelbuah.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/emmanuelbuah.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/emmanuelbuah.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/emmanuelbuah.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/emmanuelbuah.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/emmanuelbuah.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/emmanuelbuah.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/emmanuelbuah.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/emmanuelbuah.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/emmanuelbuah.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/emmanuelbuah.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/emmanuelbuah.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/emmanuelbuah.wordpress.com/205/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emmanuelbuah.wordpress.com&amp;blog=3572392&amp;post=205&amp;subd=emmanuelbuah&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://emmanuelbuah.wordpress.com/2011/07/26/routing-with-crossroads-js-browser-historyfrom-backbone-js/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:thumbnail url="http://emmanuelbuah.files.wordpress.com/2011/07/extension4.png?w=150" />
		<media:content url="http://emmanuelbuah.files.wordpress.com/2011/07/extension4.png?w=150" medium="image">
			<media:title type="html">extension4</media:title>
		</media:content>

		<media:content url="http://0.gravatar.com/avatar/4535293c14b47285dc8a7d1980d14f54?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">emmanuelbuah</media:title>
		</media:content>
	</item>
		<item>
		<title>We Have Lift Off! part 1</title>
		<link>http://emmanuelbuah.wordpress.com/2011/07/15/houston-we-have-lift-off/</link>
		<comments>http://emmanuelbuah.wordpress.com/2011/07/15/houston-we-have-lift-off/#comments</comments>
		<pubDate>Fri, 15 Jul 2011 18:27:50 +0000</pubDate>
		<dc:creator>emmanuelbuah</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://emmanuelbuah.wordpress.com/?p=191</guid>
		<description><![CDATA[ 14th of July,2011 was/and will be a very special day for me. NASA took it&#8217;s last near-orbit flight on 14th of July,2011 which was both a joyful and sad moment all together. NASA has absorbed the majority of space exploration expenses from the first shuttle lift off and just like how the government thought the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emmanuelbuah.wordpress.com&amp;blog=3572392&amp;post=191&amp;subd=emmanuelbuah&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong> 14th of July,2011</strong> was/and will be a very special day for me. NASA took it&#8217;s last near-orbit flight on 14th of July,2011 which was both a joyful and sad moment all together. NASA has absorbed the majority of space exploration expenses from the first shuttle lift off and just like how the government thought the internet was ready to live in our homes and businesses (after many years in research at government institutions including NASA &amp; US military), the US government feels near space exploration is ready for private businesses to takeover. I will like to say cheers to NASA for all the work the have done for mankind and looking forward to their next chapter &#8211; deep space exploration. I know there are people out there who are not very happy about this but the processes has worked before &#8211; the internet; and there is no reason it believe it wont work again if done right.</p>
<p>14th of July,2011 also marked my first flight at a series of personal projects. It was my first day off my corporate job; part of a gradual transition process to getting started on my personal projects. It&#8217;s been a great ride in the corporate world, working for both big and small software companies. This is by no means my declaration of  a complete departure from corporate world. In fact, I am still an employee of Employee Benefit Corporation(EBC), with a sweat working schedule for which I&#8217;m very thankful. It&#8217;s really an exciting time for me because I get to try something new and personal.  Thanks to the lady of the house &#8211; Jennie, my family and my friends for their support. I will also like to thank EBC&#8217;s CIO, James Lyerly for all his support.</p>
<p>So what are my personal projects all about? Stay tuned.</p>
<p>Credit: Featured  image by hebertkozu at Odosketch.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/emmanuelbuah.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/emmanuelbuah.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/emmanuelbuah.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/emmanuelbuah.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/emmanuelbuah.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/emmanuelbuah.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/emmanuelbuah.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/emmanuelbuah.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/emmanuelbuah.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/emmanuelbuah.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/emmanuelbuah.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/emmanuelbuah.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/emmanuelbuah.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/emmanuelbuah.wordpress.com/191/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emmanuelbuah.wordpress.com&amp;blog=3572392&amp;post=191&amp;subd=emmanuelbuah&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://emmanuelbuah.wordpress.com/2011/07/15/houston-we-have-lift-off/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://emmanuelbuah.files.wordpress.com/2011/07/liftoff.png?w=150" />
		<media:content url="http://emmanuelbuah.files.wordpress.com/2011/07/liftoff.png?w=150" medium="image">
			<media:title type="html">liftoff</media:title>
		</media:content>

		<media:content url="http://0.gravatar.com/avatar/4535293c14b47285dc8a7d1980d14f54?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">emmanuelbuah</media:title>
		</media:content>
	</item>
		<item>
		<title>Conditional Validation in ASP.NET MVC &#8211; RangeIf</title>
		<link>http://emmanuelbuah.wordpress.com/2011/04/07/conditional-validation-in-asp-net-mvc-rangeif-2/</link>
		<comments>http://emmanuelbuah.wordpress.com/2011/04/07/conditional-validation-in-asp-net-mvc-rangeif-2/#comments</comments>
		<pubDate>Thu, 07 Apr 2011 16:12:06 +0000</pubDate>
		<dc:creator>emmanuelbuah</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://emmanuelbuah.wordpress.com/?p=153</guid>
		<description><![CDATA[Simon Ince made a great post about conditional validation in mvc which he extended in his post conditional validation in asp.net mvc 3. Asp.net mvc validation is one of asp.net mvc&#8217;s great extensible points . The framework comes with a decent amount of validations attribute such as range, stringlength etc but sometimes we find ourselves [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emmanuelbuah.wordpress.com&amp;blog=3572392&amp;post=153&amp;subd=emmanuelbuah&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Simon Ince made a great post about <a href="http://blogs.msdn.com/b/simonince/archive/2010/06/04/conditional-validation-in-mvc.aspx">conditional validation in mvc</a> which he extended in his post <a href="http://blogs.msdn.com/b/simonince/archive/2011/02/04/conditional-validation-in-asp-net-mvc-3.aspx">conditional validation in asp.net mvc 3</a>. Asp.net mvc validation is one of asp.net mvc&#8217;s great extensible points . The framework comes with a decent amount of validations attribute such as range, stringlength etc but sometimes we find ourselves wanting to perform a specify type of validation that the framework doesn&#8217;t support and conditional validation is a perfectly good example. This is one of those validation types that most people feel the asp.net mvc team should have included in the framework but hey, they cannot do it all,  so we look to ourselves and to good people like Simon to the rescue.</p>
<p>Simon goes into details on how to create a RequiredIf validation so I wont elaborate on that (just dive into the links above for info on RequiredIf validation). In using Simon Requiredif validation, I decided its would be great to build on it to be applicable to other rules like Rangeif, StringLenghtIf, etc, starting with RangeIf. The first thing I needed to do was define the signature of the validation attribute. To keep things consistent with Simon&#8217;s, I decided to go with the signature as follows for an age property on the person class-</p>
<pre><code>[RangeIf(11, 25, "IsUKResident", false, ErrorMessage = "If you are not a UK  resident, your age has to be between 11 and 25")]</code></pre>
<p>The next thing to do was to define the RangIf attribute class below , inheriting from RangAttribute<br />
<code> public class RangeIfAttribute : RangeAttribute , IClientValidatable<br />
{<br />
public string DependentProperty { get; set; }<br />
public object TargetValue { get; set; }</code></p>
<p><code>public RangeIfAttribute(int minimum, int maximum, string dependentProperty</code></p>
<p><code>, object targetValue): base(minimum, maximum)<br />
{<br />
this.DependentProperty = dependentProperty;<br />
this.TargetValue = targetValue;<br />
}</code></p>
<p><code>protected override ValidationResult IsValid(object value, </code></p>
<p><code>ValidationContext validationContext)<br />
{<br />
// get a reference to the property this validation depends upon<br />
var containerType = validationContext.ObjectInstance.GetType();<br />
var field = containerType.GetProperty(this.DependentProperty);</code></p>
<p><code>if (field != null)<br />
{<br />
// get the value of the dependent property<br />
var dependentvalue = field.GetValue(validationContext.ObjectInstance, null);</code></p>
<p><code>// compare the value against the target value<br />
if ((dependentvalue == null &amp;&amp; this.TargetValue == null) ||<br />
(dependentvalue != null &amp;&amp; dependentvalue.Equals(this.TargetValue)))<br />
{<br />
// match =&gt; means we should try validating this field<br />
if (!base.IsValid(value))<br />
// validation failed - return an error<br />
return new ValidationResult(this.ErrorMessage, new[] </code></p>
<p><code> { validationContext.MemberName });<br />
}<br />
}</code></p>
<p><code>return ValidationResult.Success;<br />
}</code></p>
<p><code>public IEnumerable&lt;ModelClientValidationRule&gt; GetClientValidationRules</code></p>
<p><code>(ModelMetadata metadata, ControllerContext context)<br />
{<br />
var rule = new ModelClientValidationRule()<br />
{<br />
ErrorMessage = FormatErrorMessage(metadata.GetDisplayName()),<br />
ValidationType = "propertydependencyrule",<br />
};</code></p>
<p><code>string depProp = BuildDependentPropertyId(metadata, context as ViewContext);<br />
string targetValue = (this.TargetValue ?? "").ToString();<br />
if (this.TargetValue.GetType() == typeof(bool))<br />
targetValue = targetValue.ToLower();</code></p>
<p>&nbsp;</p>
<p><code>rule.ValidationParameters.Add("dependentproperty", depProp);<br />
rule.ValidationParameters.Add("targetvalue", targetValue);<br />
rule.ValidationParameters.Add("rule", "range");<br />
rule.ValidationParameters.Add("ruleparam","["+Minimum+","+Maximum+"]");</code></p>
<p><code>yield return rule;<br />
}</code></p>
<p>&nbsp;</p>
<p><code> private string BuildDependentPropertyId(ModelMetadata metadata,</code></p>
<p><code> ViewContext viewContext)<br />
{<br />
// build the ID of the property<br />
string depProp = viewContext.ViewData.TemplateInfo.GetFullHtmlFieldId</code></p>
<p><code>(this.DependentProperty);<br />
// unfortunately this will have the name of the current field appended to the beginning,<br />
// because the TemplateInfo's context has had this fieldname appended to it. Instead, we<br />
// want to get the context as though it was one level higher (i.e. outside the current property,<br />
// which is the containing object (our Person), and hence the same level as the dependent property.<br />
var thisField = metadata.PropertyName + "_";<br />
if (depProp.StartsWith(thisField))<br />
// strip it off again<br />
depProp = depProp.Substring(thisField.Length);<br />
return depProp;<br />
}<br />
}</code><br />
The code above is self explanatory so I wont elaborate. Note that we pass on the client rule and its parameters through rule.ValidationParameters in the GetClientValidationRules method. The next thing to do was create my client script (unobtrusive adapter) below<br />
<code>$.validator.addMethod('propertydependencyrule',<br />
function (value, element, parameters) {<br />
var id = '#' + parameters['dependentproperty'];</code></p>
<p><code>// get the target value (as a string,<br />
// as that's what actual value will be)<br />
var targetvalue = parameters['targetvalue'];<br />
targetvalue =<br />
(targetvalue == null ? '' : targetvalue).toString();</code></p>
<p><code>// get the actual value of the target control<br />
// note - this probably needs to cater for more<br />
// control types, e.g. radios<br />
var control = $(id);<br />
var controltype = control.attr('type');<br />
var actualvalue = "";</code></p>
<p><code>switch(controltype)<br />
{<br />
case 'checkbox' :<br />
actualvalue = control.attr('checked').toString(); break;<br />
case 'select' :<br />
actualvalue = $('option:selected',control).text(); break;<br />
default:<br />
actualvalue = control.val(); break;<br />
}</code></p>
<p><code>// if the condition is true, reuse the existing<br />
// required field validator functionality<br />
var rule = parameters['rule']<br />
var ruleparam = parameters['ruleparam']<br />
if (targetvalue === actualvalue)<br />
return $.validator.methods[rule].call(<br />
this, value, element, ruleparam);</code></p>
<p><code>return true;<br />
}<br />
);</code></p>
<p><code>$.validator.unobtrusive.adapters.add(<br />
'propertydependencyrule',<br />
['dependentproperty', 'targetvalue', 'rule', 'ruleparam'],<br />
function (options) {</code></p>
<p>&nbsp;</p>
<p><code> options.rules['propertydependencyrule'] = {<br />
dependentproperty: options.params['dependentproperty'],<br />
targetvalue: options.params['targetvalue'],<br />
rule: options.params['rule'],<br />
ruleparam: eval(options.params['ruleparam']),<br />
};<br />
options.messages['propertydependencyrule'] = options.message;<br />
});</code></p>
<p>That&#8217;s it. We now have our RangeIf validation attribute. Notice I modified Simon&#8217;s client side code to a generic propertydependencyrule so you can use propertydependencyrule for other propertydependency validation attributes like StringLenghtIf by passing along the max jquery.validator  rule and its parameters. In my next post, I will extend this to RegularExpressionIf, StringLenghtIf, and more. Stay tuned.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/emmanuelbuah.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/emmanuelbuah.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/emmanuelbuah.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/emmanuelbuah.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/emmanuelbuah.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/emmanuelbuah.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/emmanuelbuah.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/emmanuelbuah.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/emmanuelbuah.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/emmanuelbuah.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/emmanuelbuah.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/emmanuelbuah.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/emmanuelbuah.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/emmanuelbuah.wordpress.com/153/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emmanuelbuah.wordpress.com&amp;blog=3572392&amp;post=153&amp;subd=emmanuelbuah&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://emmanuelbuah.wordpress.com/2011/04/07/conditional-validation-in-asp-net-mvc-rangeif-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:thumbnail url="http://emmanuelbuah.files.wordpress.com/2011/04/conditionvalidate.png?w=150" />
		<media:content url="http://emmanuelbuah.files.wordpress.com/2011/04/conditionvalidate.png?w=150" medium="image">
			<media:title type="html">conditionvalidate</media:title>
		</media:content>

		<media:content url="http://0.gravatar.com/avatar/4535293c14b47285dc8a7d1980d14f54?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">emmanuelbuah</media:title>
		</media:content>
	</item>
		<item>
		<title>A reminder of why I dislike asp.net webforms</title>
		<link>http://emmanuelbuah.wordpress.com/2011/04/05/a-reminder-of-why-i-dislike-asp-net-webforms/</link>
		<comments>http://emmanuelbuah.wordpress.com/2011/04/05/a-reminder-of-why-i-dislike-asp-net-webforms/#comments</comments>
		<pubDate>Tue, 05 Apr 2011 20:13:53 +0000</pubDate>
		<dc:creator>emmanuelbuah</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[ASP.NET MVC]]></category>

		<guid isPermaLink="false">http://emmanuelbuah.wordpress.com/?p=145</guid>
		<description><![CDATA[A few hours ago, I stumbled on asp.net mvp - an up and coming asp.net opensource framework who&#8217;s aim to to unit the productivity of asp.net webforms  and the exensibilty of asp.net mvc. After combing through the links and the how-to&#8217;s on http://aspnetmvp.com , I had warmed up to the idea and was willing to give it a try [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emmanuelbuah.wordpress.com&amp;blog=3572392&amp;post=145&amp;subd=emmanuelbuah&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A few hours ago, I stumbled on asp.net mvp - an up and coming asp.net opensource framework who&#8217;s aim to to unit the productivity of asp.net webforms  and the exensibilty of asp.net mvc. After combing through the links and the how-to&#8217;s on <a href="http://aspnetmvp.com">http://aspnetmvp.com</a> , I had warmed up to the idea and was willing to give it a try in the new furture. This post should probably be titled asp.net mvp but the blog post(<a href="http://www.aaron-powell.com/yes-i-like-webforms">http://www.aaron-powell.com/yes-i-like-webforms</a>) in relation to asp.net mvp in support of asp.net webforms got my heart going so I decided to respond with this post. If you have head it all, please skip this post else you are welcome to read on.</p>
<p>The blog post(<a href="http://www.aaron-powell.com/yes-i-like-webforms">http://www.aaron-powell.com/yes-i-like-webforms</a>) in support of asp.net webforms list some very interesting point that I strongly support especially in relation to viewstate. People who complain about veiwstate just don&#8217;t know how to use it and its a fact. I actually agree with everything except for his argument quoted below in support of asp.net webform controls.</p>
<blockquote><p>Controls are great, they package up some functionality and make it easy to redistribute. But people often say that this is one of the big downsides of WebForms and MVC gives you much better flexibility. But think about some of the trivial (read: boring) tasks which we have to do as developers:</p>
<ul>
<li>Create a login form</li>
<li>Output a collection of data using a template</li>
</ul>
<p>So with MVC this is something that you end up having to write yourself, sure there are some helpers like <code>Html.EditorFor</code> and stuff so you can quickly display something. And it&#8217;s true there&#8217;s plenty of good extensions to do things like Repeaters, so this is just taking WebForms concept into MVC right?</p>
<p>One of the other main criticisms of controls is that they generate HTML for you that is hard to style, and often unchangable. But think about what they are trying to generate, a standard design cross-browser. Try having a floating layout which can be dropped anywhere and look the same?</p>
<p>True it makes them less flexible, but it depends what you&#8217;re trying to achieve</p></blockquote>
<p>Sure, controls are great because they allow us to componentize and reuse functionalities but with a greater sacrifice. If you just want to get up and going looking like ooh say anything else but precise, webform controls will do it well. Webforms are great in its composition architecture and since its been around for a while (.net world), its proven itself with a ton of best practices and guidlines. On the other hand, I(I spoke for myself and only myself) dislike it because it tends to create what i call &#8220;robot developers&#8221;. Run an http test against a decent webform dev and you will actual find out what he knows about the underlying technology. Sure, they dont &#8220;need&#8221; to know it because they just have to drag and drop control but&#8230; you(assuming you agree) and i know that in order to build great application, you almost have to go beyond drag&amp;drop and property setting. Another issues I have with webforms is the inability to control the html rended by the controls. The author asserts that its hard to stay compliant with the statement- &#8220;One of the other main criticisms of controls is that they generate HTML for you that is hard to style, and often unchangable. But think about what they are trying to generate, a standard design cross-browser. Try having a floating layout which can be dropped anywhere and look the same?&#8221;, but that&#8217;s only useful, again, to the &#8220;robot develper&#8221; because instead of learning how to do it using the right technology(thml,css,js), they end up relying on the control to do it. To add to injury, even though they are designed to generate standard cross-browser html ,they don&#8217;t. There are too many browsers to think your webform control will work flawlessly in everyone of them. In conclusion, controls in asp.net webforms hurts the framework to some extent. I will advocate controles but only when the engineer has the ability to make modification when need be. That&#8217;s why I love asp.net mvc. It takes sometime to get up to speed and yes it has its own problem but in the end, I believe as a designer/developer, asp.net mvc  is more rewarding that asp.net webforms.  Hopefully, asp.net mvp will bring these two together.</p>
<p>&nbsp;</p>
<p>Credits: Post image by ksomero at odosketch.com</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/emmanuelbuah.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/emmanuelbuah.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/emmanuelbuah.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/emmanuelbuah.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/emmanuelbuah.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/emmanuelbuah.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/emmanuelbuah.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/emmanuelbuah.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/emmanuelbuah.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/emmanuelbuah.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/emmanuelbuah.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/emmanuelbuah.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/emmanuelbuah.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/emmanuelbuah.wordpress.com/145/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emmanuelbuah.wordpress.com&amp;blog=3572392&amp;post=145&amp;subd=emmanuelbuah&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://emmanuelbuah.wordpress.com/2011/04/05/a-reminder-of-why-i-dislike-asp-net-webforms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://emmanuelbuah.files.wordpress.com/2011/04/dislikeaspwinform.png?w=150" />
		<media:content url="http://emmanuelbuah.files.wordpress.com/2011/04/dislikeaspwinform.png?w=150" medium="image">
			<media:title type="html">dislikeaspwinform</media:title>
		</media:content>

		<media:content url="http://0.gravatar.com/avatar/4535293c14b47285dc8a7d1980d14f54?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">emmanuelbuah</media:title>
		</media:content>
	</item>
		<item>
		<title>ASP.NET MVC Action &amp; Reaction</title>
		<link>http://emmanuelbuah.wordpress.com/2009/09/27/asp-net-mvc-reaction-to-actions/</link>
		<comments>http://emmanuelbuah.wordpress.com/2009/09/27/asp-net-mvc-reaction-to-actions/#comments</comments>
		<pubDate>Sun, 27 Sep 2009 00:06:00 +0000</pubDate>
		<dc:creator>emmanuelbuah</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://emmanuelbuah.wordpress.com/2009/09/27/asp-net-mvc-reaction-to-actions/</guid>
		<description><![CDATA[If you are familiar with ASP.NET MVC, you are probably familiar with the State Validation mechanism that was shipped starting from v1. Its a great way to validate your model and funnel your validation result to the user if need be. What I find lucky or I should probably say what I thought was lucking [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emmanuelbuah.wordpress.com&amp;blog=3572392&amp;post=143&amp;subd=emmanuelbuah&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<pre class="code"></pre>
<p>If you are familiar with ASP.NET MVC, you are probably familiar with the State Validation mechanism that was shipped starting from v1. Its a great way to validate your model and funnel your validation result to the user if need be. What I find lucky or I should probably say what I thought was lucking was the fact that it only dealt with error. There is nothing wrong with there and it probably the sole intention but I wanted something general. For every event the user executes (action), they expect a reaction. The most common reaction is page reload with content in relation to the user action. With that in mind, I created an Html helper  provide a generic reaction to the user, based on their action. It could be errors, it could be a warning or a successful message. These are thing developers do very often. Below is the code for my Html helper. Please not this is was a quick hack to get it working. I will post my updated to the helper when I make the final changes.</p>
<p>So here is how it works. All my views are strongly typed and accepts a ViewModel type. My ViewModels inherits from a base ViewModel class which provide the implementation for adding ActionMessage&#8217;s to the view. As seen below, my ContactViewModel inherits from the ViewModel abstract base class.</p>
<pre class="code"><span style="color:blue;">public enum </span><span style="color:#2b91af;">ActionMessaeType </span>{
    Success = 1,
    Failure = 2,
    Warning = 3,
    Alert = 4
}

<span style="color:blue;">public class </span><span style="color:#2b91af;">ActionMessage </span>{

    <span style="color:blue;">public </span><span style="color:#2b91af;">ActionMessaeType </span>MessageType
    {
        <span style="color:blue;">get</span>;
        <span style="color:blue;">set</span>;
    }

    <span style="color:blue;">public string </span>Message
    {
        <span style="color:blue;">get</span>;
        <span style="color:blue;">set</span>;
    }

    <span style="color:blue;">public string </span>ForAction
    {
        <span style="color:blue;">get</span>;
        <span style="color:blue;">set</span>;
    }

    <span style="color:blue;">public </span>ActionMessage(<span style="color:#2b91af;">ActionMessaeType </span>messagetype,</pre>
<pre class="code">                   <span style="color:blue;">string </span>message)
    {
        MessageType = messagetype;
        Message = message;
        ForAction = <span style="color:blue;">string</span>.Empty;
    }

    <span style="color:blue;">public </span>ActionMessage(<span style="color:#2b91af;">ActionMessaeType </span>messagetype,</pre>
<pre class="code">                <span style="color:blue;">string </span>message, <span style="color:blue;">string </span>foraction)
    {
        MessageType = messagetype;
        Message = message;
        ForAction = foraction;
    }
}

<span style="color:blue;">public abstract class </span><span style="color:#2b91af;">ViewModel </span>{
    <span style="color:blue;">private </span><span style="color:#2b91af;">List</span>&lt;<span style="color:#2b91af;">ActionMessage</span>&gt; _internalactionmessages</pre>
<pre class="code">                            = <span style="color:blue;">new </span><span style="color:#2b91af;">List</span>&lt;<span style="color:#2b91af;">ActionMessage</span>&gt;();
    <span style="color:blue;">public </span><span style="color:#2b91af;">List</span>&lt;<span style="color:#2b91af;">ActionMessage</span>&gt; ActionMessages
    {
        <span style="color:blue;">get </span>{ <span style="color:blue;">return </span>_internalactionmessages; }
    }
    <span style="color:blue;">public </span>ViewModel(){}
    <span style="color:blue;">public </span><span style="color:#2b91af;">ViewModel </span>Add(<span style="color:#2b91af;">ActionMessage </span>actionmessage)
    {
        _internalactionmessages.Add(actionmessage);
        <span style="color:blue;">return this</span>;
    }
    <span style="color:blue;">public </span><span style="color:#2b91af;">ViewModel </span>Remove(<span style="color:#2b91af;">ActionMessage </span>actionmessage)
    {
        _internalactionmessages.Remove(actionmessage);
        <span style="color:blue;">return this</span>;
    }
    <span style="color:blue;">public </span><span style="color:#2b91af;">ViewModel </span>Clear()
    {
        _internalactionmessages.Clear();
        <span style="color:blue;">return this</span>;
    }
}

<span style="color:blue;">public class </span><span style="color:#2b91af;">ContactViewModel </span>: <span style="color:#2b91af;">ViewModel </span>{
    <span style="color:blue;">public </span><span style="color:#2b91af;">Contact </span>Contact
    {
        <span style="color:blue;">get</span>;
        <span style="color:blue;">set</span>;
    }
}</pre>
<p>&nbsp;</p>
<p>My Contact View take accepts a ContactViewModel. Here is my page tag in my Contact.aspx</p>
<pre class="code"><span style="background:#ffee62;">&lt;%</span><span style="color:blue;">@ </span><span style="color:#a31515;">Page </span><span style="color:red;">Language</span><span style="color:blue;">="C#" </span><span style="color:red;">MasterPageFile</span><span style="color:blue;">="~/Views/Shared/Site.</span></pre>
<pre class="code"><span style="color:blue;">Master" </span><span style="color:red;">Inherits</span><span style="color:blue;">="System.Web.Mvc.ViewPage&lt;YourNameSpace.</span></pre>
<pre class="code"><span style="color:blue;">Models.ViewModel.</span><span style="color:blue;">ContactViewModel&gt;" </span><span style="background:#ffee62;">%&gt;</span></pre>
<p>&nbsp;</p>
<p>Below is the post Contact Action method in my Controller</p>
<div id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:f3998855-f7b6-4bf4-aebd-e2e7e823c5cc" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<div style="border:#000080 1px solid;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#000080;color:#fff;font-family:Verdana, Tahoma, Arial, sans-serif;font-weight:bold;padding:2px 5px;">Code Snippet</div>
<div style="background:#ddd;max-height:300px;overflow:auto;">
<ol style="background:#ffffff;margin:0 0 0 2.5em;padding:0 0 0 5px;">
<li>[<span style="color:#2b91af;">HttpPost</span>] <span style="color:#008000;">//Post</span></li>
<li style="background:#f3f3f3;">        <span style="color:#0000ff;">public</span> <span style="color:#2b91af;">ActionResult</span> Contact([<span style="color:#2b91af;">Bind</span>(Exclude = <span style="color:#a31515;">"Id"</span>)]<span style="color:#2b91af;">Contact</span> contact)</li>
<li>        {</li>
<li style="background:#f3f3f3;">            <span style="color:#008000;">//if maodel is not valid, send validated contact</span></li>
<li>            <span style="color:#0000ff;">if</span> (!ModelState.IsValid)</li>
<li style="background:#f3f3f3;">            {</li>
<li>                <span style="color:#0000ff;">return</span> View(<span style="color:#0000ff;">new</span> <span style="color:#2b91af;">ContactViewModel</span> { Contact = <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">Contact</span>() }</li>
<li style="background:#f3f3f3;">                       .Add(<span style="color:#0000ff;">new</span> <span style="color:#2b91af;">ActionMessage</span>(<span style="color:#2b91af;">ActionMessaeType</span>.Failure, <span style="color:#a31515;">&#8220;Please correct the errors in the highlighted below and try again&#8221;</span>, <span style="color:#a31515;">&#8220;create-contact-failure&#8221;</span>)) <span style="color:#0000ff;">as</span> <span style="color:#2b91af;">ContactViewModel</span>);</li>
<li>            }</li>
<li style="background:#f3f3f3;"></li>
<li>            <span style="color:#008000;">//save contact here&#8230;&#8230;</span></li>
<li style="background:#f3f3f3;"></li>
<li>            <span style="color:#008000;">//Clear ModelState or redirect </span></li>
<li style="background:#f3f3f3;">            ModelState.Clear();</li>
<li></li>
<li style="background:#f3f3f3;">            <span style="color:#008000;">//display view with action message</span></li>
<li>            <span style="color:#0000ff;">return</span> View(<span style="color:#0000ff;">new</span> <span style="color:#2b91af;">ContactViewModel</span> { Contact = <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">Contact</span>() }</li>
<li style="background:#f3f3f3;">                        .Add(<span style="color:#0000ff;">new</span> <span style="color:#2b91af;">ActionMessage</span>(<span style="color:#2b91af;">ActionMessaeType</span>.Success, <span style="color:#a31515;">&#8220;Thank you for your message. We will get back to you as soon as possible if a response is need.&#8221;</span>, <span style="color:#a31515;">&#8220;create-contact-success&#8221;</span>)) <span style="color:#0000ff;">as</span> <span style="color:#2b91af;">ContactViewModel</span>);</li>
<li>        }</li>
</ol>
</div>
</div>
</div>
<p>&nbsp;</p>
<p>You will notice from the code above that based on the certain events during the action execution, I add an ActionMessage to the ViewModel before its passed on to the view. The ActionMessage take a messagetype (failure, success, alert,…), a message to be displayed and a “foraction” parameter which depicts where the message should show in the view.</p>
<p>When the  view is rendering, the html helper is called to display the action messages. The helper can take a “foraction” parameter which is used to determine which ActionMessages to show. If no “foraction” is passed, all messages are displayed. Here is the code for the Helper method</p>
<div id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:4e4d4572-3a13-45b8-b573-a3e8159ae827" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<div style="border:#000080 1px solid;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#000080;color:#fff;font-family:Verdana, Tahoma, Arial, sans-serif;font-weight:bold;padding:2px 5px;">Code Snippet</div>
<div style="background:#ddd;max-height:300px;overflow:auto;">
<ol style="background:#ffffff;margin:0 0 0 3em;padding:0 0 0 5px;">
<li><span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">class</span> <span style="color:#2b91af;">ActionMessageExtension</span></li>
<li style="background:#f3f3f3;">    {</li>
<li>        <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">readonly</span> <span style="color:#0000ff;">string</span> ActionMessageCssClassName = <span style="color:#a31515;">&#8220;action-message&#8221;</span>;</li>
<li style="background:#f3f3f3;"></li>
<li>        <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">string</span> getActionMessageCssClassName(<span style="color:#2b91af;">ActionMessaeType</span> messagetype)</li>
<li style="background:#f3f3f3;">        {</li>
<li>            <span style="color:#0000ff;">switch</span> (messagetype)</li>
<li style="background:#f3f3f3;">            {</li>
<li>                <span style="color:#0000ff;">case</span> <span style="color:#2b91af;">ActionMessaeType</span>.Success: <span style="color:#0000ff;">return</span> <span style="color:#a31515;">&#8220;action-message-success&#8221;</span>;</li>
<li style="background:#f3f3f3;">                <span style="color:#0000ff;">case</span> <span style="color:#2b91af;">ActionMessaeType</span>.Alert: <span style="color:#0000ff;">return</span> <span style="color:#a31515;">&#8220;action-message-alert&#8221;</span>;</li>
<li>                <span style="color:#0000ff;">case</span> <span style="color:#2b91af;">ActionMessaeType</span>.Failure: <span style="color:#0000ff;">return</span> <span style="color:#a31515;">&#8220;action-message-failure&#8221;</span>;</li>
<li style="background:#f3f3f3;">                <span style="color:#0000ff;">default</span>: <span style="color:#0000ff;">return</span> <span style="color:#a31515;">&#8220;action-success-warning&#8221;</span>;</li>
<li>            }</li>
<li style="background:#f3f3f3;">        }</li>
<li></li>
<li style="background:#f3f3f3;">        <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">string</span> ActionMessage(<span style="color:#0000ff;">this</span> <span style="color:#2b91af;">HtmlHelper</span> htmlHelper)</li>
<li>        {</li>
<li style="background:#f3f3f3;">            <span style="color:#0000ff;">return</span> ActionMessage(htmlHelper, <span style="color:#0000ff;">string</span>.Empty <span style="color:#008000;">/* message */</span>);</li>
<li>        }</li>
<li style="background:#f3f3f3;"></li>
<li>        <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">string</span> ActionMessage(<span style="color:#0000ff;">this</span> <span style="color:#2b91af;">HtmlHelper</span> htmlHelper, <span style="color:#2b91af;">List</span>&lt;<span style="color:#2b91af;">ActionMessage</span>&gt; messages)</li>
<li style="background:#f3f3f3;">        {</li>
<li>            <span style="color:#0000ff;">return</span> ActionMessage(htmlHelper, messages, <span style="color:#0000ff;">string</span>.Empty <span style="color:#008000;">/* htmlAttributes */</span>);</li>
<li style="background:#f3f3f3;">        }</li>
<li></li>
<li style="background:#f3f3f3;">        <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">string</span> ActionMessage(<span style="color:#0000ff;">this</span> <span style="color:#2b91af;">HtmlHelper</span> htmlHelper, <span style="color:#0000ff;">string</span> foraction)</li>
<li>        {</li>
<li style="background:#f3f3f3;">            <span style="color:#0000ff;">return</span> ActionMessage(htmlHelper, <span style="color:#0000ff;">null</span> <span style="color:#008000;">/*messages*/</span>, foraction, (<span style="color:#0000ff;">object</span>)<span style="color:#0000ff;">null</span> <span style="color:#008000;">/* htmlAttributes */</span>);</li>
<li>        }</li>
<li style="background:#f3f3f3;"></li>
<li>        <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">string</span> ActionMessage(<span style="color:#0000ff;">this</span> <span style="color:#2b91af;">HtmlHelper</span> htmlHelper, <span style="color:#2b91af;">List</span>&lt;<span style="color:#2b91af;">ActionMessage</span>&gt; messages,<span style="color:#0000ff;">string</span> foraction)</li>
<li style="background:#f3f3f3;">        {</li>
<li>            <span style="color:#0000ff;">return</span> ActionMessage(htmlHelper, messages,foraction, (<span style="color:#0000ff;">object</span>)<span style="color:#0000ff;">null</span> <span style="color:#008000;">/* htmlAttributes */</span>);</li>
<li style="background:#f3f3f3;">        }</li>
<li></li>
<li style="background:#f3f3f3;">        <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">string</span> ActionMessage(<span style="color:#0000ff;">this</span> <span style="color:#2b91af;">HtmlHelper</span> htmlHelper, <span style="color:#2b91af;">List</span>&lt;<span style="color:#2b91af;">ActionMessage</span>&gt; messages, <span style="color:#0000ff;">string</span> foraction, <span style="color:#0000ff;">object</span> htmlAttributes)</li>
<li>        {</li>
<li style="background:#f3f3f3;">            <span style="color:#0000ff;">return</span> ActionMessage(htmlHelper, messages, foraction, <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">RouteValueDictionary</span>(htmlAttributes));</li>
<li>        }</li>
<li style="background:#f3f3f3;">        <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">string</span> ActionMessage(<span style="color:#0000ff;">this</span> <span style="color:#2b91af;">HtmlHelper</span> htmlHelper, <span style="color:#2b91af;">List</span>&lt;<span style="color:#2b91af;">ActionMessage</span>&gt; messages, <span style="color:#0000ff;">string</span> foraction, <span style="color:#2b91af;">IDictionary</span>&lt;<span style="color:#0000ff;">string</span>, <span style="color:#0000ff;">object</span>&gt; htmlAttributes)</li>
<li>        {</li>
<li style="background:#f3f3f3;">            <span style="color:#008000;">//if no messages are passed in, the viewdata model is checked for messages to display</span></li>
<li>            <span style="color:#0000ff;">if</span> (messages == <span style="color:#0000ff;">null</span>)</li>
<li style="background:#f3f3f3;">                messages = (htmlHelper.ViewData.Model <span style="color:#0000ff;">as</span> <span style="color:#2b91af;">ViewModel</span>).ActionMessages;</li>
<li>            <span style="color:#0000ff;">else</span> <span style="color:#008000;">//merge parameter with view actionmessages</span></li>
<li style="background:#f3f3f3;">                messages.AddRange((htmlHelper.ViewData.Model <span style="color:#0000ff;">as</span> <span style="color:#2b91af;">ViewModel</span>).ActionMessages);</li>
<li></li>
<li style="background:#f3f3f3;">            <span style="color:#0000ff;">if</span> (messages == <span style="color:#0000ff;">null</span>) <span style="color:#0000ff;">return</span> <span style="color:#0000ff;">null</span>;</li>
<li>            <span style="color:#0000ff;">if</span> (!(messages.Count &gt; 0)) <span style="color:#0000ff;">return</span> <span style="color:#0000ff;">null</span>;</li>
<li style="background:#f3f3f3;"></li>
<li>            <span style="color:#0000ff;">if</span> (foraction != <span style="color:#0000ff;">null</span>)</li>
<li style="background:#f3f3f3;">               messages = messages.FindAll(<span style="color:#0000ff;">delegate</span>(ActionMessage actmgs) {<span style="color:#0000ff;">return</span> actmgs.ForAction == foraction; });</li>
<li></li>
<li style="background:#f3f3f3;">            <span style="color:#0000ff;">if</span> (messages == <span style="color:#0000ff;">null</span> || !(messages.Count &gt; 0)) <span style="color:#0000ff;">return</span> <span style="color:#0000ff;">null</span>;</li>
<li></li>
<li style="background:#f3f3f3;">            <span style="color:#2b91af;">StringBuilder</span> result = <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">StringBuilder</span>();</li>
<li></li>
<li style="background:#f3f3f3;">            <span style="color:#008000;">//Render Success Messages</span></li>
<li>            RenderActionMessage(messages, <span style="color:#2b91af;">ActionMessaeType</span>.Success, foraction, htmlAttributes,<span style="color:#0000ff;">ref</span> result);</li>
<li style="background:#f3f3f3;">            <span style="color:#008000;">//Render Alert Messages</span></li>
<li>            RenderActionMessage(messages, <span style="color:#2b91af;">ActionMessaeType</span>.Failure, foraction, htmlAttributes, <span style="color:#0000ff;">ref</span> result);</li>
<li style="background:#f3f3f3;">            <span style="color:#008000;">//Render Alert Messages</span></li>
<li>            RenderActionMessage(messages, <span style="color:#2b91af;">ActionMessaeType</span>.Alert, foraction, htmlAttributes, <span style="color:#0000ff;">ref</span> result);</li>
<li style="background:#f3f3f3;">            <span style="color:#008000;">//Render Warning Messages</span></li>
<li>            RenderActionMessage(messages, <span style="color:#2b91af;">ActionMessaeType</span>.Warning, foraction, htmlAttributes, <span style="color:#0000ff;">ref</span> result);</li>
<li style="background:#f3f3f3;"></li>
<li>            <span style="color:#008000;">//Render &#8230;..more types of messages</span></li>
<li style="background:#f3f3f3;"></li>
<li>            <span style="color:#0000ff;">return</span> result.ToString();</li>
<li style="background:#f3f3f3;">        }</li>
<li></li>
<li style="background:#f3f3f3;">        <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">void</span> RenderActionMessage(<span style="color:#2b91af;">List</span>&lt;<span style="color:#2b91af;">ActionMessage</span>&gt; messages, <span style="color:#2b91af;">ActionMessaeType</span> messagetype, <span style="color:#0000ff;">string</span> foraction, <span style="color:#2b91af;">IDictionary</span>&lt;<span style="color:#0000ff;">string</span>, <span style="color:#0000ff;">object</span>&gt; htmlAttributes,<span style="color:#0000ff;">ref</span> <span style="color:#2b91af;">StringBuilder</span> htmlresults)</li>
<li>        {</li>
<li style="background:#f3f3f3;">            <span style="color:#2b91af;">StringBuilder</span> htmlSummary = <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">StringBuilder</span>();</li>
<li></li>
<li style="background:#f3f3f3;">            <span style="color:#008000;">//Render  Messages</span></li>
<li>            <span style="color:#2b91af;">List</span>&lt;<span style="color:#2b91af;">ActionMessage</span>&gt; typemessages = messages.FindAll(<span style="color:#0000ff;">delegate</span>(ActionMessage actmgs) { <span style="color:#0000ff;">return</span> (actmgs.MessageType == messagetype &amp;&amp; actmgs.ForAction == foraction); });</li>
<li style="background:#f3f3f3;">            <span style="color:#0000ff;">if</span> (typemessages.Count &gt; 0)</li>
<li>            {</li>
<li style="background:#f3f3f3;"></li>
<li>                <span style="color:#2b91af;">TagBuilder</span> messageList = <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">TagBuilder</span>(<span style="color:#a31515;">&#8220;ul&#8221;</span>);</li>
<li style="background:#f3f3f3;">                messageList.MergeAttributes(htmlAttributes);</li>
<li>                messageList.MergeAttribute(<span style="color:#a31515;">&#8220;class&#8221;</span>, getActionMessageCssClassName(messagetype));</li>
<li style="background:#f3f3f3;"></li>
<li>                <span style="color:#0000ff;">foreach</span> (<span style="color:#2b91af;">ActionMessage</span> message <span style="color:#0000ff;">in</span> typemessages)</li>
<li style="background:#f3f3f3;">                {</li>
<li>                    <span style="color:#0000ff;">if</span> (!<span style="color:#2b91af;">String</span>.IsNullOrEmpty(message.Message))</li>
<li style="background:#f3f3f3;">                    {</li>
<li>                        <span style="color:#2b91af;">TagBuilder</span> listItem = <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">TagBuilder</span>(<span style="color:#a31515;">&#8220;li&#8221;</span>);</li>
<li style="background:#f3f3f3;">                        listItem.SetInnerText(message.Message);</li>
<li>                        listItem.MergeAttribute(<span style="color:#a31515;">&#8220;class&#8221;</span>, <span style="color:#2b91af;">ActionMessageExtension</span>.ActionMessageCssClassName);</li>
<li style="background:#f3f3f3;">                        htmlSummary.AppendLine(listItem.ToString(<span style="color:#2b91af;">TagRenderMode</span>.Normal));</li>
<li>                    }</li>
<li style="background:#f3f3f3;"></li>
<li>                }</li>
<li style="background:#f3f3f3;">                messageList.InnerHtml = htmlSummary.ToString();</li>
<li>                htmlresults.Append(messageList.ToString(<span style="color:#2b91af;">TagRenderMode</span>.Normal));</li>
<li style="background:#f3f3f3;">            }</li>
<li>        }</li>
<li style="background:#f3f3f3;"></li>
<li></li>
<li style="background:#f3f3f3;">    }</li>
</ol>
</div>
</div>
</div>
<p>And here is how its used in the Contact.aspx view.</p>
<pre class="code"><span style="background:#ffee62;">&lt;%</span><span style="color:blue;">=</span>Html.ActionMessage(<span style="color:#a31515;">"create-contact-failure"</span>) <span style="background:#ffee62;">%&gt;</span></pre>
<p>&nbsp;</p>
<p>I hope this help. I’m having a hard time finding a good code plug in for Live Writer as I am not so pleased with how the code is presented above. When I do find a good one, I will update the code section of the post.</p>
<p><strong><span style="font-size:medium;">Future</span></strong></p>
<p>Like i said, this was just a hack. The best way will be to have the Message Collection as a property of the ViewData since it cannot be used in its current state without using a strongly typed view who’s Model inherits from the base ViewModel class. That’s using Injection of some sort to update the ViewData used in the Views. I also want to pipe all the validation errors for the ModelState through the ActionMessage helper so I can use that as an all purpose notification mechanism.</p>
<p>If you have any suggestions, please let me know.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/emmanuelbuah.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/emmanuelbuah.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/emmanuelbuah.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/emmanuelbuah.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/emmanuelbuah.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/emmanuelbuah.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/emmanuelbuah.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/emmanuelbuah.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/emmanuelbuah.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/emmanuelbuah.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/emmanuelbuah.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/emmanuelbuah.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/emmanuelbuah.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/emmanuelbuah.wordpress.com/143/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emmanuelbuah.wordpress.com&amp;blog=3572392&amp;post=143&amp;subd=emmanuelbuah&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://emmanuelbuah.wordpress.com/2009/09/27/asp-net-mvc-reaction-to-actions/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:thumbnail url="http://emmanuelbuah.files.wordpress.com/2009/09/actionreaction.png?w=150" />
		<media:content url="http://emmanuelbuah.files.wordpress.com/2009/09/actionreaction.png?w=150" medium="image">
			<media:title type="html">action&#38;reaction</media:title>
		</media:content>

		<media:content url="http://0.gravatar.com/avatar/4535293c14b47285dc8a7d1980d14f54?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">emmanuelbuah</media:title>
		</media:content>
	</item>
		<item>
		<title>Timestamp issue with MySql connector 6.0 &#8211; 6.1 for Entity Framework</title>
		<link>http://emmanuelbuah.wordpress.com/2009/09/26/timestamp-issue-with-mysql-connector-6-0-6-1-for-entity-framework/</link>
		<comments>http://emmanuelbuah.wordpress.com/2009/09/26/timestamp-issue-with-mysql-connector-6-0-6-1-for-entity-framework/#comments</comments>
		<pubDate>Sat, 26 Sep 2009 22:28:44 +0000</pubDate>
		<dc:creator>emmanuelbuah</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>

		<guid isPermaLink="false">http://emmanuelbuah.wordpress.com/2009/09/26/timestamp-issue-with-mysql-connector-6-0-6-1-for-entity-framework/</guid>
		<description><![CDATA[This is really a short post as to highlight an issue that I run into (and most will) when using MySql with Entity Framework employing the mysql connector net. &#160; Scenario I work mostly on my laptop which has mysql connector 6.0.4 installed. Using the connector in conjunction with EF v1 generated my domain object [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emmanuelbuah.wordpress.com&amp;blog=3572392&amp;post=142&amp;subd=emmanuelbuah&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is really a short post as to highlight an issue that I run into (and most will) when using MySql with Entity Framework employing the mysql connector net.</p>
<p>&nbsp;</p>
<p><strong><span style="font-size:medium;">Scenario</span></strong></p>
<p>I work mostly on my laptop which has mysql connector 6.0.4 installed. Using the connector in conjunction with EF v1 generated my domain object with timestamp fields mapping from a binary in my conceptual schema to timestamp in my physical schema.  Everything worked just fine till I deployed to my production machine and realized I didn’t have mysql connector installed on my production server. So…I did what most will do, download the connect but installed the latest version (v6.1). After deploying my app to the server, the unexpected happened. My app was broken. The error message indicated that Edm.binary was not compatible to mysql.timestamp. OK, I was stumped. The app works just fine on my my laptop why not on my server.</p>
<p>&nbsp;</p>
<p><strong><span style="font-size:medium;">Solution</span></strong></p>
<p>After a couple of hours using process of elimination, I realized that using version 6.1 of the connector sets your mapping for timestamp from Edm.DateTimeOffset(conceptual schema) to timestamp (physical schema)which worked fine but version 6.0.4 of the connector sets your mapping for timestamp from Edm.binary(conceptual schema) to timestamp (physical schema) which also works as well. DateTimeOffset is a type specific to Sql server so the best option for me was to stay with 6.0.1  (using binary) which is generic and can be used with other db’s if ever need.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/emmanuelbuah.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/emmanuelbuah.wordpress.com/142/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/emmanuelbuah.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/emmanuelbuah.wordpress.com/142/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/emmanuelbuah.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/emmanuelbuah.wordpress.com/142/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/emmanuelbuah.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/emmanuelbuah.wordpress.com/142/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/emmanuelbuah.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/emmanuelbuah.wordpress.com/142/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/emmanuelbuah.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/emmanuelbuah.wordpress.com/142/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/emmanuelbuah.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/emmanuelbuah.wordpress.com/142/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emmanuelbuah.wordpress.com&amp;blog=3572392&amp;post=142&amp;subd=emmanuelbuah&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://emmanuelbuah.wordpress.com/2009/09/26/timestamp-issue-with-mysql-connector-6-0-6-1-for-entity-framework/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4535293c14b47285dc8a7d1980d14f54?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">emmanuelbuah</media:title>
		</media:content>
	</item>
	</channel>
</rss>
