Working with JSON in Swift – Swift Blog – Apple Developer

If your app communicates with a web application, information returned from the server is often formatted as JSON. You can use the Foundation framework’s JSONSerialization class to convert JSON into Swift data types like Dictionary , Array , String , Number , and Bool . However, because you can’t be sure of the structure or values of JSON your app receives, it can be challenging to deserialize model objects correctly. This post describes a few approaches you can take when working with JSON in your apps.

Source: Working with JSON in Swift – Swift Blog – Apple Developer

Improving the D/L Method using Machine Learning | Blog | Microsoft Azure

The Current D/L method is a statistical method invented by statisticians Frank Duckworth and Tony Lewis. It is designed to calculate the target score (or the PAR score) that the second batting team (in a rain-interrupted match) needs to achieve. Today, there are two D/L models/editions that are available to the cricket community: Standard Edition and Professional Edition. The Standard Edition is a chart-based model used for non-ICC match and local matches. The Professional Edition is a software-based black box model, and is used by the ICC for all official matches.

Source: Improving the D/L Method using Machine Learning | Blog | Microsoft Azure

What’s New in C# 7.0 | .NET Blog

C# 7.0 adds a number of new features and brings a focus on data consumption, code simplification and performance. Perhaps the biggest features are tuples, which make it easy to have multiple results, and pattern matching which simplifies code that is conditional on the shape of data. But there are many other features big and small. We hope that they all combine to make your code more efficient and clear, and you more happy and productive. Please use the “send feedback” button at the top of the Visual Studio window to tell us if something is not working as you expect, or if you have thoughts on improvement of the features.

Source: What’s New in C# 7.0 | .NET Blog

Auto versioning SharePoint Apps (and Sandbox Solutions)

TL; DR;

spav  is a simple tool which can be used to automatically version SharePoint App packages and SandBox solution packages. You can provide custom app versioning library to provide your own mechanism to build app or WSP. It also can be used to generate application version JavaScript file which can later used to inject into pages and use in client side.

https://github.com/SachiraChin/SharePointAppAutoVersioning#examples

This a project which I created to automate the versioning of SharePoint hosted app. Initially it started as small tool, but in order to make it usable to other developers, I have added few modifications to it.

First I will explain the reason I created this tool in the first place. Recently I was involved in development of SharePoint app which had rapid development cycle. Client was expecting fast builds which deployed in SharePoint Online site. Client used his app catalog to publish the developed application across multiple sites. First version of the application published in multiple sites without any issue, but when we had to release next version of the app, we faced few problems.

  1. Versioning of the app package
  2. Update exiting content published by app -> Solution feature versioning

In order to update an application which published via app catalog, next version must have version upgrade. It can be major, minor or even patch level update, whichever it is, it must be reflected on Version property in AppManifest.xml file. If we do not change version in this file, site collection administrators will not see an app update in Site Contents.

Even if we update app version in AppManifest.xml file, it will not update the content we added in the app if we do not version application features properly. You can read more about versioning features in this blog post. As you can see, update content of the an app not easy as we think, and it all depends on feature version.

In this version of the application, my target was very simple. I wanted to maintain same version throughout the application as well as all features. In this way, when I add or update a file in a module, it’ll automatically get replaced.

Introduction

spav  is a simple tool which can be used to automatically version SharePoint App packages and SandBox solution packages. It also can be used to generate application version JavaScript file which can later used to inject into pages and use in client side.

Usage

In order to use this tool inside Visual Studio, you have to add pre or post deployment step to SharePoint add-in project. Whether to use pre-deployement or post-deployment is up to your requirement.

-p, --path  [Required] Directory of application project. Can be taken from $(ProjectDir) MSBUILD parameter.

-m, --mode  [Required] Running mode.

  • AppPackage: Increases the version of application package(.app)
  • Wsp: Build a sandbox compatible package with feature versioning
  • AppPackageAndWsp: Update app package and create sandbox solution

-b, --build-config  (Default: Debug) Application build configuration. Can be taken from $(Configuration) MSBUILD paramater.

-j, --build-js  (Default: False) Build JavaScript file to use in versioning for client side versioning. This will work with parameters –js-path and –js-class.

--js-path  (Default: {Path}\applicationVersion.js) Save path for JavaScript file.

--js-class  (Default: appVersion) JavaScript namespace to contain application version.

--versioning-lib  (Default: AutoIncrementBuildVersion.dll) Library used to get build version.

--versioning-class  (Default: SharePointAppAutoVersioning.AutoIncrementBuildVersion.VersionProvider) Full path of class in versioning library.

--help  Display help screen.

Examples

Auto increment patch and build version of the SharePoint App package

Generate SandBox compatible solution with feature updates

Update app package version and generate SandBox solution

Build JavaScript file which can be used inside the application while updating version of app package

This will generate below JS file.

NOTE: Application will use 5 commented lines which is on top of JavaScript file to generate the next version. If you erase these lines, version will be resetted to 1.0.0.0. If you want to change major or minor version, you can change it in here and it’ll be reflected it next build.

You can access version values as below,

Use custom versioning library

You can write your own custom versioning library for your versioning purposes. In order to do that, you have to create new class library and add reference to SharePointAppAutoVersioning.Shared.dll  file which you can find in application folder.

Lets assume that dll from your project is ContosoApp.CustomBuildVersion.dll . In order to use this inside the application, you have to copy this file to location of spav.exe  path. After you copy it, you can use it like below.

I will explain in another post about tools and libraries which I used to develop this application. Meanwhile, you can check my repo here, fork it, do your customization and send pull request to me. I’d like to add new versioning libraries for different scenarios and make it usable for more people. 🙂 Happy coding!!

PowerShell is open sourced and is available on Linux | Blog | Microsoft Azure

Today, we are taking the next step in our journey. I am extremely excited to share that PowerShell is open sourced and available on Linux. (For those of you who need a refresher, PowerShell is a task-based command-line shell and scripting language built on the .NET Framework to help IT professionals control and automate the administration of the Windows, and now Linux, operating systems and the applications that run on them.) I’m going to share a bit more about our journey getting here, and will tell you how Microsoft Operations Management Suite can enhance the PowerShell experience.

Source: PowerShell is open sourced and is available on Linux | Blog | Microsoft Azure

Treat Bugs as Tasks in Visual Studio Online

When we create a new project in Visual Studio Online in Scrum process template, by default it’ll treat bugs also as backlog items. It does not us to use bugs as tasks. But in some cases, we may need to treat bugs as tasks as well. In this blog, I will explain how to use both modes on Visual Studio Online.

When we start development of an application, we have two options to manage bugs in development process.

  1. Bug as a task
  2. Bug as a backlog item

Bug as a task

When we treat bug as a task, we can add bugs under backlog items. When we use this scenario, we can only add backlog items to sprint. Under backlog item we can add bugs and tasks. This mode is not enabled by default in Visual Studio Online. These are the steps to enable it.

  1. Goto Team Settings in project
    team-settings-icon-in-project
  2. Goto Work Tab
  3. Goto section Working with bugs
    team-settings-working-with-bugs
  4. Select “Bugs appear on the backlogs and boards with tasks.”

When we change this mode, task hierarchy will look like below.

bugs-as-tasks-task-hierarchy

In sprint board, bugs can be tracked under the backlog item.

bugs-as-tasks-board

This is useful if project team is small and given bug is managed by only one person. If we need break it to multiple tasks, we can add sub tasks to bug. If there’s such requirement, it’s better to keep bugs as backlog items rather than manage it as tasks.

Bug as a backlog item

When we treat bug as backlog item, it’ll force us to add tasks under bug to track its state. This scenario useful when we split bug into multiple tasks which may be addressed by multiple people in the team. When we use this approach, task hierarchy will look like below.

bugs-as-backlogs-task-hierarchy

In sprint board, we can see that we can track state of each task of the bug and assign them to different people.

bugs-as-backlogs-board

This mode is useful when application is manage by large team or bug needs to assign to multiple people. In that case, we can create multiple tasks under the bug and track those separately.

Announcing ASP.NET Core 1.0 | .NET Web Development and Tools Blog

Today we are excited to announce the release of ASP.NET Core 1.0! This new release is one of the most significant architectural updates we’ve done to ASP.NET. As part of this release we are making ASP.NET leaner, more modular, cross-platform, and cloud optimized. ASP.NET Core is now available, and you can start using it today by downloading it here.

Source: Announcing ASP.NET Core 1.0 | .NET Web Development and Tools Blog

Get Tenant Id from SharePoint App | JavaScript

In rare cases, you may need to find id for Office 365 tenant or SharePoint app catalog tenant id. This solution is for you, who want to get tenant id or unique id for a SharePoint farm with in a SharePoint App using JavaScript.

This solution can only be used when host web has SharePoint App installed, reason for that is, in order to get tenant id, it uses the product id of the app. If SharePoint App is installed in the site, this solution can be used in the host web or in the app web.