Saturday, August 1, 2015

Why Windows Phone operating system is tied to the carrier?

Actually this was my question to one of Microsoft's forum.

Verizon is my carrier and the carrier is slow in rolling out updates (more interested in quick sells). It took a year for Verizon to go from Windows Phone 8 to Windows Phone 8.1 after Window Phone 8.1 went RTM.

Here is my question:
Regarding tying OS with Carrier:
"
I think this is very a bad decision.
I bought my Nokia Icon and I was not aware at that time that it was Verizon Specific. When the Operating System was upgraded to 8.1, Verizon took one year to roll out while they were busy selling the Androids and Apples which were the major phones (in terms of sales) after many writing and complaining.
http://hodentekmobile.blogspot.com/2014/07/windows-phone-81.html
http://hodentek.blogspot.com/2014/11/filed-complain-to-fcc.html"

This is the answer from the forum:

Your question on Microsoft Community has received a reply from TomBrad95.




Reply
Carriers need to do their own testing before releasing it to the public, most of the carriers in the U.S. take their time with windows phone and some even put it off, there was a discussion from Microsoft saying that they will no longer be required carrier testing and instead releasing straight to users, however I'm unsure whether this is still true or not since there hasn't been an OS release since, we'll find out when windows 10 mobile is released.

Read this reply on Microsoft Community.

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