A while ago, I posted a quick note on my desire to use the new ASP.NET MVC framework to create a photo sales website. In the end, it didn’t work out that way, and I am using the framework to build a new website for my church.
While a huge benefit to ASP.NET MVC is (IMHO) the ability to shed the ASP server side tags, and hence gain complete control over markup and layout within the page, I am amazed at the amount of Javascript I seem to be writing to keep the application ‘Web-2.0-ish’. In fact, one particular page in the site probably contains more Javascript than the sum total of all Javascript I had written in many years before.
In this, jQuery has been a huge help, but sometimes it’s nice to see exactly what script calls are being made (this applies particularly to Ajax calls) and what is returned.
Enter Nikhil Kothari’s Web Development Helper. In his words,
Web Development Helper is a free browser extension for Internet Explorer that provides a set of tools and utilities for the Web developer, esp. Ajax and ASP.NET developers. The tool provides features such as a DOM inspector, an HTTP tracing tool, and script diagnostics and immediate window.
My understanding is that Firefox now has a similar tool built in (Firebug) but I have not tried this yet, mainly because the VS2008 development system works with IE. Tools of this calibre are more than welcome in my opinion.
Categories: Other Development
Tagged: ASP.NET MVC, Javascript
Check out win2008workstation.com – it gives full details on how to set up Windows 2008 Server as a workstation, including enabling Aero and other Vista nicetites. I’m tempted, if only to get rid of the HP-specific stuff on my laptop.
Categories: Miscellaneous
Tagged: Windows 2008
I needed a function that would return a boolean indicating if any of the values from one list appeared in another list. I love extension methods…
public static bool ContainsOneOf<T>(this IList<T> first, IList<T> second)
{
foreach (T item in first)
{
if (second.Contains(item))
return true;
}
return false;
}
Remember to place this method in a public static class.
Categories: Coding
Tagged: C#, extension methods, generics
I’ve been utilising Kevin Moore’s Bag-o-Tricks for WPF recently, but when I load my solution up in Visual Studio, I get a “The project location is not trusted” dialog. Turns out it is because I didn’t unblock the zip file before I unzipped it. Turns out there is a solution: have a look at this for more info and the solution.
Categories: Coding
Tagged: Visual Studio
I am writing a WPF application which runs as a tool-style dialog on the desktop, and needs to be able to be minimized but not maximised. It seems that this is somthing the WPF designers didn’t quite anticipate, despite it having been pretty easy to achieve under Windows Forms.
After searching around the ‘net, I finally found some code that disabled both the minimize & maximize buttons, but took a couple shortcuts that I didn’t like (and besides, it was in VB…).
A bit of searching and a quick cleanup left me with a working result. Catch the Loaded event of your window, and put the following code into the handler:
// Import some references
using System.Interop;
using System.Runtime.InteropServices;
// Place these inside the class definition...
[DllImport("user32.dll")]
private extern static Int32 SetWindowLong(IntPtr hWnd, Int32 nIndex, Int32 dwNewLong);
[DllImport("user32.dll")]
private extern static Int32 GetWindowLong(IntPtr hWnd, Int32 nIndex);
private const Int32 GWL_STYLE = -16;
private const Int32 WS_MAXIMIZEBOX = 0x10000;
private const Int32 WS_MINIMIZEBOX = 0x20000;
// And finally the event handler...
private void Window_Loaded(object sender, RoutedEventArgs e)
{
IntPtr hWnd = new WindowInteropHelper(this).Handle;
Int32 windowLong = GetWindowLong(hWnd, GWL_STYLE);
windowLong = windowLong & ~WS_MAXIMIZEBOX;
SetWindowLong(hWnd, GWL_STYLE, windowLong);
}
I have included the value for WS_MINIMIZEBOX in case you need it.
Categories: Coding
Tagged: C#, Interop, WPF