Armstrong number the Python way

What is Armstrong number

Armstrong number of 3 digits is an integer such that the sum of the cubes of the digits is equal to the number itself.

Fun with Visual Studio

Let’s have fun generating Armstrong Number

 

We find the sum of the cube of  each digits

temp = num

while temp > 0:

digit = temp % 10

sum += digit ** 3

 

The Python logic

# Python program to check if the number provided by the user is an Armstrong number or not

 

# take input from the user

num = int(input(“Enter a number: “))

 

# initialise sum

sum = 0

 

# find the sum of the cube of each digit

temp = num

while temp > 0:

digit = temp % 10

sum += digit ** 3

temp //= 10

 

# display the result

if num == sum:

print(num,”is an Armstrong number”)

else:

print(num,”is not an Armstrong number”)

 

 

Open up Visual Studio

then open a Visual Studio project with Python

Screenshot (1390)

The program

Screenshot (1394)

Will try with 2 numbers

Let’s try 346

Screenshot (1391)

Screenshot (1392)

Now 371

It’s an Armstrong Number

Cubing numbers

3*3*3 + 7*7*7 + 1= 371 (Armstrong Number)

Screenshot (1393)

Conclusion

We will go through lots of tricky logic and simple one with Visual Studio in Python. We see it’s very easy to implement it.

 

Extending Hololens app

Tinkering with Hololens app

With ongoing process of development with Hololens in this article we will try to work on the code modify it to our liking

 

Let’s break the Hololens app

1

We will now work on modifying the spinning render cpp file now we need to check on which points we need to modify for Hololens rendering of the cube.

We attack the part where it is written as cube indices let’s look on changing the co-ordinates first.

static const unsigned short cubeIndices [] =

{

2,5,0, // -x

2,3,5,

 

3,4,1, // +x

3,1,7,

 

0,5,1, // -y

0,1,4,

 

2,3,7, // +y

2,7,6,

 

0,4,3, // -z

0,3,2,

 

5,6,7, // +z

5,7,1,

};

Now we run the app in Hololens emulator the output is as shown below

Screenshot (1386)

Further modifications to continue

Conclusion:-

We find out that it’s easy to change shapes of an object and the content needs to be changed in cube renderer cpp file. With changes we can get lot of effect on the object creation.

 

Python and Visual Studio 2015

Getting started with Python in Visual Studio2015

Python being one of the most powerful languages now with capabilities within Visual Studio 2015 we can make strikingly powerful applications

We will use Visual Studio 2015 template to create a  new app with Python

1

We  now open a project in Visual Studio with Python option

Screenshot (1367)

Now let’s make a simple program.we will just see fibonacci series in Python

we will use looping technique

Here is the code for it

def fib(n):

a,b = 1,1

for i in range(n-1):

a,b = b,a+b

return a

print fib(5)

Screenshot (1368)

Click on run to see the output.

Screenshot (1369)

Conclusion

We have seen how easy it is to write Python code in Visual Studio 2015 and compile it.

Getting started UWP webhosted app

Webhosting UWP app

Windows 10 UWP app is in an era where you can update a normal website completely transformed into a UWP functionality app.

Let’s check the flow how it happens

1

Let’s Start with a blank JavaScript  UWP template in Visual Studio 2015

Now we remove CSS,JS and WinJS foldersScreenshot (1353)

Add the website in start page and URI Rules

uri

Run the app

Screenshot (1356)

Conclusion

With help of Web hosted app we cab easily convert a normal website to UWP.

Hololens app with C++

Building Hololens app with C++ template

i)To start with make sure you have installed Visual Studio 2015 update 2

ii)Hololens Emulator

We would be showing development without Unity to start with.

Currently for development  from Visual Studio two languages are supported

i)C++

ii)C#

 

We will be covering C++ first

Open Visual Studio first

Then Click on new project

Screenshot (1325)

Leave the specification as it is

Screenshot (1326)

Click on Ok.

The project details in solution explorer.

Screenshot (1329)

Select it for Hololens emulator

1

Now click on yes for the build

Screenshot (1333)

Now the Microsoft Hololens emulator will come upScreenshot (1337)

The OS is startingScreenshot (1335)

 

The main screen when Hololens emulator starts

Screenshot (1338)

The simulator tries to map the surroundings

Screenshot (1339)

The Hololens emulator in action

Screenshot (1340)

Now  we will see the cube in action within Hololens frame

Screenshot (1341)

 

Conclusion

With the help of C++ and other Direct X technology we can build lot of immersive apps for Hololens experience. I hope you like my First post at TechNet with it more learning and more experience I will post my updates on this topic

 

Microsoft Hololens an Introduction

Introduction to Microsoft Hololens

Microsoft Hololens is a headset that revolutionize the way we perceive the interaction with Virtual world with very intuitive experience with holographic projection.

Hololens interaction

The general interaction occurs when we interact with an object

The interaction process are

i)Gaze :-

It allows us to simply look at an object like we target with our eyes hence Gaze.

ii)Gestures:-

It allows us to interact with the object which we are Gazing(or aiming at through our eyes).

There can be different forms of gestures

Hand Gestures Interactions tap, place and others.

iii)Voice:-

The interaction with an object occurs when we are gazing at it and speak voice commands.

blog1

Conclusion

The Microsoft Hololens experience is driven inputs which we interact with holographic objects  through Gaze,Gesture and Voice.We can bring highly interactive virtual world experience to life using Holographic projections.

 

Getting Started With Watson Node RED Advanced Labs And Using The Trade Off Analytics With Node-RED

The IBM Watson Developer Cloud (WDC) offers a variety of services for developing cognitive applications. Each Watson service provides a Representational State Transfer (REST) Application Programming Interface (API) for interacting with the services.

IBM Bluemix is the cloud platform in which you deploy applications that you develop with Watson Developer Cloud services.

In this part of the project you can find the advanced labs. In these labs different services are combined to build apps to show the possibilities of Watson in Node-RED.

  • We would be use a widget with Trade off Analytics

Before trying these labs you should already be comfortable with Node-RED flows and how to import flows.

Node-RED is a visual tool for wiring the Internet of Things. It is easy to connect devices, data and api’s (services). It can also be used for other types of applications to quickly assemble flows of services. Node-RED is available as open source and has been implemented by the IBM Emerging Technology organization. Node-RED provides a browser-based flow editor that makes it easy to wire together flows using the wide range of nodes in the palette. Flows can be then deployed to the runtime in a single-click. While Node-Red is based on Node.js, JavaScript functions can be created within the editor using a rich text editor. A built-in library allows you to save useful functions, templates or flows for re-use.

Node-RED is included in the Node-RED starter application in Bluemix (Bluemix is IBM’s Platform as a Service, free of charge) but you can also deploy it as a stand alone Node.js application. Node-RED can not only be used for IoT applications, but it is a generic event-processing engine. For example you can use it to listen to events from http, websockets, tcp, Twitter and more and store this data in databases without having to program much if at all. You can also use it for example to implement simple REST APIs.

Getting Started

There are two ways of using Node-RED

  • Node-RED stand alone
  • Node-RED on Bluemix (Bluemix is IBM’s Platform as a Service) Both ways are described in this article, but to save time for these labs it is recommended to use Node-RED on Bluemix.

Using The Trade Off  Analytics With Node-Red

The Trade-Off Analytics service comes with a very versatile user interface widget which can be used to display the trade-off analytics results and let the user interact with them.

To use the service follow the steps:

  • Sign Up for an IBM Bluemix Account https://console.au-syd.bluemix.net/registration
  • Create Appn
  • Then Choose Your App Template, Will be Creating An Web Application So I Select Web1
  • Then Choose Your Starting Point, for this I Am Choosing Browse Boilerplate3
  • You Can Select Any Of The Boilerplates, I Would Be Using Node-Red-Starter Application. This Application Demonstrates how To Run The Node-RedOpen –Source Project Within IBM Bluemix4
  • Create An App By Providing The Name5
  • After the App Is Created Go Back To The Dashbord.6
  • Then Add A Service Or API14
  • Add The Trade Off Analytics Service15
  • Create The Service19
  • After Your App Is Running Click On The App20
  • Click on Go To Your Node-Red Flow Editor7
  • Trade Off Analytics Widget Flow Constructio21

 

Deploy the flow and point your browser at

  •  http://manishai.mybluemix.net/tofaw. Rendering of the widget should start and eventually yield a screen such as23ConclusionHere we have used a Different service in Watson which is called as Tradeoff analytics and helps us in this scenario to do analysis of different phones such as Samsung , HTC, Nokia , Sony based on their Size ,Weight and Screen and this service is added in Node Red service with Bluemix.

    In this model we have seen how easy it is add different service with       Node RED and add other services for Watson to see how easily we create different use case scenarios for different products and situations.

    This is my second article and as my journey continues I would learn and share more.