23 September, 2008

Visual SourceSafe 2005 and Visual Studio 2005/2008

I am using VSS2005 as source control system for private projects.
To make sure you are actually running on the latest bits – it is sometimes desirable to open the projects directly from VSS over your own harddisk. To enable this trick – you need to install a hotfix to VS2005/2008. Without it, some features like "Open from Source Control" will not work at all.

How to:

Download this: http://www.microsoft.com/downloads/details.aspx?FamilyID=FAF41EDD-924D-449F-AEFC-9C86DD499720&displaylang=en
and install the bits.

Don’t worry it says CTP – it still works like a charm!

VSS open dialog

 

From another blog:
Why does SourceSafe need an update anyway?  Aren't VS plugin interfaces supposed to be backwards compatible?  Yes, they are.  In fact, there are no changes to the MSSCCI API in 2008; none of the fixes are related to MSSCCI.  (3rd party source control developers can now breathe a sigh of relief).  The changes come from the way SourceSafe implements Open from Source Control, Add to Source Control, and Share inside Visual Studio. Starting in VSS 2005, these functions let you browse the database inside VS's open/add dialogs instead of hanging off the File -> Source Control menu like most other source control providers.

Visual SourceSafe 2005 and Visual Studio 2005/2008

I am using VSS2005 as source control system for private projects.
To make sure you are actually running on the latest bits – it is sometimes desirable to open the projects directly from VSS over your own harddisk. To enable this trick – you need to install a hotfix to VS2005/2008. Without it, some features like "Open from Source Control" will not work at all.

How to:

Download this: http://www.microsoft.com/downloads/details.aspx?FamilyID=FAF41EDD-924D-449F-AEFC-9C86DD499720&displaylang=en
and install the bits.

Don’t worry it says CTP – it still works like a charm!

VSS open dialog

 

From another blog:
Why does SourceSafe need an update anyway?  Aren't VS plugin interfaces supposed to be backwards compatible?  Yes, they are.  In fact, there are no changes to the MSSCCI API in 2008; none of the fixes are related to MSSCCI.  (3rd party source control developers can now breathe a sigh of relief).  The changes come from the way SourceSafe implements Open from Source Control, Add to Source Control, and Share inside Visual Studio. Starting in VSS 2005, these functions let you browse the database inside VS's open/add dialogs instead of hanging off the File -> Source Control menu like most other source control providers.

 

UPDATE:

See also this post: http://blog.clauskonrad.net/2009/05/selected-file-is-not-valid-solution.html

22 September, 2008

Accidently switching into English keyboard settings when working in Visual Studio

For a long time – I’ve had the “pleasure” of sometimes being pretty annoyed when I press “something in VS” and I all of a sudden am working with an English Keyboard. It is only so in VS and not in all other applications.

Today a colleague showed me what was the issue: When you press LeftAlt + Shift + F10 to resolve a class into the proper namespace – you actually invoke the Windows Language bar as well. This triggers Windows to perform a keyboardswitch into English (which is default language). As I’ve only removed the languagebar from view – but not uninstalled the English keyboard support – I had a problem.

To resolve this:

  1. Open “Regional and Language Options” in Windows
  2. Go to Keyboards and Languages
  3. Change Keyboards…
  4. Delete English keyboard support
  5. Voila!

That is all there is to it. You don’t even have to restart Windows to see the effect.

19 September, 2008

Creating an ASP.NET simulated Windows Service

I've recently had the need of creating a "Windows Service like" behavior on my hosted website that allowed for a scheduled execution kind of operation. As I'm not able to install Windows Services on my website hosting company's servers, I need to resolve to another solution. With the great help of a college, we came up with this simple yet beautiful solution: Use the ASP.NET Cache for invoking a worker method on intervals.

To make this work - you need to register the cache object on the "page_load" event on a page in your application. This loading will insert an object in the cache. The trick here is to make this cache expire and to use the callback delegate on this expiration.

First of all - you need to make a dummy page (aspx) what is responsible for registering the cacheobject in the first place.

/// <summary>
///
Dummy page for registering a cache-entry.
/// </summary>
public partial class Retriever : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
CacheRegistration.RegisterCacheEntry();
}
}



Next - the below shows the registration of the cache item. As evident from the cacheregistration - a delegate pointing to WorkerMethod is added in the cache registration.



/// <summary>
///
Registers the cache entry.
/// </summary>
public static void RegisterCacheEntry()
{
Logger.DebugWriteEnter("CacheRegistration.RegisterCacheEntry");

if (HttpContext.Current.Cache["cache"] != null)
return;

int intervalSec = Convert.ToInt32(ConfigurationManager.AppSettings["retrivelIntervalSec"]);

//register cache entry
HttpContext.Current.Cache.Add("cache", string.Empty, null, DateTime.MaxValue, TimeSpan.FromSeconds(intervalSec),
CacheItemPriority.High, new CacheItemRemovedCallback(WorkerMethod));

Logger.DebugWriteLeave("CacheRegistration.RegisterCacheEntry");
}


This will call the method below on cacheexpiration.



/// <summary>
///
This method is called on CacheExpiration (and will perform the work to do).
/// </summary>
/// <param name="key">
The key.</param>
/// <param name="value">
The value.</param>
/// <param name="reason">
The reason.</param>
static void WorkerMethod(string key, object value, CacheItemRemovedReason reason)
{
Logger.DebugWriteEnter("CacheRegistration.CallBackMethod");

//Do work here!

//make a call to retriver page to re-set the cache.
WebClient client = new WebClient();
client.DownloadData("http://<somesite>/retriever.aspx");

Logger.DebugWriteLeave("CacheRegistration.CallBackMethod");
}



To make sure the cache is registered again (to let it expire next time); you need to make a programmatic call to the page of interest using in this case a WebClient instance.


Now - you have a fully functional ecosystem working in the same manner as a windows service that allows you to execute repeated tasks in a scheduler like behavior. And in addition hosted at a remote provider. Simple and easy!

16 September, 2008

Convert your Windows Server 2008 to a Workstation!

Having switched from Vista into Win2008 Server as development workstation, I've come across a great resource on how to tweak the Server OS!

Link here: http://www.win2008workstation.com/wordpress/


InRiver: Not loading your extensions?

(You really need to in the loop to appreciate the issue this post addresses). Man, I've been fighting this problem for hours before I ...