Saturday, September 29, 2012

A small update of the UX in my blog.

Have been watching Billy Hollis Pluralsight course:
Creating User Experiences: Fundamental Design Principles

A lot of the information in this course is great for developers.
Solid information on what to take into consideration when building Software GUIs.

Made a small face lift on my blog, change the color scheme to get a better UX.
I added a gradient fill and green color on my blog to get some feeling of naturalness and biophilia

Monday, September 24, 2012

How to make a Per-User installation with NSIS

I've been doing some researching on how to make it possible for users to install applications without administrator credentials.

There is a lot of good samples on how to make an UAC compatible installer with NSIS. But almost all the samples are made for forcing the user to run the setup as administrator, for example in the NSIS documentation.

After a lot of googling I finally found this question on the forum and the answer was exactly what I was searching for.

Key part of the script is were the $instdir is constructed:

!define FOLDERID_UserProgramFiles {5CD7AEE2-2219-4A67-B85D-6C9CE15660CB}
!define KF_FLAG_CREATE 0x00008000
!include LogicLib.nsh
!include WinVer.nsh
!include MUI2.nsh
Var SMDir ;Start menu folder
Function .onInit
;Default $Instdir (UserProgramFiles is %LOCALAPPDATA%\Programs by default, so we use that as our default)
StrCpy $0 "$LocalAppData\Programs"
;Make sure we don't overwrite $Instdir if specified on the command line or from InstallDirRegKey
${If} $Instdir == ""
        ${If} ${IsNT}
                ;Win7 has a per-user programfiles known folder and this could be a non-default location?
                System::Call 'Shell32::SHGetKnownFolderPath(g "${FOLDERID_UserProgramFiles}",i ${KF_FLAG_CREATE},i0,*i.r2)i.r1'
                ${If} $1 == 0
                        System::Call '*$2(&w${NSIS_MAX_STRLEN} .r1)'
                        StrCpy $0 $1
                        System::Call 'Ole32::CoTaskMemFree(ir2)'
                ;Everyone is admin on Win9x, so falling back to $ProgramFiles is ok
                ${IfThen} $LocalAppData == "" ${|} StrCpy $0 $ProgramFiles ${|}
        StrCpy $Instdir "$0\${APPNAME}"

Saturday, September 08, 2012

How to: make sure windows doesn't go to sleep/hibernate

I'm currently working on support tools for an embedded system. When loading new software or loggning information from the system it takes a long time. Got feedback from the users that the tools act strange when their computers went to sleep and the they activate  the computer again. No errors indicated in the tools but it the log files look strange.

The problem can be solved in two ways:

  1. Turn off the sleep/hibernate in windows.
    1. Control panel
    2. System
    3. Power options
    4. Plan
    5. Put computer to sleep never.

      This is an easy fix but it is impossible to ensure that the users do this, and when they run into this problem it's already to late.
  2. Make sure the application tells windows it is going to run a long process, and that the user needs to wait for it to complete.

    See Stack Overflow question.


    On Vista and Windows 7 See: SetThreadExecutionState

    This is the path I think is correct by telling the operating system what the application is doing it supports the application and user does not have to do anything to get the correct behavior when logging or uploading software to the system.