Mathew Nolton Blog

Software dementia unleashed...

December 2003 - Posts

Self-Deprecation.

At work...one person was upset that Mat had gained a few pounds over the holidays.

Posted: Dec 23 2003, 04:15 PM by MatiasN | with no comments
Filed under:
I need to rant...."Does ASP.NET need to be Moderated?"....

Some of you may post on some of the Technical Boards out there. Me, I prefer GotDotNet. There is a great flow of information on a range of subjects with a number of .Net subject matter experts. Furthermore, there are a large number of off-topic discussions on a range of subjects. Recently, I started posting to the ASP.NET board. It too is a great board for posting and getting technical information...except for the extremely annoying moderation of nearly every topic. I posted a topic out there Why...Why...Why must all comments be moderated to dicuss this very fact.

The most common reason responses for moderators is the fact it helps make sure the topic is on the right board and that if the English is bad, someone will clean it up. Or they are afraid of people trolling the sites with non-sensical or trashy content. Personally, I don't buy it. The boards are quite capable of policing themselves. On several occasions (on GDN) I have seen people post get rich quick schemes (or similar) and they are quickly flamed. Typically with the marketer running off with their tail between their legs. In other situations I have seen people post questions on the wrong board and people (usually politely) tell them that they should try a different board. So if boards are capable of self-regulation (again GDN is a great example), then why is it done? Its all very Orwellian to me.

Help me understand. I just don't get it.

-Mathew Nolton

Posted: Dec 18 2003, 06:20 PM by MatiasN | with 5 comment(s)
Filed under:
Energizer Bunny Just got beat up.
So I bring in a wireless mouse @ where I am consulting. After about two months or so I have to change batteries. So I replace the Energizer batteries with Duracell batteries. Well apparently, a person about 20 feet away also has a wireless mouse and I started taking over her mouse as well as mine....Now if I could just take over the person's clipboard as well....
Posted: Dec 11 2003, 05:39 PM by MatiasN | with 1 comment(s)
Filed under:
The latest in obfuscator technology.....

Santa...Dreams do come true...

RMR-C430

 

Posted: Dec 04 2003, 04:14 PM by MatiasN | with no comments
Filed under:
Revisited---String to Decimal to Binary Converter

In a previous post, I posted a piece of code that would convert a string to its decimal equivalent and then its binary equivalent. For example:

Mathew is returned back as 01001101 01100001 01110100 01101000 01100101 01110111

A very good comment pointed out that i can just use Convert.ToString() method. I have used this class extensively but I never noticed the versions that converts either a byte, int16 or int32 to different numeric bases (e.g. base 2). I will cut myself a bit of slack because there are 36 different overridden versions of Convert.ToString(), but its a nice feature and well worth pointing out. Furthermore, it reduces the size of my code considerably(see below). Also, I could probably have made the code a bit more generic, but at the end of the day the class is still pretty useless (I just wanted to come up with a way to create clever IM display names)...so why bother ;-)

///


/// Summary description for Base2Converter.
///

public class Base2Converter
{
        #region ctors
        ///
        /// The default constructor.
        ///

        public Base2Converter(){}
        #endregion ctors

        #region public methods
        ///


        /// Converts the string into a representative binary string.
        ///

        /// Value to convert
        ///
        public string Convert( string val )
        {
                if( val == null ) return null;
                StringBuilder retVal=new StringBuilder();
               
foreach
(char c in val)
                {
                       // put a space b/w each character...
                       
if
(retVal.Length>0) retVal.Append(' ');
                        retVal.Append( Convert.ToString( c,2 ) );
                }
                return retVal.ToString();
        }
        #endregion public methods
}

Posted: Dec 03 2003, 09:08 PM by MatiasN | with 2 comment(s)
Filed under:
A Binary Clock?

Man am I a geek. I actually want this thing.

Here's the link http://www.thinkgeek.com/cubegoodies/lights/59e0/

description

Posted: Dec 03 2003, 02:15 PM by MatiasN | with 14 comment(s)
Filed under:
String to Decimal to Binary Converter

In an effort to clutter the world with useless (but fun classes), I offer this up.

Seriously, I was looking for a quick way to come up with a clever (clever is debateable) IM name, I wrote this class that takes a string, converts it to a byte array and then returns back the binary representation (as a string). For example

Mathew is returned back as 01001101 01100001 01110100 01101000 01100101 01110111

Here is the class code

/// <summary>
/// Summary description for Base2Converter.
/// </summary>
public class Base2Converter
{
        #region ctors
        /// <summary>
        /// The default constructor.
        /// </summary>
        public Base2Converter(){}
        #endregion ctors

        #region public methods
        /// <summary>
        /// Converts the string into a representative binary string.
        /// 
        /// This method converts each character to its ascii equivalent
        /// and then creates a binary representation of its ascii value.
        /// e.g. 'M' == 77 == 01001101.....
        /// 
        /// Note: This only converts ascii characters...oh well. its
        /// a pretty useless (but fun) class anyway.
        /// </summary>
        /// <param name="val">Value to convert</param>
        /// <returns></returns>
        public string Convert( string val )
        {
                if( val == null ) return null;
                ASCIIEncoding encoder =
new ASCIIEncoding();
                byte[] byt = encoder.GetBytes( val );
                StringBuilder retVal =
new StringBuilder();
                for(int i=0;i<byt.Length;i++)
                {
                        // put a space b/w characters.
                        if( i > 0 ) retVal.Append( ' ' );
                        StringBuilder itemVal=
new StringBuilder();
                        int convertedVal = (int)byt[i];
                        for(int k=7;k>=0;k--)
                        {
                                int power=(int)Math.Pow(2,k);
                                int remainder=convertedVal-power;
                                if(remainder>=0)
                                {
                                        itemVal.Append( '1' );
                                        convertedVal=remainder;
                                }
                                else
                                {
                                        itemVal.Append( '0' );
                                }
                        }
                        retVal.Append( itemVal.ToString() );
                }
                return retVal.ToString();
        }
        #endregion public methods
}

Posted: Dec 03 2003, 10:03 AM by MatiasN | with 4 comment(s)
Filed under:
More Posts