You are here

Feed aggregator

Azure Japan Team Blog 更新ポリシー変更のお知らせ

MSDN Blogs - Tue, 06/30/2015 - 23:30
7 月 1 日より、下記の通り本ブログの更新ポリシーを変更させていただきます。この変更は、読者の皆様にとって “より重要な内容を短時間でコンパクトに把握していただける“ ようにすることを目的としています。 過去 1 か月分のAzure 公式サイト (英語) のブログ投稿をインデックス化し、概要を日本語で解説したものを月次で投稿します。 過去 1 か月分の外部メディアに掲載された Azure 関連記事一覧(例: 5 月分は こちら )を投稿します。 緊急の告知が必要な内容については月次更新を待たずに投稿します。 これまでは、Azure 公式サイト (英語) の ブログ 投稿の主だったものを日本語訳して、こちらに投稿してきました。しかしながら昨今の英語版ブログの投稿本数の増加にともない、似た内容の投稿が複数存在してしまったり、どこまでがニュース性の高い投稿で、どこからが開発ガイド的なものなのかなどが端的にはわかりにくくなってきておりました。そのため、本当に重要な内容をまとめて定期的に把握いただくことを目的に、この度のポリシーの変更を行いました...(read more)

Dynamics GP - Implementación de Reportes de SQL Server Reporting Services en un entorno Multiserver

MSDN Blogs - Tue, 06/30/2015 - 23:18
 

Este ejemplo muestra una forma de implementar los reportes de SQL Server Reporting Services en un escenario de instalación Multiserver.

Servidor Web - IIS

1. Exportar el certificado utilizado en el servidor.

a. Abrir el IIS
b. En la ventana de Inicio (Home) del servidor Web, seleccionar el icono Server Certificates.
c. 
d. Seleccionar el certificado utilizado en la instalación y, haciendo clic derecho sobre el mismo seleccionar la opción Export.
e. 
f. Seleccionar una ruta y una contraseña para guardarlo.
g. 
h. Copiar el archivo generado al Servidor de SQL.
i. 

 

Servidor de SQL

1. Abrir la ubicación donde se guardó el archivo exportado del certificado.
2. 
3. Hacer doble clic sobre el certificado para iniciar el proceso de importación del certificado.
4. 
5. Presionar el botón Next
6. 
7. Ingresar la contraseña generada en el proceso de exportación.
8. 
9. Seleccionar como Certificate Store la opción de Trusted Root Certification Authorities.
10. 
11. Presionar el botón de Next.
12. 
13. Terminar el proceso de importación con el botón de Finish.
14. 
15. Ingresar a la ruta Inicio | Ejecutar (Start | Run) y teclear “MMC”.
16. 
17. Se abrirá la Consola de Administración de Microsoft.
18. 
19. Abrir la opción File | Add/Remove Snap-In.
20. 
21. Seleccionar el Snap-in de Certificates y el botón Add.
22. 
23. Seleccionar en la ventana Certificates Snap-in la opción de Computer Account y presionar la opción Next.
24. 
25. En la ventana Select Computer seleccionar la opción Local computer: (the computer this console is running on) y presionar el botón Finish.
26. 
27. Presionar el botón OK para terminar el proceso.
28. 
29. Validar que el certificado se haya importado de forma adecuada en la ruta Certificates | Trusted Root Certificates Authorities | Certificates.
30. 

 

Servidor de SQL – IIS

1. Abrir el IIS en el servidor de SQL.
2. Ingresar al icono de Server Certificates en la página de inicio (Home) de IIS.
3. 
4. Selecciónar la opción de Import (clic derecho) y seleccionar la ubicación del certificado.
5. 
6. Ingresar la contraseña asignada al momento de exportar el certificado.
7. 
8. El certificado será importado de la siguiente forma:
9. 

 

Servidor de SQL – Reporting Services Configuration Manager

1. Abrir la aplicación Reporting Services Configuration Manager en la opción Web Services URL. Presionar el botón Advanced y en la sección Multiple SSL Identities for the Report  Server Web Service seleccipnar el Add.
2. En la ventana Add a Report Server SSL Binding seleccionar el certificado importado (WILDCARD) y presionar el botón OK.
3. 
4. Presionar el borón OK en la ventana Advanced Multiple Web site Configuration.
5. 
6. Presionar el botón Apply en la ventana principal de Web Service URL. Aparecerá la URL asociada al certificado.
7. 
8. Ingresar a la opción de Report Manager URL y presionar el boton Advanced. En la sección Multiple SSL Identities for Report Manager presionar el boton Add. En la ventana Edit a Report Manager SSL Binding agregar el certificado importado previamente (WILDCARD)
9. 
10. Presionar OK en las ventanas Edit a Report Manager SSL Binding y Advanced Multiple Seb site Configuration. En la ventana principal de la opción Report Manager URL presionar el botón Apply y se actualizará la URL correspondiente al certificado.
11. 

 

Servidor de SQL – Dynamics GP – Implementación de Reportes de Reporting Services.

1. Ingresar a Dynamics GP para realizar la implementación de los reportes de Reporting Services, usando la URL definida en el certificado.
2. 


Configuración Adicional de Reporting Services.

1. Ingresar al sitio de Report Manager usando la URL generada en la implementación de los reportes. Ubicar la carpeta Data Sources y selccionar la fuente de datos correspondiente a la implementación (GPTWO en este ejemplo).
2. 
3. Ingresar en el Data Source correspondiente para poder abrir la configuración. Nos debereemos asegurar que modifique la siguiente configuración:

a. En la opción Connection String dejar solamente la siguiente cadena:

i. Data Source= GPSQL;Initial Catalog=TWO; (Eliminar la opción Integrated Security=True)
ii. En la opción Credentials stored securely in the report server ingresar las credenciales del usuario “sa”.

b. Probar la conexión seleccionado el botón Test Connection.
c. Presionar el botón Apply para guardar los cambios.

4. 

 

Prueba de la implementación en Dynamics GP

1. Ingresar a Dynamics GP y abrir cualquier ventana que contenga una lista de reportes de Reporting Services, en este caso, del módulo Financiero (Financial).
2. 
3. Ejecutar un reporte. En este caso “Accounts Payable Days Outstanding Details”. Se deberá observar que la URL está asociada al certificado utilizado en la instalación (WILDCARD).
4.   

Espero que este procedimiento les sea de utilidad.

 

 

 

Diamond dependencies

MSDN Blogs - Tue, 06/30/2015 - 23:00

 How can you tell if you’re a smart engineer? What separates people who go through the motions from those who really get it? Second-order effects. Anyone taking an introductory software class can learn what changing a line of code does to a function, but engineers who really understand programming will see the cascading impact of that change up and down the stack. It’s true in all fields—first-order effects are easily surmised and explained with simple linear relationships, but second order effects are subtle, nonlinear, and far more difficult to master and control. That’s why I ask job applicants to answer only coding questions that require nested loops or multiple call levels to solve.

Second-order effects are at the heart of Microsoft’s current challenges. We want to increase our agility and responsiveness to customers and the market, yet many of our current tools, techniques, and teams are built around shipping every year, not every day. I’ve written about teams Staying small and using fast iterations to make Data-driven decisions. While numerous teams, particularly those providing online services, are meeting or exceeding the pace of the market, a large portion of Microsoft still trudges along.

What’s holding us back? In part, a legacy attitude and approach sustained by legacy leadership. But at the heart of the problem is a second-order effect that forces our tools, techniques, and teams to always operate at enormous scale, which slows us down and inhibits our ability to compete. That second-order effect is diamond dependency, and until every team tackles it directly, our agility will be anchored to an anachronism.

Eric Aside

At one time, customer-centered design was at the heart of Microsoft’s challenges, but we’ve gotten far better in that regard. It’s still a work in progress, but our end-to-end experiences often surpass those of our competitors and surprise our critics.

What’s this now?

 A diamond dependency refers to a software component (D) that depends on two components (B and C), which in turn each depend on the same fourth component (A). Changes to component A create a second-order effect on component D through interactions with components B and C. This second-order effect is subtle. Some engineers don’t realize when a diamond dependency exists, even when they are the ones who inadvertently created it.

However, diamond dependencies dramatically decelerate developer dynamism. If the developers of component D want to use a new version of B that depends on a new version of A, they must also wait for a new version of C that works with the new A. The diamond dependency indirectly couples components B and C, creating a bottleneck that slows everyone down.

Then again, diamond dependencies are very common and often desirable. They result directly from shared code and shared libraries. Unfortunately, to keep dynamic diamond dependencies in sync, teams must use enormous builds supported by huge source control repositories. Without those big builds and repositories, changes to components A, B, C, and D would inevitably break each other and render the overall codebase useless. Enormous builds and huge repositories might slow our agility, but that’s the only way for us to have reliable builds, right?

Welcome to the 21st century

To maintain agility and isolation of individual components in the face of diamond dependencies, modern web services have multiple versions of each component service running in production at the same time. On a PC, this would be like multiple versions of the same DLL being loaded and active simultaneously.

Running multiple versions of components simultaneously breaks the indirect coupling of components B and C. Component D can call into a new version of B that uses a new version of A, while still calling an old version of C that uses a simultaneously running old version of A. With this approach, modern web services gain the agility of isolated components with fast builds and small repositories—the problem is seemingly solved.

Unfortunately, the two versions of component A running simultaneously share resources (such as memory, network connections, and storage). This is a serious problem in the world of web services. To deal with it, services are backward compatible with resources for all currently active versions. Breaking changes to things like database schemas are managed over multiple service releases to ensure no service disruption or data corruption. (Details in Production is a mixed blessing.)

The agility you get working on modern web services, with multiple versions of components running simultaneously, is worth the backward capability you must maintain. As a bonus, the ability to run multiple versions simultaneously allows you to update services without rebooting or disrupting active usage.

Eric Aside

Some major companies that run modern web services, like Google and Facebook, still choose to use huge repositories. With one big repository, it’s easier to enlist, refactor large codebases, and search shared code.

My reality and yours

At Microsoft, we’ve maintained backward compatibility for decades to support our customers. However, would we really do that at the DLL level within the Windows kernel? Having different versions of components running simultaneously on the same PC would cause all kinds of resource contention, as is the case with web services, but with far greater frequency and variety. However, if we don’t allow multiple versions of components to run simultaneously, we’re stuck keeping all components in lock step with each other, meaning enormous builds and reduced agility.

The key is choosing the right size for components. Allowing every kernel DLL to run multiple versions at the same time is nuts, but there are various ways to have multiple kernels appear to run simultaneously. (We’ve used virtualization, shimming, emulation, and sandboxing to have middleware and apps run on seemingly different kernels on the same machine.) Kernels by themselves build much faster than entire operating systems, and likewise for middleware and apps. This doesn’t provide isolation and agility down to the feature team level, but we still get dramatic improvement.

Eric Aside

Web services typically limit the number of active versions of any particular service to only a few, track which clients are using old versions, and even enforce a deadline for when those clients must upgrade. It’s possible to do something similar for kernels, middleware, and apps, though missing the deadline may only mean running a bit slower due to greater emulation.

Hard-won freedom

Breaking our large codebases into kernels, middleware, and apps, and allowing different versions of them to run simultaneously will require a great deal of work—it won’t happen overnight. Yes, it’s easier than doing this at the individual DLL level, but it’s still a huge effort. Even getting these pieces to build separately is an enormous task.

However, if we ever hope to increase our agility and responsiveness to customers, and compete effectively within the modern marketplace, we must take action today. Fortunately, people working on Windows and Office have already made substantial progress separating out major components and moving toward greater independence and reuse. Even so, they can’t defeat diamond dependencies alone. You must do your part.

To successfully separate our kernels, middleware, and apps from each other, every engineer must live and breathe backward compatibility and boundaries. Don’t take arbitrary dependencies across boundaries, don’t invent new APIs for expediency (aka laziness), and don’t break file formats or communication protocols on a whim. Instead, stick within your established boundaries, invoke or enhance supported interfaces, and take great care in altering how shared resources are used between versions. With all of us working together, we can show the world how smart we are and how quickly we can regain dominance in the marketplace.

LUA Buglight 2.3, with support for Windows 8.1 and Windows 10

MSDN Blogs - Tue, 06/30/2015 - 22:46

LUA Buglight is a utility for identifying admin-permissions issues (a.k.a., "LUA bugs") in desktop applications. That is, it identifies the specific reasons that a particular application works only when run with administrative rights. Version 2.3 is attached to this blog post and adds support for Windows 8.1, Windows Server 2012 R2, and Windows 10.

It has been well-established for many years that for security and reliability reasons, users should log on with standard user rights and that their applications should not require administrative rights.  Windows Vista began the movement toward making that the default for Windows.  Although Windows Vista and Windows 7 include technologies to help applications that had required administrative rights on earlier versions of Windows to run correctly with standard user rights, many users and organizations "solved" their application compatibility issues by disabling User Account Control (UAC) and continuing to run with full administrative rights.  Windows 8.x and Windows 10 increasingly depend on features that are absent when UAC is disabled, so the "never notify" Control Panel slider option that used to disable UAC now sets the "silent elevation" option and keeps UAC enabled.  That means that unless apps specifically request elevation, they'll run with standard user rights, and continuing to run everything with full administrative rights will become more difficult and inconvenient.  LUA Buglight can help you identify the causes for many of the compatibility issues and point to solutions.  (See below for some solutions.)

To test an application, you must be logged on as a member of the Administrators group and with UAC enabled. (*)  Run LuaBuglight.exe without elevation.  Specify the executable to test, any command line parameters, and the starting directory, and click Start.  LUA Buglight prompts for elevation and then starts the target application.  Run the program and test all functional areas of interest.  When done testing, click the Stop Logging button.  LUA Buglight will display a tabbed report showing issues that it found.  (As noted in the "LUA bugs" link above, just because an "access denied" is recorded doesn't mean there's a bug that needs to be fixed!)

LUA Buglight works by instrumenting the program being tested, intercepting hundreds of API entry points.  LUA Buglight runs the target program with standard-user rights.  When it detects an API failing with "access denied" or "privilege not held", it impersonates the user's admin/elevated token (obtained when it prompted for UAC elevation) and repeats the operation before returning control back to the program.  If the API call failed with standard user rights and succeeded with administrative rights, LUA Buglight logs details about the API call, including all parameters of interest and the call stack. (**)

Admin permissions are one cause of application compatibility problems.  The prioritized list of preferred solutions for app-compat issues goes along these lines:

  1. Retire or replace the app
  2. Get an updated version of the app that fixes the issues from the app owner (i.e., the vendor or your developers)
  3. Modify the installer via transforms or post-install scripts (for "run-once" issues where the app needs to be executed with admin rights only the first time it is run). Another option is to add junctions or directory symbolic links.
  4. Let UAC file/registry virtualization do its magic.  (For older apps where file/reg virtualization would work, but were rebuilt with newer versions of Visual Studio, which adds an embedded manifest that declares compatibility with UAC and turns off virtualization.)
  5. For writes to .ini files in protected directories, use an IniFileMapping redirection; for writes to HKCR, pre-create equivalent keys under HKCU\Software\Classes..
  6. Apply application-compatibility shims.  (For some types of shims, this can be moved up ahead of #4.)
  7. Surgically change permissions on files, directories, registry keys, or other objects.  (Unlike the previous six options, this one introduces risk of unauthorized elevation of privilege, so caution is required.)

Note that automatic-elevation products are not on this list.  I recommend against their use.

Here's some additional tips I wrote a few years ago about using LUA Buglight.

(*)  LUA Buglight should still work with Windows XP and Windows Server 2003, but I haven't tested to verify that recently.  On those pre-UAC platforms, run LUA Buglight as a standard user; you will be prompted to enter the credentials of a separate administrative account.

(**)  LUA Buglight can capture symbol information as part of the call stack, but it doesn't support use of symbol servers, so symbol files must already be downloaded and the _NT_SYMBOL_PATH variable must point to the symbol directory.

 

Nový build Windows 10 pro PC - 10158

MSDN Blogs - Tue, 06/30/2015 - 22:40
Do okruhu rychlejších aktualizací byl uvolněn nový build Windows 10. Pořadové číslo 10158 přináší jak vylepšení funkčnosti a stability, tak vyleštění některých nedostatků uživatelského rozhraní. Microsoft Edge Zamávejte Spartanu, branding se konečně mění a přichází Microsoft Edge . Prohlížeč nabídne více možností přizpůsobení...(read more)

SQL Server性能问题案例解析 (2)

MSDN Blogs - Tue, 06/30/2015 - 22:31

语句执行时间长是SQL Server 性能问题的一种典型表现形式。当运行一条语句所需要的CPU时间较长或者所需的内存资源较多时,我们往往需要对目标语句本身进行调优。通常情况下,我们可以通过更新统计信息,修改索引,使用语句执行计划的强制选择(使用Hint), 以及对于语句本身的修改来使得语句占用更少的CPU时间或者内存。

在对问题语句调优之前,我们需要得到这条语句的执行计划。除了通过SQL Server Management Studio上的 "Include Actual Execution Plan"这个图标外,我们可以通过SQL Server Profiler中Performance - Showplan Statistics Profile这个事件的捕捉来获得语句的执行计划。

另外在问题语句执行时通过下面的方式可以收集到较为直观和详细的执行计划和相关统计信息。

 

SET STATISTICS IO ON;

SET STATISTICS TIME ON;

SET STATISTICS PROFILE ON;

GO

--问题语句执行

GO

SET STATISTICS IO OFF;

SET STATISTICS TIME OFF;

SET STATISTICS PROFILE OFF;

 

下面开始我们的案例分析。 在这个案例中,客户最初碰到的问题是SQL Server 进程CPU使用率很高。通过我们的分析定位发现了占用CPU时间最多的语句。在这篇博文中,我们会着重分析这条问题语句占用较高CPU资源的原因。

问题语句本身是对一个用户定义视图运行select * 语句,相应的constraint也较为简单。但是这个视图的定义较为复杂,对应的定义我们简化如下:

 

CREATE VIEW [dbo].[demoView]

AS
WITH    DemoInfo

              AS (Complex_Select_Query)  
SELECT                                           

       DISTINCT

            ColumnAlias31 ,

            ColumnAlias32 ,

            ColumnAlias33 ,

            ColumnAlias34 ,

            ColumnAlias35 ,

            ColumnAlias36 ,

            ... ,

            ColumnAlias325,

            ColumnAlias326 = CASE WHEN EXISTS ( SELECT TOP 1

                                       FROM    DemoInfo b

                                    WHERE   b.ColumnAlias328 = a.ColumnAlias328     
                                    AND  a.ColumnAlias33 > b.ColumnAlias33 )

                      THEN NULL

                      ELSE a.ColumnAlias326

                 END ,

            ColumnAlias327 = CASE WHEN EXISTS (SELECT TOP 1

                                    FROM    DemoInfo b

                                    WHERE   b.ColumnAlias328 = a.ColumnAlias328   
                                    AND a.ColumnAlias33 > b.ColumnAlias33 )

                      THEN NULL

                      ELSE a.ColumnAlias327

                 END ,

            ColumnAlias328 = CASE WHEN EXISTS (SELECT TOP 1

                                               
                                        FROM   DemoInfo b

                                        WHERE  b.ColumnAlias328 =a.ColumnAlias328         
                                       AND a.ColumnAlias33 > b.ColumnAlias33 )

                           THEN NULL

                           ELSE
           a.ColumnAlias328

                      END ,

            ColumnAlias329 = CASE WHEN EXISTS (SELECT TOP 1

                               FROM      DemoInfo b                                    
                                   WHERE     b.ColumnAlias328 =a.ColumnAlias328  
                                              AND a.ColumnAlias33 > b.ColumnAlias33 )

                        THEN NULL

                        ELSE 1

                   END ,

            ColumnAlias30 ,

            ColumnAlias31 ,

            ColumnAlias32 ,

            ColumnAlias33 ,

            ColumnAlias34 ,

             ...

            ColumnAlias60

             FROM    DemoInfo a        

 在客户环境中,每次运行语句时,动态视图中的信息都需要更新,所以等于每次视图都会被重建。接下来我们需要去看一下对应的执行计划。

首先我们发现在执行计划中并不存在并行。并行需要额外的CPU开销来支持多核之间的同步。那么也就说明客户环境中没有这部分额外的开销。

那么之后,我们应该去关注有没有Scan count(参考文档:http://blogs.msdn.com/b/sqlserverfaq/archive/2010/09/14/scan-count-meaning-in-set-statistics-io-output.aspx)较多的表,来定位问题是否由某张表所导致的。然而在这个案例中我们有多张表的scan count 都比较高。

另外执行计划中还有一个参数叫做 "Total Subtree cost", 这个是语句优化器在执行语句前对于执行计划中对应分支所需CPU,I/O, 内存所需成本的一个计算结果。我们可以通过这个参数来去判定哪一部分使用了较多的成本。(注意:对于实例之间成本的比较,使用这个参数并不准确)。由于篇幅的关系,这里对执行计划做了一个简化:

有趣的是我们发现在复杂的执行计划中包含了四个完全相同的 "nest loops" Inner Join. 他们四个的 "Total Subtree cost"之和约有 1490, 而整个语句的cost为1969。尽管这个参数仅为SQL Server 语句优化器的计算值,而并非实际执行情况的精确反应,但足以说明这四个nest loops是整个语句执行成本的主要构成。

因为四个部分的高度一致,我们很容易找到对应的语句是之前高亮的四条使用“case when exists"的短句。当使用 “case when exist" 这个短句时,执行计划必须使用半连接(left semi join),而半连接又只能使用Nest loop。在客户环境中,nest loop join 是一个结果集对自身做join, 且结果集较大,所以使用nest loop join 开销非常大。然而对于这种固有的设计我们无法通过简单的加索引或加hint去调优语句。唯一的方式就是客户结合自己的具体业务需求重写语句而避免使用 “case when exits"的短句。

 这就是今天的分享,更多SQL Server案例学习请持续关注本博客的更新。

Free Newsletter Email Template for Reporting Project Status

MSDN Blogs - Tue, 06/30/2015 - 21:55

Please feel free to Download this free email template.

Free Microsoft Azure account for Students

MSDN Blogs - Tue, 06/30/2015 - 21:11

Good news for global students!  If you are a student (current active student having a .edu email account), you can get a FREE Azure cloud computing account from Microsoft today!   The free account includes:

  • Free Azure Web App Service
  • Free MySQL Database from ClearDB
  • Free App Insights
  • Free VS Online Service

With these, you can build and host a web site using MySQL (e.g. host a WordPress web site) with NO cost!

For more details visit http://scottge.net/2015/06/30/get-free-microsoft-azure-account-if-you-are-a-student/.

Certification Update - Azure and O365 Practice Tests Now Available

MSDN Blogs - Tue, 06/30/2015 - 20:47

 

Microsoft has added three new Microsoft Official Practice Tests to the list available through Pearson VUE:

Additional practice tests for O365, Azure, Enterprise Devices and Apps, and others are planned for release in the coming months, so stay tuned.

A complete list of available Microsoft Official Practice Tests can be found here

Dynamics CRM Online 2015 Update 1 新機能: Web API 開発者プレビュー その 9

MSDN Blogs - Tue, 06/30/2015 - 20:30

みなさん、こんにちは。

前回に引き続き Dynamics CRM Online 2015 Update 1 で提供される
Web API 開発者プレビューについて紹介します。連載記事になるため
第 1 回からご覧ください。

Web API 開発者プレビュー その 1
Web API 開発者プレビュー その 2
Web API 開発者プレビュー その 3
Web API 開発者プレビュー その 4
Web API 開発者プレビュー その 5
Web API 開発者プレビュー その 6
Web API 開発者プレビュー その 7
Web API 開発者プレビュー その 8

今回は Web API でサポートするクエリを紹介します。

概要

Web API 開発者プレビューはこれまでに REST でサポートしたクエリ
以外に、以下のクエリをサポートします。

- $ref
- $count
- Not
- $value

早速順番に見ていきましょう。

$ref クエリ

$ref クエリを使うと、レコードの値ではなくレコードが取得できる
URI を取得できます。今回は取引先企業に紐づく取引先担当者の
レコード URI を取得してみます。

事前準備

事前に「Microsoft」という取引先企業レコードと、そのレコードに
関連する取引先担当者レコードを数件作成してください。

プログラムの実装

1. 前回利用した Visual Studio ソリューションを開き、Program.cs
ファイルを開きます。新しく以下のメソッドを追加します。

public async Task RunQueries(string accessToken)
{
    // HttpClient の作成
    using (HttpClient httpClient = new HttpClient())
    {
        // Web API アドレスの作成
        string serviceUrl = serverUrl + "/api/data/";
        // ヘッダーの設定
        httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
        httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);

    }
}

2. Main メソッドの以下のコードを書き換えて、新しいメソッドを
呼ぶように変更します。

元)  
Task.WaitAll(Task.Run(async () => await app.RunFormattedValue(result.AccessToken)));

変更後)
Task.WaitAll(Task.Run(async () => await app.RunQueries(result.AccessToken)));

3. 新しく追加した RunQueries メソッド内に以下のコードを追加して、
取引先企業の取得を実行します。

// 取引先企業の取得
HttpResponseMessage accountRes = await httpClient.GetAsync(serviceUrl + "accounts?$filter=startswith(name,'microsoft')");
JToken record = JObject.Parse(accountRes.Content.ReadAsStringAsync().Result)["value"][0];

4. 取得した取引先企業に紐づく取引先担当者レコードの URI を取得
して、表示します。以下のコードを追加します。

// $ref を利用した関連する取引先担当者の取得
HttpResponseMessage contactsRes = await httpClient.GetAsync(serviceUrl + "accounts(" + record["accountid"] + ")/contact_customer_accounts/$ref");

// 結果の表示
JToken contacts = JObject.Parse(contactsRes.Content.ReadAsStringAsync().Result)["value"];

foreach (JToken contact in contacts)
{
    Console.WriteLine("取引先担当者の URI: {0}", contact["@odata.id"]);
}

動作確認

1. F5 キーを押下してプログラムを実行します。

2. 認証ダイアログが表示されたらログインします。

3. 以下のように取引先担当者の URI が表示されることを
確認します。

$count クエリ

$countクエリを使うと、レコードの件数を確認できます。

プログラムの実装

上記で追加したメソッドに以下のコードを追加して、取引先企業の
件数を取得します。※取得できる数は 5,000 件が上限です。

// $count を利用したデータの取得
HttpResponseMessage countRes = await httpClient.GetAsync(serviceUrl + "accounts?$count=true");
// 結果の表示
Console.WriteLine("取引先企業の数: {0}", JObject.Parse(countRes.Content.ReadAsStringAsync().Result)["@odata.count"]);

動作確認

1. F5 キーを押下してプログラムを実行します。

2. 認証ダイアログが表示されたらログインします。

3. 結果を確認します。

Not オペレーター

Not オペレーターを使うと、指定した条件と逆の結果を得られます。

プログラムの実装

上記で追加したメソッドに以下コードを追加して、名前が Microsoft
で始まらない取引先企業の件数を取得します。

// Not オペレーターを利用した取引先企業の検索
HttpResponseMessage notRes = await httpClient.GetAsync(serviceUrl + "accounts?$count=true&$filter=not(startswith(name, 'microsoft'))");
// 結果の表示
Console.WriteLine("Microsoft で始まらない取引先企業の件数: {0}", JObject.Parse(notRes.Content.ReadAsStringAsync().Result)["@odata.count"]);

動作確認

1. F5 キーを押下してプログラムを実行します。

2. 認証ダイアログが表示されたらログインします。

3. 結果を確認します。

$value クエリ

$value クエリを使うと、JSON データではなく値を直接取得できます。

プログラムの実装

上記で追加したメソッドに以下のコードを追加して、取引先企業の
名前を値で取得します。ポイントは OData のバージョンを明記する
ことです。尚、取引先企業の ID は上記で取得したものを再利用します。

結果の表示で JSON を処理していない点を確認してください。

// OData バージョンの指定
httpClient.DefaultRequestHeaders.Add("OData-MaxVersion", "4.0");
// $value を利用した取引先企業名前の取得
HttpResponseMessage varRes = await httpClient.GetAsync(serviceUrl + "accounts(" + record["accountid"] + ")/name/$value");
// 結果の表示
Console.WriteLine("取引先企業の名前: {0}", varRes.Content.ReadAsStringAsync().Result);

動作確認

1. F5 キーを押下してプログラムを実行します。

2. 認証ダイアログが表示されたらログインします。

3. 結果を確認します。

今回追加したメソッドを以下に示します。

public async Task RunQueries(string accessToken)
{
    // HttpClient の作成
    using (HttpClient httpClient = new HttpClient())
    {
        // Web API アドレスの作成
        string serviceUrl = serverUrl + "/api/data/";
        // ヘッダーの設定
        httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
        httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);

        // 取引先企業の取得
        HttpResponseMessage accountRes = await httpClient.GetAsync(serviceUrl + "accounts?$filter=startswith(name,'microsoft')");
        JToken record = JObject.Parse(accountRes.Content.ReadAsStringAsync().Result)["value"][0];

        // $ref を利用した関連する取引先担当者の取得
        HttpResponseMessage contactsRes = await httpClient.GetAsync(serviceUrl + "accounts(" + record["accountid"] + ")/contact_customer_accounts/$ref");

        // 結果の表示
        JToken contacts = JObject.Parse(contactsRes.Content.ReadAsStringAsync().Result)["value"];

        foreach (JToken contact in contacts)
        {
            Console.WriteLine("取引先担当者の URI: {0}", contact["@odata.id"]);
        }

        // $count を利用したデータの取得
        HttpResponseMessage countRes = await httpClient.GetAsync(serviceUrl + "accounts?$count=true");
        // 結果の表示
        Console.WriteLine("取引先企業の数: {0}", JObject.Parse(countRes.Content.ReadAsStringAsync().Result)["@odata.count"]);

        // Not オペレーターを利用した取引先企業の検索
        HttpResponseMessage notRes = await httpClient.GetAsync(serviceUrl + "accounts?$count=true&$filter=not(startswith(name, 'microsoft'))");
        // 結果の表示
        Console.WriteLine("Microsoft で始まらない取引先企業の件数: {0}", JObject.Parse(notRes.Content.ReadAsStringAsync().Result)["@odata.count"]);

        // OData バージョンの指定
        httpClient.DefaultRequestHeaders.Add("OData-MaxVersion", "4.0");
        // $value を利用した取引先企業名前の取得
        HttpResponseMessage varRes = await httpClient.GetAsync(serviceUrl + "accounts(" + record["accountid"] + ")/name/$value");
        // 結果の表示
        Console.WriteLine("取引先企業の名前: {0}", varRes.Content.ReadAsStringAsync().Result);
    }
}

まとめ

今回まで Web API プレビューの機能を HttpClient を利用して
紹介してきました。より生の HTTP リクエストに近い内容を
確認できるため参考になったのではないでしょうか。

次回は T4 テンプレートを利用した Web API の利用を紹介します。
お楽しみに!

- 中村 憲一郎

Visual Studio 2015 が7/20にリリース! ただUWPを作る人はちょっと注意

MSDN Blogs - Tue, 06/30/2015 - 19:48

いよいよ Visual Studio 2015 の最終リリース版が 7月20日からダウンロード配信が開始されます!

Visual Studio 2015 RTM のリリースが 7月20日に決定!
記念イベントも同日開催

ただ、Windows 10 の Universal Windows Platform Application を作る場合は、この期間だけ注意が必要です。

情報元:Release Dates and Compatibility: Visual Studio 2015 and the Windows 10 SDK

■ UWP開発環境についての期間限定の注意

というのも、今回のUWPの開発環境については、Visual Studio のリリース版とSDKのPre-release 版を組み合わせることができないので、注意が必要です。

  • Visual Studio 2015 リリース版には Windows 10 SDK Pre-release 版はインストールできない
  • Windows 10 SDK は 7/29にWIndows 10 と共にダウンロード開始される

なので、Windows 10 UWP の開発環境のスケジュールとしては以下のようになります。

  ~7/19 7/20~7/28 7/29~ Visual Stuio 2015 - Release UWP 開発環境 Windows 10 SDK - VIsual Stuio 2015 RC
(Windows 10 SDK Pre-release)

UWP β 開発環境

 

■ どう対応したらよいか?

ですので、現在のUWPのアプリ開発状況に応じて、開発環境の更新はご注意ください。

現在(もしくは7/28までに) UWP の開発をされている方

  • 7/29までは Visual Studio 2015 RCで開発を行う
  • 7/29以降に Visual Studio 2015 リリース版とWindows 10 SDK をインストール

7/20~7/28 の間にUWPの開発をされない方

  • 7/20以降に Visual Studio 2015 をインストール
  • 7/29以降は Windows 10 SDK をインストール

ま、9日��だけですけどね。

皆様のアプリが、Windows 10 のストアから UWPアプリとして公開されることを楽しみにしています!

SQL Updates Newsletter - June 2015

MSDN Blogs - Tue, 06/30/2015 - 19:40
Recent Releases and Announcements Cumulative Update #1 for SQL Server 2014 SP1 https://support.microsoft.com/en-us/kb/3067839 Cumulative Update #8 for SQL Server 2014 RTM https://support.microsoft.com/en-us/kb/3067836 HP and Microsoft announce a new Superdome X Reference Configuration Guide for SQL Server 2014 http://blogs.technet.com/b/dataplatforminsider/archive/2015/06/04/hp-and-microsoft-announce-a-new-superdome-x-reference-configuration-guide-for-sql...(read more)

MB2-706: Microsoft Dynamics CRM Online Deployment Exam Virtual Training 7-23 July

MSDN Blogs - Tue, 06/30/2015 - 17:57

 

If you are working towards certification we would like to invite you to attend our latest training programs, which will span over three weeks, to assist in achieving the MB2-706: Microsoft Dynamics CRM Online Deployment Exam. You will be able to attend a virtual session for each course, led by a Microsoft Certified Trainer, for an hour and a half twice a week for three weeks including:

  • Covering Modules on the following E-learning courses:
    • CRM Online Deployment: 80664AE: Deployment in Microsoft Dynamics CRM Online
  • Hands on Practice on a demo environment

Audience

This courses is for CRM partners with a role in the Application or Technical Consulting, Developer, or Solution Architect space pursuing the CRM Installation or CRM Online Deployment certification.

At Training Material Completion

This course will focused on Installation of Microsoft Dynamics CRM and related components including how-to, best practices and scenarios in the following areas:

  • CRM Installation Course
  • Install and configure Microsoft Dynamics CRM
  • Configure and manage Microsoft Dynamics CRM
  • Maintain and extend Microsoft Dynamics CRM deployments
  • CRM Online Deployment Course
  • Administer Microsoft Dynamics CRM Online
  • Upgrade a Microsoft Dynamics CRM edition and redeploy Microsoft Dynamics CRM
  • Configure and manage email
  • Install and deploy other client tools for Microsoft Dynamics CRM
  • Manage and troubleshoot a Microsoft Dynamics CRM deployment

Prerequisites

Before attending each respective course, students must have:

CRM Installation Course

  • Microsoft Windows Server
  • Active Directory
  • Internet Information Services (IIS)
  • Microsoft Exchange
  • Microsoft SQL Server
  • Microsoft Outlook

CRM Online Deployment Course

  • Some basic experience using Windows applications.
  • Recommended: Completion of the Microsoft Dynamics CRM Introduction course

Time: 10:30am – 12:00pm AEST

Date: July 7 – 23, 2015 (Tuesday & Thursday Only)

Location: Virtual Training – Information regarding the training access will be provided prior to the course.

Price: $700.00 USD

Questions: Email msdynevt@microsoft.com

Access to Dynamics Learning Portal (DLP)

To complete the homework outlined for this course you must have access to DLP. Access to DLP is available as a result of your company meeting one of the following criteria:

  • Is enrolled in the Microsoft Dynamics Partner Advantage or Partner Advantage PLUS Service Plans.
  • Has purchased the Microsoft Dynamics Training Pack.

To order or renew the Microsoft Dynamics Training Pack please review the Training Pack options available for purchase here. For assistance, please contact your local Microsoft Regional Operations Centre (ROC)

  • Review the ordering details, access the links included and purchase the “Dynamics Training Pack (pay per incident)” $1,000 USD under select service options

To order or renew the Microsoft Dynamics Partner Advantage\Advantage Plus Service Plan please review the purchase options here. For assistance, please contact your Services Account Manager or contact your local Microsoft Regional Operations Centre (ROC).

Venha comemorar o lançamento do Visual Studio 2015 RTM!

MSDN Blogs - Tue, 06/30/2015 - 17:37
    Em 20 de julho , iremos celebrar a última release do Visual Studio 2015 ! Convidamos a todos a aprender sobre as novas features e tecnologias que acompanharão a nova versão. Você poderá interagir na sessão ao vivo, participar da sessão de perguntas e respostas com o time de engenharia, além de se aprofundar em detalhes técnicos, em mais de 60 sessões on-demand. Para acessar, clique aqui . Teremos também a oportunidade de ver o time de Visual Studio criando uma solução fim-a-fim em um...(read more)

06/30 -- Errata added for [MS-TDS]: Tabular Data Stream Protocol

MSDN Blogs - Tue, 06/30/2015 - 16:34

Changes made to the product behavior notes <11>, <13>, <17>, <22>, <27>, <31>, and <41> in Appendix A to add information for SQL Server 2016 CTP2: https://msdn.microsoft.com/en-us/library/dn785067.aspx#BKMK_TDS

jadamelio’s Weekly Article Feature - Optimization

MSDN Blogs - Tue, 06/30/2015 - 15:43

Whether you are programming a video game, simulation or any other program where time and performance is important, optimizing your code is critical. Since Small Basic(Without the LitDev extension) has only a handful of streamlined tools, optimization is all about knowing the nuances in your code. 

I introduce to you, the TechNet article: Small Basic: Optimization, written by Ezra94 and Nonki Takahashi. 

For an aspiring programmer, who doesn't understand how code works under the hood, this article is a one stop solution source.  

The article discusses both specific techniques and methods to speed up the program, from keeping arrays small and clearing out their data to understanding nesting and reverse loops.

More importantly though, are the sections that discuss tools and skills to help you find where the program slows down. One of the tools mentioned, the use of the "Clock.ElapsedMilliseconds", was incredibly helpful for me when developing my game in Small Basic. Nonki made a small program that highlighted the speed of each section, and the solution because immediately apparent. 

If you're new to programming or teaching someone new, take a quick peek at the article, it's never too early to form good habits!

Thank you Nonki and Ezra for your contribution to the Small Basic community!

-jadamelio 

 

Adaptive Tile Templates - Schema and Documentation

MSDN Blogs - Tue, 06/30/2015 - 13:54

Adaptive tile templates are a new feature in Windows 10, allowing you to easily specify content on your tile notifications without being limited to the preset templates we previously provided in the "tile template catalog". You can still use those legacy templates from the catalog, but adaptive tile templates allow you to design your own tile notification content using a simple and flexible markup language that adapts to different densities.

Note: This is pre-release documentation and is subject to change. Once the official MSDN documentation is posted, I will update this article to simply link to MSDN. But in the meantime, this article will allow Windows 10 app developers to create awesome live tiles.

Quick Sample

Here is an example that quickly shows the essence of Adaptive Tile Templates and the results they produce.

<tile> <visual> <binding template="TileMedium"> ... </binding> <binding template="TileWide"> <text hint-style="subtitle">Jennifer Parker</text> <text hint-style="captionSubtle">Photos from our trip</text> <text hint-style="captionSubtle">Check out these awesome photos I took while in New Zealand!</text> </binding> <binding template="TileLarge"> ... </binding> </visual> </tile>

Schema <tile> <!-- Child elements --> visual </tile> <visual version? = integer lang? = string baseUri? = anyURI branding? = "none" | "logo" | "name" | "nameAndLogo" addImageQuery? = boolean contentId? = string > <!-- Child elements --> binding+ </visual> <binding template = tileTemplateNameV3 fallback? = tileTemplateNameV1 lang? = string baseUri? = anyURI branding? = "none" | "logo" | "name" | "nameAndLogo" addImageQuery? = boolean contentId? = string displayName? = string hint-textStacking? = "top" | "center" | "bottom" hint-overlay? = [0-100] > <!-- Child elements --> ( image | text | group )* </binding> <image src = string placement? = "inline" | "background" | "peek" alt? = string addImageQuery? = boolean hint-crop? = "none" | "circle" hint-removeMargin? = boolean hint-align? = "stretch" | "left" | "center" | "right" /> <text lang? = string hint-style? = textStyle hint-wrap? = boolean hint-maxLines? = integer hint-minLines? = integer hint-align? = "left" | "center" | "right" > <!-- text goes here --> </text> textStyle values... caption captionSubtle body bodySubtle base baseSubtle subtitle subtitleSubtle title titleSubtle titleNumeral subheader subheaderSubtle subheaderNumeral header headerSubtle headerNumber <group> <!-- Child elements --> subgroup+ </group> <subgroup hint-weight? = [0-100] hint-textStacking? = "top" | "center" | "bottom" > <!-- Child elements --> ( text | image )* </subgroup> The Basics

Adaptive templates are semantic in nature, since they are meant to work across different form factors and different types of notifications. For example, elements like group and subgroup are used to semantically link content together – they do not imply a specific visual behavior on their own. The final appearance is up to the specific device – be it a phone/desktop/Xbox, HoloLens, or smartwatch, and the type of notification – tile or toast.

Hints are optional attributes that can be added to elements in order to achieve a specific visual behavior. Some hints might be device-specific or notification-specific, hence why they are optional.

The Templates (Tile Sizes)

Content for each tile size is individually specified in separate <binding> elements within the XML payload. The size you are targeting is specified by setting the template attribute to one of the following values…

  • TileSmall
  • TileMedium
  • TileWide
  • TileLarge (desktop only)

In a single tile notification XML payload, you should provide <binding> elements for each tile size you choose to support, as shown by the example below.

<tile> <visual> <binding template="TileSmall"> <text>Small</text> </binding> <binding template="TileMedium"> <text>Medium</text> </binding> <binding template="TileWide"> <text>Wide</text> </binding> <binding template="TileLarge"> <text>Large</text> </binding> </visual> </tile>

Text

The text element is used to display text. Its usage is quite simple, but the appearance of the text can be modified in a number of different ways using hints.

<text>This is a line of text</text>

Text Wrapping

Use the hint-wrap attribute to set text wrapping on a text element. By default, text does not wrap and will continue off the edge of the tile. You can also control the minimum and maximum amount of lines with hint-minLines and hint-maxLines (which both accept positive integers).

<text hint-wrap="true">This is a line of wrapping text</text>

Text Styles

Styles control the font size, color, and weight of text elements. There are a number of available styles, including a “Subtle” version of each style, which simply sets the opacity to 60% (usually resulting in a more gray color instead of white).

<text hint-style="base">Header content</text> <text hint-style="captionSubtle">Subheader content</text>

Note: if hint-style is not specified, the style defaults to caption.

Basic Text Styles <text hint-style="*" />Font HeightWeight caption 12 epx Regular body 15 epx Regular base 15 epx SemiBold subtitle 20 epx Regular title 24 epx Semilight subheader 34 epx Light header 46 epx Light Numeral Text Style Variations

These variations reduce the line height so that content above and below come extremely close to the text.

titleNumeral subheaderNumeral headerNumeral Subtle Text Style Variations

There is a subtle variation of every style previously mentioned, which simply makes the text 60% opaque, typically resulting in text that is more gray than white.

captionSubtle bodySubtle baseSubtle subtitleSubtle titleSubtle titleNumeralSubtle subheaderSubtle subheaderNumeralSubtle headerSubtle headerNumeralSubtle Text Alignment

Text can be horizontally aligned left, center, or right. In left-to-right languages like English, text defaults to left-aligned. In right-to-left languages like Arabic, text defaults to right-aligned. You can manually set alignment with the hint-align attribute on elements.

<text hint-align="center">Hello</text> leftcenterright Groups and Subgroups

Groups allow you to semantically declare that the content inside the group is related and must be displayed in its entirety for the content to make sense. For example, you might have two text elements, a header and a subheader, and it would not make sense for only the header to be shown. By placing those elements inside a subgroup in a group, the elements will either all be displayed (if they can fit) or not displayed at all (since not all could fit).

These groups allow your tile to adapt to larger screens, where each tile can fit more content. For example, say your tile displays new emails. On small-screen phones, the live tiles themselves are smaller, and therefore only one email can fit on the live tile. However, on large-screen phones, two emails can fit on the live tile. Thus, to provide the best experience, you should provide multiple groups.

Note: the only valid child of a group is a subgroup. Hence, you must place your content inside a subgroup in a group.

... <binding template="TileWide" branding="nameAndLogo"> <group> <subgroup> <text hint-style="subtitle">Jennifer Parker</text> <text hint-style="captionSubtle">Photos from our trip</text> <text hint-style="captionSubtle">Check out these awesome photos I took while in New Zealand!</text> </subgroup> </group> <text /> <group> <subgroup> <text hint-style="subtitle">Steve Bosniak</text> <text hint-style="captionSubtle">Build 2015 Dinner</text> <text hint-style="captionSubtle">Want to go out for dinner after Build tonight?</text> </subgroup> </group> </binding> ... DesktopTabletHigh-Density Mobile Subgroups (columns)

Subgroups also allow you to divide data into semantic sections within a group. For live tiles, this visually translates to columns.

The hint-weight attribute allows you to control the widths of columns. The value of hint-weight is expressed as a weighted proportion of available space. This is identical to GridUnitType.Star behavior. For equal width columns, simply assign each weight to 1.

hint-weightPercent of Width 1 25% (1/4) 1 25% (1/4) 1 25% (1/4) 1 25% (1/4) Total Weight: 4

To get one column twice as large as another, assign one column a weight of 1, and the desired larger column a weight of 2.

hint-weightPercent of Width 1 33.3% (1/3) 2 66.7% (2/3) Total Weight: 3

If you want your first column to take up 20% of the width, and your second column to take up 75% of the width, assign the first weight to be 25 and the second weight to be 75. As long as your weights sum to 100, they will essentially be percentages.

hint-weightPercent of Width 20 20% (20/100) 80 80% (80/100) Total Weight: 100

Note: an 8 px margin is added between columns.

For subgroups of more than two, you typically should set hint-weight (which accepts positive integers). If the very first subgroup does not have hint-weight specified, it will be assigned a weight of 50. The next subgroup that does not have a hint-weight specified will be assigned a weight equal to 100 minus the sum of the preceding weights, or 1 if the result is zero. Remaining subgroups without hint-weight specified will be assigned a weight of 1.

Here is a sample showing how you would achieve a tile with five columns of equal width, such as a weather tile displaying a five-day forecast.

... <binding template="TileWide" displayName="Seattle" branding="name"> <group> <subgroup hint-weight="1"> <text hint-align="center">Mon</text> <image src="Assets\Weather\Mostly Cloudy.png" hint-removeMargin="true"/> <text hint-align="center">63°</text> <text hint-align="center" hint-style="captionsubtle">42°</text> </subgroup> <subgroup hint-weight="1"> <text hint-align="center">Tue</text> <image src="Assets\Weather\Cloudy.png" hint-removeMargin="true"/> <text hint-align="center">57°</text> <text hint-align="center" hint-style="captionsubtle">38°</text> </subgroup> <subgroup hint-weight="1"> <text hint-align="center">Wed</text> <image src="Assets\Weather\Sunny.png" hint-removeMargin="true"/> <text hint-align="center">59°</text> <text hint-align="center" hint-style="captionsubtle">43°</text> </subgroup> <subgroup hint-weight="1"> <text hint-align="center">Thu</text> <image src="Assets\Weather\Sunny.png" hint-removeMargin="true"/> <text hint-align="center">62°</text> <text hint-align="center" hint-style="captionsubtle">42°</text> </subgroup> <subgroup hint-weight="1"> <text hint-align="center">Fri</text> <image src="Assets\Weather\Sunny.png" hint-removeMargin="true"/> <text hint-align="center">71°</text> <text hint-align="center" hint-style="captionsubtle">66°</text> </subgroup> </group> </binding> ...

Images

The <image> element is used to display images on the tile notification. Images can be placed inline within the tile content (default), as a background image behind your content, or as a peek image that animates in from the top of the notification.

Note: There are restrictions on the file size and dimensions of images.

Without any extra behaviors specified, images will uniformly shrink/expand to fill the available width. The example below shows a tile using two columns and inline images. The inline images stretch to fill the width of the column.

... <binding template="TileMedium" displayName="Seattle" branding="name"> <group> <subgroup> <text hint-align="center">Mon</text> <image src="Assets\Apps\Weather\Mostly Cloudy.png" hint-removeMargin="true"/> <text hint-align="center">63°</text> <text hint-style="captionsubtle" hint-align="center">42°</text> </subgroup> <subgroup> <text hint-align="center">Tue</text> <image src="Assets\Apps\Weather\Cloudy.png" hint-removeMargin="true"/> <text hint-align="center">57°</text> <text hint-style="captionSubtle" hint-align="center">38°</text> </subgroup> </group> </binding> ...

Images placed in the <binding> root, or in the first group, will also stretch to fit available height.

Image Alignment

Images can be set to align left, center, or right, using the hint-align attribute. This will also cause images to display at their native resolution instead of stretching to fill width.

... <binding template="TileLarge"> <image placement="inline" src="Assets/fable.jpg" hint-align="center"/> </binding> ... leftcenterright Image Margins

By default, inline images have an 8px margin between any content above or below the image. However, this margin can be removed by using the hint-removeMargin attribute on the image.

Note that inline images will always have the 8px margin from the edge of the tile, and subgroups (columns) will always have the 8px padding between columns.

... <binding template="TileMedium" branding="none"> <group> <subgroup> <text hint-align="center">Mon</text> <image src="Assets\Numbers\4.jpg" hint-removeMargin="true"/> <text hint-align="center">63°</text> <text hint-style="captionsubtle" hint-align="center">42°</text> </subgroup> <subgroup> <text hint-align="center">Tue</text> <image src="Assets\Numbers\3.jpg" hint-removeMargin="true"/> <text hint-align="center">57°</text> <text hint-style="captionsubtle" hint-align="center">38°</text> </subgroup> </group> </binding> ... hint-removeMargin falsetrue Image Cropping

Images can be cropped into a circle using the hint-crop attribute, which currently only supports the values “none” (default) or “circle”.

... <binding template="TileLarge" hint-textStacking="center"> <group> <subgroup hint-weight="1"/> <subgroup hint-weight="2"> <image src="Assets/Apps/Hipstame/hipster.jpg" hint-crop="circle"/> </subgroup> <subgroup hint-weight="1"/> </group> <text hint-style="title" hint-align="center">Hi,</text> <text hint-style="subtitleSubtle" hint-align="center">MasterHip</text> </binding> ...

Background Image

To set a background image, place an image element in the root of the <binding> and set the placement attribute to “background”.

... <binding template="TileWide"> <image src="Assets\Mostly Cloudy-Background.jpg" placement="background"/> <group> <subgroup hint-weight="1"> <text hint-align="center">Mon</text> <image src="Assets\Weather\Mostly Cloudy.png" hint-removeMargin="true"/> <text hint-align="center">63°</text> <text hint-align="center" hint-style="captionsubtle">42°</text> </subgroup> ... </group> </binding> ...

Additionally, you can set a black overlay on your background image with hint-overlay, which accepts integers from 0-100, with 0 being no overlay and 100 being full black overlay. The default is 30.

... <binding template="TileWide" hint-overlay="60"> <image src="Assets\Mostly Cloudy-Background.jpg" placement="background"/> ... </binding> ... hint-overlayResult 0 20 60 100 Peek Image

You can specify an image that “peeks” in from the top of the tile. The peek image uses an animation to slide down/up from the top of the tile, “peeking” into view, and then later sliding back out to reveal the main content on the tile.

To set a peek image, place an image element in the root of the <binding>, and set the placement attribute to “peek”.

... <binding template="TileMedium" branding="name"> <image placement="peek" src="Assets/Apps/Hipstame/hipster.jpg"/> <text hint-style="caption">New Message</text> <text hint-style="captionsubtle" hint-wrap="true">Hey, have you tried Windows 10 yet?</text> </binding> ... Peek shownPeek sliding upContent shownPeek sliding downPeek shown Vertical Alignment (Text Stacking)

You can control the vertical alignment of content on your tile with the hint-textStacking attribute on both the <binding> element, and <subgroup> elements. By default, everything is vertically aligned to the top, but you can also align content to the bottom or center.

Text stacking on binding element

When applied at the <binding> level, text stacking sets the vertical alignment of the notification content as a whole, aligning in the available vertical space above the branding/badge area.

... <binding template="TileMedium" hint-textStacking="center" branding="logo"> <text hint-style="base" hint-align="center">Hi,</text> <text hint-style="captionSubtle" hint-align="center">MasterHip</text> </binding> ... hint-textStackingtopcenterbottom With branding or badge Without branding/badge Text stacking on subgroup element

When applied at the <subgroup> level, text stacking sets the vertical alignment of the subgroup (column) content, aligning in the available vertical space within the entire group.

... <binding template="TileWide" branding="nameAndLogo"> <group> <subgroup hint-weight="33"> <image src="Assets/Apps/Hipstame/hipster.jpg" hint-crop="circle"/> </subgroup> <subgroup hint-textStacking="center"> <text hint-style="subtitle">Hi,</text> <text hint-style="bodySubtle">MasterHip</text> </subgroup> </group> </binding> ... topcenterbottom

Channel9 Dev tips for Microsoft Band – How to enrich apps with sensors and notifications

MSDN Blogs - Tue, 06/30/2015 - 13:25

Hello Developers,

Are you looking at tips and tricks on how to code for the Microsoft Band and enrich your apps with sensors and notification?

Head to the following Channel 9 post where 2 MVP's share two new adventures developing for the Microsoft Band.

https://channel9.msdn.com/coding4fun/blog/Two-for-the-Band

- Ahmed

 

Pages

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