Archive for November, 2007

Visual Studio 2008 Pro for FREE

0

Microsoft is doing a Visual Studio 2008 Installfest at various locations across the country!


What specifically is “Installfest”? Tim at Microsoft says:


“Want the latest IDE toolset and start developing solutions in .NET 3.5 using Asp.net Ajax, Silverlight, LINQ, Astoria and all the good stuff? What are you waiting for?  There are various Visual Studio 2008 Installfests around the country.  My team in the west is no different, but maybe you’ve been having a hard time finding them?  Here’s a list for all those happening in the west!  please feel free to blog and spread the word. We’re providing a location, install dvds (these will be evals because the finals aren’t pressed yet), and food/drinks.  This will be a good time to get some questions answered, get VS 2008 installed, play around, and hang out with your peers.  Each registered and attended individual will receive a special code to receive the fully-licensed Visual Studio 2008 Professional copy sent to them when the full package product is available to ship. Don’t miss these events!!!  Registration is limited, so get in now and mark your calendars!”

If you’re in Phoenix, our Installfest is shaping up to be December 20th. Watch the AZGroups calendar for details.


Sports For Fun and The Lil’ Dribblers Program

1

<

Our youngest son Jace, recently completed his first basketball program. The Lil Dribblers program by Sports For Fun here in Gilbert was a great start for him to learn the fundamentals of any sport, fundamentals that are summed up well in the Sports For Fun mission statement:


“The Mission of Sports for Fun is to promote and maintain a wholesome, healthy and educational coed sports program design for kids.


Sports for Fun will accomplish these enduring principles by building upon the foundations of honesty, character, teamwork and sportsmanship.”

Jace and I had a blast. Not only did Jace learn the values put forth in the mission statement, he learned how to dribble, shoot, and pass, made new friends, and got to bond with his Dad (which is priceless for me).

Being as little as he is (turning 3 next month) the program had gear for his tiny skill level (e.g. short hoop, small basketballs) as well as gear for the older kids (the program is for 3-5 years old). If you have a 3-5 year old, put your kid in the Lil Dribblers program it’s on Saturday mornings, is six weeks, and is an experience that you definitely want to share with your child.


Instant Messaging Rules of Engagement

0

Messenger

Over at WebWorkerDaily there is a post on how instant messaging can make you more productive.  After reading the post and contemplating it a bit…I agree. For me, IM productivity boils down to self discipline. 

After thinking about the post for a while I discovered that I unknowingly have a few silent rules for IM engagement (when I engage), and IM pet peeves (when others engage and don’t follow my silent rules):

When to IM

  1. When the question I’m asking can be answered in 2 sentence or 2 responses.
  2. When a question is too technical via phone and could be better worded through a pre-thought out IM initiation.
  3. When technical information can be utilized by the IM client (e.g. sending a link versus trying to spell it out over the phone).
  4. When you want to document the conversation for legal purposes or future reference (if the IM client logs conversations).
  5. When the recipient is not in the building and you need to share your desktop with them because a visual is better than a long winded, confusing description (if the IM client allows desktop sharing)

When not to IM

  1. When the IM subject is controversial or emotionally charged (in a bad way). Obfuscation of the text can only make things worse.
  2. When what you are going to write would get you in trouble when viewed by others (e.g. somebody is standing over the recipients shoulder or IT logging it).
  3. When the person sits within 20 feet of you (duh?).

A couple Instant Messaging Techniques

  1. Do an initial IM to remove the element of surprise for a complicated question or issue, give the receiver 30 seconds to mull it over. Follow up with a phone call.
  2. Send technical information (Web link) and call immediately.

 

What are your Rules of IM Engagement or techniques?


Debug & automate any modal or modeless dialog with SWEA

0


Understanding how to get at the controls in a modal dialog box when using SWEA is something I never had to worry much about in the past; the SWEA example code took care of all of those that I had previously encountered. Recently I needed to automate a “Choose file’ dialog, and since there was no example, I had to buckle down to figure out how to get at the controls in that dialog. To understand the controls of this particular modal dialog, and also wanting to make sure I could handle all others I encountered in the future, I wrote some code that would dump all relevant things available in SWEA’s DialogControl class when the DialogActivatedEventHandler was fired. By doing this, when a dialog was presented, I was able to scrape all the control information out of the modal dialog. The following code in my explorerManager_DialogActivated method did the scraping and dumping:


if (this.Debug == true)
{
    Console.WriteLine
        (“–Modal dialog info——————–“);
    Console.WriteLine
        (“Modal Dialog Title: “ + dialogScene.Title);
    Console.WriteLine
        (“Modal Dialog ClassName: “ + dialogScene.ClassName);
    Console.WriteLine
        (“Modal Dialog DialogHWND: “ + dialogScene.DialogHWND);
    Console.WriteLine (“Modal Dialog XML: “ + dialogScene.Xml.ToString());
    Console.WriteLine
        (“—————-Controls in Modal dialog—————–“);
    foreach (DialogControl dlgCtrl in dialogScene.Controls)
    {
        Console.WriteLine(“Control name: ‘”
            + dlgCtrl.Name + “‘ is a type of: “ + dlgCtrl.GetType().ToString());
    }
    Console.WriteLine(“—————————-“);
}


With my new addition as noted above, when the DialogActivatedEventHandler was fired the explorerManager_DialogActivated method was invoked which resulted in the following informational console dump about my modal dialog:

—Modal dialog info——————–
Modal Dialog Title: Choose file
Modal Dialog ClassName: #32770
Modal Dialog DialogHWND: 5047980
Modal Dialog XML: <Dialog HWND=”5047980″ Title=”Choose file” Class=”#32770″><Window HWND=”7014084″ Title=”Look &amp;in:” Class=”Static”></Window><Window HWND=”5441378″ Title=”SMSIMG (C:)” Class=”ComboBox”></Window><Window HWND=”5900158″ Title=”” Class=”Static”></Window><Window HWND=”5572502″ Title=”” Class=”ToolbarWindow32″></Window><Window HWND=”8914906″ Title=”” Class=”ToolbarWindow32″></Window><Window HWND=”2623410″ Title=”” Class=”ListBox”></Window><Window HWND=”9963366″ Title=”” Class=”SHELLDLL_DefView”></Window><Window HWND=”7735164″ Title=”FolderView” Class=”SysListView32″></Window><Window HWND=”6293452″ Title=”File &amp;name:” Class=”Static”></Window><Window HWND=”6620914″ Title=”” Class=”ComboBoxEx32″></Window><Window HWND=”7735112″ Title=”” Class=”ComboBox”></Window><Window HWND=”4196138″ Title=”” Class=”Edit”></Window><Window HWND=”58918660″ Title=”Files of &amp;type:” Class=”Static”></Window><Window HWND=”14419712″ Title=”All Files (*.*)” Class=”ComboBox”></Window><Window HWND=”3016576″ Title=”Open as &amp;read-only” Class=”Button”></Window><Window HWND=”7276400″ Title=”&amp;Open” Class=”Button”></Window><Window HWND=”10946288″ Title=”Cancel” Class=”Button”></Window><Window HWND=”6227962″ Title=”&amp;Help” Class=”Button”></Window><Window HWND=”7079840″ Title=”” Class=”ScrollBar”></Window></Dialog>
—————-Controls in Modal dialog—————–
Control name: ‘Static_0’ is a type of: SWExplorerAutomation.Client.DialogControls.DialogStatic
Control name: ‘Static_1’ is a type of: SWExplorerAutomation.Client.DialogControls.DialogStatic
Control name: ‘Static_2’ is a type of: SWExplorerAutomation.Client.DialogControls.DialogStatic
Control name: ‘Edit_0’ is a type of: SWExplorerAutomation.Client.DialogControls.DialogEdit
Control name: ‘Static_3’ is a type of: SWExplorerAutomation.Client.DialogControls.DialogStatic
Control name: ‘Open as read-only’ is a type of: SWExplorerAutomation.Client.DialogControls.DialogButton
Control name: ‘Open’ is a type of: SWExplorerAutomation.Client.DialogControls.DialogButton
Control name: ‘Cancel’ is a type of: SWExplorerAutomation.Client.DialogControls.DialogButton
Control name: ‘Help’ is a type of: SWExplorerAutomation.Client.DialogControls.DialogButton
———————————————————


After extracting the control information I needed for my test from the console dump, in the same explorerManager_DialogActivated method I created a condition for the “Choose File” modal dialog that inserted a file location/name and then clicked the “Open” button:

//Manage the ‘Choose file’ dialog box
if (dialogScene.Title == “Choose file”)
{
if (dialogScene.ControlExists(“Edit_0”))
{
dialogScene.DialogEdit(“Edit_0”).Text =
            this.ChooseFileLocation;
}
if (dialogScene.ControlExists(“Open”))
{
dialogScene.DialogButton(“Open”).Click();
}
Check the automation of another modal dialog box off my list! …and even better, I’m now setup to dump information about any others that might cross my path.


Proper Use of the Sleep Method in Automation

1

zzz

Very often I see automators using the sleep method in their Web browser automation scripts. This makes me cringe and sigh (a heavy sigh that is). Improper use of the sleep method is simply a bad idea.


For example, take the following pseudo-code:


link.click( )
sleep(30 seconds) #waiting for flaky frame to load
verify.html(“My text in frame”)


Siiiigh… This pattern plain sucks. For two reasons in particular:



  1. If the page loads in 1 second, you just wasted 29 seconds.
  2. If the page loads in 31 seconds, your script just broke, or the test failed.

From my personal experience, people typically write this evil code because:



  1. The way the automation library ties into the browsers “the page has completed loading” events are unreliable so they are left with sleep to ensure the page is really there before testing continues.
  2. They’re in a hurry, debugging takes too long, and providing an average sleep fixes the issue (temporarily) 

I’d like to help you out with #1; I’ll leave #2 up to you.


When detection of completion events isn’t reliable within a framework, you need to come up with your own type of detection. What you’re left with when the “the page has completed loading” event has come and gone is verification of object(s) on the page to see if the page is there. However you can’t just sleep and then verify, instead of sleep I recommend a power nap instead. A power nap method could like this: 


powerNap(time sleepTime, HTMLobject objectToWaitForName)
{
    NapTimeStart = Time.now

    while not (HTMLobject.exists)
    (
        TimeGoneBy = Time.now – NapTimeStart

        if (TimeGoneBy >= sleepTime )
        (
            break
         )
         else
        (
            sleep(1 second)
         )
    )
}


With this loop you will only waste a maximum of 1 second once your HTML object is actually found on the page. Your automation code/test could then look something like this:


link.click( )
powerNap(30 seconds, lastObjectThatLoadsOnThePage )
verify.html(“blahblah”)


Now this method isn’t guaranteed to work, however your success % is going to go up dramatically. The caveat to this approach is the fact that just because the HTML object exists doesn’t mean the entire page is there. If you are attempting to do something with that object and it relies on other objects that aren’t loaded yet, then you might get an error (e.g. click a link that has a reference to a method in a .js include file that isn’t fully loaded yet). To avoid this you’ll want to pick an object that you know loads last for the page and sometimes that can be tricky. You have to play with it a bit, but if you put the time in now, you’ll get rid of those wasteful and sometimes test breaking sleeps.


As an added bonus you could take the example method provided and go one step further to wait for multiple HTML objects to be present before moving on. With a method like that you could verify the existence of several HTML objects on the page without using assert or verify methods (much like SWExplorerAutomation’s Scene object).


In summary, without looping use the sleep method for debugging and nothing more, instead of sleep take a powerNap.


Post navigation