Recently I have looked more at IoT, Raspberry Pi in my spare time. In my blog post I want to share my experience in a series of posts. This post is about measuring temperature, humidity and pressure with Raspberry Pi 2 Model B and Sense Hat and posting this data to Azure Table Storage.
I followed this tutorial for connecting to azure with python and these instructions for reading data from Sense Hat.
The python script is on github. Along the way I learned that only python 2.x can be used with azure and table names cannot contain underscore (I got Bad Request error when I tried to create a table with the name “climate_data”). But overall, the process was straightforward. The temperature is not correct, maybe because the sensor is inbetween Raspberry Pi and Sense Hat where it gets warm. But it is just a Proof-of-Concept.
I have used Visual Studio 2015 to see the data in Azure Table Storage. For that I needed to install Azure SDK 2.7. There are many other “explorers” for Azure Storage.
Accessing Azure from Linux and Mac
I am very curious about the new .NET Core, ASP.NET 5, EF 7 and Visual Studio Code for Linux, Mac and Windows. I have tried it out on an Ubuntu 15.04 machine. The installation and configuration required a few steps, so it is not an usual “Next-next-next”-installation. But, hey, it is just a beta, a preview so far, and first of all: It worked. I am sharing a couple of screenshots and the commands I ran in the terminal, mixed with comments and links:
#install latest node and npm
curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install -y nodejs
sudo npm install -g yo
sudo npm install -g generator-aspnet
# download VS Code and make a link
# make a folder
# create "src/global.json" file:
# start VS Code
# install omnisharp:
curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | DNX_BRANCH=dev sh && source ~/.dnx/dnvm/dnvm.sh
sudo apt-get install -y libunwind8 gettext libssl-dev libcurl3-dev zlib1g libicu-dev
dnvm upgrade -r coreclr
sudo apt-get install make automake libtool curl
curl -sSL https://github.com/libuv/libuv/archive/v1.4.2.tar.gz | sudo tar zxfv - -C /usr/local/src
sudo sh autogen.sh
sudo make install
sudo rm -rf /usr/local/src/libuv-1.4.2 && cd ~/
#build, I got an error here
#start the web server
Here is an animated gif that explains how to use it:
Adding own search verticals is a common task in the Search Configuration in SharePoint. Here I want to share a code sample for achieving this programmatically. I hope, this model can be added to SPMeta2.
First of all, Search Verticals are dedicated Search Results Pages and links to them. How to add them manually is described on technet:
There is no API in CSOM for that. Luckily, Mikael Svenson found how to get the Search Navigation and contributed to PnP by writing an Extension: web.LoadSearchNavigation.
Here is my sample code for adding new Search Verticals programmatically:
NavigationNode searchNav = context.Web.Navigation.GetNodeById(1040);
NavigationNodeCollection nodeCollection = searchNav.Children;
NavigationNodeCreationInformation everything = new NavigationNodeCreationInformation
Title = "Everyting",
Url = "/search/Pages/results.aspx",
NavigationNodeCreationInformation myresults = new NavigationNodeCreationInformation
Title = "My Results",
Url = "/search/Pages/myresults.aspx",