# Tuesday, November 6, 2018

Azure CosmosDB is a flexible, fast, reliable, scalable, geographically distributed NoSQL database.

You can create a CosmosDB account and database in the Azure poral.

Navigate to the Azure portal and login.

Click the [Create a resource] button, as shown in Fig. 1.

Fig. 1

From the menu, select Database | Azure CosmosDB, as shown in Fig. 2.

Fig. 2

The "Create Azure CosmosDB Account" blade displays, as shown in Fig. 3.

Fig. 3

At the Subscription dropdown, select your Azure subscription. Most of you will have only one subscription.

At the Resource Group dropdown, select an existing resource group or click "Create new" to display the New Resource Group dialog, as shown in Fig. 4.

Fig. 4

In the New Resource Group dialog, enter a unique name for your resource group and click the [OK] button.

At the "API" dropdown, select the API you want to use to access the databases in this account, as shown in Fig. 5.  Options are

  • Core (SQL)
  • MongoDB
  • Cassandra
  • Azure Table
  • Gremlin (graph)

Fig. 5

If you are migrating data from another database, you may want to choose the API that resembles your old database in order to minimize changes to the client code accessing the database. If this is a new database, you may wish to choose the API with which you and your team are most familiar.

At the "Location" dropdown, select a region in which to store your data. It is a good idea to keep your data near your users and/or near any services that will interact with your data.

The "Geo-Redundancy" and "Multi-region writes" options allow you to globally distribute your data. There is an extra charge for enabling these features.

You can enable Geo-Redundancy by clicking the [Enable] button next to "Geo-Redundancy". This creates a copy of your data in another nearby region and keeps that data in sync.

Click the [Enable] button next to "Multi-region writes" if you wish to allow data to be written in multiple regions. This will improve the performance when writing data to the database.

Notice the tabs at the top of the page (Fig. 5). The "Basics" tab displays first, but the "Network", "Tags", and "Summary" tabs are also available.

Fig. 6

The "Network" tab (Fig. 7) allows you to add your CosmosDB account to a specific Virtual Network and Subnet. This is not required.

Fig. 7

The "Tags" tab (Fig. 8) allows you to assign metadata to this CosmosDB account, which may help when grouping together related accounts on a report. This is not required.

Fig. 8

The "Summary" tab (Fig. 9) displays all the options you have chosen and validates that you completed the required responses and that all responses are consistent. You can navigate to this tab by clicking the "Summary" tab link at the top or by clicking the [Review + create] button on any other tab.

Fig. 9

Click the [Create] button to begin creating your CosmosDB account. This will take a few minutes. A message displays as shown in Fig. 10 when the account is created and deployed.

Fig. 10

As you can see, there are a number of links to documentation and tutorials.

Click the [Go to resource] button to open the CosmosDB account. By default, the "Quick start" blade displays, as shown in Fig. 11.

Fig. 11

In this article, I showed how to create a new Azure CosmosDB account. In the next article, I will show how to add a database with containers to that account.

Tuesday, November 6, 2018 6:28:00 AM (GMT Standard Time, UTC+00:00)
# Monday, November 5, 2018

Episode 536

Hao Luo on Rust

Hao Luo talks about the Rust programming language, how it works, and how he is using it.

Monday, November 5, 2018 7:24:00 AM (GMT Standard Time, UTC+00:00)
# Sunday, November 4, 2018

Today I am grateful for my first visit to Montreal in almost 12 years.

Today I am grateful to visit St. Ours, Quebec yesterday - home of some of my ancestors.

Today I am grateful for Montreal smoked meats and poutine.

Today I am grateful for dinner last night at a rotating Portuguese restaurant high above Montreal with Brent, LaBrina, and Sarah.

Today I am grateful to attend my first home Montreal Canadiens game yesterday.

Today I am grateful for dinner with Nick last night.

Today I am grateful to attend an exciting Red Wings victory at Little Caesars Arena last night.

Today I am grateful to be my nephew Sterling's sponsor for his confirmation last night.

Today I am grateful for dinner last night with Esteban.

Today I am grateful for a week in Dallas.

Today I am grateful for dinner last night with Tristan, Joe, Timothy, Sergii, Danny, Denis, and Ashley.

Today I am grateful to attend a Dallas Stars home game for the first time.

Today I am grateful for dinner last night with Amanda, Timothy, and Sergii.

Today I am grateful for Texas BBQ.

Today I am grateful for all the good restaurants in Chicago.

Today I am grateful to wake up to this view every morning.

Today I am grateful for free pound cake and ice cream at the Grand Opening of a local bakery yesterday.

Today I am grateful for the colors of autumn.

Today I am grateful for a hot bath last night.

Today I am grateful for dinner with Corey last night.

Today I am grateful for dinner with Ryan last night, where I was able to introduce him to his first Chicago-style hot dog.

Today I am grateful that, after 5 years, 3 roles, and 5 managers, I still enjoy working at Microsoft.

Today I am grateful for an empty seat next to me on my flights to and from Seattle.

Today I am grateful for the DJ playing so much non-American music at last night's party.

Today I am grateful to Brent for bringing to Seattle homemade BBQ to share with us.

Today I am grateful to learn from my teammates.

Today I am grateful for dinner last night in downtown Seattle with Brent, Carl, and Michael.

Today I am grateful to meet Richard for a drink last night.

Today I am grateful that, for the first time in my life, I have hired someone to clean my home twice a month.

Sunday, November 4, 2018 3:28:39 PM (GMT Standard Time, UTC+00:00)
# Saturday, November 3, 2018
  1. A robot may not injure a human being or, through inaction, allow a human being to come to harm.
  2. A robot must obey the orders given it by human beings except where such orders would conflict with the First Law.
  3. A robot must protect its own existence as long as such protection does not conflict with the First or Second Laws.

These are the 3 laws of robotics. They are built into the core technology of a robot's positronic brain and no robot may violate them. All robotic technology is built on top of these laws, ensuring that robots will be safe.

In the 1940s, Isaac Asimov wrote a series of stories speculating on the future evolution of robots and, in 1950, he compiled them into a single volume titled I, Robot. Although only loosely connected, most of the stories include Dr. Susan Calvin, a  Robopsychologist at U.S. Robotics, the only company able to manufacture these machines.

IRobotMany of the stories in this book revolve around the 3 laws - particularly exploring what happens when the laws come into conflict or when an ambiguous situation makes it difficult for a robot to interpret and apply the laws. The greater the conflict, the more stress placed on a positronic brain, which is why robots need a psychologist and humans need Susan Calvin to help them understand robots.

These stories launched a series of very good Robot novels for Asimov, who eventually tied the universe in which his robots existed into his Empire and Foundation series. Asimov's robots and the Robotics Laws influenced many other books and movies featuring mechanical men; and even influenced the real world field of robotics, as his three laws are often brought up when discussing the ethics of the technology. In fact, the term "robotics" was invented by Asimov and first appeared in a story in this collection.

I, Robot succeeds because it is based on plausible scientific principles and because it raises questions that science would be likely to encounter as it advances. There are no strong characters throughout the series (Calvin is a minor character in most of them), but the story and the ethical questions carry them along well.

My favourite story is "Liar", which is about a robot that gains the ability to read minds and uses this power to do what he believes will bring no harm to humans. It is a parable of the result of good intentions wrongly applied.

I, Robot is a reminder that advancing technology brings with it ethical choices and questions. Any fan of science fiction will enjoy it.

Saturday, November 3, 2018 8:21:00 AM (GMT Standard Time, UTC+00:00)
# Friday, November 2, 2018

Sometimes, you want to store quotation marks within a string, as in the following example

"Alive", she cried!

In C#, there are at least 4 ways to embed a quote within a string:

  1. Escape quote with a backslash
  2. Precede string with @ and use double quotes
  3. Use the corresponding ASCII character
  4. Use the Hexadecimal Unicode character

Escape with backslash

You can precede any escaped character with a backslash ("\") to preserve that character.

For example:

var lyrics = "\"Alive\", she cried!"

Precede with @ and use double quotes

If you precede the string with the "@" character, you can use a double set of quotation marks to indicate a single set of quotation marks within a string.

For example:

var lyrics = @"""Alive"", she cried!"

Use the ASCII character

A double quote is the ASCII value 34, so you can append this to your string.

For example:

quote = (char)34 + "Alive" + (char)34 + ", she cried!";

Use the Hexadecimal Unicode character

You can escape Unicode characters by preceding the hexadecimal value with "\u". The hexadecimal value of a double quote is 0022, so you can include this in your string.

For example:

quote = "\u0022Alive\u0022, she cried!";

These techniques work for many other characters that are difficult to represent within quotation marks, such as line feeds, non-English characters, and non-printing characters.

There are other ways to include quotation marks within a C# string, but these should be enough to get you started.
Friday, November 2, 2018 7:08:00 AM (GMT Standard Time, UTC+00:00)
# Thursday, November 1, 2018
Thursday, November 1, 2018 9:02:00 AM (GMT Standard Time, UTC+00:00)
# Monday, October 29, 2018

Episode 535

Rajasa Savant on Serverless Azure

Microsoft Engineer Rajasa Savant describes the "Serverless" technologies available in Microsoft Azure

Monday, October 29, 2018 8:56:00 AM (GMT Standard Time, UTC+00:00)
# Sunday, October 28, 2018

SecondFoundationSecond Foundation concludes Isaac Asimov's classic Foundation Trilogy

The Mule has taken over much of the galaxy defeating The Foundation and establishing his own empire through the use of his powerful mutant mental powers. He has spent years searching for the hidden Second Foundation established by the psychohistorian Hari Seldon centuries earlier, correctly assuming it is the only viable threat to his reign. But the Second Foundation finds him before he can find it and they have similar - if less powerful mental powers.

The Mule cannot last forever, and he leaves no heir (which is why he is "The Mule"), but he did leave Seldon's plan in shambles by so drastically altering the history of the universe in an unpredictable way.

The second half of this book chronicles the Second Foundation's efforts to rebuild Seldon's plan and set the galaxy back on a path toward a second galactic empire. It features a war between The Mule's successors and the remnants of The Foundation and The Foundation's quest to locate the Second Foundation.

Asimov uses his talent for misdirection multiple times in this book, guiding the reader toward one conclusion and then another, before revealing the true answer. He does this most when identifying who is with the Second Foundation and where it is located.

This volume brings to the fore a theme that lurked under the surface of the first two books: The people of the Foundation know that Seldon's plan almost guarantees their success. They have almost a religious faith in their eventual victory. This helps boost morale during the war, but hinders them as they work to overcome other obstacles. They know that the actions of individuals are insignificant in Seldon's plan and that Seldon's plan predicts their ultimate triumph. So how much effort need they put forth in accomplishing the inevitable? They hold these beliefs even after the disruption of the plan by the actions of the Mule.

One thing that appealed to me about this series is that the principles of using large amounts of data to do predictive analysis has become a huge field of study today. Machine Learning and Big Data are fields that existed since the days of Asimov, but now that cloud computing provides massive compute power at affordable prices, these sciences have gained both power and interest.  Asimov foresaw this 50 years ago.

Later in his life, Asimov returned to writing about the Foundation; but this trilogy began the ideas and remains one of his strongest work. It is well worth reading.

Sunday, October 28, 2018 9:29:00 AM (GMT Standard Time, UTC+00:00)
# Saturday, October 27, 2018

WarOfTheWorldsIt is impossible to overstate the impact The War of the Worlds by H.G. Wells had on science fiction. First published in 1897, this book broke new ground in science fiction - a genre still very much undefined at that time.

An alien invasion; monstrous creatures driving giant machines with long tentacles; weapons that blast an incinerating heat ray. These are now science fiction clichés. But they were original in the nineteenth century.

The War of the Worlds tells the story of a Martian invasion of Earth. Giant cylinders crash into England and strange creatures emerge. They climb into giant armored machines and begin to terrorize London and the surrounding area, killing people and destroying the cities. Although England was a world power at that time, it was no match for the weapons of the Martians. It isn't long before England's existing civilization is wiped out and humans are in hiding from their new overlords.

War of the Worlds is an adventure story, told by an unnamed narrator as he flees the invading monsters. The narrator does not save humanity. He simply observes and reports.

Wells was himself a scientist and he injects a great deal of science into his story - from how evolution affected the appearance of the Martians to how natural selection controls which alien plants survive on Earth and for how long to how gravity would affect the aliens. Even the final fate of the Martians is based in science.

This book is also a morality story. Wells repeatedly uses the analogy that the relationship of Martians to Earth Men is similar to our relationship with the animals of our planet, which we slaughter for food without thinking twice. He refers to us as ants to the Martians, thanks to their enormous head start in evolution, civilization, and technology. More poignantly, Wells compares the Martians' treatment of the British subjects to Britain's treatment of other people in its quest to expand its empire.

Read The War of the Worlds if you want to understand where much of today's science fiction originated.

Saturday, October 27, 2018 9:00:00 AM (GMT Daylight Time, UTC+01:00)
# Thursday, October 25, 2018
Thursday, October 25, 2018 9:37:00 AM (GMT Daylight Time, UTC+01:00)