Monday, June 27, 2016

How to call cURL from Command Line

Hi All,

I installed cURL tool on my windows 10 machine, after i installed it; I tried to use this tool to post JSON messages over HTTP web hook endpoint.  But when i open the command line and type in curl, i get the following error:

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

By default, when you install cURL it gets installed on this default directory:
C:\Program Files\cURL

If i navigate to the installation path in command line window and type in curl, the tool will start working. but because i don't want to remember this path every time i want to use this tool, i need to add it as a system variable so the system knows where to points to when i call it.

Here is how to accomplish this:

1) Open Control Panel.
2) Click on System and Security.
3) Click on Advanced system settings link on the left pane.
4) This will open system properties pop up window.
5) Click on Environment variables button from advanced tab.
6) Click on New button from Systems Variables section (bottom section).
7) Add the following variable name information:

Variable name: curl
Variable value: C:\Program Files\cURL\bin



8) Click on OK button.
9) Open a new window from command line and type curl.
10) Now you can start using curl tool from command line without the need to navigate to the installation directory of the tool.



Enjoy!


Saturday, June 25, 2016

Azure Notification Hub unable to upload .p12 for APN

Hi All,

While i was working to setup Notification Hub for APNS, I got to a point to upload the certificate i created from apple developer account to the Azure portal.

I was getting the following error every time i upload my .p12 exported certificate to Azure:



This is the error message: Error updating the Notification Hub

I tried to get more detailed error message, So i jumped into the old portal and i was getting more detailed error as shown below:


Error Message: "SubCode=40000. Failed to validate credentials with APNS. Error is The credentials supplied to the package were not recognized"

After around couple of hours, i found out that the Azure reference to setup APNS was not accurate enough to say exactly what to export after you installed the certificate into your machine.

Here is what you need to do to successfully upload .p12 file into Azure:

1) From Keychain tool, Select Keys from the left pane.
2) Expand the target key that certificate contains, Right click on the certificate only and click on Export.
3) Set the password for .p12 file and save it to your disk.
4) Visit the Azure portal, Select the exported certificate (.p12) file and set the same password you set earlier in step #3 and click upload.

You will be able to successfully upload your certificate to Azure!

Enjoy!

Monday, June 20, 2016

Python for .Net Developers

Hi All,

I have been working with Python recently and i would like to share a quick and easy tutorial to learn Python for developers with OOP experience such as: C#, JAVA or .Net experience.

This is a mini course, gets you up to speed to start developing in Python with no prior knowledge because it covers what every developers wants to know for Python programming language basics.

http://ai.berkeley.edu/tutorial.html#PythonBasics

Here is my takeaways of this tutorial:

1) Python uses indentation for code execution, Python doesn't use curly brackets for opening and closing functions, classes..etc as in C# or Java. So it is preferred to use tabs than spaces while coding.

2) You can use lists ([]), dictionaries ({key:value}), tuples (()), and sets (set([list])) for storing collections in code. Use an appropriate option as in your code case. Sets items has no duplicates. Tuples are immutable (Once it is created, you can't change it).

3) You can create main function as we do in Java or C# console apps as an entry point for your program.

# Main Function
if __name__ == '__main__':        
    // YOUR CODE HERE  

4) You can include other files in your python file by adding import statement: import myotherfile, note do not include .py in the name of your python file.

5) You can define classes and functions in Python. also, you can create instance and static variables for class members.

class Person:
    population = 0
    def __init__(self, myAge):
        self.age = myAge        --> Instance Variable
        Person.population += 1  --> Static Variable 

6) You can use Visual Studio Code as a development IDE to code in Python. Download & install VS Code for free and then install Python & Python VS Code extension. Here is the steps:

a) Download Visual Studio Code for free: https://code.visualstudio.com/Download
b) Install Python on your machine: https://www.python.org/downloads/
c) Open VS Code, Press F1 and then type install extension and hit enter and then type: python. VS Code provides intellisense & debugging capabilities for Python.



Enjoy!


More useful links:

1) Python Tutorial:
https://docs.python.org/2/tutorial/ 

Thursday, June 16, 2016

Unleash the power of office add-ins with Office Development Patterns and Practices

Hi All,

I was pleased to speak at Cap Area .NET SharePoint Special Interest Group user group yesterday.
In this presentation i covered the underlying concepts of extending office applications and how Microsoft is supporting the component architecture by enabling web extensiblity framework (WEF); hence the WEF is the core runtime platform for building web based extensions or addins to office applications.

I covered the following topics:
1) Office Add-Ins overview: Add-ins shapes/types, runtime framework, anatomy of office add-in.
2) Building Office Add-Ins using open source tools such as: Yeoman tool (yeoman.io) provides a scaffolding platform for office addins templates. while when creating an add-in using yeoman tool you will be able to use any text editor to develop your office add-in.

2) VS tools for Office Add-ins: this covers updated tools in Office Developer tools in VS 2015 version 2 that contains web addins and VSTO templates as well.



Code Samples:
1) UPS Tracker Add-in on Github is here.
2) Using Yeoman Tool for building Office Add-ins: https://code.visualstudio.com/Docs/runtimes/office


Enjoy!

Wednesday, June 15, 2016

Content was blocked because it was not signed by a valid security certificate when running Office Add-Ins

Hi All,

While i was developing an office add-in and using IE to view a deployed outlook add-in i was getting the following error:

Content was blocked because it was not signed by a valid security certificate.

It turns out that this issue is related to a self signed certificate that is being used on my local web server using gulp-webserver plugin; since i am using Visual Studio code in developing my office add-ins.

If you want to configure gulp server to use a certificate, open gulpfile.js in your project and add https to the configuration of gulp web server as explained here.

The other solution is to use chrome instead and not IE since IE requires self signed certificates to be added as a trusted certificate in your machine. So if you don't want to go through adding a self signed certificate to trusted certificates store, just use chrome and your add-in will load with no issues.



Hope this helps.

Monday, June 06, 2016

How to remotely connect to a linux based Spark Cluster in Azure

Hi All,

In this blog post i am showing how to connect remotely to a Linux based Spark cluster in Azure.

Today, Microsoft has announced Spark general availability in Azure, read the official announcement here. Technical announcement from SQL Server team is here.

Spark GA in Azure


Once you provision a Linux based Spark Cluster, you are going to need to remotely login to it using SSH to start executing Spark commands using Spark Shell.

Open Azure Portal, Search for your cluster or you can find Spark clusters under HDInsight clusters tab; if you don't have it add it as a favorite tab from browse button in the portal).


Click on Secure Shell button, this will open a new blade with a host name that we will use to sign in using SSH to Spark cluster and start using Spark Shell.

Secure SSH to Spark from Azure Portal
Copy the host name if you are using windows and then run PuTTY tool to connect to Spark cluster using host name, username and password you have set when you provisioned the cluster.

SSH host name config
Then, Open PuTTY tool and enter the host name and then click on Open button.


Then, PuTTY will prompt to enter your username and password, once you are logged in successfully, you are in Spark Shell to start working with Spark!.



Hope this helps.


Friday, June 03, 2016

Thoughts on Lambda Architecture

Hi All,

Recently i have read "Big data principles and best practices of scalable real-time data systems" by Nathan Marz & James Warren. The book is very informative on analyzing how to build scalable data systems using hadoop ecosystem.

Lambda Architecture


Regardless which tools you are using to implement this but i can say the biggest take away of this book is describing in detail Lambda Architecture (LA). I am new to LA and the way how this architecture is being laid out in building highly scalable big data systems.

LA provides a separation of concerns for building large data systems especially on separating the batch from serving and speed layers.

Lambda Architecture (LA) consists of main three layers:
1) Batch Layer: contains the original master data set (immutable, append-only data) and precomupte functions over the master dataset.

Hadoop is the standard batch processing system used for most high-throughput architectures. MapReduce is used for big data computational systems. Recently, Developers lean to use Spark as a new computation system for big data computing for its high performance & in memory processing.

2) Serving Layer: contains batch views that serves the precomputed results with low-latency reads.
Examples of serving layer technologies: Apache Cassandra, Apache HBase, ElephantDB, and Cloudera Impala.

3) Speed Layer. contains real-time views that fills the latency gap by querying recently obtained data. The speed layer is responsible for any data not yet available in the serving layer.

You can use Apache Storm to perform realtime computation in the speed layer.

It is recommended to use Apache Cassandra or Apache HBase for speed layer output while ElephantDB or Cloudera Impala for batch layer output.


Hope this article helps you in getting into designing big data systems with high throughput and low latency.

Enjoy!


Resources:
a) Lambda Architecture website:
http://lambda-architecture.net/

b) Cloudera Impala:
https://en.wikipedia.org/wiki/Cloudera_Impala


Wednesday, June 01, 2016

I was a hacker at First Ever White House Foster Care & Technology Hackathon

Hi All,

Last week i was honored to participate at first ever white house foster care and technology hackathon at the white house. Through out two full days meeting with SMEs, foster parents, foster care communities nationwide, we were able to craft solutions for issues we have in the existing foster care system.


Eight teams have participated in the technology hackathon to tackle different problem statements. and in less than 24 hours of hacking i was amazed with the type of innovative solutions that those hackers have come up with.

I was part of Microsoft team that includes my colleagues Stacey Mulcahy, Heather Shapiro and Paul DeCarlo. We have built "Ask Amy" a foster care digital counselor to help pregnant mothers with substance abuse to find resources near by where they live. We had also Scott Hanselman and Yossi Banai as our advisers.

Our team was amazing and we have learned a lot about the outstanding issues we have in foster care as we heard from social workers, federal agencies, legal agencies and foster care centers.

I had so much fun hacking with Stacey, Heather, and Paul. In addition, We had insightful discussions with Commissioner L√≥pez and Meagan Smith (US CTO) about challenges we faced in building our solution for substance abuse problem statement we are tackling.


Team Microsoft at White House Hackathon

Team discussion with Meagan Smith & Commissioner Lopez

You can check out what we have built "Ask Amy" in less than 24 hours here:

Thanks a lot for having me in this great initiative by the white house and looking forward to supporting more of these good causes. I would like to thank everyone who helped in managing, organizing or participating in this event.




Thanks all.

White house press release about the hackathon: