Posts

Showing posts from 2007

Expand your mind

The only hassle of working with Virtual Machines is being omniscient: how in the world am I supposed to know how big to make the virtual drive when I don't know what stuff I'm going to install on the machine? Solution: VMWare Converter This little beauty non only lets you convert physical machines to VMs, or Microsoft VMs to VMWare VMs, it also lets you convert VMWare VM's to another version and resize the disk along the way! sweet!

If I could get connected, I could tell who you are

Playing with Visual Studio 2008, .net 3.5 and SQL Linq today and decided to make the thing a real application. That means using a membership database. I really like using sql express for development (and deployment) of little applications. It's a shame that my hosting provider doesn't let you use an express database, but I digress... Anyway, how do you go about creating membership in an existing database... You twiddle with the command line parameters until you figure out that this is how: aspnet_regsql -A all -C "Data Source=.\SQLEXPRESS;Integrated Security=True;User Instance=True" -d "C:\MyProject\APP_DATA\aspnetdb.mdf"

You've been very helpful, can you just go away now.

Sometimes when dealing with a typed dataset (a good idea) you have a problem with constraints, or with nullable fields, or with other stuff. Microsoft gives you a less-than-helpful exception that says "Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints." Right... Well, if you use: ds.EnforceConstraints = false; then you can call this method which will output the table, row, column, and exact constraint that was violated. public void GetDataSetErrors(DataSet ds){ try { ds.EnforceConstraints = true; } catch(Exception ex) { foreach (DataTable table in ds.Tables) { foreach (DataRow row in table.GetErrors()){ System.Diagnostics.Trace.WriteLine("Table: "+ table.TableName); System.Diagnostics.Trace.WriteLine(ex.Message ); System.Diagnostics.Trace.WriteLine("Row: " +row.RowError); foreach (DataColumn col in row.GetColumnsInError()) { System.Diagnostics.Trace.WriteLine("Column " + col.Colum