<rss xmlns:a10="http://www.w3.org/2005/Atom" version="2.0">
  <channel xml:base="https://jphellemons.nl/">
    <title>JPHellemons</title>
    <description>Latest blog posts</description>
    <a10:link href="https://jphellemons.nl/" />
    <item>
      <guid isPermaLink="true">https://jphellemons.nl/post/stake-neblio-on-your-pi</guid>
      <link>https://jphellemons.nl/post/stake-neblio-on-your-pi</link>
      <a10:author>
        <a10:name />
      </a10:author>
      <title>Stake Neblio on your pi</title>
      <description>Run a Neblio Docker container to stake on a Raspberry Pi</description>
      <pubDate>Sat, 20 Feb 2021 05:34:38 +0100</pubDate>
      <a10:updated>2021-02-23T10:03:36+01:00</a10:updated>
      <a10:content type="text">&lt;p&gt;As I’ve blogged a while ago (july 2019), I made my &lt;a href="https://jphellemons.nl/post/docker-for-raspbian-buster-10-on-a-raspberry-pi-3-and-rabbitmq"&gt;pi a docker host&lt;/a&gt;. I used a pi 3, but moved now to a pi 4 with ubuntu as host.&lt;/p&gt;&lt;p&gt;If you want to know how I did it, my collegeau Johan explains it on his blog &lt;a href="http://johanthedeveloper.com/how-to-install-ubuntu-on-a-raspberry-pi/"&gt;How to install Ubuntu on a Raspberry PI – Johan the Developer&lt;/a&gt; and the followup &lt;a href="http://johanthedeveloper.com/how-to-setup-docker-on-a-raspberry-pi/"&gt;How to install Docker on a Raspberry PI – Johan the Developer&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Once you have that in place, you can proceed to get a Nebl Docker container.&lt;img align="right" style="margin: 0px 0px 10px 10px; float: right; display: inline;" src="https://getcrypto.info/images/logos/neblio.png" /&gt;&lt;/p&gt;&lt;h2&gt;&lt;/h2&gt;&lt;h2&gt;The Nebl Docker container&lt;/h2&gt;&lt;p&gt;I found this official one on dockerhub &lt;a href="https://hub.docker.com/r/neblioteam/nebliod-rpi"&gt;neblioteam/nebliod-rpi (docker.com)&lt;/a&gt;&lt;/p&gt;&lt;p&gt;The instructions are always clear at dockerhub. Step 1 is to get the image:&lt;/p&gt;&lt;p&gt;docker pull neblioteam/nebliod-rpi&lt;/p&gt;&lt;p&gt;Step 2 is to use the image to run a container:&lt;/p&gt;&lt;p&gt;sudo docker run -d --restart=always --name nebliod -v $HOME/neblio-data:/root/.neblio -p 6325:6325 neblioteam/nebliod-rpi&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;If you are less familiar with Docker, this does mount the folder /root/.neblio in your container to the folder on your docker host at the home or ~ and then neblio-data. This contains your wallet which password is generated at the 1st start of the container.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;h2&gt;Use the container&lt;/h2&gt;&lt;p&gt;I started a shell in the container, so it will save me some typing:&lt;/p&gt;&lt;p&gt;sudo docker exec -it nebliod bash&lt;/p&gt;&lt;p&gt;you can get your wallet address with this command:&lt;/p&gt;&lt;p&gt;nebliod listreceivedbyaddress 0 true&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;If you would not start bash first, but just run it from your docker host:&lt;/p&gt;&lt;p&gt;sudo docker exec -it nebliod nebliod listreceivedbyaddress 0 true&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;You can see that the password is random on line 16 here&lt;/p&gt;&lt;p&gt;&lt;a href="https://github.com/NeblioTeam/docker-nebliod/blob/master/docker-nebliod-rpi/bin/neblio_init"&gt;docker-nebliod/neblio_init at master · NeblioTeam/docker-nebliod (github.com)&lt;/a&gt;&lt;/p&gt;&lt;p&gt;You should transfer Nebl to your wallet. It will take 24 hours to mature. Then the weight will gain for staking.&lt;/p&gt;&lt;p&gt;Run the nebliod getstakeinginfo to see the weight, if the coins are mature and the expectedtime in seconds for staking.&lt;/p&gt;&lt;p&gt;You can also use nebliod getbalance to just get the balance from your wallet without the address and confirmations which the listreceivedbyaddress returns.&lt;/p&gt;&lt;p&gt;So it’s all up and running 24/7 on my Raspberry Pi 4. Now it’s just a matter of time before I will receive the first stake.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;If you want to know more about Neblio, please check out their website at &lt;a href="https://nebl.io/"&gt;Neblio - Blockchain. Simplified.&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Good luck! I hope it’s helpful&lt;/p&gt;</a10:content>
    </item>
    <item>
      <guid isPermaLink="true">https://jphellemons.nl/post/add-azure-active-directory-to-xamarin-forms-app</guid>
      <link>https://jphellemons.nl/post/add-azure-active-directory-to-xamarin-forms-app</link>
      <a10:author>
        <a10:name />
      </a10:author>
      <title>Add Azure Active Directory to Xamarin Forms app</title>
      <description>&lt;p&gt;As I’ve previously blogged, I created a Xamarin Forms application to submit pictures of my receipts to the company I work for. But if I’d publish the app in that state, the whole world could send in receipts on my behalf. So I needed to add authentication. Because the company uses Office 365, I’d decided to add Azure Active Directory.&lt;/p&gt;&lt;p&gt;There are a lot of resources about Adal (Active Directory Authentication Library) Some call it Azure Adal.NET&lt;/p&gt;&lt;p&gt;You can read about it on the Github page &lt;/p&gt;&lt;p&gt;&lt;a title="https://github.com/AzureAD/azure-activedirectory-library-for-dotnet" href="https://github.com/AzureAD/azure-activedirectory-library-for-dotnet"&gt;https://github.com/AzureAD/azure-activedirectory-library-for-dotnet&lt;/a&gt;&lt;/p&gt;&lt;p&gt;It is also very clear in the readme.md that you should in fact upgrade to MSAL.Net&lt;/p&gt;&lt;p&gt;&lt;em&gt;“&lt;/em&gt;&lt;a href="https://github.com/AzureAD/microsoft-authentication-library-for-dotnet"&gt;&lt;em&gt;MSAL.NET&lt;/em&gt;&lt;/a&gt;&lt;em&gt; is the new authentication library to be used with the Microsoft identity platform”&lt;/em&gt;&lt;/p&gt;&lt;p&gt;Searching for Xamarin.Forms and Msal.Net did not gave me that much options, so I decided to blog about it.&lt;/p&gt;&lt;p&gt;MSAL stands for MicroSoft Authentication Library. The Github is &lt;a title="https://github.com/AzureAD/microsoft-authentication-library-for-dotnet" href="https://github.com/AzureAD/microsoft-authentication-library-for-dotnet"&gt;https://github.com/AzureAD/microsoft-authentication-library-for-dotnet&lt;/a&gt;&lt;/p&gt;&lt;p&gt;It’s for Oauth2 and OpenID connect.&lt;/p&gt;&lt;p&gt;I started with adding an application registration in the azure portal under azure active directory at “app registrations”&lt;/p&gt;&lt;p&gt;I switched to “Single tenant” at the authentication tab/page to make sure that only people from within Partech are allowed.&lt;/p&gt;&lt;p&gt;Further more you need to write down the app (client) id and the directory (tenant) id.&lt;/p&gt;&lt;p&gt;Next was the code integration:&lt;/p&gt;&lt;p&gt;1. add nuget ‘Microsoft.Identity.Client’ to the Xamarin shared app&lt;/p&gt;&lt;p&gt;2. make sure your app.xaml.cs looks like this:&lt;/p&gt;&lt;p&gt;&lt;pre&gt;&lt;code&gt;
public static IPublicClientApplication PCA;
private const string applicationClientId = "clientidhere";
public static string[] Scopes = { "User.Read" };
public static string Username = string.Empty;

public static object ParentWindow { get; set; }


public App()
{
	PCA = PublicClientApplicationBuilder.Create(applicationClientId)
		.WithTenantId("tenantid here")
		.WithRedirectUri($"msal{applicationClientId}://auth")
		.WithIosKeychainSecurityGroup("com.microsoft.adalcache")
		.Build();


	InitializeComponent();

	MainPage = new MainPage();
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;3. to the mainpage I added an override of OnAppearing which called an async CheckAuth&lt;/p&gt;&lt;p&gt;4. add this code to checkauth:&lt;/p&gt;&lt;p&gt;&lt;pre&gt;&lt;code&gt;
AuthenticationResult authResult = null;
IEnumerable&lt;iaccount&gt; accounts = await App.PCA.GetAccountsAsync();
try
{
	IAccount firstAccount = accounts.FirstOrDefault();
	authResult = await App.PCA.AcquireTokenSilent(App.Scopes, firstAccount)
						  .ExecuteAsync();
}
catch (MsalUiRequiredException ex)
{
	try
	{
		authResult = await App.PCA.AcquireTokenInteractive(App.Scopes)
								  .WithParentActivityOrWindow(App.ParentWindow)
								  .ExecuteAsync();
	}
	catch (Exception ex2)
	{
		DisplayAlert("Acquire token interactive failed. See exception message for details: ", ex2.Message, "Dismiss").RunSynchronously();
	}
}

if (authResult != null)
{
	await GetHttpContentWithTokenAsync(authResult.AccessToken);
}
&lt;/iaccount&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;5. for the rest of the code to retrieve the users given name, surname etc. you should check the GitHub link I mentioned previously.&lt;/p&gt;&lt;p&gt;To do more with azure AD use the &lt;a href="https://developer.microsoft.com/en-us/graph/graph-explorer/preview"&gt;Graph explorer&lt;/a&gt; &lt;/p&gt;&lt;p&gt;Good luck coding!&lt;/p&gt;</description>
      <pubDate>Sat, 08 Aug 2020 08:43:18 +0200</pubDate>
      <a10:updated>2020-08-08T08:43:18+02:00</a10:updated>
    </item>
    <item>
      <guid isPermaLink="true">https://jphellemons.nl/post/building-a-mobile-declaration-app</guid>
      <link>https://jphellemons.nl/post/building-a-mobile-declaration-app</link>
      <a10:author>
        <a10:name />
      </a10:author>
      <title>Building a mobile declaration app</title>
      <description>&lt;p&gt;There was an email earlier this year about a change in declarations from my employer. You can’t just drop receipt on someone’s desk anymore, but since we are in a digital era, we should make a picture of it and send it by mail. That sounds fair. But that would require me to remember the constraints, like letting know for which client it is and to which address I should send it to. So I decided that it needed automation.&lt;/p&gt;&lt;p&gt;Because some coworkers have iPhones and some have Android, I decided to go for this approach:&lt;/p&gt;&lt;p&gt;&lt;img width="800" height="600" title="architecture" style="border: 0px currentcolor; border-image: none; display: inline; background-image: none;" alt="architecture" src="https://www.jphellemons.nl/posts/files/283f01b4-e839-4588-a355-a3cfe5b74f7a.png" border="0"&gt;&lt;/p&gt;&lt;p&gt;Xamarin Forms (Android, iOs) post a picture of a receipt to Azure Functions in the Azure cloud which sends it to Sendgrid. (Because Azure Functions cannot send mail)&lt;/p&gt;&lt;p&gt;Here are the steps I took to make a simple camera app:&lt;/p&gt;&lt;p&gt;1. File, new project, new Xamarin Forms project (no web api)&lt;/p&gt;&lt;p&gt;2. Add new project to solution (Azure Functions)&lt;/p&gt;&lt;p&gt;3. Add the nuget package ‘&lt;em&gt;Xam.Plugin.Media&lt;/em&gt;’ to the shared/main xamarin project&lt;/p&gt;&lt;p&gt;4. Add UI code:&lt;/p&gt;&lt;p&gt;
&lt;pre&gt;&lt;code&gt;
&lt;stacklayout&gt;
        &lt;button x:name="takePhoto" text="Take picture" clicked="takePhoto_Clicked"&gt;
        &lt;img x:name="image"&gt;
        &lt;button x:name="sendPhoto" text="Send" clicked="sendPhoto_Clicked" isenabled="False"&gt;
    
&lt;/button&gt;&lt;/stacklayout&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;5. Add code to cs (code behind file)&lt;/p&gt;&lt;p&gt;I had three class variables (type string) filePath, filename, url (url to your azure function) I forgot that the emulator is a vm so you can’t use the localhost if you are testing the Azure Function but you should use your LAN ip.&lt;/p&gt;&lt;p&gt;&lt;pre&gt;&lt;code&gt;
private async void takePhoto_Clicked(object sender, EventArgs e)
{
	if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
	{
		await DisplayAlert("No Camera", ":( No camera avaialble.", "OK");
		return;
	}
	filename = DateTime.Now.ToString("yyyyMMdd-") + Guid.NewGuid() + ".jpg";

	var file = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions
	{
		PhotoSize = PhotoSize.Medium,
		Directory = "Sample",
		Name = filename
	});

	if (file == null)
		return;

	filePath = file.Path;

	image.Source = ImageSource.FromStream(() =&amp;gt;
	{
		var stream = file.GetStream();
		file.Dispose();
		return stream;
	});
	sendPhoto.IsEnabled = true;
}

private async void sendPhoto_Clicked(object sender, EventArgs e)
{
	HttpContent fileStreamContent = new StreamContent(File.OpenRead(filePath));
	fileStreamContent.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("form-data") { Name = "file", FileName = filename };
	fileStreamContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/octet-stream");

	using (var client = new HttpClient())
	using (var formData = new MultipartFormDataContent())
	{
		formData.Add(fileStreamContent);
		var response = await client.PostAsync(url, formData);
	}
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;6. add `await CrossMedia.Current.Initialize();` in the android project in the mainactivity.cs just below the OnCreate call&lt;/p&gt;&lt;p&gt;7. add this code to the azure function:&lt;/p&gt;&lt;p&gt;&lt;pre&gt;&lt;code&gt;
string imageBase64;

using (var ms = new MemoryStream())
{
	file.CopyTo(ms);
	var fileBytes = ms.ToArray();
	imageBase64 = Convert.ToBase64String(fileBytes);
}

string sendgridApiKey = "api-key-here";

var client = new SendGridClient(sendgridApiKey);
var from = new EmailAddress("mymailaddress@partech.nl", "JP Hellemons");
var subject = "Declaraton from app";
var to = new EmailAddress("mymailaddress@partech.nl", "JP");

var msg = MailHelper.CreateSingleEmail(from, to, subject, "plain msg", "html version");
msg.AddAttachment(file.FileName, imageBase64, "image/jpeg", "attachment");
var response = await client.SendEmailAsync(msg);

return new OkObjectResult("");
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;8. of course make a free account at sendgrid and just follow the tutorial/docs for adding the nuget package to the Azure Function.&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;Next post will contain a link to the Azure Active Directory for authenticating so that not everybody will send in receipts on my behalf.&lt;/p&gt;&lt;p&gt;Good luck!&lt;/p&gt;</description>
      <pubDate>Sat, 08 Aug 2020 08:39:14 +0200</pubDate>
      <a10:updated>2020-08-08T08:39:14+02:00</a10:updated>
    </item>
    <item>
      <guid isPermaLink="true">https://jphellemons.nl/post/use-fontawesome-in-xamarin-forms</guid>
      <link>https://jphellemons.nl/post/use-fontawesome-in-xamarin-forms</link>
      <a10:author>
        <a10:name />
      </a10:author>
      <title>Use FontAwesome in Xamarin Forms</title>
      <description>&lt;p&gt;I followed this guide: &lt;a title="https://medium.com/@tsjdevapps/use-fontawesome-in-a-xamarin-forms-app-2edf25311db4" href="https://medium.com/@tsjdevapps/use-fontawesome-in-a-xamarin-forms-app-2edf25311db4"&gt;https://medium.com/@tsjdevapps/use-fontawesome-in-a-xamarin-forms-app-2edf25311db4&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Where you manually have to edit a XML file to get it to work in iOS and add the font for each platform you want to support. So for FontAwesome (regular, bold, brands) and UWP, Android, iOS. That gives 9 files!&lt;/p&gt;&lt;p&gt;which eventually works: &lt;/p&gt;&lt;p&gt;&amp;lt;Label Text="&amp;amp;#xf0f3;" FontFamily="{StaticResource FontAwesomeRegular}" FontSize="Large" TextColor="Red" /&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Label Text="&amp;amp;#xf26e;" FontFamily="{StaticResource FontAwesomeSolid}" FontSize="Large" TextColor="Red" /&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Label Text="&amp;amp;#xf26e;" FontFamily="{StaticResource FontAwesomeBrands}" FontSize="Large" TextColor="Red" /&amp;gt;&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;BUT: If you would just update to Xamarin Forms 4.5.0.530 or higher&lt;/p&gt;&lt;p&gt;you can add a line for a font. (so 3 times something like this for FontAwesome) &lt;/p&gt;&lt;p&gt;[assembly: ExportFont("FontAwesome5Regular400.otf", Alias = "FontAwesome")]&lt;/p&gt;&lt;p&gt;to your app.xaml.cs &lt;/p&gt;&lt;p&gt;and use &lt;/p&gt;&lt;p&gt;&amp;lt;Label Text="&amp;amp;#xf0f3;" FontFamily="FontAwesome" FontSize="Large" TextColor="Green" /&amp;gt;&lt;/p&gt;&lt;p&gt;in your mainpage.xaml&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;good luck!&lt;/p&gt;</description>
      <pubDate>Sat, 08 Aug 2020 08:37:48 +0200</pubDate>
      <a10:updated>2020-08-08T08:37:48+02:00</a10:updated>
    </item>
    <item>
      <guid isPermaLink="true">https://jphellemons.nl/post/teddy-bear-hunt-app</guid>
      <link>https://jphellemons.nl/post/teddy-bear-hunt-app</link>
      <a10:author>
        <a10:name />
      </a10:author>
      <title>Teddy bear hunt app</title>
      <description>&lt;p&gt;In my &lt;a href="https://jphellemons.nl/post/why-i-did-not-make-a-teddy-bear-hunt-app"&gt;previous post&lt;/a&gt; I thought that I would not make the app because I did not had a nice geocoding service. I did find Azure Maps, but there is no nice C# client at that time and I did not feel like doing manual REST calls. I know I can, I just didn’t feel like making it (sorry).&lt;/p&gt;&lt;p&gt;So I’ve worked in the past with the Geocoding.Net Nuget packages and decided to go for the Bing version. Googles version requires an account with billing because the first 200 dollar is free. It does feel like a hurdle for me as I do not work that much with Google Services.&lt;/p&gt;&lt;p&gt;So I did create an Azure Function which reads the kmz and extracts it to kml and for each unknown placemark would do a geo-location and store it in a file, so that only new bears would require a call to the Geocoding service of Bing.&lt;/p&gt;&lt;p&gt;The app is up now in the play store. Not in Apples App store, because I did not buy a license for it. &lt;/p&gt;&lt;p&gt;&lt;a title="https://play.google.com/store/apps/details?id=com.companyname.bosscheberenbingo" href="https://play.google.com/store/apps/details?id=com.companyname.bosscheberenbingo"&gt;https://play.google.com/store/apps/details?id=com.companyname.bosscheberenbingo&lt;/a&gt;&lt;/p&gt;&lt;p&gt;I forgot to rename the package.&lt;/p&gt;&lt;p&gt;Here is a small snippet for the Geocoding:&lt;/p&gt;&lt;p&gt;var geocoder = new Geocoding.Microsoft.BingMapsGeocoder(“key”);&lt;/p&gt;&lt;p&gt;var geoCodeResponse = await geocoder.GeocodeAsync(“address here”);&lt;/p&gt;&lt;p&gt;var location = geoCodeResponse.First().Coordinates;&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;Good luck and happy bear hunting!&lt;/p&gt;</description>
      <pubDate>Thu, 23 Apr 2020 09:53:00 +0200</pubDate>
      <a10:updated>2020-04-23T09:55:21+02:00</a10:updated>
    </item>
    <item>
      <guid isPermaLink="true">https://jphellemons.nl/post/why-i-did-not-make-a-teddy-bear-hunt-app</guid>
      <link>https://jphellemons.nl/post/why-i-did-not-make-a-teddy-bear-hunt-app</link>
      <a10:author>
        <a10:name />
      </a10:author>
      <title>Why I did not make a Teddy Bear hunt app</title>
      <description>&lt;p&gt;To keep kids entertained, people from all over the world put a teddy bear in their window so that kids can spot them during a walk.&lt;/p&gt;&lt;p&gt;I don’t know the origin. It’s in Canada, USA, New Zealand, UK etc. It’s also in my hometown so I decided to make an app for it.&lt;/p&gt;&lt;p&gt;People made a Facebook group with a google form to submit the teddy bear and an URL with all bears on google maps.&lt;/p&gt;&lt;p&gt;I thought that I had to get access to the Google spreadsheet containing the data, but it seems that it would not hold that much info if we take a look at the entry form and the maps data. In Google maps you can download a KMZ file which is a zipped KML (&lt;strong&gt;Keyhole Markup Language&lt;/strong&gt;) It’s XML. Here is the full KML:&lt;/p&gt;


&lt;p&gt;&lt;img width="887" height="343" title="full-kml" style="border: 0px currentcolor; border-image: none; display: inline; background-image: none;" alt="full-kml" src="https://www.jphellemons.nl/posts/files/9b81166e-2a63-4420-9759-d38e387311c0.jpg" border="0"&gt;&lt;/p&gt;&lt;p&gt;So there is a web link in it to get the live data. I used the webclient to pull it in and read it and tried to make pins out of it.&lt;/p&gt;&lt;p&gt;My first step was to add the Xamarin.Forms.Map Nuget package and the SharpKml.Core&lt;/p&gt;&lt;p&gt;Here is the full code:&lt;/p&gt;&lt;p&gt;&lt;pre&gt;&lt;code&gt;
private void AddMap()
{
	var map = new Map(MapSpan.FromCenterAndRadius(new Position(51.697815, 5.303675), Distance.FromMeters(10000)));

	using (var client = new WebClient())
	{
		var kmz = KmzFile.Open(client.OpenRead("https://www.google.com/maps/d/u/0/kml?mid=1kedGv2twtsWmzgxRpZcu5hr-qpE77plL"));
		Kml kml = kmz.GetDefaultKmlFile().Root as Kml;

		if (kml != null)
		{
			foreach (Placemark placemark in kml.Flatten().OfType&lt;placemark&gt;())
			{
				Console.WriteLine(placemark.Name);

				var pin = new Pin()
				{
					Address = placemark.Address,
					Label = placemark.Name,
					Type = PinType.Place
				};
				map.Pins.Add(pin);
			}
		}
	}

	this.Content = map;
}
&lt;/placemark&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;But the pins won’t show up (of course). Because I did not set the position. The real Kml contains data like this:&lt;/p&gt;&lt;p&gt;&lt;img width="775" height="291" title="kml-detail" style="border: 0px currentcolor; border-image: none; display: inline; background-image: none;" alt="kml-detail" src="https://www.jphellemons.nl/posts/files/a7bd6796-26f6-4795-bfb0-171dc611b3d5.jpg" border="0"&gt;&lt;/p&gt;&lt;p&gt;So as you can see there is no Latitude Longitude for the placemarks… So how does google maps work then? It seems that both Google Maps and Google Earth Geocode the address to get the lat lng. But that service unfortunately is not free. I tried to load the kml in Google Earth and export it, but that also does not add the latitude and longitude. I also thought that kml support for the map control could be used. So that I could just provide the kml to the map and have it sort it out, but that was build with monoandroid 9 instead of netstandard2.0 and would probably not fix the geocode issue.&lt;/p&gt;&lt;p&gt;I planned to make an app with no central backend. But because of geocoding, I would have to use a webapi or Azure Function to keep track of the “database” with all teddy bears and their corresponding lat lng. That would also lower the requests for geocoding if it would be moved from the phone (client) to the server.&lt;/p&gt;&lt;p&gt;But I’ve not found a good free geocoder &lt;/p&gt;&lt;p&gt;nominatim.openstreetmap.org does not work if I would provide the kml data. I think that I will come back to this one….&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;Good luck making your own KML/KMZ reading app!&lt;/p&gt;</description>
      <pubDate>Tue, 07 Apr 2020 15:56:00 +0200</pubDate>
      <a10:updated>2020-04-07T10:58:26+02:00</a10:updated>
    </item>
    <item>
      <guid isPermaLink="true">https://jphellemons.nl/post/pi-hole-no-more-ads-in-your-lan</guid>
      <link>https://jphellemons.nl/post/pi-hole-no-more-ads-in-your-lan</link>
      <a10:author>
        <a10:name />
      </a10:author>
      <title>Pi hole, no more ads in your LAN</title>
      <description>&lt;p&gt;There are a lot of guides on how to install Pi-hole on a pi. I just used the win32DiskImager to put Rasbian on it and I did put an ssh.txt file on the SD card to enable SSH. I just had to plug it in the pi and wait for it to show up on the DHCP list of my router so that I knew the IP to ssh to.&lt;/p&gt;&lt;p&gt;I have an archer c7 router which has “DNS rebind protection” so I could not change the DNS to the local IP address.&lt;/p&gt;&lt;p&gt;In order to fix it I had to go to the Archer web interface and follow these steps:&lt;/p&gt;&lt;p&gt;Add in dhcp –&amp;gt; dhcp settings, set the primary DNS to the local ip&lt;/p&gt;&lt;p&gt;in the dhcp –&amp;gt; address reservation “add new “ paste the mac address which you can find in dhcp –&amp;gt; dhcp clients list.&lt;/p&gt;&lt;p&gt;and the local ip which the pi has. This makes sure that the next reboot, the pi/dns server will have the same lan IP.&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;By the way, I had an issue with the ‘ftl’ part in the installation of pi-hole&lt;/p&gt;&lt;p&gt;I fixed it with : `sudo nano /etc/resolv.conf`&lt;/p&gt;&lt;p&gt;add a line with: `nameserver 8.8.8.8`&lt;/p&gt;&lt;p&gt;That is the google dns and that makes sure that there is a know dns so that the installation can lookup ip’s and continue.&lt;/p&gt;&lt;p&gt;Save the .conf file and run `sudo bash /etc/.pihole/pihole –r`&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;That will repair the installation and the FTL part will succeed now that there is an dns entry to the google dns in the resolv.conf&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;Good luck!&lt;/p&gt;&lt;p&gt;ps. please let me know if you know a way to block youtube ads. No browser plugin, but a pi-hole solution please.&lt;/p&gt;</description>
      <pubDate>Thu, 16 Jan 2020 22:01:23 +0100</pubDate>
      <a10:updated>2020-01-16T22:01:23+01:00</a10:updated>
    </item>
    <item>
      <guid isPermaLink="true">https://jphellemons.nl/post/sonarcube-in-docker-and-net-core</guid>
      <link>https://jphellemons.nl/post/sonarcube-in-docker-and-net-core</link>
      <a10:author>
        <a10:name />
      </a10:author>
      <title>SonarCube in Docker and .Net Core</title>
      <description>&lt;p&gt;When you have a nice .Net core solution and want to see the code smell and technical debt, you can analyze it with SonarCube &lt;/p&gt;&lt;p&gt;&lt;img alt="SonarQube" src="https://www.sonarqube.org/assets/logo-31ad3115b1b4b120f3d1efd63e6b13ac9f1f89437f0cf6881cc4d8b5603a52b4.svg"&gt;&lt;/p&gt;&lt;p&gt;I started by browsing to the docker hub and used a container:&lt;/p&gt;&lt;p&gt;docker pull sonarqube&lt;/p&gt;&lt;pre&gt;&lt;code&gt;docker run -d --name sonarqube -p 9000:9000 sonarqube&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The default username is ‘admin’ and the default password is ‘admin’ so once it is started you can head over to &lt;a href="http://localhost:9000"&gt;http://localhost:9000&lt;/a&gt; and login. Configure your project there and copy the key/hash&lt;/p&gt;&lt;p&gt;You can get the &lt;a href="https://www.sonarlint.org/visualstudio/"&gt;SonarLint extension for Visual Studio&lt;/a&gt; and Visual Studio Code and link it to the local SonarCube server.&lt;/p&gt;&lt;p&gt;You need this one time installation of a global tool:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;dotnet tool install --global dotnet-sonarscanner --version 4.3.1&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;And then:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;dotnet sonarscanner begin /k:"project-key" 
dotnet build &amp;lt;path to solution.sln&amp;gt;
dotnet sonarscanner end &lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Wait a minute after it finishes so that the SonarCube server has some time to process the results. Check the dashboard again to see the smell, bugs and tech debt. This does help you verify if you are still coding SOLID.&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;Happy coding!&lt;/p&gt;</description>
      <pubDate>Wed, 11 Sep 2019 17:56:18 +0200</pubDate>
      <a10:updated>2019-09-11T17:56:18+02:00</a10:updated>
    </item>
    <item>
      <guid isPermaLink="true">https://jphellemons.nl/post/code-coverage-net-core-unit-testing</guid>
      <link>https://jphellemons.nl/post/code-coverage-net-core-unit-testing</link>
      <a10:author>
        <a10:name />
      </a10:author>
      <title>Code coverage .Net core unit testing</title>
      <description>&lt;p&gt;As you have noticed, you need Visual Studio Enterprise for live unit testing, or Jetbrains Rider, or some Visual Studio Code “hacks”. Here is a method to have coverage of .Net core with a global tool:&lt;/p&gt;&lt;p&gt;&lt;img align="right" style="margin: 0px 0px 0px 15px; float: right; display: inline;" src="https://raw.githubusercontent.com/danielpalme/ReportGenerator/master/docs/resources/logo_512.png"&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="https://github.com/danielpalme/ReportGenerator"&gt;Daniel Palme has a global tool version of Report Generator&lt;/a&gt;. You should install it once with:&lt;/p&gt;&lt;p&gt;&lt;pre&gt;dotnet tool install -g dotnet-reportgenerator-globaltool

dotnet tool install dotnet-reportgenerator-globaltool --tool-path tools&lt;/pre&gt;&lt;p&gt;You can then run it with `reportgenerator` so after building I run:&lt;/p&gt;&lt;p&gt;&lt;pre&gt;dotnet test --filter FullyQualifiedName~UnitTests /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[*Test*]" /p:ExcludeByAttribute="GeneratedCodeAttribute"
reportgenerator "-reports:**\coverage.opencover.xml" "-targetdir:C:\Temp\Reports\" "-reporttypes:HTML"
Start-Process -FilePath "C:\Temp\Reports\index.htm"
&lt;/pre&gt;&lt;p&gt;Of course you can go to the project properties and add the three lines of powershell to a file in the root of your solution and add to the build events tab as post-build:&lt;/p&gt;&lt;pre&gt;Powershell -File "$(SolutionDir)nameOfPowershellscript.ps1"&lt;/pre&gt;&lt;p&gt;Good luck!&lt;/p&gt;</description>
      <pubDate>Wed, 31 Jul 2019 20:19:00 +0200</pubDate>
      <a10:updated>2019-07-31T20:20:00+02:00</a10:updated>
    </item>
    <item>
      <guid isPermaLink="true">https://jphellemons.nl/post/docker-for-raspbian-buster-10-on-a-raspberry-pi-3-and-rabbitmq</guid>
      <link>https://jphellemons.nl/post/docker-for-raspbian-buster-10-on-a-raspberry-pi-3-and-rabbitmq</link>
      <a10:author>
        <a10:name />
      </a10:author>
      <title>Docker for Raspbian Buster 10 on a Raspberry Pi 3 and RabbitMQ</title>
      <description>&lt;p&gt;Recently the Raspberry Pi 4 was announced, But I am currently using my rpi 3&lt;img width="240" height="163" title="test_1" align="right" style="margin: 0px 0px 20px 20px; border: 0px currentcolor; border-image: none; float: right; display: inline; background-image: none;" alt="test_1" src="https://www.jphellemons.nl/posts/files/54c4e3d2-a4a4-4753-9ab8-a8dfca480070.png" border="0"&gt; and want to run Rabbit MQ on it in Docker. So I used these two commands to get it to work and I just wanted to share it:&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;sudo rm /etc/apt/sources.list.d/docker.list;&lt;/p&gt;&lt;p&gt;curl –sL get.docker.com | sed ‘s/9)/10)’ | sh&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;If you would like to use Docker as a non-root user you should add your user to the docker group:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;sudo usermod –aG docker pi&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;To get Rabbit MQ (which has arm container) on the pi with a management web interface run:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;sudo docker run –d –hostname my-rabbit –name some-rabbit –p 15672:15672 –p 5672:5672 rabbitmq:3-management&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Then get the ip of the docker container with (but since you added the ports in the previous command, this step can be skipped):&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;sudo docker inspect –f ‘{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}’ some-rabbit&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Then you can launch a browser and go to http://thatipaddress:15672 and login with 'guest/guest'. If you did not lookup the ip of the container you can use the ip of the pi because you opened container ports when running it.&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;&lt;img width="656" height="555" title="8850828555_df7c7bd300_b" style="border: 0px currentcolor; border-image: none; display: inline; background-image: none;" alt="8850828555_df7c7bd300_b" src="https://www.jphellemons.nl/posts/files/8cdfd2bb-0a33-4ee9-81e4-c2214d3b10c9.jpg" border="0"&gt;&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;Good luck!&lt;/p&gt;</description>
      <pubDate>Fri, 05 Jul 2019 15:15:00 +0200</pubDate>
      <a10:updated>2020-01-21T20:04:41+01:00</a10:updated>
    </item>
  </channel>
</rss>