An Original Idea

because all great software begins with an original idea

Archive for the ‘Software Development’ Category

When User Experience doesn’t matter

Posted by anoriginalidea on November 19, 2009

image

I spend a great deal of time preaching the merits of user experience.  Software design is about the end user, not about my preferences as a user of software.

I particularly subscribe to the ideas in Alan Cooper’s work “Face 3” and the book the “Inmates are Running the Asylum”.  This involves researching one’s target market, creating personas typical of that market, then having those personas participate in realistic scenarios, which may or may not involve your software.

I think I’ve learnt the hard way, however, that sometimes designing the ideal user experience can be, frankly, a waste of time.

In a recent presentation, designer Joel Flom relates how designers sometimes create great designs which are gratefully received by the customer, who then proceed to take the design, consider it completely unworkable then place it in a box, never to be looked at again.   So all time spent in design, documentation and analysis is of no benefit to anyone.

Although creating a “world” (via personas and scenarios) that accurately model a user experience, we need to be careful that we do not lose sight of two highly influential factors. 

The first is ensuring that the personas we create truly do reflect the attitudes of our target market.  It’s tempting to create a persona that is a user advocate, that loves our company and wants to form a relationship with it.  This makes me feel warm inside but i don’t think it reflects every persons expectations.  Most people want to do something quickly and easily.  They’re not interested in taking us out to dinner.   Creating an elaborate “UX” for these people can be a waste of time.

The second involves the other stakeholders in the software project.  I’m talking about the analysts, developers, other designers, consultants and marketing that are expected to implement your ideas.  They have opinions too and need to be heard.  If they aren’t then they will either consciously or subconsciously sabotage or modify your grand plans beyond recognition.   

Joel provides 3 thoughts that may help.  Firstly, get a complete picture of the customer experience, not just an idealised one.  Become a student of the business, not just your customer’s business, but your own.  Understand what all the stakeholders want, particularly those responsible for implementing your solution.  Give the customer what they really need, not just what’s “cool”.  Having a more complete understanding of the problem will result in a truly effective solution.

 

 

Links

Posted in Software Development | Tagged: , , | Leave a Comment »

Enabling callto (Skype) in your application

Posted by anoriginalidea on September 30, 2009

image image

You may have noticed that Skype seems to embed itself into Internet Explorer, Firefox and Chrome.  It recognises contacts and phone numbers in the page and provides the ability to call them.

I believe people will expect this kind of functionality in conventional windows applications also.  To assist with this I created a little class that will not only allow calls, but allows a check for the existence of a skype and give the ability to extract the calling applications icon.

Sample Project

The sample winforms project includes the CallTo class and a simple Winforms test form:

image

The form has a textbox and button.   One load, the call button is enabled and give an image.  The button makes the call.

 

Public Class Form1

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim loCallTo As New CallTo
        cmdCall.Image = loCallTo.Image
        cmdCall.Enabled = loCallTo.Enabled
    End Sub
    Private Sub cmdCall_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCall.Click
        Dim loCallTo As New CallTo
        loCallTo.DoCall(txtPhoneNumber.Text)
    End Sub

End Class

 

 

Heres the source of CallTo.vb:

 

Imports Microsoft.Win32
Imports System.Runtime
Imports System.Runtime.InteropServices

''' <summary>
''' This class allows for making callto calls
''' </summary>
Public Class CallTo

    ''' <summary>
    ''' Gets the image.
    ''' </summary>
    ''' <value>The image.</value>
    Public ReadOnly Property Image() As Image
        Get
            If Not Enabled Then Return Nothing

            Dim lsValue As String
            With Registry.ClassesRoot.OpenSubKey("callto\DefaultIcon")
                lsValue = .GetValue("")
            End With

            If lsValue.Contains(",") Then
                Dim lsBits() As String = lsValue.Split(","c)
                Dim lsFilename As String = lsBits(0).Trim(New Char() {""""c})
                Dim liPosition As Integer = Val(lsBits(1))
                Return moGetIconFromExeOrDll(lsFilename, liPosition)
            Else
                Return Nothing
            End If

        End Get
    End Property
    Private Declare Auto Function ExtractIcon Lib "shell32" ( _
ByVal hInstance As IntPtr, ByVal lpszExeFileName As String, _
ByVal nIconIndex As Integer) As IntPtr
    Private Function moGetIconFromExeOrDll(ByVal filename As String, ByVal position As Integer) As Image
        Dim hInstance As IntPtr = Marshal.GetHINSTANCE( _
           System.Reflection.Assembly.GetExecutingAssembly.GetModules()(0))
        Dim hIcon As IntPtr = ExtractIcon(hInstance, filename, position)
        Dim loBitmap As Bitmap = Bitmap.FromHicon(hIcon)
        Dim loReturn As Image = loBitmap.GetThumbnailImage(16, 16, Nothing, Nothing)

        loBitmap.Dispose()
        Return loReturn

    End Function

    ''' <summary>
    ''' Gets a value indicating whether this CallTo is enabled.
    ''' </summar
    ''' <value><c>true</c> if enabled; otherwise, <c>false</c>.</value>
    Public ReadOnly Property Enabled() As Boolean
        Get
            Try
                Dim loReg As RegistryKey = Registry.ClassesRoot.OpenSubKey("callto", False)
                loReg.Close()
            Catch
                Return False
            End Try
            Return True
        End Get
    End Property
    ''' <summary>
    ''' Does the call.
    ''' </summary>
    ''' <param name="destination">The destination.</param>
    Public Sub DoCall(ByVal destination As String)

        If Not Enabled Then Throw New ApplicationException("Callto is not enabled")
        Process.Start("callto://" & destination)

    End Sub

End Class

 

Download Sample

Posted in .net Framework, Code, Software Development | Tagged: , , , , | Leave a Comment »

A Simple Scroll Controller for Winforms

Posted by anoriginalidea on February 20, 2009

 image

I am currently researching “flick” scrolling for Windows XP and over.  As part of this I need the ability to scroll controls in code.

To do this I have created a wrapper around the scrolling apis to assist with this.

Here’s how to use it for an autoscrolling panel:

 

Dim loScrollIt As New ScrollController(Panel1)

loScrollIt.VerticalScroll(20)

 

Here’s the code:

Imports System.Runtime.InteropServices
Public Class ScrollController

    ' Scrollbar direction
    '
    Const SBS_HORZ = 0
    Const SBS_VERT = 1

    ' Windows Messages
    '
    Const WM_VSCROLL = &H115
    Const WM_HSCROLL = &H114
    Const SB_THUMBPOSITION = 4

    Private Declare Function GetScrollPos Lib "user32.dll" ( _
        ByVal hWnd As IntPtr, _
        ByVal nBar As Integer) As Integer

    'Example: position = GetScrollPos(textbox1.handle, SBS_HORZ)
    Private Declare Function SetScrollPos Lib "user32.dll" ( _
        ByVal hWnd As IntPtr, _
        ByVal nBar As Integer, _
        ByVal nPos As Integer, _
        ByVal bRedraw As Boolean) As Integer

    'Example: SetScrollPos(hWnd, SBS_HORZ, position, True

    Private Declare Function PostMessageA Lib "user32.dll" ( _
        ByVal hwnd As IntPtr, _
        ByVal wMsg As Integer, _
        ByVal wParam As Integer, _
        ByVal lParam As Integer) As Boolean

    'Example: PostMessageA(hWnd, WM_HSCROLL, SB_THUMBPOSITION _
    '                         + &H10000 * position, Nothing)

    Private moControl As Control

    Public Sub New(ByVal controlToScroll As Control)

        moControl = controlToScroll
    End Sub
    Public Sub VerticalScroll(ByVal amount As Integer)
        Dim liHwnd As IntPtr = moControl.Handle
        Dim Position = GetScrollPos(liHwnd, SBS_VERT) + amount

        If (SetScrollPos(liHwnd, SBS_VERT, Position, True) <> -1) Then

            PostMessageA(liHwnd, WM_VSCROLL, SB_THUMBPOSITION + _
                                       &H10000 * Position, Nothing)
        End If

    End Sub

End Class

Posted in .net Framework, Code, Software Development, VB.Net | 2 Comments »

Alright, I admit it, Now I have an iPhone!

Posted by anoriginalidea on January 16, 2009

 

Dear Windows Mobile,

 

By the time you read this blog post, I’ll be gone.  I’m sorry for doing this but you left me no other choice.  I know comes as a bit of a shock to you – especially because things have been going so well.  But I’m sorry – I cant stand watching all those iPhone users giggling in the corridors anymore.  I think you’re swell, but I don’t think we’re right for each other.  First of all, we’re not compatible.  You’re a a bit too clunky and I’ve lost patience.   Secondly, I’m tired of waiting for Windows Mobile 7.  It’s too late isn’t it?

Anyway, I want to try another smart phone.  But you know what?  I still want to be friends.  We had some good times, developing software on the brilliant compact framework.  I’m very sad it has to be this way.  But please, don’t cold boot like last time.  Maybe I could still answer questions on the Compact Framework from time to time.  I still code in .net!  Look I wont even make issue of the fact that I had to buy you a replacement battery.

So, take care of yourself and all the best.

Sincerely

Me

Posted in Comedy, Software Development, iPhone | Tagged: , , | 1 Comment »

Musings about the memory usage of WPF and Winforms Applications

Posted by anoriginalidea on November 23, 2008

Newcomers to Winforms and WPF .net applications are sometimes alarmed about the amount of memory they are shown to use in Task Manager.  

When these applications run in a Terminal Server environment (or Citrix) the memory consumption seems to add up.  I have heard of products that somehow reduce the memory consumption of processes in this environment.   The makers of these products claimed to be able to fit more processes on the one server. I made it my mission to find out how these applications may work.

Minimizing as a Lifestyle

A hint as to how they may work is the behaviour of the application when it’s minimised.  Memory usage definitiely goes down.  When the application is normalised, memory consumption goes back up, but not as much.

For example, with a WPF application with a single window and no controls, according to Task Manager uses 27388K.  On minimise of the application, memory consumption goes down to 3128K.  Normalising the application, the memory consumption goes back to 8306K.

Apparently minimizing the application makes a call to the Win32 api call SetWorkingSet, this is what causes the apparent memory reduction.  Looking at the history of Windows, this behaviour makes sense.  In the Windows 3.1 user interface, minimizing applications was the way a user typically indicated to Windows they were switching to something else.

Something I wonder about is whether this is still appropriate?  Since Windows 95 introduced the Task Switcher, do people still minimise?    Another question.  In the Terminal Server environment, is the call being made when a user becomes idle?  Should it be?

SetWorkingSet(-1,-1)

Microsoft’s documentation of the call indicates that application calls to SetWorkingSet are not necessary, as the operating system will manage the memory as required.   Is this automatic memory management assuming the Windows 3.1 usage pattern? 

Two years ago I created a prototype that called SetWorkingSet when an application had become idle for a certain amount of time.  It seemed to work well, but I had no evidence it helped system performance particularly.

I apologise for the inconclusive nature of this post, but I thought I would put my musing out there in case others had anything to comment.

 

Links

Reducing WinForm Memory Footprint with SetWorkingSet

How much memory does my .NET application use?

WPF Memory Usage

 


Share this post :

Posted in .net Framework, Software Development | Tagged: , , , | 1 Comment »

iPhone

Posted by anoriginalidea on November 15, 2008

“In more bad news for Windows Mobile, Apple shipped more iPhones in the quarter than the total of all handsets based on the Microsoft system, even though their numbers actually increased by 42%.” (See article Apple and RIM tussle for Q4 prizes as smartphones boom)

I’m really sorry, but I don’t think Windows Mobile 6.5 or 7 is going to make any difference, it seems that Microsoft is not going to be able to produce anything compelling enough, soon enough.   I don’t think there’s going to be a “comeback”.

In case you think that the iPhone is all hype and marketing, I have a question for you.  Have you ever tried using one?  I have yet to meet anyone who has had less than a “revelatory” experience using an iPhone. 

I’ve had a great experience developing for the platform (I think the Compact Framework is excellent).

I believe the future of mobile computing is and is going to be huge, but I’m afraid Windows Mobile isn’t going to play a significant role anymore. 

Future handset operating systems will be various, including of course the iPhone and Android.

Other mobile devices such as tablet computers and netbooks will probably continue to run Windows, so I think Microsoft should concentrate their efforts on continuing to ensure relevance on this form factor.

For developers I think the news is all good.  There are great opportunities out their in mobility, if we are willing to “move on” in our choice of development technologies. 

 

Links

Permanent Link to IE6 for Windows Mobile – Better, but not brilliant

The Mobile Spoon: What happens when a Windows Mobile Addict breaks his vow and buys an iPhone?

Apple and RIM tussle for Q4 prizes as smartphones boom

 


Share this post :

Posted in .net Framework, Pocket PC Development, Software Development | Leave a Comment »

Estranged Siblings – Silverlight Mobile and the Compact Framework CLR

Posted by anoriginalidea on November 1, 2008

An illustration that contemplates the cojoined nature of Silverlight and the Compact Framework

 

At PDC 2008 in the session Microsoft Silverlight 2 for Mobile- Developing for Mobile Devices, Amit Chopra revealed some interesting details about Silverlight Mobile that I haven’t seen written elsewhere.

The presentation mainly consists of “here’s Silverlight running on Windows Mobile”.   The interesting bits are at the end.  I dear reader, present these to you here.

 

Compact Framework, small but mighty

The compact framework, is small yet mighty.  (Some may say mighty ugly...by default)

The Compact Framework provides a great deal of rich device integration and sheer programmability. It is a pleasure to create software for.  I even think that Compact Framework based applications have been a reason for customers, particularly in the Mobile Fieldworker areas to adopt Windows Mobile devices.

If you’re a Compact Framework developer like me, you may have been frustrated by the default “yesterday” appearance of the System.Windows.Forms forms engine.  It takes a great deal of work to make forms look good. 

Silverlight, a Framework Apart?

Two frameworks, Silverlight and Compact Framework, so alike, yet so different.

I for one was very excited last year at the thought of a Silverlight (ie WPF) graphics engine being available for Mobile Device development.  I was then saddened to learn that the Silverlight runtime would not be extending the Compact Framework, but would exist in addition to Compact Framework.

This is disappointing news. (I am now showing my disappointed face….beware!) It appears that Microsoft (at the moment) seem determined to give Silverlight minimal access to the device.  This is aligned with the idea that Silverlight is only a competitor to traditional Flash app that runs from a Web page. 

Although this may be acceptable for certain kinds of desktop oriented Silverlight applications, I doubt this is a believable use case for mobile developers.  The power of mobility is not only the ability to access data anywhere, but the ability to talk to the features of the device.

In the presentation mentioned at the outset, there was declaration of the intention to support Webcams, accelerometer and other device features in the future, depending on the support for this on other platforms (eg Windows and Mac). 

So, we are restricted to the lowest common denominator.  You may believe this is for technical reasons.  It isn’t. Because….

Silverlight Uses the Compact Framework!

Diagram of Silverlight Architecture on Windows Mobile

Amit said that the Silverlight runtime for Windows Mobile may be smaller because it may omit certain codecs and it also shares the Compact Framework Clr.    He went on to say that the Compact Framework would be a prerequisite to installing the Silverlight runtime.

A new and nobler purpose for Silverlight Mobile

I give you....Silver-Knight

It’s Microsoft’s belief that targeting Windows Mobile 6.? (Sorry about that WM2003 and 5) and Nokia phones will mean Web users will eschew DHTML and Flash websites for Silverlight ones.  

With the proliferation of device operating systems (particularly that pesky iPhone) I don’t think this is a likely scenario.  Do you?  Well do you?

I’ve I got an idea!  As it’s unlikely Microsoft will backtrack on their “one platform everywhere” philosophy for Silverlight, why not, in addition enable Silverlight as a cutdown WPF for the Compact Framework on Windows Mobile? Microsoft, I know you can!  Doing this would earn the gratitude of all Compact Developers and provide a side benefit to their current Silverlight efforts on Mobile.

Call to Action

If you agree, please add a comment or bookmark this article using the links below, blog about this yourself or email the people at Microsoft.   Amit said they wanted feedback, lets give it!

(BTW Any physical resemblance between Amit and myself is entirely coincidental, so don’t say it)

 

Links

Microsoft Silverlight 2 for Mobile- Developing for Mobile Devices

Amit Chopra’s Blog (Email) – WIndows Mobile Program Mananger

Giorgio Sardo’s Blog (Email: gisardo @ microsoft  com) – Evangelist for Windows Mobile

 


Share this post :

Posted in .net Framework, Pocket PC Development, Silverlight, Software Development | Tagged: , , , , | 3 Comments »

Silverlight Announcements at PDC 2008

Posted by anoriginalidea on October 29, 2008

image

I’m at PDC2008 day 2.  There were lots of announcements, including a first look at the Windows 7 user interface.

There were some really interesting announcements regarding support for Ribbon and Multitouch in WPF and MFC along with quite a few demos of real products using the technology.

I saw a very impressive demo of the “Office Online” product that provides Word, Excel, Powerpoint and Onenote for the web.  What I saw today is far in advance of any other web-based productivity suite I’ve seen before.   They said that some of the functionality was provided by Silverlight.  I’m not sure how much.

Exciting news for me is the Silverlight Tooklit.  This provides 12 new controls:

  • AutoCompleteBox
  • NumericUpDown
  • Viewbox
  • Expander
  • ImplicitStyleManager
  • Charting
  • TreeView
  • DockPanel
  • WrapPanel
  • Label
  • HeaderedContentControl
  • HeaderedItemsControl

 

More information here : http://www.codeplex.com/Silverlight

So does that make Silverlight a “Game Changer” yet?


Share this post :

Posted in Software Development | Tagged: | Leave a Comment »

Windows Azure and it’s implications on Software Architecture

Posted by anoriginalidea on October 28, 2008

image

It’s the first offical day of PDC2008 in Los Angeles.  I’ve just listened to Ray Ozzie’s (pronounced as Ahhh-zeee) keynote on Microsoft’s vision for cloud computing.  I seem to recall something similar being announced at PDC2001, but I’m sure they really mean it this time.

I wondered what Dave Cutler was up to lately.  Apparently he’s helped build “Windows Azure”, previously known under the code name “Project Red Dog”, along with Amitabh Srivasta, an operating system exclusively run at Microsoft Data Centers (“the cloud”).

I think Microsoft have outlined how they intended to provide services in both the traditional “in house” sense, and a hosted sense.   With the Microsoft Online Services (Exchange, Sharepoint, Crm etc) Microsoft hope to provide an alternative for customers who dont have the resources to run their own datacenter.

So what’s this got to do with application architecture? 

Microsoft will be providing hosted versions of all their applications.  Windows Azure provides Microsoft based developers to provide hosted versions of their own applications.   Although platforms such as GoogleApps look really interesting, a platform that allows the hosting of Microsoft technologies without redevelopment is more compelling.

Primarily it seems that the application architecture that would suit this environment best is that of a scaleable SOA or Web based application.  This doesn’t rule out any client architecture particularly, but an asp.net based application would certainly have an advantage.


Share this post :

Posted in Software Development | Tagged: , , | Leave a Comment »

Automatically stretching a Silverlight 2 control on a webpage

Posted by anoriginalidea on June 3, 2008

image

A couple of fun hours were spent trying to get my Silverlight content to resize when the user resized the browser. 

I mean, what’s the point of having your Silverlight content replace HTML if it wont flow and resize when the user resizes the browser? I want my Silverlight content to take up the whole browser frame.

The Html Code

You’d think this would be the default behaviour for an asp.net tag definition like this:

<asp:Silverlight ID="Xaml1" runat="server" Source="~/ClientBin/TechnologyOneCrm.xap" Version="2.0" Width="100%" Height="100%" />

 

Sadly this is not enough.  Your silverlight sits there in a dumb un-resizeable box.

The Xaml

When you create a Silverlight 2 control in Visual Studio 2008 or blend, the UserControl typically has Height and Width properties set, something like this:

<UserControl x:Class="Daphne.WorkplaceHome"
    xmlns="http://schemas.microsoft.com/client/2007"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Width="900" Height="400" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
    <Grid x:Name="LayoutRoot" Background="White" >
    </Grid>
</UserControl>

 

The Elusive Auto

Hence the reason why your content is not resizable.

One solution is to remove the Width and Height property.   Another is to set them to “Auto”, like so:

<UserControl x:Class="Daphne.WorkplaceHome"
    xmlns="http://schemas.microsoft.com/client/2007"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Width="Auto" Height="Auto" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
    <Grid x:Name="LayoutRoot" Background="White" >
    </Grid>
</UserControl>

 

If you run the project, it will start resizing.  Unfortunately this causes the designer in Blend and VS2008 look like rubbish.  (or more rubbish than usual anyway).

The trick is to set the Width and Height properties to “Auto” after the the screen has been rendered.

 

In WPF (apparently) you can use code like this:

Partial Public Class Page
    Inherits UserControl
    Public Sub New()
        InitializeComponent()

        Me.Height = new System.Windows.LengthConverter().ConvertFromString("Auto")
        Me.Width =  new System.Windows.LengthConverter().ConvertFromString("Auto")
    End Sub

...

 

Sadly, in another twist of fate, “LengthConverter” does not exist in Silverlight.

The Silverlight Solution – Who’s your Nan?

 

image

 

Fortunately, browsing the type library showed me that setting the property value of Height or Width to “System.Double.Nan” has the same effect as “Auto”.

So, in the intialise of your Silverlight control, put this:

 

Partial Public Class Page
    Inherits UserControl
    Public Sub New()
        InitializeComponent()

        Me.Height = System.Double.NaN
        Me.Width = System.Double.NaN
    End Sub

 

I am not sure if Microsoft intend to support LengthConverter (or TypeDescriptor.GetConverter!) in a future Silverlight version, but I’m guessing not.

Links

 


Share this post :

Posted in Code, Silverlight, Software Development | Tagged: , , , | 5 Comments »