Rick Glos Life in Portland, Oregon.

World of Tanks - Skirmish 18 - Alienware tourney

16. May 2013 12:31 by Rick Glos in Gaming

We (Cap Fast Nation) made it to the finals last weekend of Skirmish 18 out of 64 teams (brackets).  We lost to 3-1 versus Netwarriors but it was a good fight.

5-16-2013 12-22-22 PM

Scored us each 2,000 gold.

5-16-2013 12-23-06 PM

Alienware sponsored a tournament that we made it into the semifinals (brackets) – with a final 8 out of 38 teams.  There we lost a really close one 2-1 versus Scurry Hard, made up of some rude dudes.  It was double-elimination and we couldn’t field enough people the second day in the losers bracket so we forfeited.

5-16-2013 12-30-28 PM

Visual Studio 2012 theme, caps and pending changes window

1. May 2013 11:19 by Rick Glos in Programming

I’ve been living in Visual Studio 2012 for a couple weeks now, finally making the switch from Visual Studio 2010 to Visual Studio 2012 for most of my work and doing the usual stuff of upgrading projects and tools, etc.

Many people have complained about the UI and I’m not normally one to customize but it has been hard.  I find myself having having mental hiccups figuring out which tab is active or why can’t I see xyz in the pending changes window?  My co-worker and I were discussing and came across some good links I wanted to document.

  1. Customizing the theme.

    A really good extension called Color Theme Editor. A good video on how it works.

  2. Getting rid of the all caps.

    It involves the registry, but thankfully there's a way to remove those capitals.

  3. Getting the old pending changes window back.

    I think Pending Changes merits its own window, not being buried in the Team Explorer window.

VS2012 unit tests fail when using Microsoft.SqlServer.Smo

24. April 2013 06:30 by Rick Glos in Programming

I’ve got a bunch of unit tests that were in an existing VS2010 project that worked great.  They had an AssemblyInitialize method that dropped and recreated the database and used Microsoft.SqlServer.Smo to run scripts.

When I upgraded this solution to VS2012 the unit tests would no longer execute and I was receiving the following error:

System.IO.FileLoadException: Mixed mode assembly is built against version ‘v2.0.50727’ of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.. Aborting test execution.

I can’t very well change how Microsoft.SqlServer.Smo is compiled.

Googling around I didn’t find much but eventually ran across a comment buried in StackOverflow question about hand editing the VS2012 test runner.

The solution is to open the config file at C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.executionengine.x86.exe.config and add the following:

<startup useLegacyV2RuntimeActivationPolicy="true"><supportedRuntime version="v4.0"/></startup>

Note that I had to restart VS2012 to unload the exe and reload it.  You can see it running as a child process of VS2012 in Process Explorer.

4-24-2013 6-25-49 AM

Hope that helps someone else.

Unable to manage networking component. Operating system corruption bay be preventing installation.

15. April 2013 13:13 by Rick Glos in

In attempting to install some VPN software to connect to a client I received a ambiguous message from the installer.

Unable to manage networking component. Operating system corruption bay be preventing installation.

4-15-2013 9-53-44 AM

Some googling turned up a good post about Windows 7 being limited to 14 network filter drivers but is set by default to only 8 (post) along with a link to technet forums (post).

Although the post was on Cisco forums, and I was installing some SonicWALL software, I assumed SonicWALL was just a re-branding of the Cisco installer.  In addition I have a number of what I think would be ‘network filter driver’ software like Windows Virtual PC’s, VirtualBox, Network Monitor, and other client VPN connection tools.

To increase the network filters to allow the software into install, modify your registry key at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Network\MaxNumFilters and change the value from 8 to 14.

This did not require a reboot.

Google kills Reader

18. March 2013 09:53 by Rick Glos in

Update - May, 8, 2013 - I’ve started using Feedly and so far I am liking it more than I did reader.

I’ve been using Google Reader since 2005 daily and it was one of the founding applications (along with gmail) that me made use Google.  When they added Google Calendar it was a easy to encourage people I know to switch, my wife in particular being on its greatest supporters.  She non-technical, but I see her keep up with feeds via Reader on our living room TV daily.

Last week Google decides to kill it.  Silly.  But now what?

Options I’ve come across to contemplate:

  1. Newsblur

    Interesting article on how they are scaling it up to handle the new demand.  Downside?  Looks like it costs money.

  2. Feedly

    Looks slick. Does it cost anything?

  3. Digg?

    Perhaps promising but as of 2013.03.18 this is vaporware.

  4. Wunderfeed?

    Forget where I got this link. Like digg though, as of 2013.03.18, it's vaporware.

Max - from crib to toddler bed

15. March 2013 13:27 by Rick Glos in

Last night we adjusted Max’s sleeping from a crib to a toddler bed.  Our primary motive was safety.  Lately we had caught him hanging on the bar from the outside of the crib, who knows what was next.

WP_20130314_001

The bed comes with an optional side rail.  He did very well and didn’t even try to get out of the bed last night.  He was very chatty and talking about it in the morning when we woke him up and he got himself out of bed.

WP_20130314_003

We purchased this DaVinci Crib in Dec of 2010 (over 3 yrs ago) off Amazon.  Max is now 2 yrs and 4 months and we’re pleased with the $199 we spent on it.  Apparently with this Conversion Rail Kit, it can convert into a full/twin bed for another $75.

Recipe - Black Bean and Corn Soup

4. March 2013 08:55 by Rick Glos in

Turned out really good with a loaf of hearty bread.  Got the original recipe from here and tweaked it.  As the original post states, nice and creamy without having to add cream.

  • 1 bag of frozen corn
  • 1 cup of dried black beans (or 3 cans of black beans)
  • 1.5 cups of chicken broth
  • 1 (14.5 oz.) can of diced tomatoes with green chilies
  • 1/2 teaspoon of salt
  • (optional) grated cheese on top to serve

Simmer beans in pot of water for 2-3 hours. 

Heat large pot, add some oil, cook frozen corn for 4-ish minutes.

Drain, put 2/3 of beans in blender with chicken broth and blend.

Pour blended mixture, diced tomatoes, remaining 1/3 black beans, and salt into pot and simmer about 15 minutes or reduce to your consistency you like.

World of Tanks Tournaments

1. March 2013 17:34 by Rick Glos in

I’ve been doing some tournaments lately that have turned out well and netted some in-game gold.  WoT is one of the few games (only?) I’ve played where you can earn in-game currency to pay for you monthly subscription fee (2,500 gold per month).

I played in the Ultimate Conquest: Friday Scrimmage tournament and won 1,300 gold (1,000 for first + 50 for each victory).  It was a Friday only tourney that ran like a Soccer-style round-robin-group tournament.

3-1-2013 4-17-23 PM

Then in Ultimate Conquest: Absolute Power 2 tournament that ran daily over almost two weeks, we advanced through a huge deep bracket to take 3rd place overall and win 5,000 gold.

3-1-2013 4-23-53 PM

This plus holding onto Northern Italy on the strategic map (Clan Wars) has been netting us about 12,000 gold per day.

3-1-2013 4-27-18 PM

The next big one is the World of Tanks Classic, Season 2.  If i'm not mistaken, last years winners were flown to Moscow, Russia to fight against winner from other leagues (Europe and Russia).

In addition, a new league, Wargaming Professional eSports League, will be starting soon with a prize pool of 2.5 million dollars, apparently the largest in gaming history, beating out a recent League of Legends tournament.

Good time to be playing tanks.

Using ASP.NET Web API to disable Windows applications

27. February 2013 14:10 by Rick Glos in

Had an interesting problem to solve where sometimes at a client we need to disable applications during maintenance upgrades, overnight failures, etc. that would cause the application to either crash or show data that isn’t quite right, thereby confusing the users.  With a web application I’ve been using the App_Offline.htm trick for some time.  However what if it’s a windows application?

2-26-2013 4-48-01 AM

To solve this, I added a block of code that gets called during startup in these apps to determine if the application should be disabled.  Then someone, can use the web application to set a bit that the app is disabled and optionally add a reason that will get presented to the user.

In the windows applications I’m coding these days I’ve been using Prism heavily.  The best spot I could identify to place this method is in the InitializeShell before the user gets to see any UI and in the case of Prism, if the shell loads, it will start loading any modules you have registered with a region.  There, we call a method to go to the Web API and get back information.

   1:/// <summary>
   2:/// Initializes the shell.
   3:/// </summary>
   4:/// <remarks>
   5:/// The base implementation ensures the shell is composed in the container.
   6:/// </remarks>
   7:protected override void InitializeShell()
   8:{
   9:// Do not allow the application to launch if instructed not to do so
  10:    CheckToSeeIfApplicationIsDisabled();
  11: 
  12:base.InitializeShell();
  13: 
  14:    Application.Current.MainWindow = (Window)this.Shell;
  15:    Application.Current.MainWindow.Show();
  16:}

In the CheckToSeeIfApplicationIsDisabled method I call a service called InfrastructureService which handles the calling of the ASP.NET Web API.  In our case, we’ll need the application name, environment (test, production, beta, etc) and the url.

   1:private void CheckToSeeIfApplicationIsDisabled()
   2:{
   3:// Use whatever services necessary to get the infrastructure url, application name and environment - this is application dependent
   4:    var applicationSettingsService = Container.Resolve<IApplicationSettingsService>();
   5:    var assemblyInformationService = Container.Resolve<IAssemblyInformationService>();
   6:string infrastructureUrl = applicationSettingsService.InfrastructureUrl;
   7:string applicationName = assemblyInformationService.ProductName;
   8:string environment = applicationSettingsService.Environment.ToString();
   9: 
  10:// Use the InfrastructureService to check to see if the application is disabled
  11:    var infrastructureService = new InfrastructureService(infrastructureUrl);
  12:    var serverApplicationMetadata = infrastructureService.GetMetadata(applicationName, environment);
  13:if (serverApplicationMetadata != null && serverApplicationMetadata.Disabled)
  14:    {
  15:        var caption = string.Format("{0} - {1} - Application Disabled", applicationName, environment);
  16:        MessageBox.Show(serverApplicationMetadata.DisabledReason, caption, MessageBoxButton.OK, MessageBoxImage.Information);
  17:        Application.Current.Shutdown();
  18:    }
  19:}

Lastly we do the part where we call the service and get back data.  The data that we get back is in JSON format but using the ReadAsAsync method we can have the JSON get deserialized into a typed object if we want.  What’s cool is you don’t have to define every bit of information in the JSON, only those properties you care about.  If you don’t want to do it that way, you can also just use JToken objects to parse the returned JSON and grab the values you need.

Note that because this is an intranet, I need to pass in credentials and so I’m using a HttpClientHandler and passing that into the HttpClient.  I have it swallowing exceptions as I don’t want the applications to fail to load if the server is down or some other strange exception is thrown.  We should circle back around and at least log the exception using the Exception Handling Application Block so it gets logged somewhere.

   1:/// <summary>
   2:/// An encapsultion of calling the web api to get application information, etc.
   3:/// </summary>
   4:/// <remarks>
   5:/// <para>
   6:/// When using this service, add the Web API Client Libraries package to your project.  To do this, 
   7:/// click 'Manage NuGet Packages for Solution...', select 'Online', type 'Microsoft.AspNet.WebApi.Client' 
   8:/// in the search box, select the package and click Install.
   9:/// </para>
  10:/// <para>
  11:/// We may want to put this in a library if it's used alot or across different languages so that apps can just reference an external library.
  12:/// </para>
  13:/// </remarks>
  14:public class InfrastructureService
  15:{
  16:private readonly string _infrastructureUrl;
  17: 
  18:/// <summary>
  19:/// Default constructor requires the url.
  20:/// </summary>
  21:/// <param name="infrastructureUrl">Url, Example: http://yourserver/beta/Infrastructure</param>
  22:public InfrastructureService(string infrastructureUrl)
  23:    {
  24:this._infrastructureUrl = infrastructureUrl;
  25:    }
  26: 
  27:/// <summary>
  28:/// Returns an object with infromation regarding this application from a central server.
  29:/// </summary>
  30:/// <param name="applicationName">The name of the application as it exists in [infrastructure].[application].</param>
  31:/// <param name="environment">Production, Beta</param>
  32:/// <returns></returns>
  33:/// <remarks>
  34:/// We may want to make the environment parameter an enum or leave it string so it's very flexible in case more environments are added.
  35:/// </remarks>
  36:public ApplicationMetadata GetMetadata(string applicationName, string environment)
  37:    {
  38:        ApplicationMetadata result = null;
  39: 
  40:try
  41:        {
  42: using (var handler = new HttpClientHandler() { UseDefaultCredentials = true })
  43:            {
  44: using (var client = new HttpClient(handler))
  45:                {
  46:                    client.BaseAddress = new Uri(_infrastructureUrl);
  47:                    var requestUri = string.Format("api/applications?environment={0}&name={1}", environment, applicationName);
  48:                    HttpResponseMessage response = client.GetAsync(requestUri).Result;// Blocking call!
  49: if (response.IsSuccessStatusCode)
  50:                    {
  51: // Example #1: transform into somthing typed
  52:                        var convertTask = response.Content.ReadAsAsync<ApplicationMetadata>();
  53:                        var convertTaskResult = convertTask.Result as ApplicationMetadata;
  54:                        result = convertTaskResult;
  55: 
  56: // Example #2: transform into something not-typed/dynamic (useful for peeking at all the JSON)
  57: //var taskResults = response.Content.ReadAsAsync<Newtonsoft.Json.Linq.JToken>();
  58: //var taskResult = taskResults.Result as Newtonsoft.Json.Linq.JObject;
  59: //foreach (var item in result)
  60: //{
  61: //    var jitem = item as JObject;
  62: //    var disabled = jitem["Disabled"];
  63: //    var disabledReason = jitem["DisabledReason"];
  64: //}
  65:                    }
  66:                }
  67:            } 
  68:        }
  69:catch (Exception)
  70:        {
  71: // TODO: Handle the exception by logging it or swallowing it.  Do not rethrow as we don't want the inability to communicate with infrastructure app to bring down the application.
  72:        }
  73: 
  74:return result;
  75:    }
  76: 
  77:public class ApplicationMetadata
  78:    {
  79:public int ID { get; set; }
  80:public string Name { get; set; }
  81:public bool Disabled { get; set; }
  82:public string DisabledReason { get; set; }
  83:    }
  84:}

PDXLAN 21

19. February 2013 07:17 by Rick Glos in

Gone is another PDXLAN.  I’m still recovering from staying up until 4 AM for 3 days in a row.

WP_20130219_001

I did win a prize in the raffle this year.  A mechanical keyboard (Thermaltake KB-MEK007 – $89) and a mouse pad ($29).  I tried the keyboard for about 5 minutes before switching back to my existing keyboard.  The lack of a windows key was apparent in the first few minutes as I tried to open Windows Explorer with Windows+E.  The fact that is was a compact keyboard was also very difficult to overcome.  Mechanical keyboards are supposed to offer better tactile feedback and be ‘faster’.  It certainly is heavier and noisier since you audibly hear each individual keystroke.  I am giving the mouse pad a try.  We shall see.

WP_20130219_003

We also made a Harlem Shake video which is the current internet meme rage.

All signed up for the next PDXLAN 22 on Jul 12-15 2013.