Tuesday, September 11, 2007

Growing up, I had always heard people around me say "Where were you when it happened?"  The it was a variety of different events.  It was usually referring to when JFK was shot or another significant event in our history.  It seemed that each generation had it's own events that brought on this question.  I always thought those conversations were weird.  Why couldn't people just move on?  Why did they feel the need to dwell on that stuff?  What I hadn't realized is how fortunate I was.  My generation was lucky, we didn't really have any events that were so significant that we could never forget. 

Here it is, Sept 11, 2007.  And I can't help myself from asking that very question.  Ever since September 11, 2001, I understand why people ask that question.  It's not just that we can't forget, it is that we don't want to forget.  We shouldn't forget. 

I'm typically not the kind of person that remembers all kinds of details about days in my life.  But 9/11 is completely clear in my head.  I remember waking up in North Carolina, I was there for a lengthy consulting assignment.  I had been having some remote connection problems with my laptop.  I needed to call the desktop support team after 9am and I needed to do it from my apartment so I could test the system.  If it were not for that situation, I would have been at work before it happened.  I had the TV on, I was watching Good Morning America.  After some typical morning stories, Charlie Gibson announced that they were going to a live shot of lower Manhattan, where a plane had hit one of the towers.  Of course, all of the information that Gibson gave out at this point was hearsay.  Maybe it was a commuter plane?  Maybe it was a suicide?  I remember watching that live shot when the second plane hit.  My jaw dropped.  Everything was obvious at that point, this was not an accident.  The newscasters were in just as much shock as I was, just as I'm sure everyone else was that was tuned in.  I immediately called my friend Steve.  He lived in Battery Park City.  Not only was his apartment a few short blocks from what we now call "ground zero" but I knew he took the subway from the World Trade Center each morning.  Luckily, he was already in his office up town and his wife was fine too. I watched the coverage for a while and of course, I saw the towers go down.  There was also the news of flight 93 and the Pentagon as well. The whole situation was surreal.  I was very sad.  I was very confused.  I called my friend/coworker Chris.  He was in the apartment downstairs and I knew he typically went to work late.  He came up for a while and we watched the coverage together.  Eventually I went to work for a few hours, just for a change of scenery.  I couldn't watch the coverage any more.   Everyone was talking about it of course.  So many people were worried for someone they knew who lived or worked in lower Manhattan or the other affected areas.  Having recently lived in Hoboken, NJ (right across the river from Lower Manhattan) I served as source of information for many people in the office who had never visited the area.  My sad mood lasted for a long time, just as it did for many people.  Days later, Chris and I had to drive home to the Philly area because the airports were still closed.  My friend Steve's apartment was a wreck.  His windows had all blown in.  The building had a lot of damage.  He never lived there again.  And of course, many people died or were badly hurt (none that I knew personally).

I'm not sure what is harder to comprehend, each obviously for a different reason - The will of man to execute such a plot against his fellow man,  the loss of life on that day, or the bravery of men and women who risked their own lives to help others?  Tragic events like 9/11 continue to prove the complexity and sadness of life.

With a child of my own on the way now, I really hope future generations never understand why we ask the question "Where were you when it happened?"  They should be so lucky.

Tuesday, September 11, 2007 8:40:18 AM (Eastern Standard Time, UTC-05:00)  #    Disclaimer  |  Comments [1]  |  Trackback
 Monday, September 10, 2007

Sorry gang... Pub Night, scheduled for Tuesday, Sept 11 (originally scheduled for Wed, Sept 12) is now postponed again!

Because it was postponed, there wasn't enough time to ensure a good crowd for tomorrow.  Plus, a lot of us are still working on our presentations for Saturday's Code Camp.

I think it will be next week, probably Wednesday.  But don't put any money on that yet!

Monday, September 10, 2007 1:09:44 PM (Eastern Standard Time, UTC-05:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Thursday, September 06, 2007

It's been in the works for a while but now it is official.  John Baird, Mitch Ruebush, Doug White and myself have formed NoDeNUG - the Northern Delaware .Net User Group.  We've also got the support of Dani Diaz, our local Microsoft Developer Evangelist.

When:  

  • We'll meet on the last Thursday of the month at 5:30. 

Where: 

Speakers:

  • September 27 - Kevin Goff
  • October 25 - Andy Schwam
  • November 29 - Dani Diaz
  • December - We'll skip that because of the holidays.
  • January - Mitch Ruebush

Sponsors: 

More information will be coming soon. 

Thursday, September 06, 2007 7:21:22 PM (Eastern Standard Time, UTC-05:00)  #    Disclaimer  |  Comments [2]  |  Trackback

Sorry for the late notice, but our Pub Night has been changed.  Sorry, we didn't realize it was scheduled on a Jewish holiday.

Luckily, everything else stays the same.  e-brilliance will still sponsor the event at the Great American Pub in Conshohocken.  We'll start drinking around 5:30.  See you on TUESDAY SEPTEMBER 11.

The official e-mail invitation should be going out soon.

Thursday, September 06, 2007 6:51:10 PM (Eastern Standard Time, UTC-05:00)  #    Disclaimer  |  Comments [0]  |  Trackback

I've got some speaking engagements coming up.  It almost sounds like an official tour is planned.

Presentation Topic: Developing Custom Controls for ASP.Net

Description:  In this demo I'll show you how to get started creating your own custom server controls for asp.net.  I'll show how to create controls, expose public properties to make them easier for other developers to implement, and handle events from the control.  We'll  create a ControlDesigner so Visual Studio can render the control at design time.  I'll even build some extra features into the control using Ajax.

Where:

I'm really excited to get out to some of these other groups for these presentations.  If you live near any of these groups, check them out.  They've all got regular, monthly meetings with great .Net content.  I've also got calls in to Madison Square Garden, LA Coliseum, Wembley Stadium and others.  But I haven't heard back from them yet.

Please, no brown M&M's.

Update:  When I get some time I'll be writing the demo out as a tutorial blog post.  In the mean time, if you are interested in the source code for this demo, here it is:

ControlsDemo.zip (1.05 MB)

Thursday, September 06, 2007 11:59:22 AM (Eastern Standard Time, UTC-05:00)  #    Disclaimer  |  Comments [2]  |  Trackback
 Wednesday, September 05, 2007

Code Camp is just 10 days away!  The Philly.Net leadership has been working hard on all of the details.  We had a meeting last night at Rob's house.  Attendees included Bill Wolff, Rob Keiser, myself, Marc Ziss, Marc Magliocco, David Mann, and Dani Diaz.  Here are some of the items discussed about Code Camp and Philly.Net in general:

  • We may have to move Pub Night.  Keep an eye out for more information soon.  We didn't realize that it was scheduled on Rosh Hashanah.  We are looking at Tuesday night instead.
  • We (loosely) planned out the food for Code Camp.  We'll have breakfast (bagels or muffins) with coffee and juice.  For lunch we'll have big hoagies like last time.  Plus we'll have snacks throughout the day including water and soda.
  • This time we are going to try and stagger the lunch schedule, so don't panic when you see the session schedule.  Hopefully we'll have shorter lines to get food.
  • Bill is going to try and send out a confirmation email to registered attendees soon.
  • David Mann is starting up a new group for developers using Microsoft Office, VSTO, etc.  I'll post more when the details come out.
  • Several of us are starting a new .net user group in northern Delaware.  Check out this web site for more info.  I'll be speaking there October 25th.  Please spread the word about this new group.
  • Check out the ReMix 07 conference.  If you missed Mix07 last spring, here's your chance to get caught up on ASP.Net, Silverlight, AJAX and more.
  • Check out our future meeting schedule on the web site.  You'll see that we don't have many speakers or sponsors lined up for future meetings.  Here is your change to do presentation or be a sponsor.
  • Rob's new nickname is Bubba.  You'll have to ask.

See you at Code Camp!  Don't forget, you can check out the swag/prizes here.

Wednesday, September 05, 2007 7:57:06 PM (Eastern Standard Time, UTC-05:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Tuesday, September 04, 2007

It's official, I'm going to be a dad.  Of course, I am pretty excited about it but I am also pretty nervous.  Life as I know it is about to change. 

My wife and I have been telling our friends and family about our expected baby.  More then one person responded to me with "So you got one past the goalie!"  Goalie?  What goalie?  The goalie was already in the locker room.  If the goalie was anywhere near the goal she'd have been helping with rebounds! 

Telling the women we know is a lot of fun.  They all seem so sincere about how great it is to be parents and how much we'll love our child, etc, etc.  Some of my male friends have a different response.  They say they are happy for me, but behind their words I hear a sort of sinister laugh.  The kind of laugh that says they can't wait to watch me dealing with all of the issues.  A "misery loves company" kind of thing.  Thanks guys.  Maybe I shouldn't have made fun of them all these years about how I can sleep late, do whatever I want do (spontaneously), and relax at will.  Maybe I shouldn't have played with their kids until they were completely out of control and then, with a simple "See ya", walk out the door.   What's that they say about pay backs?

Na, nothing to worry about.  This is gonna be a piece of cake... Wink

Tuesday, September 04, 2007 7:15:28 AM (Eastern Standard Time, UTC-05:00)  #    Disclaimer  |  Comments [1]  |  Trackback
 Wednesday, August 29, 2007
Infragistics SourceGear
Neudesic Phillydotnet_gif

 

Philly.Net is proud to announce our newest Gold Level Contributor, Neudesic.  Our Gold Contributors make it possible for us to host the event and provide food and drinks throughout the day.

In addition, we've added SQL Server Magazine as our latest Swag contributor.  They are graciously providing a subscription to the magazine for each attendee.  You'll have to fill out the form on the day of the event though - don't forget!

 

We've got lots of other companies supporting us.  Check out the entire list.

Check out the Philly.Net site for more information.  And don't forget that pub night is Wednesday, Sept 12.

Wednesday, August 29, 2007 9:31:36 PM (Eastern Standard Time, UTC-05:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Tuesday, August 28, 2007

Sorry, if you haven't registered already for the Sept 15 2007 Code Camp you are out of luck.  Hopefully we'll see you at the next Code Camp, we are planning one for the winter.

 

If you are attending, check out the Philly.Net site to see a list of presentations.  We've got a nice variety of presenters and presentation topics.  If you are interested in the free stuff you can get at Code Camp, check out this post.

Tuesday, August 28, 2007 8:25:59 AM (Eastern Standard Time, UTC-05:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Friday, August 24, 2007

I recently started playing around with WatiN (Web Application Testing in .Net) and WatiN Test Recorder.  While these are cool tools that can greatly improve the testing process, I found that there isn't a lot of information out there to help get started.  I have put together a brief tutorial on some of the basics.  I hope it helps.  I'm including code samples in this post, plus you can download the entire VS Solution and a short video below.

WatiN, pronounced "What-in", is a library that allows you to create tests for web applications.  It is based in WatiR which was created for Ruby.  Basically, you can test your web pages just like any other classes.  In my case, I'll use NUnit to control the actual tests but they are written with WatiN.  The tests run in the browser via a class named "IE".  That immediately points out one of the downsides to WatiN -- it only works with Internet Explorer.  But the tests run in a real browser so it is very accurate.

Here's a quick code sample:
            IE ie = new IE("http://localhost/somewebsite/default.aspx");
            ie.Link(Find.ById("LinkButton1")).Click();

If you run that in a test, the browser will actually open, navigate to the default page, find the LinkButton and click it.  Seems pretty simple right?  It isn't too complicated but you'll have to get used to the WatiN classes and methods.  The fact is, the tests are a pain to write.  That's where WatiN Test Recorder comes in.  All you have to do is start the recorder and the tool will begin to record your actions in the browser (there is a browser built into WatiN Test Recorder) and translate your actions into code.  If you click LinkButton1, the recorder outputs "ie.Link(Find.ById("LinkButton1")).Click();" for you!  This is a big help but it is not exactly perfect.  I have found that it doesn't get the code right and some tweaking is needed.  I'm starting to get the hang of it so the changes to the code are getting easier. 

Sample Code and Downloads:

Download my VS 2005 solution:  WatiNDemo.zip  167KB
Download my Video of WatiN Test Recorder in action:  WatiNTestRecorderDemo.avi (Right click and "save target as")  2.22MB

I created a simple data entry web application with 2 pages that pretends to register users to a web site for outdoor enthusiasts.  The first page lists the registered users, the second page is a form to register:

image image

I want to make sure my data entry page works, so I fire up WatiN Test Recorder.  The video (see the link above) shows what happens in the recorder as I step through the page  and enter the data into the web form.  Here is the code that the recorder generated for me, with line numbers added here for reference:

          1   IE ie = new IE("http://localhost:49573/RegisteredList.aspx");
          2   ie.Link(Find.ById("LinkButton1")).Click();
          3   ie.TextField(Find.ById("txtFirst")).Click();
          4   ie.TextField(Find.ById("txtLast")).Click();
          5   ie.TextField(Find.ById("txtLast")).TypeText("andy");
          6   ie.TextField(Find.ById("txtEmail")).TypeText("schwam");
          7   ie.TextField(Find.ById("txtEmail")).Click();
          8   ie.TextField(Find.ById("txtEmail")).TypeText("andy@email.com");
          9   ie.RadioButton(Find.ByName("rdoSendInfo_0") && Find.ByValue("yes")).Checked = true;
          10  ie.TableCell(Find.ByCustom("innertext", " Choose New Jersey Pennsylvania")).Click();
          11  ie.SelectList(Find.ById("ddlState")).SelectByValue("Pennsylvania");
          12  ie.SelectList(Find.ById("ddlCounty")).Click();
          13  ie.SelectList(Find.ById("lstHobbies")).Click();
          14  ie.SelectList(Find.ById("lstHobbies")).Click();
          15  ie.SelectList(Find.ById("lstHobbies")).Click();
          16  ie.SelectList(Find.ById("lstHobbies")).Click();
          17  ie.Button(Find.ById("btnSubmit")).Click();
          18  ie.Link(Find.ByUrl("javascript:__doPostBack('GridView1','Select$0')")).Click();
          19  ie.Link(Find.ById("LinkButton1")).Click();

Fixing the Generated Code:

  • Line 1 and 2 are good:  Open Internet Explorer and navigate to my page.
  • Line 3, 4, 7, and 10 are not really needed but it won't cause any trouble.  The clicks seem to be irrelevant.
  • Line 5 and 6 are just wrong.  I put the text "andy" in the textbox named txtFirst, and "schwam" in txtLast.  I can easily fix them:  
    • ie.TextField(Find.ById("txtFirst")).TypeText("andy");
    • ie.TextField(Find.ById("txtLast")).TypeText("schwam");
  • Line 9 throws this exception if you let it run: "WatiN.Core.Exceptions.ElementNotFoundException: Could not find a 'INPUT (radio)' tag containing attribute name with value 'rdoSendInfo_0'".  It should be Find.ById, not Find.ByName.  This works instead:
    • ie.RadioButton(Find.ById("rdoSendInfo_0")).Checked = true;
  • Line 11 is good
  • Line 12.  Notice no county is selected. Try this:
    • ie.SelectList(Find.ById("ddlCounty")).SelectByValue("Delaware");
  • Lines 13, 14, 15, and 16 are just clicks but nothing is selected.  Try this:
    • ie.SelectList(Find.ById("lstHobbies")).SelectByValue("Hiking");
    • ie.SelectList(Find.ById("lstHobbies")).SelectByValue("Camping");
    • ie.SelectList(Find.ById("lstHobbies")).SelectByValue("Mountain Biking");
    • ie.SelectList(Find.ById("lstHobbies")).SelectByValue("Kayaking");
  • Line 18 is correct but worth mentioning.  This selects the first row in the grid which causes the application to display the users detail in the grid.

That doesn't seem to good for a first shot!  But even with all of the mistakes, I'd rather start with the generated code then nothing at all, especially if this was a longer, more complicated test.  Plus, I admit there are features of the recorder that I am not familiar with so maybe it would work better if I actually knew what I was doing! 

AJAX Issues:

Technically, the changes I made are correct but it still won't work right.  I am using ASP.Net Ajax to call back to the server when the state (ddlState) changes.  I'm populate a list of counties (ddlCounty) on the server.  When you run the test it goes so fast that it tries to select the county before the drop down list is loaded!  I found some documentation about a WaitUntil() method but I couldn't get it to work.  So I did it the old fashioned way and put the thread to sleep:

            ie.SelectList(Find.ById("ddlState")).SelectByValue("Pennsylvania");
            System.Threading.Thread.Sleep(100);
            ie.SelectList(Find.ById("ddlCounty")).SelectByValue("Delaware");

Validation:

After the submit button is clicked, the application returns to the list of users.  Since I am writing a test, I should validate the results.  I'll add in a few asserts:

            Assert.AreEqual("Andy", ie.TextField(Find.ById("txtFirst")).Text);
            Assert.AreEqual("Schwam", ie.TextField(Find.ById("txtLast")).Text);
            Assert.AreEqual("me@email.com", ie.TextField(Find.ById("txtEmail")).Text);

The Final Test Class:

The solution contains a class library with a class Tests . Using NUnit, I can execute the test easily.

using WatiN.Core;
using NUnit.Framework;

namespace Tests
{
    [TestFixture]
    public class Tests
    {
        [Test]
        public void FirstTest()
        {
            IE ie = new IE("http://localhost/WatinDemoSite/RegisteredList.aspx");
            ie.Refresh();
            ie.Link(Find.ById("LinkButton1")).Click();
            ie.TextField(Find.ById("txtFirst")).TypeText("Andy");
            ie.TextField(Find.ById("txtLast")).TypeText("Schwam");
            ie.TextField(Find.ById("txtEmail")).TypeText("me@email.com");
            ie.RadioButton(Find.ById("rdoSendInfo_0")).Checked = true;
            ie.SelectList(Find.ById("ddlState")).SelectByValue("Pennsylvania");
            System.Threading.Thread.Sleep(100);
            ie.SelectList(Find.ById("ddlCounty")).SelectByValue("Delaware");
            ie.SelectList(Find.ById("lstHobbies")).SelectByValue("Hiking");
            ie.SelectList(Find.ById("lstHobbies")).SelectByValue("Camping");
            ie.SelectList(Find.ById("lstHobbies")).SelectByValue("Mountain Biking");
            ie.SelectList(Find.ById("lstHobbies")).SelectByValue("Kayaking");
            ie.Button(Find.ById("btnSubmit")).Click();

            //VALIDATION

            ie.Link(Find.ByUrl("javascript:__doPostBack('GridView1','Select$0')")).Click();

            Assert.AreEqual("Andy", ie.TextField(Find.ById("txtFirst")).Text);
            Assert.AreEqual("Schwam", ie.TextField(Find.ById("txtLast")).Text);
            Assert.AreEqual("me@email.com", ie.TextField(Find.ById("txtEmail")).Text);

        }
    }
}

Running The Tests:

I use ReSharper from JetBrains which makes my life easier in so many ways.  One of which is that it includes a tool to run unit tests.  The tests within the Visual Studio solution included in this post work great when run through ReSharper.  But I found that when I ran the tests with NUnit GUI directly I got an exception:

Tests.Tests.FirstTest : System.Threading.ThreadStateException : The CurrentThread needs to have it's ApartmentState set to ApartmentState.STA to be able to automate Internet Explorer.

There are some posts out there about resolving this issue but I have a better solution.  Either install ReSharper or install UnitRun, a free tool that runs tests (also from JetBrains).  While I haven't tested UnitRun, I expect it will work the same as the ReSharper solution.

Friday, August 24, 2007 11:57:43 PM (Eastern Standard Time, UTC-05:00)  #    Disclaimer  |  Comments [5]  |  Trackback