by Dominic Zukiewicz
2. February 2010 22:29
Recently, I’ve had to interpret some user input and then place this input into an XML file for processing by BizTalk Server 2006. Unfortunately, BizTalk Server 2006 likes you to encode characters using their XML equivalents. Let me explain.. Background This can seem quite easy using the System.Xml.XmlSerializer, with its ability to automatically generate XML and escape invalid characters for us. There are problems though. Here is a template class: public class TestClass { public string Element1 { get; set; } public string Element2 { get; set; } public string Element3 { get;...
[More]
by matt
27. November 2009 17:24
I’ve been looking in to MVC a fair bit recently (more specifically Microsoft’s implementation) and came across this article about Dependency Injection by Mike Brind. Well worth a read as it explains the concept very well if you’re not familiar with it.
by matt
9. June 2009 12:50
I was recently working on an EPiServer solution and the client wanted to include an RSS feed on certain pages of their site. I though I would write out here how I consumed the feed. You’ll want to add error handling etc in here, as this is as rough as a tramps beard whilst being enough for you to get the point. The first thing I had to do was to find out how RSS is structured. After a little Google search I found an article explaining the structure of RSS in sufficient detail for me to continue. The first thing that I did was create a struck to contain the configuration that I wanted, fai...
[More]
by matt
25. March 2009 10:07
I'm still fairly new to EPiServer, so I'm going through the process of a great many rookie errors whilst taking over a site from someone with vastly more knowledge of the product than me.
One issue I had recently was when I was creating a new stage server for a client so that they could test things out. I went through a cobbled route of copying their live DB and live code and slapping them on to of a clean EPiServer install and hacking about in the web.config file to get it all working. The in itself was a piece of cake.
I started getting problems when the AD users could not connect tot he...
[More]
by matt
17. March 2009 21:14
When you are first playing with table adapters you might get to see. When you create your typed data set, Visual Studio will create an element in the generated XSD that contains the connection string that you were using. This will more than likely not be the connection string that you want to use in your production environment. So how do you go about changing it? Well, if you start using the intellisense in Visual Studio, you will soon find that there is a 'Connection' property on the table adapter once you have created it.
Great! Lets set the connection string on that and well be done...
[More]
by matt
17. March 2009 11:05
This was not the first time I've seen this error message in a web application. Usually it happens on the development box and a quick re-compile gets rid of it quite easily.
I had it today an a staging box, so re-compile is not an option. Looking at the fairly obviously generated file name, it's clear that this file is part of the ASP.Net compilation process, so that was the general area to look for a solution.
After a brief read about the Compilation Element in the web.config file on the MSDN library, I made a brief edit to my web.config so that the batch attribute is set to FALSE. This m...
[More]
by matt
13. March 2009 12:02
Many year ago I built an e-commerce solution where I was receiving the international currency code (I.e. GBP or USD) and had to use this to determine the currency symbol to display. This was during the dirty days of ASP.Classic so I just slapped in a 'nice' little switch statement and that was that.
That is neither elegant or good, and now faced with a similar issue I decided to look in to the problem and get a nicer solution.
The Problem
I'm receiving ISO 4217 currency codes in my application and that application in itself is running under a current culture of en-US.
Using this code, I...
[More]
by matt
30. January 2009 16:52
I was asked today how to go about downloading a file as a response to a server request. I think last time I had to do that was in that days of ASP.Classic.
Anyhow, incase you are interested, the following code will allow you to download content through the browser and should bring up the browser save dialogue.
// Load a lovely file (yep - I'm not too concerned about permissions here) and
// read it into a buffer
FileStream fs = new FileStream(@"C:\TestXMLFile.xml", FileMode.Open);
long fileSize = fs.Length;
byte[] fileBuffer = new byte[Convert.ToInt32(fileSize)];
fs.Read(fileBuffer, ...
[More]
by matt
17. December 2008 12:41
Having recently been subject to a number of rounding issues in an application, we've had to take a closer look at how rounding works in the .Net framework. It seams that when using Math.Round(), there is an overload that allows us to specify the type of rounding that is used in the form of the MidpointRounding enumeration. As the Microsoft documentation will tell you, there are two possible values we can choose from: ToEven: Round to the nearest even number. AwayFromZero: Round to the nearest number away from zero. This proves to be quite interesting when you start thinking abo...
[More]
by matt
1. October 2008 14:49
Just a little note here that we noticed testing something (how it had not occurred before, I do not know). We have a function that we were referencing from a referenced assembly that would format values to the slightly odd format being used by the ERP that we were talking too. In most cases it seamed to work OK, but for smaller values it didn't quite product the result we expected. It turns out that the result of the Division functiod in BizTalk Server 2006 is a double. The mapper being the way it is converts this to a string (assumably using .ToString()). At least this is how it looks w...
[More]
by matt
12. September 2008 17:02
Summary Quite often we want to be able to perform the same operation on some information given a differing number of arguments. Typically, you might pass these arguments in as an array, thus avoiding the need to specify the number of arguments. In order to call a function like this, we then need to go ahead and build and array of to pass in our arguments. To me that seems like a little bit of an effort, at each point in my application, I know how many things I want to pass in. So how else can I do this? Solution Now, consider the funtion System.String.Format(). In one form, the Format ...
[More]
by matt
10. July 2008 15:27
If you're using BizTalk Server maps, it is about 99.999% likely that you are using logic in them. Testing this functionality in Visual Studio can be tedious as the only way to change the test document is in the properties of the map. So if you have quite a few scenarios to test, this method sucks. BizTalk Server 2000 and 2002 allowed you to select the test document at runtime, which was nice I suppose but it still meant that you had to do it manually all the time. With the exception of either figuring out how to use BizUnit and actually deploying your solution, there are not too many ways ...
[More]
by matt
9. July 2008 09:12
I tend to spend a lot of time adding assemblies to the GAC (Global Assembly Cache) in order to run unit tests or work with BizTalk Server assemblies. Usually, I'll do this using the Visual Studio command prompt or the .Net configuration tool. I wanted to find a marginally quicker way to add assemblies to the GAC so I started to look at the 'Send To' menu. In order to add shortcuts to your 'Send To', simply navigate to the following folder: C:\Documents and Settings\<User Name>\SendTo In here you can create simple shortcuts to applications. So for example you can add a 'Send To ...
[More]
by matt
27. May 2008 10:44
I ran in to this problem recently while developing a solution for a client. For me it took a little while to figure out what was happening and the error was reported to be coming from a send shape that sent a message of type System.Xml.XmlDocument.
While this is the correct place for the error to be raised, it was not strictly related to them message that I was trying to send.
The actual cause of the problem is that I have a class that is used to return information back from a series of helper methods in a library that I have built. The class has 3 public properties:
Result: An inum...
[More]
by matt
15. May 2008 12:20
I found these two great articles on MSDN about performance and scaling of ASP.Net applications. They're well worth a read in my opinion. 10 Tips for Writing High-Performance Web Applications Scaling Strategies for ASP.NET Applications
by matt
10. April 2008 08:09
Overview I'm making a concerted effort to give myself a more understanding of ASP.Net. One of the things I recall from classic ASP and my early forays in to ASP.Net was creating authentication for site. Generally we created a standard set of functions that we could reuse, but the generally always ended up being 'tweaked' from project to project. Along with ASP.Net 2.0 Microsoft delivered provider models. These models can be used for site membership and roles and so looking at the membership role immediately came to mind as being something interesting to look at. Implementation I'm just ...
[More]
by matt
25. January 2008 10:12
Overview I reckon that I have probably seen the same LINQ demo as just about everyone else in the world. You know, the one where you get a list of all of the processes running on the server and print them out to the console as follows: var processes = from activeProcesses in Process.GetProcesses()
select new { Name = activeProcesses.ProcessName, ProcessId = activeProcesses.Id };
foreach (var row in processes) Console.WriteLine(row.ToString());
Console.ReadLine();
Well, I tired to use the same principle to iterate through a custom collection for an idea I was ...
[More]
by matt
10. January 2008 16:50
As I've had a number of people mention to me that they don't quite know how to use a class that implements the IFormatProvider interface. In most case that come to my attention, we are specifically interested in date formats and number formats.
Below is the code for a simple console application in .Net 2.0 that will use the NumberFormatInfo class to format the display of a numeric value. I've set up two instances of the NumberFormatInfo class, one for French formatting and one for British English formatting. The CultureInfo class from the Globalization namespace has been used to load up th...
[More]
by matt
10. January 2008 16:19
I've just installed Visual Studio 2008 so that I can start evaluating it for potential (read as 'as soon as we're allowed') deployment across the development teams here. The very first thing that I notice was understandable but still rather disapointing.
As you may have read, Visual Studio 2008 will allow you to work with different .Net Framework versions (namely 2.0, 3.0 and 3.5).
This is great, sort of.
What I noticed was that the Solution and Project files are not compatible between Visual Studio versions. Whenever you open a Visual Studio 2005 Project/Solution, Visual Studio 2008 ...
[More]