by Dominic Zukiewicz
27. April 2007 15:28
Considering how much XML is used and the amount of code I've written to read/write XML, I still make a common mistake!
If you ever get this error:
System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.
Make sure you are using the correct method for the XmlDocument class. For example:
string xml = @"<xml version=""1.0""?><node><innerNode/></node>";
string filename = @"C:\\temp.xml";
StreamWriter sw = new StreamWriter(filename);
sw.Write(xml);
sw.Close();
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(filename); /...
[More]
e1d477b3-5f89-48c8-add1-fde1155b8cf0|0|.0
Tags:
Framework | Xml
by matt
27. April 2007 11:17
OK, so it looks like someone has put together a tool for unit testing BizTalk Server.
Wow, I wish I'd know that this existed on some of my previous projects. I'm going to have to go and play with this now and see just how good it is. I normally end up writing a whole heap of extra BizTalk stuff (i.e. pretend SAP systems etc) to test my solutions, I hope this will make things quicker and easier for us all.
You can get more information on Kevin B Smith's blog.
Worth a read I feel
by matt
27. April 2007 11:04
One of our guys came up across this error recently on a system we have been developing for one of our clients. It's not en error that I have seen before so I thought it worth mentioning. The full error was:
The InboundTransportLocation is disallowed. This could be because the receive location is disabled or its service window is currently inactive.
It took us a bit to figure out (i think about 10 minutes combined), and it turns out that the document that we were receiving was invalid and we were using an XMLReceive pipeline with the AllowUnrecognisedMessage property of the pipeline ...
[More]
by Dan Matthews
27. April 2007 09:54
I was at a Ruby on Rails presentation last night, run by the Oxfordshire branch of the BCS. I was expecting great things, to be told how all our .NET and Java web apps were to be made obsolete overnight (or something like that).
Unfortunately, it wasn't all that it seemed cracked up to be. It looks lovely for bashing out quick sites, especially if you are designing the data model from scratch (and it's quite simple). However, as you try and do more complex things, then it gets exponentially harder. I think it was summed up by someone I was chatting to after the event, who said that Ruby on Ra...
[More]
f0745485-9fbb-41b4-93f8-fdee3f5bf503|0|.0
Tags:
by matt
26. April 2007 13:52
So we have .Net 2.0 and we also have .Net 3.0 (which is really just .Net 2.0 with a bunch of extra cool stuff added). What more, well - .Net 3.5 is on the horizon. This really is a new release of the framework and, unlike 3.0, also is accompanied by a new version of Visual Studio .Net.
Right now this new version is in Beta 1 and its possible a little flakey. I have it installed on my machine, but irritatingly I can't do anything as there are no templates asides from the Empty Solution template. I got a little miffed at this, but nicely enough, the Express editions are also available in ...
[More]
by Brad
26. April 2007 10:18
Instead of writing a try/catch/finally block for objects such as database connections, commands, streams (well anything that implements IDisposable) try to use the little known using command.
For example the following code works, but you'll notice that the connection and command are never closed and disposed, quite a simple mistake to make, but can prove costly!
SqlConnection cn = new SqlConnection(connectionString);
SqlCommand cm = new SqlCommand(commandString, cn);
cn.Open();
cm.ExecuteNonQuery();
The above can be easily replaced with the use of the using command...
using (SqlCon...
[More]
4021b2f7-b283-4e6e-8584-3354d566c17d|0|.0
Tags:
C#
by Dan Matthews
26. April 2007 09:33
When installing SQL Server Express 2005, you may get an error saying something like:
An installation package for the product Microsoft SQL Server Native Client cannot be found. Try the installation again using a valid copy of the installation package 'sqlncli.msi'.
Irritatingly, it only says this after the installation file has already extracted, installed support files, checked the system, checked pre-reqs, initialised main installation, prompted you for config and installed a bunch of things (which it then rolls back). It's 5-10 mins until you get the error and there's no 'retry'.
Anyway,...
[More]
53b98666-1d90-46da-90c0-4389a55919b5|0|.0
Tags:
by matt
26. April 2007 07:29
Excellent stuff!! I popped along to this event yesterday in Reading. It was all very last minute for me as someone else was supposed to be going instead of me.
The day itself consisted of four main sessions, each followed by a quick 'how-to' session for Office 2007. Basic summary of what was covered is: LINQ and .Net language enhancements, AJAX, XAML, Data Advances in VS 'Orcas' and Windows Live.
By far, I was most interested in the LINQ and language parts, which also tied in very nicely with the Data Advances in VS 'Orcas' session. So much so, that I'm currently installing Orcas on...
[More]
by Dan Matthews
24. April 2007 14:28
If you are setting MOSS User Profile properties, there is a bit of a gotcha when dealing with multi-value properties. Normally, you'd do something like:
UserProfileManager oManager = GetUserProfileManager();
UserProfile oProfile = oManager.GetUserProfile(sUsername);
oProfile["SomePropertyName"].Value = "This is a nice value to set";
If you try this then, happily, it will probably work. That is unless you have a multi-value property. Well - it will work if you have a multi-value property, as long as you are only setting a single value.
Let me explain.... it looks at first glance as i...
[More]
by Dominic Zukiewicz
23. April 2007 16:29
Again, being nosey and looking over peoples shoulders, I've seen quite a lot of heavy nesting in IF statements.
I#ve wrote a short article on some "good practice" techniques on reducing the size of your ifs, and restructuring them so they are both easier on the eye, and easier to see logically what is happening.
http://blogs.bdnet.co.uk/dominicz/archive/2007/04/23/Good-code-structuring-for-IF-statements.aspx
ee8d32da-b6af-4bfc-9386-d0bae90793cd|0|.0
Tags:
by matt
20. April 2007 10:29
When you have a fairly active DB, your going to get a pretty large log file unless you have a suitable maintenance plan.
We've had a few problems before where large log files have taken up all of the available disc space, causing application problems when acessing the DB.
If you don't need the logs, then this will tell you how to shrink them. But you must set up maintenance plans to look after you databases and conserve resources (it will also make your DBs a little more efficient).
If you don't know how to set up a maintenance plan, read this article. If you still don't know aft...
[More]
63887b8f-5e7f-4200-8bbd-6166431ad9b8|0|.0
Tags:
SQL Server
by matt
20. April 2007 09:58
In BizTalk 2000 and 2002, document tracking can be a right royal pain in the bottom if you (or a predecessor) leave it on by mistake.
In one particular example, Document Tracking was left on and database InterchangeDTA mdf file filled the disk up (22gb) when client put through large # of XMLs. As the data was not required we detached database, deleted db and recreated db using a generated script from an identical version/type of BizTalk (details below). 300k suspended messages were also removed.
Quick, Cheap and Dirty Resolution:
First of all confirm with client you need document trac...
[More]
by matt
20. April 2007 09:49
This is an issue we picked up on when trying to crowbar nice features in to BizDesk on Commerce Server 2002.
Essentailly, we did a piece of work in .Net that we want to be able to call from the BizDesk (which is all nasty classic ASP). The achieve this in development, there are a couple of things that you do to make you assmeblies work.
You basically add the entire universe according to Bill Gates in to the GAC (Global Assembly Cache), and then you run REGASM from the .Net command prompt on the key entry point assemblies (i.e the ones that you want to use Server.Create on). For dev...
[More]
b694442c-a51a-4437-96ac-18f8910fd37f|0|.0
Tags:
ASP.NET
by Dominic Zukiewicz
20. April 2007 09:20
Again, another cryptic BizTalk error.
I was deploying the orchestrations from VS2005 to my local machine, when I got this error:
Failed to add resource(s). Change requests failed for some resources. BizTalkAssemblyResourceManager failed to complete end type change request. Object reference not set to an instance of an object.
I found this error meant that the assembly for the orchestration was deployed, but the entry in the BizTalk Management DB was not successful. Re-deploying the orchestration will not work as it wants to re-deploy the assembly too!
In order to correct this erro...
[More]
4c754751-e09c-43a1-b49d-bf43cf8a9082|0|.0
Tags:
by matt
20. April 2007 07:43
Heh, a slight addition to my previous post here. Kinda feeling sheepish now.
My code worked frin for about 8 hours or su, until randomly, my client in question decided to switch date formats. I can't really figure out why, but intermittantly, the thing calling my code will send 4/20/2007 or 20/4/2005. This kinda sucks so I have to have another scurry around on google to see what I could find. Basically, this article by Amol Kulkarni here helped me out alot.
You have to be careful with XACT_ABORT I think, again - I'm not SQL guru and I'll need to read up on this. It seems fairly sim...
[More]
a4eb099e-f52e-4acf-bee1-0fc7e3f7e0dc|0|.0
Tags:
SQL Server
by Dominic Zukiewicz
19. April 2007 17:05
You may love it, you may hate it .... you may not know what it is!
Its worth knowing about in any case and may help you become a better, consistent and able developer.
You can read my article on it here:
http://blogs.bdnet.co.uk/dominicz/archive/2007/04/19/FxCop---what-is-it.aspx
b8b8a979-7ba1-4848-ab53-f0c82f47c4a0|0|.0
Tags:
Framework
by matt
19. April 2007 13:36
One of the things I really find frustrating sometimes is working with dates. I came along a problem recently where I was receiving a nicely formatted UK date (dd/mm/yyyy etc) and needed to pass it as a string over to another SP which may or may not accept that string formatting. Son instead of 19/04/2007, I wanted to use something closer to April 19, 2007.
Every time I tried I was getting a DateTime conversion error. When I've seen this problem before people have always talked about parsing the string and cutting it in to it's component parts. Now, I'm no SQL guru but I was pretty sure ...
[More]
f397b0ce-1838-4736-abe9-68bc5ec7ac70|0|.0
Tags:
SQL Server
by Dominic Zukiewicz
18. April 2007 16:27
In a lot of cases, organisations leave their computers on overnight to help keep the network stable, to apply security updates and to do their daily virus scans and clean themselves up.
When coming up with ideas for my 3rd year dissertation at university, I thought of the idea of distributed computing - to allow lots of computers to participate in a mathematically complex series of events, to help crack codes or to help science with anything that requires more computing power than is currently available.
On heading into one of the labs, I saw a little satellite dish icon in the taskbar. ...
[More]
cb0ef13d-aa0e-4ebf-85d0-e41ae7f3daea|0|.0
Tags:
by Dominic Zukiewicz
17. April 2007 12:41
Its always a good thing to know how to get the very best out of .NET. One area that is always overlooked is string concatenation. You have several ways to do this including: string x = "HELLO" + " " + "THERE"; string x = "HELLO "; x = x + "THERE"; string x = "HELLO "; x += "THERE"; string x = String.Concat("HELLO"," ","THERE"); Although these are syntactically correct, they eat memory up faster than a buffet lunch at a fat fighters convention! This is the process that is carried out by the application: string text = text + otherText; Allocates temporary memory large en...
[More]
657ac51c-53b2-4f2e-a529-70eae69b2288|0|.0
Tags:
Framework
by Dan Matthews
17. April 2007 08:59
Massive frustration... only being able to point to an AD once with a single Import connection. (Try setting up a second and see what happens!) Can anyone think of a logical reason why this limitation should be there?
To work around it, either construct a clever LDAP query to change your search root or select specific AD nodes, or use a Security Group on the filter, like so:
(&(objectCategory=Person)(objectClass=User)(memberOf=CN=YOURGROUP,OU=YOUR_OU_IF_PRESENT,DC=SOMEDOMAIN,DC=CO,DC=UK))
The advantage of using a Security Group is to get excellent granularity. I use it to select whol...
[More]