What I have learnt today…

I think the main reason I started this blog was to note to myself the things that I learn as I go on.

Coming from a MS Server background, each day I amass more knowledge and remember less of what I used to know.

Many times I have searched the web for an answer and ended up having to figure it out for myself. This blog will give me the opportunity to remember those things and pass on the experience

What I have learnt today

I think the main reason I started this blog was to note to myself the things that I learn as I go on.

Coming from a MS Server background, each day I amass more knowledge and remember less of what I used to know.

Many times I have searched the web for an answer and ended up having to figure it out for myself. This blog will give me the opportunity to remember those things and pass on the experience.

Starting off here

Welcome to the new blog for Aaron Reynolds

Here you will find things relating to Internet technologies that I deal with on a regular basis.

Most of the blogs will contain C# code that I have used to solve a problem, other things will be related to some server technologies and fixes that I have needed to implement or had difficulty finding information about on the web.

Many times I have found the solution to a problem in someone else’s blog. Now I intend to share the experience I have as I develop web sites, web services and windows apps in and out of the work-place.

Remove Remote Desktop Login Wallpaper

Ever used RDC to a server across a really slow Internet connection like connecting to the office server from home when its peak time for downloaders? I have and the downside is obvious.

One of my pet hates on any remote server is waiting for the desktop background to render on login. It's OK once you are logged in, you can automatically hide the background image through RDC settings. During login however I will often wait for 10 seconds while the default background (usually the company logo in hi-res) loads.

Found a nice simple fix for this and the link is below: Remote Desktop Login Wallpaper

Enjoy, AR

There is an error in XML document | C#

Whilest using XML serialisation to keep a set of Tasks in my Customer/Project Management App I came across a series of strange occurences which I tied down the the error: "There is an error in XML document."

Basically, the XML parser has come across a character that it doesn't expect to see given the specified encoding. In my case I was using UTF8 encoding.

Now I was puzzled that although I was using UTF8 encoding, the GBP sign (£) was causing the error. It turns out that I was encoding using UTF8 but the deserialisation was using "Default" encoding – OOPS.

Anyway, once I'd discovered that and changed so that UTF8 was the encoding for serialisation AND deserialisation we were good to go.

So if you get this error, check your encoding.

My serialisation code is:

public static bool SaveWorkToXML(TWork[] workArray, TTask thisTask) { string output = ""; try { XmlSerializer ser = new XmlSerializer(typeof(TWork[])); Stream s = new MemoryStream(); XmlTextWriter xmlWriter = new XmlTextWriter(s, Encoding.UTF8); ser.Serialize(xmlWriter, workArray); TextReader rdr = new StreamReader(s); s.Position = 0; output = rdr.ReadToEnd().Replace("\"",'"'.ToString()); xmlWriter.Close(); s.Close(); return SaveWork(thisTask, output); // SaveWork supplies SqlParameters to a stored procedure and returns T/F if inserted/updated OK } catch { } return false; }

and the Deserialisation code:

public static TWork[] LoadWork(TTask thisTask) { TWork[] workArray = null; try { string sql = "SELECT * FROM tblWork WHERE [work_guid] = '" + thisTask.Task_GUID + "'"; DataTable dt = GetDataTable(sql); string xmlText = ""; if (dt != null && dt.Rows != null) { foreach (DataRow dr in dt.Rows) { xmlText = dr["work_details"].ToString(); break; } } dt.Dispose(); XmlSerializer ser = new XmlSerializer(typeof(TWork[])); Stream s = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(xmlText)); workArray = (TWork[])ser.Deserialize(s); } catch { } return workArray; }

Return top