Thursday, August 31, 2017

Where is the link to TypeScript 2.5?


TypeScript 2.5 (the latest) is now available for download here:

http://www.typescriptlang.org/#download-links



TypeScript2.5_0

If you have installed npm, installing TypeScript is a breeze.

> npm install -g typescript

Read here for installing npm:

http://hodentekhelp.blogspot.com/2017/08/what-is-npm-and-how-is-it-useful.html

Can I access my local web server(IIS)from my smart phone?

As long as the local web server (IIS) is working and you can browse a file on the server from your browser you should be able to browse the same file on your smart phone provided you access the IP Address of your computer hosting the IIS.
You can find the iPv4 address of your computer by using the ipconfig command :
------
C:\Users\Owner>ipconfig
Windows IP Configuration
Ethernet adapter Ethernet:
   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
Wireless LAN adapter Local Area Connection* 1:
....
....
....
Wireless LAN adapter Wi-Fi:

   IPv4 Address. . . . . . . . . . . : 192.168.0.10
-------------------
Here is a partial view of my default site showing the content SVGCode.html, an interactive HTML5 page:


This is how it appears on a Microsoft Edge 15 browser:

This how it is called on my Microsoft Lumia 950 phone using the IP Address:
Note:  Although I entered the IP Address, the phone translated it to the computer name.

If it does not get displayed check the firewall and make sure this item is checked:

The computer was a Dell Laptop running Windows 10 Professional and the smart phone was a Microsoft Lumia 950 both on the same Wi-Fi network.

Tuesday, August 29, 2017

Does your browser support localStorage?

If your browser supports HTML5 then your browser supports local storage. The image below is for Microsoft Edge 15.


You can also view this HTML file (TodaysDate.html) below on your local IIS.

<!DOCTYPE html>
<html>
<body>

<div id="result"></div>

<script>
// Check browser support
if (typeof(Storage) !== "undefined") {
    // Store
    localStorage.setItem("Today", Date());
    // Retrieve
    document.getElementById("result").innerHTML = localStorage.getItem("Today");
} else {
    document.getElementById("result").innerHTML = "No browser support for localStorage";
}
</script>

</body>
</html>

If localStorage is supported then you should see the following (for today).

This also worked on IE 11 as well as Mozilla Firefox.




Sunday, August 27, 2017

How do you install Cordova Command-line Interface on a Windows 10 laptop?

You can use the Cordova command-line interface (CLI) to deploy JavaScript / HTML Cordova application to various native platforms.

Cordova CLI is distributed as an npm package and you need Node.js. You may download Node.JS from here:
https://nodejs.org/en/download/



NodeJs_08

Installing Node.JS installs npm. npm is the package manager for JavaScript and the world’s largest software registry. Read more about npm here:


http://hodentekhelp.blogspot.com/2017/08/what-is-npm-and-how-is-it-useful.html


I already had a slightly earlier version of Node.JS and I take off from there.

All I need to do now is to invoke npm to install cordova.

I do so by running this command:

---
C:\Windows\system32>npm install -g cordova
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
C:\Users\Owner\AppData\Roaming\npm\cordova -> C:\Users\Owner\AppData\Roaming\npm\node_modules\cordova\bin\cordova
C:\Users\Owner\AppData\Roaming\npm
`-- cordova@7.0.1
  +-- configstore@2.1.0
  | +-- dot-prop@3.0.0
  | | `-- is-obj@1.0.1
  | +-- graceful-fs@4.1.11
  | +-- mkdirp@0.5.1
  | | `-- minimist@0.0.8
  | +-- object-assign@4.1.1
  | +-- os-tmpdir@1.0.2
  | +-- osenv@0.1.4
  | | `-- os-homedir@1.0.2
  | +-- uuid@2.0.3
  | +-- write-file-atomic@1.3.4
.
.
.
.
 After a while it gets installed.

Testing  installed version of cordova

C:\Windows\system32>cordova --version
? May Cordova anonymously report usage statistics to improve the tool over time? Yes
Thanks for opting into telemetry to help us improve cordova.
7.0.1
C:\Windows\system32>

Now you have access to Cordova version 7.0.1 on your computer

Thursday, August 24, 2017

What is npm and how is it useful?

npm is the package manager for JavaScript and the world’s largest software registry. npm is distributed with Node.js- which means that when you download Node.js, you automatically get npm installed on your computer.

Test if you have installed Node.JS and npm. There are lots of versions of Node.JS and npm and be aware of the versions and their compatibility.


NodeNmpInstalled.png

npm registry has the largest(millions) number of packages of free, reusable code.
Depending on your needs you may choose one of these account types for using npm.


Node_NpmAccTypes

It provides an huge registry with many different programs like jQuery, AngularJS etc.

For exmple, if you are installing Cordova pacakge you can do so from command-line like in here;

 C:\>npm install -g cordova

The -g switch means globally, otherwise it will be installed in the node_modules subdirectory.

Here is how you run the help file for npm:


Node_npmHelp

npm master reference here:
https://www.npmjs.com/

Tuesday, August 22, 2017

How do you send mail using SQL Mail from SQL Server 2012 Express?

Database Mail in SQL Server Express 2012 does not have Database Mail feature built-into SQL Server Management as it does in Enterprise | Standard editions. Database Mail is also found in the Developers edition as seen in the next image.



However you can send Database mail using either CLR Integration or configure SQL Mail using the System Database, msdb

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.



MSSS2017\ENCRPTPSWD_04.pn

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="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script><br /><script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular-route.js"></script> 
This is an important module that makes routing possible:
ngRoute:

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:
"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>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular-route.js"></script>

<body ng-app="HtekApp">
<h1>HODENTEK BOOKS</h1>
<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>

<script>
var app = angular.module("HtekApp", ["ngRoute"]);
app.config(function($routeProvider) {
    $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>"
    });
});
</script>


</body>
</html>

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:

http://hodentekhelp.blogspot.com/2015/12/does-microsoft-edge-support-svg.html

http://hodentek.blogspot.com/2009/10/finally-svg-in-visual-studio.html

http://hodentek.blogspot.com/2010/09/svg-gets-rendered-on-ie-90.html

http://hodentek.blogspot.com/2013/08/short-of-cash-get-apache-openoffice-40.html

http://hodentek.blogspot.com/search?q=svg

http://hodentekmobile.blogspot.com/2016/03/intel-xdk-controls-2-usage-of-svg-and.html

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;
GO
RECONFIGURE;
GO
sp_configure 'Database Mail XPs', 1;
GO
RECONFIGURE
GO


---------------

----------

Now run this statement.

EXECUTE msdb.dbo.sysmail_help_status_sp

You get this response:


DatabaseMail_1.png

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


DatabaseMail_2.png

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


DatabaseMail_3.png




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
Go
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, 'hodentek@live.com', EncryptByPassPhrase('Happy birthday to you','xyzpo')),
(2, 'mysorian@gmail.com',EncryptByPassPhrase('Happy birthday to you ','ZZZ12$' )),
(3, 'htek@mysorian.com',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:

https://hodentekmsss.blogspot.com/2017/08/encrypting-email-password-in-sql-server.html

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.

dbo



dbo.png

db_owner

db_owner.png

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

dbo - Properties



dboProps.png

db_owner - Properties


db_ownerProps.png