Gamer Footprint April 2015 Update

25. April 2015 22:10 by Cameron in Durandal, Gamer Footprint  //  Tags: , , ,   //   Comments

Hey guys! Gamer Footprint has been receiving some cool updates lately! I have nearly finished the incremental scanner for scanning achievements/trophies and games played! I have just a couple of issues to work out before the scanner is more or less stable enough to run automatically without supervision. One of the main issues sparks from request throttling on Sony's side, but I think I can work around that by limiting the number of requests per minute. There are definitely some tweaks that can be done to improve upon the scanner, but the incremental portion has certainly made updating the timeline a ton faster.

Now that I've extracted a ton of data, I hope to get into more of the frontend development soon. I've setup several skeleton pages that I'll be filling in with content soon. I want to display the games that people play and the trophies/achievements available for each game. Content submission for a game page will be automatic based on the scanner and that will include publisher, developer, game description, release date, and several other available pieces of information. I've updated the site template so that it is more in line with flat UI design. I'm working on simplifying the top menu so that it will be easier to navigate and more mobile friendly. I'm not a huge fan of hamburger menus on mobile devices. I believe that content should be easily accessible by navigation menus and links on respective pages. 

I've been paying close attention to Rob Eisenberg's new framework, Aurelia, and I'm seriously giving it some thought as using the framework for future Gamer Footprint development. I love Durandal and I have been a huge supporter of the project, but Aurelia provides so much more with leveraging ES6 and ES7 concepts in the framework. Aurelia is relatively new with it being released in February 2015, but I have faith that it will be developed into a great product. I'll be experimenting with Aurelia over the coming months and preparing an upgrade path for Gamer Footprint. To the end user, the framework that I use on the frontend/backend means nothing. However, for performance, Aurelia seems to be stacking up quite well to other frontend frameworks on the market.

Please stay tuned!

Happy 2015 and Development Update

7. January 2015 10:52 by Cameron in Gamer Footprint  //  Tags: , , , ,   //   Comments

I know I'm a few days late, but Happy New Year 2015! It's crazy how time flies! Last year was a big year with me getting married, changing jobs, and moving to North Atlanta! They say that some of the largest life events are getting married, changing jobs, and moving. I did all three! My wife and I are finally beginning to settle in at our new jobs and our new area.

Gamer Footprint development is slow but still active. I added an API for gathering latest firmware versions for various consoles including 3DS, Wii U, Wii, PSP, PSVita, PS4, PS3, Xbox, Xbox 360, and Xbox One.

A full list of supported consoles can be found here: http://dev.gamerfootprint.com/api/firmware/consoles

A sample response for 3DS: http://dev.gamerfootprint.com/api/firmware/3ds

[{"versionNumber":"9.4.0-21 U","region":"US"},
 {"versionNumber":"9.4.0-21 J","region":"JP"},
 {"versionNumber":"9.4.0-21 E","region":"EU"}]

I plan to add caching to the firmware versions API as it can take a long time to pull back firmware versions for consoles such as the 3DS or Wii U that have different firmware version sources for each region. I'm working on a generic Neo4jClient repository for managing stored objects and relationships. This will help abstract the need to interface with Neo4jClient directly. There is an existing Neo4jClient repository, but it hasn't been updated for Neo4j 2.0. I plan to open source my work once complete so that others may benefit.

I've learned a ton on generics programming while writing the generic repository. While some may argue that the generic repository is an anti-pattern, it does have its use when paired with a non-generic repository for gathering/storing objects related to a specific model. I am working on abstracting Neo4jClient calls such that I can pass in Linq expressions directly to the query engine without explicitly having to access the query engine. I'll post some example code shortly to show some of my progress.

I'm continuing to develop the Durandal/Web API/OAuth implementation of Gamer Footprint and once I have the data layer established, I will begin writing more page functionality. The Gamer Footprint development site is very unfinished currently, but in the next couple of months, I expect to get basic account management and profiles finished. Please stay tuned!

OWIN Self-Hosted Test Server for Integration Testing of OData and Web API

A co-worker of mine and I were recently given a task to perform integration testing on OData and Web API services. You can view his posts on the subject in his series: Part 1, Part 2, and Part 3. Traditionally, one might mock the web requests and responses, but by using the TestServer found in Microsoft.Owin.Testing namespace, we can start an in-memory HTTP server for doing full integration tests. You can get the NuGet package here.

To start create a new Unit Testing project with MS Test and a new ASP.NET MVC / Web API project. In the ASP.NET MVC / Web API project install Web API 2.2 and Web API 2.2 for OData v4.0 and OData v1-3. For the unit test project, install Web API 2.2, Web API 2.2 for OData v4.0 and OData v1-3, Web API 2.2 OWIN Self Host, Web API 2.2 OWIN, and Microsoft.Owin.Testing. Below is a sample of a unit/integration test for setting up an OWIN test server for in-memory integration testing:

namespace SelfHosting.Test
{
    using Microsoft.Owin.Testing;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Owin;
    using SelfHosting.Test.Models;
    using System;
    using System.Linq;
    using System.Net.Http;
    using System.Threading.Tasks;
    using System.Web.Http;
    using System.Web.Http.Dispatcher;
    using System.Web.OData.Builder;
    using System.Web.OData.Extensions;
    using WebApp.Models;

    [TestClass]
    public class SelfHostingTest
    {
        protected TestServer server;

        [TestInitialize]
        public void Setup()
        {
            server = TestServer.Create(app =>
            {
                HttpConfiguration config = new HttpConfiguration();
                WebAppFacade.WebApiConfig.Register(config);
                app.UseWebApi(config);
            });
        }

        [TestCleanup]
        public void TearDown()
        {
            if (server != null)
                server.Dispose();
        }

        [TestMethod]
        public async Task TestODataMetaData()
        {
            HttpResponseMessage response = await server.CreateRequest("/odata/?$metadata").GetAsync();

            var result = await response.Content.ReadAsAsync<ODataMetaData>();

            Assert.IsTrue(result.value.Count > 0, "Unable to obtain meta data");
        }

        [TestMethod]
        public async Task TestWebApi()
        {
            HttpResponseMessage response = await server.CreateRequest("/api/values").GetAsync();

            var result = await response.Content.ReadAsStringAsync();

            Assert.AreEqual("\"Hello from foreign assembly!\"", result, "/api/values not configured correctly");
        }

        [TestMethod]
        public async Task TestODataPeople()
        {
            HttpResponseMessage response = await server.CreateRequest("/odata/People").GetAsync();

            var result = await response.Content.ReadAsAsync<ODataResponse<Person>>();

            Assert.AreEqual(result.value.Count, 3, "Expected 3 people to return from /odata/People");
        }
    }

}

The OData meta data is serialized into a POCO (Plain old C# object):

namespace SelfHosting.Test.Models
{
    using System.Collections.Generic;

    public class ODataMetaData
    {
        public string odatacontext { get; set; }
        public List<Value> value { get; set; }
    }

    public class Value
    {
        public string name { get; set; }
        public string kind { get; set; }
        public string url { get; set; }
    }
}

By using a generic ODataResponse class, we can deserialize our OData response into any POCO:

namespace SelfHosting.Test.Models
{
    using System.Collections.Generic;

    public class ODataResponse<T>
        where T : class, new()
    {
        public string odatacontext { get; set; }
        public List<T> value { get; set; }

        public ODataResponse()
        {

        }
    }
}

The beauty about using the TestServer is that it is self-contained and the HTTP server is inaccessible outside of the process. Once the tests complete, the server is shutdown. The WebApiConfig registered with the TestServer determines which controllers and routes to load for testing. No production code needs to be changed in order to test existing Web API and OData controllers. The only problem that I have found is that attribute routes don't seem to register correctly. Perhaps I have not found the correct method of registering the attribute routes for the TestServer.

Here is the Visual Studio 2013 solution with both a web project and a unit testing project:

SelfHostingUnitTest.zip (1.39 mb)

Visual Studio Update 3 and TypeScript external module compilation

7. August 2014 08:54 by Cameron in TypeScript  //  Tags: , , , , , , , ,   //   Comments

I recently updated to Visual Studio 2013 Update 3, but it appears as though the TypeScript compiler is a little more strict in external module compilation. If you receive an error message asking the --module flag to be set, you need to add this to your build configurations in your project:

  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <TypeScriptModuleKind>amd</TypeScriptModuleKind>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <TypeScriptModuleKind>amd</TypeScriptModuleKind>
  </PropertyGroup>

After adding the TypeScriptModule kind node to the project properties, the compiler can correctly compile external TypeScript modules!

Windows Path Environment Variable Length

10. February 2014 13:14 by Cameron in Windows  //  Tags: , , , , , ,   //   Comments

I recently started getting "Target Invocation" errors while trying to launch Visual Studio 2012 or Visual Studio 2013. This was a strange error message as not much else was given to diagnose the problem. After some extended research, I found that having an extra long PATH variable can cause Visual Studio to hang on startup. Windows limits this length to 2048 characters. Although you can still have a PATH variable longer than that, some programs like Visual Studio can't address a PATH environment variable larger than 2048 characters. A remedy to this problem is to split out your PATH variable into at least two variables. 

First, you need to open your PATH variable and copy its value into a safe spot in case it gets messed up. Then you can extract the last half of your path and create a new environment variable and call it PATH2. After your new environment variable is setup, you can reference it in your main PATH

C:\bin;C:\anotherfolder\bin;%PATH2%

Some may be asking, why would my PATH ever exceed 2048 characters? The answer is that if you're a developer and have lots of compilers, IDEs, and toolchains installed on your development machine such as Visual Studio, Net Beans, GCC, Qt, or devkitpro, your PATH can grow fairly quickly. 

If you ever exceed 2048 characters in PATH2, you can append another variable such as PATH3 or PATH4. I'm not certain if there is a real physical limit to user created environment variables, but if you experience problems, you can do as I mentioned. Note, I have a Windows 7 x64 development machine at work and I haven't seen this issue in Windows XP or Windows 8. I haven't done development on Windows XP in several years since it is now showing its age and Microsoft is discontinuing support in April 2014.

My NES and SNES game collection

7. April 2013 18:01 by Cameron in   //  Tags: , , , , , , , , , , ,   //   Comments

It's been a while since I've posted a new blog post. I've been fairly busy with life and work lately. Over the past couple of weeks, I've been expanding my NES and SNES game library. I plan to collect several original titles that I enjoyed playing as a kid. Some of the games that I recently acquired for the NES are:

  • Donkey Kong Classics
  • Tengen's Pacman
  • Tetris
  • Othello
  • Mario Bros. Arcade Classics
  • Castlevania I
  • Castlevania II
  • Castlevania III
  • Duck Tales
  • Dr. Mario
  • Caesar's Palace
  • The Bugs Bunny Birthday Blowout
  • Tengen's Road Runner
  • The Bugs Bunny Crazy Castle
My NES collection is rapidly growing as I previously only had these games in my library:
  • Super Mario Bros. / Duck Hunt
  • Super Mario Bros. 2
  • Super Mario Bros. 3
  • Home Alone
  • The Legend of Zelda
I plan to add the Teenage Mutant Ninja Turtles trilogy, Megaman 1-6, Metroid, and several other great games to my collection. Megaman collections can easily go for $150 or more on eBay while a single copy of Megaman can be easily $30. I'm hoping to find a collection with all six games when I'm ready to add them to my collection. I love super Metroid on the SNES so I'm sure that the original Metroid will be an excellent addition. Metroid has held its value fairly well over the years. Copies of Metroid typically sell for $30 or more. I will also be adding a RetroZone NES PowerPak to my library so I can play translated Famicom games and homebrew. I would like to try my hand at NES development with 6502 assembly too.
 
For my SNES, I recently added these games:
  • Sim City
  • Donkey Kong Country 3
  • Buster Busts Loose
  • Kirby's Avalanche
  • Super Mario World 2: Yoshi's Island
I've got quite a large collection of SNES cartridges that I've been building on over the past few years:
  • Super Mario Kart
  • Super Mario All Stars + World
  • Super Off Road the Baja
  • Jurassic Park
  • Donkey Kong Country
  • Donkey Kong Country 2
  • Final Fantasy Mystic Quest
  • The Legend of Zelda: A Link to the Past
  • Chrono Trigger
  • Starfox
  • Mario Paint
  • Final Fantasy II
  • Final Fantasy III
  • Super Battletank: War in the Gulf
  • Super Caesar's Palace
  • Super Mario RPG
  • SNES PowerPak
  • Super Gameboy
  • Super Metroid
Since I have a SNES PowerPak, I can play most all translated Super Famicom games, homebrew, and almost all of the SNES games available. I've used my SNES PowerPak for development of my own and playing various hacks or ROM translations. Even though I can play nearly every game available for the SNES using the SNES PowerPak, I still enjoy collecting the original carts. 
 
One may say that it's cheaper to just use a NES/SNES to USB adapter and play games on an emulator, but it's just not the same as playing on the original hardware. I grew up in the 1990's and the NES/SNES were a big part of my childhood. Arguably, I'd have to say the SNES is my favorite console as it's one that I played the most. I didn't have an NES at home as a kid, but I used to play at friend's houses. I have all the emulators and ROMS, but nothing compares to the feeling of playing a game they way it was meant to be played, on the glorious consoles themselves.

Month List

Tag cloud