Posterous theme by Cory Watilo

[My] Annoying Visual Studio options

Again this one is more for my memory than anything else. That said I hope 

you find it useful too !

There's just the one for the time being, but I'm intending to rebuild my
laptop in the near future, so no doubt we'll find the article growing.

1. Highlighting references.

A new feature in Visual Studio 2010 is you put your cursor on a word and after a second or so it highlights everything that matches it. I actually quite like this feature in notepad++ but for some reason not in VS (think it's because it does it wherever the cursor is, whereas notepad++ only does it when you highlight something, i.e. it
responds to your intent). Anyway, enough of my ranting, the important bit is how to turn it off.

Options
Evidently this feature is dependent on the editor being used in Visual Studio at the time, so it's hidden away [for C#] under Tools > Options > C#
> Advanced > Highlight
references to symbol under cursor.

Hope this helps someone else as well as me! Until next time.

Kind regards,
Team TP.

Debugging ASP.NET MVC Source Code

This is more for my memory than anything else, but hopefully will be useful for others too.

To debug the ASP.NET MVC source code you need the following steps:

  1. Go to Tools > Options and tick Enable .NET Framework source stepping.
  2. Did it work? If not (like me) continue with the rest of these steps.
  3. First off download the source code. I’m going to be debugging version 2 at : http://aspnet.codeplex.com/releases/view/41742
  4. Once downloaded, extract the zip out (you may want to unblock it first [Right click on the ZIP, Properties > Unblock) otherwise you may hit issues when trying to debug later.
  5. Add the System.Web.Mvc.csproj as an existing project in Visual Studio.
  6. Replace the normal MVC reference in your web project with the new project with the source code.
  7. Open the web.config (the one in the root, not the one in Views):
  8. Comment out {add assembly=“System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL” /}
  9. Add in {add assembly=“System.Web.Mvc” /}
  10. Do a Clean, then Rebuild.
  11. Bit of luck, jobs a good ‘un.

28th Sep 2010 Addendum

I’ve subsequently come across this article that outlines an alternative method by using the source code server in Visual Studio:

http://weblogs.asp.net/gunnarpeipman/archive/2010/07/04/stepping-into-asp-net...

I’ve had a go, but I couldn’t get anything coming out of the watch windows (due to the assemblies being optimised) which kind of limits what you can do (unless I’m doing something wrong – please add a comment if I am!).

Hope this is useful,

Regards,

Team TP!

Finding redundant code in Visual Studio solutions.

In the early days of the development of toepoke.co.uk I didn't have any proper source control management (yeah I know, I know !)

Anyway the days of commenting out code whilst I try stuff out and using my own source control management system are long gone (thankfully!).

However I still have a lot of commented out code hanging around from those days and I really need to get rid of it and to tidy things up. Thing is there's load of files and I didn't fancy going through every single file, so I figured there must be an easier way.

I figured typically I'm commenting out multiple lines of (C#) code, along the lines of this:



//public void SomeLazyCommentedOutMethod()
//{
//}


So all we need to do is search for //{ or // { or basically // followed by anything with { at some point afterwards. Sounds like a regular expression search to me. Ordinarily my ability to build a regular expression from scratch extends to this. But thankfully even I can cope this one!

(:b)*(//)+([a-zA-Z0-9])*\{

Which breaks down to:

  1. (:b)* = Zero or more tabs or spaces, followed by
  2. (//)+ = One or more slashes (/), followed by
  3. ([a-zA-Z0-9])* = Zero or more letters or numbers, followed by
  4. \{ = followed by an opening curly brace ({).

So if you bob (:b)*(//)+([a-zA-Z0-9])*\{ into the Visual Studio Find In Files dialog (CTRL + SHIFT + F) and hit Find All you should find most of the areas where you've commented out code.

C#

c# find in files dialog

VB.NET

vb.net find in files dialog

I reckon you should be able to the same in Visual Basic.NET by replacing the // with ' (so (:b)*(')+([a-zA-Z0-9])*\{ ) - however I've not tried it.

Well I've tried (the C# version) on the toepoke.co.uk code and found 158 hits which on the up side means it's probably working, on the downside I've been a naughty boy !

Regards,
Team TP!

New Build: 1.0.0006

Hi,

Had the week off dog sitting this week, so got tonnes done.  Sadly not a lot of it will be visible to you guys and girls, but should provide under the cover improvements.  Anyway here’s what’s in this build.

Features  - new stuff (big and small):

·         Matches on the match dashboard are now shown in the order they are due to be played ... rather than some semi-random order. 

·         E-mails are now sent in both text and HTML formats, so you pick which you prefer to view in.

·         Site now only sends the match reminder e-mail if you don’t have enough players for your game.

·         E-mail detailing the sides for a match now includes an appointment you can download to your e-mail client to remind you there’s a match on.

·         A few more additions to the FAQ and Glossary.

·         The screen for allocating sides in a match have been re-written to make it easier to support in the future.  In addition:

o   Each side where you drop players now grows and shrinks as required so it should always have enough space (previously it was too small for 11-a-side games).

o   Each box on the screen now shows you how many players are on each side (no more having to count them manually .. yeah !)

·         Demo account now uses 11-a-side rather than 5-a-side so it looks a little more involved.

·         You can now un-subscribe from games.

·         You can now close your account if you wish and be removed from the site.

·         You can now delete a game if you stop playing a regular game.

·         Made a few updates to the icons.  References to games are now a console controller icon, a football now represents a match.

·         Google Adverts have now been added.  Sorry, but I’ve gotta pay the hosting costs somehow J

·         You can now [finally!] modify your account profile

·         How you sign into your account has changed as previously you couldn’t click the Remember Me function without going to the dedicated signing in screen ... which frankly was even annoying me !

·         Site now remembers which match/game you last had selected (useful if you have two or more games on the go at the same time)

Fixes – stuff we’ve fixed:

·         Fixed issue with the e-mail validation when inviting new players.  Which was a little ... erm ... eager?

·         Fixed problem where you couldn’t unsubscribe from a regular game.

·         Fixed issue on the more information screen where the tabs were the wrong way around.

·         Fixed issue with scrollbars in the accordion region with Google Chrome (think it was an issue with Firefox too)

·         Fixed issues with deleting accounts.

·         Fixed issues with the CATCHA in Chrome and Firefox where it would load a blank page.

·         Fixed issues with double slashes in e-mails.

·         Fixed issue with not being able to save game changes.

Background – stuff you probably won’t notice nor care ;-):

·         Website assets (javascript and css) now Squished.

·         Embedded styles now moved to external stylesheets.

·         Add terms, disclaimers and other legal stuff.

·         jQuery and jQuery UI libraries now retrieved from Google Content Delivery Network (CDN).

·         Site now only uses http://toepoke.co.uk, so if you visit http://www.toepoke.co.uk you’ll be redirected.  This is to avoid the confusion of having two sites (basically the internet sees http://toepoke.co.uk and http://www.toepoke.co.uk as two different web sites).

Phew!  Busy couple of weeks! 

Hopefully everything’s working correctly, and if not, as always you can tweet me off :)

Thanks for reading,

Team TP!