Friday, December 15, 2017

How do I ‌put x and y values as data input in R programming?

In constructing relationship between x and y, we create a table with two columns, with x in the first column and corresponding y in the second column. The value of x may be discrete (numeric or non-numeric) or continuous(numeric) and y is numeric. A graph with x and y represents the table of values.
In the following there are six categories (A through F) and for each of these categories a value has been assigned (67,47,11,12,22,24). Now how do I create a data in R that I could work on?
This is easily carried out by creating a data frame as shown:

>  dap <- br="" data.frame="">+  x=factor(c("A","B","C","D","E","F"), levels=c("A","B","C","D","E","F")),
+ ItmVal=c(69,47,11,12,42,24)
-----------------------------------


DataFrameDiscrete.png

What is the best program to review report rdl file?

A RDL file is a report definition language (RDL) file. It has every bit of information in the file.

You have several options to look at a report's rdl file as shown (by right clicking the (any report) reportany.rdl file.


XmlRdl_0


You could open in Notepad and it is going to be a very large file and you may get yourself lost in it without recognizing the key areas. Even using Microsoft Edge it is the same. You could open in Microsoft Visual Studio, but not every one may have it.
The reccommendation is XML Notepad. This is a good application to review the properties of a report rdl file.
You may download XML Notepad as described here. it is free.
Launch XML Notepad and click FIle menu to open the rdl file. In this case I am using a simple file called SimpleReport.rdl.
The file gets opened as shown. Now you see why I recommend this application. You canveyr clearly see how ggthe report is constructed.


XmlRdl_1.png

Expand the DataSource to see the details.



XmlRdl_2.png

Now open the DataSets node as shown.



XmlRdl_3.png

Click the Fields to see the fields in the data as shown.

XmlRdl_4.rdl


Well, you can also see the report design.

XmlRdl_5.rdl

Explore more and enjoy!

I guess you agree with my assertion that XML Notepad is the best to see the report rdl file.

Thursday, December 14, 2017

How do you use factor/s in R Programming?

Factors are variables to represent categories. Categories are discrete and not continuous. In statistics there is a need for such a variable.

Let us say, I roll the dice a dozen times and come up with values for each roll as shown:
2,4,5,3,2,6,10,5, 9,6,4,5

I can gather these in a data as shown in R with "dat":
data
---------------------------------






---------------------------------
Now I use 'factor' as used in R:
facData=factor(data)
--------------------

-----------------------
factor just took one unique item from the list presented to it to display in Levels. There were two 4's, three 5's and two 6's. It categorized them.

While the original data was numeric they could be also character data in "datac" below:


-------------------------------
We know the unique ones in the above data. How are we going to find how many of each are there?
For this we can use the table() in R as shown below:
------------------------------------

You can check for yourself, that it picked the correct value for each category.

Wednesday, December 13, 2017

How do you plot using GGPLOT in Power BI?

We saw an example of plotting using GGPLOT earlier in the RGUI.

Herein we use ggplot in Power BI.

We connect to Northwind database on an instance of SQL Server 2016 Developer. We load data from Products and OrderDetails table into Power BI.

We drop the R Script Visual from the Visualizations onto the designer.



ggplot2
The R script editor opens up as shown


ggplot_03

Add the following code as shown:
-------------------------------
library(ggplot2)
y=ggplot(data=dataset, aes(x=ProductName, y=Quantity))
y=y + geom_point(aes(color="red"))

-------------------------
If you run this code using the R script

You get an error:


Now modify the above to this:
---------------------------
library(ggplot2)
y=ggplot(data=dataset, aes(x=ProductName, y=Quantity))
y=y+geom_point(aes(color="red"))
y=y+geom_point(aes(size=Quantity))
y

---------------------
Now run the script. You will see the plot as shown. The size shows the value of "Quantity" and the color=red is supposed to make it red.


The correct code for aes is modified to this:
-------------------
library(ggplot2)
y=ggplot(data=dataset, aes(x=ProductName, y=Quantity))
y=y+geom_point(aes(size=Quantity, color="red"))
y

-------------------
Run this code again. You get the following visualization.

Looks like there may some error in rendering of the color. Changing it to blue makes it still 'red'.



Tuesday, December 12, 2017

How do you find details about your computer operating system using Windows Management Instrumentation?

Call up WMIC from a command prompt to begin as shown.e  It is better to start the CMD  as an adminsitrator.
-----------
C:\WINDOWS\system32>Wmic
wmic:root\cli>
----------------
Now you are at the root, use the following statement to find the help file for the Operating System (OS):
------------
wmic:root\cli>OS /?
OS - Installed Operating System/s management.
HINT: BNF for Alias usage.
( [WMIObject] | [] | [] ) [].

USAGE:
OS ASSOC []
OS CALL []
OS CREATE
OS DELETE
OS GET [] []
OS LIST [] []
OS SET []

-------------------
You should get help for each of these as well. Here is an example for OS Get:
Execute the following statement:
-------------
wmic:root\cli>OS GET /?
Property get operations.
USAGE:
GET [] []
NOTE: ::= |

The following properties are available:
Property                                Type                    Operation
========                                ====                    =========
BootDevice                              N/A                     N/A
BuildNumber                             N/A                     N/A
BuildType                               N/A                     N/A
CSDVersion                              N/A                     N/A
CSName                                  N/A                     N/A
CodeSet                                 N/A                     N/A
CountryCode                             N/A                     N/A
CurrentTimeZone                         N/A                     N/A
Debug                                   N/A                     N/A
Description                             N/A                     N/A
Distributed                             N/A                     N/A
EncryptionLevel                         N/A                     N/A
ForegroundApplicationBoost              N/A                     N/A
FreePhysicalMemory                      N/A                     N/A
FreeSpaceInPagingFiles                  N/A                     N/A
FreeVirtualMemory                       N/A                     N/A
InstallDate                             N/A                     N/A
LastBootUpTime                          N/A                     N/A
LocalDateTime                           N/A                     N/A
Locale                                  N/A                     N/A
Manufacturer                            N/A                     N/A
MaxNumberOfProcesses                    N/A                     N/A
MaxProcessMemorySize                    N/A                     N/A
Name                                    N/A                     N/A
NumberOfLicensedUsers                   N/A                     N/A
NumberOfProcesses                       N/A                     N/A
NumberOfUsers                           N/A                     N/A
OSLanguage                              N/A                     N/A
OSProductSuite                          N/A                     N/A
OSType                                  N/A                     N/A
Organization                            N/A                     N/A
OtherTypeDescription                    N/A                     N/A
PlusProductID                           N/A                     N/A
PlusVersionNumber                       N/A                     N/A
Primary                                 N/A                     N/A
QuantumLength                           N/A                     N/A
QuantumType                             N/A                     N/A
RegisteredUser                          N/A                     N/A
SerialNumber                            N/A                     N/A
ServicePackMajorVersion                 N/A                     N/A
ServicePackMinorVersion                 N/A                     N/A
SizeStoredInPagingFiles                 N/A                     N/A
Status                                  N/A                     N/A
SystemDevice                            N/A                     N/A
SystemDirectory                         N/A                     N/A
SystemDrive                             N/A                     N/A
TotalSwapSpaceSize                      N/A                     N/A
TotalVirtualMemorySize                  N/A                     N/A
TotalVisibleMemorySize                  N/A                     N/A
Version                                 N/A                     N/A
WindowsDirectory                        N/A                     N/A
The following GET switches are available:
/VALUE                       - Return value.
/ALL(default)                - Return the data and metadata for the attribute.
/TRANSLATE:      - Translate output via values from
.
/EVERY: [/REPEAT:] - Returns value every (X interval) seconds, If /REPEAT specified the command is executed times.
/FORMAT:   - Keyword/XSL filename to process the XML results.

NOTE: Order of /TRANSLATE and /FORMAT switches influences the appearance of output.
Case1: If /TRANSLATE precedes /FORMAT, then translation of results will be followed by formatting.
Case2: If /TRANSLATE succeeds /FORMAT, then translation of the formatted results will be done.
------------
Now here are a few things about my operating system (Windows 10 Professional)
----------------
wmic:root\cli>OS GET BootDevice
BootDevice
\Device\HarddiskVolume2

wmic:root\cli>OS GET SerialNumber
SerialNumber
00330-80000-00000-AA401

wmic:root\cli>OS GET Manufacturer
Manufacturer
Microsoft Corporation

wmic:root\cli>OS GET Version
Version
10.0.17025

------------
This was just a sample of what you can find. You can try a whole lot on yourself.

Friday, December 8, 2017

How do you plot data with ggplot?

After knowing your data, visualizing data is the next most important thing.

Report writing, analyzing data and mining data all require data visualization. It is a must for all including the data scientists.

There are various data visualization software such as Power BI, SQL Server Reporting Services, Tableau etc, but ggplot outshines them in many ways besides being free, like air. GGPLOT also happens to be the most used tool especially in serious science and  statistics.

Let us get some data to plot using GGPLOT.

In my previous post I have created a csv file that we can use. Read about this csv file here:

http://hodentekhelp.blogspot.com/2017/02/how-do-you-import-text-file-into.html

How do you plot data with ggplot?

Launch R GUI from your Microsoft R folder here:


Get this data into a data frame using this code in R

> df <- csv="" esktop="" header="TRUE)</font" log2017="" read.csv="" sers="" wner="">
The data can be displayed in R as follows:


ggplot_data2

Now I assume you have the ggplot package. If you do not have get it as shown here:

http://hodentekhelp.blogspot.com/2015/11/what-is-needed-to-visualize-data-in-r.html

Load the library of ggplot as shown here:

> library(ggplot2)


Now run the following code in R
> z=ggplot(data=df, aes(x=productName, y=Quantity))
This just loads the data to ggplot but will not plot. You need to tell what kind of geometrical object we use to plot and that we specify by geom_point(). It is some what of unintuitive way but that is how it works.
The code to plot would be as shown:
-----------
> y=ggplot(data=df, aes(x=ProductName, y=Quantity))+geom_point()
> y
--------------
This brings up the graphic R window as shown (if you do not see this, click on the
windows menu item in R)


ggplot23_plot.png


Agreed that this is not a great set of data, but it is enough to illustrate the most basic step of visualizing data with ggplot().

The function aes() is called the aesthetics. You will learn that the name of this function is quite appropriate. That will be for another day.

How do you connect to SQL Server using Microsoft SQL Operations Studio?

It is so easy to connect to SQL Server database.

Read here: What is Microsoft SQL Operations Studio?
http://hodentekhelp.blogspot.com/2017/12/what-is-sql-operations-studio.html

Read here: Microsoft SQL Operations Studio User Interface
https://hodentekmsss.blogspot.com/2017/12/sql-operations-studio-user-interface.html

Watch this video: Connecting to SQL Server 2016 Developer edition database using
Microsoft SQL Operations Studio

Monday, December 4, 2017

What is SQL Operations Studio?

Well there is a heavy-weight tool, SQL Server Management Studio that is installed as a separate application from SQL Server installation (used to be a part of the SQL Server installation).

SQL Operations Studio is a lighter tool. It is free and you can carry out database development operations using it. It is available for SQL Server on Windows, Linux and Docker, Azure SQL Database and Azure SQL Data warehouse on Windows, Mac or Linux.

The preview version became available in November of 2017.

If you would like to use it you need to download the version you want from here:


I downloaded the Windows version. You need to extract the files into a folder. 


The executable is sqlops.exe and it is indeed a small file.






Thursday, November 30, 2017

How do you find details about the aliases in WMI?

In order to explore with WMI we need to know the alias for the item we want to explore. Let us find out what the 'alias' in WMI is.

Let us get the help on 'alias' first.
Run this command (just type WMIC in search charm in Windows 10[this is where you see the Cortana icon]) and the C:\windows\System32\wbem\wmic.exe will come up as shown.

Now type alias /? at the wmic:root> prompt as shown.
-----------------------------------
wmic:root\cli>alias /?
ALIAS - Access to the aliases available on the local system
HINT: BNF for Alias usage.
( [WMIObject] | [] | [] ) [].

USAGE:
ALIAS ASSOC []
ALIAS CALL []
ALIAS CREATE
ALIAS DELETE
ALIAS GET [] []
ALIAS LIST [] []

wmic:root\cli>
------------------
Now we can get the aliases and what they represent using the Alias List command as shown in the next using the list switch - brief:
------------
wmic:root\cli>Alias List Brief
FriendlyName         PWhere                                  Target
NICConfig               Where Index=#                        Select * from Win32_NetworkAdapterConfiguration
SysDriver                 where Name='#'                       Select * from Win32_SystemDriver
TapeDrive                                                                 Select * from Win32_TapeDrive
NTEventLog           WHERE LogfileName='#'        Select * from Win32_NTEventlogFile
UserAccount                                                             Select * from Win32_UserAccount
Job                          WHERE jobid=#                               Select * from Win32_ScheduledJob
SoftwareElement                                                      Select * from Win32_SoftwareElement
--------------------------------------------------------
The full list is long and above is a clipped list.

Here is picture of the complete list (use a magnifier to see it):


WMicaliaslist.png

Wednesday, November 29, 2017

Does PowerShell work with XML?

XML is stored as a string in PowerShell. Hence it can work with XML.

For example I have a XML document such as this one:

http://hodentek.blogspot.com/2007/07/simple-xml-file-aka-my-hello-world-for.html
-----------------


Review image 

-------------
How do I use this XML document?

Just assign this string to a PowerShell string variable as shown:(note the XML formatting has been changed slightly)
-------------

What is OWIN? How does it relate to Web?

.NET is Microsoft Specific which is also featuring in some Open source projects. Believe me it is true, read here:

https://opensource.com/business/14/11/microsoft-dot-net-empower-open-source-communities

'Microsoft is providing the full .NET server stack in open source, including ASP.NET, the compiler, the .NET Core Runtime, Framework and libraries, enbaling devvelopers to build with .NET across Windows, Mac or Linux'.

This is old story, since 2004 the 'mono project' was a open source implementation of .NET platform.

Now coming to OWIN, which is short for Open Web Interface for .NET OWIN) defines a standard interface between .NET web servers and web applications.

You can find everything you want to know about OWIN here at this master site.
http://owin.org/

These are some of OWIN compatible projects:
Servers and Hosts
    Katana
    Nowin
    Suave
Frameworks
    Jasper
    Nancy
    SignalR
    WebApi
    WebSharper
    DuoVia.Http
    Simplify.Web
    Wisej
Implementations
    Katana
    Freya
    ASP.NET vNext

Microsoft uses OWIN for building ASP.NET Single-Page applications and several of the assemblies used are OWIN based as shown here:



MicrosoftOwinAssmeblies.png

Monday, November 27, 2017

What are the differences for Sparklines in Microsoft Excel and in R?

These are the sparkline related functions in R:
newSparkLine()
newSparkBar()
newSparkBox()
newSparkHist()
newSparkTable()

You could get access to sparkLines in R using the package "sparkTable"
You may need to get the Package from a CRAN Site.

These functions are used with plot(). If the method export() is used then they are saved as mini-plots in png,eps and pdf.

The Spark lines in MS Excel are:


SparkLine_00

SparkLine_01

Excel Sparklines

It is straightforward to use in Excel as long as you have the data as in the posts.
http://hodentekhelp.blogspot.com/2017/06/how-do-you-create-sparklines-in-excel.html
http://hodentekhelp.blogspot.com/2017/06/how-does-winloss-sparkline-work.html

Examples (graphic) of Sparkline(), Sparkbar() and


R Reference for SparkTable()
https://cran.r-project.org/web/packages/sparkTable/sparkTable.pdf
R has a larger option with sparklines than Microsoft Excel.

Sunday, November 26, 2017

What is WMI?

Windows Management Instrumentation(WMI) allows you to use API calls to control systems and services on Microsoft Windows 10 (also from Windows XP) through models Win32_LogicalDisk and Win32_Process. You can use WMI to control local and remote machines. WMI is available for all Windows' versions.

Some of the tasks that you can undertake with WMI are,

Start a process on a remote computer.
Schedule a process to run at specific times on specific days.
Reboot a computer remotely.
Get a list of applications installed on a local or remote computer.
Query the Windows event logs on a local or remote computer or multiple computers with a single command.

You access  WMI locally and remotely using the interactive command WMIC in command-line as follows:
----------
C:\>wmic
wmic:root\cli>
-----------
Now you can see what WMI is about using the help flag /? as follows:
----------
wmic:root\cli> /?
[global switches]
The following global switches are available:
/NAMESPACE           Path for the namespace the alias operate against.
/ROLE                Path for the role containing the alias definitions.
/NODE                Servers the alias will operate against.
/IMPLEVEL            Client impersonation level.
/AUTHLEVEL           Client authentication level.
/LOCALE              Language id the client should use.
/PRIVILEGES          Enable or disable all privileges.
/TRACE               Outputs debugging information to stderr.
/RECORD              Logs all input commands and output.
/INTERACTIVE         Sets or resets the interactive mode.
/FAILFAST            Sets or resets the FailFast mode.
/USER                User to be used during the session.
/PASSWORD            Password to be used for session login.
/OUTPUT              Specifies the mode for output redirection.
/APPEND              Specifies the mode for output redirection.
/AGGREGATE           Sets or resets aggregate mode.
/AUTHORITY           Specifies the for the connection.
/?[:]    Usage information.

For more information on a specific global switch, type: switch-name /?

The following alias/es are available in the current role:
ALIAS                    - Access to the aliases available on the local system
Press any key to continue, or press the ESCAPE key to stop

----------
Refer to this source for more information:
https://msdn.microsoft.com/en-us/library/aa384642(v=vs.85).aspx

Friday, November 24, 2017

What happenned to my restore points in Windows 10?

They disappeared because there was an automatic update of the operating system.

One creates system restore points to go back in case there is a problem. Typically when you encounter some rpoblem you would want to go back to a restore point you have created. The restore point would still be available to you were it not for the automatic Windows Updates.

It would be nice if there is a way of having OS on one drive that does not update (so restore points are available) and OS on the other that can update and install the better(?) code.

Wednesday, November 22, 2017

Do more tabs means more memory usage in Chrome?

I think the more tabs you open in any browser the more memory is used, not particularly Chrome.
Chrome has a task manager of its open which you can open from a Chrome browser.


You just bring up this Task Manager and watch the Task Manager as you open in new tabs. Here are some pictures for you to see. There are no extensions right now, just the browser. Start with just the browser and go on adding tabs.











Windows 10 Insider build related errors

I am in the Windows 10 Insider program and I have noticed some 'bizzare' displays quite unexplicable. I believe they manifest whenever there is some kind of attack from an external site.
These appear to manifest during such an attack. I have felt that the computer has slowed down and the Windows Explorer has lost some control.

Sometimes they go away if you empty past history, cookies, etc.

Look at what happens when I do a right click on desktop.

Insider Problem.png

This should have been this:


Look at the contextual menu of a desktop folder.


InsiderProblem2

Instead of this:

Look at this empty content.

More importantly I strongly believe that my Report Builder UI related errors are because of the Insider Build.

https://hodentekmsss.blogspot.com/2017/11/report-builder-3-has-ui-problems-that.html

Tuesday, November 21, 2017

What is the latest Windows 10 release version?

If you work with Windows 10 you better know what version you are using. Additionally, if you are in the Windows Insider program you better know the build you are using.

Windows OS updates are automatic. The Insider builds may interfere with your other programs. I noticed it accidentally and could not make something work which worked like a clock earlier.

https://hodentekmsss.blogspot.com/2017/11/report-builder-3-has-ui-problems-that.html

The Windows 10 release information my be found here:
https://technet.microsoft.com/en-us/windows/release-info.aspx

Here it is all tabulated:



Windows 10 Versions.png

Friday, November 17, 2017

Can you create a subscription in SQL Server Reporting Services to deliver to Public folder?

Public folder is shared by all the users of a computer and you should have no problem creating a subscription to deliver to the Public folder. Provide the UNC path to the folder.

Here is a subscription.


This subscription delivered a report to the Public folder.

What is a Public folder on Windows 10?

This is a very useful feature if you want to share files with other users of the computer. If your computer has others users you should be aware of the existence of this feature. Public folder is therefore available to all users, a shared folder. any user who can log into the computer can access the Public folder without any other permission. If you and your users are working on a common document then it is easy to colloboratively work on the document using the Public folder by moving the document to the folder.

You can find Public folder here (C:\Users\) :

PublicFolder_00


The folder contents are as shown. Foxit Software is not one of the defaults, the others are and to begin with they are all empty. You move related files that your other users can access.


PublicFolder_01


These are the visible items and there are few hidden ones.

In the folder's View menu, place check mark on Hiddem items as shown.


PublicFolder_02


The folders Libraries and Public Account Pictures are the hidden items. The Public Desktop folder, also hidden contains applications that are shared. Usually the installed software asks at installation time whether you want the app shared and if you have clicked YES, you will find them here as in my case.


PublicFolder_03

From the properties of this folder you can make changes to the security and access advanced properties as well.

Thursday, November 16, 2017

Do you need a CIO or a CEO? What is CDO or WhoIs CDO?

What we more importantly need is a CDO.

CDO is Chief Data officer(DBA in disguise?) who can mesmerize your customers with the infinite possibilities of data analytics.

Well, you also need a CAO, the Chief Analytics Officer.

Here is a play on the anagrams from Gannet.


Friday, November 10, 2017

What is XMLNotepad and where do you get it?

XMLNotepad is a Microsoft tool, an XML editor. You can easily open an XML documents using this tool. It is very useful and very informative.

You can get the latest version from the Codeplex site here:

Go to this link.
https://xmlnotepad.codeplex.com/

Click on downloadable installer.
This will take you to the site where you can download the Microsoft XML Notepad.


XMLNotepad2_7.jpg

This application requires .NET 4.0. If it is not available in your computer (look inside Programs and features in Control panel). If you do not have this, you can download and install from here:

https://www.microsoft.com/en-us/download/confirmation.aspx?id=17851

Click on Microsoft XML Notepad which brings up the following:




 XMLNotepad2-7_1.jpg

Click Install. It will install directly from a server on the internet and you may see this window.


XMLNotepad2-7_2.jpg


After a while the application gets downloaded and you should see in your All Programs as shown



XMLNotepad2-7_5.jpg

You can get the user interface of this application by clicking the shortcut in the above.



XMLNotepad2-7_4.jpg

Enjoy!