Friday, November 21, 2014

How can I install PHP on Windows 8.1?

In order to install PHP on your machine you should have the local web server working which is IIS 8.0 on a Windows 8 OS.  if it is not activated you can activate it from Control Panel (Turn Windows features on or off ).

If the IIS 8.0 is activated you should be able to see the following screen when you access  http://localhost in  browser on your computer.

For the current laptop the following is the response:

Assuming you had no problem activating IIS 8.0 we can move to the next step of installing PHP 5.x.

Downloading and installing PHP 5.X:

PHP can be downloaded (free) using the latest Web Platform Installer (WebPI) which happens to be WebPI version 5.0 from here:

The advantage of using the WebPI is that it not only it installs PHP engine but also configures it to work with IIS.

Downloading and installing is quite easy as shown in the following post:

After installing PHP engine you should test to verify it is working correctly by browsing the info.php file shown next from the following file location:


Here is the simple code listing for info.php:

If your PHP engine is working well you should see the following (only part of a very long page is shown) when you browse this file in your IIS or type the following in the address box of your browser.
This completes the installation of PHP 5.6 on Windows 8.1 Professional that works well with IIS 8.0

In a future post we take a look at accessing SQL Server 2012 from a PHP application.

Related must read article:
I have covered in detail how to use PHP applications (PHP versions 5.2.4 or later) to access data on Microsoft Azure SQL Databases (formerly called  Microsoft SQL Azure) using PHP Data Objects. Details are on pages 369-373, Chapter 10 in my 2010 book here:

You can buy or join the library here:



Wednesday, November 19, 2014

What is DMCA?

DMCA stands for Digital Millennium Copyright Act (it is part of the US Copywrite law) and it criminalizes, "production and dissemination of technology, devices, or services intended to circumvent measures (commonly known as digital rights management or DRM) that control access to copyrighted works".

This United States copywrite law implements two 1996 treaties of World Intellectual Property Organization.

Follow Wikipedia for further details:

According to this law you could be penalized and pay penalties for copywrite infringement on the Internet.

DMCA provides protection to online providers such as Google from copywrite infringement liability claims provided, Google and similar providers remove or disable the alleged infringing sites.
You can get more information here for DMCA related information for Google Products:

If you think you are the target of copywrite infringement (Let us say your blog or some picture) you could bring it to the notice of Google or the other provider so that they can take steps to remove.

How effective is this process?

Internet is big and the complexity grows each day and I am not really sure how much protection you can get. I have been the target and you can read about it here  and here.


Monday, November 10, 2014

What is the difference between Windows PowerShell and Windows PowerShell ISE?

Windows PowerShell is not a GUI application and it runs the PowerShell engine in the host program. You will see the following screen displayed when you access Windows PowerShell from the Search charm on Windows 8.1.

If you choose to launch you should search for 'Windows PowerShell ISE. The following screee will be displaced. It is rich interface that has many features including interactive help in scripting. If you are new to Power Shell you should begin your learning with this tool.

You can launch them as administrator which gives you more power (Run as Administrator) and is called launching with elevated permissions.

You can launch multiple instances.

You may be interested in these two posts as well:

Monday, November 3, 2014

How do you work with Javascript Object Notation?

With enhancements to JavaScript in recent years and the advent of AJAX, interest in JavaScript took a turn for the better. Early on with AJAX it was recognized that there was a contender for XML for handling data which was stable, faster, and portable. This was the beginning of JSON.

Although RFC 4627 marks a JSON milestone, it appears that it had already been discussed among the JavaScript cognoscenti. JSON is equally, or even more suited, for data exchange than XML, which was originally considered to be the ideal wire friendly format.
What is JSON?
So what is JSON? It’s an acronym you might have started appearing in greater frequency on the Internet. JSON stands for JavaScript Object Notation. Well, it is a special object notational construct and is a subset of JavaScript. It can be used wherever JavaScript can be used and you do not need to download anything. There is no need to worry about the version of JavaScript.
You can read more about JSON in RFC 4627. JSON was designed to be minimal (small), textual, and portable. The MIME Media Type is now registered as application/json. JSON can handle exchanging data in applications written in different programming languages such as C, C#, ColdFusion, Perl, Python, Ruby, and so forth.

JSON Basics
JSON has simple types and two structures which are very similar to the universally used data structures such as dictionary objects, hash values, key/value pairs, lists, sequences, record sets, arrays and so on. It is a natural.

Types in JSON

JSON’s JavaScript subset admits of the following four primitive types.
* strings [except ", and Control Characters]
* number [Integer, real and Floating point]
* Boolean [literals, true and false]
* null

Unlike JavaScript it does not support hexadecimal and octal representation of numbers, nor does it support NaN (not a number) and infinity. Also numbers do not need quotes but strings do.
In addition to the four primitives it also supports two kinds of structures, object and array.

JSON Object
A JSON object is an unordered set (members) of key/value pairs, with keys being separated by values using a colon (:) and the members being separated by a comma (,). The colon and the comma are respectively called the name separator and the value separator.
Here is a variable that represents a JSON object with three members. “company”:”Hodentek” is one member of the JSON object where the key, which is “company,” is separated by the value, which is “Hodentek.” The object is always enclosed between curly brackets as shown in the declared variable. In this example all the values are of type string.

var jObj={"company":"Hodentek", "phone":"609-275-1205", "city":

You can access any member’s value using the dot notation as shown in the next snippet, which shows the “phone” of the object in the alert as “609-275-1205.”


The values of members of the JSON object can be of different types as shown in the following code listing.
Script Language="JavaScript"›

//values are numbers (integer and floating point)
var jobj2={"sunday":1, "tuesday":2.85, "wednesday":3};
document.write("‹b›jobj2.tuesday:‹/b› " + jobj2.tuesday +"‹br›");
//values are of mixed types
var jObj3={"culprit":true, "innocent":false, "notsure":null};
document.write("‹b›jObj3.culprit:‹/b› " + jObj3.culprit +"‹br›");
document.write("‹b›jObj3.innocent:‹/b› " + jObj3.innocent +"‹br›");
document.write("‹b›jObj3.notsure:‹/b› " + jObj3.notsure +"‹br›");


The displayed output when this code is browsed is as shown in the next picture.

JSON Array

Unlike JSON objects, JSON arrays are enclosed between square braces [ ]. The JSON array is an ordered sequence of values separated by a comma (,). The values can be any of the primitive types as well as the two structures, JSON objects and JSON arrays. Here is a JSON array variable with four string values.

var myJsonArray=["Red", "Blue", "Yellow", "Magenta"];

You will be able to access an array item from its position (0 based) as shown in the following listing.

var myJsonArray=["Red", "Blue", "Yellow", "Magenta"];
for (i=0; i‹4; i++){
document.write("‹b›myJsonArray["+i+"]‹/b›="+ myJsonArray[i]+"‹br›");

The displayed output when this script is executed is as shown in the next picture.

It is possible to have an array  whose elements are of different types. Array items can be objects and arrays as well, as shown in the next listing.
//Array with different types
myJA2=["red", 1, null, true];
document.write("‹;b›myJA2:‹;/b›  " + myJA2[2]);
//Nested array
myJA3=["red",1,["a", "b", "c"], false];
document.write("‹;b›myJA3[2][1]:‹;/b›  " + myJA3[2][1]);
//Object in an array
myJA4=["red", {"Yes":"Yes, you do", "No":"No, you do not"}, 2];
document.write("‹;b›myJA4[1].Yes: ‹;/b›"+ myJA4[1].Yes);

The displayed output when this script is executed is as shown in the next picture.

Notice how the inner array and the object inside the array are  accessed.
JSON is minimal textual representation of data as compared to the “verbose” XML, which makes equivalent XML much larger than JSON. Well, both are textual, but JSON is more so than XML with all its “angularities.” This is not to put down XML but just to highlight the obvious. This has obvious implications for AJAX, and more often JSON is the preferred data format in which AJAX results are received.
Everything in XML is a string but JSON has types as discussed earlier. JSON equivalent of XML In my previous tutorials, XML Islands and XML Responses and AJAX, the file webstudents.xml was used for illustration.

The same file will be represented as a JSON object in this section. The file is reproduced here for reference. In writing down the equivalence only the root element and its children are considered. Here is the listing of webstudents.xml.
‹!--My students who took web programming class with me--›
‹student id="1"›
‹name›Linda Jones‹/name›
‹legacySkill› Access, VB5.0‹/legacySkill›
‹student id="2"›
‹name›Adam Davidson‹/name;
‹legacySkill›Cobol, MainFrame‹/legacySkill›
‹student id="3"›
‹name›;Charles Boyer‹/name›
‹legacySkill›HTML, Photoshop‹/legacySkill›
‹student id="4"›
‹name›Charles Mann‹/name›
‹legacySkill›Cobol, MainFrame‹;/legacySkill›

The rules in this conversion are simple. The root element will be the main object, and the three student nodes will form an array. Each array element will be a student object with its own attributes as a string value pair. If you keep the following syntax  in your cross-hairs it will be easy to follow the listing.

Object: var obj={key1:value1, key2:value2 ,key3:value3};
Array: var Arr=[valueA, valueB, valueC];

The XML document has both simple and complex types and this is developed piecewise to make the explanation easy to understand.

Root element with students and their attributes

The root element is the object with the three students arranged in an array. Each of the students is an object as shown in the next listing.

var justStudents={"wclass":[
This is an object whose value is an array. The wclass[1] refers to the second student object and is accessed as shown in the alert statement. This code will display an alert window with value 2. In the above code the children of the students are not included.
Root element with student’s children

The next listing shows the JSON object with only the children of students shown in an array.

var webclass ={
{"name":"Linda Jones", "legacySkill":"Access, VB 5.0"}},
{"name":"Adam Davidson", "legacySkill":"Cobol, MainFrame"}},
{"name":"Charles Boyer", "legacySkill":"HTML, XML"}}

Here student 2 is “Charles Boyer” and his legacyskill is displayed in the alert box. Combining the two, it is easy to see how the JSON equivalent of webstudents.xml can be fashioned as shown in the next listing.
var studentAll={"wclass":[
{"student":{"id":"1"},"name":"Linda Jones",

"legacySkill":"Access, VB 5.0"},
{"student":{"id":"2"},"name":"Adam Davidson",

"legacySkill":"Cobol, MainFrame"},
{"student":{"id":"3"},"name":"Charles Boyer",

"legacySkill":"HTML, XML"}
document.write("‹b›Id of 3rd student: ‹/b›" + studentAll.wclass[2].;
document.write("‹b›name of 2nd student:‹/b› " + studentAll.wclass[1].

document.write("‹b›legacySkill of 1st student:‹/b› " + studentAll.


The listing also shows how the various values are accessed. The displayed output when this script is executed is as shown in the next picture.

Notice how the student attributes are accessed.

What about binary object representation?

There is no native support for binary objects. However some new formats have appeared recently.
Read here and here. However their universal adoption will take time.


JavaScript Object Notation (RFC 4627) is introduced with examples of its types, objects and structures in this post. JSON is well suited for data interchange. JSON is stable because it has no versions; needs no validation; and is not extensible, all very likable characteristics which may make it a long time player in JavaScript.

However, since JSON is a subset of JavaScript, it has to conform to the same naming conventions regarding the use of language specific keywords and other rules. Also, its usefulness in AJAX calls is obvious because JSON is as easy for humans as it is for machines, and a lot simpler and more understandable. he fact that it is easy for machines makes it an obvious for the Internet of Things where communication with machines takes center stage.

In the simple example of webstudents.xml, the number of characters for XML amounted to 413, whereas when formatted in JSON it required 243, a substantial difference. Accessing values is also a lot simpler than going through the ECMA object model climbing up and down the XML tree.

Unmodified version of the post appeared here:

Friday, October 24, 2014

How to developer-unlock a Windows Phone 8.1 Preview and deploy an app?

You are a Windows Phone 8.1 Preview developer and you have created a nice app that you want to
test on a phone you own.

How do  you test it?

While developing the application using Visual Studio 2013 Express for Windows Update 3 (this is a
free developer resource, read more here) you will see it on a emulator, the phone image that emulates your actual phone  that comes on your PC/Laptop when you run the app. After running the app on your laptop you should deploy it to your phone. The phone you buy is by default locked and you need to unlock it.

Details of unlocking the phone are here:
Go to this link:

This is how I was able to do.
  • I connected my phone (Nokia Icon) to the laptop.
  • On my Windows 8.1 Professional (x64 bit) laptop I searched for Windows Phone and got these results(few shown)

  • I clicked on the Windows Phone Developer Registration. I do have a developer license attached to my Windows LiveID (you shold have one too).

The following screen opened up. Notice the last line in this screen referring to the status. The phone I am using is identified.

I clicked on Register

The phone gets registered and the status shows it is unlocked now.

I can now deploy the app to the device. If deployment is successful I will be able to see the app on my app list in the phone.

I have to take care of the following before I deploy.
Make sure the phone is connected to the PC/laptop on which you developed the application.
Build the app for ARM architecture (you should find it immediately below the menu item Store on your Visual Studio 2013 IDE, see next image) and make sure the phone is working and is not locked.


Thursday, October 23, 2014

How do I take a screenshot of a display on my Windows Phone 8.1?

This is easy but a little tricky but you do get a signal when you capture an image.
I am using Nokia Icon using Windows Phone 8.1 Preview.

Also you may not have a folder called Screenshots in your Photo where it is supposed to get saved. But as soon as you add your first screen shot, a folder Screenshots will be created where your first screen shot is stored. You do not need an app to do this.

How do you capture?

With the display showing your image, hold and press both Volume Up(hardware) and Start (hardware) buttons together. This is the tricky part because the Start (hardware start) button when pressed turns your display dark and I could do it only 30% of the times. But it does work.

Here is a screenshot I took today:


Wednesday, October 22, 2014

What is LumiaSensorCore?

Microsoft introduced Lumia SensorCoreSDK at Build 2014. It enables memory-efficent tracking of motion and location information. It is ideally suited to building health and fitness tracking activities using the 4 apis.

It is supported on several of Nokia phones using Windows Phone 8.1 OS. The early beta is now an offial release SDK version 1.0 since Octobe 14.

If you are a developer you should access this site to learn more:
It is already built into Bing app for Health and Fitness app from Windows Store.