Monthly Archives: October 2011

Dynamics GP Business Analyzer with Lync on Touch Tablet

Jivtesh is fast becoming my favorite Microsoft Dynamics GP MVP!

Here are two VERY real scenarios of being able to access Dynamics GP information very easily from your windows tablet device.

Dynamics GP Business Analyzer on a Windows Touch Tablet

Lync with Dynamics GP Business Analyzer on a Windows Touch Tablet

 

Thank you Jivtesh

DCWEEK Hackathon + Dev Days

Registration is still open here but will be limited to 150 attendees. Check out who is attending the event at

http://dcweekdevdays.eventbrite.com/

Microsoft (Chevy Chase)
5404 Wisconsin Avenue 7th Floor
Chevy Chase, MD 20815

Sunday, November 6, 2011 from 8:00 AM to 6:00 PM (ET)

Who?

Developers. Developers. Developers. Limited to 150 attendees.

Note: while we love entrepreneurs and social media strategists, this event is not for you.

What?

The DCWEEK Hackathon + Dev Days are a chance for DCWEEK devs to learn from one another, and work on passion projects/new ideas. Hack, hang, teach, learn…whatever.

A ,000 prize pool has just been announced thanks to the SBA’s Apps for Entrepreneurs challenge! Full details are here.

Apps for Entrepreneurs is also providing 100 free Gold Badges to DCWEEK for developers at the hackathon. You’ll get the badge code on 11/6 – if you’ve bought a badge already this one can be used for someone else.

8:00am – Doors open for coffee/bagels

9:00am – Quick welcome by DCWEEK and quick agenda building (you propose a topic)

10:00am – Session 1: Chose from 3 sessions proposed morning of by attendees

11:00am – Session 2: Chose From 3 sessions proposed morning of by attendees (one will focus on Apps for Entrepreneurs)

12:00pm – Lunch break then open hacking till 6pm

When?

Sunday 11/6 from 9am to 6pm

Where?

We’re taking over the full floor of Microsoft’s Chevy Chase HQ.

Building Mobile Sites With HTML5? Microsoft’s patterns & practices Group Needs Your Help

HTML5LogoThis just in from Redmond via my teammate Joe Healy down in Florida…

Christopher Bennage over in the Microsoft patterns & pracitces (PNP) group (and esteemed developer originating from the Florida dotneterati) has asked for an assist.

pnpLogoThe PNP group is preparing to launch a project delivering guidance about HTML5 development for mobile.

PNP is looking for feedback about what people are doing and what they care about. They’ve listed some potential mobile web development scenarios at http://liike.github.com/scenarios/.

Head up to GitHub and click [Like] on the ones that you care about. Also use the comments spaces to give some additional feedback.

Contribute and enjoy. Thanks… Joe

LightSwitch Star Contest

Think you’ve got what it takes to be a LightSwitch star?  Check out the new LightSwitch application contest at http://www.codeproject.com/Competitions/524/LightSwitch-Star-Contest.aspx.

Nouveauté C++ de la preview de Visual Studio 11 Partie II

Depuis Visual Studio 2010, il est possible d’utiliser les expressions Lambda (forme de méthode anonyme) dans du code C++, et plus précisément avec la STL. Elles sont bien pratique par exemple, lorsque nous les utilisons avec des algorithmes de type for_each, parallel_for, parallel_for_each, etc..

Code Snippet
  1. std::deque<int> d1;
  2.     d1.push_back (2);
  3.     d1.push_back (1);
  4.     d1.push_back(3);
  5.     d1.push_back(0);
  6.     auto a=d1.begin ();
  7.     auto b=d1.end ();
  8.     std::sort(a,b);
  9.     
  10.     std::for_each (a,b,[](int i)
  11.     {
  12.             std::cout << i << std::endl;
  13.     });

Ici la lambda commence par les deux caractères [] qui indiquent que nous ne capturons aucune variable locale par opposition à la syntaxe [&] ou [=] ou nous capturons toutes les variables locales par référence ou par copie respectivement. Le faite de ne capturer aucune variable fait que la lambda est dite stateless (c’est à dire sans état).

Désormais, ce type de lambda est convertie implicitement en pointeur de fonction, en d’autres termes, on va pouvoir les utiliser avec nos bonnes vieilles API Win32.
Un exemple ici avec l’API CreateThreadpoolWork, qui prend comme 1er paramètre un pointeur de fonction de type PTP_WORK_CALLBACK ou nous lui passons à la place une lambda avec bien évidement les bons paramètres.

Code Snippet
  1. PTP_POOL pool=CreateThreadpool(NULL);
  2.     TP_CALLBACK_ENVIRON cbEnviron;
  3.     InitializeThreadpoolEnvironment(&cbEnviron);
  4.     SetThreadpoolThreadMaximum (pool,4);    
  5.     BOOL bRet=SetThreadpoolThreadMinimum (pool,2);
  6.     
  7.     
  8.     PTP_WORK work=CreateThreadpoolWork([]( PTP_CALLBACK_INSTANCE Instance,PVOID Context,PTP_WORK Work)
  9.     {
  10.         
  11.         wprintf(L"Fait du boulot\n");
  12.     },NULL,&cbEnviron);
  13.     SubmitThreadpoolWork(work);    
  14.     WaitForThreadpoolWorkCallbacks(work,FALSE);
  15.     CloseThreadpoolWork(work);
  16.     CloseThreadpool(pool);

Un autre exemple sur l’API EnumWindows, ou nous pouvons mixer du “C++ Moderne” avec des appels d’API à l’ancienne !!

Code Snippet
  1. BOOL ret=EnumWindows ([](HWND hwnd,LPARAM lParam)->BOOL
  2.     {
  3.         const size_t MAX_SIZE=2048;
  4.         LPWSTR title=static_cast<LPWSTR>(_malloca(MAX_SIZE));        
  5.         if (title!=nullptr)
  6.         {
  7.             ZeroMemory (title,MAX_SIZE);
  8.             if (GetWindowTextLength (hwnd) >0)
  9.             {
  10.                 GetWindowTextW  (hwnd,title,MAX_SIZE);
  11.                 wprintf(L"%ls\n",title);
  12.                 _freea(title);
  13.             }
  14.         }
  15.     
  16.         return TRUE;
  17.     },0);    

 

Eric Vernié

New from Microsoft Research: Controlling Home Heating Using Occupancy Prediction

Our friends over in Microsoft Research recently showcased a project, called PreHeat , which is designed to save energy by automatically controlling a home’s thermostat based on predictions of when the occupants will be home. In the U.S. and U.K., home heating uses more energy than any other residential energy expenditure. In the U.S., fewer than half the houses have programmable thermostats, and many of those are used as a manual on/off switches for the furnace. PreHeat uses occupancy sensors to…(read more)

Now Available: Relay Load Balancing for Windows Azure Service Bus

On Friday we added relay load balancing to the Service Bus with support for up to 25 listeners per relay endpoint. Relay load balancing greatly simplifies the task of achieving high availability, redundancy, and scalability by supporting multiple listeners per relay endpoint (up to 25) and distributing work across listeners.

If your existing solution relies on failover through receiving an AddressAlreadyInUse exception for the same relay endpoint, you will no longer see this behavior.  Additional information on this new functionality can be found on the Connectivity and Messaging forum and Service Bus release notes site.

This service update follows closely on the heels of our Pub-Sub messaging enhancements at the BUILD conference, and marks the second enhancement to the Service Bus in less than 45 days. 

We are pleased to deliver this highly requested feature and look forward to your feedback!

[Windows Phone 7.5] Tutoriel simple sur la réalité augmentée, partie 2: Les APIs

Cet article est le deuxième d’une série qui constituent une introduction à la réalité augmentée avec Windows Phone 7.5.

 

Voyons maintenant les API qui nous permettent d’utiliser les différents composants utiles du téléphone, à savoir la caméra, le spatial framework qui permet d’avoir la position du téléphone et les APIs XNA permettant de réaliser les transformations.

 

Accéder au flux de la camera

C’est la partie la plus simple ! en effet avec Mango on dispose de 2 APIs différentes : la classe PhotoCamera, spécifique à Windows Phone, permettant de contrôler la caméra, qu’elle soit frontale ou au dos du téléphone, le flash, le bouton de prise de photo, etc… Une autre API existe, l’API héritée de Silverlight 4, qui garantit la compatibilité avec les applications Desktop, dont nous n’avons cure…

Pour afficher le flux de la caméra à l’écran il faut définir une zone d’affichage, qui sera rectangulaire : pour cela, il suffit de définir un rectangle, dont nous définirons la source du contenu en code :

<Rectangle>
    <Rectangle.Fill>
        <VideoBrush x:Name="viewfinderBrush" />
    </Rectangle.Fill>
</Rectangle>

 

Et pour le code behind :

PhotoCamera camera = new PhotoCamera(CameraType.Primary);
viewfinderBrush.SetSource(camera);

 

Ces quelques lignes suffisent à afficher le flux vidéo à l’écran. Il faut savoir qu’on peut intercepter chacune des frames de la caméra pour y appliquer un traitement, mais cela ne nous intéresse pas dans cet article. C’est en revanche un élément clef pour l’autre type de réalité augmentée, qui nécessite d’appliquer un traitement à l’image pour détecter un tag par exemple.

 

Déterminer la position du téléphone dans l’espace

Maintenant que nous sommes en mesure d’afficher le code de la camera, il nous faut récupérer la position du téléphone. Pour cela nous allons utiliser un spatial framework, c’est-à-dire une API qui permet d’intégrer les fonctionnalités des différents capteurs du téléphone (accéléromètre, boussole, et éventuellement gyroscope), et d’y appliquer un certain nombre de traitements (des filtres par exemple) pour lisser le signal. Comme tous les capteurs dans Windows Phone 7 ce spatial framework dispose d’une interface asynchrone : on va donc l’instantier, le configurer pour recevoir un certain nombre de positions par seconde, et s’abonner à l’évènement de changement de position, avant de le lancer. C’est dans la méthode associé à cet évènement qu’on écrira le code permettant d’afficher les points d’intérêt à l’écran, étant donné que la position de ces points d’intérêt sur l’écran change en fonction de la position du capteur !

Motion motion = null;

if (!Motion.IsSupported)
{
    MessageBox.Show("Motion API Not supported :( ");
    return;
}

if (motion == null)
{
    motion = new Motion();
    motion.TimeBetweenUpdates = TimeSpan.FromMilliseconds(66); // 15 FPS, largement suffisant
    motion.CurrentValueChanged += new EventHandler<SensorReadingEventArgs<MotionReading>>(motion_CurrentValueChanged);

    try
    {
        motion.Start();
    }
    catch (Exception ex)
    {
        MessageBox.Show("Impossible de démarrer l'API Motion! " + ex.Message);
    }
}

 

Vous remarquerez qu’avant toute chose, on teste si l’API Motion est supportée : en effet, pour fonctionner le spatial framework a besoin au moins d’un accéléromètre et d’une boussole… hors cette dernière est optionnelle dans les chassis Windows Phone 7 (de même que le gyroscope). En tout état de cause, sans boussole, impossible de connaitre l’orientation du téléphone et donc de l’utiliser pour faire de la réalité augmentée… Le gyroscope quand il est présent amène quant à lui une bien meilleure précision dans la captation des mouvements du téléphone.

 

Déterminer la position GPS et la direction des points d’intérêt

Notre application exige qu’on connaisse la position de l’utilisateur afin de situer les points d’intérêt autour de lui. C’est chose très facile avec Windows Phone 7, grace à l’API GeoCoordinateWatcher. Encore une fois elle est asynchrone : il faut donc l’instancier, s’abonner à l’évènement de changement de position et démarrer le capteur :

GeoCoordinateWatcher gcw = new GeoCoordinateWatcher(GeoPositionAccuracy.High);
if (gcw.Permission == GeoPositionPermission.Granted)
{
    gcw.MovementThreshold = 20;
    gcw.PositionChanged += new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(gcw_PositionChanged);
    gcw.Start();
}
else
{
    MessageBox.Show("You denied location permission - please enter a location in the textbox");
}
 

Attention à bien vérifier que l’utilisateur a bien autorisé sa géolocalisation avant !

 

Nous avons étudié les concepts mathématiques dans la partie 1, les APIs dans la partie 2, il ne reste plus qu’à utiliser tout cela ensemble pour obtenir une application! c’est l’objectif de la partie 3….

How to subscribe to checkins not under a particular path

Nick Kirchem, who works on the TFS web access team, recently answered a question on how email subscriptions on checkin alerts.  The question was, how do I subscribe to checkin alerts not under a particular folder?

Here’s how to do it.

bissubscribe /eventType CheckinEvent /address someone@domain.com /deliveryType EmailHtml /server http://myserver:8080/tfs/DefaultCollection "’Artifacts/Artifact[@ArtifactType=\"VersionedItem\"][not(starts-with(translate(@ServerItem, \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\", \"abcdefghijklmnopqrstuvwxyz\"), \"$/devdiv/feature/build/qa\"))]‘ <> null"

Let’s break it down.

  • /eventType – Here we want CheckinEvent.  There are others.  Rather than list them, I’d recommend the Alerts Explorer that is part of the Team Foundation Server Power Tools.  You can use it to discover more, as each different type has different things you can filter on.
  • /address – The email address to use.
  • /deliveryType – We want HTML-formatted email.
  • /server – Here I’ve used the URL to the default collection on a TFS 2010 server.  You’ll need to edit it to match the server and collection you need to use.
  • expression – The expression is somewhat hard to read.
    • The path we want to filter out is listed last, which $/devdiv/feature/build/qa in this case.  You must use lowercase for your path.
    • The translate XPath function is used to normalize the casing of the server path to be all lower case.  This is important because XPath is case sensitive.
    • The starts-with XPath function tests to see if the path is one we are interested in (in this case to filter out).
    • The not XPath function inverts the test to see if it is not under the path we want to filter out.
    • The quotation marks are escaped so that they can be inside quotation marks on the Windows command prompt.

I recommend using the Alerts Explorer power tool rather than doing this by hand.  However, in this case, the Alerts Explorer does not support this.

Nick has also written a feature for TFS 11 to allow you to edit alerts inside the product through the web interface.  An early version of it is in the TFS 11 CTP release that came out in concert with the Windows’ //build conference.  Here’s a screen shot of it.  Note that you can only see it in the UI if you enable email in the TFS Administration Console.  Since then he’s made it easier to use and made it so that you can administer other user alerts, if you are an administrator.

image

Related post: Adding a path filter to a CheckinEvent subscription using bissubscribe

BlobShare – A File Sharing Sample Solution Built on Windows Azure

The BlobShare Sample is a simple file sharing application that utilizes the storage services of the Windows Azure Platform, together with the authentication and authorization capabilities of Access Control Service (ACS). The application allows an administrator user to upload files and share them with other users by sending invitations. By leveraging the claims-based service of ACS, invited users will be able to authenticate using the social identity providers and get access to the shared files.

You can download the source code and documentation of the BlobShare app here. Watch Wade and Steve’s discussion below in Cloud Cover episode 63 show. Also, you can read the Vittorio Bertocci’s blog post to see how the app handles identities and access controls.

Note: To test and deploy this sample app, you need a Windows Azure Platform account. If you do not have one, you can get a free 90-day trial account at http://bit.ly/zxazuretrial

fd359b4e-b95e-483b-9dcd-195d2175daee_2

Other Developer Resources:

Windows Azure SDK Download: http://bit.ly/zxazuresdk

Windows Azure Platform Training Kit http://bit.ly/zxazuretraining