Archives for category: .NET

Thanks to a tip in this video by Cocoa Samurai/Colin Wheeler:

Distributed Version Control with Git on Vimeo:

This is a screencast based off a talk I gave to the Des Moines Cocoaheads group. In this talk I tried to show why you should switch from Centralized Version Control, what is wrong with Subversion and what git does well. Check out Part II when I demonstrate Git and some apps available on Mac OS X to help you get the most out of git.

…you can configure File Merge to be used by default by Git version control system:

git config –global merge.tool opendiff

Haven’t tried it yet but it’s a great tip and I’m looking forward to implementing it once I get Git up and running properly…

Thanks!

Seems that I occasionally need to trigger the postback on an UpdatePanel, and invariably I forget between usages.

Since this particular post from Encosia has saved my bacon on more than one occasion, I shall share it here (and for my own future benefit):

Easily refresh an UpdatePanel, using JavaScript | Encosia:

I’ve noticed a lot of discussion lately regarding methods to refresh an UpdatePanel via client script. This is very easy on the server side, of course. You can just call UpdatePanel.Update(). However, on the client side, the most common solutions I’ve been seeing just don’t feel right. Many will advise you to use a hidden button control inside the UpdatePanel, manipulated via button.click(), to trigger a partial postback of the UpdatePanel. While it does work, I never have been able to get past the kludgey nature of that solution.

In a nutshell, we can use the __doPostBack() method:

Luckily, there’s an easy method for triggering a postback targeted at the UpdatePanel: __doPostBack().

As long as the event target of a __doPostBack() call is an async trigger of an UpdatePanel, the ASP.NET AJAX framework will intercept the postback and fire a partial postback instead. For purposes of demonstration, I’m going to add that to the OnClick event of the container div:

<div id="Container" onclick="__doPostBack('UpdatePanel1', '');">

Now, clicking anywhere in the UpdatePanel will trigger a partial postback, targeting the UpdatePanel. Since partial postbacks follow the full page lifecycle, this will fire UpdatePanel1_Load and update the Label’s text.

Someone on the ASP.NET forums asked how to set session variables in JavaScript. The answers given ranged from “totally wrong” to “rather misleading” or “marginally helpful”.

So in a nutshell, yes, you can totally do it. Not only will you be able to do it, you will love doing it after you get used to the process of getting it set up.

Here’s the recipe for success:

  • Add an ASP.NET AJAX ScriptManager to your page.
  • Create a simple ASMX Web service using Visual Studio.
  • Uncomment the Attribute directly above the class definition that reads [System.Web.Script.Services.ScriptService] to enable ASP.NET AJAX to see your web methods.
  • Create a method to get or update data in your session, and make sure the Attribute above the web method reads [WebMethod(EnableSession = true)] so you can have access to the session via your web service method.
  • Add a <Services> section to your ScriptManager.
  • In the <Services> section add a <ServiceReference> element with the Path attribute set to the path of your .asmx page.

OK, so that enables the ability to access your session from the client side.

But here’s the really awesome part:  if you include a reference to the web service in your .js file like so:

///<reference path=”~/MyServices/MyService.asmx” />

…you will get IntelliSense in the JavaScript for your web service methods! it’s very cool.

So then you just call your web service methods like you would any other JavaScript function. It’s totally easy and almost magical. It’s one of my favorite features of ASP.NET AJAX.

LukeW | Designing with Keynote:

Recently, an increasing number of designers are turning to Apple’s presentation making software, Keynote, to design and prototype software applications. Here’s a few reasons why and some tips learned along the way.

30+ Handy Blank Templates for Designers | Creative Repository:

Sometimes you have a nice concept for a design in your mind, but you don’t know where to start; or sometimes you are just not aware of the right size for the design to implement. That’s where templates come handy. I have collected some very useful templates with proper guidelines, sizes and resolutions for design projects like business cards, letterheads, vinyl designs, brochures etc. I believe that these will prove to be a great time-saver for many of you guys. Most of these are in PSD or AI format, and are easily editable. Hope you find them useful.

I had run into this problem before.

Setup

  1. I have my Visual Studio 2008 options set to reload the previously loaded solution on startup.
  2. I use Subversion.
  3. I use AnkhSVN as my SVN provider in Visual Studio 2008.

Problem
If I launched Visual Studio 2008 with a particular solution loaded when I last closed VS, I would receive a “Source control provider could not be found” error.

However… if I just launched it via double-clicking on the .SLN file in my file system, no error!!!

Weird.

OK – so I did a quick diff on a solution that I knew worked fine. Both had the expected source control provider information embedded:

SccProjectName = "Svn"
SccAuxPath = "Svn"
SccLocalPath = "Svn"
SccProvider = "SubversionScc"

However there was a difference.

The solution that did not generate the error message also contained the following block in the “Global” section:

GlobalSection(SubversionScc) = preSolution
    Svn-Managed = True
    Manager = AnkhSVN - Subversion Support for Visual Studio
EndGlobalSection

Which somehow got generated in one solution, but not the one causing problems. Once I copied the block from one solution to the other, the error message ceased to be shown on launch of VS2008.