Speech: To cloud or not to cloud -fundamental

Microsoft Imagine” was held on the 16th of October, 2016 at Leading University . The event was organized by “Microsoft Student Partner(MSP) Community”. A total of approx 100 students were participated on the event.

Since most of the students were unknown with the cloud platform so before diving into the Azure specific session I took a cloud fundamental session. In that session I discuss what cloud is, what are the benefits they will get after moving on cloud, what are the cloud terminology developers use regularly etc.

lu-1

There was a QA part at the end of each session where I answer some interesting questions. Questions like how IoT fits with cloud, is it safe to store data in cloud etc.

lu-2

Slide that I covered during the event can be found below:

Advertisements

Speech: Microsoft Azure Overview

Microsoft Imagine” was held on the 16th of October, 2016 at Leading University . The event was organized by “Microsoft Student Partner(MSP) Community”. A total of approx 100 students were participated on the event.

“Microsoft Azure Overview” was the first technical session in this event. In this session I gave them a high level overview of azure, what they can do with it and how they can get up to speed with azure in a short time.

lu-3

Azure offer various services to accomplish different scenario, one of them is Azure App Service. Developer uses App Service when they want to focus on building unique features for their app and need the infrastructure to just work.

azure-app-service

There was a QA part at the end of the session where I answer Azure specific questions.

lu-4lu-5

Some of the students were keen to know how Machine learning service actually works, how this service could help them in their research.

machine

Slide that I covered during the event can be found below:

Asp.Net Core at Microsoft Developers Conference 2016

“Microsoft Developers Conference – 2016” was held on the 3rd of September, 2016 at Leads Training and Consulting Ltd. The event was organized by “Microsoft Technical Community – Bangladesh”. A total of 80 developers were participated on the event.

The event was conducted by Bangladeshi MVP’s. There were a total of 6 session on different topic like Microservices, Azure Service Fabric, Microsft Bot Framework, Asp.Net Core, Windows Platform Development and Sharepoint.

The event was inaugurated by the CIO, Mr. Papias Hawlader of LEADS Group. The event had drawn a very good response from the community.

One of the featured session of this event was the Asp.Net Core in Azure which was covered by me.

14207711_10210814684190097_5604712688542961348_o

The panel of speakers included Shahriar Hossain , Mahedee Hasan, Swagata Prateek, Atis Diponkar and Rahat Yasir.

Slide that I covered during the event is shown below:

Check out the video of that session here.

Facebook event page :https://www.facebook.com/events/1656181424655247/1658264587780264

Tuple gets more powerful with C# 7.0

Lately I was taking some developers interview and one of the question that I asked them was “How they can return multiple values of different type from a method“. Most of them came up with the answer of “ref” and “out” keyword, some also said they will wrap the result to a temporary object and they will return that object to the caller. While all of these answers are technically correct (although ref/out not works with async method), I realize that most of the developers are not aware of Tuple, a data structure that were introduced back on .Net 4.0

I talked with some of my colleague and they said they found it ridiculously bulkyYes, It was little bit bulky, BUT NOT ANYMORE with the release of C# 7.0

I will show the new lightweight syntax at the the end of this post. Feel free to jump on that section directly if you are already familiar with what Tuple actually is, how it works and so on.

 Here goes the code snippet:

As you can see from the code snippet the method OldWay_UserInfo returns a Tuple that ultimately returns two string and a int value. You can create Tuple in two ways. Using constructors for your type’s corresponding argument (line 6, TupleCreation_1) or using the static Tuple.Create method (line 8, TupleCreation_1).

Retrieving the result of Tuple is done by accessing the read only property (Item1, Item2, Item3, … Item8).

Note:

A tuple is an ordered, immutable, fixed size of heterogeneous objects. That mean the order of items strictly follows the order used at the time of its creation. Plus the size of the tuple was set at time of its creation. You can not add or remove items on the fly.

A single tuples could have a max 8 items. If I ever need to pass more then that I can always wrap the extra information inside a new tuple and pass that as the last argument (TRest) of my first tuple i.e. If you want to create a tuple with more items, you have to go for nested Tuples ( Tuple<T1, T2, …, TRest>). In fact, you could even put a third tuple inside the second and so on.

Accessing the last element (8th element) is little ticker.  I have to call the Rest property.

Tuple gets better with C# 7.0

With the release of C# 7.0, the usages of Tuple gets simpler then ever. I will re-write the first tuple example with the latest syntax. Lets not waste any time. Here is the new elegant snippet :

Don’t sweat to understand the underlying details. To me, it feels like, its basically syntactical sugar on top of the existing work. I can still access data with the read only property (Item1, Item2, Item3, … Item8) like I did before.

Calling Item1, Item2, …. etc does not make much sense often.  Simply because these names aren’t very descriptive. Sometime you might want to call them with more meaningful name, with the latest release you can achieve it like this:

This approach is good when I have zero or few params in the method signature. If I have good number of param in the method signature then I prefer to use the below style:

Here I am specifying element names directly in tuple literals (line 6, TupleCreation_5)

Caution:

Tuples rely on a set of underlying types which aren’t included in Visual Studio “15” Preview 4. Current work around is to install the nuget package System.ValueTuple

Tuple_1

Wrapping Up:

Tuples can be very handy for developers,  you can just return a Tuple and have a nice method signature without having to create a new POCO.

I am now Azure MVP

The story started long ago, long before I had passed the secondary school. I used to work for peperonity, world’s largest mobile site building service provider. I was not their paid employee, but I used to do community work for them. In order to help the people of peperonity community, I came up with the idea of two unique sites –  ask.help and free.tutorial which turned out to be the best service providing sites in their community in the year 2008.

After getting a recognition from peperonity community I was inspired to do more community works and engaged myself in community works for many organizations. However it turns out that joining the Microsoft Student Partner(MSP) Program was one of the best things I did at that time. Being an MSP I was responsible of sharing my technical knowledge with the academic community by arranging events, giving presentations and initiating projects. Soon I became the MSP lead in my campus. During that period I had participated in Imagine Cup and ended up being the runners up team in Bangladesh. At that time, I had also written my first ebook named “Microsoft Silverlight for Windows Phone” for which I got immense response from the community. In September 2014, three years after joining MSP, I ended my journey as an MSP.

Journey from MSP to MVP

If you see closely, you will see that the alphabet ‘S‘ in MSP is only two alphabets before the alphabet ‘V‘. To make the S into V was a dream for me, a burning desire to get to the next level. So, with a little knowledge of Azure I started this group to bring all the azure enthusiasts under the same hood in Bangladesh. Over time I learnt a lot from other community members and also started sharing my knowledge with others. I wrote blog posts, arranged several events, podcasts and then on the very first day of January 2016 I got mail from MVP panel.

1

I am now Azure MVP 😀

It turns out that was right about MVP. To become an MVP you need to have an intense appetite for technology, a passion to evangelize, a burning desire to convey it, a love of writing and speaking about it. I did try from the bottom of my heart to do all these and today I am awarded with the most prestigious award Most Valuable Professional (MVP) by Microsoft.

MVP_Logo

 

 

 

I would like to remember few people who helped me on the way. Avishek Ahmed is the key person who kicks the passion inside me for technology. He was probably the best mentor I  could ever get in my life.

Photo : Me with Avishek Ahmed

Photo : Me with Avishek Ahmed

And then there is Tanzim Saqib who kept pinging me to embrace new technologies. I still remember the day when Tanzim vai first told me to focus on cloud.

Tanzim Saqib

Photo : Tanzim Saqib

There is one more person who motivated me with his excellent effort and he is Swagata Prateek. The young, not too tall, funny guy who keeps motivating me to work. He never said me to do anything in the face actually, but his community works inspire me a lot.

Swagata Prateek

Photo : Swagata Prateek

This award wouldn’t have been possible without the support  from other community members. They helped me to arrange events, find sponsors, helped me with ideas, with feedback on articles and so on. Ashraf AlamMonjurul Habib, Shahriar Galib, Sk TajbirHasanuzzaman Shuvo are only a few of them. Special thanks to my beloved girl Anika Sayara.

If you are passionate with Microsoft products, I think you should check out this article. So. this is it. Thank You Microsoft and Happy New Year!

Azure WebJob SDK Intro

I have some fellow colleagues who are extremely talented but they don’t have much working experience with Azure. So each time they are assigned to a job where they need to interact with the azure for data,  they kind of struggle. For example, few days earlier one of them is assigned to a job where he have to resize all the images. Writing the code which can resize the image is not that hard. He did that part in fair amount of time. But he find it bit difficult to interact with the storage. To help from such situation Azure blessed us with Webjob SDK.

Azure Webjob SDK is all about model binding in the cloud. Making it easier to talk to storage ! This is helpful and can speed up work because now I don’t have to write stuffs to establish connectivity with azure storage. Instead, I can concentrate on the core business logic part and let Webjob SDK to handle the connectivity issue for me. The best part of Webjob SDK is that it offers stuffs out of the box like triggering. So now I can do something more meaningful like do some task upon the arrival of new files or information on queue or so.

The first step is to install the nuget package for Azure Webjobs. Adding package from nuget is damn easy, I open up my nuget console and hit the following command :

Azure_WebJob_SDK_01

Now, I need to initialize an object which will do all the heavy lifting for me, things like triggering, binding, invocation of function and so on. I can do that by initiating JobHost object. So, here is my entry point, canonical main function:

I press Ctrl+Shift+B to build the solution and everything seems fine. Then I have tried to run this solution. Boom! Now, whats that? Its a run time error! But I have not done anything except initializing the JobHost object. Whats causing the error?

When I look into the error message it says –
“Microsoft Azure WebJobs SDK Dashboard connection string is missing or empty. The Microsoft Azure Storage account connection string can be set in the following ways:

  1. Set the connection string named ‘AzureWebJobsDashboard’ in the connectionStrings section of the .config file in the following format <add name=”AzureWebJobsDashboard” connectionString=”DefaultEndpointsProtocol=http|https; AccountName=NAME;AccountKey=KEY” />, or
  2.  Set the environment variable named ‘AzureWebJobsDashboard’, or
  3.  Set corresponding property of JobHostConfiguration.”

The error message is helpful as it also indicates how to resolve the issue. But wait a minute.  I don’t have any plan to use storage yet, so why its asking me to set storage credential? Plus from my  Azure Webjobs deployment experience, I know Azure storage is not required for Webjobs ! So, why it is issuing this error now?

Well, even though I don’t use storage entities, I still need to configure it because WebJobs’ SDK use some blobs and other storage entities for its own tracking and operation.

Note: 

  • AzureWebJobsStorage connection string is required.
  • AzureWebJobsDashboard connection string is optional.  you only need it if you want to be able to use the Dashboard UI for logs, etc.

Luckily, I already have an storage account which I am going to use at this point. If you don’t have one you can create storage account easily. Make sure the storage is placed the same region as the host website.

Now that I have provided the required storage information I will no longer face the existing runtime error. However, I know the template still need one more tweaking before it finally runs without an error. To find out the error lets re-run our simple program.

Azure_WebJob_SDK_02 - Copy

As you can see the exception saying “can’t be invoked from Azure WebJobs SDK. Is it missing Azue WebJobs SDK attributes?” Resolving this issue is quite easy. I just have to Use public on the main program class.

I took all the moving parts and placed them on the right spot and now everything seems workable. Now, I can focus on our canonical main function –

A JobHost is an execution container for your WebJob which knows what all functions you have in your program. The  RunAndBlock() method will cause the JobHost to listen for any triggers on any functions that you define in this Host.

Before I move any further, PLEASE NOTE I am using WebJob 1.0.1. If you are using earlier version the code snippet that I am showing might not work for you!

The following code snippet has two methods.

  • ProcessText() and
  • CopyBlobToBlob()

The method ProcessText() will be triggered when a text file will be found in the blob under the container named “input-dir” with a extension matches to “.txt”.  After that it will write the file with the same name in “output-dir”.

Note : If you don’t have a container with the name “output-dir” in your blob then this method will create a container by itself.

Azure_WebJob_SDK_05

CopyBlobToBlob() method works like the same way ProcessText() does. But since here I am pulling images so instead of TextReader, I am using Stream. The attribute BlogTrigger[] gets fired when a new blob content appears in the blob container. The Blob[] attribute write new blob contents to specified blob container.

Wrapping Up :

Azure Webjob SDK simplifies the communication part between your app and the cloud storage. So developers can focus on their main business logic and and they can leverage their app with the powerful binding features that Webjob SDK offers. They can simple pass proper attribute in their method parameter to connect to Azure Storage (notably blobs, tables, and queues) and SDK will handle everything.

Reference :

Azure Webjob ebook is on the way !

Your_Voice_Counts_01

I have been writing tech articles on the blog for quite some time now, and what motivates me to write regularly is YOU. Each time I receive a query or a request over mail, I feel special, because I feel somehow this small attempt of mine to help you guys is paying off.

Lately, many of you have mailed me to say that you guys are enjoying the Azure Webjob Series and asked me whether I will be able to provide a pdf version of the series to make it easier for you to read. You have also asked my plan regarding ‘Azure Webjobs‘  series and what are topics I am planning to cover in my future posts.

well, I just want to say –

“Your Voice Counts !”

Azure Webjob ebook is on the way !

THOUGH I am not giving any particular release date just yet, I can promise you that azure webjob ebook will be available very soon. Till then you can visit my blog for new posts on this series.

Regarding the roadmap I have planned for azure webjobs, here it is –