in

dotnet.org.za

South African .NET Developer Portal

The Bumpy Blog

Bumpy's Bedside Story

October 2004 - Posts

  • ASP.NET 2.0 UPDATE - Amazing

    I read this from Scotts blog.  I am glad that I am not working on such a use project.  Take a look at what they go through to do some tests.

  • 6 GMail accounts available

    I have 6 GMail accounts available.  First 6 requests gets it.
    Posted Oct 11 2004, 03:39 PM by deonvs with 9 comment(s)
    Filed under:
  • JetBrains Omea is best

    Anyone still in doubt??  Read this review.  Still on the BETA, but you get the idea.  Try it.
    Posted Oct 07 2004, 03:16 PM by deonvs with no comments
    Filed under:
  • Configuring IIS: Mapping .* to the aspnet_isapi.dll - HttpHandlers

    I recently wanted to map ALL requests going into IIS to a HTTPHandler.  Not justfor a specific file extention.
    For the life of me, I just could not figure that one out.

    I feel a bit stupid after finding this on Scott's Blog.

  • Serializing a Well-Known Class object to XML, to Deserialize later.

    If you ever worked on Mobile USSD, you will know that it works exactly like a web request. We have a USSD session manager application (sort of like IIS), because USSD also needs to keep sessions for each time the user comes back with a response. Every USSD service that we add have new requirements and thus normally have a new class to be added as a reference so that the Session manager are aware of the data type it should hold in its session data.

    This becomes a problem after a few services because of DLL versioning etc, etc. It became apparent that we needed to store the Class objects in a way that the Session Manager does not need to know what it is. I looked at XML as the answer.

    I used a XML Doc to send the Serialized class to this Session manager so that the Session Manager do not need to know what object type it is. I therefor needed to parse these class objects to XML. I wrote these methods to help me with this. The only snag is that it must be well-known object types, like string, int, bool, etc. I started looking at XML attributes, but could not make a generic method for any datatype I can pass to it.

    The methods look like this:

            public XmlDocument ParseToXML(ClassObject data)
            {
                XmlSerializer ser = new XmlSerializer(typeof(ClassObject ));
                System.Text.StringBuilder doc = new System.Text.StringBuilder();
                TextWriter tw = new StringWriter(doc);
                try
                {
                    ser.Serialize(tw, data);
                }
                catch (XmlException ex)
                {
                    Console.WriteLine(ex.Message);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
                
                tw.Close();
                XmlDocument xmldoc = new XmlDocument();
                xmldoc.LoadXml(doc.ToString());
                return xmldoc;
            }
            public ClassObject FromXML(XmlDocument xmldoc)
            {
                ClassObject data = new ClassObject();
                XmlSerializer ser = new XmlSerializer(typeof(ClassObject));
                XmlTextReader xmlreader = new XmlTextReader(xmldoc.OuterXml, XmlNodeType.Document, null);
                
                try
                {
                    return (ClassObject)ser.Deserialize(xmlreader);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                    return null;
                }
                finally
                {
                    xmlreader.Close();
                }
            }
    
     The Class Object can look like this:
            public class ClassObject
            {
                private int _property1;
                private int _property2;
                private int _property3;
                private string _property4;
                private ItemIndexer[] _listitemsindex = new ItemIndexer[0];
                public class ItemIndexer
                {
                    private int _itemindexprop1;
                    private int _itemindexprop2;
                    public int ItemIndexProp1
                    {
                        get {return _itemindexprop1;}
                        set {_itemindexprop1 = value;}
                    }
                    public int ItemIndexProp2
                    {
                        get {return _itemindexprop2;}
                        set {_itemindexprop2 = value;}
                    }            
                }
                
                public ClassObject()
                {
                }
                public int Property1
                {
                    get {return _property1;}
                    set {_property1 = value;}
                }
                public int Property2
                {
                    get {return _property2;}
                    set {_property2 = value;}
                }
                public int Property3
                {
                    get {return _property3;}
                    set {_property3 = value;}
                }
                public string Property4
                {
                    get {return _property4;}
                    set {_property4 = value;}
                }
                public ItemIndexer[] ItemIndexes
                {
                    get    {return _listitemsindex;}
                    set {_listitemsindex = value;}
                }
            }
    
    And just by running ParseToXML method, you should get a XMLDoc to send the
    OuterXML as a string to save to DB or anywhere else, and get the ClassObject back by running
    the FromXML method.
    Remember to add 

    using System.Xml.Serialization;

    in your code.

     
  • Screen Ruler in C#

    Jeff Key created this very nice C# pixel measuring ruler app.  I can think of a few places where it could come in very handy...
    You can download the Exe or Source.

  • Omea Reader 1.0

    Just got a email from JetBrains!!!  The released version 1.0 of Omea Reader.  Very nice news/blog/more reader.

    We are happy to announce the release of the third product from JetBrains - Omea Reader 1.0

    Omea Reader is an easy to use, all-in-one RSS/ATOM feed reader, newsgroup reader, and web bookmark manager. But what really makes it unique is the level of information organization and management features including lightning-fast searches, flexible filing, contextual access, and extensibility.

    As a limited time offer, you can get a FREE license for using Omea Reader.
    You can download Omea Reader at
    http://www.jetbrains.com/omea_reader/download/index.html.

    We hope that you will enjoy using Omea Reader. Your comments and suggestions are welcome at feedback.omea@jetbrains.com. As always, we thank you for your interest in JetBrains and your support for our products.

    The JetBrains Team

    Posted Oct 05 2004, 09:15 AM by deonvs with 5 comment(s)
    Filed under:
Powered by Community Server (Commercial Edition), by Telligent Systems