Skip to main content

Posts

Kendo UI Window Widget: Window only opens once

On a project I’m using the Telerik Kendo UI widgets and I’m enjoying the experience so far. They are a lot better than the default jQuery UI controls(and better documented). However with the Window widget I had a small issue I wanted to share(together with a solution). The first time I used the Window widget I used the following JavaScript: This code will open a Window when the user clicks on a specific link on my webpage. This code works as expected BUT only the first time that I load my page. If I close the window and click on the link again nothing happens… After some trial and error I found a solution, it seems like you have to create the Window widget only once and then re-use it each time you want to open a new Window. Here is my updated code: You can see that we only create a Window object once and then re-access it through the data property of the div.

Free ebook: 45 database performance tips for developers

Redgate provides us with a free copy of 45 Database Performance Tips for Developers . It contains SQL Server performance tips and tricks recommended by some of the smartest minds in the Simple Talk community, including SQL Server MVPs. Download your copy here . Remark: Registration is required.

TFS Build Server Error: The build service host XXX is currently owned by XXX. A service host may only be active on one machine at a time.

A customer reported me the following problem with their TFS Build Server: We had several occurrences of an error on the build development server that prevents the build controller from starting. In the TFS Event log on the server, this error message appears: Exception Message: The build service host XXX is currently owned by XXX. A service host may only be active on one machine at a time. (type BuildServiceHostOwnershipException) A service restart will not correct this error. One workaround we found is to reinitialize the build server status in the Team Foundation Server collection database. Execute the following steps to do this: Determine what is the ServiceHostId of your build server (to get a key for the update): Update the record to reinitialize status: Remark: Be careful! This is a workaround, NOT an officially supported solution.

WatiN error: Could not load file or assembly 'Interop.SHDocVw’

For a customer I’m comparing multiple UI testing frameworks. One of these frameworks I’m looking at is WatiN . I started simple, I created a new test project in Visual Studio, installed the required assemblies through NuGet and copied the sample code from the website. But when I tried to run this test, it failed with the following error message: Test Name:        TestMethod1 Test FullName: WatinTestProject.UnitTest1.TestMethod1 Test Source:      c:\Projects\Test\WatinTestProject\WatinTestProject\UnitTest1.cs : line 12 Test Outcome: Failed Test Duration:   0:00:00,0910315 Result Message:              Test method WatinTestProject.UnitTest1.TestMethod1 threw exception: System.IO.FileNotFoundException: Could not load file or assembly 'Interop.SHDocVw, Version=1.1.0.0, Culture=neutral, PublicKeyToken=db7cfd3acb5ad44e' or ...

Secure your cookies!

As we are building more and more web applications in the Cloud, security becomes a key aspect of every application. Before we felt a little bit more safe behind the company firewall but these days are gone… And as your security is as strong as your weakest link, it is important to understand every aspect of it. One possible risk is the (wrong) usage of cookies. Most of the time when you create a cookie inside your ASP.NET application, you  don’t want to read it on the client. With a tool like https://www.cookiecadger.com/ , it becomes very easy to steal someone's authentication cookie. How can we prevent this? In ASP.NET, you have to set the HttpOnly flag to true when creating a cookie: Unfortunately the default for HttpOnly=false, so if you forget to set it somewhere you’re in trouble. Probably better is to set HTTP only as the default for all cookies to via the web.config: <httpCookies httpOnlyCookies="true" /> More info: http://www.troyhunt.com/2013/03/c-is...

Saxon: Write XQuery in .NET

They are not many solutions out there in .NET that allow you to combine the power of XQuery with a C# API. The built-in XSLT support in .NET is very limited and only supports the XSLT 1.0 specifications. One of the best options you have is Saxon , a powerful XSLT and XQuery processor. The only disadvantage of this tool is that the syntax is very JAVA oriented, which makes it sometimes counterintuitive for .NET developers. A sample:

Simplify XPath development by using XQuery

Most people have heard about XPath , it gives you a powerful syntax to navigate through elements and attributes in an XML document.  Most of the time XPath is used to transform one XML document to another(through XSLT). I always found the XPath syntax hard to read, especially if your expression start to get more complex. That’s one of the reasons why I always tried to avoid using XPath and preferred writing a small C# program and use Linq to XML . What I didn’t know is that XML had it’s own query language, XQuery , which offers you a similar more readable experience when walking through XML files. XQuery itself uses XPath underneath but it hides the complex expressions behind a nice and clean functional-style syntax. From w3schools : And here is a sample of the syntax: