Jeff Widmer's Blog

ASP.NET, ASP.NET MVC, C#, VB.NET, IIS7, Windows Forms, VB6, ASP 3.0

  • StackOverflow Stickers

    I got my StackOverflow, ServerFault, SuperUser, and How-To Geek stickers from Jeff Atwood yesterday (In stickers We Trust).  They are really nice looking.

    IMG_7645

    In case you have not heard of StackOverflow it is the most awesome question and answer site (100% free!) for developer related questions.  ServerFault is for sysadmin questions and SuperUser is for general computer questions that really do not fit into the other two sites.  How-To Geek is a partner of all three.

    Now I have to go talk to my wife about putting these on the bumper of the car… she’s got her MOPS sticker there, so why not StackOverflow too?!?

     

    Technorati Tags:
  • Credit Card Expiration Date DropDownList Sample Code

    The other day I needed to create a credit card input form including the drop down lists for the credit card expiration month and year.  I started to write the code to populate the month and year drop down lists and I wanted to make them dynamic so that whatever the year was it would add an appropriate number of list items.  But as I started thinking about how to structure the code, I figured that this has been written probably thousands of times by other developers so I would just Google for it.  To my surprise, I was unable to pull back any sample code for my various search terms.  In the end I had to write it myself but now I am posting it on my blog so that others my benefit from my hard work.  :)

    //Populate the credit card expiration month drop down
    for (int i = 1; i <= 12; i++)
    {
        DateTime month = new DateTime(2000, i, 1);
        ListItem li = new ListItem(month.ToString("MMM (M)"), month.ToString("MM"));
        ExpirationDateMonthDropDown.Items.Add(li);
    }
    ExpirationDateMonthDropDown.Items[0].Selected = true;

    //Populate the credit card expiration year drop down (go out 12 years) 
    for (int i = 0; i <= 11; i++)
    {
        String year = (DateTime.Today.Year + i).ToString();
        ListItem li = new ListItem(year, year);
        ExpirationDateYearDropDown.Items.Add(li);
    }
    ExpirationDateYearDropDown.Items[0].Selected = true;

     

    Technorati Tags:

  • How to get the mouse wheel to work in VB6 IDE

    Visual Basic 6.0 (VB6) applications are still around and frequently I will have to work on some Visual Basic 6 COM Component DLL or application.   I would much rather prefer to work in c# or VB.NET but I completely understand a companies decision to not rewrite a reliable VB6 component but prefer to just make minor changes to it (especially when they have limited resources and the VB6 component does not provide value add to the customer). 

    So I have no problem working with Visual Basic 6 except for one of the most painful parts which is no mouse wheel support in the code window.  It sounds like just a minor inconvenience but in reality not having mouse wheel support slows down development dramatically when trying to find your way around some VB6 code.

    I was about to post my question on StackOverflow but as soon as I typed in my question this StackOverflow question popped up with the #1 answer pointing me to this Microsoft Support article for a Mouse Wheel Add-in for VB6: 

    Mouse wheel events do not work in the Visual Basic 6.0 IDE - http://support.microsoft.com/kb/837910

    Follow the instructions in Method 1 described on that page and then your mouse wheel will work within the Visual Basic 6.0 IDE code window.  Very, very nice!

    Technorati Tags: ,
  • PureText is Pure Gold!

    PureText from Steve Miller is a very simple and extremely useful utility that makes the Windows-V hot key combination paste non-formatted text instead of formatted text. 

    image

    I use it all over the place and I make sure it is installed and set to run at startup on all of my machines including my wife’s laptop.

    From the PureText website:

    PureText is basically equivalent to opening Notepad, doing a PASTE, followed by a SELECT-ALL, and then a COPY.  The benefit of PureText is performing all these actions with a single Hot-Key and having the result pasted into the current window automatically.

    By the way, guess how I pasted in the text above that I copied from the PureText website?  :)

     

    Technorati Tags:
  • How to reset an Outlook view – expand all groups

    For some reason one of my Outlook folder’s views ended in a state where the groups were always collapsed.  It was not a huge deal but just annoying enough to bug me.

    image

    I tried several things to get it to stay expanded but I could not find the setting to change the view to always be expanded and stay expanded when I left the folder and returned.

    Eventually I figured out that I could just reset the current view to the original settings to resolve the problem.

    To do this, first browse to the folder with the view problem.  Then go to View > Current View > Customize Current View…

    image

    In this dialog there will be a Reset Current View button on the bottom right.  Click this button and then click OK. 

    image

    Now you view will be back to the default which is to have all groups expanded.

  • Import RSS Feeds to New Outlook Profile from Common Feeds List

    I am in the process of migrating from one Outlook profile to a new one (I am actually moving away from Exchange and back to the .pst world).  Initially I created a new profile, created a data file, and then added my email account to POP email into the new data file.  All done… nice and easy… time to turn off the lights and go home.  Hang on a second… where are my RSS Feeds?

    I use Outlook to download my RSS Feeds and I have several that I enjoy reading and now my new profile does not have those RSS Feeds listed.  Luckily I was able to find two solutions to get those feeds over to me new profile.

    First, I could export the feeds from my old Exchange profile as an OPML file and then import them into my new Outlook Profile.  This can all be done from Outlooks File menu using the Import and Export Wizard.

    This would have been easy enough but there was an even easier way for me.  I added my RSS Feeds into the Common Feed List through Internet Explorer and there is an option to import the RSS Feeds from the Common Feed List.

    image

    Select this option, choose next and you will be presented with a list of RSS Feeds that you can check or uncheck for import into Outlook.  Now I have my new Outlook Profile set up just like my old one when I was on Exchange.

  • BurnCDCC – Burn ISO files to DVD

    One of my tools that I keep in my \Utils folders and use often is BurnCDCC.  As described on the TeraByte website BurnCDCC will burn an ISO file to a CD/DVD/BD disc.

    image

    The freeware download is just a zip file containing an EXE that just runs… that’s right no install necessary.  Running BurnCDCC.exe gives you a simple and easy to use user interface.  Select your ISO file, check a couple of options, choose your DVD drive, and hit start… and it just works.  Perfect for burning those Windows 7 and Windows Server 2008 R2 ISO images to DVD.

    image

    Technorati Tags: ,
  • Index Server and the Enable 32-Bit Applications Setting

    We had a old website that made use of Microsoft Index Server and the Index Server COM objects (ixsso,Query).  Everything was working fine on our Windows Server 2003 machines under IIS6. Then when we migrated to Windows Server 2008 and IIS7 our classic asp pages (which we did a straight migration over to classic asp in IIS7) could not instantiate the Index Server objects.

    Simply instantiating the object would fail:

    Dim objQuery  
    Set objQuery = Server.CreateObject("ixsso.Query")

    After a call to Microsoft PSS we were finally able to track down the problem to the Application Pool running in 32-bit mode.  IIS7 allows you to run the application mode in 32-bit or 64-bit by configuring this setting of the application pool:

    image

    False is the default but it was overridden to true in the Application Pool where the Index Server object was being instantiated.  And the Index Server dlls are 64-bit only.  So while a 32-bit dll can load in a 64-bit process the reverse is not possible.  There was no reason that the application pool was set to 32-bit so we switched it to 64-bit (changed the “Enable 32-bit Applications setting to false) and everything worked.

  • Use Ctrl-m in OneNote to create a new instance

    I love Microsoft OneNote and I use it so much that I want multiple OneNote instances open so that I can quickly use Alt-Tab to switch between the various notebooks, sections, and pages that I am referencing.  At first I did not think it was possible to create a second instance of OneNote but then I found that Ctrl-m will create that new instance for you.

    Looking under the Window menu, I see that it has been there the entire time: 

    image

    Interesting that I never tried looking in the Window menu but only found out about Ctrl-m from another user.  The OneNote 2007 Keyboard Shortcuts help topic also has Ctrl-m clearly listed.

    image

    I wonder if I looked in the File menu and just didn’t think to look under Window??  Or did I just not think that creating a New instance of OneNote is a Window menu function??  What did I not understand about “New Window”?  Or was I looking for the New Instance menu item??  I probably will never know… but I sure am happy that I found Ctrl-m.  :)

     

    Technorati Tags:
  • Use Alt-key to select arbitrary block of text in Visual Studio

    One of the my most favorite tips/tricks for Visual Studio is the ability to copy and paste an arbitrary block on text in the Source View by pressing and holding the Alt-key while dragging your mouse.  A quick example is the best way to describe it.

    Normally you can select text line by line, starting from a point in one line of text and going to a point in another line of text and including all of the lines in between.

    image

    But if you hold down the Alt-key and drag your mouse you can select an arbitrary block of text.

    image

    And now you can use the normal copy and paste functions to grab that block of text and paste it elsewhere like so:

    cation.EnableVis
    cation.SetCompat
    cation.Run(new F

    The example above is not very practical but I have found plenty of uses for Alt-Select during my daily development work.