Load XML into List Collection

I needed the ability to load a XML file into a selectable list. The problem was really two fold, I had a collection of DAT files (like a single column CSV file) that I needed to first convert to XML (I had another existing collection of XML files, yea I know "consistency, consistency, consistency") as well.ScreenShot014

So I can up with a simple couple of utility methods to convert a single column CSV file (herein referred to as a DAT file) to an XML and then another method to take a XML file and return a list collection. This allows me to first convert the DAT and then load the collection into a ComboBox. 

At first I was worried about performance of reading from the XML files, but then I realized we are talking about a collection of strings around the order of 100. This loads using the XMLTextReader class in about 2/10 of a second. I think that is performance I can live with.

This method takes a plurized DAT file (much like the RoR MVC style) and creates a simple XML (that includes the root attributes that the partner XML read method expects). An example would be using a DAT file name ‘colors.dat’ it would make a XML file with ‘colors’ root node and then a collection of ‘color’ nodes with a single element named ‘name’ that contains the value of each DAT file.

Example DAT file (just for clarity):

Method to convert the DAT to a XML file:

 

Now the method to take the newly created XML file and load it into a List<string> collection:

Bit of info on the options:

  • The "displayMember" is the value of the element name to use for the string value (defaults to "name").
  • The "sortList" option is a bool that indicates if the list should be sorted before it is returned.
  • The "includeAll" option is a string value that will be put at the top of the list. Like "- All" or "* Select All *".
  • The "includeEmpty" option is a bool that (if set "true") sets the option to include empty DAT file entries in the string collection.

So put together like this:

Awesome stuff. Super simple and very fast. I loaded up the entire US Zipcode collection in .223 seconds and then put that into a ComboBox in 2.9 seconds. I realize most people are not going to have 40,000 entries in a selectable ComboBox, my point is that it is zooming fast.

Enjoy!

Linux Mint, AMD 3850 and 1680×1050 Working!

About a month ago I picked up the ATI 3850 video card thinking it would be significant performance upgrade from my Nvidia 7950GT – it was. However, I was seriously dismayed to see the state of video drivers from ATI – in particular in comparison to the Nvidia driver. My LinuxMint Desktop glory!

Anyhow, so I started the fight. The fight to get my ATI 3850 card to drive my Viewsonic VG2230wm at 1680×1050@60. I tried several of the binary ATI drivers but finally got the 8.01 (the kernel version is 8.45.4, the driver is labeled 8.01 and the ATI website says it’s version 8.1 !? -man is that confusing) driver to work. Simple to install; Download the binary, then from a command line just execute the file as root.

Here is my relevant xorg.conf sections:

Enjoy!

Google Chart C# API

I was playing around with the excellent Google Chart API and I wanted to illustrate just how crazy simple it is to ScreenShot013implement this, even on a WinForm app (see nifty screen capture ->).

First grab the Google C# API Wrapper source code. Then take and unzip that and open that project in Visual Studio and compile the DLL. Then add a new Windows Application Project to the solution, drag a new PictureBox on the form, and then paste this into Form1.cs:

Dell Latitude c840 + Ubuntu + Restricted Nvidia == blankScreen;

I picked up a nifty Dell Latitude c840 notebook on Ebay for around $185, nice. So I get it and decide to setup Linux Mint (based on Ubuntu 7.10). After the install completes I then have the bright idea to setup the restricted drivers to get the 3D acceleration working (so I can play with Compiz later) and find that I am presented with a lovely black screen after reboot.

yay! black screen of nothing! yay!

So I troll around on the net and discover it’s some sort of problem with the Nvidia NV17 (GeForce4 440 Go) chip and the way the EDID‘s work on the Samsung 1600×1200 LCD, or somesuch silliness.

Anyhow to make it work( read = "I would like to actually see the screen!") reboot and select the "recovery mode" kernel and then do this:

Save file, reboot and click on my Google ads 😉

Enjoy!