Udf Oddities

I have been experiencing some wierd udf behaviour.
I have a udf that takes 7.5 mins to run.  The sql inside the udf runs in < 1s.
Run the query under index tuning wizard and it suggests a very odd index.
Adding the index gets the time for both down to < 1s.

I have a second udf that is not as condusive to the index tuning wizard.

 

Dynamic Type Loading

Here is a very simple sample of dynamic type loading:

==== LoadLibrary.cs ==== 

using System;
using System.Reflection;

namespace LoadLibrary
{
    class Program
    {
        static void Main(string[] args)
        {
            Assembly ass = Assembly.LoadFile(AppDomain.CurrentDomain.BaseDirectory
                + @”.SimpleLib.dll”);
            Type type = ass.GetType(“SimpleLib.SimpleClass”);
            object newInstance = Activator.CreateInstance(type);
            Console.WriteLine(newInstance);
            Console.ReadLine();
        }
    }
}

=== SimpleClass.cs ===

namespace SimpleLib
{
    public class SimpleClass
    {
        public override string ToString()
        {
            return “I am a simple class”;
        }
    }
}

 

Build simple class into SimpleLib.dll

Build LoadLibrary into LoadLibrary.exe

Put SimpleLib.dll into the same directory as LoadLibrary.

 

Lightweight Ruby Webserver to list podcasts

Once you get your head around ruby constructs the following was easy to write:

As a benefit it actually displays properly…

require ‘socket’

def latest3podcasts(session, podcast)
session.print “


  • Dir.glob(podcast)[-3..-1].each {|x| session.print “
  • #{x}
  • ” }
    session.print “

rn”
end

port = 8080.to_i
server = TCPServer.new(‘serveraddress’,port)
while (session = server.accept)
puts “Request: #{session.gets}”
session.print “HTTP/1.1 200/OKrnContent-type: text/htmlrnrn”
session.print “”
latest3podcasts(session, “/storage/podcast/dotnetrocks/*.mp3”)
latest3podcasts(session, “/storage/podcast/hanselminutes/*.mp3”)
latest3podcasts(session, “/storage/podcast/polymorphicpodcast/*.mp3”)
session.print “rn”
session.close
end

Talk Talk Customer Support Hell

A non-technical friend of mine asked me to help her with a problem with her Talk Talk broadband.

Due to various confusions at the Talk Talk end she had three of their modems available.

I went through all of the usual drills involved in setting up the modem. I reentered the username and password, I looked at the connection details and even ran the diagnostics utility (it reported an authentication problem).  The computer could access the modem, the modem could read the adsl status, but it would go no further.  There were no external connections being made.

The next step was to call the helpdesk.  The first try consisted of waiting against piped music and was then disconnected.

The second call got me through to a helpdesk operator who went through her script (ingnoring the fact that I had diagnostic information that should have been of use).  The script forces the use of IE under Windows 2000.  After 20 mins I was told I was being passed to 2nd line support.  The line then disconnected.

The third call got through to another individual who insisted on going through the entire script again. He did not notice that I was able to predict the next step. 20 mins later (including a pointless reboot of a slow laptop) I was eventually passed to second line support.  Answering exactly the same questions about the lights on the modem to this individual he determined that the modem was broken (it was clearly accessing the ADSL line, but he ignored that). I am now awaiting the arrival of the new modem so I can go and set it up again.