Monday, August 21, 2017

What is Samsung Dex?

It is more correct to call it Samsung Dex Station (hardware) that pairs with Samsung's Galaxy S8 phone to provide you a real desktop experience that you always wanted.

Hear what VMware calls this:
"Samsung DeX redefines what a smartphone can do to keep mobile workers productive with just their smartphones."

Your Samsung Desktop would consist of a computer monitor, keyboard, mouse, Samsung Galaxy S8 and the Dex Station.
Review the below image:

As you can see in the above image, Microsoft is there with all its Office 365 products.  Microsoft's dream of entering the mobile world may still be realized although Windows Phone is near extinction.
Microsoft has played a smart hand in going with Samsung on this.

Looks like Google Drive is still accessible and there are still few more programs(Hancom Office, Citrix Receiver and VMware Horizon Client).

Hancom Office consists of Hanword (a.k.a. Hangul, hwp), Hancell (Spreadsheet), and Hanshow (Presentation program).

Citrix Receiver is a suite of products that allow client devices to connect to various desktop virtualization services offered by Citrix.

VMware Horizon:
VMware Horizon delivers true Windows desktop and applications computing experience on Samsung Galaxy S8 through the VMware digital workspace and Samsung Desktop Experience (DeX)

Sunday, August 20, 2017

How do you decrypt encrypted cypher?

We saw in the previous post how to encrypt using the EncryptByPassPhrase() function.

We will use the same encrypted text and decrypt it using the same PassPhrase used to create it.

We use the reverse function DecryptByPassPhrase() which takes two arguments, the first is the PassPhrase and the second is the encrypted value (cyphertext). The PassPhrase generates the key for decryption.


Saturday, August 19, 2017

How do you navigate between pages in a Single Page Application?

Here we are working with a Angular JS application.

Actually there are no 'Pages' in a Single Page Application (SAP) but no problem. If you are familiar with anchor tags in HTML, you could follow it with the help of the SRC's in your script that will help updating the page dynamically calling up the routing in AngularJS.

These are two important script references that you should add to your SPA:<script src=""></script><br /><script src=""></script> 
This is an important module that makes routing possible:

ngRoute module provides the routing and deep linking services and directives for a Angular JS applications.

You should read the documentation which gets clearer when you do an example.

ngRoute teams up with ngView directive to render the partial views.

"ngView is a directive that complements the $route service by including the rendered template of the current route into the main layout (index.html) file. Every time the current route changes, the included view changes with it according to the configuration of the $route service."

Here is an example of a SPA hosted on my localhost (the file below is placed in the wwwroot directory of  C:\inetpub

<!DOCTYPE html>
<script src=""></script>
<script src=""></script>

<body ng-app="HtekApp">
<p><a href="#/!">Welcome to Hodentek</a></p>

<a href="#!SSIS">SSIS </a>
<a href="#!SSRS">SSRS</a>
<a href="#!Azure">Azure SQL</a>

<div ng-view></div>

var app = angular.module("HtekApp", ["ngRoute"]);
app.config(function($routeProvider) {
    .when("/", {
        template : "Click on the link to see the contents"
    .when("/SSIS", {
        template : "<h1>SQL Server Integration Serivces 2005"
    .when("/SSRS", {
        template: "<h1>SQL Server Reporting Services</h1><h2>SSRS 2008: ISBN: </h2><h2>SSRS 2012: ISBN</h2>"
    .when("/Azure", {
        template: "<h1>Microsoft SQL Azure Enterprise Application Development</h1>"


The page renderings of the links are as shown:

Monday, August 14, 2017

Is SVG a part of HTML5?

SVG is variously described as  'part of HTML5 specification' or an HTML5 extension. In either case, I am very happy as I am a fan of SVG.

In HTML documents you could embed an in-line SVG code.
SVG in some cases appear superior to Canvas in HTML. SVG creates prefabricated graphics that is part of the documnet model which can be accessed by the ID for any event based action, where as the graphics for use in CANVAS needs to be created and rendered during page loading.

Read my SVG related posts here:

Saturday, August 12, 2017

How do you enable database mail in SQL Server 2016?

For security reasons this feature is turned off and you must enable it.

In a newly installed server if you run stored procedure in the context of msdb

EXEC sp_send_dbmail

You get the following message:

'Msg 15281, Level 16, State 1, Procedure sp_send_dbmail, Line 0 [Batch Start Line 9]
SQL Server blocked access to procedure 'dbo.sp_send_dbmail' of component 'Database Mail XPs'
because this component is turned off as part of the security configuration for this server.
A system administrator can enable the use of 'Database Mail XPs' by using sp_configure.
For more information about enabling 'Database Mail XPs', search for 'Database Mail XPs' in
SQL Server Books Online.


This is how you enable Database Mail extended Procedure:
sp_configure 'show advanced options', 1;
sp_configure 'Database Mail XPs', 1;



Now run this statement.

EXECUTE msdb.dbo.sysmail_help_status_sp

You get this response:


You will find the dbo.sp_send_dbmail stored procedure in the msdb database.


You will find all these objects in the msdb database in the Stored Procedures and Views nodes.


Thursday, August 10, 2017

How do I keep my email addresses and passwords encrypted using SQL Server?

You could keep your email addresses and passwords in SQL Server database table. You could get a free copy of your SQL Server from a Microsoft download site.

While the email addresses can be kept un-encrypted, you may want to keep your passwords in an encrypted column of a table. If want to keep everything encrypted you can do it also.

With this table set up correctly you may need to remember just one phrase which can be of your choosing.

Here are steps to create such a table:

1. Create a table in one of your existing databases. I am creating this table in a database called 'Aloha' which I use for teaching.

Here is the statement to create the table:

USE Aloha
Create Table Encrpt(
emailID int Primary Key not null,
emailAdd nvarchar(25) null,
emailPswd varbinary(250) null

This creates the table ENCRPT.

The email password (emailPswd) is stored in a special column(varbinary data type) as shown above.

Now keep a list of emails and the passwords ready to populate the table.

Populate the table you created by inserting values using the following code:

INSERT INTO ENCRPT(emailID, EmailAdd, emailPswd)
values (1, '', EncryptByPassPhrase('Happy birthday to you','xyzpo')),
(2, '',EncryptByPassPhrase('Happy birthday to you ','ZZZ12$' )),
(3, '',EncryptByPassPhrase('Happy birthday to you','$$$11X' ))

I have inserted only three values but you could add more. While the email addresses shown are my real addresses, the passwords are not.

Now when you run a SELECT statement to display all the columns, this is what you see.

Here is a screen shot of all code:

I have used the same PassPhrase for all data, you could have different on, the onus of remembering phrases is on you.

The fourth row was filled using a different PassPhrase ('Happy Anniversary).
Read more here:

Tuesday, August 8, 2017

How do you launch Excel from SQL Server Management Studio?

I am using SQL Server Management Studio Version 17.1. You may user another version.

Launch SSMS 17.1

Click Tools | External Tools...

External Tools window is displayed as shown.

Replace the Title with a name of your own, herein Excel Application. The menu contents also
changes to the one you provided, herein Excel Application.

You need to provide the location of the executable in the Command box. In the present case the
executable is here:

"C:\Program Files (x86)\Microsoft Office\root\Office16\EXCEL.EXE"

Now you External Tools window should appear as shown.

Click OK.

Now you will find 'Excel Application' as shown in the Tools menu.

Now when you click this menu item, Excel Application is launched.

Tuesday, August 1, 2017

What is the difference between dbo and db_owner?

This question pops up now and then.

dbo is a user and db_owner is a database role. They both are in the Security node in the Object Browser. The SQL Server Management Studio (SSMS) makes it abundantly clear.





It will be instructive to review their properties as shown here.

dbo - Properties


db_owner - Properties


Saturday, July 29, 2017

What is two digit year cutoff in SQL Server?

Remember the millenium bug fiasco. It happenned in Year 2000.
This is what chronicled in Wikipedia:

"The Year 2000 problem is also known as the Y2K problem, the Millennium bug, the Y2K bug, or Y2K. Problems resulted because people, including programmers, reduced the four-digit year to two digits. This made the year 2000 indistinguishable from 1900"

Now we have a better interpretation for people using two digit years as far as SQL Server is concerned.

The default time span for SQL Server is 1950-2049.

Two-digit year 49 is 2049, but two digit year 50 is back to 1950.

Probably you will start seeing it in your credit cards (may be?)

You may configure it in SQL Server 2017 using,

Exec Sp_Configure 'two digit year cutoff', 2038

In SQL Server 2012 Express it is enabled by default:

Read more here:

What is mssql-scripter?

In your SSMS on your computer you can use the Generate Scripts drop-down
menu to create scripts for database objects as shown here for Northwind database on SQL Server 2016 SP1.

However, the above is for SQL Server on Windows Platform. However, mssql-scripter tool provide the same functionality as Generate Scripts wizard on SQL Servers on Linux and macOS. Of course mssql-scripter would work on Windows as well.

Using mssql-scripter based on Python you can generate T-SQL scripts for objects on SQL Servers, Azure SQL database and Azure SQL Data Warehouse.

The generated script is saved to a .sql file or, on Linux can be piped to standard Unix utilities (sed, awk and grep ). The scripts can be checked into source control systems as well.

The source code for mssq-scripter is found here:

Thursday, July 27, 2017

Usage Modulo: How many hours and minutes are there in so many minutes?

x%y is defined as the remainder of the division x/y. You can use modulo to find the minutes and hours in so many minutes.

Let us say we have a cconversion exercise to convert 123490 minutes into minutes and hours.
By long hand we would do this:

123490/60 and find the remainder
We get 2058.1666666667 with 0.1666666667 hours converts to 10
That is 2058 hours and 10 minutes.

We can do the same using modulo as shown.


You can use a much shorter code as shown here: (note input data has changed to 1234901)

Sunday, July 23, 2017

How does the string function STRING_SPLIT() work?

When compared to an earlier version, SQL Server 2016 has two new string functions shown in the next image.


The syntax for the new function:
STRING_SPLIT ( string , separator )

Let us take this string:

'quote, substring, toLowerCase, toUpperCase, charAt,
      charCodeAt, indexOf, lastIndexOf'

Now write the following code in the query pane of SQL Server 2016 as shown. When the query is evaluated we see that the string is split at the comma (,) as shown. The white spaces are preserved.

How to test a comparison operator in an SQL Query?

Let us say we want to know if a variable x is greater or less than another variable y. How do we write a query to test it?

One way to do this is as follows:

declare @x int
set @x=5
declare @y int
set @y=10
    IF @x < @y
 print 1
 print 0

Saturday, July 22, 2017

Why did YouTube disappear from my Samsung Smart TV?

This happenned on our Samsung Model UN46F7500AF Smart TV purchased in 2013 but the Model began selling in 2012. Speaking to the Samsung support team in USA gives me the feeling that YouTube created a new platform and that the older TV (Prior to 2012) does not support the new YouTube platform.

I will have to pursue this matter with YouTube site for confirmation.

In Summary, the reason YouTube disappeared is not because of Samsung, but because of YouTube's changes.

Monday, July 17, 2017

What is a Single Page Application?

It is exactly what it says. Single Page Applications (SPAs) are web applications with a single web page that uses AJAX for its dynamic interactions. As page refresh is on the client side the SPAs can have downside of performance degradation if they are not properly designed and SEO optimized.

There are many JavaScript frameworks to write SPAs. There are lots of JavaScript frameworks that you can use to build SPAs. Lots of them are Open Source. Here are some:


I hear a lot about Angular and Aurelia, perhaps more people are using them.
Intel XDK had both Angular and Backbone templates, but they are not supporting them anymore.

AngularJS is in Version 2.

I have a large number of posts on Intel XDK here.

Sunday, July 16, 2017

How do you restore a database from its backup?

A backup of Northwind database was obtained from the Codeplex site and was saved to one of the folders on a Dell computer with Windows 10 OS. The computer also has SQL Server Management Studio (v 17.1). You should be able to restore using the SQL Server Management Studio installed when you installed the SQL Server 2012 Database engine.

Follow these steps to restore the Northwind database to an instance of SQL Server 2012 (x86) installed on the same computer.

Step 1. Start SQL Server Management Studio v17.1 (Run as administrator)

The SSMS is version 17.1 and Hodentek9\PCATT is a SQL Server 2012 Express

Step 2. Right click the Databases node highlighted in the PCATT isntnace as shown.


Step 3: Click Restore Database...

Restore Database window is displayed as shown.


Step 4: The Default Source is Database and it is greyed out as shown. Chnage it to Device. The Restore Database gets changed as shown.


Step 5: Click the ellipsis button along 'Device' in the above image.

Select backup devices window shows on top of Restore Database window as shown.


Step 6: Click Add button in Select backup devices window.
Locate Backup File window gets displayed as shown.


Usually the 'backup files with extension .bak' are found in the following directory in the case of x32 bit SQL Server.
C:\Program Files (x86)\Microsoft SQL Server\MSSQL11.PCATT\MSSQL\Backup

However, for this exercise it is stored in a different location.

Step 7: Now browse to that location and highlight the Northwind.bak (A backup file which came from a Microsoft site) as shown.


Step 8: Click OK. The file path is entered in the Select backup devices window as shown.


Step 9: Click OK
You are returned to the Restore Database - Northwind as shown.


Step 10: Click OK in the above.

Microsoft SQL Server Managment Studio message reports that the database
'Northwind' restored successfully.


Step 11: Click OK to the message. Verify that Northwind database is in the SQL Server 2012 instance Hodentek9\PCATT



Thursday, July 13, 2017

What is Dynamic Data Masking?

The title is quite revealing, is it not?

Dynamic Data Masking which is available in SQL Server 2016 allows you provide another level of security to your data, by masking data that you do not want unauthorized (by policies) users to peek into. Data in the database itself is unchanged. SQL Server 2016 has other security features besides dynamic data masking.

This is a nice feature that you should implement if are dealing with sensitive information (Credit card numbers, Social Security Numbers, etc).

Here is an image of credit card numbers being masked

Credit card masking imaged source:

Read here about masking using JavaScript:

Do you need special permission to create a table with a dynamic data mask?

No, you do not. Of course you need standard permissions like Create table, Alter on schema permissions.

The Alter Any Mask permission and Alter permission on  a Table are needed, though.

Read more about Dynamic Data Masking here:

Wednesday, July 12, 2017

How to handle this Power Shell error, "Set-Location: a Positional parameter..."?

Power Shell does not like white spaces. While it may like or .  I got stumped for while as I started getting this exception.

The trick to do this changing directory is to use double quotes around words with white spaces as shown here.

I have Power Shell 5.0 on my Windows 10 Pro OS.

What is Microsoft Graph?

Microsoft SQL Server is for accessing data and Microsoft Graph is to access the myriad of things that are not really part of the database. The things that spring to the mind are things like, emails; your devices; the teams you work with; calendars; files; messages, peoples etc..

Also read this post on Graph databases:

A quick look at this image shows how Microsoft Graph is positioned.

Well, what is it Microsoft Graph good for?

Believe me, you indeed have a great deal of use for it. Allow me to quote Microsoft:

'Looks at your next meeting and helps you prepare for it by providing profile information for attendees, including their job titles and who they work with, as well as information on the latest documents and projects they're working on (pro-active, do diligence).

Scans your calendar, and suggests the best times for the next team meeting.

Fetches the latest sales projection chart from an Excel file in your OneDrive and lets you update the forecast in real time, all from your phone.

Subscribes to changes in your calendar, sends you an alert when you’re spending too much time in meetings, and provides recommendations for the ones you could miss or delegate based on how relevant the attendees are to you.

Helps you sort out personal and work information on your phone; for example, by categorizing pictures that should go to your personal OneDrive and business receipts that should go to your OneDrive for Business.
Behind Microsoft Graph is the Microsoft Graph API; a RESTful web api that enables you to access Microsoft Cloud serivce resources.

Come back to this blog again for more on Microsoft Graph.

Thursday, July 6, 2017

Can you install SQL Server Express (x86) on Windows 10 (x64 bit)?

The short answer is YES.

A x32 bit SQL Server Express Advanced and a x64 bit SQL Server 2016 SP1 are both installed on a Dell Inspiron laptop.

Here are the responses to the command:

SELECT @@version in a query launched by both of these versions:

(No column name)
Microsoft SQL Server 2012 - 11.0.2100.60 (Intel X86)   Feb 10 2012 19:13:17   Copyright (c) Microsoft Corporation  Express Edition on Windows NT 6.2 (Build 9200: ) (WOW64)

(No column name)
Microsoft SQL Server 2016 (SP1-GDR) (KB3210089) - 13.0.4202.2 (X64)   Dec 13 2016 05:22:44   Copyright (c) Microsoft Corporation  Developer Edition (64-bit) on Windows 10 Pro 6.3 (Build 15063: )

They can co-exist as shown:

Friday, June 30, 2017

What do you mean by 'Comprehension' in JavaScript?

Comprehension(s) list(array) is used in many computer languages. What it does is it takes an array and modifies it  to create a new list(array) based on some modifier.

For example if you have a list like this: [ 1,2,3 ],
you can create a new list with each element of list replaced by itself multiplied 3 times like in Example 1

In the second example from Mozilla site, you take an array of lower case letters and use the Javascript string operatory 'toUpper()' to generate a new array with letters of each element capitalized.

Read here:

These were tested to work in Mozilla Firefox (I believe it is version 54). However it does not work in Microsoft Edge. I believe these are still being tested for future version of ECMA script according to the Mozilla Developer site.

Where is Video Manager in YouTube?

I see this question being asked often and in fact I could not find the Video Manager quick enough to do some task. Video Manager is needed to make changes to your video's title, description, etc.

This is an easy way  to find the Video Manager:
None of the menus in this image will take you to Video Manager when you access your account.

Just click Creator Studio button to display the items that you can access as shown. Here you find an item to navigate to the Video Manager as shown.

Thursday, June 29, 2017

How do you format a chart in Power BI?

Customers are used to eye candy as most of social media strive to provide. While working with data it is not just eye-candy effects that are the driving force for visualization but controls available to bring out the features of data like its value representation; what it represents; relative magnitiudes; values of each piece of data, etc. Power BI can do a lot of this with simple choices. It is pretty find grained.

Take for example this mundane bar chart of some values in a chart of two axes. It shows a 'bar graph' and the default formatting if any are barely visible.


The formatting icon is where you click and start.


Right now only X-axis, Y-axis and Title are turned all on but you can hardly see any details. Using the drop-down you can control the Data colors; Data labels, background, border and lock aspect (locking the aspect ratio of the chart).

Presently the default color of all the six X-axis values are 'Green'.


However you can individually color them if there is a need. For this you need to turn on 'Show all'.


This image shows each data with a different color. You cal also go to default if you do not like. These changes in formatting renders the visualization as shown which is immediate.


You can also change the title which is barely visible clicking on 'Title' .


These changes in formatting renders the visualization as shown which is immediate.


You can turn on the Data lables turning 'Off' to 'On' by pulling the slider to right.
You will notice that the letters are too small to read (see above image).


You can work all the controls under Data Labels and make it look better as shown. If you click X-Axis or Y-axis then you can modify the formatting as swell.


If you have a saved image or logo or any background image you can add as shown and set its transparency as shown.

Similarly you can set the backgorund color and its tranpareancy as well.


In the 'General' section you can set the settings shown.