VB.NET Logical Operators

Quick chart to clarify which VB.NET operators one should use always.*

Never Use Instead, Always Use:
IIf(x, y, z) If(x, y, z)
And AndAlso
Or OrElse


* Always means “pretty much always.” There may be some very rare, strange cases to use the “never use” items.

** Logical Awesome image copied from this site.

Posted in Programming, VB | Leave a comment

The Speed of Trust: Individual Credibility

The Speed of Trust appears from here to be broken down into Five Waves of trust; these waves move from the inner-most out. That is, it begins with changing yourself, then working out to the people you interact most often with, and continuing out to society at large:

  1. Self trust.
  2. Relationship trust.
  3. Organizational trust.
  4. Market trust.
  5. Societal trust.

An introduction to “Self Trust” came next; that topic itself is broken down into four main cores. Self Trust comes down to credibility – are you a credible person? Even though people will give a simple Yes or No, or could give an answer on a one to ten scale for this, the book argues that there are four aspects of credibility, and your achievement in each of the four cores can vary:

  1. Integrity. This relates to basic honesty, but goes further into having an understanding of your own values, and the courage to stand up for and live by your values when challenged.
  2. Intent. Are your motives and agendas (and the behavior they produce) guided by a genuine care for others, or do you operate in a self-centered way without regard to others? Imagine someone who was very honest, but had no deep concern at all for others. Even though such a person would never tell a lie, people can’t trust the person because they always have to guard themselves so as not to be taken advantage of.
  3. Capabilities. What are your talents, abilities, skills, knowledge, etc., that allow you to produce results? Again, imagine someone full of honesty and integrity, and always operating with the very best of intentions, yet utterly incompetent in any tasks they were given. Such a person, though possessing a wonderful character, would still not be trustworthy simply because of incapability.
  4. Results. Do you have a track record of accomplishing tasks? Do you work on the right thing, and see that right thing through till it’s done? Again, one can imagine a talented, fully capable individual full of integrity and the good intentions, yet they never seem to Get Things Done. Such a person’s credibility would certainly be in question.

It’s is interesting to hypothesize an individual who has any three of the four cores of credibility listed above, but severely lacking the last.

When an expert witness is called to testify in a trial, the supporting lawyer will try to establish before the jury these four aspects; if the opposing attorney can seriously undermine the expert in any one of these items then the witnesses credibility, and the expert’s influence on the entire trial, is severely effected.

The next sections of the book drill down on each of the four cores individually. I’m in the process of building a Prezi presentation to map the structure of the book and keep its outline straight in my mind.

Posted in Leadership, Softer Skills | Tagged | Leave a comment

Why is Estimating so Hard?

Uncle Bob suggested a small software estimation exercise in a recent blog post, Why is Estimating So Hard?

My best-case, nominal, and worst-case estimates were x, 2x, and 4x, respectively. My actual time spent was 3.4x, and while the final code worked I wasn’t real happy with it.

I had never thought before about the distinction between how long it takes to do something and how long it takes to describe how to do something. Uncle Bob uses the example of tying shoes – takes a few seconds to do, but I’ve heard of college communication classes being centered around how to describe how to do it. Everyone failed that assignment.

The accounting world would have other similar examples. How long does it take to reconcile a checkbook, assuming no major discrepancies? Compare that with how long it would take to write a step-by-step procedure describing how to reconcile a checkbook — one that could be used by someone who didn’t have any familiarity with checkbooks.

In some ways, that’s what computer programming is: writing detailed, step-by-step procedures for a machine — and this machine has absolutely zero intelligence on its own — no problem solving skills, no deductive capabilities and no intuition.

Posted in Estimating, Programming | 2 Comments

Book: Notes to a Software Team Leader

I heard about this new book, Notes to a Software Team Leader, on a podcast on my way to work this morning. Below is the “Manifesto” of the book; upon reading it I feel the book has potential to have insightful and helpful content – I think it aligns with Nexus’s values in unique and surprising ways.

  • We believe the role of a team leader is to grow the people in their team
    • We believe in adjusting the leadership style to the current needs of the team, over a single style of leadership
    • We believe in challenging ourselves and our teams to always get better, so:
      • We embrace taking risks for our team over staying safe
      • We embrace fear and discomfort as learning new skills
      • We embrace experimentation as a daily practice
        • With people
        • With tools
        • With processes
        • With the environment
    • We believe team leaders lead people, not machines, so:
      • We embrace spending more time with our team than in meetings
      • We embrace learning people skills and techniques

This is a unique “book” – at least, it’s being written in a unique way. It’s not done yet, and if you feel you have something important to say about software team leadership, you can submit a contribution to the book.

Posted in Leadership, Programming, Softer Skills | Leave a comment

Giving Yourself a Job

In 1950 in New York, looking for a job consisted of catching a subway at 6:30 to pick up a copy of the New York Times, searching the classifieds, and then pursuing the most promising opportunities.

After doing this for forty weeks straight, Bill still didn’t have a job. Times were tough: meal time would come and there was no food; this lack created tension between Bill’s parents; the family was under tremendous discouragement.

Coming home after yet another grueling and fruitless day, Bill made a radical change. At the kitchen table with his brother Jerry, Bill said:

“If no one will give me a job, I’m going to give myself a job.”

Jerry thought his brother had finally lost it. There were no jobs to be had. It seemed ridiculous to magically produce one for yourself. But Bill was determined, and so the brothers pulled together all the money they had to start a business: $13.

After deliberating together they decided to start a technical writing company for $13 because you could buy pens and enough paper to get started on that budget. Bill said, “I’m going to sell. You’re going to go to the library and learn how to do technical writing.” Bill figured he could sell to companies of ten people or less who were doing government work.

In three weeks Bill made his first sale, and Jerry began putting his new tech-writing skills to work. The books were accepted. Within a few years they were able to hire a typist, then an illustrator, then rent an office in downtown New York (prior to that they all worked out of the brothers’ tiny apartment).

Today, sixty-two years later, this company has tens of thousands of employees. I had the opportunity to meet Jerry today, sixty-two years after he and his brother struck out on a $13 budget. I was very much impressed with this startup story. Through resourcefulness, fortitude, and hard work, Bill and Jerry created their opportunities. I believe the same opportunities exist today. Jerry had the library, where he could become a competent tech writer for free; today we have the Internet, where you can become a competent almost-anything for free. Your chances of becoming a multi-millionaire are probably low, but the reward for initiative, hard work and perseverance in today’s world is what is was in 1950: success.

Bill’s decision that he would not be ultimately dependent on others, but would take responsibility for improving his situation himself, is an admirable attitude. I wonder how many today carry that same attitude: “If no one will give me a job, I’m going to give myself a job.”

Posted in Business, Leadership | Leave a comment

From .NET, Calling REST and getting "dynamic" results

It seems like every time I want to call a RESTful service from my .NET app I have to re-lookup the documentation for either Hammock or RestSharp. Mainly for my own future reference, here’s the code using Hammock to get a change list from bitbucket.org’s REST API, then using JsonFx to deserialize the JSON to a dynamic object (which is pretty sweet).

var client = <span class="kwrd">new</span> Hammock.RestClient {
    Authority = <span class="str">"https://api.bitbucket.org"</span>,
    VersionPath = <span class="str">"1.0"</span>,
    Credentials = <span class="kwrd">new</span> BasicAuthCredentials {
        Username = <span class="str">"bitbucket-username"</span>, 
        Password = <span class="str">"bitbucket-password"</span>

var request = <span class="kwrd">new</span> RestRequest {
     Path = <span class="str">"repositories/[username]/[repo]/changesets"</span>,
     Method = WebMethod.Get

dynamic result = <span class="kwrd">new</span> JsonFx.Json.JsonReader().Read(response.Content);
<span class="kwrd">for</span>(<span class="kwrd">int</span> i=0, len=result.changesets.Length; i&lt;len; i++) {
    var date = DateTime.Parse(result.changesets[i].utctimestamp);
    <span class="kwrd">string</span> author = result.changesets[i].raw_author;
    <span class="rem">// do what you want with the results.</span>
<font color="#0000ff"></font>
Posted in CodeMinder, JSON, Programming, REST | Leave a comment

Call a web service with PowerShell

I recently used a PowerShell script like the following to troubleshoot the details of a third-party web service our code was using. I thought the script was something worth noting here for future reference.

$url = <span class="str">"https://path/to/Service.asmx"</span>
$parameters = <span class="str">'&lt;?xml version="1.0" encoding="utf-8"?&gt;'</span> + <span class="str">"`n"</span> 
   + <span class="str">'&lt;soap12:Envelope...&gt;<em>(your request body here)</em>&lt;/soap12:Envelope&gt;'</span>

$http_request = New-Object -ComObject Msxml2.XMLHTTP
$http_request.open(<span class="str">'POST'</span>, $url, $<span class="kwrd">false</span>)
$http_request.setRequestHeader(<span class="str">"Content-type"</span>, <span class="str">"application/soap+xml"</span>)
$http_request.setRequestHeader(<span class="str">"Content-length"</span>, $parameters.length)
$http_request.setRequestHeader(<span class="str">"Connection"</span>, <span class="str">"close"</span>)


The (your request body here) part can be obtained easily if the service you’re talking to is running on .NET with the metadata information turned on. If you point your regular web browser at the URL in this case, it will return a list of operations the service supports. Clicking on any operation will show you what to put in for $parameters – something like this – very handy:


Posted in PowerShell, REST | 3 Comments

The Speed of Trust: Chapter 2

There were two points in the second chapter of The Speed of Trust that had an impact on me.

Stewardship and Accountability

I learned in this chapter that the Stephen Covey who wrote this book is the son of the Stephen Covey who wrote the popular Seven Habits book. In Seven Habits, the father tells the story of teaching his son to take care of his yard. In The Speed of Trust we get to hear that very son tell his side of the story. I enjoyed seeing this story from those different perspectives. The son’s main point was that when his father entrusted the keeping of the yard to him, that trust inspired him to become trustworthy. The main aspects of this story that I found instructive were:

  • Clear stewardship. The father said the grass was to be kept “green and clean.” He showed in detail by example what both of those words meant.
  • Defined accountability. The father explained that once a week they would walk through the yard together to see how well the son was keeping the yard green and clean.
  • Autonomy of the “steward.” The father explained that the son was to use his own plan, his own timeline, his own resources, his own ideas to carry out his stewardship. The father didn’t give him detailed instructions, and wasn’t going to be reminding him and driving him to get the work done.
  • Sufficient equipping. The father said he would be willing to help if the son needed it. It was clear that the son would need to ask for it, but all the resources of the father would be available to the son to be successful in his stewardship.
  • Allowing failure. Things didn’t go perfectly right away; the son neglected his duties for a while. Yet the father honored the son’s autonomy by not nagging on him to get to work. The time of reckoning came, of course, at the agreed upon appointment when the accounting came. There were tears at this accounting, but the agreement continued, and the father dealt with things in a way that lead to the son learning how to keep the yard green and clean.
  • Trust created trustworthiness. In this book, Covey’s primary emphasis was that when you entrust something to someone, just the very act of entrusting someone with the responsibility can inspire them to become more trustworthy. (Of course one can take this to naïve and foolish extremes.)

The story in the book that illustrates these things adds a lot of meaning to these points. I am going to try to put this into practice with my kids and their chores and schoolwork. At this point we are homeschooling our kids, and a few of them wear their mother out because she has to keep riding them to keep on their work. I think a system like this may help – to tell them, “It’s no longer your mother’s job to make sure you get your work done. It’s your job. And every other evening you have an appointment with me, where you will give an account of where your schoolwork and chores are at.”

Trust = Character + Competence

It seems very true to me. When we trust someone in a particular circumstance, we have to trust both their character and their competence. Other ways to describes these are integrity and intelligence; personal trust and expertise trust; heart and head.

Consider that a person can be a wonderfully nice and honest person who never breaks the most minute law, always holds doors for ladies and helps the elderly. But if that person is not a very good carpenter, you’re not going to trust him to build the shed in your back yard. For specific circumstances, character is not enough; competence is necessary.

The reverse is certainly true: you can have the most proficient carpenter in the world, but if he’s a liar and a cheat and has a dangerous temper, you’re not going to want to work with him, either.

I found the examination of the two facets of trust to be very clarifying to my own thinking.

Posted in Leadership, Softer Skills | Tagged | 6 Comments

"Please Prepay"

Yesterday’s post about The Speed of Trust hit me in a new way this morning when I was filling up with gas. The sign on the pump said, “Please Prepay.” Wow, does that slow things down, doesn’t it? Instead of simply filling up and walking in to pay, I have to walk in, walk out, fill up, and walk in again. That also has to create extra overhead for the workers if I overpay the first time in: they have to keep track of how much I gave them and then look it up when I come in for change. If I underpay then I suppose I don’t get a full gas tank and either have to fill up more often or go through further rigmarole to top off.

Yet one more way that the world is slowed down because of the number of people who aren’t trustworthy.

Posted in Business, Leadership | Tagged | Leave a comment

The Speed of Trust: Chapter 1

I’m slowly picking my way through Stephen Covey’s book, The Speed of Trust. In chapter one Stephen makes a compelling argument that trust makes a very real difference in the amount of time and money required to get work done.

Corporate Application

Consider the example of Warren Buffet when acquiring McLane Distribution from Wal-Mart. Such a merger typically takes months, with several million dollars for accountants, auditors, and attorneys. The two parties in the case trusted one another; the deal was made with a two-hour meeting, and completed in less than a month. I find Warren Buffett’s words from his 2004 annual report to be very powerful: “We did no ‘due diligence.’ We knew everything would be exact as Wal-Mart said it would be – and it was.”

On the other hand, the incredible cost large companies face of implementing the Sarbanes-Oxley can be attributed to the distrust created by Enron and WorldCom.

Individual Application

The speed of trust is not just for the corporate world. The book suggests that the “office politics” that people hate are usually extra overhead created because people distrust one another.

When describing what trust is, as Covey sees it, he writes that trust is confidence; it’s the opposite of suspicion. When you trust someone, you have confidence in their integrity and abilities. When you distrust someone, you are suspicious of their integrity, agenda, capabilities or their track record. Working with someone you trust is often joyful and efficient; working with someone you distrust is draining, tedious and cumbersome.

My own example: consider even simply going on a camping and fishing trip with someone you have confidence in: you believe they are trustworthy to bring ample supplies; you have confidence in their abilities to be able to help efficiently with all the little duties needed to have a fun and successful trip. How much less would you enjoy a trip like that with someone who you didn’t have confidence in?


I thought it was a surprising coincidence that after reading this chapter I heard a couple more stories in a different context that related to this.

I heard second-hand the story of a successful businessman in the Fargo area. His family has owned a grain elevator for years in the past. When a farmer brings his grain in, an elevator worker scoops a handful of grain out to sample it for chaff and moisture content; the value of the grain depends on the sample. Elevator owners know that the shape they hold their hand in as they scoop up the grain makes a difference in the amount of chaff picked up. There’s a big temptation for owners to pick up as much chaff as they can, and thereby pay less for the grain. When this man’s father taught him to do it, he said, “You hold your hand like this, to get the best possible price for the farmer. The reason, Doug, is that our customers must trust us.”

Later in this man’s life, when his software business was growing but still struggling, this life-lesson of trust was tested. The company had shipped out software with a major bug. The timing couldn’t have been worse: the nation-wide (world-wide?) convention was imminent.

Of course the buzz of the convention was angry customers complaining about the issue. Doug took a huge risk, putting the company on the line. During a talk of the convention he said, “We messed up. We’re working hard to fix it. We know this is costing you money. I can’t make any promises, but send us a bill for the expense we’ve cost you.” This was very risky because the company at this time wasn’t flush with cash. But suddenly so much of the trust (confidence) that had been lost in this company was turned around. The tone of conversations at the convention changed dramatically.

Here’s where the speed of trust hits hard: Out of the hundreds of customers that were invited to send bills, only two did. I suppose this indicates that the customers weren’t as concerned about the money loss as they were the lack of confidence they had in the company, and when Doug acknowledged the mix-up and was willing to go to such lengths to make it right, the trust and confidence was restored.

Looking forward to the rest of the book

Covey talks about how earning and keeping trust sometimes has to be a deliberate effort; you don’t get it by default. People with whom you don’t often interact, by default will doubt you. Covey talks about proactively establishing and increasing trust. I’m excited to learn what he has to say about doing that; hopefully the techniques aren’t ways to fake trustworthiness, but simply ways to express whether you are trustworthy or not. I’m excited about how the ideas in this book might improve relationships in every area of my life.

Link to The Speed of Trust on Amazon.

Posted in Business, Leadership | Tagged | 3 Comments