Take the following example string (note the two tabs at the end):
var s = “HellotHowtaretyoutt”;
and then run the following to write it out to the screen:
Well that works as expected, and outputs “Hello,How,are,you,,”;
But if you replace the string in the split method with an inline Regex object it fails if run under a Microsoft implementation
This outputs the same as above in Firefox etc, but if run in JScript (i.e. Internet Explorer) you lose all empty elements and get the following: “Hello,How,are,you”. This is really weird, because if you use the string delimiter above it works just fine.
I have managed to find another blog post that tries to fix this problem, but doesn’t say why it happens.
To test this online, try going to W3Schools.com.
Since I started working as the technical editor for the XSLT 2.0 and XPath 2.0 reference book I thought I’d try my hand at helping out on the Wrox Programmer to Programmer (P2P for short) forums.
When I first started out I was a ‘Starting Member’ but soon progressed to ‘New Member’.
Not long after that I noticed I’d gone up in status to ‘Junior Member’, which I actually found to be slightly condescending! I’m 33, I’m hardly a junior anything anymore.
Now however I’ve just passed the 200 post mark and I’m now a plain ‘Member’, although I do get 3 funky red stars to my name.
My Wrox Forums profile
I help out mostly on the XSLT forum, but I’ve been straying onto the C# and C# 2005 forums of late too. I find the post volume is about right for me to not get overloaded – compared to the Microsoft Forums where I can barely keep up. Luckily the Microsoft forums has a helpful ‘answered’ feature, so you can easily see which posts still need help.
However for some reason sometimes when I click on the ‘Reply’ button it logs me out – very annoying.
Overall though I find helping out others useful as makes me think about the way I work, plus I try to write my proposed solutions in a way that they should hopefully learn a little without just writing out the answer for them. Its the way I would want to be answered.
Still, the most annoying thing is those questions where the answer is on the first page of the results I find when I search google. Is it just laziness do you think? My typical response to these is now just “Google is your friend”.
News about the recently previewed Model-View-Controller framework for ASP.Net is that a first look Community Technology Preview is due out in a few weeks.
It will form part of the ASP.Net Futures release, which is a product I had a quick look at recently, and includes some wonderful stuff on Dynamic Forms.
For an overview of what the ASP.Net MVC will do there is a recording of a presentation Scott Hanselman did recently here, as well as an overview of the framework by Scott Guthrie here (if you’re not subscribed to Scott’s blog yet then why not – he provides some of the most concise yet informationful (is that a word?) blog posts imaginable about ASP.Net and associated technologies).
It seems likely that the next release of the ASP.Net Futures will be released soon after Visual Studio 2008 and .Net Framework 3.5, which are both due out before the end of November, so we shouldn’t have long to wait.
Official ASP.NET MVC framework will have first CTP release in ‘next few weeks’ « codeville
Other MVC frameworks do exist for .Net, such as MonoRail from the Castle Project. I haven’t had a chance to look at this, but it appears to be an attempt at a port of Ruby on Rails like functionality into the .Net environment.
Top 10 things to know about Visual Studio 2008 and .NET Framework 3.5
Daniel Moth (‘The Moth’) lists 10 very good reasons why I’m looking forward to Visual Studio 2008.
The killer feature for me is still the fact that I can target .Net 2.0, which means I can upgrade straight away from Visual Studio 2005, play with the new features, but still get my day job done.
The new .Net Framework classes XslTransform (or more recently XslCompiledTransform) allows you to write them in any .Net language.
But how do you implement these? Well there are two methods you can choose from, read more below the break:
Continue reading “Implementing extension methods to XSLT in .Net”
I recently had to convert an Enum back to its original Xml value so I thought I’d share the little method I wrote with you all incase you wondered how to do it yourself.
public static string ConvertToString(Enum e)
// Get the Type of the enum
Type t = e.GetType();
// Get the FieldInfo for the member field with the enums name
FieldInfo info = t.GetField(e.ToString("G"));
// Check to see if the XmlEnumAttribute is defined on this field
if (!info.IsDefined(typeof(XmlEnumAttribute), false))
// If no XmlEnumAttribute then return the string version of the enum.
// Get the XmlEnumAttribute
object o = info.GetCustomAttributes(typeof(XmlEnumAttribute), false);
XmlEnumAttribute att = (XmlEnumAttribute)o;
Example Enum Class
public enum TestEnumClass
FirstValue = 1,
SecondValue = 2,
[System.Xml.Serialization.XmlEnum("The Third one")]
ThirdValue = 3
An Enum of TestEnumClass.FirstValue will then return “FirstValue”, while TestEnumClass.ThirdValue will return “The Third one”.
Hope you find that useful.