Monday, December 31, 2007

Due to popular demand I (finally) got around to updating my Regular Expression Assembly Builder Tool.  If you're not familiar with it, you can read more about it and its history here and here, but suffice it to say, it's a handy little utility that compiles regular expressions into their own assembly (dll).  There is a lot of power behind this, not the least of which is that you can effectively pre-compile your regular expressions for your application and gain some performance improvements.  You can read more about it in my aforementioned posts.

The updates to the utility include the following:

  • NEW: Upgraded to version 2.0.0.0.
  • NEW: Upgraded to VS.NET 2008, .NET 3.5.
  • UPD: Added resizability to regex dialog, supporting a larger text field for regex entry, line breaks, tabs (with a tabstop of 3), etc.
  • NEW: Added scrollability to editor panels rather than not at all.
  • NEW: Added support for a command-line-specified DLL to load.
  • NEW: Added support for hierarchical (namespace) representation of regular expressions.
  • UPD: Context menus add regular expressions to the hierarchy based on the user's selection.
  • FIX: Fixed issue involving the various RegexOptions checkboxes where an invalid configuration of options could be selected (particularly involving ECMAScript, Multiline, and Singleline.

So, apart from some nicer UI interactions than in previous versions, this version most notably includes

  1. Organization of your regular expressions my namespace.
  2. Alphabetical listing of regular expressions.
  3. The ability to provide an argument on the command-line designating the DLL to load.

Let me know what you like and/or don't like about it and I'll see what I can do to improve it for you!

Download it here

Enjoy!

Monday, December 31, 2007 5:03:00 AM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Monday, December 24, 2007

I was working with a customer today that, after upgrading to the latest version of our software, was running into an error that I had never seen before.  The product, as you may be aware, is a web-based Product Configurator for Microsoft CRM.  Historically, our upgrades have been very clean and easy, but today the customer received the following error message when attempting to launch the application:

The file or directory is corrupted and unreadable.

The error was occurring at launch (during the initialization of ASP.NET) and was caused by an IOException.  Inspecting the call stack it was apparent that it was happening during the System.Web.HttpRuntime.FirstRequestInit() method while loading the assemblies from the \bin folder (System.Web.HttpRuntime.PreloadAssembliesFromBin() method).

My first thought was that something security-wise was amiss.  So, via Windows Explorer, we inspected the security properties on the folder for the website.  Sure enough, some credentials were messed up so we fixed those; but the application continued to fail with the same error.

Something in the back of my mind told me it was still security related.  After considering it a bit the answer was obvious.  We proceeded to open \Windows\Microsoft.NET\Framework\vX.X.X\Temporary ASP.NET Files to the folder for the application.  Upon drilling down the folder tree Windows reported the exact same error.

To fix it, all we had to do was fix the security settings on the folder, perform a CHKDSK, and delete the application's folder in the \Temporary ASP.NET Files folder.  After that, everything ran beautifully.

Monday, December 24, 2007 9:07:00 AM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [1]  |  Trackback
 Wednesday, December 19, 2007

As you're probably already aware, Microsoft recently RTM'd Visual Studio 2008.  Well, I had a moment to come up for air the other day and decided it was time to upgrade my machine to this newest encarnation.  I must say that the installation was probably one of the easiest I've ever done.  The product installed very smoothly without even a hiccup.  Also, much to my delight, ReSharper 3.0 continues to work flawlessly with VS2008! :-)

Having played around with the Beta and CTP versions of VS2008 I was very excited to move onto the released version.  It's flat out awesome!

Highly recommended!

Wednesday, December 19, 2007 2:47:00 AM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [2]  |  Trackback
 Thursday, December 06, 2007

As a special treat this year my company was kind enough to bequeath me a copy of Adobe Creative Suite 3: Master Collection.  I've been giddy with delight as I'm a long time user of both Photoshop and Illustrator and absolutely swear by the products.  I've had it sitting on my desk here for a few days and just tonight am getting the opportunity to install it.

Of course, as with most everything, things don't always go according to plan.  Not two seconds after starting to install, I was greeted with the most pleasant and informative error message and the setup aborted:

Setup has encountered an error and cannot continue.  Contact Adobe Customer Support for assistance.

Internal Error 2739

Though slightly disheartened, I sought a resolution on Adobe's site and didn't find anything.  However, after a single search on everyone's favorite search engine I found a resolution.  Though the solution is simple (regsvr32 jscript.dll) I would have never guessed it.  Thanks, Gopinath M for the great tech tip!

Thursday, December 06, 2007 11:04:00 AM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Monday, November 26, 2007

I have a website that I created that uses an ASP.NET Login control to assist in user authentication on the site.  I've used the Login control on other sites and it's provides a very convenient mechanism for authenticating a user.  On this site particular site I have the Login control contained within a wrapper control (which I called LoginBox).  Due to the nature of this site, the LoginBox does not exist on the page in the ASP.NET HTML markup but rather is added to the page dynamically.  As such I don't have the convenience of editing the HTML markup of the asp:Login control directly but must interact with it programmatically.

The Login control provides several properties through which I can achieve a nice look and feel.  It contains child controls for the title, labels, textboxes, required field validators, checkboxes, and buttons.  Each of these can be customized via CSS styles or by directly assigning values to the controls' properties.

In this particular site I needed to extend the appearance of the control, adding some textboxes to the control.  At first this wasn't very intuitive, but I'll show you that it is, in fact, quite easy to achieve.  You can easily add fields to the control (e.g., a 'verify password' field, an 'email' field, a CAPTCHA control, etc) by customizing the LayoutTemplate of the Login control.

Were I to have had the control in the HTML markup of my page this would be a piece of cake.  Note, via the designer, you can simply click the Login control's smart tag and click “Convert to Template“ or create it manually:

<asp:Login runat="server" id="login">
  <LayoutTemplate>
    <!-- HTML template here -->
  </LayoutTemplate>
</asp:Login>

However, as the control is being generated entirely in code, the template must be created programmatically.  As a bare minimum, you need two controls in your template that implement the ITextControl interface for the control to render; otherwise, you'll get an exception (TextBoxes will suffice or any control you create that implements that interface).  These controls are UserName and Password.  I recommend adding the login button as well (Button, LinkButton, or ImageButton) with a CommandName set to “Login“.  Using a template, you can fully customize the look and feel of the output.  Note, that when you go the route of creating a custom template, you are solely responsible for the output.  In other words, you're completely replacing the output that the Login control generates; if you want field validators, you need to add them.

// somewhere in the page (e.g., Page.Init)
Login login = new Login();
login.LayoutTemplate = new LoginTemplate();
Controls.Add(login);

internal class LoginTemplate : ITemplate {
  public void InstantiateIn(Control container) {
    TextBox txtUserName = new TextBox();
    txtUserName.ID = "UserName";
    container.Controls.Add(txtUserName);

    TextBox txtPassword = new TextBox();
    txtPassword.ID = "Password";
    container.Controls.Add(txtPassword);

    ImageButton btnLogin = new ImageButton();
    btnLogin.ID = "LoginButton";
    btnLogin.ImageUrl = "~/images/LoginButton.gif";
    btnLogin.CommandName = "Login";
    container.Controls.Add(btnLogin);
  }
}

With this, I have an extremely boring-looking Login control, but you get the idea.

When the page is posted back, you can easily retrieve the contents of any control you added to the template by calling the .FindControl() method, referencing it by name:

string emailAddress = ( ( TextBox )login.FindControl("txtEmail") ).Text;

Monday, November 26, 2007 3:36:00 PM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [3]  |  Trackback
 Saturday, November 03, 2007

I had the opportunity to present at the Utah Code Camp today on the topic of Regular Expressions.  This topic is near and dear to my heart, but (being my worst critic) I feel that I couldn't get my act together.  In part I feel that the presentation went very poorly; it was definitely among my worst.  I felt my explanations lacking, incomplete, or erroneous, my examples unsuccessful or poor, and my 'togetherness' absent.  It was a very far cry from a similar presentation I had given back in Sept 2006 to the Utah .NET User Group which was among my best I feel.  That made it all the more disappointing for me.

I guess on the positive side I've updated my RegexTester application and it's available for download here.  Thanks to all that came and participated.  We had a great turnout to the event so that was very positive.  I just wish my presentation hadn't ruined my day...it's been lousy ever since.  I guess you can't win them all.

Saturday, November 03, 2007 1:54:00 PM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [3]  |  Trackback
 Wednesday, October 31, 2007

Please join us at the Utah Fall Code Camp this coming Saturday, November 3rd, 2007.  This event is going to be excellent!  Come check out the site, register, browse the schedule and more.  Here's the official announcement:

Utah Fall Code Camp

Nov 3rd 2007

Neumont University

Salt Lake City, UT

www.utcodecamp.com

 

The local Users Group Community is conducting a “Code Camp” for local software programmers at Neumont University. This Camp is Free to all.

 

We have a diverse topic range for this code camp. You can see the full list of sessions and speakers at www.utcodecamp.com We will be giving away at least one IPOD, software, Shirts, Books and Lunch and Breakfast will be provided. 

 

You will need to register on the site to be eligible for some giveaways so you need to go register now at www.utcodecamp.com if you haven’t already. If you registered on www.msutahevents.com you will need to re-register at the code camp site.

Wednesday, October 31, 2007 7:08:00 AM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Friday, October 19, 2007

If you're developing ASP.NET applications on Windows Vista that are utilizing the Visual Studio-provided web server (a.k.a., Cassini) then you may have run into an issue where, when attempting to debug your website, Visual Studio immediately drops out of debugging once your application starts.  That is, you press F5, the browser pops up and displays the website and Visual Studio stops debugging and drops back into its standard development mode and the browser continues on running.  Your breakpoints are no longer active and you essentially can't utilize your development environment to troubleshoot issues with the site.

This has been happening to me of late.  I don't usually use the debugger in that sense to 'walk through' my code for a variety of reasons, but tonight I needed to.  Sure, I could attach to the process (WebDev.WebServer.exe), but that's a pain and I get tired of constantly attaching and detaching.

The culprit in my case was that http://localhost was in my Local Intranet zone in IE and, using IE 7 and Vista, I'm not authorized to debug intranet sites.  The solution is an easy one: move http://localhost to the Trusted Sites list in Internet Explorer.  Now the debugger attaches and remains attached, greatly simplifying the debugging process.

Friday, October 19, 2007 4:45:00 PM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [12]  |  Trackback

Thanks to everyone that came out to the Utah .NET User Group lunch today at Olive Garden.  We had a great turnout and a great time.  I think in the future we'll be holding the lunch around I-15 and I-215 as it's a major intersection and a great place to gather.  Any time we've attempted to hold the lunch elsewhere has resulted in just a small handful of people (3-4) whereas all of our lunches in the Fashion Place area have resulted in 10+ (today we had 14 if I recall).

Anyway, it was great to see everyone and we'll be doing it again in the future - maybe at the new Cheesecake Factory that opens next month...we'll keep everyone posted.

Friday, October 19, 2007 7:17:00 AM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |  Trackback