<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1206571740479812463</id><updated>2012-01-12T14:58:41.323-08:00</updated><category term='c#'/><category term='asp.net'/><category term='architecture'/><category term='HtmlHelper'/><category term='mvc2'/><title type='text'>STEVE DEVELOPS .NET</title><subtitle type='html'>DO OR DO NOT... THERE IS NO TRY</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://stevedevelops.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1206571740479812463/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://stevedevelops.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Steve Hayes</name><uri>http://www.blogger.com/profile/06593903536584236730</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://bp2.blogger.com/_vHC17YcAdX0/SGvetSJYFiI/AAAAAAAAAAM/KGtAX9cN8hA/S220/SteveFace.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>3</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1206571740479812463.post-250193408946620978</id><published>2011-06-02T08:26:00.000-07:00</published><updated>2011-06-02T08:49:08.647-07:00</updated><title type='text'>Mercurial: Setting the Default Branch</title><content type='html'>I have been working up here at Microsoft for a few months now on the Server &amp;amp; Tools Online (STO) team and was introduced to Mercurial. So far I have been very impressed by the way it handles source control, branching, merging and everything that goes along with it.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So I decided to give it a try for some of my own personal projects. Let me tell you, I have had my fair share of problems, primarily because I have no idea what I am doing. Since everything was already in place here at MS, I didn't have to know about all the different setting/config files and how to set them up. As I continue my adventure through Mercurial-land, I'll be sure (try) to post my findings in hopes that it helps you, the reader.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So I created my new Mercurial repository using &lt;a href="http://bitbucket.org"&gt;bitbucket.org&lt;/a&gt; and uploaded my initial project per the instructions. I won't go into detail about how that works at the moment, perhaps in another post. Anyways, I started working away on my home machine and everything was going great...or so I thought. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I checked in my code and then tried to do a &lt;i&gt;hg push &lt;/i&gt;only to receive the message: &lt;/div&gt;&lt;div&gt;"abort: repository default not found!"&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;"Huh, well that's odd" I thought to myself, "I only have one repo and only one branch in that repo. So I would assume that the only branch in it would be the default". Well I was correct, however didn't know that I simply needed to update one of the setting files and set the default path to the url of my repository. Here is where and how to do it:&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Navigate to the local copy of your repository&lt;/li&gt;&lt;li&gt;Find the folder named "&lt;i&gt;.hg&lt;/i&gt;" and open it up&lt;/li&gt;&lt;li&gt;Inside of the folder is a file named "&lt;i&gt;hgrc&lt;/i&gt;" which contains various settings specific to the repository. Right click and open it with your favorite text editor&lt;/li&gt;&lt;li&gt;Locate the &lt;i&gt;[path] &lt;/i&gt;section. If this doesn't exist, add it&lt;/li&gt;&lt;li&gt;Under &lt;i&gt;[path] &lt;/i&gt;enter the following: &lt;i&gt;default = https://path/to/your/hosted/source (ie: https://bitbucket.org/username/repository)&lt;/i&gt;&lt;/li&gt;&lt;li&gt;Save the file and that's it!&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;Now when you do a &lt;i&gt;hg push &lt;/i&gt;or &lt;i&gt;hg fetch &lt;/i&gt;it will now know where to go to manage the files.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Happy Coding!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1206571740479812463-250193408946620978?l=stevedevelops.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stevedevelops.blogspot.com/feeds/250193408946620978/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1206571740479812463&amp;postID=250193408946620978' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1206571740479812463/posts/default/250193408946620978'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1206571740479812463/posts/default/250193408946620978'/><link rel='alternate' type='text/html' href='http://stevedevelops.blogspot.com/2011/06/mercurial-setting-default-branch.html' title='Mercurial: Setting the Default Branch'/><author><name>Steve Hayes</name><uri>http://www.blogger.com/profile/06593903536584236730</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://bp2.blogger.com/_vHC17YcAdX0/SGvetSJYFiI/AAAAAAAAAAM/KGtAX9cN8hA/S220/SteveFace.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1206571740479812463.post-541624612667630688</id><published>2011-01-24T10:01:00.001-08:00</published><updated>2011-01-24T10:03:45.391-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='HtmlHelper'/><category scheme='http://www.blogger.com/atom/ns#' term='mvc2'/><category scheme='http://www.blogger.com/atom/ns#' term='asp.net'/><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><title type='text'>Display Image from a DB using MVC 2 &amp; HtmlHelper</title><content type='html'>&lt;font face="Consolas"&gt;On a recent project, I wanted to extend the HtmlHelper to read in an image from a database and render it to my View using MVC 2. After various failed attempts and research, I put together a pretty simple way to accomplish my task.&lt;/font&gt; &lt;br /&gt;&lt;br /&gt;  &lt;h2&gt;The model&lt;/h2&gt;  &lt;p&gt;&lt;font face="Consolas"&gt;First we build out the model, which is pretty straight forward.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_vHC17YcAdX0/TT2-bU92KoI/AAAAAAAAACc/LBEJEeTruX0/s1600-h/Model%5B4%5D.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Model" border="0" alt="Model" src="http://lh5.ggpht.com/_vHC17YcAdX0/TT2-bx7omXI/AAAAAAAAACg/x7XPa5Am_Eg/Model_thumb%5B2%5D.jpg?imgmax=800" width="405" height="169" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;the service&lt;/h2&gt;  &lt;p&gt;&lt;font face="Consolas"&gt;Next, we build the service call to get the image from the database by ID and return to us a populated model.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_vHC17YcAdX0/TT2-cKldW1I/AAAAAAAAACk/CvMM3r0qN6M/s1600-h/Service-GetContactPhoto%5B3%5D.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Service-GetContactPhoto" border="0" alt="Service-GetContactPhoto" src="http://lh6.ggpht.com/_vHC17YcAdX0/TT2-dBFQCtI/AAAAAAAAACo/GsXbwhwzeDA/Service-GetContactPhoto_thumb%5B1%5D.jpg?imgmax=800" width="598" height="254" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Consolas"&gt;Now that we have the service and model setup and ready to go, we need to add a method to the controller that returns a &lt;strong&gt;FileContentResult&lt;/strong&gt;. All the &lt;strong&gt;FileContentResult &lt;/strong&gt;does is simply send the contents of a binary file to the response, which I will be using inside of the HtmlHelper.&lt;/font&gt;&lt;/p&gt;  &lt;h2&gt;the controller&lt;/h2&gt;  &lt;p&gt;&lt;font face="Consolas"&gt;&lt;a href="http://lh6.ggpht.com/_vHC17YcAdX0/TT2-dQSH2HI/AAAAAAAAACs/8Q9gt3PvPGk/s1600-h/Controller-GetPhoto%5B6%5D.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Controller-GetPhoto" border="0" alt="Controller-GetPhoto" src="http://lh4.ggpht.com/_vHC17YcAdX0/TT2-eI1-6PI/AAAAAAAAACw/0EoYfAn715o/Controller-GetPhoto_thumb%5B4%5D.jpg?imgmax=800" width="536" height="119" /&gt;&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Consolas"&gt;Again, pretty straight-forward as to how this works. I get the model from the service (in this case my service is &lt;strong&gt;contactService&lt;/strong&gt;) and then return a &lt;strong&gt;File&lt;/strong&gt; passing in the content byte[] and content type string.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Consolas"&gt;Now to the HtmlHelper and actually rendering the image to the View.&lt;/font&gt;&lt;/p&gt;  &lt;h2&gt;the htmlhelper&lt;/h2&gt;  &lt;p&gt;&lt;font face="Consolas"&gt;&lt;a href="http://lh3.ggpht.com/_vHC17YcAdX0/TT2-eYTEABI/AAAAAAAAAC0/9w8xAvvKYSw/s1600-h/HtmlHelper-ContactImage%5B3%5D.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="HtmlHelper-ContactImage" border="0" alt="HtmlHelper-ContactImage" src="http://lh4.ggpht.com/_vHC17YcAdX0/TT2-ejvkYLI/AAAAAAAAAC4/9VdHuz4_1PY/HtmlHelper-ContactImage_thumb%5B1%5D.jpg?imgmax=800" width="584" height="144" /&gt;&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Consolas"&gt;First, we set the &lt;strong&gt;urlHelper&lt;/strong&gt; to the requesting controllers &lt;strong&gt;Url&lt;/strong&gt;. Then we call the &lt;strong&gt;urlHelper.Action &lt;/strong&gt;which calls our controller method that we created earlier and passes in the &lt;strong&gt;pictureId&lt;/strong&gt;. Finally, we use the &lt;strong&gt;TagBuilder &lt;/strong&gt;to build an &lt;strong&gt;img &lt;/strong&gt;tag, merge the &lt;strong&gt;src &lt;/strong&gt;with the content from the controller, and return the tag to be rendered onto the View. You could extend this example and add in properties for the image ID, alt attribute, etc. if you wanted to. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Consolas"&gt;Now, anytime you need to render an image from the database, you simply use the HtmlHelper, pass in the ID and that’s it! &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_vHC17YcAdX0/TT2-exOp6lI/AAAAAAAAAC8/bel7bblSfBc/s1600-h/View-CallHelper%5B3%5D.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="View-CallHelper" border="0" alt="View-CallHelper" src="http://lh5.ggpht.com/_vHC17YcAdX0/TT2-faBaMRI/AAAAAAAAADA/tK29hlt8tyU/View-CallHelper_thumb%5B1%5D.jpg?imgmax=800" width="423" height="23" /&gt;&lt;/a&gt;&lt;font face="Consolas"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Consolas"&gt;As always, I want to hear your questions, comments, and feedback as to what I can do to make this better.&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1206571740479812463-541624612667630688?l=stevedevelops.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stevedevelops.blogspot.com/feeds/541624612667630688/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1206571740479812463&amp;postID=541624612667630688' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1206571740479812463/posts/default/541624612667630688'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1206571740479812463/posts/default/541624612667630688'/><link rel='alternate' type='text/html' href='http://stevedevelops.blogspot.com/2011/01/display-image-from-db-using-mvc-2.html' title='Display Image from a DB using MVC 2 &amp;amp; HtmlHelper'/><author><name>Steve Hayes</name><uri>http://www.blogger.com/profile/06593903536584236730</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://bp2.blogger.com/_vHC17YcAdX0/SGvetSJYFiI/AAAAAAAAAAM/KGtAX9cN8hA/S220/SteveFace.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_vHC17YcAdX0/TT2-bx7omXI/AAAAAAAAACg/x7XPa5Am_Eg/s72-c/Model_thumb%5B2%5D.jpg?imgmax=800' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1206571740479812463.post-6392631126834312766</id><published>2011-01-17T00:13:00.000-08:00</published><updated>2011-01-18T00:37:12.976-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mvc2'/><category scheme='http://www.blogger.com/atom/ns#' term='asp.net'/><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><category scheme='http://www.blogger.com/atom/ns#' term='architecture'/><title type='text'>Architecting an Application: Project Structure</title><content type='html'>&lt;p&gt;I don’t think that many developers think about how important the architecture and project structure of the application is. I have had multiple conversations about the right and wrong way to properly structure an application and after all of the information that I have learned, I decided to architect, what I believe, to be a good design. &lt;/p&gt;  &lt;p&gt;I call it &lt;strong&gt;Project PROTOTYPE&lt;/strong&gt;. It uses the .NET 4.0 Framework, &lt;a href="http://asp.net/mvc" target="_blank"&gt;MVC 2&lt;/a&gt;, &lt;a href="http://ninject.org" target="_blank"&gt;Ninject&lt;/a&gt;, Membership Services, NLog, StyleCop, and ReSharper.&lt;/p&gt;  &lt;p&gt;   &lt;table border="0" cellspacing="0" cellpadding="2" width="631"&gt;&lt;tbody&gt;       &lt;tr&gt;         &lt;td valign="top" width="142"&gt;&lt;a href="http://lh6.ggpht.com/_vHC17YcAdX0/TTQDvdMQVAI/AAAAAAAAABw/FfWj7gBHm7g/s1600-h/project-structure-01%5B3%5D.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="project-structure-01" border="0" alt="project-structure-01" src="http://lh4.ggpht.com/_vHC17YcAdX0/TTQDvuMZlmI/AAAAAAAAAB0/5Xh0dmbsV70/project-structure-01_thumb%5B1%5D.jpg?imgmax=800" width="160" height="640" /&gt;&lt;/a&gt;&lt;/td&gt;          &lt;td valign="top" width="10"&gt;&amp;nbsp;&lt;/td&gt;          &lt;td valign="top" width="477"&gt;&lt;strong&gt;4 Projects – &lt;/strong&gt;I get a lot of mixed feelings about the idea of forcing separation of concerns through the use of projects, however from my experience I have found the pros outweigh the cons. Each project represents the different layers of the application, from Front End/UI, Business Logic, and Data Access, as well as a &lt;em&gt;Tasks &lt;/em&gt;project to help with common tasks, which I’ll get into a little bit more shortly.             &lt;br /&gt;            &lt;br /&gt;            &lt;ul&gt;             &lt;li&gt;&lt;strong&gt;Client – &lt;/strong&gt;I modified the out-of-the-box project that MS gives you to what I think makes a little more sense.                 &lt;ul&gt;                 &lt;li&gt;&lt;em&gt;Public &lt;/em&gt;– This is where I keep all of the publically available content such as css, images, downloadables, etc. &lt;/li&gt;                  &lt;li&gt;&lt;em&gt;Utilities&lt;/em&gt; – This is where I put helpers, enums, base classes, and other code related items.                     &lt;ul&gt;                     &lt;li&gt;&lt;em&gt;Config – &lt;/em&gt;This folder stores configuration files such as Connection Strings, App Settings, etc. &lt;/li&gt;                   &lt;/ul&gt;                 &lt;/li&gt;               &lt;/ul&gt;             &lt;/li&gt;              &lt;li&gt;&lt;strong&gt;Core – &lt;/strong&gt;This is the backbone of the application. Here is where all of the business logic is done. When a Controller makes a request, the &lt;em&gt;Services &lt;/em&gt;do all of the processing and return back a model to the Controller. That way the Controller only passes data back and forth between the Views and the Services and does little to no logic.                 &lt;ul&gt;                 &lt;li&gt;&lt;em&gt;Models – &lt;/em&gt;I moved the Models from the Client project into the Core. Since the &lt;em&gt;Core &lt;/em&gt;deals with building the Models, keeping it with the services makes more sense, especially since the &lt;em&gt;Client &lt;/em&gt;has a reference to the &lt;em&gt;Core &lt;/em&gt;project anyways. &lt;/li&gt;                  &lt;li&gt;&lt;em&gt;Services – &lt;/em&gt;I like to use folders to keep my projects organized. When creating new services, it is important to remember to add it to the IoC (Ninject SiteModule). &lt;/li&gt;               &lt;/ul&gt;             &lt;/li&gt;              &lt;li&gt;&lt;strong&gt;Data – &lt;/strong&gt;Here I usually have a LinqToSql .dbml or something like that for my Data Access. The great part is that you may add whatever you like! &lt;/li&gt;              &lt;li&gt;&lt;strong&gt;Tasks – &lt;/strong&gt;This concept was adopted from &lt;a href="http://tekpub.com/" target="_blank"&gt;Rob Connery from TekPub&lt;/a&gt; where in his MVC 2 videos he talks about a &lt;em&gt;Tasks &lt;/em&gt;Console project that is used to perform various common tasks when building an application. For example, maybe you have to insert some data into a table or modify some existing status. You can pop that into the &lt;em&gt;Tasks &lt;/em&gt;project and with a command or two, you can do exactly those things. &lt;/li&gt;           &lt;/ul&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/p&gt;  &lt;p&gt;So that’s my idea for a good clean design for an application. I encourage your feedback, comments, and suggestions as I am always open to new ideas and ways to grow.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1206571740479812463-6392631126834312766?l=stevedevelops.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stevedevelops.blogspot.com/feeds/6392631126834312766/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1206571740479812463&amp;postID=6392631126834312766' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1206571740479812463/posts/default/6392631126834312766'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1206571740479812463/posts/default/6392631126834312766'/><link rel='alternate' type='text/html' href='http://stevedevelops.blogspot.com/2011/01/architecting-application-project.html' title='Architecting an Application: Project Structure'/><author><name>Steve Hayes</name><uri>http://www.blogger.com/profile/06593903536584236730</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://bp2.blogger.com/_vHC17YcAdX0/SGvetSJYFiI/AAAAAAAAAAM/KGtAX9cN8hA/S220/SteveFace.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/_vHC17YcAdX0/TTQDvuMZlmI/AAAAAAAAAB0/5Xh0dmbsV70/s72-c/project-structure-01_thumb%5B1%5D.jpg?imgmax=800' height='72' width='72'/><thr:total>1</thr:total></entry></feed>
