Display Description When Summary Block is Closed in Visual Studio

When you collapse a summary block in Visual Studio, you lose the description text

image

Here’s a quick tip on how to still be able to read the summary text even when the block is closed so it looks like this

image

Read More

Two Quick Ways of Opening the Current Explorer Window in CMD

Sometimes you want to open the current Explorer window in Command Prompt (cmd). You could navigate to it in cmd but here are two quick ways to open cmd and have it jump to the folder itself.

Read More

Set the Google Timer to Play Your Own MP3 File

About an hour ago I found out Google has a new “Timer” feature which can essentially act as an alarm whilst you’re browsing the web. Simply go to google.com and type in, for example, “timer 5 seconds" and after 5 seconds are up it’ll play an alarm sound. This is pretty neat but I thought it would be better if I could play one of my own MP3s instead of the alarm sound. Turns out you can.

Read More

Quickly Remove Line Numbers From Pasted Code In Visual Studio

Sometimes when you try and copy code snippets from a webpage their syntax highlighter doesn’t separate the line numbers from the actual code. This means when you paste it in your IDE, you’ve got the line numbers and the code (which obviously wouldn’t compile). Instead of manually going down each line to remove the numbers, you can simply use column select in Visual Studio.

Read More

Avoid Using ArrayLists (C#)

In the days before generics, ArrayLists were used because you could store any object type in them and have them resize at will which was useful if you didn’t know how many objects were to be used (unlike an array which required an explicit capacity at the point of initialization). However, if you’re not targeting .NET 1.0,.NET 1.1, or working on legacy code, there’s very little reason to use ArrayLists anymore.

Read More

How to Re-Throw Exceptions (C#)

Generally it’s good idea to handle the exception as soon as possible. However in some cases, you want to re-throw that exception and have it handled later on. I see two common mistakes when doing this whereas the preferred way to do it also requires the least typing; win-win.

Read More

Introducing the #ScrapOverflow Tag

I often spend some time on Stackoverflow and end up seeing common questions or mistakes being repeated. I’m going to start posting some of these, as well as some random code snippets, like a scrapbook with the hashtag #ScrapOverflow (I wasn’t going to miss out on that pun). 

Fixing a Windows Phone ListBox Scrolling Bug (?)

A couple of days ago, I came across an interesting question on Stackoverflow which seemed to highlight a bug in the ListBox control which allows the user to scroll vertically even if the ScrollViewer.VerticalScrollBarVisibility property has been disabled. I’ve never noticed it before so figured it might be worth writing a quick post about in case others are unaware of it. (Note this isn’t the same as disabling the ListBox altogether. You can still select the visible items when you disable scrolling).

Read More

Set Your Windows Phone’s App Startup Page in VS Without Typing

In Blend you can simply right-click on a XAML file and that set as the startup page (similar to how, in Visual Studio, you can right click on a project and set that as the startup project). However, there’s no simple “set as startup page” for XAML pages in Visual Studio (AFAIK) and so you have to open up WMAppManifest.xml and manually type in the name of the XAML page you want to set.

As you may know, I enjoy hacking fixes together like the other minor WP dev annoyance, autoscrolling pages for autocue-like reading of any website, and my hack that won an award at my first hackathon (more details about that another time). So I’m not going to sit idly by whilst fellow developers have to go through those painstaking error-prone 20 seconds of changing the WMAppManifest file by hand. Let’s fix these startup page shenanigans!

Read More

Quick and Easy Access to the C# 5.0 Spec

A good way to learn C# is to look at its specs and find out how it works underneath and why it does what it does. You can download the C# Language Specs 5.0 from here. However, sometimes I want to quickly access it online without having to download the file so I created an easy to access file.

Read More