Posts

IBM x335 and Windows 2008 installation

I love the fact that IBM stops supporting its hardware long before Microsoft does; this means that lots of top-tier companies have to decommission their *somewhat* old hardware and you can pick up a server cheap (or free) to play with at home. It may mean, however, that your installation mileage may vary. Such has been the case for my IBM x335 (of which I have three). I've been on a quest to do an installation of Windows Server 2008 on said boxen. (plural of ox is oxen, plural of box is...) How fickle a lover are antique hardware and modern operating systems? How doest thou vex me, let me count the ways... Windows 2008 only comes on DVD while an IBM x335 has only a CD and will not boot from USB. Windows 2008 will not install from any sort of DOS utility disk. So Bart's Network boot disk is out, likewise a network boot to anything based on DOS. The IBM x335 has an internal IDE that is used by its CD Rom. You can crack the case and use an internal DVD drive from some other comput...

New cool tool

Oh, by the way, I have to give some credit to Notepad++ for that last post. The asp.net was HTML encoded using Notepad++ (TextFX TextFX Convert Encode HTML). I keep Notepad++ on a USB drive using PortableApps . It has lots of cool tools that are handy to keep with you or keep personal like KeyPass portable, but that's another post!

AJAX and IP Addresses

I realize you are disappointed, but the only clever title I could think of for IP Address reminded me of a stupid joke from kindergarten... Never the less. Here is a cool formula for a client-validated IP address using the AJAX Control Toolkit and asp.net. <asp:TextBox ID="TextBox1" runat="server" Text='<%# DataValue %>'></asp:TextBox> <cc1:MaskedEditExtender ID="MaskedEditExtender1" runat="server" TargetControlID="TextBox1" Mask="NNNNNNNNNNNNNNN" MaskType="None" ClearMaskOnLostFocus="true" Filtered=". " PromptCharacter="" /> <cc1:MaskedEditValidator ID="MaskedEditValidator1" runat="server" ControlToValidate="TextBox1" InvalidValueMessage="IP Address required (192.168.1.1)" ControlExtender="MaskedEditExtender1" ValidationExpression="^([01]?\d\d?2[0-4]\d25[0-5])\.([01]?\d\d?2[0-4]\d25[0-5])\.([01]?\d...

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...

Does this dress make me look fat?

Here's a nice little bit of code that can be used to dynamically theme a website that has multiple domains at the same site. using System; using System.Collections.Generic; using System.Text; using System.Web; using System.Web.UI; namespace URLThemeHandler { public class ThemeHandler : IHttpModule { #region IHttpModule Members public void Dispose() { } public void Init(HttpApplication context) { context.PreRequestHandlerExecute += new EventHandler(context_PreRequestHandlerExecute); } void context_PreRequestHandlerExecute(object sender, EventArgs e) { HttpContext currentContext = HttpContext.Current; if (!(currentContext.Handler is System.Web.UI.Page)) return; System.Web.UI.Page myPage = currentContext.Handler as System.Web.UI.Page; string strHost = currentContext.Request.Url.Host; if(ThemeExists(strHost)) myPage.Theme = strHost; } bool ThemeExists(string theme) { string strPath = HttpContext.Current.Server.MapPath("~/App_Themes/" + theme); return System.IO.Directory...