Posts

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

Can you hear me NOW?!?!

My wife is very disgusted with our packet8 telephone. Part of the issues we're facing are that our Belkin router will block the outbound voice (thinking that it is a DOS attack). In the security log, there was this entry: 07/17/2006 18:35:57 **UDP Flood to Host** 192.168.1.10, 8006->> 209.247.23.73, 62602 (from WAN Outbound) So, thanks to a technical article I found, there is a support page that references this URL: http://192.168.1.1/firewall_spi_h.stm which allows you to turn off the "SPI and Anti-DoS firewall protection:" It should be easier to turn off a feature like this than an undocumented feature.