... all I'm offering is the truth. Nothing more. RSS 2.0
# Wednesday, December 30, 2009

If you are working on a massive web project and the lead developer has no clue what Peter Blum controls are … pick up your ergonomic keyboard, mouse, and the spare monitor from home and get the heck out of Dodge!

Technorati Tags:
Wednesday, December 30, 2009 11:20:33 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
Humor
# Sunday, December 13, 2009

I am a huge fan of WPF and more specifically Silverlight so when my wife took the opportunity to incorporate Expression Blend into a recent project I was eager for her to give the new Sketch Flow pattern a whirl. The Sketch Flow concept came across as the ability to mock up a complete application or website and transform that into a working production model. Effectively narrowing the gap between the client, designer and the developer. After working with my wife over the last couple of months it is clear that this particular idea was misrepresented.

My wife had created a prototype using the Sketch Flow concept and put together a very compelling, and partially functional, application. Unfortunately that fact that project was in fact Sketch Flow means that you just cannot simply open this application up in Visual Studio and start doing the complex software engineering work. In fact there a bunch of hoops (albeit well documented in Blends User Guide) that need to be followed in order to make this happen:

image 

It is just clear to me that the role of the Devigner (Designer and Developer amalgam) is not a cohesive as advertised.

Sunday, December 13, 2009 10:09:28 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
.NET | Silverlight | Visual Studio | WPF
# Wednesday, December 09, 2009

On a recent project I was asked to provide a real easy way to zip multiple files and while I have seen this problem solved many moons ago in VB6 I have never really thought about this question from a managed framework standpoint. While navigating MSDN I came across GZipStream but this did not explicitly provide an interface for adding files to a zip archive. Several Bings later I came across a highly rated project on CodePlex called DotNetZip.

I must say this got straight to the point, with a intuitive API that was well documented and explained. Here is a code sample:

using (ZipFile zip = newZipFile()
{
    // add this map file into the "images" directory in the zip archive
   
zip.AddFile("c:\\images\\personal\\7440-N49th.png", "images");
    // add the report into a different directory in the archive
   
zip.AddFile("c:\\Reports\\2008-Regional-Sales-Report.pdf", "files");
    zip.AddFile("ReadMe.txt");
   zip.Save("MyZipFile.zip");
}

DotNetZip is packaged as a single DLL, a single assembly. It is fully managed code, written in C#, and provides support for reading and writing Zip archive files and streams. The main type is ZipFile, featuring methods like Add(), Extract() and Save(). There are string and int indexers for the entries of the ZipFile. There are properties for things like password protection, unicode and codepage support, and ZIP64 behavior. And there are progress events for Reading, Saving, and Extracting.

Technorati Tags:
Wednesday, December 09, 2009 9:53:09 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
C#
# Sunday, December 06, 2009

This is the first in a series of posts that I wanted to dedicate to my own coding errors, the situations where I forget some fundamental programming concept and it has me confused for minutes, hours and\or days. So I will attempt to lay bare my own gaffs and hope that this blog serves as a permanent reminder that I remain irrevocably human.

So my latest brain freeze involved an attempt to filter an Array List  based on its content (using .NET 1.1), the basic premise was as follows…

ArrayList ls = new ArrayList();
ls.Add("This");
ls.Add("is");
ls.Add("a");
ls.Add("Test");

foreach (string s in ls)
{
    if(s == "is")
        ls.Remove(s);
} 

The more discerning programmers among us will immediately realize that this for each loop will keep iterating right up until we actually remove something and then we will get this error…

System.InvalidOperationException was unhandled
  Message="Collection was modified; enumeration operation may not execute."

Simply put we cannot modify collection while iterating through it, pretty obvious when you actually take the time to read the exception ;) There are several ways to resolve this, we could create a new ArrayList that we simply add to, however, I preferred using for loops, feels closer to C.

for (int i = 0; i < ls.Count; i++)
{
    if((string)ls[i] == "is")
        ls.RemoveAt(i);
}

I will keep going with a list of embarrassing Faux Pas until I stop committing them, that is to say, until I stop programming ;)

Technorati Tags:

Sunday, December 06, 2009 9:09:01 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
.NET | C#
# Thursday, December 03, 2009

I was having a problem with validating two fields in a web page the other day. The two fields were not required but it was necessary that if either field was selected then the other field would also be required.

 

Most of the examples I have come across simply require both fields, or require both fields based on another control. Logically speaking the request we have is an XNOR (where Field1 ='A', To Field2='B'). Only when one text box is filled out should the page flag an error.

clip_image003

 

In order to achieve this I used a CountTrueConditionsValidator from the PeterBlum Validation and More, as follows:

<vam:CountTrueConditionsValidator id="NeedBothFieldsOrNeitherField" runat="server" 
    ErrorMessageLookupID="You need both fields" 
    Minimum="1" Maximum="1" NotCondition="True" EventsThatValidate="OnSubmit"> 
    <Conditions> 
        <vam:RequiredTextCondition ControlIDToEvaluate="Field1" /> 
        <vam:RequiredTextCondition ControlIDToEvaluate="Field2" /> 
    </Conditions> 
</vam:CountTrueConditionsValidator>


In this example it counts the number of required fields from the conditions elements with the Minimum and Maximum both set to 1. This means if only one field is active this constitutes a true scenario (XOR). To make this fulfill our scenario (XNOR) the NotCondition is set to true.

Peter Blum Controls are really flexible and immersive, I will not develop any meaningful website again without them!

 

Technorati Tags:
Thursday, December 03, 2009 10:26:29 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
ASP.NET | Tools
# Saturday, October 24, 2009

I have had my 64 bit OS for several months now and loving the increased speed and stability of everything that I use. I did not realize until a few moments ago that I had been using the 32 bit version of IE. Now this really has not been a problem, but I did purchase a 64 bit OS and would like to take advantage of it.

imageIn my list of programs I started to notice that there were two version…

 

 

 

image

 

Task Manager was also mocking my naivety…

 

So after updating the all the accessible shortcuts in every location I find myself left with 64 bit goodness, hopefully there are no unfortunate side effects!

image 

Technorati Tags:

Saturday, October 24, 2009 12:40:58 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [3] - Trackback
IE
Blogroll
Statistics
Total Posts: 334
This Year: 22
This Month: 0
This Week: 0
Comments: 32
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2010
Mark Downie
Sign In
All Content © 2010, Mark Downie
DasBlog theme 'Business' created by Christoph De Baene (delarou)