November 2004 - Posts

Developer Readiness - Chalk, Talk & Code

Would there be any interest in us arranging chalk, talk & code sessions, for the saArchitect and/or saDeveloper communities to get together on a bi-weekly basis to investigate new technology, talk about the technology and to develop re-usable code in informal workshop style events?

We could take a complete solution from A-Z, through all the SDLC cycles and end up with a working solution ... having fun and at the same time being able to learn from each other. Please let me know if you would be interested in such sessions, so that we can plan accordingly and arrange under the saArchitect/DRP banner.

If you are interested, also indicate what time in the week would best suit you, i.e. weekend, after hour, etc.

 

Posted by willy with 3 comment(s)

94.7 Cycling Challenge

The Pick ‘n Pay 94.7km Cycle Challenge is once again behind us ... Gauteng's “toughest race”, should actually be termed the “safest and greatest race”. 

Our kids enjoyed the 947m, 4.97km and 9.74km kiddies races on Saturday, while we thoroughly enjoyed the race on Sunday this year, even if the rain and strong wind gave us all a bit of a beating at times. The race has once again received great support from the Johannesburg residents for this great event and the crazy 24 600 cyclists who took over the roads. To Karl, your time of 02:45:54.4 is truly inspiring! To the crowds ... “thank you very much” for your support, cheering and assisting the cyclists who ended up fixing tubes and chains. To the organizers “a big thank you” for the excellent organization and total road closure, which definitely makes this race a highlight.

To my cycling colleagues ... may the force be with us next year to slowly close the gap on Karl ... q;-)

 

Posted by willy with no comments
Filed under:

Extract from the DRP … “Using an interface instead of InvokeMethod with Reflection”

We are told that InvokeMethod with Reflection is slow and that we should be using an interface. But how … the example ProcessData either calls ComplexReflection (using InvokeMethod) or SimpleReflection (using an interface).

 

#define Neptune

 

using System;

using System.Reflection;

using System.Runtime.Remoting;

using System.Globalization;

using System.Diagnostics;

 

 

namespace BBD.Drp.Remoting

{

    [RefClass("BBD.Drp.Remoting.CalculationA.dll",

              "BBD.Drp.Remoting.CalculationA",

              false)]

    public class RemoteObject : MarshalByRefObject

    {

        private DateTime dateTimeStart = DateTime.Now;

        private DateTime dateTimeEnd;

        private long     processTime;

   

        public RemoteObject()

        {

        }

 

        public bool ProcessData ( double valueOne, double valueTwo,

                                  out double result, out string description )

        {

            bool success     = false;

            result           = 0;

            description      = "Unknown";

 

            // Check our attributes

            Attribute[] attrs = Attribute.GetCustomAttributes(typeof(RemoteObject));

            foreach ( object attr in attrs )

            {

                if ( attr is RefClass )

                {

                    if ( ((RefClass)attr).complex )

                    {

                        success = this.ComplexReflection ( ((RefClass)attr).name, ((RefClass)attr).cclass,

                            valueOne, valueTwo, out result, out description );

                    }

                    else

                    {

                        success = this.SimpleReflection ( ((RefClass)attr).name, ((RefClass)attr).cclass,

                            valueOne, valueTwo, out result, out description );

                    }

 

                    dateTimeEnd = DateTime.Now;

                    // Calculate difference between end and start in milliseconds

                    processTime = (long) ((TimeSpan)(dateTimeEnd - dateTimeStart)).TotalMilliseconds;

                }

            }

 

            return ( false );

        }

 

        private bool ComplexReflection( string dll,        string cclass,

                                        double valueOne,   double valueTwo,

                                        out double result, out string description )

        {

            // init

            double retCode;

            result      = 0;

            description = "";

 

            // Load DAO using reflection

            Assembly assembly = Assembly.LoadFrom( dll );

                   

            // Load Type within Assembly

            Type     type       = assembly.GetType( cclass, true, true );

            CultureInfo culture = new CultureInfo( "en" );

                    

            // Create an instance of a type.

            object[]     argsConstructor    = { "Add Calculation" };

            object       objectCalculator   = null;

                         objectCalculator   = type.InvokeMember( null,

                                                                 BindingFlags.DeclaredOnly |

                                                                 BindingFlags.Public   | BindingFlags.NonPublic |

                                                                 BindingFlags.Instance | BindingFlags.CreateInstance, null, null,

                                                                 argsConstructor, culture );

           

            // Call Method

            object[]     arguments    = { valueOne, valueTwo, result, description };

            retCode = (double)type.InvokeMember( "Calculate",

                                                 BindingFlags.Instance

                                                 | BindingFlags.InvokeMethod

                                                 | BindingFlags.Public,

                                                 //| BindingFlags.NonPublic, // Needed to access private

                                                 null, objectCalculator, arguments, culture );

            result      = (double)arguments[2];

            description = (string)arguments[3];

 

            return true;

        }

 

        private bool SimpleReflection( string dll, string cclass,

                                       double valueOne, double valueTwo,

                                       out double result, out string description)

        {  

            // init

            double retCode;

            result                          = 0;

            description                     = "";

            object[]     argsConstructor    = { "Add Calculation" };

           

            // Load DAO using reflection

            Assembly    assembly   = Assembly.LoadFrom( dll );

            Type        type       = assembly.GetType( cclass, true, true );

            ICalculator calc       = (ICalculator)Activator.CreateInstance( type, argsConstructor );

           

            retCode = calc.Calculate ( valueOne, valueTwo, out result, out description );

            return true;

        }

 

        [Conditional("Neptune")]

        private void Whatever ()

        {

        }

    }

}

 

 

If you have a better way of solving the issue, please let us know.

 

Posted by willy with 3 comment(s)
Filed under:

Quick reference poster "Best Practices - Security", DRAFT-1, ready for review

Quick reference poster "Best Practices - Security" has been posted in the quick reference poster gallery.

http://dotnet.org.za/willy/gallery/image/1042.aspx

Your comments would be appreciated, so that we can revise and finalise the poster.

More posters are available for download on our readiness site www.drp.co.za.

Posted by willy with no comments

Quick reference poster "Best Practices - Service Interface", DRAFT-2, available for review

Quick reference poster "Best Practices - Service Interface", DRAFT-2 has been posted in the quick reference poster gallery.

http://dotnet.org.za/willy/gallery/image/1039.aspx

Your comments would be appreciated, so that we can revise and finalise the poster.

More posters are available for download on our readiness site www.drp.co.za.

Posted by willy with no comments

Quick reference poster "Best Practices - Performance", DRAFT-2, available for review

Quick reference poster "Best Practices - Performance", DRAFT-2 has been posted in the quick reference poster gallery.

http://dotnet.org.za/willy/gallery/image/1041.aspx

Your comments would be appreciated, so that we can revise and finalise the poster.

More posters are available for download on our readiness site www.drp.co.za.

Posted by willy with 1 comment(s)

Microsoft Data Access Block v2 Bug ... Old but found in production again

Ensure that you have fixed the Data Access Block bug in the FillDataSet method, around line 1840 as shown below. IT is a fairly old bug, but as we have found it at a customer site again, we thought to send a reminder.

// Add the table mappings specified by the user
if (tableNames != null && tableNames.Length > 0)
{
    string tableName = "Table";
    for (int index=0; index < tableNames.Length; index++)
    {
        if ( tableNames[index] == null || tableNames[index].Length == 0 )
            throw new ArgumentException( "The tableNames parameter must contain a
                                         list of tables, a value was provided as null
                                         or empty string.", "tableNames" );
        dataAdapter.TableMappings.Add(tableName, tableNames[index]);
        // Fix as per YAH email from GotDotNet
        tableName = "Table"+(index + 1).ToString();
    }
}

Line … 1840

Posted by willy with no comments
Filed under:

From the DRP FYI List - .NET Enterprise Service Considerations

When working with high transaction volume systems we have found the following two considerations valuable to manage resources and thus enhance performance:
  • Consider calling the Dispose method when you complete ServiceComponent objects to avoid possible deadlocks on multithreaded applications because of asynchronous cleanup of component references.
  • Consider making use of System.Runtime.InteropServices.Marshal.ReleaseComObject(objref) to release Enterprise Services objects. This method call forces the wrapper to release the reference and that the wrapper is freed up when garbage collection occurs. Otherwise it is possible for an object activation to remain alive indefinitely.
Posted by willy with no comments
Filed under:

VS2005 BETA 1 and PocketPC ... teething problems

While researching and developing the PocketPC lab we encountered the following issues, which are probably due to the early BETA, are are nevertheless worth noting:

  1. When running Visual Studio 2005 in a Virtual PC connected to the network, we encountered issues when deploying the PocketPC solution to the virtual pocket pc emulator. The error was not very descriptive, merely a “Deploy failed”, even though the emulator launched successfully.

     Work Around: The only resolution we found was to disconnect from the network, restart Virtual PC and continue from there.
  2. When design forms were left open, the solution failed when re-opening the solution, claiming that the Virtual Emulator could not be launched and that version information was incorrect.

    Work Around: Close all files in the solution before saving and closing the solution.
Posted by willy with 1 comment(s)
Filed under:

New Horizon book finally ships on 11th November ... introducing the concept of a reusable...? toothpick

As part of sharing information, experience and best practices the DRP team (with the help of third-party contributors and reviewers) committed iteself on a journey of creating a consolidated book ".NET Enterprise Solutions ... Best Practices for the conisseur", ISBN:0-620-33013-9, which was interesting, fun, yet challenging and especially frustrating when it came to finalising the book to meet publishing requirements. We probably know more about RGB and YMCK colour formats, which illustrations formats work best for PDF conversion and which result in funny and at time fuzzy-stealth-like images after conversion.
 
Ralf Dominick added the following foreword to the book, which sums up the initiative quite nicely:
 

It is often said that experience is like a toothpick; it’s for personal use only. I often deplore the sad fact that a highly experienced professional cannot create a simple web services interface to the invaluable store of human experience that has been gained over millennia. This book is a small step towards making the toothpick of experience a reusable commodity.

Although this book is focused on Microsoft-specific technologies, the collective experience of the authors has been gained during the evolution of the micro computer, from the first stand alone personal computers to current network-centric systems. This means that, although we can expect the technological relevance of this book to decay in as little as the next three years, the experience shared will retain its relevance for decades to come.

The group of authors who have contributed their knowledge gave selflessly of their time while remaining responsible for designing systems, developing programs and managing projects. This book is a monument to their experiences, while to the reader; it is a toothpick that can be shared.
 
If you are interested in the book, please ping us on drpauthors@bbd.co.za.
Posted by willy with no comments
Filed under:

Where is the AppReader on Compact Framework?

Ahmed pointed us to a good link, which introduces you to an alternative to AppReader, which is missing in the .NET compact framework. If you are adhering to the best practise guideline of keeping configuration and business logic loosely coupled, then go to http://www.eggheadcafe.com/articles/dotnetcompactframework_app_config.asp which provides a simple workaround.
Posted by willy with no comments
Filed under:

Quick Reference Design and Development Charts

Please note that we have posted all of our quick reference posters on www.drp.co.za which cover areas such as design, security, SQL, C#, Java, EJB and lots more. The intention of the charts are to create a “quick reference” or “cheat” poster for specific areas of interest as most of us are unable to remember everything there is no remember the world of bits and bytes.

Your comments and feedback on the posters will be most welcome. We will strive to include all recommendations and problem reports. We are also happy to make available higher resolution posters on demand.

Enjoy

Posted by willy with 1 comment(s)
Filed under:

Getting started ...

A brief introduction of myself as the first post. I try to cover the complete development lifecycle from architecture, through my favourite development right to testing and QA. My focus is primarily on Microsoft .NET solutions and interoperability with other technologies. I am also a member of the developer readiness program (DRP), which is an initiative for developers, by developers, with developers intended to share information and best practices in the development space and to assist other teams to adopt new technology efficiently and effectively.

As part of saArchitect I will try to post valuable information to the www.saArchitect.net site and notify everyone using this RSS feed. To allow those using smart RSS readers to filter the posts, we will be using predefined tokens/categories, such as Development, Architecture, General and others when and as needed to fine tune the content.

Originating from the days when PCs were dug out of garages in the 80's, my exposure to IT has been interesting and challenging, with .NET being the latest cave I am busy exploring. The latter technology is probably the most exciting technology I have worked with to date and I am looking forward to many more years of fun and excitement.

On the personal front I am a fanatical diver, another track that is also already 24 years old, and when courage prevails we launch rockets, some self designed and built, others based on the more reliable kits. If there is any interest I am more than happy to share marine and diving pictures from Truk Lagoon, Guam, SA coast, SA interior, SAP Dive Unit dives, amongst others.

Posted by willy with 3 comment(s)
Filed under: