A developer’s view

Ramon's website

last update:

Application Insights is a valuable tool to monitor your application, but the amount of gathered telemetry can grow very large. In this post, I will give you some options to reduce the amount of logging and what the trade-offs are. What is the problem? Application Insights is great to monitor the duration of all requests and dependencies (i.e. SQL queries). All requests are logged, so you can determine the average request duration and spot slow requests.

I am working on a project for a customer to move an existing cloud solution to a sharded Azure SQL environment. Azure SQL has some major drawbacks compared to the traditional SQL Server environment. The most notable (IMHO) is the lack of the SQL Profiler. I had a hard time investigating queries that took a long time to complete. To solve this issue I have created the following query. It displays all the active connections and shows the following information:

Are you looking at a similar window and you desperately need access to your database? You’re come to the right place, because there is a good way to recover access to the database without nasty tricks, third party software or losing any data. The not so-good options I had to recover a SQL Server database for a customer that changed its internal AD structure, so the database wasn’t accessible via Windows authentication anymore.

If you have accidentally ran a script and your current database was still set to ‘master’, then you end up with a pretty messed up master database. It doesn’t really hurt, but I like to keep my computer tidy. So I came up with a script that cleans up the mess again. To determine when the mess was created run the following query: SELECT * FROM sys.objects It will show you all the objects and the creation date.

This article is an updated of my previous January 2014 article SQL Server 2012 Express edition is a great database with a lot of potential. There are some limitations, but for a lot of applications this isn’t a big deal and SQL Server express is a great choice. For SQL Server 2012 Express edition, the following limitations exist: Each engine will use only up to 1GB of RAM memory.

I recently used a TabControl and required a different ContentTemplate per item, so I used datatriggers to change the ContentTemplate based on the current selected page. In theory this should work fine, but I found that changes to the ContentTemplate are not effectuated. How to reproduce Use the following XAML code to illustrate the problem. The property trigger based on the ‘IsMouseOver’ property changes the content template, when you hover over it.

WPF introduces the concept of routed events. There are different routing strategies, but the most commonly used strategy is the bubbling strategy. With the bubbling strategy, the event handlers on the event source are invoked. The routed event then routes to successive parent elements until reaching the element tree root or when a handler sets the Handled property. Always make sure that you set the Handled property, when you handle a routed event.

WPF control share no code with the old-style Win32 controls that are used in traditional Windows applications. The WinForms controls wrap the native Win32 controls and extend them in some areas. The WPF library complete rewrites these controls in native .NET code, so some differences may occur. In this post I will describe two small differences that might be annoying. Using US international keyboard on Windows XP Using a keyboard setting that allows composing letters with diacritics have some issues on Windows XP.

The TextBlock.GetPositionFromPoint raises a NullReferenceException in some cases. This method should return a TextPointer to the text that starts at the given position. In some cases it generates a NullReferenceException instead, which is clearly a bug. The internals of this method looks like: public TextPointer GetPositionFromPoint(Point point, bool snapToText) { if (this.CheckFlags(Flags.ContentChangeInProgress)) throw new InvalidOperationException(SR.Get("TextContainerChangingReentrancyInvalid")); if (((ITextView)this._complexContent.TextView).Validate(point)) return (TextPointer) this._complexContent.TextView.GetTextPositionFromPoint(point, snapToText); if (snapToText) return new TextPointer((TextPointer) this._complexContent.TextContainer.Start); return null } The call fails in the TextBlock.

The ScrollViewer control is a convenient control, when the content doesn’t fit on screen and you need some kind of scrolling to make all content accessible. I tend to use the mousewheel to scroll up and down, but this sometimes doesn’t work in WPF applications. It fails when you nest multiple scrollviewers, because the deepest ScrollViewer will always handle the MouseWheel message. Even if there is no vertical scrollbar visible or when it is disabled.