Godaddy Virtual Servers and RDP are not my friend…

It seems to be every day or so I try and RDP into my virtual server I have hosted at GoDaddy, and the thing just decides I shouldn’t be allowed to connect. It’s a wonderful feeling to know you can see your pages being server, processes still active, but the RDP connection just gets instantaneously rejected. If I had but a clue why this happens, but I chalk it up to their proprietary virtual server quirks.

One of these days they will get their act together and I won’t have to issue a reboot request every time I want to terminal in.

UPDATE: So after talking with the GoDaddy folks, I find out that they have a single license for the virtual servers. Only one connection is allowed in at a time. When you are used to Windows normal 2 connections, this is pretty annoying. If your connection drops and you try to reconnect, it doesn’t always honor the reconnect. It sits in some sort of limbo and blocks up the port. The only way to fix it is to reboot the server. Fun, right?

If you want to avoid this, just make sure you log off after every session. Start ->Logoff. Not the lovely Red X, that just disconnects you leaving the session logged on.

What’s with government owned stock volatility?

I have been following Citigroup (C), Freddie Mac (FRE), and Fannie Mae (FNM)  lately and it seems they are behaving very erratic.

Citigroup we all know has been a roller coaster ride for us all. A day traders dream for the brave and a scary white-knuckled ride for us long term folks.  Citigroup has been slowly but surely rising higher and higher. They peaked at $5 on the 24th and I got pretty excited but then it decided to drop back down to the mid $4’s. The housing market is supposedly doing better according to this weeks report and you would have thought that the financial’s would be bolstered by the good news.

Freddie Mac and Fannie Mae have jumped 40+% in the last couple of days. Any rhyme or reason? Nope….Will it continue to rise, I sure hope so but don’t see any real reason for it to any time soon.

I keep wanting to jump into the market and grab a few more stocks, but the volatility is so high that it is quite scary for a laymen investor like myself. If anybody out there knows what the secret is, I am happy to hear it! Otherwise, I will keep watching in wonder as stocks bounce around based on consumer whim.

This is one roller coaster that can make your wallet fall out.

Let’s all jump into the pool..The SQL Connection pool that is..

I was out swimming in the data pool and I started thinking to myself, how many people are sharing the same pool without me even knowing they are there? How did I even get into the pool? And why is the water so cold?

Well, if you are using ADO.NET with SqlConnection , you are playing in the pool to. ADO.NET is a pretty smart animal. It realizes that if you are going to be connecting to a database a lot, then its probably a good idea to keep the connection to the database server open awhile. It does this behind the scenes, so when you create multiple data connections, it only really grabs one from the available pool of connections and uses those.

So….with that in mind, I started thinking about how I can tell what data connections an application has used and who is swimming in my pool. Coupling that with the brainstorming involved in .NET Illuminator, I came up with a very nice and simple piece of code that grabs all the connection strings from the Pool and throws them in rafts for you to see.

Why might this be handy for .NET Illuminator, well…Its always interesting to see what data connections an app has made and what the connection string is for them 🙂

Here is my simplistic example of using C# with .NET to walk the SQL pooled connections and return their connection strings.

         /// <summary>
        /// Loads all pooled connection strings.
        /// </summary>
        /// <returns></returns>
        public static List<string> LoadAllPooledConnectionStrings()
                SqlConnection connection = new SqlConnection();

                FieldInfo connectionFactory = connection.GetType().GetField("_connectionFactory", BindingFlags.GetField | BindingFlags.NonPublic | BindingFlags.Static);

                object cFactory = connectionFactory.GetValue(connection);
                FieldInfo connectionPoolDictionary = connectionFactory.FieldType.GetField("_connectionPoolGroups", BindingFlags.GetField | BindingFlags.NonPublic | BindingFlags.Instance);

                object dictPools = connectionPoolDictionary.GetValue(cFactory);

                Type poolDictionaryType = dictPools.GetType();
                PropertyInfo pooledKeys = poolDictionaryType.GetProperty("Keys", BindingFlags.Public | BindingFlags.Instance);

                object keys = pooledKeys.GetValue(dictPools, null);

                List<string> allKeys = new List<string>();
                foreach (object key in (IEnumerable)keys)
                return allKeys;
            }catch(Exception err)
                throw err;

So…What did we learn? Just because you don’t see the pool….smell the chlorine…or even get wet, you open a data connection and you have jumped all the way in.. and left your stench behind in the water..

Happy swimming!

System.Diagnostics.Stopwatch is no longer my friend….

So..I have been thinking for quite some time, “Gee, wouldn’t it be nice to have a nice and easy to use timer class built right into the framework?”. I decided to go and use the lovely Stopwatch class to start building a lot of timing routines into my applications for debugging and logging purposes. The syntax was so easy and beautiful.

var sw = new System.Diagnostics.Stopwatch()

Can’t get much simpler than that, right? Well…..that is if the stopwatch returned reliable results….

It seems on one our computers we run this code and a 23 second process returns 10.5 seconds…Yeah, same thing I thought.. What a bunch of crap!

So, I read something about Processor Affinity and CPU clock stepping that may be causing the issue. Either way, I don’t want to have to set the threads processor affinity or try and manage the CPU’s frequency just to take a simple time measurement……Back to the old

DateTime start = DateTime.Now();
TimeSpan elapsed = DateTime.Now() - start;

I know…not much difference, but didn’t the Stopwatch look so much cooler?

Do I need a shot because I am thinking of an Injection?

I began thinking more and more about writing an application that is able to “illuminate” another .NET process. Basically, I want to be able to inject some code into another .NET application and then provide the ability to see all of the user controls and Forms loaded in the application as objects that can be manipulated.

I am working on creating the application that will shove itself in there and let you see every active control and Form and let you manipulate the properties of them all realtime. Make the button active. Show the hidden panel. Change the text on a label for your own amusement.

It should be ready in the next few days, so stay tuned for .NET Illuminator…

Welcome welcome welcome

Welcome to the random musings and ramblings I have decided to grace the web with. I will be using this platform to help disseminate knowledge that I have picked up along the way as well as to keep a record of things I will probably forget.

Thanks for stoppping by and I hope to see you again soon.