Development

This category is for all things relating to scripting or programming languages, as well as software construction, design and development.

Astrolight 1.2 Update

My Astrolight red flashlight application has been updated to keep the screen from locking. I had heard from users that sometimes they wanted to set the phone down while playing with cameras and eyepieces – but when they went back to the phone they’d have to unlock again. Which could be pretty bright depending on your wallpaper! Get it from the Windows Phone Marketplace.

The ‘Real’ Windows 8 Logo

The new Windows 8 logo, as shown above from the Microsoft blog post that announced it, has been designed to compliment the Metro Design Language and also has roots in the Swiss International Style, which is all about typography, solid colours, strong lines and grids.

Over all I like it, but when I first saw it I felt like something was a little off with the ‘beams’ on the window. It looked like the perspective was messed up or something.

Later I came across an article about the new logo by the design agency Pentagram – who were commissioned by Microsoft to create the new logo. After thinking about it for a little while I understand that the beams are like a grid on top of the rectangle shape, and because of this understanding the logo looks better to me.

This is a bit like seeing the arrow in the FedEx logo for the first time.

You can tell this version of the logo looks slightly different to the one posted on the Microsoft blog. As Pentagram explains, the window shape itself has been chosen to be a rectangular shape in perspective, but the actual beams (or grid lines) are separate from the shape.

The perspective drawing is based on classical perspective drawing, not computerized perspective. The cross bar stays the same size no matter the height of the logo, which means it has to be redrawn for each time it increases in size, like classic typography.

You can see these lines are cut out of the coloured shape, and are not in perspective at all. The idea is that each time the logo is drawn the lines are always the same size, as shown below.

Seeing the logo in this view makes me appreciate the design a lot more, but the problem is that the version that is on the Pentagram website is actually quite different to the one on the Microsoft site.

Here is an animation which Kean created for me which show the difference in the beams and text between the two.

So which one is the real Windows 8 logo?

I find it really hard to believe that Microsoft would be able to convince everyone – from OEMs to the press – to render a version of the logo for the exact size they need, every time they need it. So I think they’ve had to compromise on the design given to them by Pentagram.

I’m not sure which is the ‘real’ Windows 8 logo yet, or if Microsoft are going to make any more changes before it gets released to the public. But I’m going to place my bets on the version that Microsoft posted to their blog.

I’m assuming they’ve just picked a width for the beams which fits well for the majority of sizes shown in the new operating system, and decided to stick with that moving forward.

I wasn’t the only person to notice this, Long Zheng has a write up on his excellent blog. He suggests changing the beams to fit in with the perspective of the rest of the logo, and I think his version looks pretty good too.

Microsoft Future Vision

Every so often Microsoft make ‘Future Vision’ videos, and while both of the ones I have posted here were produced some time ago, I stumbled across them again recently so I thought I’d share them for anyone who hasn’t spotted them yet.

The basic concept is for the Office division to imagine where productivity will be in the next 5-10 years, without having to actually create the products today. Both of these videos have a similar feel (I actually prefer the 2011 video) and the technology in them is smart and subtle. Some of the technology is even starting to become real.

It’s this smart yet subtle concept that really connects me to the modern Microsoft design language, including Metro on Windows Phone and Windows 8.

2009

My favourites from the 2009 video have to be the smart school room, and the flexible newspaper display. Fantastic ideas.

2011

There are so many parts of the 2011 video I like, but most of all I like the way the devices work together. The taxi windows and hotel room computers become personal once hooked up to the smaller devices. A very powerful concept.

You can watch a few of the Microsoft Future Vision videos on the Office YouTube page, but I don’t think we’ll see a new one until next year.

Bluetooth Improvements in Windows Phone Mango

It was a pleasant surprise to see that Windows Phone Mango includes some improvements to the Bluetooth stack, which means I now see the name of the currently playing track in my car.

This gets added to the already existing ability to pause, fast-forward and rewind directly from the steering wheel, so now I can do just about everything from the Zune software on my phone while driving.

Very handy – as the built in USB player in my car doesn’t support content downloaded from Zune Pass…

WMPowerUser.com has a more information on what has been the Windows Phone Bluetooth stack, if you fancy being nerdy about it.

Querying TFS with TFPT.EXE and PowerShell

At Branded3 we use Team Foundation Server for source control, task managment, and various other tracking purposes. One of the benefits of this is being able to run queries with WIQL to pull off reports.

As is usually the case with me, I have set up a couple of PowerShell scripts that use TFPT.EXE from the Team Foundation Server Power Tools to make life a little simpler for myself…

Viewing Open WorkItems

$TFSSERVER   = "hq-tfs08-01.branded3.net"

Function Get-WorkItem
{
    $query = "SELECT [System.Id], [System.Title] FROM WorkItems " +
             "WHERE [System.AssignedTo] = 'Julian Kay' " +
             "AND [System.State] <> 'Closed' " +
             "AND [System.State] <> 'Resolved' " +
             "ORDER BY [System.Id]"

    tfpt query /collection:$TFSSERVER /wiql:$query /include:data
}

This little script gets a list of WorkItems which are not closed or resolved from TFS. I find this much faster than opening a copy of Visual Studio to find out which tasks I have assigned to me. True you could run this kind of script by using a batch file, but I like the fact I can use this in conjunction with the various Outlook scripts I use for PowerShell with simple one-liners like foreach ($workItem in Get-WorkItem) { Add-OutlookTask “$workItem” }

Getting Work Hours

Function Get-WorkItemHours
{
    $month = (Get-Date).ToString("MMMM")
    $year  = (Get-Date).Year
    $query = "SELECT [Completed Work] FROM WorkItems " +
             "WHERE [System.AssignedTo] = 'Julian Kay' " +
             "AND [Assigned Month] = '$month' " +
             "AND [Assigned Year] = '$year'"

    $hours = tfpt query /collection:$TFSSERVER /wiql:$query /include:data
    $total = 0.0
    foreach ($hour in $hours)
    {
       $total += $hour
    }
    $total
}

We also have custom fields which help us keep track of the hours we’ve spent on a project, and as shown above, we can even see how many hours have been spent in a month. By running this simple script I can be sure that all my time is correctly recorded to enable us to both bill correctly, and keep track of how long things really take.

Naturally, everyone has their own requirements for scripts like this, but PowerShell gives me the flexibility to create these simple utilities with very little development work.

Fix for Italic Fonts in Windows Command Prompt

I kept getting a problem where the Consolas font was in italics on when using either CMD or PowerShell on Windows 7.

After messing around with lots of options, I actually ran a repair on the Office 2010 installation I had. It worked. I’m not exactly sure why this is the case, but if you’ve got this problem – you might want to try this too.

I know Consolas ships with Office 2010, so maybe the repair just makes sure the font files are installed correctly. If anyone knows the real reason, please feel free to leave me a comment!

Outlook Tasks in PowerShell and Vim

Getting Outlook Tasks in PowerShell is actually pretty easy. All you need to do is use the Office Interop to get access to the default tasks folder, then iterate through the items that are returned.

Create a file called Get-OutlookTask.ps1 in your scripts folder, and paste the following code:

Add-Type -AssemblyName Microsoft.Office.Interop.Outlook
$folders = "Microsoft.Office.Interop.Outlook.OlDefaultFolders" -as [type]
$outlook = New-Object -ComObject outlook.application
$mapi = $outlook.GetNameSpace("mapi")
$tasks = $mapi.getDefaultFolder($folders::olFolderTasks)

foreach($task in $tasks.Items)
{
  if(!$task.complete)
  { 
    $task.subject 
  }
}

Naturally, you could customize this script to work any way you like – for example, you could sort by priorty or date, or you could show an extra column for category information. I have actually set up an alias to this script, so all I have to do is type tasks to see all my current tasks.

If you have set Vim to work with PowerShell, you can import your Outlook Tasks directly into the open document by using the Vim command:

:r! tasks

Pretty cool huh? If you’re looking to add Outlook Tasks in a similar way, you can check out this script by Lee Holmes. I use this one with the alias of nt to save on all that extra typing.

If you want to be able to add Outlook Tasks from Vim, I suggest you add the following function to your vimrc file:

function! Task(args)
  system("nt \\\"" . a:args . "\\\"")
endfunction

command! -nargs=1 Task :call Task('')

Now you just need to call :Task buy milk and it’ll get added – without switching to the shell itself.