Monday, November 13, 2017

Building Beautiful RESTful APIs in .Net Core - Adnug November Meeting

Nate Barbettini talked to 26 developers at the Austin .Net Users Group.

Here's my notes from his talk:
RPC (Remote Procedure Call) vs. REST (REpresentational State Transfer)
RPC endpoints are verbs (, in REST endpoints are resources (/User)

HATEOAS - hypermmedia as the engine of application state
Data exchange should be treated as if the client were a web browser
No documentation or out-of-band info needed

Use RPC when dealing with a simple object, like the Slack API
Use REST when dealing with lots of different objects with CRUD operations possible on all of them
GraphQL is useful when trying to traverse a graph of REST calls

REST + JSON is popular but hard because no schema is available for the data.
HAL and JSONSchema try to solve that.  Also Ion trys to give structure to JSON data.
The Ion content type is application/ion+json
Ion data is embedded in JSON with fields, like "href","rel", and "value".

ASP.NET Core is a full rewrite of .Net to be portable, faster and cleaner.
Dependency Injection is now in the framework, don't have to download StructureMap

Nate has a free eBook about starting with .Net Core at
Demo to create new .Net Core API with Web API template.  No diff between MVC or API controllers.

Nate used package Entityframework inmemory to do development of demo.  inmemory just gives an inmemory

ASP.NET Core is friendly to async/await pattern.  async first philosophy.


Nate has a course on this. is the result of his 4 hour Lynda course.

Nate has done a great job of learning .NET Core and sharing his knowledge with the community free of charge.

Wednesday, November 01, 2017

Just Switched Electrical Providers to Our Energy LLC Using

In Texas we can choose our electrical provider. is a website to help consumers pick a provider, but it's very difficult to find which provider is the cheapest for me, since providers have a complex rate structure.  I did a previous blog post on choosing an electric provider.

I've found a great website,, which cuts through all the weird pricing structures and shows the best rate for your usage.  The service costs $10, but it saved me $150 for the next year. said my cheapest option was Our Energy LLC, so I switched.   I had not heard of them before,  but will let you know how they work out.

Be careful not to just continue with your "current" provider when your time is up.  I think they are tempted to offer you a decent plan, but not the best, since it's such a hassle to change.  When I called my provider, and said that I had found a better rate, they offered me a better rate plan than what was mailed to me to renew. 

Here's my results from


Saturday, October 28, 2017

Saving for Retirement

The Basics of Saving for Retirement

I know, I know, I've waited to long to have "the talk" with my daughter who is a Junior in college. But something else always came up. The time never seemed right and I felt awkward, but I finally sat down with her and told her what I wish I'd known at her age about finances. I would be much further along in retirement savings if I'd just known these facts.

You can work hard all your life, put lots of money into your savings, but can still end up with a poor retirement if you don't save well.  Save wisely and you can enjoy a wonderful retirement.

How much money do you need to retire? 
The Four Percent Rule. The typical rule of thumb is that you can take out 4% of your money every year for your retirement.  So if you need $40,000 dollars a year from your savings, you will have to save one million dollars by retirement age.  That's a lot of money and it doesn't just happen.

General Tips
1. Don't buy toys on credit.   Credit cards carry a huge interest rate and you will be losing money every time you have a balance at the end of the month.  Pay your credit cards off at the end of the month.  Buy clothes at Goodwill, eat frugally, take local vacations, drive an old car, use a Windows computer - do what you must, but never carry a balance on your credit cards.

Your home and cars are the only things you should buy on credit.  Save up your money so you don't have to buy cars on credit.

2. Use a Credit Union.  Banks are made to provide profits for their owners, the stock holders.  Banks try to wring every last cent from you.  Credit Unions belong to the depositors and hence try to serve you, the depositor.  That being said, sometimes banks can provide services like ATMs everywhere that make them worth a second look, but remember banks live to make other people money.

Bankers circling to figure out ways to charge more fees
Basics of Investing
1.  You get paid for risk.  Since inflation runs about 2% a year, if you put your money in the bank in a risk-free FDIC insured account at 0.05% interest, you are losing money every year.  You need to take more risk to earn more money.

2. What is the stock market?  When you own a stock, you own a little piece of the company.  When the company makes a profit for the year they will pay you a tiny part of that profit which is called a dividend.  If a company has a million stock shares, and you own one stock, you will get one-millionth of their profits for the year.  Although some companies don't pay dividends, but let their stock price rise instead.  Either way you can make money.

3. Stocks are risky. If the company goes bankrupt you can lose all the value of your stock.  But with greater risk comes greater reward.  The stock market averages about 8% returns a year.

4. What are stock funds?  Stock funds are composed of a group of other stocks.  It's like a basket of baskets; when you buy a stock fund (big basket), you buy a small piece of multiple stocks (little baskets).  Two types of funds exist, managed and indexed.  Managed funds buy stocks based on the opinion of a highly paid stock picker.  Index funds buy stocks based on an list, like the 500 biggest companies in the stock market (the S&P 500 list) or the 1000 biggest companies (the Schwab 1000).

Index funds will almost always beat managed funds because managed funds have a higher expense, like 1-2% of all your money, while index funds may only charge you .03% of your money invested in them.  Over the decades this tiny difference can amount to over a hundred thousand dollars.

Don't invest in individual stocks, buy index stock funds. Individual stocks are fun to play with, but they're not stable enough to warrant high-stake investments.

You can buy stocks and bonds at a company like Vanguard or Schwab.  You create an account and send them money and they will buy and hold the stocks and bonds for you.

4. What are bonds?  Companies borrow money from investors by selling bonds. They are like government savings bonds - you buy them now and can redeem them later with interest. While bonds earn interest and are safer than stocks, they don't earn as much potential profit.  When a company goes bankrupt the bond holders get their money before stock owners, less risk so less reward.  Government bonds are the safest investment, but only pay about 1.5 - 2% returns.

6. Diversify.  You should own a mix of stock index funds and bonds in case the stock market goes way down.

What percentage in stocks?  One rule of thumb is to have the percentage of stocks the same as (120-your age), so at age 50 you should have 70% of your savings in stocks, both domestic and foreign.  When you are 20 you should be 100% in stocks, since you have a lot of time to ride out the ups and downs in the market.
You should also diversify over countries.  Have some stock and bonds from other countries.
 John Bogle, founder of the Vanguard Group which champions low cost index funds recommends this set of funds:
40% in the Vanguard Total U.S. Stock Market Index Fund
20% in the Vanguard Total International Stock Market Index Fund
40% in the Vanguard Total Bond Market Index Fund

7. Dollar cost averaging and beating the market.  Trying to invest money in the stock market when you think it is low, and selling when you think it is high almost never works.  Instead, invest every month when its going up and down and just ride out the storms.

The S&P 500 in 2008 was around 1500 and dropped to 700.   Many of my friends sold their stocks and lost half their investments.  If they would have been patient, they would have made all that money back and then some since the market has recovered to 2500.

8.  Real Estate.  You can invest in real estate, but it takes time to manage.  Your own home is typically, but not always, a good investment.  Another way to invent in real estate is a Real Estate Investment Trust (REIT), which is like a stock, but it invests in real estate like apartments, shopping malls, office buildings, and homes.  This is the simplest way to own real estate.

9.  Invest in ways that minimize your taxes.  Your work will typically have a Retirement 401(K) plan that will allow you to invest money without it first being taxed.  They will typically match a part of your investment, like the first 4% of your salary.  You get to deduct the amount you invest from your income so you don't have to pay taxes on it, yet.  When you retire you will pay taxes when you pull money out, but the money has grown for 30 years without paying taxes.

If your company doesn't offer a 401K, you can invest in an IRA, or a ROTH account. If you invest in an IRA, it is untaxed going in, allowing for compounding interest on the full amount you put in, but taxed when you withdraw money from the account. If you invest in a ROTH account, money is taxed going in, but considered non-taxable income when withdrawn.

10.  How much to save?

As a general rule you should try to 15% of your salary for retirement. The following table shows how far along you should be at a particular age to be on track.

Age Save this multiple of your salary
30 1x
40 3x
50 6x
60 8x
67 10x

In Summary
Save 15% of your salary for retirement every month in a mix of domestic and international stock index funds and bond funds into your company 401K or a ROTH account.

Planning and saving for your future is hard work, but your 65 year old self will thank you.

Friday, October 20, 2017

Agile Austin Lunch Session - How Microsoft VSTS went from 18 mo Releases to Three Week Sprints

Clementino de Mendonça presented to 20 Agile Austiners on the topic "Agile at Scale SIG - Agile Transformation at Microsoft TFS/VSTS team".

Microsoft uses 3 week sprints with releases to different test environments named  Ring 0 to Ring 6.
Releases every 3 months, could be more frequent, but customers don't want it more frequently.

Microsoft's internal release notes for VS are available at

How did they go from 18 month release cycle to daily?

In the old days it took 3 months of planning to organised details for the next release.  Developers coded in two week sprints, with stand ups.
The lower levels were Agile, but the upper level planning was not.

Before and After Microsoft Transformations:
4-6 month milestones to 3 week sprints
Personal offices to Team rooms
Long planning cycles to Continual Planning and Learning
Feature Branches to everyone in master branch with tags
Secret road map to publicly shared road map on the web
100 page specs to specs in PPT
Private repos to open source publicly available
Deep hierarchy to flat hierarchy

"Culture eats strategy for breakfast", Peter Drucker

Microsoft at one time was cutting edge on Agile (Ken Schwaber studied them for the creation of Scrum), but then lost it.

Microsoft looked at Pink's book "Drive". People want Autonomy, Master, and Purpose.
Youtube video summary here,

Alignment and Autonomy balance.  Too much alignment and the autonomy falters.

MS changed Roles.  In the old days developer testers were considered lower quality.
Used to have Program Management, Dev, and Testing.  Now only PM and Engineering.  Everybody writes tests - no separate testers.

Full list of roles:  UX / User Experience / Program Management / Engineering / Service Delivery.

PM is responsible for What and Why building.  Engineering is responsible for How.

Teams are cross discipline, 10-12 people, self managing, clear goals, lasts for 12-18 months, work in physical team rooms.
The team owns the features in production and own deployment.  So if problems occur, that team fixes the problem.

Instead of doing horizontal layers: teams doing UI other team doing API, others doing business logic.
Now, one team does all of those things in a vertical slice.

Autonomy - let teams choose what they want to work on.  They must train successors.  aka.selfformingteams

800 people working on VS.  Teams stay in contact with each other using "Sprint Mails" detailing what they did, and what they plan to do next sprint.  This is instead of big meetings.

Lightweight Planning: Sprints in 3 weeks, Plan in 3 sprints, Season is 6 months, and Strategy in 12 months.

Strategy / Features / Stories / Tasks.  Strategy comes from top down.

Backlog is taken from UserVoice, community requests and voted on.

Stabilization sprint used to happen.  Devs would push bug fixes to stabilization sprint instead of fixing immediately.

Bug Cap is total number of bugs to have, it's five times number of devs.

1. Get good a science, but don't be overly prescriptive.
2. Stop celebrating activity, start celebrating results.
3. Embrace the new normal.  Delivery continuously.
4. You can't cheat shipping.  Putting into production.
5. Build the culture you want ... and you'll get the behavior you're after.

Wednesday, October 11, 2017

Agile Austin, Oct 10, 2017 - Rage, Disorder, and Your Agile Team

At Agile Austin this month Matt McBride from Genesis10 talked about Agile team culture at headquarters.
He wrote Leadership Patterns for Software and Technology Professionals.

My random notes:
* Rage, Stress, and Its Impact
Rage is one specific behavior that our teams are exposed to in their daily lives.
Rage and anger are types of stress.  Rage and anger are specific instantiations of the "abstract class" named stress.

What is impact of stress?: Health, Behavior, and relationships with our team members.
Stress can be a good thing for short periods.

Cortisol is the chemical produced during stress.  Long-term Cortisol can shrink your brain.
Sources of Anger: disappointment, frustration, judgement, rejection fear.

Anger make people indiscriminately punitive.

* Threat of Architectural Disorder
complexity grows at an exponential pace
Nonfunctional features (security, testing ...) tend to get lost or ignored
Grady Booch on characteristics of successful projects: strong architectural vision and well-managed iterative cycle (scrum).

Major Classes of Program Features to  Think about At the Beginning
1. Significant features for business/customer
   We look for functional features with a high business risk
2. Architecturally significant features
    We look for functional and non-functional features with high technical risk.

From Agile we need to embrace these:  commitment, courage, focus, openness and respect.

Missing in college education is leadership skills.  How to educate non-technical customers.

1. Leaders are avid learners.
Leaders try, fail, learn, and grow.
2. Leadership is a choice.
We have to change the way we think about ourselves, careers, and work.

* Tactics for reducing anger, rage, and stress
Have everyone take one deep breadth
Then followup with a specific goal

Partnership Pattern - moving forward from newbie to Trusted Partner
1. Performance - establish record of success
2. Credibility - be trusted based on performance
3. Trust -
4. Become a Trusted Partner

* The resolute pattern
Recast problems as assumptions to be questioned

Invest in your team and in development of leadership and interaction skills.

Monday, October 09, 2017

Continuous Integration and Delivery with Visual Studio and Azure - Austin .Net Users Group October 9, 2017

Shawn Weisfeld (Shawn is also founder of created and deployed a project from scratch at the Austin .Net Users Group. gives us a free repository. You can create a project stored in the cloud. Team Services is free for teams under 5 people. Visual Studio online and VS local easily share a repository by default. will host. You chose how many machines and the size of the machines. Azure will create a load-balancer for the cluster. Azure will automatically collect telemetry. Changing the environmental variables on production is easy - you don't have to create multiple versions of the web.config for each environment. Shawn showed how it really is insanely easy to deploy an app in Azure to cluster using, and a local copy of Visual Studio 2017.

Saturday, September 23, 2017

How to Embed a JavaScript Script in a Handlebars Template

While working on the next generation of, a site I'm working on with my 10yr old daughter, we needed to add a little bit of JavaScript in the template to add the ordinal suffix to a number (e.g., "3rd President").

It's easy enough to do by registering a Handlebars helper and calling it with "{{{nth number}}}". Here's the code in context:

<h1>The Presidents Of The United States</h1>
Handlebars.registerHelper('nth', function(n) {
  return new Handlebars.SafeString(
<script id="entry-template" type="text/x-handlebars-template">
{{#each presidents}}
<div class="row" itemscope itemtype="">
  <div class="col-sm-4 centered" > <!-- left panel -->
  <h2 class="name" itemprop="name">{{fname}} {{mname}} {{lname}}</h2>
  <p class="ordinal">{{number}}{{{nth number}}} President of the United States</p>
Special thanks to Tomas Langkaas from stackoverflow for the "nth" algorithm in JS.

Tuesday, September 12, 2017

Git Examples and Notes

Git Notes and Examples

Every programmer has a git cheatsheet. This is mine.

What is Git?

Git is a distributed version control system written by Junio Hamano and Linus Torvalds. Linus said the name came from British slang for an argumentative pig headed person.

Where to Get Git?

You can download Git from


You can download a visual GUI for Git at

"gitk" is a handy GUI tool installed with some systems.

"git citool" will open a GUI tool.


Scott Chacon's and Ben Straub's book, ProGit is downloadable for free at

Atlassian has a great tutorial at

An interesting interactive visual demo of Git is at

Git from the Bottom Up:

A great interactive cheatsheet:

Getting Started

git init
creates .git directory and machinery to create a git repository
git clone
clones (copies) repository and creates a local repository with all the commits, trees, blobs, branches, and tags, but not the remotes. For that use the "-mirror" switch.
git clone presidents presidents1
copies repository "presidents" to "presidents1".

Saving Your Basic Information For Future Sessions

"git config" allows you to put information into the "~/.gitconfig" file for future sessions. This tells "git" things like your name and favorite editor.

git config --global "Mitch Fincher"
git config --global ""
git config --global core.editor vim
git config --global help.autocorrect 1
git config --global color.ui auto
git config --global --list

Saving Aliases into ~/.gitconfig

You can create aliases to reduce typing.

git config --global alias.cma "commit --all -m"
git cma "adding twelve.txt"

You can also edit your ~/.gitconfig file directly and create multi-line scripts that take parameters. The alias below takes a branch name, checks it out, and then merges in the previous branch. You would invoke it like this: "git qm master".

#quick merge
qm = "!f() { branchName=$1; git checkout ${branchName} && git merge  @{-1}; }; f"

Background: Git has Four Object Types

Git Database has four types: Blobs, Trees, Commits, Annotated Tags

  1. Blob

    A "blob" is a compressed file with no meta-data. All the meta-data, like name and time-stamp, are stored in a tree. The blob, may, and probably is, referenced by many trees.

    A blob has a header record consisting of it's type, "blob", a space, the number of bytes, followed by a null byte. Git prepends this to the contents of the actual file and then calculates it's SHA-1 hash value. Git then compresses the contents using zlib and writes it to the file system using the hash value as the name into the .git/objects/directory.

    To create a hash from a string or file use the "git hash-object" command.

    To play with this online visit

  2. Tree

    A "tree" contains references to blobs and other trees. Using "ls-tree" we can see the tree inside a commit.

    $ git ls-tree master
    100644 blob 1f0d9c362b635efe4f321a92d6715f00530ed2b2    greetings.txt
    100644 blob 586d7ab779c9fcd2d171ca012a6186144beea379    one.txt
    040000 tree 584d1a5650d8b2f5d7c71f1373c884569cad0cbf    spanish
    100644 blob 4adbf7c8f4d643d31800f4b3780c602ed455f993    three.txt

    Each line contains a mode, hashid, and filename.

    Git uses three modes for blobs, 100644 is a normal file, 100755 is an executable file, and 120000 is a symbolic link.

    We can also use "ls-tree" to look directly at a tree, like the one above,

    $ git ls-tree 584d1a5650d8b2f5d7c71f1373c884569cad0cbf
    100644 blob c5027f551f410b6a2438b285fd0cebff4c05cef4    greeting.txt
  3. Commit

    A "commit" is a snapshot of the working tree. It contains a tree hash, usually a parent, an author and committer info, date info, a blank line, and finally a commit message.

    git cat-file commit 107b22915830203ff40d0d8dfbf8e950961bc490
    tree 21e1ce7f2888871854a6a54e7f37853626331eb9
    parent cedfd274bc5fc6ed23baf7eb93d81a5f0e8416e8
    author Mitchell Fincher  1507926633 -0500
    committer Mitchell Fincher  1507926633 -0500
    adding spanish

    You can try this yourself, use "git log" to get the hash.

    The parent of the commit is the SHA-1 value of the reference that HEAD points to.

    Commits only reference parents, never children.

  4. Annotated Tags

    Unlike a lightweight tag, which is merely a reference to a commit, an annotated tag is an object. To create one, use the "-a" option.

    git tag -a rel1.1 cedfd274bc5fc6ed23baf7eb93d81a5f0e8416e8

    git will present you with the option to add a description, like "release 1.1".

    To see the new object reference to rel1.1, cat the file contents:

    $ cat .git\refs\tags\rel1.1

    Use cat-file to inspect the comments:

    git cat-file -p ad9fea1c206def283ba24549ddf1979703f176a2
    object cedfd274bc5fc6ed23baf7eb93d81a5f0e8416e8
    type commit
    tag rel1.1
    tagger Mitchell Fincher  1508168418 -0500
    release 1.1


git checkout <branch-name>
set the current branch to <branch-name>. This updates the index, the files in the working tree, and sets the HEAD pointer (.git/HEAD) to the branch. Modified files in the working tree are not updated.
git checkout -b <new-branch>
create a new branch from the current branch. It is equal to doing a "git branch <new-branch>" and then a "git checkout <new-branch>"
git checkout -- <file-name>
checkout a copy of <file-name> from the current branch and overwrite the working copy.
git checkout <commit>
detach the HEAD and set directly to this commit, "git checkout 661d5fd32".
git checkout -
checkout previous branch used
git checkout <branch-name> -- <path-to-file>
The command to checkout a specific file from another branch

What's Going On?

git status
shows your current branch and any interesting files
git status --short
shorter list with first two cols significant
git config --list
shows the combined settings from four files: .git/config file, ~/.gitconfig, /etc/gitconfig, and $XDG_CONFIG_HOME/git/config.
git log
see the changes
git log --oneline
to show quick one line summary
git log -2
see last two changes
git log --pretty=oneline
will not show commits that are reset over
git log --pretty="%h | %d %s (%cr) [%an]"
You can create your own log format using items like "%s" which is the "subject". Complete list of codes is at
git log --pretty="%Cblue%h%Creset | %Cred%d%Creset %s (%cr) %Cgreen[%an]%Creset"
you can spice it up with color
git log --oneline --graph --decorate --all
pretty graph
git shortlog -sn
shows how often people are committing
git show head
shows last commit
git show HEAD~1
shows previous commit
git show-ref master
shows all commits for branches with master in name


git branch <new-branch>
creates new branch named <new-branch>. Typically you would then enter "git checkout <new-branch>" right afterwards. Or you can do both in one command with "git checkout -b <new-branch>".
git branch
shows all your local branches
git branch -r
shows all remote branches
git branch -a
shows all remote and local branches
git branch -vv
shows a verbose listing of the last commit on each branch
git branch --merged
shows all branches that have been merged into HEAD
git branch --merged master
lists branches merged into master
git branch --no-merged <commit>
lists branches that have not been merged i.e., list branches whose tips are not reachable from the commit (HEAD is used if commit not specified)

Deep Magic Commands

Git has "porcelain" commands, pretty things to be seen and used by everyone like these: git add, git commit, git push, git pull.

Git also has many "plumbing" commands to be used by experts and the Morlocks who keep the Eloi happy, like "git cat-file", "git hash-object", "git count-objects". The porcelain command under the covers and made up of the plumbing commands.

A little background, git uses SHA-1 which reads any file or string and returns 20 bytes which is 40 hex digits. You can convert a string to its SHA1 hex value using hash-object.

echo "The fault, dear Brutus, is not in our stars" | git hash-object --stdin

You can write a string into git's database by using the "-w" option.
 echo "The fault, dear Brutus, is not in our stars" | git hash-object --stdin -w 

$ ls .git\objects\2e\72face*

Git will write objects to its ".git/objects" directory. This is why git is called a "content-addressable filesystem".

Use "git hash-object <filename>" to show the SHA-1 hash created by the contents of <filename>.

A great course on the internals is

Plumbing commands:

git cat-file -t <object>
returns the type of the object: "blob","commit","tree", or "tag"
git cat-file <type> <object>
shows the contents of the file associated with the object.
git cat-file blob 5f831d630dd069aca58b3a164ff526b53c142456
'Hello, world!'
git cat-file commit a7cc8785c5bd3594c9659b779ed56487097281b4
shows the contents of a commit with two files, "texas" and "greeting":
tree a822836950b935d16f8ee572429dd1d754a85a73
parent 640f3af9f9e883a5ed0102154e453170f04267b7
author Mitchell Fincher <> 1505507251 -0500
committer Mitchell Fincher <> 1505507251 -0500

texas greeting

The object does not have to be the "type" requested, if the "type" can be easily deferenced from the object, like asking for a commit from a "tag".

$ git cat-file commit v4.0
tree 71dea1ed6141af0acfc61e8e145612255924723d
parent 888c1884b879ef34da6685ac0158c0e3f830d040
parent 872c5443db65734a507201b514b3ae80c6c32d2c

The pretty-print, "-p" option, will do its best to determine the type of object you want. Here we look at an annotated tag:

$ git cat-file -p v4.0
object d4c9f8f2fe56221002113dcfcb7082913d7e9921
type commit
tag v4.0
tagger Mitchell Fincher  1509128823 -0500

    added four.txt

Here we use the magic "-p" option to look at a tree:

$ git cat-file -p 9a9e2826ac8ed12d43ca0a23fbe5c26af4e64bab
100644 blob b5244467192a2cb0e94b6cee014d007a1b439b68
100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391    eight.txt
100644 blob 5bace8b1cedb799bfac944e5a65fd301de784700    eleven.txt
git ls-tree <tree-ish>
shows all the objects in the "tree-ish" object. A tree-ish object can be a tree or an object that contains a tree.
$ git ls-tree master
100644 blob 5f831d630dd069aca58b3a164ff526b53c142456    greeting
100644 blob b6d99afd00cffebbd33e6a99c946e4bf54319ec4    texas
git ls-files
shows info about the files on the stage (index) and the working directory.
git rev-parse HEAD
HEAD is usually a reference to a branch which contains a pointer to a commit. "rev-parse" derefences the branch and shows the hash id of the commit without having to go through the intermediate branch.
$ git rev-parse HEAD

$ cat .git/HEAD
ref: refs/heads/master

$ cat refs/heads/master
git write-tree
takes the contents of the index (staging area) and creates a tree.
echo "My comment" | git commit-tree <hashid>
commit-tree takes a tree hashid and creates a commit from it. By suppling the comment, git can do its work without asking you for it.
git update-ref refs/heads/master <hashid>
writes the hashid into the file refs/heads/master, making that commit hashid the current one for the branch master. This could be done manually:
$ echo <hashid> > .git/refs/heads/master
You can also use update-ref to create a branch manually. To create a new branch pointing to a hash you enter:
git update-ref refs/heads/rel2 eafd8ea4563a802f6ad9dd65bf1222689785af26
git symbolic-ref HEAD
shows the value of the HEAD reference
$ git symbolic-ref HEAD
git symbolic-ref HEAD refs/heads/master
sets the value in .git/HEAD to be "refs/heads/master". You can try to do it manually with "echo", but it may put a space at the end of the line. To do this manually you should edit in your fav editor.
echo ref: refs/heads/branch1> .git\HEAD
C:\Users\mfincher\gittest (master ) #notice space at the end

What's in them files?

When you create a new repository with "git init", git will create a new directory, ".git" with these files:
$ ls -F
HEAD         description  info\        refs\
config       hooks\       objects\
This file typically contains one line of text. It points to the branch currently checked out. Usually a symbolic link pointing to a friendly name like "ref: refs/heads/develop", but can point directly to a commit hash.
you can edit this file to describe your repo
contains project specific settings and the URLs for your remotes, e.g., where does "origin" point.
keeps a list of file patterns to ignore.
C:\Users\mitchf\gitdemo2\.git (master)
$ cd info

C:\Users\mitchf\gitdemo2\.git\info (master)
$ ls

C:\Users\mitchf\gitdemo2\.git\info (master)
$ cat exclude
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
contains hook scripts
a single file which is a mini-file system containing all the staged changes
stores all the contents of your repository objects in "blobs". The files do not have names. Their SHA-1 hash id is their name. The file's real name is stored elsewhere in the tree. So, if two files have the identical contents, the contents will be stored only once. The two trees will point to the exact same file.

Inside the objects directory is the top layer of subdirectories named the first two characters of the SHA-1 hash. Underneath that directory are files named with the remaining 38 character hash.

$ ls objects
1f    48    5e    76    81    93    ab    ce    f3    pack
3f    4a    64    7a    8a    99    bb    d6    f4
47    58    6f    7c    8e    a6    cd    ea    info

$ ls objects/lf
025359eec40ca200dc800f72ff78f6153a502a  82622d17e916d82b3badc38fbe8e025cd4a7d9
1621638abb2fbf888eef4e5a9314e74e055e99  8d7e0431e16b7f03856a5a9ac874d1bea13bcb
1af4d5ff8194432203d4bfd7b78f07426d8362  905c34c72391fa21571b54dd1a8d2711186975
stores reference pointers to objects like heads, remotes, stashes and tags.


Tags come in two flavors: annotated and lightweight.

Lightweight tags

A lightweight tag is an immutable reference to a commit, it simply points to that commit. It gives the commit a warm, friendly name. Creating one is easy if you:

  #create a lightweight tag
$  git tag v6.0
  #look at the file contents created, it points to a commit
$ cat .git\refs\tags\v6.0
  # see that it is the same hash as the master
$ cat .git\refs\heads\master
  # later you can come back to this commit
$ git reset --hard v6.0

You can manually create a tag using update-ref

  git update-ref refs/tags/rel1.0 107b22915830203ff40d0d8dfbf8e950961bc490
git tag
shows all tags
$ git tag

Annotated tags are real objects and are described here.


git remote update origin --prune
removes from your local list the branches that have been deleted in origin
git ls-files
shows all the files in the repo
git ls-file "**/<file-name>"
gets the full path to file
git fsck --full
checks for a corrupt git database. It will find things like a tag reference to an object that has been deleted.
git whatchanged
shows what has changed

Help Me

git help
gets general help
git help config
gets help on the "config" command

Adds and Commits

git add <filename>
adds file to the stage
git add <filename> <file2>
adds multiple files to the stage
git add '*.txt'
adds using wildcards, but must have single quotes
git add --all
adds all new, deleted or modified files
git add -A
stages All files, same as "--all"
git add .
stages new and modified, without deleted
git add -u
stages modified and deleted, but not new files
git commit -m "my commit message"
commit staged files to repo

Deleting and Renaming Files

git rm <filename>
deletes the file and stages the deletion
git rm --cached <filename>
removes the file from version control, but keeps it on the filesystem.
git rm '*.txt'
stages the removal of all the txt files
git mv <filename> <new-filename>
renames a file


git remote
returns the name of the current remote site
$ git remote
git remote -v
use the verbose option to see the URLs for reading and writing
$ git remote -v
origin (fetch)
origin (push)
git remote show origin
shows the URL for "origin" and remote branches.
git remote set-url origin
changes a remote location's value
git push -u origin master
pushes your code to the master branch of the repository defined by "origin"
git remote rename <old-name> <new-name>
renames the remote
git remote remove <branch-name>
removes branch-name from your list of remotes
git remote add <remote-name> <URL>
adds a new remote reference. This will add a section in your "config" file to map the name to the URL. For example after adding "demo" with "git remote add demo", "config" contains:
 [remote "demo"]
   url =
   fetch = +refs/heads/*:refs/remotes/demo/*

The value of "fetch" is called the "refspec". It has an optional "+" (directing git to update the reference even if it's not a fast-forward) followed by <src>:<dist>. "src" is a reference to where the data is on the remote site and "dist" is where to put the files locally.

What's Changed - git diff

git diff
shows only unstaged changes, defaults to HEAD
git diff --staged
shows only staged changes (those in the index)
git diff --cached
"cached" is an alias for "staged"
git diff HEAD
shows staged and unstaged changes
git diff <branch-name>
see changes between current branch and <branch-name>
git diff origin/master
see the difference with the origin master branch
git diff <commit>
see changes from <commit>
git diff HEAD~1..HEAD
see changes from previous commit


"reset" is confusing because it can edit the references, the index (stage), and trees. Note: "--mixed" is the default.

What do the reset options affect?

reset optionworking treeindexHEAD
git reset HEAD
remove changes in the index ("the stage") and resets the HEAD pointer. (default option is "--mixed")
git reset <filename>
removes <filename> from the staging area, but preserves its contents in the working directory
git reset --soft HEAD^
moves HEAD to its parent, leaving the index and working directory files untouched.
git reset --mixed HEAD^
moves HEAD to its parent, and resets the index, but leaves the working directory files untouched.
git reset --hard HEAD^
moves HEAD to its parent, and resets the index and the working files. (You should do a "git stash" before doing this reset)
git reset --hard eb70244
sets HEAD to specific commit and erases all changes in current working tree. Use "git checkout eb70244" to preserve changes.
git reset --hard eb70244
sets HEAD to specific commit and erases all changes in current working tree. Use "git checkout eb70244" to preserve changes.
git update-ref HEAD HEAD^
same as "git reset --soft HEAD^"
git reset HEAD^
undoes last commit and leaves files ready to be staged
git reset origin/master
restores to origin's version


Revert will reverse the effects of previous commits.

git revert <commit>
removes the changes created by <commit>
git revert HEAD~5
removes the changes from the fifth last commit and creates a new commit to reflect that.


git merge <feature>
merges changes from the <feature> branch into current branch. The current branch is updated, but the target branch, "<feature>", is unaffected. Here is a typical flow to merge changes from a feature branch into master with no conflicts:
$ git checkout master
$ git checkout -b feature1
  # make edits and commits on feature1
$ git checkout master
$ git merge feature1
  #cleanup by deleting feature1 branch
$ git branch -d feature1 

Deleting a Branch

git branch -d <branch-name>
delete branch <branch-name>
git branch -d branch1 branch2 branch3 ...
multiple branches can be specified
git branch -D <branch-name>
delete branch <branch-name> even if unsaved changes will be lost. (-D is short for "--delete --force")
git push origin --delete <branch-name>
delete branch <branch-name> on remote
git push origin :feature4
delete branch feature4 on remote (prefixing with ":" does the same as "--delete" in this case)


"git clean" will remove untracked files and directories.

git clean -f
delete untracked file "-f" is needed to force deletion
git clean -df
delete untracked files and directories; useful for getting rid of build products.
git clean --dry-run
Shows what files would be deleted.


"push" copies local refs to the remote and sends the objects necessary to complete the refs.

git push
usually pushes the current branch to origin unless config has a value for "branch.<name>.remote".
git push <repository>
pushes the current branch to <repository>, which can be a URL or the name of a remote
git push origin
pushes local changes to origin. With no further arguments, git looks in the ".git/config" file for the '[remote "origin"] merge' value.
git push -f
forces local changes to origin overwriting others changes. Not recommended except in extreme cases.
git push origin :<branch-name>
pushes an empty branch over "<branch-name>" causing it to be deleted.
git push origin <local-branch-name>:<remote-branch-name>
push a branch to origin with a different name


git pull
same as doing a "git fetch" + "git merge"


git rebase <branch-name>
make <branch-name> the "base" of the current branch. Conflicts may need to be resolved.
git rebase -i HEAD~3
to go back three commits, note lines in reverse order now
git rebase --abort
stop the rebase and roll back

Stash - store changes off to the side

"stash" saves your changes into a genuine commit onto a side stack that can be used like any other commit.

git stash save
stashes staged and unstaged changes onto stash queue (but not untracked files) and reverts current branch to last commit
git stash save "message"
stash to a name
git stash
appends "save" at the end for you
git stash apply
brings back the stash

if you enter "git stash && git stash apply", it will create a snapshot of your system.

git stash list
shows list of stashes with previous commit
git stash list --stat
shows more info, log options can be used e.g., "--oneline"
git stash apply stash@{1}
brings back stash 1. Does not pop off the top of the queue - leaves it there
git stash drop
removes top stash frame in queue
git stash pop
restores most recently stashed files and removes them from the stack of changesets
git stash save --save-index
keeps staged files, but stashes unstaged
git stash show
shows info on last stash
git stash show stash@{2}
info on 2
git stash clear
removes all stashes
jwiegley recommends this clever use of stash for linux systems:
$ cat <<EOF > /usr/local/bin/git-snapshot
git stash && git stash apply
$ chmod +x $_
$ git snapshot  

Cherry Picking

git cherry-pick <commit>
will pick that commit into our current branch
git cherry-pick --edit <commit>
allows changing message
git cherry-pick --no-commit <commit> 55aed374
pulls in changes to staging
git cherry-pick -x <commit>
adds in previous SHA-1 number in comments
git cherry-pick --signoff <commit>
adds picker's id

Genealogy, Searching the Family Tree

to reference a commit you only need to type enough characters to make it unique, usually 6 or 7 characters are enough.
the parent commit, if more than one parent, the first is used
the grandparent
the eighth ancestor, or name^^^^^^^^
If more than one parent this will get the second parent.
matches all commits whose message matches this pattern.
$ git log --grep puppies
matches all commits whose author matches this pattern
$ git log --author=Linus
matches all commits which have only one parent, i.e., no merged commits


"Reflog" is a backup system that keeps track of all our commits, even if we delete branches. The commits will stay around for about 30 days and then get really deleted.

"Reflog" is a history of where HEAD has been pointed.

git reflog
shows commits. Only local to user
   54eb749 HEAD@{0}: checkout: moving ...             
   54eb749 HEAD@{1}: checkout: moving ... 
   eb70244 HEAD@{2}: checkout: moving from ...
   54eb749 HEAD@{3}: pull: Fast-forward

let's accidentally delete a branch

$ git branch -d zoo //generates error, not fully merged
$ git branch -D zoo //overrides and deletes
$ git log --walk-reflogs //gives more info
$ git branch zoo <commit> //creates new branch pointing to deleted branches' last SHA-1
$ git branch zoo HEAD@{1}//same as above
$ git checkout zoo

Squash multiple commits into one tidy commit

You can group your commits into a meaningful one before a merge, but it takes two steps:

Step 1:

  git rebase -i HEAD~n //where n is a number of commits to merge (squash)

The "i" option is for interactive.

Step 2: Git will present you with a text file like this:

pick 8a18f54 one
pick 64156a7 two
pick f4a9307 3

# Rebase cd97cab..f4a9307 onto cd97cab (3 commands)
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit

Leave the first line as is, but in the following lines change "pick" to "squash". Then save, and exit the editor. [In vim, ESC -> :wq! (save changes)]

Git will then present a message file where you can delete all the checkin comments and replace with a new one for all commits. Save and exit. Enter "git log" to see the change.


"git gc" will garbage collect and repack your database.

Git has three types of references: tag, branch, and HEAD.

Git may reduce storage space by using a base file and "diffs" from that base file. These are stored in the "pack" subdirectory.

HEAD is usually a symbolic reference to the last commit in the currently checked-out branch. HEAD points to the current branch. In the .git directory, the file "HEAD" contains a pointer to the current branch, which in turn references a commit hash id. Example:

$ cat .git/HEAD
ref: refs/heads/Mitch_895553_MyBranchName

$ cat .git/refs/heads/Mitch_895553_MyBranchName

The HEAD can be set directly to a commit. This is called a "detached head".

A directory named "index" holds all the files to be committed. This is called the "stage", where files are staged before being committed. Files do not go from the working tree to the repository, they have to be added to the staging area first with a "git add " command.

The "working tree" is where the normal files are kept on your filesystem. It has a ".git" directory which contains all the .git objects.

A "hash id" is a SHA-1 hash, a 40 character hex hash. SHA-1 takes text and reduces it down to 40 characters. The hash of a file is just based on contents, name is not hashed. See "git hash-object file". You can usually use abbreviate the hash with the first few characters. The abbreviation needs to be unambiguous and have at least 4 characters.

Almost all operations in Git add data to the db, it doesn't delete or change the database, so it's very forgiving

For passwords setup in Visual Studio, see:

Three Rules of Branches

  1. Current branch tracks new commits
  2. When you move to another commit (branch), Git updates the files in your working directory
  3. Unreachable objects may be garbage collected

Emacs Examples and Notes

Emacs Examples and Notes

This is the start of my Emacs notes - more to come.

Keyboard Macros

C-x C-k n
names last keyboard macro only for session
C-x C-k b
bind to key sequence
M-x insert-kbd-macro CR macroname CR
inserts named keyboard macro into current file, e.g., .emacs

Tuesday, July 18, 2017

Windows 7 is Not Recognizing a USB Keyboard

My Windows 7 box has not been recognizing my awesome USB Das Keyboard when I dock my workstation in the morning.  The solution was to update the power settings so Windows would not ignore USB devices after powering down.

Steps to Fix:
1. From the Start Button, select "Control Panel" and then "Power Options"

2. Select "Change plan settings" from your favorite power plan.

3.  Select "Change advanced power settings"

4. And finally set the "USB selective suspend setting" to "Enabled".

5.  This should force Windows to keep the USB ports active and recognize your devices.  It may take a minute when you dock your laptop for it to recognize the keyboard.  Please be patient.  This is windows.

Wednesday, July 05, 2017

iPhone "Cannot Connect to App Store"

My iPhone could not connect to the App Store this morning.  I checked Apple Supports answer, but that didn't solve it.

I got these two errors  "Cannot Connect to App Store" and "Loading":

The problem turned out to be my local Wi-Fi provider was blocking ports.   The solution is to switch off your Wi-Fi and access the App Store via cellular - assuming you have enough data in your plan.

Saturday, June 10, 2017

Cutting the Cable in Austin TX with a Tivo and Digital Antenna

After spending around $12,240 on cable TV for the past 17 years, I finally decided to join the 2nd millennium and say goodbye to my cable company and hello to digital broadcast TV.

Here's my step by step guide to cutting the cord on cable with a Tivo in Austin TX. 

1.  Find out if you can receive any digital TV signals.  Visit the FCC at and see how many stations you can receive.  Here's what Austin looks like.

2. Purchase a few digital antennas and see which one works the best and take the rest back.  The price has nothing to do with quality.  Antennas may be actively powered or passive.  The powered may be better for far away stations, but they may not be good for close stations.  Consumer Reports tried to recommend specific brands, but after testing, they could not recommend any since the antennas would do well in one area, but not another.  At the recommendation of the Best Buy guy I tried this one which costs $33.  See more notes below on antennas.
 3. Mount the antenna on the wall near your TV, or better yet on an interior window.

4 Hook up your antenna to the back of your Tivo.

5. Convert the Tivo from cable to over the air (OTA).
The tricky part with the Tivo is that you have to go through the complete initial setup again. On the main menu select "Settings and Messages"/"Help"/"Restart or Reset"/"Repeat Guided Setup" to repeat the setup.  Select "Antenna only" on all the settings.
Tivo will then scan your antenna and show you all the stations it found.

 6.   Remove poor quality stations.
Tivo found 20 OTA stations, but not all came in well and many were in Spanish.
After subtracting those , I now have these stations in Austin TX:
18-1 PBS
18-2 create
18-3 PBS
18-4 PBS
21-1 ABC
24-3 Justice
36-1 NBC
36-2 COZI
36-3 ION
42-1 CBS
54-1 CW
54-2 GRIT
54-3 Laff

 7. Make sure everything is working correctly and then call the cable company to cut the cord.

My bill went from $150 to $ $90 with taxes.
That is still way too high for just internet at 100Mb, but it's a start.
How much do you pay for internet and phone?

After trying the RCA antenna for a while I was disappointed.  I took that back to Best Buy, and  I got a better cheaper one ($20) from Amazon: the Mohu Leaf Metro TV Antenna, Indoor, Portable, 25 Mile Range. It works much better.
Then for my other TV I tried the Intoam Leaf, but it could only pick up 10 stations clearly.

Friday, June 09, 2017

Agile Austin Lean / Kanban SIG Group Lunch Meeting - Theory of Constraints

Jim Brission from gave a great noon talk to the Agile Austin Lean / Kanban SIG group.

Jim started by showing I Love Lucy's famous chocolate scene

My Notes::
Recommended book:  The Goal

Intro:  In hiking you can only go as fast as your slowest person.

Process of Ongoing Improvement (POOGI)

1. Identify system's constraint
   (Optimizing other steps is a waste)
2. Maximally exploit the constraint
3. Subordinate every else
4. Elevate Constraint fix it, make it faster
5. Iterate

Where do we see constraints in Software Development?
Any handoff - QA, Technical Writer, Release team
That guy
  - knows the device driver, the kernel
  - is a super debugger


Drum sets the beat
Buffer is inventory
Rope pulls work into stockpile

Double Loop Learning
  Action Strategies / Results & Consequences
  Governing Variable (values, assumptions, frameworks, beliefs)

Critical Chain Project Management - CCPM
Start with
  Network of tasks and dependencies
  No task starts before dependencies met
  No multitasking of individuals
  Minimize Project Duration

Buffer: Time, Money, Scope
Put buffer at the end of a project, not in individual tasks.

Fever chart

Product owner can save the day by paring down the scope

Cost Accounting
  Created after industrial revolution
  Measures efficiency of men adn machines - unit production per dollar of man or machine
  Cost Accounting not good for software development
ABC - Activity Based Costing
Invalid Assumptions
  Local efficiencies lead to global efficiency
  (.e.g, making one machine faster, doesn't necessarily help the throughput - unless its the most constrained operation)
Bad things that are viewed as good things in Cost Accounting
  Build up inventory (keep machines/people busy)
  Fill everyone's plate with work
    or minimize personnel to ensure all are fully engaged
  Show high productivity rather than high value

Tuesday, June 06, 2017

Agile Austin "Attacking Things Incrementally"

Walter Bodwell spoke to 55 people at Agile Austin this month.

Yassar opened the meeting

 Walter was a great speaker.  He made the audience feel comfortable and people participated well.  We broke into small groups and discussed how to break down some current issues we had at work.

Here's my personal notes:

Simplicity the art of maximizing the amount of work not done is essential.
Small stories are best:  easier to estimate, enables earlier testing, less risk, faster feedback, easier to pivot, easier to tell when done.
Stories can be too small - overhead can be too big.
At least 5-9 stories per iteration.
Ideally .5 to 3 days  per story.

Barriers to small stories: get past all or nothing; some developers don't want to itemize large tasks, overhead can be too great.

 When splitting a story each "slice" should add incremental user value.
Reprioritize and resize after splitting

Who does the splitting?  Product owners and developers
Split stories vertically (Ui and Middle Tier and DB) so user can see value
Don't split horizontally e.g., DB, because user can't see value or be tested

Questions to ask yourself:
How will we test this slice?

Ideas for splitting:
Handle most important users first
CRUD - Start with just Create and Read; wait on Update and Delete
Do the happy path first
Make it work, make it work fast

Why Small Releases?:  Easier to defer to next release; earlier revenue opportunity; earlier feedback; pivot faster;

When doing a code rewrite, put both system out so users can still use old system.  Sometimes a feature is written in such a way that a customer can do something odd and create something very valuable to them which is not documented nor was it intended.


Test Driven Development Workshop

I recently led a Test Driven Development workshop using C# at work.  Here's the exercise I created to show how to do TDD.


Red/Green Refactoring is starting with a failing test, and then making the target software work.

Remember to write the simplest thing that could possibly work

Ping-pong is having a pair of programmers work together.  The first programmer writes the test,  and the second makes the test pass

Workshop Background:
We just bought a zoo and employ jr. high students to write queries against our db for our web site.
The kids work hard, but their construction of URL strings to hit the web service is often bad.
We see final queries like America?type=reptile&pen=a2#4&time
    You need to write a helper URL builder function to make errors less likely, something like,
string url = Utilities.BuildUrl(host, name1, value1, name2, value2, ....)

Here's my example project. 
Clone solution and files from

file ZooQuery.cs -- just a main program -- you will not change this file.
using System;

namespace TestDrivenDevelopment
    public class ZooQuery    {
       public static void Main(string[] args)
           string host = "";
           string url;
            url = host + "?location=Africa";


Utilities.cs -- this is where we write a function
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace TestDrivenDevelopment
    public static class Utilities
               //this is where ReSharper will create the method BuildUrl

UtilitiesTest.cs -- this is where we put the tests defined in the comments below
using System.Collections.Generic;
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Web;
using TestDrivenDevelopment;
using System;
using System.Linq;

namespace UnitTestProject1
    /*    Workshop tasks, Expected URLs:
     1. Simple name-value pair:
     BuildUrl(host, "location","Africa");
     2. Name-value pair with non-url friendly characters:
        BuildUrl(host, "animal pen","#16"); //(note: # in hex is 23)
     3. Multiple name-value pairs
        BuildUrl(host, "type","mammal","continent","Africa","size","small","food appetite","carnivore","animal pen","#16");
       code error conditions:
     4. Check for bad number of parameters
        BuildUrl(host, "type","mammal","continent");
     5. Check for bad host value, needs to look like a host name
    public class UtilitiesTest
     //your tests go here. 
    //Use Snippet to write the initial outline of the test


Have one person create the test, and pass control to another person to upgrade BuildUrl() so it will pass the test. I have 5 exercises, so with 10 people everyone will get to code.

Sunday, May 14, 2017

First Alert Smoke Detector Keeps Chirping/Beeping 5 Times Every 45 Seconds

Came home today and our First Alert model 9120B smoke detector/fire alarm was chirping 5 times every 45 seconds.  Changed the battery like Youtube said, but to no avail.
Turns out it was the carbon monoxide detector located near the smoke detector that had gone bad.  9120B smoke detectors chirp 3 times when their having issues, not 5 times.  Thanks to the First Alert hotline for figuring this out (1-800-323-9005 option 1).

Saturday, May 06, 2017

In C# .Net MVC, How to Pass Arguments to RenderPartial

Sometimes you just need to pass a bit of extra information to a RenderPartial.  It's easy in Microsoft MVC.  Assuming you need to pass the "name" of a zoo animal for the picture tiles:

Html.RenderPartial("_ZooAnimalTile", Animal);

All you need to do is add an entry to the ViewDataDictionary like this:

Html.RenderPartial("_ZooAnimalTile", Animal, new ViewDataDictionary { { "name",  "Mikey"} });

Then in the "_ZooAnimalTile" partial, you can extract the name like this:

string name= this.ViewData.ContainsKey("name")  && ViewData["name"] != null ? this.ViewData["name"].ToString() : string.Empty;

 Enjoy.  (I know the picture of the meerkat is superfluous, but ... I like meerkats).

PS: We have to be paranoid and check for the presence of "name" (i.e., this.ViewData.ContainsKey("name")  && ViewData["name"] != null) since this partial may be called from different places now or in the future.