Monday, February 22, 2016

Traversing TFS Links

Recently, Team Foundation Server (TFS) has added some new features that my team is using. One of these features is the new Epic work item. We are using epics to track high-level business initiatives, with features underneath the epics to track user requirements. Underneath the features, we have user stories, which are self-contained units of work that can be tested and deployed independently. My team works with user stories and tracks everything through user stories. I need to drive my reporting by user stories but relate the data to the epics that they are under.

The built-in reporting capabilities of TFS are pretty good, but they don't handle the kind of roll-up reporting I need. A consultant friend shared some code snippets with me that use the TFS API to pull data from the TFS database. I'm building out my custom reporting using the TFS API. One of the first challenges I've run into is starting with a user story and determining the epic that contains that story.

I struggled trying to understand how to follow the links that are available on a TFS WorkItem object. This link pushed my understanding forward quickly. It helped me understand how to identify the "type" of link that I was seeing.

"The tricky bit" for me is identifying the type of link I'm dealing with. Here is the code snippet to do that:

if (link.LinkTypeEnd.Name == "Parent")
In this code snippet, I am filtering on links that are of type "Parent." One could easily filter on other types of links based on need.

As I develop my TFS reporting capability, I will document what I'm doing to make it less mysterious for others.

Monday, February 15, 2016

Pinewood Derby and Arduino Coding

My middle son's Pinewood Derby for Cub Scouts was about a month ago. His pack usually has an "outlaw" division for dads, siblings, and other family members to submit cars. Usually I don't submit a car for the derby, but this year I decided to create a car powered by Arduino.

My original idea was to put a motion sensor on the car, have the Arduino detect that the car was moving, and start up a motor with a propeller. The way the project played out, I got the Arduino kit about 3 days before the Pinewood Derby, so I had to throw something together very quickly.

I cut the car into a basic platform, with a cut-out intended for the motor. I slapped some black paint on it to cover the wood and mounted the wheels. I didn't put any time into making it faster or straight because my intention was not to win a race.

Next I had to do something with the Arduino. I purchased the Arduino Uno with a basic electronics kit. The kit came with jumper wires, resistors, and numerous sensors. It was perfect! I spent a few hours installing the Arduino IDE and playing around with sample sketches. Now I was ready for my project.

My initial idea of driving a motor with the Arduino was doomed to fail. First off, I needed a 5V battery to power the Arduino. I really didn't have room on the car for the Arduino board, battery, and motor. (If I had more time, I would have used an Arduino micro.) Second, not being an electrical engineer, I didn't realize I needed a relay switch to power the Arduino and the motor from the same battery. This realization put my whole project in jeopardy.

At this point I was frantically scrambling to come up with something I could do for this project. I settled on mounting the active buzzer component, with a ball switch. I found a sketch that set up all the notes on the scale and played a melody repeatedly through the buzzer. I wired the buzzer into the Arduino board with the ball switch so that the melody only played when the car was angled downward. (This ensured that the car wasn't annoying everyone unless it was perched for a race.)

The project came together as a family effort. My oldest son helped me mount the board to the car while I figured out how to get the electronic components mounted. My middle son helped me figure out the first few notes of the Imperial March (think Darth Vader theme song) so I could program that into the sketch. I used the space for the motor to mount the battery, and was able to get something together. Here is a picture of the car.

The code I downloaded and modified to play the Imperial March is here on Github.

Even though the project didn't come out as I expected it, it had the desired effect. Numerous adults and scouts asked me about the car. They were all interested in how it worked and what it did. This was exactly the purpose of the project.

I wanted to show the scouts that something like the Pinewood Derby could be looked at through a different lens. I wanted to show the kids that technology can be used in different ways, even on a wooden block with wheels. Although it wasn't perfect, I'm still proud of my first IoT project!

Saturday, February 6, 2016

Evangelization

The St. Ferdinand Men's Club has been reviewing the four signs of a Dynamic Catholic from the book by Matthew Kelly. I was supposed to do a brief presentation at our February meeting, but it got bumped due to a full schedule. Since I'm not sure if it will get rescheduled or not, I thought I would convert it into a blog post.

The first sign we covered was prayer. We covered it first because it is the first sign in the book, and because I feel it is the basis for everything we do as Catholics. The next sign I was going to cover is evangelization. I skipped ahead because I think this is the toughest of the four signs, and I think it is one of the most critical for our parish at this time.

What is evangelization? Fundamentally, evangelization is sharing our faith with others. It is being open to opportunities to talk about our faith, our faith journey, and our practice of the faith. Evangelization is also about sharing our faith with our faith community (parish) and helping to bolster our fellow parishioners.

When I want to understand how to evangelize, I turn to the saints. The first saint I look to is St. Rose Philippine Duchesne. She is the dedicated religious that founded St. Ferdinand school and helped bring Catholicism west of the Mississippi river. She evangelized by working for the poor, building schools to teach the faith, and by supporting the missionaries in any way she could.

Another person I look to for help understanding evangelization is Fr. Pierre De Smet. He was a Jesuit missionary in America, whose "home base" was St. Louis. He was instrumental in establishing missions in Florissant, MO, Kansas, and Oregon. He made great strides converting Native American tribes by learning their language, understanding their customs, and adapting his approach to their particular needs. Fr. De Smet's peaceful approach to evangelization earned him the respect of most of the Native American tribes west of the Mississippi.

Stories of holy people moving thousands of miles from home to start missions and teach poor kids are exciting and romantic. They make evangelization seem intimidating for most ordinary people. The key is to understand that St. Rose and Fr. De Smet had particular callings that spoke to their characters, allowing them to do these things. Most of us are called to evangelize in simpler ways.

St. Rose, despite her accomplishments starting schools, was most known for her prayer life. She was known by the Native Americans as the Woman-Who-Prays-Always. Her contemporaries were convinced of her holiness because of her diligence in prayer.

Fr. De Smet gained the respect of the Native Americans he worked with in several simple ways. He learned their language and customs, helped broker peace between tribes, and treated them with respect. His success came from simply living as a Christian.

So, who should evangelize? The short answer is: EVERYONE! We should all feel called to share our faith with others. If we have truly embraced Christianity and its way of life, we should be eager to share it with others.

How should we evangelize? First and foremost, we should evangelize through the example of our lives. We should live as Christians are called to live by Jesus Christ. That example was compelling enough to draw thousands to the church in the days immediately after the Ascension. It is good enough to work today.

We are also called to evangelize by telling our story. A great way to to get people curious about the faith is to share with them what drives you in your faith. The compelling personal story goes a long way to drawing people to the Lord.

A critical way we evangelize is by supporting our faith community. My cousin always signs his emails with the tag line "Keep the faith." I used to think it was a catchy platitude, but now I see the brilliance of it. Keeping the faith is difficult, and it needs the support of a strong faith community. By participating in our faith community, we bolster the faith of others and make them strong to evangelize too.

So how do we, as modern Christians, draw others to Jesus?

Tuesday, October 27, 2015

Exercises for New Developers

Over the course of my career, I have needed to guide newer developers learning either general programming practices or a specific topic. I usually have the developer work through a sample project with some specific instructions intended to push that person along a path. I was recently asked to find my notes from one of these exercises to share with another individual. Instead of just emailing the instructions, I wanted to capture them more permanently.

These write-ups are not very detailed. They are written with the assumption that a more experienced programmer is "administering" the exercise to someone, so the instructions are more like teacher's notes. The only comparison I can come up with are the Spiritual Exercises of St. Ignatius Loyola. He wrote a manual of sorts for spiritual directors to guide retreatants through spiritual "exercises" to improve their relationship with God.

As I write up these exercises, I will link them here.


Calculator Project

Calculator Project

This is the first write-up of a software development exercise that I have used to help train developers. This post should be viewed as instructions for the instructor, more than a step-by-step guide for someone trying to learn.

In this project, the user will create a basic calculator application. The specific project steps are written to encourage the user to create a program that interacts from the command line. This is done to keep the focus of the project on Test Driven Development and good programming practices. After the main exercise is described, alternate variations are mentioned.

Phase 1

Create a command-line application that will prompt the user for two numbers, add the numbers together, and return the result.

The program flow should look like:

C:\> calculator.exe
Please enter the first number: 3
Please enter the second number: 4
The sum of 3+4 is 7.
C:\>

The main() method should call the Calculate() method on another object. The program should be able to accept and correctly add any integer less than half of the max integer available on the system.

Phase 2

Modify the existing calculator program to be able to perform subtraction. The user should enter two numbers just as with addition, but will be prompted to select an operation. All of the constraints from the first phase still apply.

Phase 3

Modify the existing calculator program to be able to perform multiplication and division. If the user enters a 0 as a divisor, the program should return a message indicating that division by 0 isn't possible.

Phase 4

Modify the existing calculator program to accept floating point values (decimal values) as well as integers.

Alternate Phase A

Using the calculation code developed in the first 4 phases, implement the entire application as a web site using MVC. The scope of this approach could be expanded to have the user interface mimic a calculator's interface with number and operation buttons.

Alternate Phase B

Using the calculation code developed in the first 4 phases, implement the entire application as a REST API, with a single page application (SPA) framework such as AngularJS as the user interface.

Saturday, October 24, 2015

Creating a Sample ASP.NET 5 App to Run in DNX

In my on-going quest to better understand the .NET Execution Environment (DNX) and all of its goodness, I've been creating sample applications. Recently I've been experimenting with the Yeoman generators for ASP.NET. In this post, I want to introduce Yeoman and run through the steps necessary to quickly create a simple MVC application that can be run with DNX.

Yeoman is billed as "The web's scaffolding tool for modern webapps." It is built on top of NodeJS and uses generators to create whatever project or file is requested. A developer calls Yeoman, specifying a generator, to kickstart new projects, encapsulating all of the necessary details for a given technology stack.

Microsoft has had a similar scaffolding concept built into the File > New Project menu item in Visual Studio. Most .NET developers expect this type of templating to be available to them. Since DNX is enabling cross-platform development in the .NET stack, and Visual Studio is not cross platform, Microsoft is leaning on Yeoman to provide the scaffolding for ASP.NET 5.

Installing Yeoman is very easy once NodeJS, especially the Node Package Manager (npm), is installed. (NodeJS can be downloaded from the NodeJS web site.) Open a command-prompt and execute the following command:

npm install -g yo
This command installs Yeoman globally for everyone. To call Yeoman, execute the command
yo
from a command prompt. It will display a text menu of options, including generating applications with any installed generators.

Once Yeoman is installed, the generators for ASP.NET 5 need to be installed. They are installed by executing the command

npm install -g generator-aspnet
This command installs the ASP.NET 5 generators globally.

The following steps can be taken to use Yeoman to create a basic MVC 6 application that will run in the DNX. These instructions assume you already have the DNX installed.

  1. Call Yeoman:
    yo aspnet
    1. Select Web Application Basic from the menu presented and hit Enter.
    2. Name your application HelloWorldMvc at the next prompt.
  2. Change directory to your new MVC application folder:
    cd HelloWorldMvc
  3. Restore NuGet packages:
    dnu restore
  4. Run the application:
    dnx kestrel
  5. Navigate to the application in your browser by going to http://localhost:5000
  6. You should see the default page with the name HelloWorldMvc in the upper left-hand corner.

Congratulations! You have created and executed an ASP.NET 5 application in the .NET Execution Environment.

Thursday, September 24, 2015

Understanding DNX

Getting a handle on the new .NET Execution Environment (DNX) is difficult. I've been following the project for a while, and still get twisted around trying to explain it to people. I believe the following analogy and diagram help to understand the environment.

Keep in mind, this is a tenuous comparison meant to help people understand the environment. It is not a comparison of the technologies in question.

I often compare DNX and its ecosystem to the MEAN development stack (MongoDB, ExpressJS, AngularJS, and NodeJS). This development stack consists of a runtime environment (NodeJS) that hosts a framework for creating server-side applications (ExpressJS). These server-side applications can be accessed using client-side frameworks such as AngularJS. The entire stack can be backed with MongoDB for permanent storage.

The DNX environment is similar, but much richer. DNX is the runtime environment, much like NodeJS is for the MEAN stack. MVC can be used to create an API (formerly WebAPI*) that runs on the server in DNX, much like ExpressJS is used in the MEAN stack. The client-side component can still be AngularJS that calls the API. This is where the comparison ends.

DNX is unique in that it requires an implementation of .NET to be available in order for it to serve up applications. As of the Beta7 release, it can use either Mono or CoreCLR. This requirement allows software developers to completely control the environment in which their application lives, by choosing either Mono or CoreCLR as the backing .NET implementation.

The best part is that all of this can be run on Windows, Mac, and Linux! DNX enables developers to completely control their application's environment and runtime.

In my analogy, I left out the backing database technology in the DNX ecosystem. As the CoreCLR advances, it will enable applications to access SQL Server natively. This capability means that an app running on a non-Windows operating system will have "native" access to SQL Server.

Below is a basic diagram showing how the DNX landscape looks. Not all of the functionality depicted is currently available, but an awful lot of it is.

Since the DNX environment is changing rapidly, I would appreciate any feedback as to anything I have stated that is incorrect.