Friday, July 31, 2015

What are variables in C++ and how do you declare them?

Please review this previous post before you dig into this post.

A variable is a portion of the memory to store a value very similar to your pigeon-hole in your mail office at work.


PigeonHole.png

This picture shows all mailboxes of same size, in C++ and other programming languages you have variables of different sizes and the above analogy has to be modified. The idea that a variable indicates the storage in memory is valid.

In order to declare a variable you need a name and type. The name can be anything other than the names reserved for its (C++ Program) use. You can find them in references (for example: http://cs.smu.ca/~porter/csc/ref/cpp_keywords.html).

The type however, depends on what the variable stands for, such as, is it an integer or a floating point; is it a single character or a bunch of characters; does it represent time in some fashion? etc.

Declaring variable that are integers

The following three lines declare three integers

int a;
int z;
int axc;


The following line declares 3 integers as well. Note that to declare in a single line all of them should be of the same type. This is a short hand for declaring more than one variable.

int result1, result2, result3;

Just declaring a variable is not enough, to work a program, you need to provide a value to the variable, that is called assigning a value.3

Assuming you declared variables as indicated earlier, now the following lines assign values to them:

a=6;
z=19;
axc=1500;


Once you have a bunch of varibales declared and assigned as above you can operate on them in various ways;

result1=a+z; //(this should produce the result 25
result2=axc/(a+z);//(this should produce the result 60)
result3=axc/100;// (this should produce 15)

Here the operators are + (add), and / (divided by)

Now this is all put inside a project called Variables_01 as shown using Visual Studio Express 2015 for Windows Desktop. Of course you can use any other program with C++ compiler.

I assume you reviewed the post mentioned earlier, if not go back and review.

You need to reference in your stdafx.h file as shown:
-----------------
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//

#pragma once
#include "targetver.h"
#include
#include
#include

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

Variables_01

Build and run this program, the result displayed as shown.

Variables_01_1
 

Tuesday, July 28, 2015

How do you create a C++ Windows Console Application in Visual Studio 2015?

In a recent post I described why you cannot use Visual Studio Express 2015 Community for developing C++ Windows Console Application.

You need Visual Studio Express 2015 for Windows Desktop to develop the C++ Windows Cosole application. Downloading and installing the same and the various templates that you can use are described here .

Launch Visual Studio Express 2015 for Windows Desktop (just VSDesktop in this post) from its shortcut.Click on New Project... to open the New Project window and expand the Visual C++ node as shown highlighting the Win32 Console Application. Change the name of the project to Console2015 and accept default directory for saving.

Console2015_01

Click on Win32 Console Application to display the Welcome wizard screen as shown.

Console2015_02

Click Next button at the bottom of screen to display the Win32 Applicaiton Wizard screen as shown.

Console2015_03

Accept all items on the above screen and click Finish.

 
The project window opens as shown with the Console255.cpp file on the left and the project folders/files in the Solution Explorer as shown. This should build without errors.
Console2015_04

Double click and view the stdafx.h file. Add the indicated (in red) '#include' files as shown as we are planning to use the console as well as 'string' variables.
----------------------
#include "targetver.h"
#include
#include
#include
#include

// TODO: reference additional headers your program
//requires here
----------------------
Open the Console2015.cpp by clicking the same in soltuion explorer.

Add the followind code to this file as shown. 'endl' adds an empty line to the output.
--------------------
#include "stdafx.h"

int main()
{
 std::string mystring = "Hello, from Waikiki";
 std::string mystring2 = "This is Jay";

 std::cout << mystring2;
 std::cout << std::endl;

 std::cout << mystring;
 std::cout << std::endl;
 return 0;


}

--------------------
From Main menu click Build | Build Solution. You should see the
following in the Build Outpt screen.
--------------------
1>------ Build started: Project: Console2015, Configuration: Debug
Win32 ------
1>  stdafx.cpp
1>  Console2015.cpp
1>  Console2015.vcxproj -> c:\users\jayaram\documents\visual studio

2015\Projects\Console2015\Debug\Console2015.exe
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped

==========
-------------------------
Hit Start without debugging (CTRL+F5) to run the program. The output
is displayed in the console as shown.

Console2015_06

By using the namespace designation the above code can be modified as
shown (stdafx.h stays uncchanged):
----------
// Console2015.cpp : Defines the
// entry point
// for the console application.
//

#include "stdafx.h"
using namespace std;

int main()
{
string mystring = "Hello, from Waikiki";
 string mystring2 = "This is Jay";

 cout << mystring2;
 cout << std::endl;

 cout << mystring;
 cout << std::endl;
 return 0;


}

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


 

Saturday, July 25, 2015

How do you create a C++ Console Application in Visual Studio 2013?

First of all get a copy of Visual Studio 2013 Community as described in the following posts.

http://hodentek.blogspot.com/2014/11/free-visual-studio-community-2013-for.html
http://hodentek.blogspot.com/2014/11/you-get-all-this-for-free-in-visual.html

Launch Visual Studio 2013 from its shortcut.


Console01

Click on New Project... to open the New Project window as shown.

 

Console02

Expand Visual C++ and under Win32 there are two templates as shown.

Console03

Change the name of the project from ConsoleApplicaiton1 to Testing and accept the default location and other items. Click OK.
Win32 Application Wizard opens to the Welcome window as shown. Read the readme.txt file.


Console04

Click Next.
The second page of the wizard (Application Settings)is displayed as shown.


Console05

Since you started with Windows Console application, the application type is already chosen-Console application. You can leave the other  options as they are. Click Finish.
The Project folders and files are created as shown in the left and Testing.cpp file is shown on the left. You can build the project and it will build as shown.


Console06
Include in the stdafx.h file which has only the following:
--------------
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//

#pragma once
#include "targetver.h"
#include
#include

#include
// TODO: reference additional headers your program requires here
--------------
Modify the Testing.cpp by replacing the existing code with the
following as shown in the next image.
int main()
{
 std::cout << "Hello Jay! ";
 std::cout << "I'm not a C++ programmer";

}
--------

Console07

Click Build in the main menu. Build is successful as shown.


Console08
 

Click Ctrl+F5 to run without debugging. The command window is displayed with the output of the program written to it as shown.


Console09

 

Tuesday, July 21, 2015

What is Zigbee and what is its importance to IOT?

Zigbee is an open global wireless protocol standard that addresses the needs of low-cost, low-power networks that connect IOT devices such as home automation; (automating functions like opening doors, garage openers, water sprinklers, etc.); environment control like temperature; controlling traffic; and other IOT devices and not just home automation. The range is around 10 to 100 meters and a Zigbee  network can support 1000's of end devices.
 

Technically speaking the Zigbee standard operates on IEEE 802.15.4 (physical and MAC layers)  physical radio specificaiton and operates in unlicensed bands 2.4GHZ, 900MHZ and 868 MHZ (http://www.rfwireless-world.com/Tutorials/Zigbee-frequency-bands-data-rates.html).

zigbee_OSI.jpg
The Zigbee protocol was been created and ratified by member companies belonging to the Zigbee alliance consisting of more than 300 leading semicondutor manufacturers; technology companies; service providers; and OEMS. You can find the member list here: http://www.zigbee.org/zigbeealliance/our-members/

Zigbee components:
  • Coordinator
  • Router
  • End device
The componets are connected in mesh or star. The coordinator which is installed first  as well as the routers which join the Zigbee network next are always up and the end  devices (bulbs, thermostats, etc.) that join later can stay up or down. The end devices are usually battery operated.


Zigbee_network.jpg

Here is an example of setting up a Zigbee network with a specific device. network.
http://www.solaredge.com/files/pdfs/se_application_zigbee_gateway.pdf

Zigbee being open stardard, the adoption will be slow and vendors add their own special tweaks. Xbee is a special kind of Zigbee manufatured by Digi International. Review this link for more info on Digi and IoT(www.digi.com).


 

Saturday, July 18, 2015

How do you create JSON data with Visual Studio?

You can create JSON formatted data using a text writer as it is really a text file specially
formatted and saved with the extension .json. JsonTextwriter is derived from System.IO assembly.

You can look at everything (properties, methods, etc.) in Newtonsoft.Json which you added to a
Visual Studio project in a previous post using the Object Browser in Visual Studio IDE (herein Visual Studio2013 Community edition.

Browse for Newtonsoft.Json in My Solution as shown in your Visual Studio IDE after displaying the Object Brower.

NewtonsoftNamespace.png

The first step is to create a C# (could be VB also, but here it is a simple console project)
Project and add reference to Newtonsoft.JSON as described in the previous post.

The following code taken from the Newtonsoft site was slightly altered to make it work in the
Visual Studio 2013 Community edition(free).

The original code is here:

Origcode.png

In order to build and run this code in Visual Studio you need to provide references to the various assemblies you will be including in the code. You will be using the various methods that Newtonsoft.Json provides which you can see in the object browser.

The code instantiates a String Builder to take the text writer's text (name and value) and build the Json formatted object.

In order to use String Builder you need to reference System.IO assembly and the result of running the code will be displayed in the Console as shown:

ConsoleDisplay.png

However if you want to display the result in the Debug Output window in Visual Studio IDE you need to do a couple of things:

1. You should add a reference to System.Diagnostics.Debug assembly.
    This may not be available in the default installation of Visual Studio 2013 but you should browse for it in the Window Phone related assemblies (this was where it was found)

2. In the project properties Application page you should change the output type from the default 'Console Application' to 'Windows Application'.

WindowsApplication.png

3. Add a line of code to display using System.diagnostics.debug.print()
Now build and run the program and you will display result in the debug output window as shown.

debugprint.png

Here is the code that was run to display the above.
----------------
using System;
using System.Collections.Generic;
using System. Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using System.IO;
using System.Diagnostics;


namespace JsonWrite

{
class Program
{
static void Main(string[] args)
{
StringBuilder sb=new StringBuilder();
StringWriter sw = new StringWriter(sb);
JsonWriter writer = new JsonTextWriter(sw);


writer.Formatting = Formatting.Indented;

writer.WriteStartObject();
writer.WritePropertyName("CPU");
writer.WriteValue("Intel");
writer.WritePropertyName("PSU");
writer.WriteValue("500W");
writer.WritePropertyName("Drives");
writer.WriteStartArray();
writer.WriteValue("DVD read/writer");
writer.WriteComment("(broken)");
writer.WriteValue("500 gigabyte hard drive");
writer.WriteValue("200 gigabype hard drive");
writer.WriteEnd();
writer.WriteEndObject();

Console.WriteLine(sb.ToString());
// Console.WriteLine(sb.ToString());
System.Diagnostics.Debug.Print(sb.ToString());
}

}
}



Thursday, July 16, 2015

How do you install JSON.NET?

The installation of JSON.net is very easy. There are three ways you can do it. When you hit the download button on this site you will see the details.

InstallJsonNet.png

Since I will be using the Visual Studio IDE. I will show how to install it by invoking the Packet Manager console.

Launch Visual Studio 2013 Community edition (this is a free version).

Create a new C# project with the name JsonRead. This creates the folder JsonRead in Solution Explorer and the C# file, JsonRead.cs as shown.

JsonRead.png

From Tools | NuGet Packet Manager click on the Packet Manager Console as shown.


PacketManagerConsole.png
The Packet Manager Console pane opens as shown. I have already added the package Newtonsoft.Net package to another project called JsonWrite,

PacketManagerConsolePane.png

Type in the following at the PM> prompt as shown

PM>Install-package Newtonsoft.Json
Json.Net gets added to the project JsonRead as shown in the Solution Explorer

JsonNetAdded.png

Newtonsoft.Net gets added to the project as shown.


JsonReadwithJsonNet.png
 

Wednesday, July 15, 2015

When do you use JSON.Net?

JSON is JavaScript Object Notation. You can read all about JSON by reviewing the following:

What is JSON?:
http://hodentekhelp.blogspot.com/2009/02/what-is-json.html

Working with JSON:
http://hodentekhelp.blogspot.com/2014/11/how-do-you-work-with-javascript-object.html

SQL response in JSON:
http://hodentekhelp.blogspot.com/2015/05/how-do-you-obtain-json-formatted.html

Let us take this fruit (object) which has,
Name="Apple"
fruit should be used before (Expiry)=12/28/2008
Sizes=small, big, extra large

This object can be represented it in JSON as:
{
"Name": "Apple",
"Expiry": "2008-12-28T00:00:00",
"Sizes": [
    "Small"
  ]
 }

JSON.NET is a high-performance JSON Framework for .NET.

You can read all about JSON.NET here.

The benefits of using JSON.NET are the following (quoted from the above site):

  • Flexible JSON serializer for converting between .NET objects and JSON
  • LINQ to JSON for manually reading and writing JSON
  • High performance: faster than .NET's built-in JSON serializers
  • Write indented, easy-to-read JSON
  • Convert JSON to and from XML
  • Supports .NET 2, .NET 3.5, .NET 4, .NET 4.5, Silverlight, Windows Phone and Windows 8 Store
 In order to use it in your .NET project you need to add a reference to NewtonSoft.JSON

Tuesday, July 14, 2015

How to navigate to an URL in Internet Explorer using powershell?

To navigate to an URL use the New-Object definition as in the following: (in this case http://www.bing.com/news):
PS C:\Users\Jayaram> $ie = New-Object -com InternetExplorer.Application
$ie.visible=$true
$ie.navigate("http://www.bing.com/news")

You get to display the following (contents will be different):


BingNews.png

Can you change the size of the window?

Yes, you can change as shown by adding attributes.


Bing_news4to3PS.png

When you run the above in Windows PowerShell you get to display a different sized window:
 


Bing_news4to3.png

These are supported for the Internet COM Object in PowerShell:

 

How many powershell modules should I have on my computer?


It depends on what version of Windows you have on your computer (the version of Powershell).

On my windows 8.1 computer, I can get the version of powershell by running this code in powershell:
--------------
PS C:\Users\Jayaram> Get-host


Name             : Windows PowerShell ISE Host
Version          : 4.0
InstanceId       : 88471f59-d3a1-4cfe-8293-717336f8bdde
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-US
CurrentUICulture : en-US
PrivateData      : Microsoft.PowerShell.Host.ISE.ISEOptions
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace
-------------------
The number of modules and their listing can be obtained by the following:
-------------------------
PS C:\Users\Jayaram> Get-module -ListAvailable


    Directory: C:\Windows\system32\WindowsPowerShell\v1.0\Modules


ModuleType Version    Name                                ExportedCommands                                                                    
---------- -------    ----                                ----------------                                                                    
Manifest   1.0.0.0    ActiveDirectory                     {Add-ADCentralAccessPolicyMember, Add-ADComputerServiceAccount, Add-ADDomainContro...
Manifest   1.0.0.0    AppBackgroundTask                   {Disable-AppBackgroundTaskDiagnosticLog, Enable-AppBackgroundTaskDiagnosticLog, Se...
Manifest   2.0.0.0    AppLocker                           {Get-AppLockerFileInformation, Get-AppLockerPolicy, New-AppLockerPolicy, Set-AppLo...
Manifest   2.0.0.0    Appx                                {Add-AppxPackage, Get-AppxPackage, Get-AppxPackageManifest, Remove-AppxPackage...}  
Script     1.0.0.0    AssignedAccess                      {Clear-AssignedAccess, Get-AssignedAccess, Set-AssignedAccess}                      
Manifest   1.0        BestPractices                       {Get-BpaModel, Get-BpaResult, Invoke-BpaModel, Set-BpaResult}                       
Manifest   1.0.0.0    BitLocker                           {Unlock-BitLocker, Suspend-BitLocker, Resume-BitLocker, Remove-BitLockerKeyProtect...
Manifest   1.0.0.0    BitsTransfer                        {Add-BitsFile, Complete-BitsTransfer, Get-BitsTransfer, Remove-BitsTransfer...}     
Manifest   1.0.0.0    BranchCache                         {Add-BCDataCacheExtension, Clear-BCCache, Disable-BC, Disable-BCDowngrading...}     
Manifest   1.0.0.0    CimCmdlets                          {Get-CimAssociatedInstance, Get-CimClass, Get-CimInstance, Get-CimSession...}       
Binary     2.0.0.0    ClusterAwareUpdating                {Get-CauPlugin, Register-CauPlugin, Unregister-CauPlugin, Invoke-CauScan...}        
Manifest   1.0        Defender                            {Get-MpPreference, Set-MpPreference, Add-MpPreference, Remove-MpPreference...}      
Manifest   1.0        DFSN                                {Get-DfsnRoot, Remove-DfsnRoot, Set-DfsnRoot, New-DfsnRoot...}                      
Binary     1.0        DFSR                                {New-DfsReplicationGroup, Get-DfsReplicationGroup, Set-DfsReplicationGroup, Remove...
Manifest   2.0.0.0    DhcpServer                          {Add-DhcpServerInDC, Add-DhcpServerv4Class, Add-DhcpServerv4ExclusionRange, Add-Dh...
Manifest   1.0.0.0    DirectAccessClientComponents        {Disable-DAManualEntryPointSelection, Enable-DAManualEntryPointSelection, Get-DACl...
Script     3.0        Dism                                {Add-AppxProvisionedPackage, Add-WindowsDriver, Add-WindowsImage, Add-WindowsPacka...
Manifest   1.0.0.0    DnsClient                           {Resolve-DnsName, Clear-DnsClientCache, Get-DnsClient, Get-DnsClientCache...}       
Manifest   2.0.0.0    DnsServer                           {Add-DnsServerConditionalForwarderZone, Add-DnsServerDirectoryPartition, Add-DnsSe...
Manifest   2.0.0.0    FailoverClusters                    {Add-ClusterCheckpoint, Add-ClusterDisk, Add-ClusterFileServerRole, Add-ClusterGen...
Manifest   1.0.0.0    GroupPolicy                         {Backup-GPO, Block-GPInheritance, Copy-GPO, Get-GPInheritance...}                   
Binary     1.1        Hyper-V                             {Add-VMDvdDrive, Add-VMFibreChannelHba, Add-VMHardDiskDrive, Add-VMMigrationNetwor...
Manifest   2.0.0.0    International                       {Get-WinDefaultInputMethodOverride, Set-WinDefaultInputMethodOverride, Get-WinHome...
Manifest   2.0.0.0    IpamServer                          {Get-IpamDhcpConfigurationEvent, Remove-IpamDhcpConfigurationEvent, Get-IpamConfig...
Manifest   1.0.0.0    iSCSI                               {Get-IscsiTargetPortal, New-IscsiTargetPortal, Remove-IscsiTargetPortal, Update-Is...
Manifest   2.0.0.0    IscsiTarget                         {Add-ClusteriSCSITargetServerRole, Add-IscsiVirtualDiskTargetMapping, Checkpoint-I...
Script     1.0.0.0    ISE                                 {New-IseSnippet, Import-IseSnippet, Get-IseSnippet}                                 
Manifest   1.0.0.0    Kds                                 {Add-KdsRootKey, Get-KdsRootKey, Test-KdsRootKey, Set-KdsConfiguration...}          
Manifest   3.0.0.0    Microsoft.PowerShell.Diagnostics    {Get-WinEvent, Get-Counter, Import-Counter, Export-Counter...}                      
Manifest   3.0.0.0    Microsoft.PowerShell.Host           {Start-Transcript, Stop-Transcript}                                                 
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Content, Clear-Content, Clear-ItemProperty, Join-Path...}                      
Manifest   3.0.0.0    Microsoft.PowerShell.Security       {Get-Acl, Set-Acl, Get-PfxCertificate, Get-Credential...}                           
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Format-List, Format-Custom, Format-Table, Format-Wide...}                          
Manifest   3.0.0.0    Microsoft.WSMan.Management          {Disable-WSManCredSSP, Enable-WSManCredSSP, Get-WSManCredSSP, Set-WSManQuickConfig...
Manifest   1.0        MMAgent                             {Disable-MMAgent, Enable-MMAgent, Set-MMAgent, Get-MMAgent...}                      
Manifest   1.0.0.0    MsDtc                               {New-DtcDiagnosticTransaction, Complete-DtcDiagnosticTransaction, Join-DtcDiagnost...
Manifest   2.0.0.0    NetAdapter                          {Disable-NetAdapter, Disable-NetAdapterBinding, Disable-NetAdapterChecksumOffload,...
Manifest   1.0.0.0    NetConnection                       {Get-NetConnectionProfile, Set-NetConnectionProfile}                                
Manifest   1.0.0.0    NetEventPacketCapture               {New-NetEventSession, Remove-NetEventSession, Get-NetEventSession, Set-NetEventSes...
Manifest   2.0.0.0    NetLbfo                             {Add-NetLbfoTeamMember, Add-NetLbfoTeamNic, Get-NetLbfoTeam, Get-NetLbfoTeamMember...
Manifest   1.0.0.0    NetNat                              {Get-NetNat, Get-NetNatExternalAddress, Get-NetNatStaticMapping, Get-NetNatSession...
Manifest   2.0.0.0    NetQos                              {Get-NetQosPolicy, Set-NetQosPolicy, Remove-NetQosPolicy, New-NetQosPolicy}         
Manifest   2.0.0.0    NetSecurity                         {Get-DAPolicyChange, New-NetIPsecAuthProposal, New-NetIPsecMainModeCryptoProposal,...
Manifest   1.0.0.0    NetSwitchTeam                       {New-NetSwitchTeam, Remove-NetSwitchTeam, Get-NetSwitchTeam, Rename-NetSwitchTeam...}
Manifest   1.0.0.0    NetTCPIP                            {Get-NetIPAddress, Get-NetIPInterface, Get-NetIPv4Protocol, Get-NetIPv6Protocol...} 
Manifest   1.0.0.0    NetWNV                              {Get-NetVirtualizationProviderAddress, Get-NetVirtualizationGlobal, Get-NetVirtual...
Manifest   1.0.0.0    NetworkConnectivityStatus           {Get-DAConnectionStatus, Get-NCSIPolicyConfiguration, Reset-NCSIPolicyConfiguratio...
Manifest   2.0.0.0    NetworkLoadBalancingClusters        {Add-NlbClusterNode, Add-NlbClusterNodeDip, Add-NlbClusterPortRule, Add-NlbCluster...
Manifest   1.0.0.0    NetworkTransition                   {Add-NetIPHttpsCertBinding, Disable-NetDnsTransitionConfiguration, Disable-NetIPHt...
Manifest   1.0        NFS                                 {Get-NfsMappedIdentity, Get-NfsNetgroup, Install-NfsMappingStore, New-NfsMappedIde...
Manifest   1.0.0.0    PcsvDevice                          {Get-PcsvDevice, Start-PcsvDevice, Stop-PcsvDevice, Restart-PcsvDevice...}          
Manifest   1.0.0.0    PKI                                 {Add-CertificateEnrollmentPolicyServer, Export-Certificate, Export-PfxCertificate,...
Manifest   1.1        PrintManagement                     {Add-Printer, Add-PrinterDriver, Add-PrinterPort, Get-PrintConfiguration...}        
Binary     1.0        PSDesiredStateConfiguration         {Set-DscLocalConfigurationManager, Start-DscConfiguration, Configuration, Get-DscC...
Script     1.0.0.0    PSDiagnostics                       {Disable-PSTrace, Disable-PSWSManCombinedTrace, Disable-WSManTrace, Enable-PSTrace...
Binary     1.1.0.0    PSScheduledJob                      {New-JobTrigger, Add-JobTrigger, Remove-JobTrigger, Get-JobTrigger...}              
Manifest   2.0.0.0    PSWorkflow                          {New-PSWorkflowExecutionOption, New-PSWorkflowSession, nwsn}                        
Manifest   1.0.0.0    PSWorkflowUtility                   Invoke-AsWorkflow                                                                   
Manifest   2.0.0.0    RemoteAccess                        {Add-DAAppServer, Add-DAClient, Add-DAClientDnsConfiguration, Add-DAEntryPoint...}  
Manifest   2.0.0.0    RemoteDesktop                       {Get-RDCertificate, Set-RDCertificate, New-RDCertificate, New-RDVirtualDesktopDepl...
Manifest   1.0.0.0    ScheduledTasks                      {Get-ScheduledTask, Set-ScheduledTask, Register-ScheduledTask, Unregister-Schedule...
Manifest   2.0.0.0    SecureBoot                          {Confirm-SecureBootUEFI, Set-SecureBootUEFI, Get-SecureBootUEFI, Format-SecureBoot...
Script     2.0.0.0    ServerManager                       {Get-WindowsFeature, Install-WindowsFeature, Uninstall-WindowsFeature, Enable-Serv...
Cim        1.0.0.0    ServerManagerTasks                  {Get-SMCounterSample, Get-SMPerformanceCollector, Start-SMPerformanceCollector, St...
Manifest   2.0.0.0    SmbShare                            {Get-SmbShare, Remove-SmbShare, Set-SmbShare, Block-SmbShareAccess...}              
Manifest   2.0.0.0    SmbWitness                          {Get-SmbWitnessClient, Move-SmbWitnessClient, gsmbw, msmbw...}                      
Manifest   1.0.0.0    StartScreen                         {Export-StartLayout, Import-StartLayout, Get-StartApps}                             
Manifest   2.0.0.0    Storage                             {Add-InitiatorIdToMaskingSet, Add-PartitionAccessPath, Add-PhysicalDisk, Add-Targe...
Manifest   2.0.0.0    TLS                                 {New-TlsSessionTicketKey, Enable-TlsSessionTicketKey, Disable-TlsSessionTicketKey,...
Manifest   1.0.0.0    TroubleshootingPack                 {Get-TroubleshootingPack, Invoke-TroubleshootingPack}                               
Manifest   2.0.0.0    TrustedPlatformModule               {Get-Tpm, Initialize-Tpm, Clear-Tpm, Unblock-Tpm...}                                
Manifest   2.0.0.0    UpdateServices                      {Add-WsusComputer, Approve-WsusUpdate, Deny-WsusUpdate, Get-WsusClassification...}  
Manifest   2.0.0.0    VpnClient                           {Add-VpnConnection, Set-VpnConnection, Remove-VpnConnection, Get-VpnConnection...}  
Manifest   1.0.0.0    Wdac                                {Get-OdbcDriver, Set-OdbcDriver, Get-OdbcDsn, Add-OdbcDsn...}                       
Manifest   1.0.0.0    WebAdministration                   {Start-WebCommitDelay, Stop-WebCommitDelay, Get-WebConfigurationLock, Remove-WebCo...
Manifest   1.0.0.0    WindowsDeveloperLicense             {Get-WindowsDeveloperLicense, Show-WindowsDeveloperLicenseRegistration, Unregister...
Script     1.0        WindowsErrorReporting               {Enable-WindowsErrorReporting, Disable-WindowsErrorReporting, Get-WindowsErrorRepo...
Manifest   1.0.0.0    WindowsSearch                       {Get-WindowsSearchSetting, Set-WindowsSearchSetting}                                


    Directory: C:\Program Files (x86)\Microsoft SQL Server\110\Tools\PowerShell\Modules


ModuleType Version    Name                                ExportedCommands                                                                    
---------- -------    ----                                ----------------                                                                    
Manifest   1.0        SQLASCMDLETS                        {Add-RoleMember, Backup-ASDatabase, Invoke-ASCmd, Invoke-ProcessCube...}            
Manifest   1.0        SQLPS                               {Backup-SqlDatabase, Add-SqlAvailabilityDatabase, Disable-SqlAlwaysOn, Enable-SqlA...


    Directory: C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement


ModuleType Version    Name                                ExportedCommands                                                                    
---------- -------    ----                                ----------------                                                                    
Manifest   0.8.10.1   Azure                               {Disable-AzureServiceProjectRemoteDesktop, Enable-AzureMemcacheRole, Enable-AzureS...


    Directory: C:\Program Files (x86)\Microsoft SQL Server\130\Tools\PowerShell\Modules


ModuleType Version    Name                                ExportedCommands                                                                    
---------- -------    ----                                ----------------                                                                    
Manifest   1.0        SQLASCMDLETS                        {Add-RoleMember, Backup-ASDatabase, Invoke-ASCmd, Invoke-ProcessCube...}            
Manifest   1.0        SQLPS                               {Backup-SqlDatabase, Save-SqlMigrationReport, Add-SqlAvailabilityDatabase, Add-Sql...

Monday, July 13, 2015

What is needed to encrypt a database in SQL Server 2016 CTP 2.1?

In order to enable encryption for a database you should set the encryption key.

Here is a database (TestEncrypt with three simple columns) which needs to be encrypted and for which no Enccryption key is set.


TestEncryptOptions.png

Change Encryption Enabled from False to True by clicking on the handle.


TestEncryptOptions2.png
Click OK.
You get the following error message:

TestEncryptOptions3.png

How do you customize Windows PowerShell ISE?

You can change many of the settings as well as fonts & Colors in the Windows PowerShell ISE.

Code coloring, intellisense settings; script pane  customization; and other settings can be changed in Windows PowerShell ISE.

Launch Windows PowerShell ISE from the run program as shown:


CusotmizePSISE.png

In the Windows PowerShell ISE displayed click to open Tools | Options to display the Options window as shown. In the tabbed page (2 tabs) General you will see the following. These are (may be) the defaults.


PsIseOptions1.png

In the tabbed page Colors and Fonts you can set the changes you want to make or use defaults for Script Pane as well as Console Panes.


PsIseOptions2.png

Wednesday, July 8, 2015

What is Sass?

Well, Sass is not software as super service. Sass stands for Syntactically Awesome StyleSheets. It is actually an extension of CSS to make CSS more powerful and elegant. Sass helps organizing unwieldy large CSS and let smaller CSS to run faster using the Compass Style Library.

The main features from Sass documentation are:

  •     Fully CSS3-compatible
  •     Language extensions such as variables, nesting, and mixins
  •     Many useful functions for manipulating colors and other values
  •     Advanced features like control directives for libraries
  •     Well-formatted, customizable output
Sass has two types of syntaxes, one older and the other new. The more recent SassyCSS (Scss) is an extension of CSS3 which essentially means that all CSS3 stylesheets are valid SCSS file with the extension .scss.
The older syntax called Sass uses indented syntax instead of brackets for nesting the selectors and has the extension .sass.

It is easy to go from one to the other with a simple convert command.

Note: Sass is Ruby based and windows users need to install Ruby .

After installing Ruby, you can convert the .Scss file to .css file calling the sass command as shown here:   
           sass input.scss output.css
The CSS generated is what you are going to use in your web page.

Here is the reference to documentation:
http://sass-lang.com/documentation/file.SASS_REFERENCE.html

Here is an example of variables defined with .scss syntax being converted to .css:
--------
$font-stack:    Helvetica, sans-serif;
$primary-color: #333;

body {
  font: 100% $font-stack;
  color: $primary-color;
}

------------
$font-stack and $primary-color are variables in the Scss syntax and this gets changed to .css after processing as in the following:
--------------
body {
  font: 100% Helvetica, sans-serif;
  color: #333;
}

The above is just an example of a variable, but dig deeper to find the rich coding possibilities.

Well give it a try and find out yourself in what ways you can improve your styling.