Rick Glos Life in Portland, Oregon.

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.

Lost Regiment Series by William R. Forstchen

20. December 2012 12:44 by Rick Glos in

I’m finding this series, Lost Regiment Series by William R. Forstchen, to be particularly good.  I thought he first one was so good, it needs to be a movie.  Careful researching this though because if you read the plot, it’ll destroy some of the novelty and the first book has some great plots.

Apparently there are 9 books in the series and at this point I’ve made it through 5.

Here’s what I’ve read so far:

  1. Rally Cry (1990)

  2. Union Forever (1991)

  3. Terrible Swift Sword (1992)

  4. Fateful Lightning (1992)

  5. Battle Hymn (1997)

And here’s what’s next:

  1. Never Sound Retreat (1998)

  2. A Band of Brothers (1999)

  3. Men of War (1999)

  4. Down to the Sea (2000)

They are hard to find though.  I’ve been buying them used through Powell’s Books here in Portland.

Starting Preschool

8. October 2012 11:28 by Rick Glos in

DSCN0615

Max had a big week last week when he started pre-school.  He’s in a Montessori school.  They phased him in over the week.  We went with him for an hour on Monday, then 2 hours on Tuesday, Wednesday we left him there for 3 hours, same on Thursday and by Friday it was his first day (about 6 hours) all by himself. 

The prior week, his teacher came to our house to visit for an hour on Thursday to get to know Max on his turf which I thought was a nice concept as well.  Then on Friday we went in for 30 minutes at the end of the day after most of the kids were gone so he could get a feel for the classroom.  Heidi’s mom will still be helping us out from time to time during vacations, school closings, etc, and so the four of us all went.  Here he is using the magnifying glass to look at a sunflower.

DSCN0609

Here Max is using the screwdriver with his teacher Megan on his first day (1 hour only with us with him).

DSCN0618

I think he’ll do well there and start working on his socialization skills.  It’s been a great almost 2 years and I’m really going to miss having him at home.  When I would come upstairs from working to grab a snack, bio, or lunch, he’d hear the basement door open, yell, “Papa!” and come running towards me.  I was able to see a lot of really great things during these last two years and I’m really going to miss knowing that if I want to see him was right upstairs.  I’m going to miss you buddy…

Compounding that is that Heidi’s mother who was watching him will no longer be here each week and that is going to suck as well.  She helped not only with Max but did loads of dishes, laundry, yard work, etc.  All kinds off stuff Mom’s do.  I had forgotten how nice that was haha!

On the positive side, I’ll be picking Max up everyday at 3 PM and we’ll be riding the bike.  He loves that and had a great time with me on Friday.  His spatial awareness is amazing.  He can be 2-3 blocks from home and recognize where he is.  I know this because he’ll start saying, “More bike. (pause) More. More.”, and maybe throw in a whimper or two because he knows were about to reach home and stop.  Our first ride was along busy Capital Highway but I think I can find a back roads way so we can talk, stop and look at stuff, hit the park if we want to, etc.

Baby Monitor, Wireless IP Camera, Surveillance, etc

5. October 2012 11:59 by Rick Glos in

I recently was reminded when someone asked me about what we used for a baby monitor for Max and would I still buy one?

I purchased an IP Camera (it’s name is a mouthful - LTS Wireless+RJ45 640x480 IP Camera with 30 IR LEDs and MicroSD Card Recording) at the end of summer before Max was born (Aug 2010).

The idea was using our home network, we could look at the crib without the baby monitor, closed-network restrictions.  Like being able to look at the screen with any IP device that can surf the web – your phone in your backyard, the kitchen on your laptop, your living room on your TV, your bedroom on your TV, etc.  It has worked flawlessly and we still use it to this day every day.

It’s mounted just above his crib pointed right down at it.

DSCN0621

We use it right when he goes to bed to see, “Is he falling asleep?”, “Is he standing in his crib because he just pooped his pants?” to when we get up in the morning to see if he is awake yet and during naps to know when he’s done sleeping.

Here’s our view from the couch in our living room.

DSCN0623

For a non-technical user I’d say this specific device itself would be moderate to difficult to setup – you’d need to know how to enter an IP address, find it on your network, play with a few settings, etc.

At the time, we got it for $180 and now I see it’s down to $157.  It has both wireless and wired.  We ended up sticking with wired because I was having issues with the unit staying connected via wireless.

We’ve thought about getting another one.  Would I buy it again?  If I had to go back in time, yes.  But are there better options 2 years later?

I found this guy after a bit of research on Amazon - 900+ 4.5 star reviews, $90 price tag, and some great photo’s from users implementations.  It has a mouthful of a name as well - Foscam FI8910W Wireless/Wired Pan & Tilt IP/Network Camera with IR-Cut Filter for True Color Images - 8 Meter Night Vision and 3.6mm Lens (67° Viewing Angle) - Black.

I like that you can pan and tilt remotely.  With ours you have to do it manually – although we only needed to move it during initial setup since we have it focused on his bed.  Although as he gets older, it might be nice to see, “What’s he doing in his room?”

One additional suggestion; turn off the audio – we had it on to start with but found it annoying because you’d wake up ever time your child sighs or mumbles in their sleep and Max seemed to make a lot of noise.

In any case, I can’t recommend getting an IP Camera enough.

Using Windows Media Center to watch TV

11. September 2012 12:39 by Rick Glos in

We cut the cable cord but we still would like to watch TV.  I’ve been a cable user for the last 15 years or more and haven’t touched an antenna since.

I ordered an Indoor TV Antenna and TV Tuner off of Amazon for around $150 bucks.

AntennaTV Tuner

The installation into our media center pc went pretty smoothly. 

Remove the cover.

DSCN0548

Unbox the TV Tuner

DSCN0550

Install it in an open PCI Express slot.

DSCN0551

There’s four ports on the back of the card.  A Cable TV / TV Antenna in, FM Radio in, an Audio/Video in and a IR input.  The IR input I think will be important later when we want to control Media Center with a remote control in addition to the keyboard.

DSCN0552

I mounted the TV antenna behind the TV on the wall so it cannot be seen.  The cord coming out of the antenna, which is a coaxial cable, plugs right into the back of the tuner card just like cable would, which brings the total to 4 cords into the media box – power, antenna, cat-5 and HDMI (for outputting video and sound back out to the receiver).

DSCN0553

When I started the PC, Device Manager did not automatically load drivers to I went Hauppage’s website to get the drivers directly for the WinTV-HVR-2250 and installed them.  Fired up Windows Media Center and it detected the new TV Tuner card and began a setup wizard process starting with a zip code.

DSCN0554

It downloads program information off the web and ends up with a finish screen.

DSCN0557

Looking at the TV Guide showed all the new channels available.  I thought it looked nice and was an upgrade from the UI in the Comcast DVR.  While browsing the guide, the background is transparent and you can still hear the current channel.

DSCN0560

The picture came in High Definition very nicely and you  get all the controls you would expect with a DVR (stop, pause, record, etc).

DSCN0561

We recorded a couple shows to get a feel for how that works and I’ll add some notes about that in another post.

DSCN0563

Overall we are both very pleased so far with the experience and the wife acceptance factor is very high with these.  I find her experimenting with options and doing things without me showing her a thing.

Cutting the cord with cable

9. September 2012 09:30 by Rick Glos in

Last week we canceled cable.  Too expensive with prices at $250 a month.  Sure we started off like most people with a special offer package around $99 bucks a month with all the channels.  Eventually the special offer expires.  You call to cancel and they extend the offer another 6 months.  This continues over the course of a few years.  Eventually you call and they aren’t extending the offer.  Like an addict, you have become hooked on some shows on premium channels (like Inside the NFL on Showtime, Game of Thrones on HBO, etc) and channels in the sports lineup like NFL RedZone – NFL with zero commercials.

Stepping back and looking back I can see how it happens but it has gone too far and even if they did extend the offer again, I am growing tired of calling back each 6 months when the offer falls away and having this large cable bill.

I do wonder if they really need to charge that much.  While I might feel taken advantage of, its still my choice.  So voting with our dollar and cancelling is all we can do.

On the positive side we have been greatly enjoying the Windows Media Center PC I built driving the TV in the living room.  Watching movies from the file server, listening to music, looking at pictures and home video, etc, and the wife acceptance factor is very high with this.

DSCN0547

The case makes it look just like a component in a home theater system.

I’ve ordered a TV Tuner card and HD antenna so we can watch and record TV over the air.  This will be an interesting next project.

Frozen Hell

11. August 2012 11:14 by Rick Glos in

Finished the book A Frozen Hell: The Russo-Finnish Winter War of 1939-1940 .  It was an interesting read about a part of the war I didn’t know much about.  Inspiring how a force so small could do so much damage to a force so large and how much a part politics plays in decision making.  It was sometimes dry and I would’ve liked more personal stories and more maps defining the locations described to give better context.

Eating dirt

27. February 2012 14:15 by Rick Glos in

Mmm…. dirt!

DSCN0187