Posts

Showing posts from 2018

What were they thinking

Image
As of late I have been spending a lot of time working on a “legacy” system. The term legacy means different things for different groups, in the circle I’m working with these days it means a system that is no longer being actively developed. As has been stated by mean, software isn’t “dead” it’s “done”. The catalyst for the work I’m doing is security requirements that need to be applied. While applying the updated security polices I’ve also been tasked with migrating the system from our data center to our cloud data center. As I move through the system I’m confronted with implementations that looking at now seem crazy; however, it’s these situations where it is important to apply two mindsets. One is giving others the benefit of the doubt. In a case like this, those that were working on this system used, for the time, the best options the technology stack could offer. For example, the extensive use of WCF seems silly now; however, at the time it was a recommended approach to hooki

Being a good customer means being able to complain in a way that is helpful

Image
I'm often told that I deal with difficult situations in a way that results in getting what I want. To me this is quick an interesting observation because I find that most often what people mean when they say that is, when I receive a poor customer experience I'm able to turn things around so that I obtain a desirable outcome, thus turning a bad experience into a good one. This manifest itself most often when I'm out and about with my wife. We will be at a retail store, or out to dinner and something will go wrong. Often my wife will turn to me and suggest that I handle it since "I know how to deal with these things". So what is the secret to my taking a bad situation and turning it around... being a good customer. As it turns out business want to make money. Shocking, I know. The way they make money is by advertising to attract customers to frequent their brick and mortar locations to use their services or purchase their goods. Knowing this puts the customer

Benefits of Working with .NET ConcurrentQueue<T>

Image
* Working with a queue in .NET is an excellent experience and provides a great way to decouple execution paths. Once you start working with in memory queues your just a hope, skip, and a jump away from using "infrastructure" queues such as Service Bus, RabbitMQ, or even MSMQ on Windows Desktop. While it is quite possible to work with the standard .NET Queue<T> object if you find that you are in need of using a lock to ensure consistent results with putting things in the queue (i.e. Enqueue) and taking things off (i.e Dequeue or Peek) or even just to obtain a consistent reliable count, well then you should probably take a look at ConcurrentQueue<T> . There is a whole section of the .NET Framework with deals with concurrency concerns by creating specific objects for Dictionaries, Stacks, Queues and more that are considered thread safe. When I started working with ConcurrentQueues I found it helpful to put my own wrapper around the concurrent queue object and

Things I need to remember... IIS Express ports for HTTPS and Configure WCF Rest endpoints for HTTPS

Image
As I have been writing consistently for a bit now I've already found myself referring back to things I've posted, which has prompted me to try and post items which have taken a bit of time to work out. It seems that the act of "writing it down" causes me to remember information better. Perhaps it's all the thought into attempting to write something useful. This post includes two details which took me more than a few hours to sort out so I hope to help others who have a similar need. Funny enough it could be me in the future after I've forgotten this information. First up is a little detail that I know I've forgotten and looked up more than once, and depending on the google/bing results I find sooner or later. Setting up IIS Express to host a site via HTTPS When configuring your site to run in IIS Express using Visual Studio it's fairly trivial to set the attribute to use SSL (i.e. HTTP over SSL which is HTTPS) as it's just an "

.NET MSTest and DeploymentItem Attribute

Image
I was recently reminded that order of operation can byte you when trying to troubleshoot intermittent unit test failures. First, I’ll be the first to admit that if you want to avoid problems with unit testing it’s best to avoid any dependency outside of your actual code base, things like databases, API and even the file system are best avoided in execution of your unit tests. That last one, the file system, in some applications is really hard to avoid. If you happen to be using MSTest, a helpful attribute for your test is DeploymentItem. This particular attribute allows you to define a file within your unit test project assuming it’s marked as “Copy Always”. With this attribute in place you can then combine this with TestContext.DeploymentDirectory to find this sample file and then do what you need to do. In my particular case I was having an issue with the unit tests failing on the build machine but not locally. After stumbling around for a bit I finally feel back to t

Keep Calm and Get the Facts

Image
It often amazes me at how often I find myself apologizing to others for rashly commenting on a problem before I have all the facts. In fact, after so many years as a professional in the IT space and dealing with countless critical situation/severity one problems (a.k.a. Sev1, crit-sit) I would be able to react in a more appropriate and beneficial manner. The sad truth is that, as I write this post. I JUST "did it wrong" on a Sev1 from earlier in the day and found myself sheepishly apologizing for my brash response. Perhaps by writing this down and publishing for others to read I can obtain the positive results of public shame to result in my correcting my behavior. At least there is a chance someone else can read this and benefit from my mistakes. The fundamental problem I seem to have is that I hear a few pieces of information or even just the subject line of an e-mail or short text message and immediately jump to a conclusion. Having done a bit of a personal post-morte

Compose a message through some else’s eyes

Image
Twilight Zone: The Eye of the Beholder I've always enjoyed science fiction work that intended to make the onlooker reflect on their world view, you know, really make you think about yourself. A wonderful example of that is the classic Twilight Zone: The Eye of the Beholder. Although I don't think it's needed at this point I will mention there are spoilers about this particular episode. The story outlines the tragic plight of a woman who has been horrible disfigured and all other attempts to make her look "normal" have failed until this final last ditch attempt. Through out you don't see the woman or the faces of the other characters. That is until the end when they unveil the woman by removing the bandages and you see, what at the time of filming, would have been considered an attractive movie star and as the camera pans around you also realize that everyone else appears to be "disfigured" according to what the vast majority of humans look l

HTTP BIN - Developer Tools

Image
One of my favorite tools in my 10 in 1 screwdriver. The appeal is that in a single tool, just by flipping some pieces around you have just what you are looking for. In many minor jobs around the house I can do everything needed just with this single tool. When writing software you can find similar valuable tools and one such valuable tool is http://httpbin.org Like with most tools, the simplicity can be deceptive because how hard could it be to have an API that just echo's back what you sent. But then that is what is so great about httpbin, it's done and it's very robust. By way of example, when building a front-end you may find that the API isn't complete and thus you want to "stub out" the calls. With httpbin you can send a call such that it echo's back what you want and thus you are wiring up to an actual HTTP call. On the server side you might have the same need to wire up to a service that isn't something you are allowed to call fr

Using telnet to troubleshoot connectivity.... and watch Star Wars

Image
So the teaser I'll lead off with is, at the end of this post you'll know how to watch Star Wars A New Hope in ASCII art form (i.e. text based graphics)... So let's begin. Recently I found myself working on a legacy application such that I had to redeploy the multi-node application into in Infrastructure running in Azure. Two of the models communicate via a WCF binding over net.tcp. While I was operating under the impression that the firewall had been opened up to allow the communication I was a bit stuck on how to validate that the communication was working. So I wandered up to the networking area to chat with our Network Architect. As I often find, chatting with those who have an expertise different than your own requires patience and effort in the area of translation. Even though we both work in the IT field we each have our jargon to deal with, but the price of admission is well worth it. In just a few minutes of explaining my challenge I had been provided wi

Talk to the Rubber Duck

Image
*See attribution of image at the bottom. One of the greatest tricks I have had the pleasure of participating in is that of helping someone solve a problem simply by listening. I'm sure there is a more accurate description of this phenomenon, but in the world of programming it's called Rubber Duck Debugging . I was first introduced to this idea from listening to Jeff Atwood podcasts/interviews as well as reading his blog under CodingHorror.com  he wrote about the topic under the title Ruber Duck Problem Solving . Why the term Rubber Duck? Really it has nothing to do with the rubber duck, the intent is to encourage someone to solve their own problems by working through the very difficult challenge of describing what the problem actually is. It is often surprising to people when they discover that simply the act of attempting to describe a problem helps them to find the answer they were looking for. So my approach to assist others is by asking questions that I often ask

Example of using LazyInitializer.EnsureInitialized

Image
When looking at making systems more efficient it's helpful to think about being lazy. A helpful tool in the .NET tool belt is the static class under the System.Threading namespace LazyInitializer. In particular this class contains a method  EnsureInitialized This method is very simple to use and provides a convenient way to ensure that an initialization is called only once based on the value of the target property already being populated. For example, if you need to load a file as part of the setting of values in an application you can use the EnsureInitialized method. The following is a derived example of using the class to illustrate the usage pattern. If you are having trouble viewing the below code you can use this link to view the gist github. https://gist.github.com/briannipper/ac2778ccd0d15b4ab217083331419ae7 using System; using System.Collections.Generic; namespace Example.EnsureInitialized { class Program { static void Main(string[] args)

Automate Work and Life with IFTTT and Office 365 Flow

Image
I'm a huge fan of automation for situations where I find myself doing something mindlessly over and over again, like punching a clock. The way I approach these problems is to find a way to eliminate some portion of the task and iterate till it just happens on it's own. To avoid confusion, when I say punching a clock what I mean is knowing a rough approximation of how long I worked on a given day so that when I need to put in my "billable vs. non-billable" time at the end of the week I have a rough idea of how much time I spent on working each day. As such the way I "manually" accomplished this was putting the time I arrived at work and the time I left into a spread sheet. So, step one, avoid having to open excel to enter the information. This was easy using a feature of Office 365 called Flow . It's an application that smells very similar to the populate If This Then That site (a.k.a. IFTTT.com ). Flow makes it easy to setup operations that

Fire in London helped preserve the city of Savannah GA through the modern age

Image
By Pierre Fourdrinier and James Oglethorpe [Public domain or Public domain], via Wikimedia Commons Once upon a time, before my wife and I had kids, we visited the city of Savannah, GA. We had the opportunity to take a carriage ride through some of the most oldest portions of the planned city. A detail of the tour that has stuck out in my mind was how much of the original street remained unchanged. The reason this stuck out was, as I had found in visiting a few other historic locations on the east cost of the US, many locations as old, if not older, had to be altered to accommodate motor vehicles. So why was that not the case for the planned city of Savannah GA? Because of fires in London. Huh? The founder of Savannah was James Oglethorpe . Born in England in 1696, he would have been familiar with the fires that ravaged that part of the world in 1666. The  great fire of London burned through much of the city due to many factors, one of which was the way homes were built, basica

Creating a DSC module to install Oracle Client and disable enable UAC

You ever get a task and think, how hard can this be? Then you begin down what turns into a seemingly never ending journey. Welcome to mixing old and new technologies. I found myself in the position of needing to install the Oracle Client on a Windows VM running in Azure using Desired State Configuration (a.k.a. DSC) and, well, let's just say it was an interesting journey. Listed directly after this is the snippet of the DSC which I'm posting here in hopes that others who have a similar need may stumble across this and save themselves from headache. I'll provide a break down of the major pieces. I have intentionally left the logging pieces in the script so that any who would be so bold as to cut and paste without reading over at least have a log to dig into. A few important prerequisites to using this script. You'll need a DSC module that downloads the Oracle Client Package, the one I used was for 11gR2 and includes an answer file for the client. These ite

Resilient Scripting is scripting that can be rerun... safely

Image
Making a script that is resilient can mean many different things to different people, IMHO an important one is to be able to re-run a script "safely". By safely I mean to minimize side effects and to prevent negative consequences. To illustrate let's say we have an install process and we need to log details about what happens when we run the install. To keep this simple let's just focus on the logging requirement. We want a log file that we can look at when an install happens. So a simple approach would be as follows. Set-Content log.txt "Information about Install" Nice and simple, we have satisfied the requirement. But let's see if we can make this one liner more resilient. $logFileTime = Get-Date yyMMddhhmmss $logFileName = $logFileTime + "_log.txt" Set-Content $logFileName "Information About Install" Now even if we run this install multiple times we will have a script for each instance of the install even when

Dogfooding is important for business policies as well

Image
Perhaps you are unfamiliar with the term "dogfooding", in short it is the idea that a company or organization use its own Product or Service in addition to providing it to the others. A more complete definition can be found on Wikipedia under Eating your own dog food . The reasons a group might chose to dogfood are varied, but an important reason is to ensure that they are familiar with the challenges with using the good or service, or to put it in business jargon... they want to find opportunities to make, what they make, better. For groups that are just starting to do this it can be EYE OPENING what their customers/patrons are dealing with to use their stuff. Often the overall impact is great and everybody wins. So why not do this for policies within, let's say an IT organization. How would one go about dogfooding a policy you may ask? Thanks for asking... let me tell ya what I think. For any organization to be successful there needs to be consistency in the way