Can Of Code

SteamOS on the Intel NUC

With the announcement of the HTC Vive there has been a lot of talk around Half Life 3 (mainly because HTC “mistakenly” said it was in the works). It gave me the urge to play some Half Life 2.

My next train of thought was how horrid it would run on my laptop so I decided to hit two birds with one stone and try SteamOS

Getting Steamy

I had a Intel NUC lying around which made the perfect candidate. The NUC has 8GB ram, an Intel i3 and a SSD with around 20GB storage.

The process of getting steam on to the NUC was pretty similar to installing any OS,  download the installer files then paste onto a FAT32  USB drive and your good to go.

What the EFI

After installing StreamOS, the machine restarted but no bootable media could be found.  In my daze of excitement I hastily Googled the problem which led me to an article suggesting a BIOS update should fix the problem

As I was too impatient I didn’t read the the BIOS warning that stated:

The memory reference code in BIOS version 0046 and later was updated as a part of the changes made in the BIOS to meet Microsoft Windows 8.1* requirements. This new memory code no longer supports 1066 MHz memory modules. Please review the Release Notes for more information.

Of course I was running some 1066Mhz RAM that was now no longer support. So I had to do some backtracking to  an older version and I was back to square one.

More Googling led me to this article which suggests the there is a bug in the NUC’s UEFI which means its looking for the EFI file in the wrong place.

Using the article mentioned above but adapting for SteamOS, I first had to boot from the SteamOS Installer but in the “recovery mode”. After selecting language and then loading a shell from the options provided. I then typed the following into the shell:

$ sudo mount /dev/sda1 /mnt
$ sudo mkdir /mnt/EFI/BOOT
$ sudo cp /mnt/EFI/steamos/* /mnt/EFI/BOOT
$ sudo mv /mnt/EFI/BOOT/grubx64.efi /mnt/EFI/BOOT/bootx64.efi

  A reboot later and I had SteamOS running.

No sound though

All was dandy except there was no sound. I turned on the desktop mode and tried a number of tricks via the terminal to try and get it to work, but had no luck. If anything I had made it worse as no sound card was getting detected at all. I proceeded to do the only thing I could do which was to try and reinstall again.  It did the trick! my theory was that when I first installed I didn’t have a network connection, so when it went through the “detecting hardware” stage it couldn’t get the drivers it needed? If anyone has a different theory let me know.


The UI is exactly the same as Steams “Big Picture Mode” which is totally effective for a more console like experience. I found that in the games section it was a little annoying to have all the servers and utilities show up in the “games I can play” section but that was easily changed by changing the filter to “games”. I also found the store experience a little limiting, however you can always browse via the built in web browser.

So considering that the whole point of this exercise was to play some Half Life 2, I booted the game up (The full game is only 2GB! those were the days!).  What I wanted from SteamOS was the stability (most of the time) of consoles but with the keyboard / mouse input and SteamOS was able to provide this. There were a few glitches in the game but none that ruined the gameplay experience and I can imagine that porting the game from Windows to Linux wouldn’t have been a trivial experience.

Half life 2


Have a spare machine around and want to give SteamOS a try? I would say “go for it!” the installation process is simple but its still new and in development so do expect some issues along the way.

Posted in Uncategorised | Leave a comment

Hello World in Spectrum assembly

I started this post originally in November 2013 but it ended up in the drafts pile. The idea then came back to me when I heard of the Spectrum ZA Vega IndieGoGo.

After a voyage into the roof I discovered a box of old electronics. Getting completely distracted from what I was supposed to be finding I took a peek inside the box to find a collection of Spectrum consoles and related accessories.

After digging around in the box I found this book:

Spectrum & Spectrum+ Assembly Language Course

Spectrum & Spectrum+ Assembly Language Course


I should explain that seeing such a book didn’t instil some sort of nostalgia. If i’m honest, it was before my time. The book did however spike my interest, perhaps I could see what life was like without the comfy luxuries of IDEs and managed languages.


Getting Started

It makes sense that the first step is to get the hardware setup. This gifted me with my first two issues:

– I have been reliable informed that none of the Spectrums in the roof actually work. Made in England!

– Even if they did work, I don’t have a TV that has a coax connector.

So my best bet was to try and find a Spectrum emulator. The search was both long and tiresome but I finally found an emulator that both worked and included a code editor.

Enter ZX Spin

ZX Spin

ZX Spin

You can get ZX Spin here. Unlike most emulators I found, this one works on Windows 8 and it runs straight out of its folder, no need to install anything.


Time for Hello World

So to print “Hello World” to the screen is a pretty simple command:

PRINT “Hello World”

The first gotcha here is that you would be inclined to type out “PRINT”  however the Spectrum keyboard worked in such a way that the “p” key would write “PRINT”


Spectrum Keyboard

Spectrum Keyboard


To type a string you need to surrond the string in quotation marks, nothing new there.  So to print out “Hello World” we would have to type:

P key  –  (Right Alt + P)  –   hello world – (Right Alt + P)

Hit enter and you should see:




Next time…

Next time I hope to create a reusable program using the tape emulation. I’m also intrigued by why they chose to use single key presses for commands? I assume it was a technical limitation?  Let me know in the comments if you have an insight.

Posted in Uncategorised | 15 Comments

ASP Entity Framework Many to Many not working

i’ve been working on a simple book website using ASP MVC.  I have a Book class and an Author class. Each book can have one or more Authors and each Author can have one or more books.

Many to Many incorrect in the database

The first issue I came across was that the database was being created without a lookup table as should be the case with a many to many relationship. instead it added a bookId to the Author table. This would mean that duplicate author records would exist for authors with more than one book.

To fix this (thanks to @TheRealDuckboy) I just needed to add a List of books to the Author object! I only had a Author list in the Book object which confused Entity Framework.

Correct database layout, hurrah?

After solving my borked many to many relationship I stumbled across my next issue. It was time to list the authors of the Book object in my view. The Book’s Authors property was null. After checking the database I saw that the data was there and the relationship was valid.

The problem was with how I represented the collection in the Model.  I naively bashed out the following:


public List<Book> Authors { get; set;}


After some googling i saw that people were using a ICollection for their lists. Its always a good idea to use a generic interface so more fool me.


public ICollection<Book> Authors { get; set; }


So I ran “update-database” to do the code first migration and started running. The Authors property was still null!

What I then found was that I was missing the “virtual” keyword.


public virtual ICollection<Book> Authors { get; set; }


It worked! This Stackoverflow answer suggests that the collection can’t be lazy loaded (loaded when first accessed) unless its virtual.

Posted in Uncategorised | Leave a comment