Mixed Reality Techday event at Kochi

It's always great when you work with state-of-the-art technology. HoloLens is one such device. A unique, one of it's kind device. And more greatful when you share the knowledge with the community and mentor them.

I am part of technology community - K-MUG. Last month, we decided to take break from all seasoned topics and shifted gears to bring exciting and state-of-the-art technology to passionate audience. We hosted an exclusive event on Augmented Reality and Mixed Reality titled - Mixed Reality TechDay. I had unique opportunity to address an awesome crowd of technology enthusiasts - engineers, professionals, students and all passionate individuals.

We are overwhelmed to go house full.

An event that we dare claim went over the moon based on the feedback and the smiling faces of 60+ attendees.

More photos are available in our Facebook community page. Feel free to join and attend our next events.

Thanks.

 

//build/ Tour - Pune 2016

I have attended this year’s exciting //build/ tour in Pune. Last time, it was in Bangalore. Those who are new to //build/ tour - this event is a one-day technology event of the biggest developer conference powered by Microsoft where next generation technologies, technology roadmaps are showcased. More details here.

Beijing, China skyline at the central business district.

Undeniably great speakers have lined-up for the event and below are some of the notes that I managed to capture during the event, in no specific order.

 

Windows IoT & Azure

IoT has lot of offerings in Azure portal. Here goes the short list:

  1. Azure IoT Suite – business solution to manage your IoT devices
  2. Azure IoT Starter Kits – development board that are ‘Azure Certified for IoT’, sensors and actuators.
  3. Azure IoT Hub – connect, manage and monitor your IoT assets
  4. Azure IoT Gateway SDK – connect your devices (includes legacy devices) to gateways to manage at central point, run analytics and wherever on-premise computation is necessary. Typically used when your IoT components like sensors can’t be connected to cloud.

Now to remotely control UWP application running on Windows IoT you can use Windows IoT Remote Client app from Windows Store. More details on setting up the device and app is available here.

As a side note, Lambda Architecture is commonly used architecture for IoT.

 

UWP in Xbox

You can deploy UWP app to Xbox One devices, starting with Windows 10 Anniversary Update. All Xbox One retail kits can be converted to dev kit. UWP apps can be regular apps and games. Other than gaming experience, Xbox also provide TV experience which multiplies your dev opportunity. Xbox default sounds can be used for UWP apps so that user’s get the same experience across the app. More details here.

 

Augmented Reality in UWP

Vuforia SDK now can be used for Augment Reality in UWP apps. Vuforia SDK supports HoloLens too.

 

HoloLens Development

HoloLens SDK (with emulator) is available to public for developing holograhic apps. More details on getting started is available here. Most interesting info – in emulator you can use Xbox One Controller to navigate in your 3D world and do gestures like air-tap, gaze, etc. using controller buttons.

 

Xamarin

Xamarin iOS emulator is available with VS2015 Update 2. This will eliminate the dependency of a Mac machine for your iOS development. However, it is always advisable to test your app in real device before publishing to store. Also, you can take advantage of Xamarin Test Cloud to test your apps across different devices.

 

Project Westminster (Hosted Web App)

Project Westminster is a UWP bridge to bring your web apps Windows 10 platform. The demo of this session was indeed interesting. A hip-hop music composing website (web app) was converted to UWP app which runs on desktop and tablet. Then the same app is deployed on phone. In desktop and tablet, you can tap on any instrument to create music. However, the phone experience was surprisingly different. You can select an instrument and shake your phone. With respect to your phones movement, sound will be generated. Ain’t that sound interesting? That made the crowd applause.

The demo also showcased how you can access native APIs like live tiles, camera, etc.. The idea behind this concept is, leave Phonegap and other technologies behind, which has several device dependent limitations and embrace the UWP concept where you can access all the APIs like in native apps.

Hosted web apps are undoubtedly hosted in a server which means you need to be online to access the service. So what you’ll do when your app is offline? There is an tricky solution. Hosted web app can include msapp-error.html webpage which will be loaded when your app is offline. You can either show an offline message or show a minimal version of the app so that end-user’s experience is not affected.

 

Azure Microservice

Azure Microservice lets you breakdown you application into smaller independent services. One notable feature was when the newly deployed service fails (typically during an update), that service will be rolled backed to it’s older version automagically. Azure microservices can be written in an programming language and can use any framework.

Another great announcement,   Azure Data-Center > AWS + Google. Ain’t that sound great!

Cloud is the future inevitably.

 

Power BI

Power BI Embedded is available which allows you to integrate Power BI reports into your application. This is available in preview.

 

Cross-Platform Web App Development

Manifold JS – Lets you create hosted apps across platforms and devices. It’s a Node.js app.

Volron JS – a platform-agnostic tool for remotely debugging and testing your web apps. It’s powered by Node.js and Socket.io.

 

Pen and Ink

Windows 10 has lot of investment in inking API. The natural way of interaction where we often jot down notes in a paper using pen/pencil. Using pen or stylus, you can write on the screen and inking API will take care of converting that to it’s correct text. During demo, we are shown how you can fill in a form using a Pen. This is indeed amazing since it recognizes your hand writing and converts that to correct value.

If you take note (say, some reminder task) in Sticky Notes and launch Cortana, those text will be prompted to add as reminder in Cortana which automatically gets synced with your phone and you’ll never loose your important stuff. The way devices and services talks to each other is an amazing way to visualize.

You can read more about inking in windows 10 here, here or here.

 

Creative Animation with Composition API

Earlier, integrators (those who swims in XAML) used to do storyboard animations in XAML using Blend. The XAML framework sits on top of DirectX. Sometimes, we might need more smooth animation and fine-grained control over animation. The new Windows.UI.Composition API lets you go one-level down to the Visual Layer to write your fine grained animations using C#. This provide more control on your animations to do the vital things. XAML support is on it’s way. More details here.

 

Windows App Extension

You can register your app for a particular extension so that whenever a registered URI is triggered, your app will be launched. This is similar to deep-linking concept.

 

Store Engagement SDK

The catchy feature is you can use Feedback class in UWP apps to direct your Windows 10 customers to Feedback Hub, where they can submit problems, suggestions, and upvotes. Then, manage this feedback in the Feedback report in the Dev Center dashboard. More details here.

 

Project Centennial

Project Centennial is another universal bridge which lets you convert your legacy Win32 apps to UWP. You can convert your legacy apps using App Converter. This is preview stage. The converted app runs on desktop and tablets but not on any other form factors like phone, Xbox, etc..

For the demo, the popular game Quake or Doom (can’t recollect which one) from GitHub has been converted using this bridge and played right on the stage, without any issues. This bridge looks promising enough. However, the idea of this bridge is to port your app to UWP and use App Services to communicate with this UWP app to get your business data. That’s my best guess.

 

Cortana

Right now, Cortana is using Voice Command Definitions (VCD) files to listen to the commands. However, this will be replaced with another cognitive service – LUIS (Language Understanding Intelligent Service) in the long run. In a nutshell, Cortana starts learning you more personally than your spouse. Alarming!

 

Bot Framework

(Intelligent) Bot is going to be the next big thing which powers Conversation-as-a- Platform. Microsoft Bot Framework is available to create bots. You can leverage existing bots service or create a new bot of your own and teach the bots using machine learning.

 

Miscellaneous

Microsoft Graph Explorer – you can test run your Graph APIs here.

Shazham – Windows 10 version is developed as hosted web app and audio playback logic is written in C++.

 

conclusion

If you are waiting to hear about Windows Phone, then there are no news on windows mobile platform. Since, Windows 10 runs on one core and essentially you can target your app on any device running Windows 10; I don’t think we’ll hear news about any specific platform alone going forward. In short, Microsoft will be more interested to talk about Windows 10 in general than about any specific platform. Another fact I noticed was Microsoft was trying to target an era beyond mobile. Yes, they missed the mobility ship! The talk was more concentrated on services – bots, cognitive services, etc. that works in platform agnostic way.

 

That’s all about the event.

Hope you enjoyed this lengthy post.

Thanks.

Why you should learn Delegates?


What everyone should learn while start writing code is the Basic Fundamentals, which most of them doesn’t do (myself among the one). Instead they go behind the attractive features, which is easy to learn and understand. In short run, you’ll win. But, in the long run, you’ll fail or you’ll end up using more lines of codes than required or you’ll write the most ugliest code.

I’m no different and I end up writing bloody-ugly code, due to my ignorance, delay and laziness to learn the fundamentals.

Few months back, I’m playing with user-controls in Silverlight 4, in which I want to pass data from one user control to another. And, delegate is the most perfect and standard way to do that.

The Ugly side of Ignorance – Object Passing

My situation was like this, I have a main page (say, MainPage.xaml) in which I’m loading a User Control (say, DocumentDetails.xaml). The MainPage.xaml contains a Label control which displays the total number of documents loaded in the  DocumentDetails.xaml.

Something like this:

WithoutDelegate

What I’d done is, in my DocumentDetails.xaml, I created a property named DocumentCount whose type is Label. The purpose of this property is to keep a reference of the Label in the MainPage.xaml, so that any update to the property: DocumentCount will update the original Label content in the MainPage.xaml.

Here goes my (ugly) code:

Documents.cs (Custom Class)

/*** Documents.cs ***/
 
public class Documents
    {
        public int Id { get; set; }
 
        public string Name { get; set; }
 
        public string Type { get; set; }
    }

 

DocumentDetails.xaml (Design)

<!-- DocumentDetails.xaml (Design) -->
<Grid x:Name="LayoutRoot" Margin="10" Height="Auto" Width="Auto" 
HorizontalAlignment="Center" Background="White">
        <sdk:DataGrid AutoGenerateColumns="False" 
                      Height="Auto" 
                      Margin="10"
                      RowHeight="40"
                      HorizontalAlignment="Left" 
                      Name="dgDocuments" 
                      VerticalAlignment="Top" 
                      Width="Auto">
            <sdk:DataGrid.Columns>
                <sdk:DataGridTemplateColumn Header="Id" Width="50">
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Id}" />
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </sdk:DataGridTemplateColumn>
                <sdk:DataGridTemplateColumn Header="Name" Width="150">
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Name}" />
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </sdk:DataGridTemplateColumn>
                <sdk:DataGridTemplateColumn Header="Type" Width="150">
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Type}" />
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </sdk:DataGridTemplateColumn>
            </sdk:DataGrid.Columns>
        </sdk:DataGrid>
    </Grid>

 

DocumentDetails.xaml.cs (Code-Behind)

/*** DocumentDetails.xaml.cs ***/
public partial class DocumentDetails : UserControl
    {
        /// <summary>
        /// Reference of Label object from MainPage.xml
        /// </summary>
        public Label DocumentCount { get; set; }
 
        /// <summary>
        /// Constructor
        /// </summary>
        public DocumentDetails()
        {
            InitializeComponent();
        }
 
        /// <summary>
        /// User Control Loaded
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            List<Documents> olstDocs = new List<Documents>() { 
                new Documents(){ Id = 1, Name = "Name 1", Type = "Type 1" },
                new Documents(){ Id = 2, Name = "Name 2", Type = "Type 2" },
                new Documents(){ Id = 3, Name = "Name 3", Type = "Type 3" },
                new Documents(){ Id = 4, Name = "Name 4", Type = "Type 4" },
                new Documents(){ Id = 5, Name = "Name 5", Type = "Type 5" }
            };
 
            // Set Count
            DocumentCount.Content = "Total Docs: " + olstDocs.Count;
 
            // Bind Data
            dgDocuments.ItemsSource = olstDocs;
        }
    }


MainPage.xaml (Design)

<!-- MainPage.xaml (Designer) -->
<Grid x:Name="LayoutRoot" Background="White" HorizontalAlignment="Center">
        <Grid.RowDefinitions>
            <RowDefinition Height="40" />
            <RowDefinition Height="40" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        
        <!-- Count -->
        <sdk:Label Grid.Row="0" 
                   Grid.Column="0" 
                   Name="lblCount" 
                   Content="Total Docs: " 
                   VerticalAlignment="Center" 
                   HorizontalAlignment="Left" 
                   VerticalContentAlignment="Center" 
                   Width="120" 
                   FontSize="12" />
 
        <!-- Load UserControl -->
        <Button Content="Load Documents" 
                Grid.Row="1" 
                Grid.Column="0"
                Height="23" 
                HorizontalAlignment="Left" 
                Name="btnLoadDocs" 
                VerticalAlignment="Center" 
                Click="btnLoadDocs_Click"
                Width="150" />
 
        <!-- Container -->
        <StackPanel Grid.Row="2" 
                    Grid.Column="0" 
                    x:Name="stkpnlContainer" 
                    Height="Auto" 
                    Width="400" 
                    HorizontalAlignment="Left" 
                    Orientation="Vertical" 
                    Background="Gray">
        </StackPanel>
        
    </Grid>

 

MainPage.xaml.cs (Code-Behind)

/*** MainPage.xaml.cs (Code-Behind) ***/
public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
        }
 
        /// <summary>
        /// Load Document Control
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnLoadDocs_Click(object sender, RoutedEventArgs e)
        {
            DocumentDetails oDocDetails = new DocumentDetails();
            // Pass the Label reference
            oDocDetails.DocumentCount = lblCount;
 
            stkpnlContainer.Children.Clear();
            stkpnlContainer.Children.Add(oDocDetails);
        }
    }

 

So what’s the problem with this? It’ll work fine. Correct?

Well the problem is, I’m passing the object reference itself. And the situation is more worse, if I want to update more Controls in my parent form (here MainPage.xaml), which makes me to pass more control reference, in turn making it ugly.

The Powerful side of Fundamentals – Delegates

Well…Well…Well… There is a powerful solution to handle this called Delegates. Simply, Delegate is function pointer, the most common definition that you’ll hear, if you ask a good amount of developers! Another definition? They’ll scratch their head.

Windows and Web development relies on event-driven mechanism. When you perform an Action (Event, say Click), you need a Method/Procedure (Event Handler) to be invoked as part of the action, to perform an operation. And, Delegate acts as a conduit between Event Source and Event Handler methods. The delegate carries the information about the Event to the Event Handler.

In our situation, you can handle the total count displaying in the MainPage.xaml by;

  1. Declaring delegate & event in the DocumentsDisplay.xaml
  2. Registering event in the MainPage.xaml & defining the event-handler method to handle the raised event
  3. Here goes the code:
    DocumentDetails.xaml.cs
    /*** DocumentDetails.xaml.cs ***/
    public partial class DocumentDetails : UserControl
        {
            /// <summary>
            /// Delegate
            /// </summary>
            /// <param name="count"></param>
            public delegate void TotalCountHandler(int count);
     
            /// <summary>
            /// Event to fire the "Total Count" value
            /// </summary>
            public event TotalCountHandler Count;
     
            /// <summary>
            /// Constructor
            /// </summary>
            public DocumentDetails()
            {
                InitializeComponent();
            }
     
            /// <summary>
            /// User Control Loaded
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            private void UserControl_Loaded(object sender, RoutedEventArgs e)
            {
                List<Documents> olstDocs = new List<Documents>() { 
                    new Documents(){ Id = 1, Name = "Name 1", Type = "Type 1" },
                    new Documents(){ Id = 2, Name = "Name 2", Type = "Type 2" },
                    new Documents(){ Id = 3, Name = "Name 3", Type = "Type 3" },
                    new Documents(){ Id = 4, Name = "Name 4", Type = "Type 4" },
                    new Documents(){ Id = 5, Name = "Name 5", Type = "Type 5" }
                };
     
                // Set Count
     
                // Check whether event is registered or not
                if (Count != null)
                {
                    // Fire Event
                    Count(olstDocs.Count);
                }
     
                // Bind Data
                dgDocuments.ItemsSource = olstDocs;
            }
        }
    MainPage.xaml.cs
    /*** MainPage.xaml.cs ***/
    public partial class MainPage : UserControl
        {
            DocumentDetails oDocDetails;
     
            /// <summary>
            /// Constructor
            /// </summary>
            public MainPage()
            {
                InitializeComponent();
            }
     
            /// <summary>
            /// Load Document Control
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            private void btnLoadDocs_Click(object sender, RoutedEventArgs e)
            {
                oDocDetails = new DocumentDetails();
                
                // Register Event
                oDocDetails.Count += new DocumentDetails.TotalCountHandler(oDocDetails_Count);
     
                stkpnlContainer.Children.Clear();
                stkpnlContainer.Children.Add(oDocDetails);
            }
     
            /// <summary>
            /// EventHandler method that sets the Total Count
            /// </summary>
            /// <param name="count"></param>
            void oDocDetails_Count(int count)
            {
                lblCount.Content = "Total Docs: " + count;
     
                // Remove Event
                oDocDetails.Count -= oDocDetails_Count;
            }
        }

Preview

Delegate

Download Source

Hope this helped. Thanks!