Mat Velloso's Blog

Anything about Azure, Windows 8, XAML, Windows Phone, Visual Studio, .Net, Office 365, HTML5, SQL Server, well... you got the idea

  • Mat Velloso's Blog

    Cloud Identity 201: Identity concepts for developers


    Yesterday I've published a new Channel 9 video:

    It talks about basic OAuth concepts and how Azure Active Directory plays a role in your application authentication/authorization scenarios.


  • Mat Velloso's Blog

    Two more videos on O365 APIs and SharePoint


    If you only have 20 minutes and you want to have an overview of SharePoint online and O365 REST APIs, please check these:




  • Mat Velloso's Blog

    New Channel 9 Series: Explain that to me


    I have started a new Channel 9 series called Explain that to me.


    The idea is to explain often difficult concepts in the easiest possible way. To start, we have a video talking about how Identity plays a role putting up Office 365 and Azure together. Let's call it Identity 101. Enjoy:


  • Mat Velloso's Blog

    A detailed guide about creating the ADAL Xamarin binding for Android


    Today I just put together a step by step guidance to get Azure Active Directory Authentication Library to work on a Xamarin Android project:

  • Mat Velloso's Blog

    A detailed guide about creating the ADAL Xamarin binding for iOS


    Just posted it today with screenshots and code samples:

    Will work on an Android version next.


  • Mat Velloso's Blog

    Simple guide for enabling authentication to Azure Active Directory from an application


    Many people ask how to get started with authentication on their mobile app, web app, web service, Xamarin, etc. Usually this first step can be confusing as there are lots of options available with different weaknesses and strengths.


    I wrote a simple guide to help you get started with making those decisions and moving forward:


  • Mat Velloso's Blog

    Setting up a subscription to work with Azure Active Directory and o365


    I've posted a little step by step guide in order to show how to get both an o365 and Azure subscription to work with the same Azure Active Directory (so you can authenticate users seamlessly on both platforms):

    This is the step 1 of a more extensible guidance around creating apps that leverage Azure and o365 together. Stay tuned!


  • Mat Velloso's Blog

    RichEditBox, Store apps and the challenges with advanced text formatting


    This has become a common topic people ask me about so I decided to write it down for future reference.


    If you are using RichEditBox on a store app, you might have realized by now that coding specific format changes in parts of the content is not trivial. Different than RichTextBlock which has a very extensible, c# friendly way of defining paragraphs and custom formatting inside of it (but is not an user editable control), RichTextBlock will allow you to reach some basic properties in order to format the entire content as a single unit, but no c# specific classes and methods for, let's say, format a specific subset of the content with a different font color.

    So how do you do that if you need to?


    I typically suggest two options:


    1-Rely on RTF:

    RichEditBox understands RTF well. So you can either load an entirely RTF formatted document or update parts of a content with RTF tags. For example, imagine the user selects part of the text and you want to format that part only with a different font color. You can do that in a relatively simple way doing this:


    string text;
    richText1.Document.Selection.GetText(Windows.UI.Text.TextGetOptions.None, out text);
                       "{\\rtf1\\ansi\\deff0" +
                       "{\\colortbl;\\red0\\green0\\blue0;\\red255\\green255\\blue0;}" +
                       "\\cf2" + text + "}");

    What we are doing here is getting the selected text on screen, keeping it in a variable, then overwriting it with a RTF content that enforces a specific color definition. In other words, for anything the RichEditBox can't do with it's properties and methods, RTF can.

     I have published this sample here.

    2-Use a HTML based rich text editor.


    Another approach to this problem is to just use a WebView control and load it with a HTML/JS based rich text editor. That way you now have control over the entire HTML content, which will let you do as much as HTML can. There are many sample rich text editors in HTML you can rely on for this.

  • Mat Velloso's Blog

    Xamarin iOS and Android bindings for ADAL (Active Directory Authentication Library)


    If you're diving into building cross platform apps using Xamarin and you need to use Active Directory Authentication Library, you will need to create bindings so you can call the native iOS and Android libraries from C#. Xamarin describes the process of creating bindings libraries in details here (Objective -C) and here (Java). But if that feels like too much work, the AD folks have published sample codes that will get you going:

    Sample binding project for Xamarin iOS

    Sample bindings for Xamarin Android

    I will blog more about getting these things to work later on.








  • Mat Velloso's Blog

    So you did what with PowerPoint??


    I was volunteering in a robotics class when one of the boys started playing with Microsoft PowerPoint in a way that was completely novel to me: He was creating an actual playable computer game in PowerPoint.

    No kidding, I had to record this as a proof, the video below says all.

    What Aaron did got me to think about a couple of things:


    First, what is programming? From my perspective, Aaron figured how to "program" PowerPoint, even if not using an actual programming language. He managed to control decision points and actions without any problems.


    And second: How much more could we do with the tools and technologies we already have, but what's stopping us is just our lack of imagination and different perspectives?

    I don't have much else to say so I will let Aaron run the show. Enjoy:



  • Mat Velloso's Blog

    Are 8 inches Windows tablets a good idea?


    I've been using the Venue 8 Pro for a few days now and I personally think the 8 inches form factor is just perfect for Windows 8.1.

    Then I read a review from the Verge on it which I think was, in my opinion, a bit too harsh:

    Although they seemed to like it a lot, their final conclusion was:

    "At just $299 the Dell Venue 8 Pro is certainly the best Windows-based 8-inch tablet I’ve used so far, but with Lenovo and Toshiba already offering similar competition I suspect there will be even more on the way shortly. I want a small Windows tablet to replace my iPad mini Retina, and I’m convinced it’s a good idea, but for now it’s hard to switch fully. Dell’s Venue 8 Pro might not replace my iPad mini, but it’s certainly good enough to sit alongside it in my bag. I’ll await more Windows 8 apps and a better display until I fully make the switch."


    So it appears that they don't think this device competes with other tablets with supposedly "more apps". Well, let me share my desktop right now with you:



    Basically I've plugged my Venue 8 Pro's Micro USB on a Targus DisplayLink, then used a big touch screen monitor, a keyboard, a USB headset, a wireless mouse and a few other devices, all at the same time. Then after configuring Outlook, SkyDrive and my VPN to work I decided to also install Visual Studio 2013 on it. That's right, I even used Visual Studio while playing a movie on Netflix on the second screen! Now let's think about that for a moment:: Second screen, multiple apps at the same time, visual studio, desktop PC, outlook running at the same time as well without any lags.

    So here's my humble opinion, The Verge: While you think we're lacking apps for our platform I personally would like to see an iPad that could do half of the things I'm doing right now on this $300 8 inches tablet. Not only I can even run SQL Server and Visual Studio on it, plus the other millions of Windows applications that we love and need on a daily basis (which is why most people who use tablets just play games on them).

    So is this a competitor for other tablets? No, not really...

  • Mat Velloso's Blog

    Running Windows 8 Consumer Preview on Samsung Slate 7? Check this


    Samsung has created a page to help you with drivers and everything. Enjoy :)




  • Mat Velloso's Blog

    Switzerland, Shape Conference, WinJS Windows 8, asynchronous and multi-threading


    Hello from Switzerland!


    What a beautiful, beautiful country this is. I’ve just arrived after a long flight from Seattle and on Monday I’ll be presenting at the Shape Conference, thanks to the invitation I’ve got from Ken Casada, a technology evangelist from the Swiss Microsoft team (or should I say “Schweiz”?). And Microsoft keeps allowing me to meet different places and people, how could I not love this job?

    Hey, here’s a view from my hotel room:


    I’m so inspired that I’ve decided to write about technology. (That’s how geeks function, we get inspired and then we do geeky things)

    So let’s talk about WinJS promises and a typical misconception: Asynchronous versus multi-threaded.

    Now if you have read about WinJS promises you have learned it provides a very nice way of running tasks asynchronously. Here’s an example:




    I really like the syntax there. It’s clearly saying: “Hey, download this feed first and then update the UI”.

    The UI won’t freeze because the download is happening, so the experience is not harmed because you’re waiting for the 3G network to do whatever it has to do.

    Now that’s asynchronous to me. But wait, let’s see what happens here:


    My “KillMyCPU” function does what it says: it keeps things busy. Now the thing is, just because promise provides asynchronous capabilities it doesn’t mean it is not single-threaded. When you run this code you’ll notice everything freezes. Because the KillMyCPU function asks for all the CPU’s availability, forcing that thread to not allow anything else to run.

    So what we do in such cases?

    First, you don’t take 100% CPU in a for..loop :) 


    But let’s assume you still want to create additional threads. There are ways around this. One that I particularly like is mixing JavaScript and C# together. Why I like it? Because mixing JavaScript and C# is what web developers have been doing for a long time. They are used to it so this is not so different: You take advantage of what is most powerful about each.


    So what you do:


    1-Create a Metro JS/HTML project

    2-Create a Metro C# class library

    3-Go to the properties of the Metro C# class library and change it to generate a WinMD file

    4-At the Metro JS/HTML project, add a reference to the class library

    5-Create a class like this:

    The class has to be sealed for the WinMD to compile and all it is doing is doing the same for..loop using the ThreadPool.

    6 – From the JavaScript code, call the class:

    Now if you run this you will notice the UI is not being frozen because of this code. Of course this increases the complexity since now you have to deal with multi-threading, multi-language, etc. Still it shows you can actually combine the power of these two languages together.


    Although, it still makes no sense to create a Metro application that consumes so much CPU. Think about tablets, low spec machines and think about the overall experience you want to provide to the user. For that kind of stuff, 100% CPU isn’t a good idea, is it?


    But the point here is to understand that asynchronous and multi-threaded are very different things.


    Now I’ll have to disconnect so I can enjoy Zurich while I’m still here.


    Auf Wiedersehen!


  • Mat Velloso's Blog

    Yet another big step...


    I haven't been updating my blog for quite a few months now.


    And there's a reason for that: I have been quite busy moving. I have changed jobs so now this is my team:


    More specifically I am now part of the Microsoft IT Engineering Architecture team and my focus will be on PoC’s on different technologies, such as Windows Phone, Windows 8 and SharePoint.

    Today was my first day at my new job and I can't really complain about the view you have at the Sammamish campus:

    Not bad, eh?

    After working with/at Microsoft Brazil, Australia, New Zealand and US I can say I can't think about a better company to be at. This is such an awesome organization with so many amazing professionals. I'm proud of the technologies we are creating and to be part of that. So I'll try to keep on blogging every now and then to share what I'm learning with you.

    And if you're visiting the Samm-C campus, come to say hi :)

  • Mat Velloso's Blog

    Team blades - Imagine Cup


    I've been helping these guys on the ImagineCup competition. Please come to check out their work with .Net Microframework to automate a remote controlled helicopter. And when there, please "Like" the page to show your support! :)



  • Mat Velloso's Blog

    Visual Studio 2010 hanging when attempting to debug ASP.Net MVC Apps on Azure solutions - here's how I solved it


    So I was getting very annoyed about a problem I was facing: Every time I attempted to hit F5 on a Azure Solution, Visual Studio 2010 that had an ASP.Net MVC 2 project as the start one, Visual Studio 2010 (even with SP1 beta) got frozen during the build.

    I'm not sure if it is due to some of the millions of beta, alpha stuff I keep installing on my laptop but one way or another, it was still annoying me a lot. Until I tried this:

    1-Menu tools

    2-Import/Export settings

    3-Reset all settings

    Then instead of selecting the C# developer profile (I never select this one BTW, just did it once to see how that felt and honestly didn't like it because several of the menu shortcuts I love on the general developer did disappear) I selected the normal settings I always like which is the general developer one.

    Did a quick restart of visual studio and after that guess what? Problem gone!

    Not quite sure what the relation is, but hey, it worked! So if you have the same problem, give this a try.

  • Mat Velloso's Blog

    Nokia + Microsoft


    I know I speak for many of us at Microsoft when I say: WELCOME NOKIA! We are very glad to work with you guys :)


  • Mat Velloso's Blog

    Windows 7 tablet, my user interface experiments with WPF, C# and lots of APIs


    After playing a bit with a Windows 7 slate I decided to create a project, just for fun, to test a few ideas on it.

    Basically what I’m trying to create is a companion kind of tool that assists with common tasks related to using applications that are not built to be used in a touch screen, without mouse or keyboard.

    I didn’t spend much time on it yet but I decided to show what I’ve got so far. So please be nice and consider this is just a test I’ve created for fun, nothing more.

    If your attention span only goes this far, just look at what I’ve built here:


    Keep in mind this is a WPF, 32bit application written in C#, running on an Intel Atom slate with 2 GB Ram. I did not disable any visual feature, nor did any optimization on windows itself.

    So basically this tools docks into the screen and reads the start menu, offering a Windows Phone 7 style of navigation into the items. It’s quite handy because you can do the whole navigation with your thumb as you hold the device. Now here’s the trick: The start menu items aren’t stored in a single folder but basically in two different places: One is your specific Star Menu Items list and the other is the all users list. You basically have to merge both so a good place to start in .Net is looking at these two places:





    These will help you to get the list as it appears in your start menu.

    Ah, but not so fast! You will notice that most of the items in these folders are .lnk files, not the actual programs. What’s the challenge with that? None really, unless you want to show the real icons from the each executable these applications correspond to. In which case you will have to decode the .lnk file, find the target executable it links to, and use a few APIs to get the corresponding icon so you can bind it to the WPF list. Piece of cake! :)


    Next you can see I added a few buttons for typical things you want to do with windows: Maximize, minimize, etc. How we do that? Basically we have to hook into the foremost open window using a few APIs so we can get the window handler, also known as hWnd. Doing so we can then send commands such as minimize, maximize, close and etc.

    But we can do far more than that. Assuming the application running uses old style menus, we can also hook into them, showing an easier to access list to the user without having to even touch the application:

    Keep in mind this works with legacy apps. The new ribbon and other styles of menus aren’t that simple to hook into. And that’s why I created another tab, with common tasks we are likely going to execute in most applications:

    For these, I simply send the corresponding key combination to the open window so it responds accordingly. Ctrl+S for save, Ctrl+V for paste and so on.

    I’ve also been working on a magnifier using the magnifier APIs, but since they aren’t touch compatible I decided for simply opening the windows magnifier instead. I actually managed to make part of the magnifier API work with touch but that was pretty much a hack so never mind about that…

    That’s pretty much it. Hope you have as much fun watching it as I had building it :)

  • Mat Velloso's Blog

    BluesBox v2


    We finally uploaded the BluesBox v2 to Marketplace. Should be available soon.

    Beyond Daryl "Mad dog" Ooh's new UI design, I also added a bit more functionality to support doing the background bass playing so two or more people can play together.

    Also included a tutorial video and did a hell lot of bug fixing. We had a few issues around multi touch (it can be tricky when dealing with sliding around the notes and controling which sounds need to start/stop) but I think I managed to fix everything now.

    You can watch it working here:

    I already have a whole lot of cool ideas for next version, but way too little time to build it. So far I spent less than two days with building this thing. I think I need a part time job :(



  • Mat Velloso's Blog

    Trade Me API - How to do the bidding part?


    So a few of you have asked how to implement the bid functionality using the Trade Me API and I honestly didn't know because I never tried that myself.

    But Mr. Nikhil Ramrakhiani did it and was very kind to provide a code sample, which I'm making available here.

    Many thanks to Nikhil and hope it helps everybody else!

  • Mat Velloso's Blog

    Behold! These smart kiwis and their great Windows Phone 7 apps!


    Ok, so I'm finally doing what I've promised some time ago: Talk about some of our Windows Phone 7 challenge competitors!

    I'm my defence, I've been a bit busy these days so apologies for taking so long!

    I want to mention the top 5 finalists of each categories, plus a few others that also called my attention so let's go:


    New Zealand Category

    App name: Event Finder NZ

    One of the winners of the WP7 competition, Event Finder NZ has quite a nice user interface and provides an easy way of searching for events:


    You can watch the video here:

    The author is Sashank Ramkumar.

    App name: Auckland Transits

    The second winner of the NZ category, Auckland Transits provides a handy way of finding the best public transport option for getting around Auckland:


    One cool thing I like about this app is that it makes use of the tiles, once you select your route:


    Nice eh?

    The presentation video can be found here:

    The author is Shane S. Anderson.

    App name: Checka

    Now that app is scary. I honestly had no idea you could get all this information from a car's license plate and I'm not sure I feel good about this. Nevertheless it is a very handy and well-built app:


    You can watch the video here:

    And the author is Sean Jackson

    App name: Get Kicking

    Now this guy is a XNA ninja and he had no problem showing this on this little 3D Rugby game:


    (By the way, he managed to build most of it without an actual phone device to test it!)

    You can watch the video here:

    And the author is Guy Sherman

    App name: Fruit Salad

    What a cute little game! We loved the concept and the graphics. And I personally loved the fact that this was built by a female developer. Unfortunately we didn't have many in this competition...


    You can watch the video here:

    And the author is Beverley Laundry

    App name: What's On NZ?

    That's quite similar to the Event Finder NZ and was another strong candidate.


    You can watch the video here:  (I quite like the intro in the video too!)

    And the author is Vinny Jeet

    App name: Today on TVNZ

    Another strong candidate. Very good looking little app!


    You can watch the video here:

    And the author is Thivyakanth Ruthramoorthy (Thivy)

    Trade Me Category

    App name: Trade Me Mobile

    One of the winners of the WP7 competition in the Trade Me category, the Trade Me Mobile provides a nice user interface and some cool navigation functionality:


     You can watch the video here:

    The author is Brian Donovan-Smith.

    App name: Gooseberry

    The other winner of the WP7 competition in the Trade Me category, Gooseberry also provides generic Trade Me related functionality and good looks:


     You can watch the video here: (another catchy video/music BTW)

    The author is Seshi Chemudugunta

    App name: Open Home Finder

    Different than the first two, this is a more specific app that helps people to find open homes.

    The idea is pretty cool and the app was quite well built:


    You can watch the video here:

    The author is Steve Chadbourne

    App name: My Trades

    Yet another great general purpose Trade Me application. Will blog more about this guy later as he has been very helpful with some Trade Me API related questions.


    Lots of features!

    You can watch the video here:

    The author is Nikhil Ramrakhiani

    App name: Scout About

    This app works with the properties in your watch list. It allows managing the properties in lists/groups and getting more information about directions and details about the auction. Very handy.


     You can watch the video here:

    The author is Andrew Jackson

    App name: Price This!

    Ok, this is my personal favourite. It is so crazy that it is actually a great idea: It is a Trade Me game.

    Yes, a game. Crazy? Yes, definitely. Would you have imagined such an idea? No. That's why it is so awesome.



     You can watch the video here:

    And the author is Henry Chong

    App name: ISBN Barcode Sleuth for Trade Me

    What's cool about this one? Two words: Barcode reader.

    Yes, they've ported a Barcode reading library to the phone! Need to say more?


    Very nice work. I've asked these guys to write us an article about how they did it. Will they say yes? :)

    You can watch the video here:

    And the authors are Zhi Lee and Mathew Peachy, who is still waiting for a t-shirt, I know, I know.


    And there is more, many more. I've just picked a few apps to show you why you should be proud of New Zealand developers. These guys built this in their spare time, with only one or two developers, in one month. That's it!



  • Mat Velloso's Blog

    The Ultimate New Zealand Windows Phone 7 Apps List


    From now on I'll be maintaining this list of NZ made WP7 applications that are currently available in the Zune Marketplace.

    If you app isn't there, please let me know:



  • Mat Velloso's Blog

    Free ebook: Programming Windows Phone 7, by Charles Petzold


    In case you didn't see this, it's a free downloadable pdf format ebook, including source code samples:


  • Mat Velloso's Blog

    Love Windows Phone 7? Got a Mac? Then read this


    The beta of the Windows Phone 7 connector for Mac is available to download here:

    It basically allows synchronization music, videos, podcasts and photos from iTunes and iPhoto to your phone.

    I'm sure this will make some people quite happy :)

  • Mat Velloso's Blog

    Professional Developers Conference – Live from the Microsoft Redmond Campus this Friday!


    The Microsoft Professional Developers Conference (PDC) kicks off this Friday (29 October) morning and we would like to invite you to participate in this year conference LIVE in New Zealand. This year's PDC online event will include live streaming of the keynote, as well as concurrent live streaming of all sessions. No registration is required. Join the live streaming and on demand sessions from the 29th October. You can join us on the web or with the MS Communities User Group starting this Friday.

    Since 1991, the Microsoft PDC has been the centre of Microsoft's biggest platform announcements. This year will be no exception. So, make sure you join your local user group or on the web to watch the latest PDC announcements.

    URL Links

Page 1 of 2 (50 items) 12