Making visual studio extensions work with vs 2011 developer preview


If you want to make your Visual Studio 2010 extensions work in Visual Studio 2011 Developer Preview, there is a little hack that you can do.

NOTE: Since this is a hack, there is NO guarantee that the extension will work properly.  But it might be worth giving a shot if, like me, the only thing stopping you from using VS 2011 is a few extensions that you just cannot live without :)

Also note that this only applies to vsix extensions.

1. Download the vsix file

To do this, go to the Visual Studio Gallery and search for your extension of choice.

Visual Studio Gallery
Visual Studio Gallery

Once you find you extension, download it to your desktop (or wherever)

Download Visual Studio Extension
Download Visual Studio Extension

(yes, that is one extension that I just cannot live without, it’s fantastic! Get it here)

2. Rename the file to zip

Once the file is downloaded, simply append .zip to the file name.

vsix renamed to zipAnd expand it into a folder using the default Windows ‘Extract All…’ option (right-click context menu) or whatever tool you want.

3.Edit the manifest

Next, in the expanded folder, edit the file extension.manifest using notepad, wordpad or whatever (I use Notepad++).

Look for the text ‘<VisualStudio Version‘, and change the value to read "11.0"

Change Visual Studio Version For ExtensionSave and close :)

4. Compress the folder content

Now, compress the folder content back into a zip file, using whatever tool you want.

In Windows, you can select all the content in the folder (CTRL+A), right-click, and select ‘send to’ and ‘compressed (zipped) folder’

Compress a folder to zip5. Rename the file back to vsix

Once compressed, rename the file back to .vsix

VSIX Visual Studio Extension6. Install it

Now all you need to do to install it is to Double-Click it.

Good luck :) It might not work, or it might partially work… but this system should allow you to install it.

Hope it helps :)  If anyone has any great extension suggestions, please let me know.

Advertisements

Extending LINQ to allow foreach constructs


Whilst playing around with LINQ over enumerations, I have asked myself whether or not one can extend normal LINQ functionality to also allow a foreach-like construct to form part of the expression itself (very similar to what you would do in jQuery).

Now LINQ results are in the form of IEnumerable instances, and IEnumerable does not supply a ForEach method, yet .NET 3.5 has also given us extension methods… so all we need to do really is to define an extension method like so:

private static void ForEach<T>(this IEnumerable<T> result, Action<T> action){
foreach (T entry in result) action(entry);
}

This will allow us to execute queries of this form:

(from x in [some array] where [some condition involving x]).ForEach([do something with x]);

Not exactly as elegant as fully compliant LINQ syntax, but way better than the alternatives :)

How to disable google.com country redirect for all browsers


Further to my last post, on how to change the default google country redirect, I found a really good way if you want google to stop redirecting you to the version for the country that you are in.

Quite simply, just point your browser to http://www.google.com/ncr (<- yes click on it)

This will quite simply set a cookie in your browser which will stop google from redirecting you… and will make you ‘stick’ to google.com

(This is for my friend Grzegorz :) Since he asked me about this for FireFox this morning)

Hope it helps!

WPF Localised Bindings – What to do when they just don’t seem to work :)


I am currently working on a system in Arabic (no, I don’t understand Arabic), and I bumped into an issue where Bindings were not respecting my CurrentUICulture.

Digging bit deeper (with the help of a handy decompilation tool) I found a not-so-beautiful line in FrameworkElement.cs

public static readonly DependencyProperty LanguageProperty =
DependencyProperty.RegisterAttached("Language", typeof(XmlLanguage),
_typeofThis, new FrameworkPropertyMetadata(XmlLanguage.GetLanguage("en-US"),
FrameworkPropertyMetadataOptions.Inherits | FrameworkPropertyMetadataOptions.AffectsMeasure));

As you can see, WPF does NOT respect your thread’s CurrentUICulture.

The fix is simple… finding it, on the other hand, was a nightmare.

Just override the metadata as follows:

FrameworkElement.LanguageProperty.OverrideMetadata
(typeof (FrameworkElement),
new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));

Hope it helps :)

Change default google search country in Google Chrome browser


Chrome can be quite annoying at times for people who travel a lot.  In whatever country I visit, chrome insists on changing the default google.com site to the localized version.

Now in my case, I cannot read Arabic, or German… or most of the native languages for the countries I visit… so I hate it when the google site I use changes.

Also, some features are only available on google.com … so why bother with the rest?

It turns out that it is actually quite easy to change the default search country for Google Chrome.

If you are using windows, launch your ‘Run‘ dialog by doing the following

  • Close your Chrome browser
  • Press WIN+R (that’s ‘keep the windows key next to your alt key pressed, and hit the letter R)
  • Type in the following
    notepad %LOCALAPPDATA%\Google\Chrome\User Data\Local State
  • Now look for “last_known_google_url” and “last_prompted_google_url” and change the value next to both to read “http://www.google.com” (or whichever version you want)
  • Save the file and restart Chrome… and, voilà… all sorted :)
If you are not using Chrome, but are using Firefox, IE or any other browser, there’s an alternative solution here
I hope someone finds this handy :)

Steve Jobs iPad, iPod and iPhone Wallpaper


In the past few hours, I have received a lot of hits for iPad, iPod and iPhone Wallpaper… so I’ve just quickly created some :)

At least if you hit my blog, you won’t walk away empty handed.

Steve Jobs Wallpaper for iPad
Rotation friendly Steve Jobs wallpaper for the iPad (1024x1024)
Steve Jobs Wallpaper for iPhone 3GS
Steve Jobs Wallpaper for iPhone 3GS
Steve Jobs Wallpaper for iPhone 4
Steve Jobs Wallpaper for iPhone 4

Comments are welcome ;)

Also check out the following:

Apple’s Co-founder and Chairman Steve Jobs dies


Steve Jobs (1955-2011)

Steve Jobs (1955-2011)
Steve Jobs (1955-2011)

It is a sad day.  The legendary Steve Jobs, the man behind Apple, Macintosh, iPod, iPad, iPhone, NeXt… among so many other innovations, has died.

The entire industry will miss you.

Read more: