September 2006 - Posts

Have you checked the Download section of Microsoft Visual Basic 2005 website? There are cool resource to have, such as these, Microsoft Visual Basic 2005 Power Packs. Currently, there are only two available at the time of this blog writing:

Enjoy and tell me your experience! Smile

Share this post: | | | |
Posted by eriawan | with no comments
Filed under:

Finally, I can blog again. Thanks guys! 

Hi, many of us also use Visual Foxpro as their programming environment (also the use of XBASE language). Many interesting fact about Foxpro functions is SYS functions. These are dubbed as Visual Foxpro system functions. Some of them have .NET equivalents, some of them are not. An example of this is SYS(2015), that returns a sequence of alphanumeric characters that has unique behavior.

Unique? in term of it will display unique sequence for each call. Basically, it's just a 36-based numbering that contains [0-9] to [A-Z], and makes up to 36-based. Creating it on .NET is quite easy, I quickly use lazy approach by using an array of strings.

Here it is: 

         private static string[] strsequence={
            "0","1","2","3","4","5","6","7","8","9",
            "A","B","C","D","E","F","G","H","I","J",
            "K","L","M","N","O","P","Q","R","S","T",
            "U","V","W","X","Y","Z"
        };
        private static long xtick=0;

        private static string CobaTimestamp()
        {
            string sTimestamp="";
            xtick=DateTime.Now.Ticks;
            //construct numbering of base 35
            long habis=xtick;
            long hasilmod;
            while (habis>=36)
            {
                hasilmod=habis % 36;
                habis=habis/36;
                sTimestamp=strsequence[hasilmod]+sTimestamp;
            }
            hasilmod=habis%35;
            sTimestamp=strsequence[hasilmod]+sTimestamp;
            //Chop it off
            sTimestamp="_"+sTimestamp.Substring(0,10);
            Thread.Sleep(40);
            return sTimestamp;
        }

 Yup, you can extend it. Better implementations and comments are welcome. Thanks!

Share this post: | | | |
Posted by eriawan | with no comments