Monday, April 28, 2008

Vista's XPS Viewer needs IE as default browser

This is annoying, I went to open an XPS document that someone at Microsoft kindly sent me in request to a query I had. A quick Google showed me that I should be able to open it with Vista's built-in XPS Viewer. However when I try to, I find it opens Mozilla Firefox with this message:

XpsViewer

The only problem is that if I hit OK, it opens another tab in Firefox with the same popup, ad infinitum.

Making IE my default browser solved the problem, but if the darn things is dependent upon IE then it should just try opening in it in IE, regardless of what my default browser is, grrrr ... I checked for a Firefox add-in, but couldn't find one, so I ended up making IE my default browser for the 2 minutes it took to open and print the document.

In case you're interested I develop cross-browser apps so I need multiple browsers on my PC, and I prefer to use Firefox for random links I open because of the excellent NoScript add-in, which prevents my PC getting reamed by dodgy code on the websites I visit (which can sometimes happen on even the most reputable sites).

Sunday, April 27, 2008

Do you know your IDE?

Had a great Code Camp Oz session this morning from Mahesh Krishnanm about shortcuts in the Visual Studio IDE. Unfortunately his presentation was biased towards C# (which was probably good for the audience there). Fortunately the VB team blog has some great Did You Know posts that explain new Visual Studio features for VB2008. Check them out, there are some great ones there, like the ability to bring back snippet highlighting when you want to edit the snippet.

Saturday, April 26, 2008

Photos from Code Camp Oz

There are some great photos from CCOz on Flickr. I even managed to find one on Mitch's blog that showed me ... I'm the bloke slouching inside the big yellow ellipse (thanks to the Expression Design eval I picked up).

CCOz

 

It has been great meeting so many friendly and helpful people and Twitter has had some very lively threads on it. If you want to check out what is happening realtime (or afterwards), look for the ccoz tag on Hashtags.

Jeff Wharton challenged me to do a presentation myself, I guess because of my smart aleck comments from the peanut gallery. I'd like to do one on XML literals in VB9 having just spent the last month working on our branching pathways diagram code for Elcom's Learning Management System and being up to my elbows in it (and Prototype).

Code Camp Oz 2008

I'm really enjoying being here. We've had some great sessions from favourites like Greg Low (SQL Server 2008 and how to present at events) and new guys like Shane Morris (User eXperience). Right now Paul Stovell is giving me a headache trying to keep up with his Reactive Programming via SyncLINQ.

It's also been great discussing things with guys from Readify, SSW, and the tons of other companies represented here, I even met the AFP alumni from Canberra.

Coming out of this I am sure that Craig and I will be raving about Windows Server 2008 Hypervisor and looking for greater use of VMs internally (as well as SQL clusters) and pushing for more emphasis on UX in the dev team at Elcom, which should make Anthony happy!

Next up, TDD of DotNetNuke Modules by Philip Beadle ... very relevant to us.

Tuesday, April 22, 2008

Second ALT.NET conference

Ben Scheirman has a good couple of posts on the ALT.NET open conference that ran just after the Microsoft MVP Summit. Not being an MVP I wasn't anywhere close to going, so it is nice to see this sort of photo intensive report ... looks like fun and I'm hoping Code Camp Oz 2008 can be as productive for me.

Monday, April 14, 2008

How aware are you?

Courtesy of Henrik Mårtensson comes this little gem of a test:

I got the number of passes (thirteen) but completely missed the surprise inclusion.

Code Camp Oz 2008

CodeCampOzLogo

I'm all set to go to Code Camp Oz 2008 but I'm wondering who else I'll know there. Craig Bailey and I will be sharing a car to/from the event (we're both staying in Wagga Wagga city centre).

Personally I'm most looking forward to Greg Low's workshop on presenting at events, Philip Beadle's TDD 'in the trenches' session and Luke Drumm's swashbuckling DLR session. It will also be interesting to grill the MVP's that come to Code Camp Oz on the back of the MVP Global Summit in Seattle.

Finally, what is it with the Code Camp Oz logo? I'm going to have to see if I can carve out a spare couple of hours to improve upon it ...

Tuesday, April 08, 2008

Annealing a sword

OK, here is a good reason why I am not a swordsmith:


In case you're wondering what he's doing, it's annealing, the process of softening the metal so it can be re-worked (in this case ground).

Monday, April 07, 2008

Drinking the Watir

I've been using Watir recently to help automate integration tests for some of our client projects. Moving from a Windows XP to a Windows Vista environment proved more troublesome than I had realised it would be, however I now have my test environment all working and last Friday night realised some value from the automated tests as they (very) quickly ran through a complicated series of steps to prove an important piece of client functionality after a server upgrade, thus allowing me to get home earlier than expected.

For the benefit of my fellow Elcomites I'm going to document the steps required to setup Watir on a brand new Vista machine.

Pre-Requisites

Firstly, as I pointed out previously, you can't have Office Groove 2007 installed. Also, you need to be able to run as Administrator on your local machine.

Install Ruby

You will want Ruby 1.8.5, and fortunately there is a one-click installer for Windows, which you just need to download and run. By default this installs under C:\Ruby\ and includes RubyGems (which makes installing other Ruby stuff dead easy).

Having done this, let's test whether we have a fully working Ruby installation by running irb (the interactive ruby shell). Open a command window and type the following:

C:\Users\angus>irb

In Vista this prompts you with the message "An unidentified program wants to access your computer", identifying the program as ruby.exe with the option to Cancel or Allow. Obviously we want to Allow this (note: you won't get this message if your UAC settings are different to mine). It will then open a new command window with the following text shown:

irb(main):001:0>

Just getting this far tells us that Ruby is installed. Close both the command windows you have open.

Install Watir

Installing Watir is as simple as starting another command window and then typing in the following command:

C:\Users\angus>gem install watir

We then want to do the same for the windows-pr library that provides access to various Win32 APIs and is needed in Vista to run Watir.

C:\Users\angus>gem install windows-pr

We can then open irb again and see if we can test Watir from the command-line!

irb(main):001:0> require 'watir'
=> true

This tells Ruby that we are using the Watir namespace (like Imports in VB.NET or using in C#.NET)

irb(main):002:0> include Watir
=> Object

This actually mixes in the Watir library with our code (essentially making it available to us).

irb(main):003:0> ie = Watir::IE.new
=> #<Watir::IE:0x4a50e70 @url_list=["about:blank"], @ole_object=nil, @rexmlDomobject=nil, @logger=#<Watir::DefaultLogger:0x4a50d94, @progname=nil, @logdev=#<Logger::LogDevice:0x4a50d30, @mutex=#<Logger::LogDevice::LogDeviceMutex:0x4a50d08, @mon_entering_queue=[], @mon_count=0, @mon_owner=nil, @mon_waiting_queue=[]>, @dev=#<IO:0x32d7320>, @shift_size=nil, @shift_age=nil, @filename=nil>, @formatter=nil, @default_formatter=#<Logger::Formatter:0x4a50d58 @datetime_format="%d-%b-%Y %H:%M:%S">, @level=2>, @activeObjectHighLightColor="yellow", @down_load_time=0.413, @speed=:slow, @typingspeed=0.08, @page_container=#<Watir::IE:0x4a50e70 ...>, @ie=#<WIN32OLE:0x4a50e0c>, @error_checkers=[], @defaultSleepTime=0.1>

Whoa! Did you see that Internet Explorer window open up? This is the litmus test for Watir, this line opens a new IE window and assigns a reference to it to the ie variable.

irb(main):004:0> ie.goto('http://ww.google.com.au')
=> 2.206

We can now start playing with the open window, firstly by browsing to the Google (Australia) website ...

irb(main):005:0> ie.text_field(:name, 'q').set('Elcom Technology')
=> true

... entering a search term ...

irb(main):006:0> ie.button(:name, 'btnG').click
=> 1.045

... and then actioning the search. There is a lot more that Watir allows you to do, but this is a good start!

Install Aptana Studio

Editing Ruby scripts in Notepad is a chore, and whilst Visual Studio will eventually support Ruby the current Sapphire in Steel IDE doesn't excite me (the free version is still just an alpha release). Enter Aptana Studio, which has absorbed the old RadRails IDE project and which has a stable, and free, Community edition. Amongst other features this gives us Ruby colour coding and an integrated test runner - great for Watir!

Aptana Studio is built atop the open-source Eclipse IDE for Java. This means that other Eclipse plugins are also available. It also means your machine will end up running Sun's Java. It comes with a Windows installer to make things easy and is a free download.

Once you have run the installer you will want to edit the properties of the studio exe so that it runs as administrator.

Aptana

You can now run Aptana Studio and choose to install the Ruby on Rails plugin from the start page:

Aptana Start

Create your first test script ... here is that sample we ran before, but this time the way you might typically create a test file:

##########################################################

# Integration Test Sample

##########################################################

# This demonstrates the skeleton of an integration test.

##########################################################

 

require 'rubygems'

require 'test/unit'

require 'watir'

require 'watir/testcase'

 

class IntegrationTest < Watir::TestCase

    # Runs before each test case, e.g. used to specify login details.

  def setup

    super

  end

 

  # Runs after each test case, e.g. could be used for logging, etc

  def teardown

    super

  end 

 

  # always the first test as it sets up the browser object

  def test_first

    # Create a new browser instance (running this opens IE)

    @@ie = Watir::IE.new

    @@ie.speed = :fast # comment this line if you want to more easily see what is happening

    @@ie.maximize

  end

 

  # reproduce our irb test

  def test_google_elcom

    @@ie.goto('http://www.google.com.au')

    @@ie.text_field(:name, 'q').set('Elcom Technology')

    @@ie.button(:name, 'btnG').click

  end

 

  # always the last test, closes the browser object 

  def test_end

    @@ie.close

  end

end

 

By right-clicking in that file and choosing Run As > Test::Unit Test (see below) you can run the tests within the Aptana test runner.

RunAs

That gives you a nice test result tree that shows exactly where things fall over (when they do).

You are done! Now I am pretty sure that people are going to find problems I haven't documented. If you do, then please feel free to add a comment with your difficulty and I'll update this main post with the solution.

8 little known things about Falkayn

Anthony tagged me with this old meme. Here are the 'rules':

  1. Each player starts with eight random facts/habits about themselves.
  2. People who are tagged need to write a post on their own blog (about their eight things) and post these rules.
  3. At the end of your blog, you need to choose eight people to get tagged and list their names.
  4. Don’t forget to leave them a comment telling them they’re tagged, and to read your blog.

So here are 8 little known things about me:

  1. World traveller
    My Dad's work always took him around the world. That led to my family living in New Zealand, the USA, Canada, the UK and back home in Australia. By the time I was 10 years old I had travelled around the world roughly 5 times (and I've done it another 4 times since then).

  2. Sailor
    In 1986 I did the Sydney to Hobart yacht race. As one of the few Category One ocean races in the world it was a challenge, especially as I was just a teenager. I sailed with my Dad on his boat Dreamtime, and he made sure I trained properly. So it was a half mile swim every morning before school that year, a training sail midweek and then weekend ocean races, with me completing the mandatory two overnight races in the lead up to Boxing Day.

    It was a tumultuous 4 days with gale force winds, rough seas, a crew that was only half experienced and cold, wet conditions. As my Dad had intended it was a watershed moment for me - I ran the mainsheet and at one stage we were in a death roll whilst skimming down the Tasmanian coastline, and I had to ignore panicked commands from my fellow crew (men in their 40s!) and just listen to what my skipper (Dad) was telling me to do.

    I survived that race (and the return sail), but it was quite a few more years before I could be convinced to start ocean racing again. However, I helped my Dad move his new boat, One Step Ahead, from Pittwater to Sydney Harbour a few weekends ago, and you know what? It felt pretty good being out on the water again, and it's not many guys who can say they've "sailed with my father, man and boy, these twenty years".

  3. Bent middle fingers
    The last joint on each of my middle fingers is bent outwards slightly. It's something to do with the angle of the joint because they seem to straighten up when they bend. Weird, huh?

  4. Hate sandals
    Sorry but closed shoes are what I prefer - even on hot days. Having said that, living closer to the beach has caused me to actually buy a pair of thongs.

  5. Love to cook
    It seems to be something about the physicality of cooking, along with the appreciation for good results, that makes me love cooking. I'm not a fast cook, but there is nothing more relaxing after a hard day's work than taking an hour or two to turn out a nice meal. Of course you sometimes have to knock up something edible out of minimal ingredients with 20 minutes notice - that's definitely less fun.

  6. Chlorine blind 
    One family holiday in Spain when I was very young my Dad tried to help me learn to swim with my eyes open underwater. It was a pretty successful day, with me triumphantly announcing I could now swim underwater. However I woke up the next morning unable to open my eyes due to an allergic reaction to the (massive) amounts of chlorine the hotel had dumped in their pool. I've been a firm believer in swimming goggles ever since!

  7. Skiing a white Christmas 
    I spent the bulk of my childhood living in the UK, and one of the (few) nice side-effects of that was my family being able to take holidays in Europe very affordably. The best ever holidays turned out to be ones we had around Christmas when my Dad took us to Lech, Austria for skiing trips (it wasn't quite so exclusive then). We would go for two weeks at a time, and spend the first week re-acquainting ourselves with the sport and the second week revelling in the fantastic snowfields of the region.
    100259289_458867cb28 
    My fondest memory is of getting woken up just before midnight on Christmas Eve to gather at the local church, sing Carols and watch the midnight torch run, local ski instructors snaking down the mountain in lines, carrying burning torches to light up the dark. There's something spectacularly appropriate about all that fatty Christmas food that suits cold, snowy places - somehow 35 degree Centigrade sweaty Christmas days in Oz better suit cold seafood and salads.

  8. Swordsmithing
    Back in my university days I hung out with a bunch of friends who were all into roleplaying games, and hence swords, armour and pretty much all sorts of historical military goodies. We were also into martial arts, especially Japanese ones (I did Judo). One of the guys had a book on Japanese swordsmithing, which we pored over. I had topped my year at school when it came to Design & Technology, and I fondly remembered standing over the forge bashing out some metal.

    I remember dreaming what I would like to do in the future and imagining the perfect blend of natural environment, zen-simple lifestyle and heady success. For me that seemed to be an Austrian chalet on a mountain in New Zealand, with a fully kitted out forge in the back and international customers waiting for one of my original katanas ... since then I've had a friend actually take up blacksmithing, specialising in historical reproductions of weapons (spears, swords, etc). As is often the case the reality turned out to be far more prosaic and boring than you imagine.

So there's 8 (reasonably) useless facts about me. In the spirit of this whole meme I'm going to tag eight other bloggers to follow on: