Microsoft Virtual CD Rom

I needed a quick way to read an ISO image at work today that 7zip couldn’t extract properly. Normally at home I’d just mount it in Daemon Tools and be on my way but that idea doesn’t sound the best for the work place due to the free version of Daemon Tools containing adware. After some searching I ran across a Microsoft Developed Virtual CD driver and interface. It’s very basic but it let me open the Visual Studio 2008 iso I downloaded from MSDN without any hickups or needing to reboot to install the driver..

http://download.microsoft.com/download/7/b/6/7b6abd84-7841-4978-96f5-bd58df02efa2/winxpvirtualcdcontrolpanel_21.exe

Advertisements

The dreaded ASP.NET submit button double click

I’m sure every one of us has ran into the issue of a user inadvertently or even intentionally double clicking the buttons on our web applications, many times this can lead to invalid states or duplicated submissions or even the worst, duplicated billing. Through out my time as an asp.net developer this along with the back button has been a bane to web aplication development, I’ve seen many solutions for dealing with this issue however I seemed to find a very simple and reliable one.

Inside the aspx, create 2 buttons one for your active click one to be a place holder

<asp:Button ID=”btnSave” runat=”Server” CssClass=”button” Text=”Save Entry” OnClick=”btnSave_Click” />
<asp:Button ID=”btnSaveDisabled” Enabled=”false” runat=”server” Text=”Save Entry” CssClass=”button” Style=”visibility: hidden;” />

Note the style on the Disabled button that’s a key to this solution. Now inside the PageLoad

if (!Page.IsPostBack)
{
btnSave.OnClientClick = string.Format(“javascript:{0}.style.visibility = ‘hidden’;{0}.style.display¬† = ‘none’;{1}.style.visibility = ‘visible'”, btnSave.ClientID, btnSaveDisabled.ClientID);

With this in the code behind you always have the guaranteed client id of the controls without any need for any complex object finding that is browser specific and a very simple on client click method will remove the actual submit button from the page entirely and set the disabled one to show.

This solves both issues of double submitting and removing the button from the form entirely with the visibility = ‘none’ protecting from any type of html manipulation or JavaScript manipulation to click the button again even thought it’s not visible to the user.

BloggingContext.ApplicationInstance.CompleteRequest();

A Programming Job Interview Challenge #14

In this programming challenge it involves collecting a series of points to form a polygon in a 2d field and then 1 additional point in the field by itself. The goal is to determine if the point is either inside or outside of the polygon.

http://www.dev102.com/2008/08/05/a-programming-job-interview-challenge-14-2d-geometry/

This problem sounds a lot more complex than I believe it actually is since we are only going to deal with closed form polygons I believe we only need 2 vectors to simulate an X, Y coordinate plane.

Enter Polygon Coordinates: For every coordinate position add the x value to ordered VectorX, and y value to ordered VectorY. Ignore duplicates.

Take hanging coordinate position: ValueX, ValueY

With VectorX and VectorY already being sorted

bool xInside = false;
for (int i=0; i<VectorX.Count; i++)
if(VectorX[i] <= ValueX && ValueX <= VectorX[i]
{
xInside = true;
break;
}

Now repeat process for yInside, if xInside and yInside are both true the point is inside the polygon otherwise it is outside. Ignoring the time for sorting this algorithm solves this problem in 2*O(n), it could further be sped up to O(log n) by using a divide and conquer pattern to determine if the 1 dimensional point exists in the line.

BloggingContext.ApplicationInstance.CompleteRequest();

World of Warcraft: Wrath of the Lich King

I know this is very off topic but I had quite a pleasant suprise today after I made it home from the office, upon checking my email I found a beta invite to World of Warcraft: Wrath of he Lich King. I enjoy the opportunity to beta test software and video games as I feel with my technical background that I can offer additional insight above a normal user might notice in terms of bugs and glitches. I’m very excited that my beta testing application was approved for the world’s largest online game.

Hopefully the time I can spare on beta testing WoW: WotLK will also benefit me and offer me new perspective in my own field especially with the talented user experience team that develops for Blizzard. Very frequently we as ASP.NET developers become so engrossed in the technical side of a website that we can easily forget about the overall user experience. It doesn’t matter how amazing or revolutionary your program is if the user can’t understand how to use and is too frustrated to stay on your website.

My cowoker and I ended up having a discussion earlier today on ASP.NET 3.5 framework with the newly added ListView control and for the MVC website development pattern that’s so integrated to the future of ASP.NET development. It really centers on how much more flexible site design can be for integrating pure html and the dynamic website generation that ASP.NET offers.

This really opens up doors to allow cooperation between web designers and ASP.NET developers. Being able to transform html/css design that was created by a very experienced designer that has lots of talent with user experience into the dynamic and interactive site that ASP.NET offers is definitely a great advancement for overall quality.

BloggingContext.ApplicationInstance.CompleteRequest();