Debugging with Mole for Visual Studio 2005/2008

By the way... If you are into .NET development and use Visual Studio 2005/2008 you should give mole a try. It's a very nice debug visualizer for various datatypes. For instance you can easily navigate through the structure of a DataTable:

MoleVisualizer: Mole Visualizer for Visual Studio - Happy Debugging!MoleVisualizer: Mole Visualizer for Visual Studio - Happy Debugging!

head over to http://karlshifflett.wordpress.com/mole-for-visual-studio/ and check it out!

How to access Excel files via ADO.NET

The C# snippet below will dump ALL sheets of a given Excel file (c:\test.xls) onto the console. It took me a while to figure out how to access sheets within a Excel file which names I don't know - so here it is:

  1. String connectionString =
  2. "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\test.xls;Extended Properties=\"Excel 8.0;HDR=YES;\"";
  3. DbProviderFactory factory = DbProviderFactories.GetFactory("System.Data.OleDb");
  4. try
  5. {
  6. using (OleDbConnection connection = new OleDbConnection(connectionString))
  7. {
  8. connection.Open();
  9. DataRowCollection rows = connection.GetSchema("Tables").Rows;
  10. foreach (DataRow row in rows)
  11. {
  12. string sheetName = row["TABLE_NAME"] as string;
  13. Console.WriteLine("************************************************************************");
  14. Console.WriteLine("Dumping Sheet: "+sheetName);
  15. Console.WriteLine("************************************************************************");
  16. using (DbCommand command = connection.CreateCommand())
  17. {
  18. string[] restrictions = { null, null, sheetName, null };
  19. DataRowCollection columns = connection.GetSchema("Columns", restrictions).Rows;
  20. string[] columnNames = new string[columns.Count];
  21. for (int i=0; i<columns.Count; i++)
  22. {
  23. columnNames[i] = columns[i]["COLUMN_NAME"] as string;
  24. }
  25. Console.Write("Columns in Sheet: ");
  26. foreach (string s in columnNames)
  27. {
  28. Console.Write(s);
  29. Console.Write(" ");
  30. }
  31. Console.WriteLine("");
  32.  
  33. command.CommandText = "SELECT * from [" + sheetName + "]";
  34. using (DbDataReader dr = command.ExecuteReader())
  35. {
  36. while (dr.Read())
  37. {
  38. foreach (string columnName in columnNames)
  39. {
  40. Object fieldValue = dr[columnName];
  41. Console.WriteLine("'" + columnName + "' : " + "'" + fieldValue + "'");
  42. }
  43. Console.WriteLine("------------------------------------------------------------------------");
  44. }
  45. }
  46. }
  47. }
  48. }
  49. }
  50. catch (Exception e)
  51. {
  52. Console.Write(e.StackTrace);
  53. }

To be honest - I did not expect it to be that easy. I guess I spent too much time developing Java applications.

Speedup Windows Shares Access for Vista

At least for me it did a marvelous job:

  1. netsh interface tcp set global autotuninglevel=disabled

Accessing Windows Shares from my Vista machine works damn fast now. The shares are either located on a Win2003 Server (LAN) or on another vista machine connected via VPN. The browsing performance via VPN was never that fast!

Separated at Birth?

Separated at Birth?

Red Ring Of Death - Welcome to the Club

FUCK!

Red Ring Of Death: borkedRed Ring Of Death: borked

XEN: Bridged Network Routing Issues

My current XEN installation has some unconventional setup. On my new root server I have to use routed network setup / script since I need to provide the default gateway for my assigned subnet to my XEN guests by myown.

In a common scenario, where each guest gets his own Public IP, this might not be a problem. In my case there was a need for a secondary private network where I would add proxied hosts (i.e. one for java applications proxied by apache).

Unfortunately the network scripts shipped with XEN 3.1.0 does not provide any out of the box support for such setup. So here is what I have hacked:

  • dom-0 gets a eth0:1 NIC alias set to 192.168.1.1
  • dom-u gets eth0 with a public IP and eth1: a private one like 192.168.1.100 (it's very important to include both of the ip addresses in the guest-configuration file!)

to enable routing you need to patch the vif-route script in order to get your private network routed properly.

Replace:

  1. if [ "${ip}" ] ; then
  2. for addr in ${ip} ; do
  3. ${cmdprefix} ip route ${ipcmd} ${addr} dev ${vif} src ${main_ip}
  4. done
  5. fi

With:

  1. if [ "${ip}" ] ; then
  2. for addr in ${ip} ; do
  3.  
  4. base=${ip:0:3}
  5. route_ip=${main_ip}
  6.  
  7. if [ "$base" = "192" ]
  8. then
  9. echo "private ip detected, ${ip}" >> /xen-debug
  10. route_ip="192.168.1.1"
  11. else
  12. echo "public ip detected, ${ip}" >> /xen-debug
  13. fi
  14.  
  15. ${cmdprefix} ip route ${ipcmd} ${addr} dev ${vif} src ${route_ip}
  16. echo "${cmdprefix} ip route ${ipcmd} ${addr} dev ${vif} src ${route_ip}" >> /xen-debug
  17. done
  18. fi

Not pretty, but it will do. The hardcoded eth0:1 IP address could be obtained from the ifconfig / IP output.

XEN on 32 Bit with 8 GB Ram Odyssey

Last week I've ordered a new shiny root server at hetzner. A nice 8gb Server begging me to install XEN on its virgin 750GB Raid HD. Hell yeah, but wait, I need to run 32 Bit XEN-Guests on that one. After a quick glance at the current Debian XEN packages I decided not to install the 64 bit variant of Debian as the Domain-0. Unfortunately Debian is still stuck at 3.0.x which doesn't allow 32-on-64 setups (which I have found no documentation for anyway).

Ok, 32 bit it is. To my very disappointment I had to discover the lack of PAE extensions in the XEN-Kernel. But why-o-why is the hypervisor package flagged with PAE extensions but not the kernel? So, what now? One option has been to go with a XEN Setup from the sources. For obvious reasons I'd rather like to have a distribution run solely on official stable packages.

I’ve always wanted to take a look at Debian's younger brother - Ubuntu. Thank god Hetzner did offer easy and convenient image-base setup for various Linux distributions, including Ubuntu 7.10. Setup and first XEN steps went like a breeze. Soon I have found myself running XEN on 32 Bit with full PAE support being able to address all of my tiny little ram bits. YAY!

Time to migrate some XEN-U guests to the new machine. Fortunately the old server was also located at the same collocation center, so the copy process did not take too long. The fun did not last any longer though. The very first boot of the guest OS resulted in a frozen console. No login. WTF!? After fiddling with various Kernel options and googling myself into madness I have found some very interesting facts.

Amazon Delivery

Wow!

That was quite fast

 Winter Games 2007Winter Games 2007

Ready, Steady, GO!

Winter Games

Woohoo... this winter is going to be *hot*

Just placed my Order over at amazon.co.uk for quite a few games for this winter season:

  • Hellgate London
  • Assassins Creed
  • Call of Duty 4
  • Timeshift
  • Crysis
  • Ratchet and Clan: Tools of Destruction
I have still Blue Dragon to finish first though. So many games, so little time!
Syndicate content