August 15, 2009

Quickly Navigate to a CSS Class Definition in Visual Studio

Suppose you have a CSS style defined as class=”myClass” as shown below: Now suppose you want to know exactly how the myClass style definition is defined. Just place your cursor on myClass and press F12. This will highlight the CSS class for you whether the class definition is in the

Decoding General Compiler Error Messages

Error: Undeclared Identifier Example error message: doy.cpp: In function ‘int main()’: doy.cpp:25: ‘DayOfYear’ undeclared (first use this function) doy.cpp:25: (Each undeclared identifier is reported only once for each function it appears in.) doy.cpp:25: parse error before ‘;’ token Meaning: You used DayOfYear in your code, but the compiler has not

Get the Name of the Executing ASP.NET Page

You can use the following server-side code to get the name of the currently executing ASP.NET page (e.g. default.aspx, hello.aspx). string sPagePath = System.Web.HttpContext.Current.Request.Url.AbsolutePath; System.IO.FileInfo oFileInfo = new System.IO.FileInfo(sPagePath); string sPageName = oInfo.Name;

Global Exception Handling in WPF

In XAML, you can hook an application-level event that will fire whenever an unhandled error occurs anywhere in your application by overriding the OnStartup event in the App.xaml.cs file. Here’s an example excerpt: protected override void OnStartup(StartupEventArgs e){ // define application exception handler Application.Current.DispatcherUnhandledException += new DispatcherUnhandledExceptionEventHandler( AppDispatcherUnhandledException); // defer

Determining Whether a Site Is Running or a URL Is Valid

The HttpWebRequest object makes it easy to check whether a web site is available or a URL is valid. Its HttpStatusCode property returns the status code from the request, which you can check to determine the site’s availability. public static bool checkUrl(string url) { bool rt = false; if (url.StartsWith(“www.”))

Augmented Reality on Android: Prepping the Camera and Compass

ugmented Reality (AR) seems to be on everyone’s radar. For the two of you who haven’t watched a YouTube video about it: Augmented Reality is the ability to overlay location data points on the live view of a mobile device’s camera. In a sense, AR allows the phone to become