Visual Studio 2005 can do directory based search

One of the features I thought was lost in Visual Studio 2005, directory/file based searches, is not!

When you bring up Files In Files (Ctrl+Shift+F, Edit.FindinFiles) you can type in the path straight

Find_In_Files
Find_In_Files

Or you can click on the Epsilon button at the side and select many directories.

Folder_Choosing
Folder_Choosing

Look you can even have named sets.

I take back all those bad word I said about you Microsoft. Well maybe I leave some the table, because it has taken me so long to re-find one of my favorite features.

SleepyQueue

I discovered in my Curse of the Azure Bonds port that I was handling system interrupts related to keyboard input incorrectly. What I needed was a blocking getKey function when keys were buffered. So I wrote some code to solve this using lock and a semaphore. Today I rewrote it into a generic class. Here it is:

public class SleepyQueue
{
  Queue queue;
  Semaphore semaphore;

  public SleepyQueue()
  {
    queue = new Queue();
    semaphore = new Semaphore(0, 1);
  }

  public void Enqueue(T t)
  {
    lock (queue)
    {
      queue.Enqueue(t);
      if (queue.Count == 1)
      {
        semaphore.Release();
      }
    }
  }

  public T Dequeue()
  {
    T item;
    semaphore.WaitOne();
    lock (queue)
    {
      item = queue.Dequeue();
      if (queue.Count > 0)
      {
        semaphore.Release();
      }
    }

    return item;
  }
}

This can be used like so

static void Main(string[] args)
{
  SleepyQueue<int> q = new SleepyQueue<int>();

  q.Enqueue(1);
  q.Enqueue(2);
  q.Enqueue(3);

  Timer t = new Timer(CallBack, q, 3000, 3000);

  while (true)
  {
    Console.WriteLine(q.Dequeue());
  }
}

static void CallBack(object state)
{
  SleepyQueue<int> q = (SleepyQueue<int>)state;
  q.Enqueue(System.DateTime.UtcNow.Second);
}

Then this morning our new developer was asking how to use IEnumerable<> to loops across a queue of objects, and it was the same lock/semaphore type problem.

I started modifying my generic class so I could post the code, but it got nasty quite quickly, so I’ll just pass for now, and work on getting our code correct…

Moving from Visual Source Safe to Subversion

Last year we moved our current development repository from Visual Source Safe to Subversion. At a previous .Net Architecture Chat we talked about this process.

So here is the python script and DOS .bat file used to do our conversion.

This conversion only extracts the history for the current live tree. This is useful when you want to change going forward, but don’t need the complexity (and problems) or trying to move your complete history. You can add sub-path exclusions, and it may take a few iterations to get the result you want. ie Identify the dead code paths, and not included them in your new code tree.

I have been using these scripts the last few days to convert another teams repository. Their VSS repository was large (>1Mloc) and the Python run-time was crashing so I had to reduced the size of the repository been moved in one go. I decided to separate out the Libraries sub-directory, as this was large, but the changes do not really need to be in the same atomic check-ins as the main code base. Running the script over the weekend resulted in success (all be it a 10 ½ hour success).

You can merge many dump files into the same repository using svnadmin, so this can consolidate your repositories if they are fragmented like ours were.

Re: Why are Open Source People So Fanatical?

Peter Jones asked why are open source people so fanatical? and I think there are a number of reasons. So I’m going to enumerate them here.

The first is regarding compiling the kernel. This is seen as a guaranty, if things go wrong I can fix it. This plays on the idealism of youth, in which you have large amounts of time to track down and fix the problem, and the idea of I could if I wanted to! Examples of where this comes into play are getting a driver to piece of hardware X to run of older system Y. In the windows world if your driver does not work for new OS or visa-versa you are out of luck. You have to pay to upgrade. Where-as if it’s all open source you can just spend time porting the driver. Then share and save others time/money. The flip side is valuing your time more than your money, and just buying a new PC, or new Component or new OS so stuff just works.

The another concept I can think of is OSS vs. Microsoft is along the Alt.Net vs. MS.Net argument, where MS doesn’t embrace / leverage development tools and has to write it’s own. Often to the disdain of the Alt.Net crowd as they feel sidelined by MS and/or that MS has missed the point. It’s understandable that MS does what they do, but that’s because they are a commercial company. They build developer tools to push their platforms not tools for the sake of tools.

The last idea is, OSS is an idealistic stance, and people who have idealistic stances have an emotional attachment to that opinion, and therefore behave fanatical when their position is attacked. Just like religion really.

Wii Flash Games

Well I have just upgraded my Wii (I assume too System 3) and the best flash game ever! Desktop Tower Defense is better, but still marginal. Version 1.5 is just blank after the splash screens, version 1.2 shows the towers, shots, health bars of the creeps and the desktop. version 1.1 you can also see the border of the game area. Playing without a keyboard is painful, so it is only really useful if you need a fix, to tied you over till you get on a real browser next.

Desktop Tower Defense on the Wii
Desktop Tower Defense on the Wii

See no text, no creeps, hmm where is that sell button…

I then resorted to Googling for Wii Flash games and viewing lots of terrible sites, but did find wiicade.com, and it is setup really nicely for the Wii screen size. The most enjoyable game there was Missile 3D by DX interactive. I liked the faux 3D and hand drawn look.

But there is only so much fun that can be had from a point and click only interface.

I wish the Wii/Opera browser had a Silverlight client, then I could develop and not just complain. Well at least try.

Remote connection to Oracle 10g Express via ODBC

For some strange reason the Oracle 10g Express installation will not run the configuration web client for me but it works all fine for the testing folks. But it installs happily in a virtual PC, and it runs/configures just fine.

Now to connect from my PC I need some client stuff. On the Oracle 10g Express page it has a client download, which you would think would do the business. But does not. The current approach in the office is to install the complete Express server and just ignore the server parts. That idea stinks, so with some help from a co-worker I got the correct option work.

Install the Instant Client, for ODBC (god bless VB6.0 applications) you need to:

  1. Download the Instant Client Package - Basic and Instant Client Package - ODBC

  2. unzip them to C:\\Oracle\ and the will make a instantclient_10_2 subdirectory. The resulting directory C:\\Oracle\\instantclient_10_2 will be referred to as <dir> from now on.

  3. run <dir>\\odbc_install.exe

  4. create a file in <dir> called tnsnames.ora with the contents:

     Name Of TNS =
     (DESCRIPTION =
     (ADDRESS = (PROTOCOL = TCP)(HOST = your_server_name)(PORT = 1521))
     (CONNECT_DATA =
     (SERVER = DEDICATED)
     (SERVICE_NAME = XE)
     )
     )
    

    replacing your_server_name with the name/ip address of you remote server. You can name you TNS with a sensible name by replacing Name Of TNS

  5. Add <dir> to the PATH environment variable

  6. Add new environment variable TNS_ADMIN with value <dir>

  7. Now you can use the Data Source (ODBC) tool to setup the DSN like via the Oracle in instantclient 10_2 Driver

Done!

Updated: Changed the naming the TNS part to be correct.

Windows Live Spaces got too Social

Dare recently posted about the great new social features that Windows Live Spaces has deployed. I think they are good features, the problem is Live Spaces has changed into a mini FaceBook (well I think I’ve not been there) or MySpaces to compete with that Gen Y crowd. But there was no options to not get these “upgrades” and the tool became more of what I didn’t want it.

My core problem is that the people in my Windows Live Messenger contact list are not the targets of my blogging at all. So all these new ways to interact with my WLM contacts added zero value, and a lot of screen clutter.

I already have a RSS feed reader that I love, and when the few of my WLM contacts update their blogs I know about it. All the contact auto management features seem like some form of Plaxo (that I’m not using any more). The friends lists seem to be some from of LinkedIn/FaceBook. Not interested.

Someone (in my feed list) was remarking about how the A-List blogger’s are behind the times (in regards to FaceBook etc) and not trying to A-List myself, but I think I’m even more behind the times, so much so I’m just plain not interested.

I think Jeff Atwood summed it up best when he said own your presence on the Internet (can’t find post) and that is what I want. I’m here, I’ve got stuff to contribute. It’s just here on my domain. It’s there to find via Google and that’s the way I like it. What’s more I am prepared to pay for that privilege of control.