You are here

Feed aggregator

Little strange thing

MSDN Blogs - Sun, 03/06/2016 - 07:01

Last week, my colleague and I were working on an issue in which we had to restrict user from clicking the same submit button (on a form rendered in a browser) multiple times. We thought of handling it through the client side JavaScript. It was a simple fix to handle onClick event of the submit button and disable the button. We did it by using jQuery and the code shown below:

$("#submitButton").on("click", function()
{
$(this).attr('disabled','disabled');
});

We had tested the fix and was working fine. So, went back home.

THE NEXT DAY !!!

The next day we started seeing that user is unable to submit the form at all. (STRANGE !) After a bit of analysis we figured out that, this is happening only in Chrome browser while we had verified it in Internet Explorer.

This is interesting. (PROBLEM) Disabling the submit button on client-side using JavaScript is completely blocking the form from submitting in Chrome while it works well in IE and Firefox. (Not tested in other browsers).

To understand this correctly, I have created a simple HTML page - Page1.html has a form and submit button, which upon clicking submits the form to another page.

(FIX) Hence, as a work around, we had used setTimeOut() function of JavaScript as shown in the code below:

$("#submitButton").on("click", function()
{
setTimeout(function(that){
$(that).attr('disabled','disabled');
}, 1, this);
});

So, this way browser does not block the form from submitting and submit button gets disabled after 1 milli second from the button click action. This works well in three of the browsers - Chrome, IE, Firefox.

Attaching the HTML page used for this little experiment.

Visual Studio Team Services - NEW MARCH RELEASE: 13 Improvements (Viewing Test Results, Triggers, Board Drill Down, Testing from a Work Item, & More!)

MSDN Blogs - Sat, 03/05/2016 - 23:33

For the March 3 release, Visual Studio Team Services features 17 great improvements!

 

Several of these new features are actually groups of features, so there are a lot more than 17 improvements.

Let's get started by learning about the first new feature...

View test results for each release environment

We’ve enabled a feature that lets you view test quality and test results in context of release. The Tests tab in the Release summary page will show you test status of each environment in which tests have run. The status includes count of passed and failed tests, pass percentage, and test duration, for a particular environment or for the entire release, across all environments. You can drill down into the error message, stack trace and test attachments for failed tests without having to navigate away from the Release summary page. From here you can create bugs for failed tests and auto-populate the bug with related information (error messages, stack traces, etc.).

  

  

 

Next, here are all the new features:

  1. View test results for each release environment
  2. Triggers: Deploy based on completion in multiple environments (join)
  3. Epic and Feature board drill-down
  4. Exploratory testing directly from a work item
  5. Data collection: Image action log
  6. Create test cases based on Image action log data
  7. Assigning configurations to test plans, test suites and test cases
  8. Squash merge pull requests
  9. Clone in IntelliJ, Android Studio, etc.
  10. Gated builds for Team Foundation Version Control (TFVC)
  11. Automated testing on Azure environments
  12. NuGet package delist
  13. Office connector

 

That's 13 big improvements for VSTS! A lot of the improvements above are actually small buckets with multiple updates in them!

    

Find the details for each of those features for the March 3 release of Visual Studio Team Services:

https://www.visualstudio.com/news/2016-mar-3-vso

       

Have a good buy.

   - Ninja Ed

さくらの壁紙の思い出

MSDN Blogs - Sat, 03/05/2016 - 10:17

#win10jp

桜の季節が近づくと Windows 7 の桜の壁紙を思い出します。

当時のBlog(Windows 7 RC の壁紙)にも書いてありますが、マイクロソフト社内の壁紙コンテストで優勝して正式にWindows 7 の壁紙として採用されたもの。ファイルのプロパティを見るとメタ情報として名前を入れてくれていました。ちなみに優勝賞品も賞金も全くなし。ただ、日本のWindows開発チームから表彰していただいて立派な盾をいただきました。今でも感謝です。

それにしても、壁紙としての採用が決まった時に最初にやったのが「使用権をマイクロソフトに移譲する」と書いてサインした紙を本社にFAXで送ることw 今となってはいい思い出です。今はちゃんとプロの写真家の写真が毎日Bingの壁紙を飾っています。そういう意味ではもうこういったチャンスはないんだろうな、とおもって珍しくラッキーだった自分にびっくりしています。

とは言え、Windows 7 は今のご時世にはやはり古いOSです。取り巻く環境も大きく異なり、高度なセキュリティの脅威にさらされている今、Windows 10 へのアップグレードをお勧めしますけどね。今のセキュリティの怖さは自分の環境を壊される被害者になるのではなく、他人の環境を壊す加害者にされてしまうところです。そのレベルまで対応した新しいOSを使うことをお勧めします。

Restrict people picker to get users from a particular domain.

MSDN Blogs - Sat, 03/05/2016 - 05:23

 

We had a request from client to allow to pick up users in a people picker on a site from particular domain

Let me elaborate the SharePoint environment involved here

The SharePoint farm is on a domain say Contoso.  The client has another domain say Talespin.  There is 2 way trust relationship between Contoso and Talespin.

The SharePoint farm and machine is joined to Contoso.  Now for a particular site the client wants to be able to search and pick users from Talespin and not Contoso.

It took a long time for us to finally nail it.  Some of the commands available on net were working with resolving users but not with search on people picker.

Here are the commands that worked

$wa = Get-SPWebApplication -Identity http://webapp

#List the Domains 
 $wa.PeoplePickerSettings.SearchActiveDirectoryDomains 

#Below script will add domain to Search of people picker
 $wa = Get-SPWebApplication -Identity
http://webapp
$ad = New-Object Microsoft.SharePoint.Administration.SPPeoplePickerSearchActiveDirectoryDomain 
$ad.DomainName = "Talespin.local" 
$ad.IsForest = $true 
$wa.PeoplePickerSettings.SearchActiveDirectoryDomains.Add($ad) 
$wa.Update() 

stsadm -o setproperty -url http://webapp -pn peoplepicker-distributionlistsearchdomains -pv Talespin.local

#This will restrict people picker to resolve and search only from Talespin
stsadm -o setproperty -pn peoplepicker-searchadcustomfilter -pv "(&(userPrincipalName=*Talespin.local)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))" -url http://siteurl

Investigating issues with Continuous Deployment from Classic Azure Management Portal - 3/5 - Investigating

MSDN Blogs - Fri, 03/04/2016 - 20:13

Initial Update: Saturday, 5 March 2016 04:02 UTC

Starting approximately at 21:30 UTC on 03 March 2016, engineers are aware of an issue where a limited subset of customers may experience errors when they try to setup Continuous Deployment in Web Apps with Visual Studio Online Team Services via Classic Azure Management Portal. (https://manage.windowsazure.com).

Users are encouraged to use Visual Studio Team Services build definitions to setup continuous deployment for Azure Web Apps. Alternatively, users can use the Azure Portal (https://portal.azure.com) to setup continuous deployment when using Git repositories.

We are actively working to resolve this issue and apologize for any inconvenience.

Sincerely,
Manohar

 

PowerShell remoting & DNS

MSDN Blogs - Fri, 03/04/2016 - 12:22

I've noticed a strange thing: the PowerShell remoting works much faster if you use the remote computer's IP address for connection rather than a DNS name. Well, not everything is faster but the re-connections. PowerShell uses the HTTP (or HTTPS) protocol to send the data. This connection is cached between the successive commands but if you don't enter anything for a few minutes, this connection gets dropped and then re-established when you enter the next command. This re-establishment, and also the initial connection, works much faster with the IP address than with the DNS name. The effect is most pronounced if connecting over a WAN, such as to a VM in Azure. Don't know why. There shouldn't be that much delay with the DNS. It's a mystery.

Of course, this won't work with HTTPS connections, HTTPS connections require that the machine name matches the name in the certificate.

Technology and Friends: Sarah Sexton on Female Game Developers

MSDN Blogs - Fri, 03/04/2016 - 12:04

I was honored to join David Giard for an interview about women who build video games and the website I use to transcribe these interviews, www.shebuildsgames.com

Sample: Use JavaScript with OOM to create an email with an attachment and display it in Outlook for sending.

MSDN Blogs - Fri, 03/04/2016 - 09:26

This sample shows how OOM can be used with JavaScript from the command line. Use cscript to launch it - this will cause the script to write the output to the command window. 

 

// Use this command line:  cscript test.js

function test()

{

    WScript.Echo('Start -------------');

    try {

 

       var outlook = new ActiveXObject('Outlook.Application');

        var email = outlook.CreateItem(0);

        //add some recipients

        email.Recipients.Add('danba@microsoft.com').Type = 1; //1=To

 

 

       //subject and attachments

        email.Subject = 'Javascript test';

       

       WScript.Echo('Before Add()');

        email.Attachments.Add('http://contoso/documents/wonderful.pdf', 1); //1=Add by value so outlook downloads the file from the url

        WScript.Echo('After Add()');

       

       WScript.Echo('Before display()');

        email.Display();

        WScript.Echo('After display()');

    }

   catch (error)

   {

        WScript.Echo("Error - name:" + (error).name + "   \nMessage:" + error.message);  

   }

 

   WScript.Echo('End -------------');

}

test();

タッチパネル付きモニターはContinuum の入力として使えるのか?

MSDN Blogs - Fri, 03/04/2016 - 09:23

#wpjp #w10mjp

Micracast アダプタ ScreenBeam Mini2 にはUSBの入力ポートが付いています。ここにマウスやキーボードを指せば入力情報として入力され、それをMiracast の信号に乗せてデバイス側に返す UIBC の機能を使えます。

Miracast UIBC

さて、ここでタッチモニターのタッチ入力をマウスの代わりとして使えないか?ということで接続してみました。

結果は、残念ながら反応せず。そういやタッチパネルの入力ってマウスとかと違うのかな?違うのか。

結局わかったのはこのタッチの入力を返す技術は Haptic Feedback というらしく、通常のマウスとは異なるようです。知っている中で実装ができているのは Surface Hub 。Surface Hub はMiracastアダプタが付いたモニタの様に見え、接続するとhaptic feedback の機能により Hub の画面を触ってデバイス側を操作できるとか。技術的には特殊なのかな?

Windows の新機能をいろいろ考えたい。

Sample: Use OOM in an HTML page to create an email with an attachment and display it using Outlook.

MSDN Blogs - Fri, 03/04/2016 - 09:16

 Some customers use Outlook Object Model in IE.  This example shows how this might be done.  Note that IE security settings need to be opened up in order to make this work.   I wrote the sample below to troubleshoot issues with this type of usage of OOM.

 

To get this page to work you will need to allow active X scripting.  Note that this is considered to be a possible security risk, so its not something I would really recommend doing.

Go to Internet Explorer Options

Choose the Security tab.

Select Local Internet

Select Custom Level

Select ActiveX controls and Plug-Ins

Select Initialize and script ActiveX controls not marked as safe for scripting – set to Enable.

 

Here is a sample page which demonstrates using Outlook from an HTML page:

 

<html>
  <head>
    <script>
        function test()
        {
                       
            var sInfo = "";
            document.getElementById("TestResults").innerHTML = "";
           
            var StartTime = new Date()
            sInfo += "Start:  " + StartTime + "<br>";
           
            try {
                sInfo += "Create Outlook.Application<br>";
                var outlook = new ActiveXObject('Outlook.Application');


                sInfo += "outlook.CreateItem<br>";
                var email = outlook.CreateItem(0);


                sInfo += "email.Recipients.Add<br>";
                email.Recipients.Add('testuser@contoso.com').Type = 1; //1=To

                //subject and attachments
                email.Subject = 'Javascript test';
           
                sInfo += "email.Attachments.Add<br>";
                email.Attachments.Add('http://download.microsoft.com/download/5/D/D/5DD33FDF-91F5-496D-9884-0A0B0EE698BB/[MS-ASCMD].pdf'); 


                sInfo += "email.Display<br>";
                email.Display();
               
                //email.x();  Uncomment to check handling a failure.
                
            }
            catch (error)
            {
               
                sInfo += "Error(s) found:<br>";
                for (var er in error)
                    sInfo += "Error:  " + er + ": " + error[er] + "<br>";

            }
     
            var EndTime = new Date()
            sInfo += "End:  " + EndTime + "<br>";
           
            document.getElementById("TestResults").innerHTML = sInfo;
    }
    </script>
  </head>
  <body>
    Test OOM in an html page<br>
    --------------- <br>

    <input type="button" onclick="test()" value="Run Test"/>
    <br>
    --------------- <br>
    <p id="TestResults"></p>
    <br>
  </body>
</body> 
</html>

 

 

 

 

 

Microsoft Embracing Open Source

MSDN Blogs - Fri, 03/04/2016 - 08:15

Senior ADM, Brian Keyes spotlights the momentum of Microsoft embracing Open Source software and recommends you to take a moment to peruse the official Microsoft GitHub collection of  repositories.  As of today there are 21 pages of repositories.  Roughly 400 projects.  Included are the source code for the Edge JavaScript engine, the source code for the amazing TypeScript, as well as the source for VS Code.

Check out the full article here.

 Premier Support for Developers provides strategic technology guidance, critical support coverage, and a range of essential services to help teams optimize development lifecycles and improve software quality.  Contact your Application Development Manager (ADM) or email us to learn more about what we can do for you.

Experiencing Data Gaps for Multiple Functional Areas - 03/04 - Investigating

MSDN Blogs - Fri, 03/04/2016 - 07:49
Initial Update: Friday, 04 March 2016 15:48 UTC

We are aware of issues within Application Insights and are actively investigating. Some customers may experience Data Gaps. The following data types are affected: Availability,Customer Event,Dependency,Exception,Metric,Page Load,Page View,Performance Counter,Request,Trace.
  • Work Around: None
  • Next Update: Before 03/04 20:00 UTC
We are working hard to resolve this issue and apologize for any inconvenience.
-Ghouse

Windows Platform Developer Updates Feb 2016

MSDN Blogs - Fri, 03/04/2016 - 06:28

 

Windows 10 version 1511 is here, the first major update to Windows 10 since release in the summer. And it brings a number of exciting new features, such as the release of Windows 10 for Mobile, bringing Windows 10 to phone devices, including new phones supporting the amazing Continuum for Mobile where your phone can run apps on a connected screen such as a TV or monitor, and you can connect up a mouse and keyboard to give a PC-like computing experience all from your phone! There is also Microsoft Passport and Windows Hello, replacing passwords for logon with biometrics such as face, iris or fingerprint recognition. And for enterprises, there's also the release of the Windows Store for Business, a great new way to distribute apps to your company users.

For developers, there's a new SDK, Version 10586 which comes as a part of Visual Studio 2015 Update 1. Using the updated SDK and tools, you can build apps to take advantage of these new Windows 10 features.

Developers' Guide to Windows 10 videos where Andy and Shen give you everything you need to know in order to build compelling application experiences on Windows 10.

Developers Guide Updated 1511 http://aka.ms/dev1511

Visual Studio Tooling

Visual Studio Update 1 - https://www.visualstudio.com/en-us/news/vs2015-update1-vs.aspx 

New SDK Features

Windows.UI.Composition -- Provides APIs for user interface composition.
https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.composition.aspx 
OpenSource Gihub https://github.com/Microsoft/composition 

Windows.Devices.Perception - Provides classes for handling image frames from colour cameras, depth sensors, and infrared cameras.
https://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.perception.aspx

New design templates (http://aka.ms/windesign)

PowerPoint templates

This deck has everything you need to quickly mock up wireframes for UWP apps, including controls and layouts.

Adobe Illustrator templates

These Adobe Illustrator templates provide controls and layouts for designing UWP apps.

Adobe Photoshop templates

Controls and layouts for designing UWP apps in Adobe Photoshop.

UWP app design PDF

Get all of our design guidance as a PDF for easy viewing.

 

Get a Windows 10 development environment

Start your Universal Windows Platform development quickly using an evaluation virtual machine.

Try out the Windows 10 development environment without spending the time it would normally take to set up and configure a device for development or test use. Run this VM on your current Mac or PC for a 60-day evaluation of the Universal Windows Platform tools and technologies to accelerate bringing your existing code to Windows.

We’ve provided a Windows 10 development environment in a number of different virtual machine implementations- matched to the latest release and ready to go.

Download a virtual machine (Build 201602)

Choose your virtual machine implementation of choice to begin developing with Windows 10.

VMWare
Hyper-V
VirtualBox
Parallels

These installs contain:

Want to try Windows 10 we now have Evaluation VMs http://aka.ms/winvms

Windows Store for Business

Store management for organisations

Make volume purchases from the Windows Store

Distribute apps to employees

Create a private store (mix Store and private LOB apps)

Assign apps

Use MDM to distribute apps

Offline licensing

Manage licenses (assign / reclaim / re-use)

Publishers can create LOB apps for specific organisation

For more details see http://aka.ms/winbus

Developer Center Updates

Dev Center Multi-user + Role support

•Add additional users to your Dev Center account

All based around AAD identities

Dev Center Accounts still created with an MSA (owner)

MSA is required for app <-> Store association in Visual Studio

 

New Single age rating system for app submissions with IARC system which automatically issues required age ratings for all apps and games based on answers to a short questionnaire https://www.globalratings.com/for-developers.aspx

Windows 10 Momentum

200M PCs, tablets and phones running Win10
Fastest growing Windows
3B+ visits to Store since launch
2x paid transactions this “holiday season” vs last
Win10 customers generate 4.5x more revenue per device than Win8
Games by far most popular category (by DL) – 32%
Monetization IAP (49%), MS Ads (37%), Paid app (14%)

See Store trends at http://aka.ms/trends0216

Async printing helper for Universal Apps

MSDN Blogs - Fri, 03/04/2016 - 04:49
  • Printing data can be a complex task.
  • The printing API for Universal Apps is event-based and does not support async/await.
  • This helper wraps the printing API so that it can be used to print collections of data (e.g. list of customers) in a simple way. It is slightly similar to the Silverlight API (PrintDocument).

 

The code can be found here:

https://github.com/luiscantero/PrintHelper

これは日本のWPの新たなる一ページ:Windows 10 Mobile Insider Preview Build 10586.122

MSDN Blogs - Fri, 03/04/2016 - 03:11

#wpjp #wpdev_jp #w10mjp

下記Blogの(高橋忍のフレーバーを含めた)意訳です。

Announcing Windows 10 Mobile Insider Preview Build 10586.122

3/2にWindows 10 Mobile Insider Preview Build 10586.122 をSlow とRelease Preview リング向けにリリースしました。このInsider Preview 引き続き Windows 10 Mobile のデバイスからのフィードバックをいただくことを目的にリリースしています。さて、今回このInsider Preview の対象デバイスとして4つのデバイスを追加したことをご報告します。

  • MCJ Madosma Q501
  • BLU Win HD W510U
  • BLU Win HD LTE X150Q
  • ALCATEL ONETOUCH Fierce XL.

開発中の Fast Ring 用の更新はまだリリースできないため、一時的にこのビルドを Slow および Release Preview リングに対してリリースしています。

もし Windows Insider に既に登録されている方で更新についてのテストにご協力いただけるのであれば、Windows Device Recovery Tool を使っていったん WIndows Phone 8.1 に戻していただいたうえで、ストアから Windows Insider app をダウンロード・実行してSlow ないし Release Preview リングに参加していただければ、更新からこの 10586.122 を取得することができます。アップグレード中もしくはアップグレード後に何か問題があればぜひフィードバックをお寄せください。品質向上のためにご協力いただけることに感謝します。

今回のリリースでの修正・更新

  • Continuum における漢字入力の改善
  • 縦画面ビデオでのサムネールが現れるまでの時間を改善
  • テザリング(インターネット共有)でのモバイルネットワークの洗濯を改善
  • Edge でいくつかのサイトでワードフロー入力を受け付けない問題を修正
  • Edgeで全ての開いているタブを閉じる機能を修正
  • OOBE経由でMSAを追加するさいに落ちて、そのご再追加ができない問題を修正
  • WiFi 接続時のメールの同期の仕様を改善
  • Dusal SIM デバイスでの接続プロファイルのデータを改善
  • バッテリー消費量改善のためバックグラウンドタスクについていくつか更新
  • SDメモリーカードに保存するビデオの品質を改善
  • いくつかのケースにおける録画時の音声について改善
  • スタート画面、アプリケーション更新、フィードバックアプリについてのOSの信頼性を向上
  • アラームの信頼性を向上

皆様からのフィードバックをお待ちしています。

Validate XML with rich error output in the XML Task

MSDN Blogs - Fri, 03/04/2016 - 02:33
 

Validate XML documents and get rich error output by enabling the ValidationDetails property of the XML Task. For more info, see Validate XML with the XML Task in the SSIS documentation.

SQL Server Integration Services (SSIS) introduced the ValidationDetails property in SQL Server 2012 Service Pack 2 in July of 2014. This new property was not announced or documented at the time of its original release. The property is also available in SQL Server 2014 and in SQL Server 2016.

The following screen shot shows the XML Task Editor with the settings required for XML validation with rich error output.

 

Before the ValidationDetails property was available, XML validation by the XML Task returned only a true or false result, with no information about errors or their locations. Now, when you set ValidationDetails to True, the output file contains detailed information about every error including the line number and the position. You can use this information to understand, locate, and fix errors in XML documents.

The XML validation functionality scales easily for large XML documents and large numbers of errors. Since the output file itself is in XML format, you can query and analyze the output. For example, if the output contains a large number of errors, you can group the errors by using a Transact-SQL query, as described in this topic.

 

 

Sample output for XML that's valid

Here is a sample output file with validation results for a valid XML file.

<?xml version="1.0" encoding="utf-8"?>

<root xmlns:ns="http://schemas.microsoft.com/xmltools/2002/xmlvalidation">

       <metadata>

              <result>true</result>

              <errors>0</errors>

              <warnings>0</warnings>

              <startTime>2015-05-28T10:27:22.087</startTime>

              <endTime>2015-05-28T10:29:07.007</endTime>

              <xmlFile>d:\Temp\TestData.xml</xmlFile>

              <xsdFile>d:\Temp\TestSchema.xsd</xsdFile>

       </metadata>

       <messages />

</root>

Sample output for XML that's not valid

Here is a sample output file with validation results for an XML file that contains a small number of errors. The text of the <error> elements has been wrapped for readability.

 

<?xml version="1.0" encoding="utf-8"?>

<root xmlns:ns="http://schemas.microsoft.com/xmltools/2002/xmlvalidation">

       <metadata>

              <result>false</result>

              <errors>2</errors>

              <warnings>0</warnings>

              <startTime>2015-05-28T10:45:09.538</startTime>

              <endTime>2015-05-28T10:45:09.558</endTime>

              <xmlFile>C:\Temp\TestData.xml</xmlFile>

              <xsdFile>C:\Temp\TestSchema.xsd</xsdFile>

       </metadata>

       <messages>

              <error line="5" position="26">The 'ApplicantRole' element is invalid - The value 'wer3' is invalid

    according to its datatype 'ApplicantRoleType' - The Enumeration constraint failed.</error>

              <error line="16" position="28">The 'Phone' element is invalid - The value 'we3056666666' is invalid

     according to its datatype 'phone' - The Pattern constraint failed.</error>

       </messages>

</root>

Analyze XML validation output with a Transact-SQL query

If the output of XML validation contains a large number of errors, you can use a Transact-SQL query to load the output in SQL Server Management Studio. Then you can analyze the error list with all the capabilities of the T-SQL language including WHERE, GROUP BY, ORDER BY, JOIN, and so forth.

DECLARE @xml XML;

 

SELECT @xml = XmlDoc  

FROM OPENROWSET (BULK N'C:\Temp\XMLValidation_2016-02-212T10-41-00.xml', SINGLE_BLOB) AS Tab(XmlDoc);

 

-- Query # 1, flat list of errors

-- convert to relational/rectangular

;WITH XMLNAMESPACES ('http://schemas.microsoft.com/xmltools/2002/xmlvalidation' AS ns), rs AS

(

SELECT col.value('@line','INT') AS line

     , col.value('@position','INT') AS position

     , col.value('.','VARCHAR(1024)') AS error

FROM @XML.nodes('/root/messages/error') AS tab(col)

)

SELECT * FROM rs;

-- WHERE error LIKE ‘%whatever_string%’

 

 

-- Query # 2, count of errors grouped by the error message

-- convert to relational/rectangular

;WITH XMLNAMESPACES ('http://schemas.microsoft.com/xmltools/2002/xmlvalidation' AS ns), rs AS

(

SELECT col.value('@line','INT') AS line

     , col.value('@position','INT') AS position

     , col.value('.','VARCHAR(1024)') AS error

FROM @XML.nodes('/root/messages/error') AS tab(col)

)

SELECT COALESCE(error,'Total # of errors:') AS [error], COUNT(*) AS [counter]

FROM rs

GROUP BY GROUPING SETS ((error), ())

ORDER BY 2 DESC, COALESCE(error, 'Z');

 

Here is the result in Management Studio of the second sample query shown in the preceding text.

 

See Also

XML Task

XML Task Editor

Tutoriel : Premiers pas de développeur avec Docker, Azure et Visual Studio 3/3

MSDN Blogs - Fri, 03/04/2016 - 02:25

Dans la partie 2 de ce tutoriel, nous avons déployé une application console ASP.Net 5 dans un conteneur linux sur Azure. Pour réaliser cela, il nous fallait une VM linux avec l’agent Docker, que nous avons créé depuis le portail Azure.

Cette fois, nous allons déployer la même application mais dans un conteneur Windows, tout cela – de la création de la VM au déploiement de l’app - directement depuis Visual Studio.

Il faudra prendre quelques précautions dans le projet Visual Studio, pour bien dissocier les paramètres spécifiques à la cible du déploiement linux/windows: nous verrons cela en temps voulu dans la suite de l’article.

Voici les grandes étapes de ce tutoriel:

  • Créer la VM supportant les conteneurs Windows, depuis Visual Studio
  • Retrouver la VM sur le portail Azure (ce n’est pas nécessaire, mais ça peut toujours servir !)
  • Déployer l’application (et constater que le déploiement échoue)
  • Modifier le fichier dockerfile
  • Déployer l’application à nouveau
  • Et si chez moi ça ne marche pas ?

 

Entre temps, une nouvelle version du package des outils Docker pour Visual Studio est sortie. N’hésitez pas à la mettre à jour avec la dernière en date si besoin. (voir la partie 2 de ce tutoriel pour les détails d’installation)

Créer la VM supportant les conteneurs Windows, depuis Visual Studio

Placez-vous dans Visual Studio, sur votre projet

Cliquez sur le bouton droit et sélectionnez “Publish”

Après avoir sélectionné “Docker Containers”, cliquez sur le bouton “New”

Remplissez les champs, avec notamment l’image de l’OS qui sera Windows Server 2016 Technical Preview with Containers.

Les certificats Docker seront générés automatiquement si besoin, dans le répertoire .docker du profil de l’utilisateur.

Lorsque vous validez, le script PowerShell suivant est lancé.

Deploy-DockerAzureResourceGroup.ps1' -ResourceGroupName 'stephetutodockerwin' -ResourceGroupLocation 'westeurope' -TemplateFile 'C:\stepheWin8\Projets\DockerConsoleApp\PublishScripts\Templates\DockerConsoleAppDockerVM.json' -TemplateParametersFile 'C:\stepheWin8\Projets\DockerConsoleApp\PublishScripts\Templates\DockerConsoleAppDockerVM.param.dev.json' -DockerCertsDirectory 'C:\Users\stephe\.docker' -AdminPassword 'XXXXXX'

Il utilise un template ARM nommé DockerConsoleAppDockerVM.json que vous retrouverez dans votre projet, tout comme le script PowerShell d’ailleurs:

Retrouver la VM sur le portail Azure

Si vous jetez un œil à votre portail Azure, vous verrez que la VM (de type ARM : Azure Resource Manager qui est le nouveau modèle de VM) est en cours en provisionnement

Si tout se passe bien, VS vous prévient dans la fenêtre d’Output que le déploiement du template s’est bien passé.

Déployer l’application

Refaites un clic droit sur le projet pour déployer à nouveau le projet

Si vous cliquez sur “Validate Connection”, vous verrez apparaitre le petit icône check vert qui indique que la connexion au Docker host a réussi.

Cliquez maintenant sur le bouton “Publish” : aïe, le déploiement se passe mal’

Impossible de trouver l’image docker/aspnet ? Je parie que vous voyez où je veux en venir.

Modifier le fichier dockerfile

En effet, le fichier dockerfile présent dans notre projet est resté le même depuis le déploiement sous linux. Or les images docker permettant de faire tourner l’application sur Windows sont différentes. Pour rappel, notre dockerfile part de l’image microsoft/aspnet qui se base sur Mono. Vous trouverez plus de détails sur le sujet dans le 2ème volet de cet article.

Visual Studio est capable de générer le dockerfile qui va bien en fonction de la cible du déploiement, mais pour cela, le fichier ne doit pas encore exister. Donc nous allons renommer le .dockerfile existant en .dockerfile.linux:

Redéployer l’application

On relance le déploiement et on remarque que VS nous informe qu’il va regénérer le fichier puisqu’il mentionne “autogenerate” (c’est grisé, il faut de bons yeux !)

Remarquez que le Dockerfile contient maintenant:

FROM windowsservercore
ADD . /app
WORKDIR /app/approot
ENTRYPOINT DockerConsoleApp.cmd

Cette fois on part de WindowsServerCore qui correspond à l’image d’un conteneur de  Windows Server 2016 (Tech preview).

Au démarrage du conteneur, c’est le paramètre ENTRYPOINT qui sera utilisé pour démarrer l’application, à savoir le fichier de commande DockerConsoleApp.cmd.

Vous trouverez ce fichier dans un répertoire temporaire du profil de l’utilisateur : C:\Users\stephe\AppData\Local\Temp\PublishTemp\DockerConsoleApp82\approot

Si vous mettez le compilateur en mode verbose dans Visual Studio

Vous verrez apparaître le chemin utilisé pour la génération du package de déploiement et du .cmd (Menu Tools/Options):

Voici son contenu:

@echo off
SET DNX_FOLDER=dnx-coreclr-win-x64.1.0.0-rc1-final
SET "LOCAL_DNX=%~dp0runtimes\%DNX_FOLDER%\bin\dnx.exe"
IF EXIST %LOCAL_DNX% (
  SET "DNX_PATH=%LOCAL_DNX%"
)
for %%a in (%DNX_HOME%) do (
    IF EXIST %%a\runtimes\%DNX_FOLDER%\bin\dnx.exe (
        SET "HOME_DNX=%%a\runtimes\%DNX_FOLDER%\bin\dnx.exe"
        goto :continue
    )
)

:continue
IF "%HOME_DNX%" NEQ "" (
  SET "DNX_PATH=%HOME_DNX%"
)
IF "%DNX_PATH%" == "" (
  SET "DNX_PATH=dnx.exe"
)
@"%DNX_PATH%" --project "%~dp0src\DockerConsoleApp" --configuration Debug DockerConsoleApp %*

On voit que l’on utilise en fait dnx.exe qui est le host natif capable de prendre en charge l’exécution notre application console. Pour comprendre comment cela fonctionne, je vous suggère la lecture suivante, et notamment l’architecture ci-dessous:

Une fois le déploiement terminé, Visual Studio vous indique comment accéder à l’output de l’application:

Si vous copiez-collez cette ligne de commande dans un prompt, vous devriez voir le résultat suivant:

Et voilà….

Pour terminer, il vous suffit de renommer le dockerfile en dockerfile.Windows et de bien spécifier celui-ci dans le boite de dialogue servant au déploiement de l’application sur Windows. Il faudra faire de même avec le profil permettant de déployer sur Linux.

Visual Studio est aussi capable de suffixer le dockerfile tout seul lorsqu’il le génère : notamment si vous avez déjà un autre dockerfile suffixé dans votre projet : dans mon cas, à la génération du dockerfile, il l’a directement nommé dockerfile.Windows !

Et si chez moi ça marche pas ?

Si vous rencontrez ce genre de souci lors du déploiement de l’application:

Cela signifie qu’il vous manque certaines versions du runtime sur votre machine cliente. Pour les installer, il vous suffit d’utiliser l’outil dnvm en ligne de commande:

Pour voir les runtimes installés :

> dnvm –list

Pour installer dnx-coreclr version 1.0.0-rc1-final pour Windows avec l’architecture x64:

> dnvm install 1.0.0-rc1-final –r coreclr –arch x64

Veillez également à installer les dernières versions du SDK Azure et des outils Web pour Visual Studio, accessibles via le menu “Tools/Extensions & Updates”

Et après ?

Nous venons de découvrir comment déployer une application dans un conteneur Linux ou Windows, sur Azure, ce qui vous a permis de comprendre comment fonctionne Docker et comment il s’interface avec Azure et les outils de développement..

Mais se pose rapidement la question de la scalabilité et de l’orchestration, nécessaires dans la vraie vie c’est à dire dans un contexte de mise en production. Pour cela, il existe Azure Container Service qui est un service de plus haut niveau, qui vous permettra notamment de piloter des clusters, à travers des technologies comme Swarm ou Mesos.

N’hésitez pas à suivre les explications et le tutoriel de Julien Create a Docker Swarm cluster using Azure Container Service.

Office 365 Education Event with Coretek

MSDN Blogs - Fri, 03/04/2016 - 01:30

Last week, Microsoft, in partnership with Coretek, welcomed nine schools from the Hampshire area to the Microsoft UK Headquarters in Reading for an Office 365 in Education event.

This event brought together a partner, teachers and students with the purpose of showing students how they can make the most of Office 365. We focused on how teachers can enhance student's learning through Office features such as the OneNote Class Notebook, and the wealth of training resources available on the Microsoft Educator Community.

 

The day began with a talk from one of our education account executives, Richard Green, introducing what Office 365 Pro Plus Benefit is and what the key features are. It is interesting to see how many schools have the free benefit, but don’t know about the key features, for example, every student and teacher can download and install Office 365 on a number of different devices, at no cost to the individual.

Check your school's eligibility and download the latest version of Office now

Following this, our STEM lead Stuart Ball gave a hugely engaging talk on all the cool things you can do with Office, and more specifically the Office Mix add-on for PowerPoint that allows students and teachers to bring their presentations to live. His presentation focused on the ways you can build games in PowerPoint, create sounds add record their own audio and video commentary, all of which highly engaged the students and teachers alike.

 

 

While the morning consisted of informative talks about how to make the most out of your Office 365 package, the afternoon was full of interactive workshops, with different tasks for the teachers and students. The students were tasked with a 'pitch perfect' project. They had to create a one minute elevator pitch which they can use when they go back to school with the purpose of encouraging their peers to download Office 365. However, the challenge was that they were only allowed to use five slides, one word per slide, and each word can only begin with the letter 'S'. With this challenge in mind, the students set to work, as there was a huge prize up for grabs; a Microsoft and Coretek hosted Hackathon at their school!

At the same time, we conducted a CPD workshop with the teachers, focusing on the new Microsoft Educator Community. The site has a wealth of resources to support training and professional development which allows educators to stay current with the right mix of student-focused technology, experiential learning, and virtual collaboration to help students learn and develop. The feedback from this session was very interesting; we were showing the teachers all the key features that they can use on Office to enhance their teaching (Office Mix, Sway, OneNote), and although many were not fully familiar with these programmes, they now know where they can find training material and lesson plans on MEC as well as connect with each other, and more teachers around the world.

After exciting the students and teachers with a tour of the Microsoft campus, the day came to a close with the students presenting back their Office 365 pitches. This was a real test of teamwork and time management skills for the young students, and our team from Coretek who judged the competition were very impressed with all the teams that took part.

Due to the originality of their presentation and the great collaboration demonstrated by the group, Coretek awarded Wellow Primary School as the winners of the Pitch Perfect challenge. They have won the coveted prize of a Microsoft and Coretek hosted hackathon at their school.

Overall, we had some fantastic feedback from the event. All the students and teachers that attended went away with a greater understanding of the extra programmes and features that they can use in Office 365 to enhance their learning, how they can work together and collaborate, and for teachers, how they can create more engaging content and enhance students' learning. What's more, many teachers didn't realise how easy it was to find support on these programmes. Coretek will support all of these schools following the event, though there is also a constant community of support on the Microsoft Educator Community.

To download Office 365 for free, click here.

Sharing data between users of a Universal App

MSDN Blogs - Fri, 03/04/2016 - 01:24

 

How to use:

  • Enable the policy e.g. by creating a REG_DWORD value called AllowSharedLocalAppData under HKLM\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\AppModel\StateManager and set it to 1.
  • You can now run code similar to the following to access a shared file:

StorageFolder folder = ApplicationData.Current.SharedLocalFolder;

StorageFile file = await folder.CreateFileAsync("Test.txt");

await FileIO.WriteTextAsync(file, "Hello world!");

 

  • This code will create a file called Test.txt under C:\ProgramData\Microsoft\Windows\AppRepository\Families\<PACKAGE NAME>\SharedLocal\.

How to kick-start programming, when you know nothing?

MSDN Blogs - Fri, 03/04/2016 - 00:56

As an evangelist for Microsoft, I often get chance to interact with students from different parts of India. It’s always quite inspiring to meet these youngsters who are full of energy and desire to change this world for good.

During my recent trip to Narsee Monjee Institute of Management Sciences, I gave a day-long session on C# and Object Oriented Programming. After the session ended, one of the students hesitantly shared his dilemma with me. He talked about his insecurities and fear of programming and how difficult it is for him to catch up with some of his friends who have been programming since the first day of their college.

Rather frequently, I have started getting this question again and again from these future leaders about programming and the starting point to enter into this amazing world of coding.

I am writing this blog post to share my views regarding – How to be a kick-start programming, when you know nothing? I have tried my best to make it as generic as possible but still I am adding a disclaimer that every individual is different. You may or may not agree with my views.

All right! So let’s start our journey –

Firstly, about where to start, I would say in this connected world, we have innumerable resources available at our disposable just a click away.

Try to start learning about technology as if you are in kindergarten. Remember, those amazing days when there was no pressure and you enjoyed solving puzzles by making words.

Start small with no fears – Take any programming language and just start reading about it. Understand it and go slow.

There are some amazing resources and websites available like Code.org – which is pretty commendable as it gives you a feeling of accomplishment through its gamified system for completing programs on browser based system.

My favorite portal is Codeacademy.com due to availability of a large number of courses and pretty active forums to clear my queries.

Dilemma Stage after a week: Just by coding on these portals for 6-7 days, you can’t expect overnight success or achieve the “THE CODER” tag in your community and college. It takes lots and lots of effort initially to learn programming.

I really like this learning curve: 

I would suggest reading at least one book every month so as to understand the nitty-gritties of your preferred platform or language.

Start with something simple like “Let us C by Yashwant Kanitkar” and then move ahead slowly to slightly complex books. You can easily find multiple books according to your interest and technical aptitude.

Now, once you get a hang of the basics of your preferred programming language, it’s time to actually start building a solution. It can be anything – a calculator app, a chat bot, a small website based on RSS feed, solving problems on competitive programming websites or literally anything.

As long as you are applying your learnings in building something – You are on your way to become an expert.

Take help of various video tutorials and courses available online to give you a kick-start in actually building a solution.

I personally love MVA aka Microsoft Virtual Academy (I know its shameless self-promotion, but still, its literally the best). With more than 500 courses along with accessibility to download all the resources without paying a cent makes it my go-to portal for  technical learnings.

Pluralsight is another amazing portal with more than 4000 courses and detailed assessments. I have done a lot of courses on it for web platform BUT Its paid – tsk tsk L.

Attention MSDN Subscribers: There is a good news for you! MSDN Subscribers get Pluralsight membership free for 6 months and also amazing discounts and offers for extending it.

Here’s a list of resources which I really like:

  • Code.org
  • Code Academy
  • Code School
  • Pluralsight’s Programming for Kids
  • Head First Books
  • Khan Academy
  • Hour of Code
  • New Boston Videos on Youtube

I would conclude with this statement that – Programming requires patience, willingness to learn and positive mindset to excel. No good thing has even been done overnight except scoring 40 marks during engineering in just one night ;)

So, until next time – Rise and Shine.

I look forward to know more about your journey on “How you entered into programming world” and any other related information.

Feel free to comment, rate or tweet me at www.twitter.com/NowayHeCodes :-)


 

Pages

Subscribe to Randy Riness @ SPSCC aggregator
Drupal 7 Appliance - Powered by TurnKey Linux