October 12, 2009

Cannot open .CHM file

I recently had difficulty getting content when opening a .CHM file.  It gives me a Address not found message in the content section.  I was still able to see the table of contents.  To fix this issue, please refer to Article ID: 902225.

I used Method 2 to solve my problem.

October 10, 2009

WatiN, Gallio, and MbUnit ... Web Application Testing

WatiN is a web application testing framework.  It is used to test the UI portion of your web application.  It can be used for validating the functionality of a button, and also to validate your JavaScript ( or jQuery ) code, just to name a couple.  Combining WatiN with Gallio and MbUnit results in a very effective and easy to maintain tests.

When I first started working with WatiN, I had a difficult time finding information and sample code to get started.   And when I combine both Gallio and MbUnit to my test project, it was even harder to get started.  I am writing this in hopes that it will help others get a jump start.

First, you need to download WatiN.  WatiN comes in a ZIP file.  All you need to do is to unzip it to a folder ( for now anyway ).   Gallio and MbUnit comes bundle together and can be found here.  Once download is complete, you will need to install it.  The current version ( at the time of this blog being written ) for WatiN is 2.0.10.928, and for Gallio and MbUnit, it is 3.1.313.

Next, open Visual Studio 2008 and create a new Class Library project.  You may also add a new project to your existing solution.

NOTE: If you have VS 2008 running in Vista / Windows 7, make sure you ran VS 2008 as administrator. Otherwise, you will get errors when you try to debug your tests.  

In my examples, I am going to add a new class library project to an existing solution.  The web site that I am using is a simple web site that contains a single page.  This page contains a text box, a label, and a button.  Here's what the web site looks like.



Now that we have this working, let's create a new class library in this solution.  In this new class library, go ahead and add the following DLLs
1. Gallio.dll
2. MbUnit.dll
3. Watin.Core.dll

The reference folder in your class library should look something like this



Both projects are using .NET framework 2.0.  In WatiNTestClass.cs, your code would look something like this.

using MbUnit.Framework;
using WatiN.Core;

namespace WatiNTestClassLibrary
{
    public class WatiNTestClass
    {
        public static IE ie;

        [SetUp]
        public static void Setup()
       {
              ie = new IE("about:blank");
       }

        [TearDown]
        public static void TearDown()
       {
             ie.Close();
             ie.Dispose();
       }

       [Test]
       public static void WatiNTests()
      {
            ie.GoTo("http://localhost:2728/Default.aspx");
            TextField tf = ie.TextField(Find.ByName("TextBox1"));
            Button b = ie.Button(Find.ByName("Button1"));
            tf.TypeText("Hello world");
            b.Click();
      }
   }
}

Now, you are ready to test.  If you wish to debug, set a breakpoint and click on the half green half yellow circle on the left of your test method ( in this case, it is WatiNTests() ).  You will be presented with a list of four options .... Run, Debug, Profile, and Append to Session.  Select Debug.

You are now on your way to write tests for your web applications.  Happy UI testing.

UPDATE: You can also find additional information by opening WatiN.CHM file.  You can find this file from the ZIP file that you have downloaded from the WatiN site.  Thanks Mr. Brown.

September 15, 2009

MagicJack Review

I am sure a lot of you have seen the ads and/or in some store like Radio Shack, Best Buy, ... just to name a few.  Well, I am here to give you my thoughts about this "MagicJack".

It cost me $40 to buy the USB device that also includes 1 year of service. I bought it 2 months ago.  Installation was easy.  I installed it on a dual core machine running Windows 7 RTM.  It does go out to download and install a software that runs on your PC.  I went through the initial setup ... self-information, pick a number, etc.  Now, I live in KS and it did not have my area code, so, I picked one closest to me, which is an 816 area code.  Not all area code is available at that time.  Once I am done with setup, I was ready to make calls.  I tried it two different ways.  One, I connected using wireless.  The call quality was poor.  Now this could very well be because of my wireless connection and has nothing to do with MagicJack.  So, after a couple of days, I switched over to wired networking.  The sound quality was much much better.

I did notice that my PC must be constantly on.  The screen saver cannot be running and/or the PC cannot be in sleep mode.  If the PC is in one of the states, I cannot make and/or receive calls.  This is one small drawback but it is something I can live with.  My PC is hardly ever shut down anyway, so, no problems here.

After a few days, I noticed that I cannot call home.  Every time I call my home, it would immediately go into voice mail.  I checked my connection ( still have internet ), software is up and running, but I still cannot receive calls.  I can pick up my phone and I can dial out.  Once I dial out, I can start receiving calls again.  After a while, it would stop receiving calls again.  This went on for a while.  Finally, I "chatted" with customer service and I was told that since I am using Windows 7, which is NOT a supported OS, he cannot help me.  So, I packed it all up and returned it to Radio Shack.

Now, overall, I was happy with the sound quality.  The reason I returned it is because I cannot call my home, if and when I need to.  So, if your intention is to use it purely for making calls, then I would recommend it.  Give it a shot.  Otherwise, go elsewhere.

Installing Microsoft IIS in Windows 7

First thing is to make sure that you are not using Windows 7 Home Edition. It is my understanding that Microsoft IIS does not come with it. Second, make sure you have the Windows 7 DVD handy ( you may need it during installation ).

1. Go to Start > Control Panel > Programs and Features.
2. Click on Turn Windows features on or off
3. When another dialog box that contains a list of many Windows relates services appear, check the box for 'Internet Information Services (IIS)'.  Leave all the default installation settings intact ( unless you want additional services .. like FTP, etc ).
4. Click OK.  Installation will start.  It may prompt you for the Windows 7 DVD.

Once installation is complete, you may go to Administrative Tools > Internet Information Services (IIS) Manager and you may configure your web site from there.  I also notice that you can have more than 1 website.  This option was not available in Windows XP.  I am not sure about Vista.

Anyhow, there you go.

September 10, 2009

Windows 7 - Update

I am not an early adopter, especially when it comes to technology.  However, I have been so impressed with Windows 7, I have upgraded both my laptop as well as my home/work desktop toWindows 7.  It seems to me that Windows 7 is just that much better than Vista.  If I were to compare it to XP, I personally think Win 7 is just slightly better. 

It is stable.  I have a lot of software installed on these machines, Visual Studio, VirtualBox, accounting software, Adobe products, just to name a few.  And they all work.  Driver support is awesome.  I no longer have to install the software that came with the HP printer that I have.

The AeroPeek feature is nice.  What I like the most is the ability to snap the active window to the left and/or right of your screen by simply holding down the Window key and pressing either the left arrow key / right arrow key.  I believe that these Winkey combinations is new for Windows 7.  Here's a short list of Winkey combinations:

Win+Up arrowMaximize current active window
Win+Down arrowMinimize current active window
Win+Left arrowSnap current active window to left
Win+Right arrowSnap current active window to right
Win+HomeMinimize / restore window
Win+TFocus the first taskbar entry
Pressing again will cycle through them, you can can arrow around.
Win+Shift+T cycles backwards.
Win+HomeMinimize / restore window

If there are others that you have used and found useful, please let me know.

September 4, 2009

Cloning a Virtual Harddrive - VirtualBox

I use VirtualBox to allow me to run multiple OS on one machine. It is a powerful virtualization product, with rich features. It is an Open Source Software. It runs on Windows, and supports all of Windows OS'es, Linux, Solaris, OpenBSD, just to name a few.

One feature that I use a lot is the cloning feature. Here's what I do.
1. Create a new virtual machine
2. Create a new virtual hard drive ( this will be my template )
3. Install the OS ( Windows XP Pro, for example )
4. Update the OS with the latest patches, etc.
5. Install any additional software necessary

Once complete, I open up a command prompt and navigate to the VirtualBox folder. I type the following command and then hit Enter:

VBoxManage clonehd "sourceTemplate.vdi" "newCloneDisk.vdi"

You will replace the VDI names in quotes with the path and filename where the source is located and where you want it to clone to. It will do it's thing and will return to the command prompt once it completes.

I then return to VirtualBox and do the following steps:
1. Create a new virtual machine
2. Here, I would select an existing virtual harddisk, in this case, I would select the newly cloned VDI.

I also found that there is another way of cloning. I have not yet tried this out myself ( I will try this the next time I need to clone ) but here it is anyway.

First copy the VDI file ( or your template ) using Windows Explorer. Name the copy to what you want. Open up a command prompt and navigate to the VirtualBox folder. Type:

VBoxManage internalcommands setvdiuuid "newCloneDisk.vdi"

You will replace the VDI names in quotes with the path and filename where you want the new VDI to clone to.

I hope this helps. If someone has already used the second option, please let me know how you like it, if you ran into any issues, etc. Thanks.

UPDATE: The second option works and it is a whole lot faster to complete.

August 30, 2009

St. Louis Day of .NET Review

St. Louis Day of .NET is over. It was a two day conference that was held in the Ameristar Casino in St. Charles, MO.

The conference started with Jumpstart events ... which are basically introductions. Each sessions were 1 hour 15 minutes long and the topics covered were awesome. WCF, Silverlight, Architecture and Patterns, C#, MVC, DotNetNuke, LINQ, and many more. I believe that there were over 40 sessions. Some of the sessions were repeated, which is great, as it allows you the opportunity to attend it if you missed the first session.

One of the things that I really liked about this event compared to other events like VS Live, was the ability to talk to the speakers. They were just hanging around talking with folks. It did not seem like I had that opportunity to do that at VS Live. I had the opportunity to meet with Mr. Phil Japikse, Mr. Lee Brandt, Mr. Chris Deweese, Mr Kevin Grosnicklaus, Mr. Jeff Fattic, and Mr. Dan Rigsby, just to name a few. I also had the opportunity to meet and talk with Mr. Jeff Strauss, who happens to be one of the organizers of this wonderful event.

If you were not able to attend this event this year, please plan on checking it out next year. I will be providing the information on here. For the organizers and speakers that just happens to be seeing this blog, I want to thank you for making this a great conference. Top class event. Looking forward to next year.

August 26, 2009

PLINQO

A new and better LINQ to SQL. It is call PLINQO. You can find it at http://plinqo.com. It is available in C# and VB.

August 8, 2009

Installing Win7 from USB Drive

Found this article. Check it out here. Great post and HOWTO.

April 11, 2009

April 8, 2009

Windows 7 Beta

I wanted to share some of my thoughts of Windows 7 - Beta. So far, I would have to say I like it much better than Vista and even XP. It seems that things are running much smoother than Vista. Prior to installing Windows 7, I was using both Vista 32-bit and 64-bit. Win 7 performs much better than both.

My first attempt was actually just an upgrade to my Vista 32-bit. That went fine. I really did not see much difference from speed but did notice that there was no lag on the sidebar. I normally have XM Radio running on the sidebar and with Vista, I sometimes hear lags.

I then decided to completely wipe out my HD and reinstall from scratch. I personally think that this is a better route to go. Only thing annoying with the Beta version would be the Send Feedback link on every dialog box that comes up. It also has a watermark on the bottom right corner of the screen. I am sure those are easily removed.

March 3, 2009

Ignoring Header in Excel using .NET

I recently was put on a project that requires an Excel file to be uploaded. It must then be read and data in it, validated. The solution I chose was to use a OleDbDataReader. However, the Excel file can come in with or without headers. What I mean is that the very first row may or may not contain headers.

After researching the web for a while, my colleagues and I found the following property can be set in the connection string. Here's the code:

String sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + [Your Excel File Name Here] + ";Extended Properties=Excel 8.0;HDR=No";

Setting HDR=No will ignore the first row as header.

February 28, 2009

FDM - Free Download Manager

This application is an easy-to-use download accelarator and manager. It is also absolutely free. One of its features is flash video download. It allows you to download videos from sites such as YouTube, etc. It resumes broken downloads and also provide smart file management and a powerful scheduler.

FDM can be found here

January 3, 2009

SlickRun - Opening multiple sites with one MagicWord

Create a new MagicWord in SlickRun. Enter a new MagicWord that you would like to use. In the Filename or URL, enter @MULTI@. In the parameters section, there the MagicWord browser of your choice. In my case, I am using firefox. Enter the following:
firefox -url http://www.techbargains.com -new-tab http://www.woot.com -new-tab http://www.dealsucker.com.

UPDATE: doing the above will only work if you already have a browser open. If you do not have a browser open, it will actually open up a new browser for you. If you remove the -url and all the -new-tab(s), it will open up a new browser and automatically open up additional sites in a new tabs.

firefox http://www.techbargains.com http://www.woot.com http://www.dealsucker.com http://sellout.woot.com

Save the new MagicWord. Now, try it. You can also use IE or any browser of your choice. In this case, make sure that you have a MagicWord created for your browser.




You can also use @MULTI@ to start multiple applications. Make sure that you have MagicWords for your applications. In the parameters section, enter the applications that you would like to open. Separate each application with the @ sign.