Search Results For : microsoft

ML.NET Part 2 – Machine Learning

Last week, i did the first post on ML.NET covering the basics and its various steps required to get a model up and use it – I will cover how to go about preparing, coding and using them in the later posts.

Two of the key steps involved are
1. Loading the data
2. Transforming the data
3. Training and Generating the model
4. Using the trained model

In this tutorial, we will focus on getting the environment in your computer correct so that we can prepare and start doing ML.NET. Kindly note that this tutorial is written for Windows Environment. As of time of writing, i am on Windows 10 with Visual Studio 2017 Enterprise.

Installing MLNET

I attempted to start by calling the command (You can start by going to Command Prompt and type straight away)


but i was thrown with the error –

'mlnet' is not recognized as an internal or external command, operable program or batch file. 
'mlnet' is not recognized as an internal or external command, operable program or batch file.
‘mlnet’ is not recognized as an internal or external command, operable program or batch file.

I recognized that i do not have mlnet installed. I then run

dotnet tool install -g mlnet

and what? –

No executable found matching command "dotnet-tool"

Based on some search, concluded it is due to the fact that dotnet tool is only available in .NET CORE 2.1.3 onwards and I am running – 2.1.2

dotnet version
dotnet version

Went on to and downloaded dotnet core 2.2 (as of time of writing .net 3 is in preview and hence I did not use yet). Do note that the release was not compatible with VS 2017 and if you are using VS 17, there is another version for you to download.

After installing, restart your computer and let it install again by running the command.

dotnet tool install -g mlnet

Note that you have to wait. Nothing will happen for some time and it will just magically works after that!

mlnet installed!
mlnet installed!

ML.NET Introduction – Introduction
ML.NET Part 2 – Machine Learning – Environment setup

Microsoft Powerpoint 2010 – Inserting Offline Video

One of the good things in Microsoft Powerpoint 2010 is the ability to insert offline and online videos into your powerpoint presentation easily. Do look at this if you are wondering how to achieve it.

One of the common questions are what are the different format available,

Note Videos in the .mp4, .mov, and .qt formats can be played in PowerPoint
if the Apple QuickTime player is installed.

File format Extension More information
Adobe Flash Media .swf Flash Video This file format is generally used to deliver video over the Internet using the Adobe Flash Player.
Windows Media file .asf Advanced Streaming Format This file format stores synchronized multimedia data and can be used to stream audio and video content, images, and script commands over a network.
Windows Video file .avi Audio Video Interleave This is a multimedia file format for storing sound and moving pictures in Microsoft Resource Interchange File Format (RIFF) format. It is one of the most common formats because audio or video content that is compressed with a wide variety of codecs (codec: An abbreviation for compressor/decompressor. Software or hardware used to compress and decompress digital media.) can be stored in an .avi file.
Movie file .mpg or .mpeg Moving Picture Experts Group This is an evolving set of standards for video and audio compression developed by the Moving Picture Experts Group. This file format was designed specifically for use with Video-CD and CD-i media.
Windows Media Video file .wmv Windows Media Video This file format compresses audio and video by using the Windows Media Video codec (codec: An abbreviation for compressor/decompressor. Software or hardware used to compress and decompress digital media.), a tightly compressed format that requires a minimal amount of storage space on your computer’s hard disk.

Note The third-party products discussed in this article are manufactured by vendors independent of Microsoft; we make no warranty, implied or otherwise, regarding the performance or reliability of
these products.

Quoted from

Connecting to SQL Azure with PHP

To start, I would like to first say that although many PHP developers usually recommend MySQL as the accompanying database for PHP, it is not difficult to interface PHP with other databases such as SQL Azure, Microsoft’s cloud-based relational database offering.

PHP connects with SQL Azure in a similar manner as how it does with Microsoft SQL Server, ie through an interface known as the Open Database Connectivity (ODBC), which is actually the standard software interface for accessing databases. Each platform and database has its own implementation following the ODBC standard but for this tutorial, I’ll focus on PHP.

There are a few ways to connect your php site to MS SQL but the 2 main approaches are as shown in Figure 1.0.

1. Using the “php_mssql.dll” php extension requiring MS SQL Client Tools installed (Figure 1.0, right column).
2. Using the “sqlsrv” driver (“Microsoft Drivers for PHP for SQL Server”) requiring MS SQL Native Client installed (Figure 1.0, left column)

Figure 1.0

I will be using the 2nd approach for this tutorial because it supports both PHP 5.2 and 5.3, unlike the 1st which is not available for PHP 5.3.

Microsoft Drivers for PHP for SQL Server
As of 1 February 2011, the latest version of the driver is version 2.0.1 (30 November 2010).
You can grab it from
Once you have installed the drivers, you should see the following in the installation directory:

Figure 2.0

We will be using the “php_sqlsrv_53_nts_vc9.dll” library for this tutorial.
• “php_sqlsrv” –> Driver name
• “53” –> PHP 5.3
• “nts” –> Non-thread safe (The PHP FastCGI Handler of IIS handles thread-safe operations for PHP, use the non-thread safe version to reduce performance issues)
• “vc9” –> Library compiled using VS 2008, use vc6 (VS 6) if PHP is running on Apache
Configure PHP
1. Copy “php_sqlsrv_53_nts_vc9.dll” into the “ext” folder of your php installation directory.
2. Edit the php.ini to include the library

Figure 3.0

Microsoft SQL Server 2008 R2 Native Client
In order for the PHP for SQL Server Drivers to work, the necessary SQL Server ODBC drivers must be installed on the web server.
The version of the ODBC driver needed for SQL Azure comes with the SQL Server 2008 R2 Native Client.
You can grab it from

PHP Syntax
After all the preparation and configuration, here comes the actual thing -> Coding!
This tutorial showcases how to do simple CRUD (Create, Retrieve, Update, Delete) commands.
1. Connect to Database:

$serverName = “”;
$connInfo = array(“UID”=>”username@servername”,
$conn = sqlsrv_connect($serverName, $connInfo);

2. Insert data to Database (taking data from a html form text field):

$comment = $_POST[“txtComment”];
$comm = “INSERT INTO commentsqlazure (commentContent) VALUES (?)”;
$stmt = sqlsrv_prepare($conn, $comm, array(&$comment));
$result = sqlsrv_execute($stmt);

3. Update data in Database:

$Id = $_POST[“txtUpdateId”];
$comment = $_POST[“txtUpdateComment”];
$comm = “UPDATE commentsqlazure SET commentContent = ? WHERE id = ?”;
$stmt = sqlsrv_prepare($conn, $comm, array(&$comment, &$Id));
$result = sqlsrv_execute($stmt);

4. Remove data from Database:

$Id = $_POST[“txtRemoveId”];
$comm = “DELETE FROM commentsqlazure WHERE id = ?”;
$stmt = sqlsrv_prepare($conn, $comm, array(&$Id));
$result = sqlsrv_execute($stmt);

5. Retrieve data from Database:

$comm = “SELECT id, commentContent FROM commentsqlazure”;
$stmt = sqlsrv_query($conn, $comm);
while($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC))
echo $row[“id”].” “.$row[“commentContent”].”

6. Close connection and release resources:


You can download the project file from here.

Please take note that you have to change the Server Name, Username, Password at the connection string to make this work. You should run the following script to the table first.

Credit to Luke Ng.

How to use Back Button on Windows Phone 7

Credit to Steven, for allowing me to post this up on my blog.

Recently, I worked on an app for the Windows Phone 7 platform and submitted it to the marketplace for certification. I’ve learnt many things and gained many insights after going through this process and would like to share one of these with you, developers and potential developers of the Windows Phone 7 platform.

Throughout this post, I will be making references to the official Windows Phone 7 Application Certification Requirements document (WP7ACR) which can be downloaded at

Under Section 5.2.4 of the WP7ACR, clause a, it is stated that:

Pressing the Back button from the first screen of an application must exit the application.

Developers who are creating apps with multiple pages must give special attention to this clause because pressing the back button automatically brings the user to the previous page, regardless of whether the user is at the first screen or not. Consider the following example:

In this app, there are 2 pages. Page1 goes to Page2 via a button with the following logic:

NavigationService.Navigate(new Uri(“/Page2.xaml”, UriKind.Relative));

Page2 goes back to Page1 via a button with the following logic:

NavigationService.Navigate(new Uri(“/Page1.xaml”, UriKind.Relative));

Each time that line of code is executed, it is actually creating a new instance of the page defined under the new Uri. Therefore if the user navigates in this manner:

  1. User starts the app.
  2. User navigates to Page2 via button.
  3. User navigates to Page1 via button.

At this point in time, the user is at the first page of the application. If the user presses the back button, he will be brought back to Page2 instead of exiting the app, which is wrong and will result in a failure of the certification process.

There is no API in the Windows Phone 7 SDK similar to the Application.Exit() function found in the average C#.NET Windows Forms application. For this reason, we must overcome this problem by navigation by page hierarchy. That is to say, when the user navigates from Page2 to Page1 via the button, instead of treating Page1 as a new page, the developer should instead use this line of code for the navigation purpose from Page2 back to Page1:


By doing this, the developer is essentially coding the button to function exactly like what the back button does on the Windows Phone. In this way, the app will always exit when the back button is pressed on the first page because the first page is always the only record under the action history when the user is on the first page. The diagram will then look like this:

Therefore we have successfully adhered to Section 5.2.4 of the WP7ACR, clause a. This is how we can effectively use the Back button and pass certification for functions relating to the back button.

Developing application on Windows Mobile Platform

Chirs Chin, Developer Marketing Director, Microsoft Singapore came to MSP (Microsoft Student Partner) meet on Saturday to give us a quick talk on Windows Mobile 6.5 (, abit on Windows Mobile Marketplace and asked us to submit applications for certification if we can. Certainly, he got me excited and right after my exam on Wednesday afternoon, I begin to develop my first Windows Mobile Application. As a student, we should try everything. :p

I posted it on my facebook and twitter and it seems like it gotten some attention from my friends. Some of my friends, my classmates and friends outside, asked me whats the difference in developing a client-side application and mobile application, I will say beside the idea that should be generated is a bit different, the rest are the same. I will be covering this later.

On Thursday night, Microsoft Singapore has a Mix-It-Up event and the speaker is Chris as well. Went down and listen what he has to present and what others are presenting. A group of students and 2 companies presented their product. I am really impressed by what the students and HNL had done. =)

Let me point out some of the differences here.

1. The normal application we are developing on VS08, we normally use .Net framework 3.5 but for a windows mobile application, we use .Net Compact framework 3.5 ( )

2. Can we develop a silverlight application on Windows Mobile since silverlight is cross platform? At the moment, its a no. I believe something is coming out soon though ( After doing a search on bing, )

3. I am developer, what is the link to Windows Mobile Marketplace?

4. Where can I find applications which I can buy for my Windows Mobile phone?

5. I want to start developing. Where is the SDK?
You might want to have a look at the toolkit as well

Hopefully my application I am developing will be a success though I am facing some difficulties now. =)

Follow me at @limguohong