Tuesday, February 21, 2017

How do I download R Studio to run / learn R programming?

If you are looking for the free version you need to download the RStudio Desktop which comes under Open Source License. Go here to see other versions which are not free ).

In the above link choose the free edition which has Integrated Tools for R and click Download.

You get the following page. If your operating system is in this list, you download from the related link. Note that depending on whether or not you have R 2.11.1+ version. If you do not have you need to download that one first (http://cran.rstudio.com/).


Click on the one you need. For Windows 10 Desktop, the relevant installer is RStudio 1.0.136 -Windows Vista/7/8/10.

You save the file to your Downloads folder.

Double click the executable and it begins installing following the wizard steps.

The installation folder by default is C:\Program Files\RStudio but you can change. You can also add shortcuts.

The installation is quick and you will find the rstudio.exe in the RStudio\bin folder. Double click to launch the program. The shiny package is already in it as shown.


When you just run library(shiny) in RStudio you get the following response. You also get color coding and code guidance very much like intellisense as shown.


Monday, February 20, 2017

What is Shiny?

You started learning the Statistics/Analysis focused language R and you want to do more. You want to build apps with it and host them on the Internet. All this is possible using Shiny.

It is an enterprise-grade web application framework targeted for those who want to develop with R using the familiar HTML5, CSS and JavaScript. Using R you can turn terrific analytic solutions you have developed/developing into interactive web applications.

Go to this site (https://shiny.rstudio.com/) directly and learn more.


If you have R Studio you have Shiny because Shiny is a package that you can download.

In this first part we only talk about the very basics.

I assume you have read my previous hands-on R examples in my blogs.


Here I just show a very basic (aka Hello World) example of creating content for a web page using R GUI. More will come later in my blogs.

Launch R Gui as shown and provide reference to the shiny "library" as shown by typing in the three lines of code (The four lines of code in red).


<-fluidpage br="" ello="" world=""><-function br="" input="" output="">When you hit Enter after the third line where you define the shiny app, a browser window will open as shown displaying the apps output as shown at a port of the local host.

<-fluidpage br="" ello="" world=""><-function br="" input="" output="">HelloWorld_01

You also get a response (the last line) in the R GUI as shown.
<-fluidpage br="" ello="" world=""><-function br="" input="" output="">
<-fluidpage br="" ello="" world=""><-function br="" input="" output="">
<-fluidpage br="" ello="" world=""><-function br="" input="" output="">
<-fluidpage br="" ello="" world=""><-function br="" input="" output="">
<-fluidpage br="" ello="" world=""><-function br="" input="" output="">That is all there is to create a content.
<-fluidpage br="" ello="" world=""><-function br="" input="" output="">
The ui summarizes your user interface, the server is something like a web serve rand shinyApp is your web response. No fuss, very simple.

Saturday, February 18, 2017

What are mutable and immutable variables in F#?

If I assign a value to a variable and then later in the program I assign another value to the same varible the program does not care if it is a mutable variable. However if it is immutable, the program does not accept it. Hence immutable variable is one which is solidly bound to its value.

Let me take you to the .NET Fiddle site so that you can run it yourself and see the result.

First of all assignment to a variable in F# has the following syntax:

let x=25
The above statement assigns a value 25 to the variable x. I can print it to the screen using the second statement (printfn "x: %i" x) because x is an integer.

Next I assign a value of 45. You can see the error in this statement immediately. Hence value of x is immutable.

Now how can I assign a mutable value?

Well, F# uses the keyword mutable as shown here:

let mutable x=15

Now x has a value which can be changed later as shown in the next image. The first statement sets a value 15 for the variable x and the second statement prints it.

The third statement assigns a new value to it, namely 20 and the fourth line prints it. Observe carefully the new value assignment, a backward going arrow.

What is Windows Hello and how to enable it?

Windows 10 uses bio-metric signature of an individual as a security feature of a Windows 10 device, be it a Windows Phone or a Windows tablet/PC. Windows Hello makes this possible in Lumia 950 with an iris scanner. It can also be of two other types and some devices may have more than one type. As an alternative the device should also have the option of other non-bio-metric of authentication such as a pin or a username/password pair.

Lumia 950, the Windows 10 phone has an iris scanner built-in to the camera that compares an individual's iris image to the one that it stored during the initial set up and the phone is unlocked when there is match. if not, the phone asks for the pin number to be punched in to unlock.

The other Windows Hello options are finger print recognition and facial recognition.

In what follows I show some of the screen shots for setting this up on a Lumia 950 Phone. Not all types of Windows Phone has this feature.

First of all this is a high resolution photograph of a human iris from an UK site here.
It is easy to believe the iris signature is far superior to finger print if the camera is good.

Setting up Iris Recognition:

Yous start with Settings on your Lumia Phone after setting up a pin to login. In Settings look for Personalization.


Go down the list and click Lock Screen to open the Lock Screen Page as shown.


 At the very bottom you find Sign-in options. Click this link. The Sign-in options page opens as shown.


There is link if you want to know more about Windows Hello. But there is a Iris(Beta) Set up button. Click the button.
You get a Welcome to Windows Hello page. You can not only unlock your phone without complex passwords but you can buy stuff from Windows Store.


Click on Get Started. The Camera becomes active and you will be asked to move closer or farther (as the case may be) so that the camera can take its standard image of your eye as shown here.


You will be asked to hold your phone in front of your eyes (I did open my eyes a little more than wider to make sure he camera got it all) as shown.


Click Next while you are holding the camera and looking into it.

Your setting up has been successful. You may do it even with your glasses on so that with or without glasses you can unlock your phone.


It did work quite well. There were a few times it did not and then I had to use my pin. But this is much better.

Friday, February 17, 2017

Can I use Windows Power Shell to look at Printers?

Almost anything on the Windows can be accessed from Power Shell and that includes Printers. I have a Canon MX430 printer which is a multi-function printer.

There are two ways to find about printers (that I know of):

You can find all printers using this comndlet to run:
PS C:\WINDOWS\system32> (New-Object -ComObject WScript.Network).EnumPrinterConnections()

Canon MX430 series Printer
Send To OneNote 2016
Microsoft XPS Document Writer
Microsoft Print to PDF
Journal Note Writer Port:
Journal Note Writer
Canon MX430 series FAX

Or, you can also use this:
PS C:\WINDOWS\system32> Get-WmiObject -Class Win32_Printer

Location      :
Name          : Canon MX430 series Printer
PrinterState  : 0
PrinterStatus : 3
ShareName     : Jays MX430 series Printer
SystemName    : HODENTEK8

Location      :
Name          : Send To OneNote 2016
PrinterState  : 0
PrinterStatus : 3
ShareName     :
SystemName    : HODENTEK8

Location      :
Name          : Microsoft XPS Document Writer
PrinterState  : 0
PrinterStatus : 3
ShareName     :
SystemName    : HODENTEK8

Location      :
Name          : Microsoft Print to PDF
PrinterState  : 0
PrinterStatus : 3
ShareName     :
SystemName    : HODENTEK8

Location      :
Name          : Journal Note Writer
PrinterState  : 0
PrinterStatus : 3
ShareName     :
SystemName    : HODENTEK8

Location      :
Name          : Fax
PrinterState  : 0
PrinterStatus : 3
ShareName     :
SystemName    : HODENTEK8

Location      :
Name          : Canon MX430 series FAX
PrinterState  : 0
PrinterStatus : 3
ShareName     :
SystemName    : HODENTEK8

What is fsi.exe?

Fsi.exe is an interactive console application for programming with F#.  Fsi.exe executable opens up a window console when you double click this file after download or otherwise.


F# is not only for Windows OS, you can use it on Mac and Linux operating systems as well.

On Windows platform it is recommended to use Visual Studio to code in F# as Visual Studio is extremely well integrated with F#.

There are a couple of ways to work with F#:

1). If you have Visual Studio 2010/13/15 Professional are higher F# is already included.

2) .Using Visual F# Power Tools can provide additional features such as :
Source Code Formatting
Auto-generating XML Docs
Rename refactoring
Depth Colorizing
Implementing Interfaces
many more.

3). You can also Install Visual Studio Code which is both open source and cross-platform. F# is supported by the Ionide  Project.

4). Install free F# compiler and tools alone

For this you need Windows SDK:

On Windows 10 use the Windows 10 and .NET 4.6 SDK from Microsoft
On Windows 8.1 use the Windows 8.1 and .NET 4.5.1 SDK from Microsoft
On Windows 8 or Windows 2012 Server use the Windows 8 and .NET 4.5 SDK from Microsoft
On Windows 7 or Windows 2008 Server use the Windows 7 and .NET 4.0 SDK from Microsoft
Requires Microsoft Build Tools 2015

5). Another easy way to work which does not need any download is to access this URL:

You have the choice of three languages here: C#,VB.NET or F#.


Sunday, February 12, 2017

How do one access data on a OData Data service?

If you are looking for URL data access you are in the right place.

This is often a easy way to find database data by sending queries to the service site.
There are two formats of resource representations:


The document OData:Operations describes the actions that can be performed on the URLs. Although most sites follow the conventions defined by specification not all of them do.

The following is a picture of the URL Components from the the OData site that is relevant to our discussion.


As an example let us take the Northwind OData service at this site here:


The http: is the HOST
http://Services.odata.org/northwind/northwind.svc: is the SERVICE ROOT

The SERVICE ROOT is required to find all the resources provided by the OData service.

Simply put, if you access the Service Root you would see the following in Microsoft
Edge (Microsoft Edge 39.14965.1001.0)


This is essentially the same as what you see in Mozilla Firefox

URLData_01b.PNG Mozilla (Firefox 51.0.1 (32-bit))

The collection in either of these you see are the tables in the Northwind database exposed as a service.

Accessing the table:

Now how do we access one of these tables. Let us say the Products table. All you have to do is to append Products to the Service Root as in the following:

The Firefox browser would display this:
Only part of the browser display is in this image.


However in Microsoft Edge you would get a response asking you whether or not you want to save.


I have found this is does not always happen and displays the same information as the Firefox.

You may query the browser to format it in JSON with the following instruction:

Filtering the table:
After getting to the Products table, let us say you want to get only the first Product which has ProductID=1, then you change the URL to

In ME you get the same results above.

You can further filter the table.  For example you can find all the Orders placed by the Customer whose CustomerID="ALFKI".

URLData_04 FF

But in ME you would get the following:


Looking at the Northwind database, this result is the same as the query.


These are the columns in the Orders table.