mardi 27 octobre 2015

New Imgur .NET SDK on Github, can be used Universal App, WinRT app, Windows Phone, any .net project


Github Repo: https://github.com/Delaire/Imgur-.NET-SDK

How to use this sdk:

You first need to get your API key and secret id which you can find on the imgur website https://api.imgur.com/oauth2/addclient and/or here if you already have a done this: https://imgur.com/account/settings/apps
To start you need to initialize the api:
    ApiRoot.Instance.Init("XXXXXXXX", "XXXXXX");
All of the methods are async, so just remember that you need to wait for the response.
I have mapped all of the imgur api endpoint which can be found here: https://api.imgur.com/endpoints to classes.

Here is example of how the API works with the GetEndPointEntityAsync method:
You will tell the method the type of data you plan on receiving and then tell it where to get this data:
    ApiRoot.Instance.GetEndPointEntityAsync<RootElement<Data_Format_we_will_recieve>>(
                      new Data_to_get()
                          {
                                    //Data parameters
                          });
Here is a real example for how you can make a call:
    var result = await ApiRoot.Instance.GetEndPointEntityAsync<RootElement<GalleryImage>>(
            new GetGalleryImage ()
            {
                page = 0,
                section = Section.hot.ToString(), <- cloud be improved
                showViral = true,
                sort = Sort.top.ToString(),
                window = WindowsSort.day.ToString(),
            });
Here is another example of how to do a Get Random Gallery Image
    ApiRoot.Instance.GetEndPointEntityAsync<RootElement<GalleryAlbum>>(
                 new GetRandomGalleryImages()
                    {
                            page = 1
                    });

This API sdk is used in my personal windows phone imgur app 8gur which can be found here: http://windowsphone.com/s?appid=15913087-9ea1-4f42-92b0-8b2c1c764837
if you wish to help be my guest!
Here is the Github Repo: https://github.com/Delaire/Imgur-.NET-SDK


mercredi 21 octobre 2015

Using AppVeyor CI to build a Windows Phone 8.1 XAML App with Ad Mediator and Player Framework, what I had to do, to make it work!

What I want to do:
As a developer I am LAZY and like to make sure that when I push code to my GitHub repo that it doesn’t break everything, that is why I love AppVeyor. AppVeyor will build my app or code every time a push code to Github.

Lets get Started:
I have create a sample application called ‘’ExampleApp‘’ which contains the references that can’t just installed using nugget.

Usually on AppVeyor to load the libraries needed to build the application you would go into settings:


Then into Build:



And making sure that before the build is built you launch a script that will restore all of your nuget packages: nuget restore ExampleApp \ExampleApp.sln

Side note: make sure that you select platform version x86, ARM or else Ad Mediation will not build.

For our sample app that I want AppVeyor to build, I will add 2 references Ad Mediator and Microsoft player Framework before the application is built:

Here is a screenshot of the references of my app:


AppVeyor cannot load these references using nuget, so we are going to have to write a PowerShell script (please don’t start running this will be simple!! I Promise).

AppVeyor spawn a VM every time you launch a build of your project so running a PowerShell script should be easy! And its even easier thanks to their interface.

To Start:

You need to find the correct .msi & .vsix files needed to be installed on the machine.  Here are the Urls for the two files that I need to install:

  1. For Ad Mediation the url is ‘https://visualstudiogallery.msdn.microsoft.com/401703a0-263e-4949-8f0f-738305d6ef4b/file/146057/6/AdMediator.msi’ 

  2. For Player Framework 2.0 the Url is ‘http://download-codeplex.sec.s-msft.com/Download/Release?ProjectName=playerframework&DownloadId=845206&FileTime=130449531816430000&Build=21031’

Once you have found those urls we can use this PowerShell script:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
Write-Host "Installing Microsoft Universal Ad Client SDK..."
$msiPath = "$($env:USERPROFILE)\AdMediator.msi"
(New-Object Net.WebClient).DownloadFile('https://visualstudiogallery.msdn.microsoft.com/401703a0-263e-4949-8f0f-738305d6ef4b/file/146057/6/AdMediator.msi', $msiPath)
cmd /c start /wait msiexec /i $msiPath /quiet
Write-Host "Installed" -ForegroundColor green
 
 
Write-Host "Installing Microsoft Player Framework 2.0 ..."
$vsixPath = "$($env:USERPROFILE)\Microsoft.PlayerFramework.vsix"
(New-Object Net.WebClient).DownloadFile('http://download-codeplex.sec.s-msft.com/Download/Release?ProjectName=playerframework&DownloadId=845206&FileTime=130449531816430000&Build=21031', $vsixPath)
"`"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\VSIXInstaller.exe`" /q /a $vsixPath" | out-file ".\install-vsix.cmd" -Encoding ASCII
& .\install-vsix.cmd
Write-Host "Installed" -ForegroundColor green


side note: remember that this script needs to run before the build is launched.


Launch your build and Eureka, the build passes:



I hoped this small tutorial has helped you out in better using AppVeyor.


Bonus 1
You can connect to the VM AppVeyor spawns to debug and see what packages you are missing using:

1
$blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))


In the console you will get the information you need (Server IP, Username, Password) to connect to the VM using a Remote Desktop:



Bonus 2
AppVeyor allow you to have a badge on your Github repo which allows you to know if the build is building or not =).  This can be found in MyProject -> Settings -> Badges, here is an example of my badge
https://ci.appveyor.com/api/projects/status/tie0te4no2uxlxn5?svg=true



 PS: this is my first post, so please don’t hesitate to writ e comment and tell me if you liked it or not!

lundi 19 octobre 2015

Console.WriteLine("Hello, World!"); - Damien Delaire, Windows Software Engineer

Hello World this is my first blog post and I am testing this out!

I am Software Engineer, working in San Francisco, California for DAILYMOTION as their Lead Mobile Software Engineer for Windows Store & Windows Phone. Before that I used to work for a star-up called Pret d’Union (financial sector) in Paris, France as a Back-end .NET Software Engineer.

I have a double masters in MSc Software Engineering with Oxford Brookes University and my MSc in Computer Science with SUPINFO Paris University. Having lived in New York State for 6 years and having finished my studies in the United Kingdom, I am bilingual in English and French.

Additional Information:

On my free time I like to develop Windows Store and Windows Phone applications. These applications allow me to try out new features, try to prototype new idea, exchange with other programmers. Also, this gives me the opportunity to learn and improve my skills. You can check out my different applications here for Windows Store and Here for Windows Phone.

I am also stackoverflow asking questions and answering them to try and help the windows store and phone community move forward.

Even More information:

I participated in the Imagine Cup 2012 in Software Design category, Azure and Windows Phone 7, our name was called Doctor Me. We participated in the competition Imagine Cup 2012 World & National (France). More info here...

I participated in the Imagine Cup 2011 in the Windows Phone 7 category. My project passed round one of the World competition and the National competition, we were selected as French finalist and went to Paris to present our project to a jury. More info here...

I am open to any professional opportunities, please do not hesitate to contact me.


Github: https://github.com/Delaire
Linkedin: https://www.linkedin.com/in/damiendelaire
Stackoverflow: http://stackoverflow.com/users/1733263/damien


Example code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
namespace Delaire.Controls
{
 public class AzertyView: ListView
 {
  public AzertyView()
  {
   this.SizeChanged += AzertyView_SizeChanged;
  }
  private void AzertyView_SizeChanged(object sender, Windows.UI.Xaml.SizeChangedEventArgs e)
  {
   if(ItemsPanelRoot!=null)
    ItemsPanelRoot.Width = e.NewSize.Width;
  }
 }
}