I’ve spent the last few weeks laid up with knee surgery.  In that time I’ve revisited some hobby stuff including WorldBankBBS.  Testing with Synchterm normally goes well, but when testing at 2400 baud it’s not entirely accurate.

The solution is to use WinVICE (the Versatile Commodore Emulator) to actually emulate a Commodore 64 connecting to the BBS.  To make that work, you need another program called TCPSER.  This program is a GNU/Linux native app and requires Cygwin to run on Windows.  There is a Java port called TCPSER4J, and it works fine, but you get all of the problems of having Java installed on your system.

One of the things that is a big bonus of porting TCPSER4J to C# is that it allows the application to be run as a Windows Service which ensures you always have it running.

You can check out the code at https://github.com/sharpninja/tcpsersharp and you can check out the project at http://thesharp.ninja/tcpsersharp where you can download the installer.

 

An extension method that will be making its way into the Generic Extension Methods library is one I want to share tonight.  It’s for projecting an action N times.  Why such a method doesn’t already exist baffles me!

        public static T Project<T>(this T projected, int n, Action<T> action)

        {

            for (int i = 0; i < n; ++i) action(projected);

            return projected;

        }

Usage could not be simpler, any object can be projected to the specified action any number of times.

        public static int Method()

        {

            var value = 1;

            return value.Project(10, i => i*=i);

        }

 

The projection in this case yields 10^10 as the answer.  Overly simplistic example, but makes the point succinctly.