Friday, August 5, 2016

What is needed to leverage R from Visual Studio?

Microsoft's strategy is to bind all its assets and stay in a continuous state of integration, be it SQL Server; Office or its Communication set of products such as Exchange, Live or Skype.

With the addition of R technology for SQL Server in its most recent, highly touted product SQL Server 2016, integration of R with SQL Server and by default with Visual Studio 2015 was a natural extension. Probably integrating R with Excel is not far behind.

As it moves forward embracing Open Source concepts, Microsoft R client is free, the details of which follow:
----------
Microsoft R Client (x64) - (English)
SHA1: B5A7053C7CBC1079091DD1420D04E0489F43AD00
File name: en_microsoft_r_client_x64_8839107.exe
--------------
You can download R Client from here:
http://aka.ms/rclient/download

With Microsoft R Client you are not limited to Microsoft R Open and you can use any open source R package. ScaleR is a powerful new technology in Microsoft Client. ScaleR's propriety functions can be used to great advantage for parallelization and remote computing. With R Client you can work locally using ScaleR but is somewhat constrained limited by local memory and speed. This is improved by pushing the compute context to Microsoft R Server(SQL Server R Services) and R Server for Hadoop.

Microsoft R Client is also part of the R Tools for Visual Studio which gets installed with Visual Studio Update 3 install.

Here are some screen shots from a Visual Studio 2015 Community Update 3 upgrade from Update 2. You can also install the latest version of Visual Studio 2015 Community.

As a default, you get notified of product updates right within Visual Studio 2015 Community (presently Update 2).

 In the Extensions and Updates window you see more details and you can launch the installation from here by clicking the Update button.


This is an intermediate window during updating. R Tools 0.3 for Visual Studio 2015 are being applied to Visual Studio.
This is the Help screen of Visual Studio 2015 after update. I am not sure why the window is stall showing Update 2!! However, notice that R Tools have been added.

R Tools appear to provide a comprehensive set programming support for using R with Visual Studio 2015.

A R Tools toolbar item is added to the menu as shown.

Looks like there are two independent ways of getting Microsoft R Client, the hyperlink which downloads the executable to your computer to being installing or upgrading Visual Studio 2015.

Please note before upgrading to Visual Studio 2015 Community Update 3 I might have started the independent client installation. I will have to check on that.

Here is an image from R Tools site.



Saturday, July 30, 2016

What is dynamic SQL?

It is a batch of SQL statements that you can run by executing the batch.

Basically you declare a command variable and execute the command. The Command variable has the executable T-SQL code.  The executable code may also contain the following:

  • System Stored Procedure
  • User defined stored procedure
  • CLR stored procedure
  • Scalar valued user-defined function
  • Extended stored procedure
Let me first give an example which is often used to demonstrate the use of Dynamic SQL. I am using SQL Server 2016 but using a database imported from SQL Server 2014.


D_SQL_00

The first line of code declares a variable @cmd of data type characters

The second line declares a variable @tbl also of data type characters

The third statement sets a value for the @tbl variable which in this case AdventureWorks2014.Person.Address table. This statement does not require the context of AdventureWorks2014, but can be run from 'master'

The fourth statement declares what the @cmd variable should do when executed. It is just a SELECT statement that selects the top 5 rows from the Person.Address table.

You can see that this dynamic SQL returns the results requested.

Wednesday, July 27, 2016

How are User DSN, System DSN and File DSN are different?

ODBC User data source stores information needed to connect to the data source that is targeted for connection.

DSN is needed to connect to a data source and it stands for Data Source Name.
User DSN:
Only visible to the user who created it and can only be used on the computer on which it is created.

System DSN:
It is available for all users of the computer on which it is created including NT Services.

File DSN:
It can be shared by users who have the same drivers installed on their computer.

Obviously File DSN is more portable than User DSN

How do you create a DSN?

All Windows installations have what is called a ODBC Data Source Administrator, a program to create, maintain or modify data source access that use SQL as a data source standard language.

Search ODBC Data Source on our desktop. 

Can you code in TypeScript in Visual Studio 2015?

I have Visual Studio 2015 Community and I can say that you can indeed code in TypeScript and Visual Studio 2015 provides support. As you can see from the next image, VS Community 2015, TypeScript 1.8 is installed.



As to what type of templates exist, all you need to do is to create a new project and take a look at the installed templates and look for TypeScript as shown here:

Sunday, July 24, 2016

What is Microsoft R Open and how do you get it?

Are you interested in doing statistical analysis of data on a SQL Server? If you say yes, you need to use the most developed statistical ananlysis language R to go with it.

Microsoft R Open is the enhanced distribution of R from Microsoft. It is complete and open source platform. The version R Open 3.3.0 is 100% based on the R-3.3.0 statistical language (R Foundation for Statistical Computing). It is available for 64-bit acrchitecture only.

Its features are:
  • Improved performance
  • Reproducibility
  • Support for Windows and Linux-based Platforms
You may download it from here: https://mran.revolutionanalytics.com/download/

However, if you have already installed SQL Server 2016 and you want to use the R 3.3.0 features then
https://mran.revolutionanalytics.com/download/mro-for-mrs/

Note that R Open is automatically installed for you during installation of R Server.

What is the connection string to use while connecting to SQL Server 2016 from R?

Connection String is perhaps the most important parameter while connecting to SQL Server or for that matter any other source of data.

You should preferably launch the Microsoft's R Gui and specify a string variable to connect to SQL Server 2016 from within R Gui.

You need to create a string variable such as this for a trusted connection:
----------------------------------
.

-----------------------------------
If you have UserId (Uid) and Password (Pwd) with appropriate permissions you may use the following:
--------------------------------------------
-------------------------

Note 1: Your Server may be different and your database may be different
Note 2: For Server you may also use just a period as in:
-------------
Server=.;
-------------
Note 3: Keyword are case sensitive

My apologies for an ill formatted post which I have now corrected by using images instead of formatted text.

Saturday, July 16, 2016

Does Evernote Web Clipper extension for Microsoft Edge really work?

What is Evernote Web Clipper?

It is an extension to Microsoft Edge for builds 14372 and beyond (hopefully).
This is a new extension that clips web pages and saves to Evernote (called the Evernote web Clipper) which adds the extension to Microsoft Edge (Clip to Evernote). Once in Evernote you can easily find them on any device. You can, not only clip, but also add annotations and share the web clips with others.

Here is the PR video:

Now does it work? I tried to work with the extension and here are the findings.

You get to the Microsoft Extensions page from the link shown earlier which brings up the page with several extensions. Evernote Web Clipper as shown below is also available if your version of Microsoft Edge supports it.
EvernoteWebClipper14372_00

Click Open in Store. From here you can download it.


After downloading you should be able to see the Clip to Evernote menu in the Ellipsis at the right most end of Microsoft Edge as shown.


When you click on it, you will be asked to provide the Evernote login or register if you do not have an account as shown.
Since I do not have an account I click on Create an Evernote account which opens up this pop-up.


There is no message if it has been accepted or not, but there seems to be a piece of mail from Evernote advising me to download Evernote.

I download the application (Evernote_6.1.2.2292.exe). Then follows a series of wizard screens such as this one.


Looks like you need to register again as the 'Get a Free Account' got launched. I will just try if my initial registration is still current. Looks like the account is current.

Launch the Evernote app to open the following (after providing the credentials).


Click the radio button, Clip content from the web launches a web page reminding you that you can say Good Bye to Bookmarks and welcome Evernote.

Test Web clipping with extension:

Launch a web page (any page) in Microsoft Edge.

Try to click Clip to Evernote and you may not succeed couple of times and you may get this message.


Close Microsoft Edge (all browsers) and start again and finally this will come up.


I saved it as a Simplified article and clicked Save. The synchronize button started working, probably synching, what it captured with the Evernote on the desktop. Finally this came up.


Now Launch Evernote to see if the clip has been added. You may have to click on the menu item Sync to see the note as shown.


Wunderbar! It finally worked.