Development

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

Initial thoughts on the Windows 10 Technical Preview

Now that the second preview build of the Technical Preview of Windows 10 is out, I decided the time was right to share some of my initial thoughts on this early preview for Windows 10.

Windows 10 Universal Apps

First of all, it’s important to understand that, for casual computer use, I was very happy using Windows 8.1 on my Surface Pro 2, both on the touch screen and when plugged into a monitor, keyboard and mouse. I didn’t just “put up with Windows 8″ like many folk seem to. I embraced it and it changed the way I used a computer.

I embraced Windows 8 and I loved using full-screen apps at home

Simplicity is something I am always striving for. For example, I don’t have any icons on my desktop and I only pin the minimal amount of apps to my taskbar. The majority of the apps I used at home were ‘modern’ full screen apps. This means that I could have Xbox Music playing in the background with no icon in the task bar or any other visible UI unless I have it snapped to the screen. I understand that for some users this was mind-blowingly hard to understand, but I liked the simplicity.

Windows 10 Taskbar

With Windows 10, performing a task, like listening to music, means that there is an icon in the task bar. This is better for the majority of users, but for me it takes some getting used to.

Using Windows 10 is already better for multitasking and getting things done

The first two builds of the Technical Preview have been focused squarely on the experience in the enterprise, and specifically, use with a keyboard and mouse inside of the desktop environment. Here are where things really shine in Windows 10.

Unlike the way I was using full screen Windows 8 apps at home, I use multiple screens and desktop applications when I’m at work. Three screens means I can multi-task between development applications like Visual Studio, SQL Management Studio and PowerShell at the same time, but I still have to minimize and swap windows around when switching to communication and note taking applications like OneNote and Outlook.

Windows 10 Task View

Windows 10 includes some fantastic virtual desktop features which help around this, and I’m really looking forward to running Windows 10 at work. I could use the Task View to switch between these two logical tasks rather than minimising multiple windows.

Unfortunately the Windows team couldn’t get everything done in time for the first preview. The biggest things that are missing for me are around using the touch screen, and modern apps in full screen. The good news is that we do know that future builds will include features like Continuum, that are specifically designed for hybrid computers like the Surface.

Touch screen is still coming, and hopefully it will be as great as the desktop

With two builds already, it seems that the velocity is pretty fast. I’m looking forward to getting my hands on new features. Windows 10 is shaping up to be one of the most important versions of Windows ever – in terms of both the features and the speedy development process.

Windows 10 has an improved Console

Windows 10 Console

It’s true, the Windows command line is making a comeback.

With Windows 10, a number of ‘experimental’ options have been added to the console host which work with both the classic cmd.exe and PowerShell. This includes features like CTRL-C and CTRL-V for copy and paste, plus new text selection hotkeys, resizing, transparency and more.

And, by the looks of Microsoft’s UserVoice forum, this looks like just the beginning:

In the dawn of time, the original Windows console was created. For millenia, geeks and developers (typically both) steeled their nerves and leveraged the console’s utility. After a (very) short time, a great lacking was noticed. And so, legions of ever intrepid command line mavens migrated to other platforms and other consoles, ‘til but a stalwart few remained. Now, today, with a small rumbling, the ancient, weary console heaves a great sigh and rises. The journey to legitimacy has begun.

WE’RE BACK!

If these kinds of features are important to you, don’t forget to give your feedback to Microsoft so that they know that the command line is still relevant in 2014.

Windows 10 Technical Preview

As a big user of software and services in the Microsoft ecosystem, finding out about the next version of Windows is always exciting. Yesterday, we got our first official look at Windows 10, and while we didn’t learn about many features which hadn’t already been leaked, we did finally get to hear Microsoft’s plan for its next generation Windows platform.

Windows 10 Product Family

The official picture above teases how this single release of Windows will feature multiple interfaces the operating system itself, scaling from the Xbox One and the large Perceptive Pixel multi-user business display, all the way down to embedded devices, phones and small tablets.

From a developer point of view, Windows 10 will support a new universal app model that spans across multiple devices. This means that an application can be written only once to run across all of these environments, end-users will only have to purchase the application once to use it everywhere. Universal apps for Windows 10 will probably be very similar to the ones announced at Build earlier this year.

Windows 10 Start Menu

New features like Task View and Snap Assistant are included in the technical preview, but the more obvious user interface changes look like they are still to come. For example, Continuum is a set of features which enable hybrid devices to switch between touch and desktop modes automatically, just by attaching or removing the keyboard.

Windows 10 Task View

Today, along with many other Windows enthusiasts, I signed up for the new Windows Insider Program. This new program is similar in concept to the Windows Phone Developer Preview, but it will also provide opportunities to provide feedback directly to the Windows team.

Trust me, I’m going to provide as much feedback as possible.

String Hashing in F#

I recently wrote a small program to convert some strings into a ‘unique enough‘ hash which could be used as a short reference.

Whenever I’m trying to come up with an idea of how to handle these kinds of functions, I tend to turn to my favourite language, F#. This allows me to do rapid prototyping in a very functional way.

Below is the prototype version of this hashing program:

open System
open System.Text
open System.Security.Cryptography

let encode (alpha:string, number:int) =

    let b = alpha.Length

    let rec enc (s:string, n:int) =
        match n with
        | x when x <= 0 -> s
        | _ -> enc (s + alpha.[n % b].ToString(), n / b)

    match number with
    | 0 -> alpha.[0].ToString()
    | _ -> enc ("", number)

let md5Int (input:string) =

    let clean (str:string) =
        str.ToLowerInvariant()
           .Trim()

    let computeHash (str:string) =
        let bytes = Encoding.Unicode.GetBytes(str)
        use crypto = new MD5CryptoServiceProvider()
        crypto.ComputeHash(bytes)

    let convert (bytes:byte[]) =
        let i = BitConverter.ToInt32(bytes, 0)
        Math.Abs(i)

    convert (computeHash (clean input))

let hash (input:string) =

    let a = "ABCDFGHJKLMNPQRSTVWXYZ0123456789"
    let i = md5Int input

    encode(a, i)

Once I have this program created, it’s very easy to use in F# Interactive like so:

> hash "Here is a test string!";;
val it : string = "1W2ALLB"
> hash "The hash is much smaller, which is great.";;
val it : string = "5DAF5T"
>

Running JAR applications on Windows without installing the Java Virtual Machine

As part of my Open University course, I’m required to use a piece of open source software called Aladin Sky Atlas. This is maintained by Centre de données astronomiques de Strasbourg.

The program itself is actually pretty cool – it’s an interactive sky atlas, which allows you to view astronomical images along with information from the SIMBAD database and other sources.

The only problem with this program is that it uses Java, something I tend to avoid whenever possible. Installing Java on my Surface Pro 2 would mean I’d have more critical patches to install than I already do, and would open me up to a whole new attack vector. It’s not something I’d want to run on a tablet computer either.

(ノಠ益ಠ)ノ “Eww, Java!”

I originally tried using Hyper-V with a virtual machine running CentOS. This is a nice clean way of having ‘nothing running’ until it’s actually needed, but it’s quite an overhead to run a whole Linux operating system just to host a single app. Especially when battery life is a concern.

When searching around for a solution, I stumbled upon a really cool project that I’d never seen before. The IKVM.NET project includes a number of components for Java & .NET interoperability, but for this task I’m mostly interested in the Java Virtual Machine implementation.

By downloading the Windows binary of IKVM.NET, I’ve been able to run the application on my Windows 8.1 machine without requiring the JVM (or any other software) to be installed at all. This is a pretty fantastic achievement.

First I put the binaries into my apps folder (similar to my Vim setup), then I set up an alias to the executable using PowerShell.

# There's usually much more than this in my profile!
$SCRIPTSPATH  =  "C:\Users\Julian\Scripts"

Set-Alias ikvm   "$SCRIPTSPATH\Apps\ikvm\ikvm.exe"
Set-Alias ikvmc  "$SCRIPTSPATH\Apps\ikvm\ikvmc.exe"

# ikvmc.exe is cool too! have a look

After creating an alias in PowerShell I can just run it whenever I need.

PS> ikvm -jar aladin.jar

Obviously you could always set up a Windows Shortcut that does a similar thing, but that’s boring. Using PowerShell really suites me, as I often run applications this way.

Aladin Sky Atlas running on Windows without Java installed

The software doesn’t exactly look pretty, but these open source projects rarely do. Sometimes it looks like text hasn’t rendered as expected, but overall I’m really impressed.

If you’re looking to run JAR applications on Windows, without the Java Virtual Machine, then have a look at The IKVM.NET – it might work for your apps too.