IETester - Multiple versions of IE in one place

by David 6/10/2008 11:32:00 AM

Testing your site in the various different flavours of browser is by far one of the most tedious and hit or miss experiences every web developer will face.  This is probably truer of IE than most.  The only real way to test properly is to have multiple machines (or VMs) with original installs of each version.

For quick testing as you develop however, wouldn’t it be great if you had a desktop app that emulated all the different versions?  Well this is what IETester claims to do.  I’ll admit that I’ve not tested it a lot, but a quick browse through some sites that I know have IE 5.5 issues seems to suggest it’s doing it’s job.  IETester claims to emulate not only the rendering engines of IE8 beta 1, IE7, IE6 and IE5.5 but also their JavaScript engines.  It’s currently only in Alpha but if they manage to pull of what they’re claiming this is a killer web dev tool.

On a similar theme another impressive, but slightly less useful testing tool can be found in http://browsershots.org/ - given a URL it will produce screenshots of the site on a dizzying number of browser versions and platforms.  There’s no emulation here, but rather a network of physical machines each installed with a different browser version.  Whilst impressive, it has drawbacks; you only get a screenshot of one page in your site, that page has to be public and it can take a while to process.  It’s still a cool project though.

Vista Gadgets Part 1 – Just the facts Ma’am

by David 6/3/2008 6:09:00 PM
Writing a simple gadget for Vista’s sidebar is actually very straightforward.  All gadgets are essentially HTML/CSS and JavaScript and hosted by IE.  In this first part of a series on developing Vista gadgets I’m going to show you the bare essentials to get something (not much) to appear in your sidebar.  In future parts I promise things will get a little more interesting…

  1. Open Windows Explorer and browse to C:\Users\ [User] \AppData\Local\Microsoft\Windows Sidebar\Gadgets

  2. Create a folder called jacksTest.gadget
    The .gadget suffix is essential, without it you won’t see your gadget listed in Vistas Add Gadget dialog.

  3. Create a file called gadget.xml in your new folder
    This is the gadget manifest; the filename is essential.  Your manifest should look like this:

    <gadget>
      <name>jacksTest</name>
      <version>1.0</version>
      <author name="jacksBag">
        <info url="www.jacksbag.com" />
      </author>
      <copyright>&#169; Jacks Bag Limited.</copyright>
      <description>
        A simple and some might say, pointless gadget.
      </description>
      <hosts>
        <host name="sidebar">
          <base type="HTML" apiVersion="1.0.0" src="jacksTest.html" />
          <permissions>Full</permissions>
          <platform minPlatformVersion="1.0" />
        </host>
      </hosts>
    </gadget>


    The name, version, author, etc elements are what gets displayed when you’re selecting gadgets to add to your sidebar in Vista.

  4. Create a file called jacksTest.html
    This is the file that will host your gadget’s UI.
    This can be called anything you like so long as it matches the src attribute in the manifest as highlighted above.  As a standard I’d say it’s a good idea to name this file after your gadget.

  5. Add the following HTML to the file and save it:

    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=Unicode" />
        </head>
        <body>
            Hey Jack!
        </body>
    </html>

  6. At this point you now have a “working” gadget.
    If you click the + button on the sidebar, you’ll see jacksTest listed as a gadget and adding it will display a small white slither in the sidebar where most of the text is hidden.



    Obviously this looks crap so we’ll get a little more fancy, but for now leave the crapo jacksTest on the sidebar.

  7. Create a folder called css, within the jacksTest.gadget folder.

  8. Within the new folder, create a file called jacksTest.css and add the following content:

    body
    {
        margin: 0;
        width: 130px;
        height: 50px;
    }


  9. Return to jacksTest.html and add a reference to our new style sheet by adding the following within the <head></head> section:

    <link type="text/css" rel="stylesheet" href="css/jacksTest.css" />

    Make sure everything is saved.

  10. Click the + button on the sidebar again and add jacksTest once more.  You should see something like this:

    Much better!

Now I’ll admit, this is not that exciting but there are still some important lessons to be learnt even as this early stage:

  • Each gadget is independent, hence the crapo gadget we already had on our side bar has not picked up the addition of a style sheet.  As a note of interest; if at this point you logged off/restarted your computer, when windows and the sidebar reloaded the crapo gadget would pick up the changes.  We can presume from this that the source is never copied anywhere but is instead loaded into memory once for each instance of a gadget.
  • Whilst developing a gadget it pays to work on the files in the AppData folder as it makes tweaking and testing quick and simple.  You can make a change and just re-add the gadget to your sidebar to test its effect.
  • Because of the previous reason, it’s a very good idea to take a copy of your work from the AppData directory and save it else where at the end of a dev session.  If you accidentally choose to uninstall your gadget via the sidebar UI all your hard work would be deleted.
  • Folder structure – its good practise to keep each type of component separated, such as creating a separate css directory for your style sheets.
  • Naming – it’s good practise to give related components the same base name, so it’s clear that jacksTest.html and jacksTest.css are related.

You can download the files for this example here:  jacksTest Gadget Part 1.zip (1.52 kb)

In Part 2 we’ll look at adding some functionality to our gadget and the use of settings.

Off-Topic: Word Of The Day - Pentasyllabic

by David 4/21/2008 10:13:00 PM

Pentasyllabic
 - Having five syllables.

Things you learn watching University Challenge...

WPF – First Impressions

by David 4/20/2008 5:53:00 PM

Over the past week I’ve been getting myself up to speed with the latest emerging .Net technologies namely WPF, Silverlight and LINQ.  By emerging I mean; they’ve all been around for a while now in various forms, but I’ve only just got around to reading up on each of them in any detail.

WPF – Windows Presentation Foundation (formerly known as Avalon) is probably best described as the WinForms replacement built entirely on .Net components.  Much like other new Microsoft technologies of late, this is not simply the introduction of some new features - this is a ground-up re-write.  As such there is much to discuss, I’m just going to touch on some of the fundamentals.

Breaking the mould - DirectX
If you create a WinForms application ultimately the core controls and the rendering of them backs onto some pretty old Windows components; User32.dll and GDI/GDI+ (this division dates back to the days of Windows 3.0).  For the most part, if creating a .Net WinForms application, you don’t know or care about either of these components because .Net wraps them.  But if you wanted to break out of the standard Windows button and make it look a little more interesting the core controls weren’t very extendable and you would very quickly find yourself getting involved with drawing every element using a lower-level model and handling all the events yourself.  All the while the computers primary CPU would be hard at work drawing everything.

A fair bit has changed in the last 15 years, not least the introduction of extremely powerful graphics cards.  WPF pushes the job of rendering the UI onto the GPU via DirectX, where it can take advantage of the features a graphics card brings to the table like onboard shaders and anti-aliasing.  This makes delivering slick UI’s, such as Vista, much easier to deliver.  The core components (buttons etc) have been re-written from the ground up in pure .Net making them completely extendable and customisable in a way simply not possible before.

The Glue - XAML
Whilst all this rendering guff is interesting cocktail party talk, for your every day business developer it doesn’t amount to whole heap of beans.  The big change is the introduction of XAML (eXtensible Application Markup Language).  XAML is described as “a declarative XML-based language created by Microsoft which is used to initialize structured values and objects.”  What does this mean?  Well let’s take a look.  (The XAML code below is all that’s needed to render the Window below it.)



The first thing that may strike you if, like me, you’ve spent a lot of time in the world of ASP.Net, is the mark-up looks pretty familiar.  And it should, both ASP.Net and XHTML are also “XML based” languages.  As such XAML feels remarkably natural.

You may also note the lack of co-ordinates.  Unlike WinForms, you’re strongly incentivised away from using co-ordinates to layout your UI which can make catering for different resolutions and window re-sizes tricky.  Instead a flow layout is encouraged which if you’re familiar with CSS and the use of DIV’s to layout your web-page will again feel incredibly natural.

The similarities between Web and WPF don’t stop there.  Styles in WPF allow you to abstract the formatting of an applications elements to a separate resource file.  You can create named styles or target particular elements to add consistent padding to all buttons in your application for example.  If this sounds a lot like CSS, well, that’s because it is.

There is no doubt that much of XAML/WPF has been inspired by standards created in web development.  When ASP.Net first appeared on the scene it was often said to have brought the WinFoms event driven model of development to the web world.  It could be said that with WPF, the favour has been returned by bringing the Web layout and the separation of design and implementation to the Windows world.

One Pony – Many Tricks
Although XMAL and WPF are intrinsically linked, XMAL is a common ingredient that once mastered can be used many times over in the world of .Net.  As the definition said; XAML “is used to initialize structured values and objects” – so whilst in the case of WPF it’s used to initialize UI objects, it can be used to initialize any kind of object.  If you look under the hood of WF (Windows Workflow Foundation) or Silverlight (Microsoft’s answer to Flash) guess what.  You’ll find XAML describing the show.

Further more XMAL will run directly in both IE and Firefox (2.0+).  Take a look at this Font Picker example.  (You’ll need the .Net 3.5 Framework installed).

http://blogs.msdn.com/text/attachment/592777.ashx

[Related blog post: http://blogs.msdn.com/text/archive/2006/06/20/592777.aspx]

If you view the source of main link above you’ll get pure XAML - that’s the only code involved.  Under the hood the .Net CLR is parsing the XMAL and generating the UI hence you (the client) need to have the framework installed.  (Silverlight overcomes this, but that’s a story for another day

 

All in all, I’m extremely impressed and pleasantly surprised with WPF and XAML.  I’m excited at the deep XAML integration across the .Net platform and the possibilities that it opens up.  I’ll leave you with a geeky observation...

If you’re an exciting, fly by the seat of your pants kinda guy like me, you’ll find it interesting it to note the namespaces involved.  Ya classic Windows Forms controls all appear in the System.Windows.Forms namespace.  Whilst the new WPF controls all exist in System.Windows.Controls i.e. these are the controls that Windows now uses.  It’s quite a statement.

Tags: ,

WPF

My Sync’d Up Life

by David 4/6/2008 5:39:00 PM

For many a year now my personal email, address book (Yahoo) and calendar (Google) have been 100% web based.  For the most part this suited me, my primary goal being to always be able to get at my info where ever I am.

In recent months my life has changed somewhat, I’ve jacked in the permanent job and have set about setting up my own consultancy; Jacks Bag.  I’ve bought myself a laptop, on which I do a lot of work and carry around a fair bit.  That’s mixed with spending time on short-term contracts based out of client offices, using their equipment.  To add to the mix I’ve also entered into the world of the BlackBerry, which so far is a pretty nice place to be.

These 3 things combined have meant I now have 3 different places I’d like all of my information to be all of the time;

  1. The Web (in a client’s office, at a friend’s, in a net café etc)
  2. My Laptop (working from home, on the move)
  3. My BlackBerry (non of the above)

There’s little doubt that the word “sync” was involved in the solution, but to make things a little more challenging I wasn’t prepared to change any of my web based providers.  Yahoo has the best web based mail client with the best features (disposable email addresses are excellent) and Google offers the best Calendar.

Mail
Yahoo offer POP3/SMTP access your mail, so configuring that with Outlook is easy, the key is to check the “Leave a copy of messages on the server” when configuring it in Outlook.  This means you still 100% mail history available from the web.  Since Yahoo no longer has any size limit on their mail accounts, this is awesome.  To my delight Yahoo also keeps track of what you’ve already retrieved, so you only get a new mail on a Send/Receive.  Perfect.

Yahoo also offers a free BlackBerry push service.  I was able to configure this via my carriers (O2) website really easily.  Being as I’ve already setup Outlook to leave messages on the server, it means I still get a copy of all mail on my BlackBerry as well.  If I download the same mail item in Outlook it get’s marked as read on both the web and my BlackBerry.

Address Book
Yahoo gets more points here; they provide a system tray app called Yahoo Autosync.  Which can provide 2-way sync for your calendar, contacts, tasks and notes between Outlook and the equivalent Yahoo applications should you wish.  I’m just using it to sync my Contacts and it works really well, it sits happily in the system tray and as soon as I change any contact details in Outlook it jumps into action and updates Yahoo.

My BlackBerry’s address book get’s updated using the standard BlackBerry desktop manager on my laptop via Bluetooth whenever the two are close by.  Obviously if I’ve added/updated some contact details to my Blackberry whilst on the move, the desktop manager updates Outlook, which Yahoo Autosync is monitoring, and updates my Yahoo address book.

Calendar
It seems there are a lot of homemade solutions out there for synchronising your Google calendar with Outlook.  I tried a couple of them and nothing seemed as straight forward as I really wanted.  Thankfully Google, fairly quietly, have just released their own Sync app; Google Calendar Sync.  This really is as simple as it gets and works quietly without flaw.

Once again the BlackBerry calendar sync’s via the desktop manager over Bluetooth.


I’ve been running like this for a good couple of weeks now and everything has been running without fault, each component silently doing its thing and keeping me sync’d.  For me, this setup is pretty much perfect although there are a few drawbacks that might bother others:

  • You’ve got to have 2 additional system tray apps running, if you’re really precious about memory this may bother you.
    • Autosync for Yahoo uses about 9mb
    • Google Calendar Sync uses about 4.5mb
  • The Google Calendar Sync app will only sync you’re primary calendar.  If you’re running more than 1 and can’t live without being able to sync them all, you’ll have to look elsewhere for a solution.
  • Your BlackBerry needs regular-ish contact with your laptop to keep everything perfectly up to date.

Happy Sync'ing! 

Powered by BlogEngine.NET 1.3.0.0
Theme by Mads Kristensen