Friday, January 19, 2018

There are no user databases in my SQL Server 2017, Can I connect to it using Microsoft SQL Operations Studio?

Yes you can. There are already system databases. Make sure that the server has started. Start it if it has not started in Control Panel, or otherwise.

I have a default instance of SQL Server 2017 Verion 17.3 and I connect to it as described here.

Launch SQLOPS from its shortcut and click New Connection as shown


SQLServer17SQLOPS_0


The New Connection window opens as shown.


SQLServer17SQLOPS_1


Enter the items as shown.


SQLServer17SQLOPS_3

Click Connect.
You are connected as shown.



Click New Query to open a new query window as shown.


SQLServer17SQLOPS_6


Type S and a drop-down list appears.


SQLServer17SQLOPS_7


Complete a query as shown:

SELECT @@version


SQLServer17SQLOPS_8

Click Run and review the result as shown:


SQLServer17SQLOPS_9

Right click the result, copy and paste it in Notepad as shown:

Microsoft SQL Server 2017 (RTM) - 14.0.1000.169 (X64)  Aug 22 2017 17:04:49  Copyright (C) 2017 Microsoft Corporation Developer Edition (64-bit) on Windows 10 Pro Insider Preview 10.0 (Build 17025: ) (Hypervisor)

Note: It was mentioned that you type in msdb as a database. In fact just localhost is all that is neccessary to connect.

Sunday, January 14, 2018

Are there many versions of Windows 10 emulators?

Yes indeed. There are various versions for Windows 10 as well as for even earlier Windows versions.

Here are the ones for Windows 10:

10.1.15254.1


10.1.15063.137


10.1.14393.0


10.1.10586.11


10.0.26624.0


You may download them from this site here.

Wednesday, January 10, 2018

How would I add an app icon to my Universal Windows Project using Visual Studio 2017?

On smart phones Windows 10 Mobile, iPhone, Pixel Phones etc users immediately get to the app by clicking the app icon. It is their point of entry. Also when you install a new app, the new app appears on the app list.

For our HelloWorld Universal Windows Project, we can add the app icon (by replacing the default) using Visual Studio 2017 Community (or any other similar Visual Studio version).

If you are using the default app icon, when deployed your app would appear as shown here.


Lumia950AppIcon_0


It is pretty ugly (the icon of Hello World) and I am sure you want something that is distinctive of your development or company. You need to create an image to replace the "x" in your app.

I used Logo Foundry app that you can download from here. You can use any other software. It is just I found it the first time I searched and used it.

http://www.logomakerapp.com/index.html

I used it to create a simple logo that has the text 'Hodentek' on it as shown here:




Lumia950AppIcon_1

By using a photo application, I sliced it and created a 88x88 sized image recommended for the app icon in Visual Studio.

You should see this in the Package.appxmanifest file under Visual Assets | App Icon as shown.

I used the Browse(...) button for the recommended 88x88 size and retrieved to Visual Studio from the saved location.




Now from File menu click Save All. The build and run deploy the application to  Local Computer.

The application runs and the Hello World app icon appears as shown in Windows All programs as shown.






Tuesday, January 9, 2018

How do you deploy a Universal Windows Project to a connected device?

We will be using the Lumia 950 as the connected device and it has been set to Developer Mode as described earlier.

We start with the HelloWorld Universal Windows Project(UWP) that has been tested to run without errors on the Local Machine as described here.

Open the project in Visual Studio 2017 as shown.



LumiaDeploy_0 and LumiaDeploy_7

Build (Using Menu Build and its context menu) the Project and verify it is successful.
--------
1>------ Build started: Project: HelloWorld, Configuration: Debug x86 ------
1>  HelloWorld -> C:\Users\Owner\source\repos\HelloWorld\HelloWorld\bin\x86\Debug\HelloWorld.exe
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped =====
------------------

Click Local Machine along Debug as shown.


LumiaDeploy_1

Pick Device from the list, the display changes as shown.



LumiaDeploy_2

Connect your Windows 10 Mobile(Lumia 950) to one of the USB ports.


This will result in an error as it is not x64 architecture.
LumiaDeploy_9

Pick ARM from the list.

Click Configuration Manager... to display the Configuration Manager window as shown.


LumiaDeploy_4

Make sure configuration is as shown above.

Click Build and from drop-down click Deploy.


Deploy succeeds and you should see the HelloWorld app appears in the apps list.

Here are the deployed apps on Lumia 950


 After clicking 'Hello'


What is required to deploy a Universal Windows Project to Lumia 950?

One of the requirements is that your phone should be configured so that UWP can be deployed. 
The configuration needs to be modified on the phone using SETTINGS as described here. If you are a registered then you can use the developer mode.

I deploy my UWP apps to Microsoft Lumia 950. One of the first things you need to do is to set it for Developers.

There are three options and you should choose Developer mode as shown here:


Lumia950_0

You should turm on option to make your phone visible to USB connections to your local network as shown here:


Lumia950_1

Also turn on remote diagnostics over USB and authentication as shown above.


Lumia950_2

Now you can connect the Windows 10 Mobile(=Lumia 950) to one of the USB connections on your laptop/computer where you are running Visual Studio 2017 used for creating Universal Windows Projects. You set up your project deploying it to the device.

Here are my phone details:
Microsoft Lumia 950
Version 1709
Windows 10 Mobile
OS Build:10.0.15254.124
Screen Res: 1440x2560

Here is HelloWorld deployed to Lumia950


Lumia950_3

Sunday, January 7, 2018

How do you change the BACKGROUND color of a XAML button using a CLICK event in C#?

Sometimes you need to change the background color from its default to a different color. Let us say, we have a button whose Background color needs changing by an event such as the CLICK event.

How is it done?
Well, I could give you a line of code to do that. Perhaps it will work and all that there is to it. However, if you are beginner and wondering how the hell it is coded with so much of background code, namespaces; classes, methods, events etc.

This post tries to show how you may find yourselves how to do it.

If you are looking for the one line of code, please go to the end and you will find it there. If you are beginning to code and new to Microsoft; new to Visual Studio in particular, follow on.

As mentioned in my previous post Universal Windows Project use XAML for the UI and the pages.
Some of the things you should remember is that you should use intellisense as much as possible. You should also use code hints you get when your code is not doing what you except.

In order to illustrate let us start with the code for a BUTTON click event for a button named ClickMe as shown:
=========
public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();
        }

    
        private void ClickMe_Click(object sender, RoutedEventArgs e)
        {
            ClickMe.FontSize = 50;
           
        }
    }
}

===============

The above code changes the font-size to 50 when the button is clicked. We add one more line which changes the BACKGROUND color to red.

Start with ClickMe (the object) by typing below ClickMe in the above code.

As soon as you typein Click you will see this:


ClickMeEvent_0

Pick ClickMe from the above and add a period to it after that and you will get more pop-up as shown.


ClickMeEvent_1

Pick Background and your code looks like this:


ClickMeEvent_3

You try the 'dot trick' again by typing a dot after Background as shown. You do get a pop-up which does not seem to have anything to do with color.


ClickMeEvent_4

Now you need to know that color is given by using a brush and you have an Object called SolidColorBrush besides other kinds. In XAML scenarios, Color is not referenced directly but by the component SolidColorBrush.


ClickMeEvent_5

Now you type in SolidColorBrush but you get the red wiggly (oops, something not right).


ClickMeEvent_6

You place your cursor on SolidColorBrush and you get a hint. SolidColorBrush is a class name and you are looking for a color value. Instead of using the class, you should use an instant of the class with the 'new' keyword as shown.


ClickMeEvent_7

The red wiggly is still there but you have made progress.

Well this gives a hint that you must follow up this with one of [], {},or ().

Let us type the parenthesis-begin as shown


ClickMeEvent_8

There are two options as shown.


ClickMeEvent_9

The first method gives no color and the second options uses one of the Windows colors.


ClickMeEvent_10.jpg

Now I use the hint from the image one previous to the above. And we continue with code as shown.


ClickMeEvent_11.jpg

Well, again we are getting the class COLOR. Place the cursor on the color and find out what is needed.

Now with the dot trick we are ahead to choose a color we want.


ClickMeEvent_12.jpg

Now we have to choose the color from inserting proper values for the arguments of the function
FromArgb() as described in this post here.

Let us choose a ALPHA (transparency)channel value of 255 and a RED channel value of 255, BLUE channel value 0 and Green channel vlaue of 0 as shown. Type these into FromArgb() as shown.


ClickMeEvent_14.jpg

Now we are rid of the pesky red wiggly line. Ready to rock and roll.

Build the code from the main menu and deploy it to the local machine as described in my earlier post.

The Build succeeds as shown.


ClickMeEvent_15.jpg

Now Deploy the solution and you get this result as there are no errors:
========
Deploy started: Project: HelloWorld, Configuration: Debug x86 ------
Updating the layout...
Copying files: Total <1 br="" layout...="" mb="" to="">1>Checking whether required frameworks are installed...
Registering the application to run from layout...
Deployment complete (0:00:18.287). Full package name: "b940c521-2fb5-429c-9486-69bb2a425e90_1.0.0.0_x86__ckpvgz13cfhxc"

========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
========== Deploy: 1 succeeded, 0 failed, 0 skipped ==========
Now run the project and you get this display of  your application
<1 br="" layout...="" mb="" to="">

<1 br="" layout...="" mb="" to="">
<1 br="" layout...="" mb="" to="">ClickMeEvent_16

Now click the Hello button to see the Background color and font size change as shown.


ClickMeEvent_17

After verifying close the application and you get the following response:
==================
The program '[15840] HelloWorld.exe' has exited with code 1 (0x1).

That's it folks!





Saturday, January 6, 2018

What is FromArgb(int32, int32, int32,int32) in creating color by code?

It is from System.Drawing namespace and used in SolidBrush Class.

Its usage syntax in .NET for Windows Universal is:
Windows.UI.Color.FromArgb(byte,byte,byte,byte)

In the above, the first argument is the alpha channel(transparency) that runs from 0 to 255; the next three are red, green and blue channels in that order each from 0 to 255.

For example:
Windows.UI.Color.FromArgb(75, 255, 0,0) produces Background color 'red' with a transparency of 75.