Archive for the ‘.NET’ Category

While working on a project at my new job I ran across a problem where I needed to update a WPF UI (databound collection) from an async call. There are tons of examples on the internet of how to do this, but few of them seem tailored for the MVVM model where your ViewModel doesn’t have knowledge of the view (and thus doesn’t have access to the view’s Dispatcher). For scalar types this isn’t a problem as they are marshaled to the UI thread in WPF, but for collections bound to controls, this becomes asynchronous updating is an issue.

Fortunately, Jeremy Likness came up with an elegant solution. Instead of regurgitating what he did, I’ll just point you to his blog post. While is post is about Silverlight, this is also applicable to WPF.

I thought his solution was simple & elegant (and best of all, it works!)

Dispatching In Silverlight

Adams Complexity Threshold

…complexity is what guarantees mistakes will happen and won’t be caught.

The same is true for software.

This is the third post in a series of posts about the IPTV project.

In the previous post I talked about the Video Signal Path. In this post I’m going to talk about how we control the DISH Network Satellite receivers remotely without the aid of hand held remote controls. We’ll look at the IR Command Path for the DISH Network Satellite Receivers and the role that the Global Cache CG-100 Network Adapters play in allowing us to control devices.

As stated in the previous post, the DISH Network receivers are stored in a climate controlled server room under lock-and-key. This is great for the receivers, not so great for the jailers trying to change a channel.

Fortunately, this is where the Global Cache GC-100 Network Adapters come to the rescue.

Global Cache GC-100 Network Adapter

The GC-100 is a really cool device. What it allows you to do is send ASCII text commands to it over a network. It then interprets those ASCII commands, transforming them into IR commands that can be understood by the device you’re trying to control.

For this process to work, the GC-100 has to be located next to the device you want to control as it utilizes short, wired IR Emitters. Basically, you string a wired IR Emitter from the GC-100 to the IR input of your device (in this case, the front of the DISH receiver where the IR receptor is located). The IR Emitters have a sticky substance on their face that allows you to fasten the emitter to the front of the IR input on the DISH receiver. However, in reality, we found this sticky substance to be pretty pathetic, so we fastened the emitters to the receivers using black electrician tape.

The GC-100 is then hooked up to the network via CAT-5/CAT-6 and given a network address.

Sending Commands To The GC-100

Having the GC-100 IR emitters hooked up to the DISH receivers and also having it plugged into the network is only half the equation. The next thing you need to be able to do is actually send ASCII commands to it. These ASCII commands are actually text representations of IR signals. But how do we know what commands to send? What do they look like? How do we create them?

Programming The GC-100

Fortunately, the folks at Global Cache created a little tool that makes this whole process much easier. It’s called an IR-Learner.

What the IR-Learner does is allow you to point a remote control at it and capture the ASCII representation of the command. So, for instance, you can take the DISH Network remote control, press the “Power” button, and the IR-Learner will capture the ASCII representation of that “Power” command. From that point you just need to save that text somewhere. In our application, we choose to save this in a database.

Operating The Virtual Remote

So now we have the GC-100 hooked up to the DISH Network receiver, and we have the ASCII commands saved in the database. How do we actually control the DISH Receiver? Remember, the DISH Network receiver is housed in a climate-controlled environment. The jailers do not have direct access to the DISH receivers. What happens when they want to change a channel on the receiver?

We start at the client application, with a view that shows us a virtual DISH Network Remote Control:

The Client

The user can click a button on this virtual remote control. The client then sends a request to the server application via WCF Duplex Channel. The request basically consists of an ID for the internally stored ASCII command that is located in our database.

The Server

When the request reaches the server application, it fetches the ASCII text from the db cache (we’re using NHibernate and an internal cache in the service to save round trips to the db). The server application then formulates the appropriate command to send out over TCP/IP to the GC-100 Network Adapter. You need to specify the IP Address of the GC-100 that you want to talk to, as well as a “module” on the GC-100 that you want to send the command over (a module in the GC-100 corresponds directly to a physical device you are controlling, in this case a specific DISH receiver). For instance, the GC-100-18 has multiple modules so it can control multiple “devices”. We used one GC-100-18 to control four DISH receivers. By specifying the module we specify which of the DISH receivers we want the IR signal to go to.

Conclusion

There are a lot of pieces involved in this part of the puzzle, but the result is a simple interface in the client application that non-technical people can understand and utilize. Almost everyone nowadays has a DISH or DirectTV remote control at home. Jailers can easily make sense of the client interface, press a button on the remote control and thus control the DISH receivers remotely, from the comfort of their command and control stations.

This is the second post in a series of posts about the IPTV project.

In the previous post I introduced the IPTV project that we built at Nez Perce County. Today I’m going to talk about the Video Signal Path. Basically, how we route the video signals to the individual television sets that are scattered throughout the jail.

We begin with four DISH Network receivers located in a climate controlled server room environment. The output from each DISH Network satellite receiver is taken to a port on the Osprey-450e Video Capture Device. The ports on the back of the Osprey accommodate standard RCA video cables. The audio RCA cables are attached to a squid on the Osprey.

The Osprey-450e is located on a Windows XP box that we built. This is where our server-side application (written in C#) resides as well as an installation of open source VideoLAN (VLC) software package. Our C# server application utilizes VLC processes to perform transcoding and streaming of the DISH network signals that are coming in off the Osrprey-450e. What we’re doing here is taking the signals that the Osprey is providing and we’re transcoding them into MPEG-4 format and then multicasting them via UDP over the internal network.

The streams then travel over CAT-6 cable throughout the jail facility. The streams are broadcast as multicast UDP, so any device that is listening on this internal network can receive the signal. The Tornado Set Top Boxes receive these streams via the plugged in network cable and transmit the signal to the television sets via HDMI cables. By issuing commands to the Set Top Boxes, we can instruct the STB on which stream to display to the television.

In the next post we’ll cover how we control the DISH receivers remotely without the use of hand held remote controls.

It’s that time again: time to move on. I’m officially looking for a new job.

To get an idea of what I have done and what I can do, check out my resume or my CV on Careers.StackOverflow.com. Also, browse this blog :-)

Why am I looking for work?

For the past five years I have had the privilege of working for Randy Buttenhoff at Nez Perce County. It’s been one of the best jobs I’ve ever had, and the best job I’ve had as a software developer. I work for a great boss who gives me all the tools I need to be successful. At various points in time our team has passed most of The Joel Test. I’ve been able to work with great coworkers who are really good human beings. I’ve also been given the ability to continue to grow as a software developer: to attend conferences, read blogs, experiment with new technologies and tools and keep up with the rapidly changing pace of this profession. I have enjoyed growing as a software developer.

But life has a way of throwing surprising events at us. Sometimes those events are laced with sorrow; sometimes they are good; and sometimes, if we’re lucky, they’re wonderful. Recently, I became engaged to the most amazing woman I’ve ever met. She has plans for her immediate future and I support those plans, and so that means I will be moving to her. Hey, I’m a software developer, or as I like to say, a professional problem solver – I can write software anywhere in the world. It’s a scary thing to pick up your life and move across the country, but for the right reasons, and the right people, it can be worth it. It can even be easy.

I am specifically looking for work in or near the Kingsport, Tennessee area. I will be moving to Gate City, Virginia, just across the border from Kingsport, and Kingsport seems like the most likely place to find my kind of work. I am, however, also very open to the idea of working remotely or in a consultation capacity, which is something I’ve done in the past.

What kind of work am I looking for?

My preference is work with the .NET platform (C# variety). It is where I have spent the most time in the last decade and where I am comfortable. I really like a lot of the tools and technologies and feel like I can solve problems pretty quick with my currently favored technology stack (C#.NET, SQL Server, NHibernate, FluentNhibernate, NUnit, StructureMap, etc.). That is not to say that I am opposed to new tools or technologies – far from it. If an employer thought I would be a good fit for a position as a Ruby on Rails developer, by all means, talk to me.

Most of my current work takes place in WinForms development, but I also enjoy ASP.NET development and have done some very basic WPF work as well. I especially like what I am seeing out of the ASP.NET MVC camp and the FubuMVC stuff from Jeremy Miller, Chad Meyers, et. al.

I would like to work somewhere where I have the same freedoms that I have now to continue to learn and grow as a software developer. The landscape of computer programming changes so rapidly; we owe it to our profession and our customers to stay up-to-date, continue to learn new technologies and tools and grow as problem solvers. I would like to work somewhere much like where I work now: where I am given the tools and hardware to be successful and given the time and support to continue to grow. It would be especially nice to work somewhere where there was a budget for developers to attend conference such as Agile Austin and the PDC. I attended the first Agile Open Spaces conference in Austin a few years ago and met many of the people in the C#.NET world that I admire. I also learned a lot and grew quite a bit from that conference.

At any rate, I’m on the market and openly looking for a new job. I would like to have a new job lined up by August at the latest. My current employer supports my decision and knows the reason for my move, so references from him are available on request. If you know of anyone near Kingsport, TN who needs a talented .NET developer, send them my way, eh?

-Chris