Posts

Showing posts from 2011
Easy read on WPF / Silverlight leak management http://www.simple-talk.com/content/article.aspx?article=1337

Simple MVC3/Razor Fileupload and Storage

Recently I had to add a simple fileupload control in an MVC3 Razor page. It wasn't very difficult to do, thanks to System.Web.Helpers and Microsoft.Web.Helpers. To begin... if you don't have Microsoft.Web.Helpers, find and install through NuGet. pm > Install-Package microsoft-web-helpers Next in your Razor view add the following : @using Microsoft.Web.Helpers @{ ViewBag.Title = "Upload Files"; } @using (Html.BeginForm("Upload","Upload", FormMethod.Post, new { @encType = "multipart/form-data" })) { @FileUpload.GetHtml(initialNumberOfFiles:1, allowMoreFilesToBeAdded:true, includeFormTag:false, addText:"Add Files", uploadText: "Upload File") < input type="submit" name="submit" text="upload" /> } Next in your Upload Controller add the following. The submit button on the Razor page submits the form to the Upload

Setting up a git repository

If I am creating a repository from scratch, then I pick the creating and commiting option. Creating and Commiting $ cd (project-directory) $ git init $ (add some files) $ git add . $ git commit -m 'Initial commit' Once that is done, then I can clone the repository from any computer by following the Cloning and Creating Patch directions. Cloning and Creating a Patch $ git clone git://github.com/git/hello-world.git $ cd hello-world $ (edit files) $ git add (files) $ git commit -m 'Explain what I changed' $ git format-patch origin/master Pushing a branch $ (execute the following in the remote repository) $ git config --bool core.bare true $ (delete all files in remote repository except the .git folder) $ (now you can push to the remote repository from any branch) $ git push origin master Git Reference http://git-scm.com/

ReportViewer control in web application story

Most articles out there talk about adding a report viewer control in Visual Studio to a windows form. If we need to add the same control to a web application, it isn't as straight forward. The following is my ReportViewerControl in web app story. After hours of trial and error and frustration, this is what worked for me. Follow the directions at http://msdn.microsoft.com/en-us/library/ms251669.aspx to create your web application. My report was running on native mode so the report server url was http://(myserver-name)/ReportServer and the report path does NOT have a .rdl extension. Next we have to implement the interface IReportServerCredentials to authenticate through to the server that hosts the actual report. It was not easy to find one clean solution and therefore I blog about it. using System; using System.Configuration; using System.Net; using System.Security.Principal; using Microsoft.Reporting.WebForms; public partial class POCReportViewerControl : System.Web.UI.Page { pro