Quantcast
Channel: JPHellemons
Viewing all 132 articles
Browse latest View live

Passed the 70-483 exam

$
0
0

I have just passed the 70-483 exam. The next one will be the 70-486. I thought that that would make me an app builder.

Microsoft Certified Solutions Developer: App Builder 2017

 

But that is (probably) not the case…

snip_20170131150257

Passing 70-486 would give me: “Microsoft® Certified Solutions Associate: Web Applications”

and after that, I am still required to get one of the electives. Because I passed the 70-345 and 70-355 too soon Crying face

So next stop: 70-486!

 

Good luck!

ps. will the Microsoft Certified Solutions Developer Universal Windows Platform become obsolete after march 2017?


OneDrive and Groove Sync error

$
0
0

I have stored an mp3 in my OneDrive music folder on my Win 10 (build 14393.693) and it syncs to OneDrive online. So far so good. When I go to https://music.microsoft.com

it is not there. When I click on the song on https://onedrive.live.com/ it starts to open music.microsoft.com and I see:

snip_20170208101035

So something is wrong there:

snip_20170208100957

So I cannot play the mp3 which is in my OneDrive music folder. They appear up on onedrive.com so the onedrive sync is working fine. The problem is with my groove connection. When I locally start groove, there is the mp3. Because I stored it on my HDD it loads locally, but does not show up from onedrive.

Local Groove:

snip_20170208101306

I clicked on the option to reset my groove catalog which seems to reset my cloud collection:

snip_20170208101744

This does give me my recently added track. But only as “unknown”

snip_20170208101845

There is a lot which is not known…

Perhaps this all happened because I added the onedrive/music folder which is local as folder to watch for groove:

snip_20170208102004

I have removed that reference now and this seems to fix it Smile Even the new track is not an unknown one!

 

I hope this might help someone

Azure SQL database tuning advisor was wrong

$
0
0

The documentation for Azure SQL db performance tuning is great and accurate with great detail on docs.microsoft.com (instead of the old msdn location)

https://docs.microsoft.com/en-us/azure/sql-database/sql-database-query-performance

I was looking at a SQL db in Azure and noticed some spikes. Here is my graph:

snip_20170215133957

I could drill into the Azure portal to see what was causing this spike and recognized the SQL statement, so I knew which product to update the SQL for. However this was not even necessary.

Here are the client stats when I copy pasted the query causing the spikes in SQL Management Studio Express. Check out the “Total execution time”

snip_20170215120138

My next step was to take a look at the execution plan of the query. There is this exclamation mark at the sort operation:

snip_20170215120257

When you hover it, you get this context popup:

snip_20170215124310

So it used tempdb. I still had no clue how to fix this, so I reached out to stack exchange. And a user named T.H. gave me the solution to create two rather simple indexes:

CREATE NONCLUSTERED INDEX TEST ON STOCKDEBUGTRIGGERED (ChangeDate)

CREATE NONCLUSTERED INDEX TEST ON STOCKDEBUG(ProductID, StockOld, StockNew)

Here is the query plan after the two new indexes:

snip_20170215124852

No more yellow exclamation mark! and fewer steps. The client statistics also prove that this is a lot faster/better:

snip_20170215124929

From an average of 4250 down to 50!

 

This is also backed by the dramatic drop in resource usage in the Azure Portal:

snip_20170215133957

So the lesson is: do not trust the Azure db perf advisor a 100% Smile

T.H. commented on Stack Exchange:

The automatic index advice is extremely limited, and often misleading, so can only be considered as a starting point.

 

Hope this info might help someone troubleshooting Azure Db perf!

 

Good luck!

Microsoft.NETCore.UniversalWindowsPlatform fail to install at file new project

$
0
0

I started my IoT (Internet of Things) journey a bit later then some. I waited for a suitable small project to come along and some free time. The creators update (Windows 15063) has just been released and apparently also the IoT version of the creators update.

I already had the Visual Studio RTM version of 2017 on my machine. I have worked with several release candidates of the 2017 version, but updated as soon as possible to the RTM update. The SDK and everything else was already setup and ready to go.

snip_20170410110914

When I started with file –> new project and selected the background application I got this error:

snip_20170406161443

“Could not add all required packages to the project.” That’s odd because this is just a file new project…

The package causing this is: “Microsoft.NETCore.UniversalWindowsPlatform.5.0.0” Unable to find version 5.0.0 of package Microsoft.NETCore.UniversalWindowsPlatform

When I manually ran the install-package command in the package console I got more info. The Jit package was also failing to install (dependency)

snip_20170406162235

I did not see how to fix it, so I turned to stack overflow. Rita Han from Microsoft reached out and confirmed that the solution workaround given by Wind Rider was the solution to my issue.

My solution explorer looked like this after the file new project and the popup with the error:

snip_20170407120531

The project.json had a yellow exclamation mark and checking it with explorer, it was not available on disk. So there is no file… that’s odd.

The workaround from SO was to manually create a project.json with this content:

{
  "dependencies": {
    "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0"
  },
  "frameworks": {
    "uap10.0": {}
  },
  "runtimes": {
    "win10-arm": {},
    "win10-arm-aot": {},
    "win10-x86": {},
    "win10-x86-aot": {},
    "win10-x64": {},
    "win10-x64-aot": {}
  }
}

and then manually edit the .csproj file.

navigate the the “ItemGroup” of project.json and add below the </itemgroup>

<ItemGroup><SDKReference Include="WindowsIoT, Version=10.0.15063.0"><Name>Windows IoT Extension SDK</Name></SDKReference></ItemGroup>

This will cause visual studio to reload things. Installing the Microsoft.NETCore.UniversalWindowsPlatform package now works Smile

 

Good luck, hope this reference helped!

Enable Bash in Windows 10 Creators update

$
0
0

Here are the 9 steps to enable the linux subsystem in the latest Windows 10 version:

  1. Windows key + I (to go to settings)
  2. Update Windows
  3. Select developer menu on left hand side
  4. Make sure that the developer mode is enabled
  5. Go back to the main page of settings
  6. On the right hand side click “programs and features”
  7. Click on install additional features on the left hand side
  8. Check the box for the linux subsystem
  9. Double click on c:/windows/system32/bash.exe to install it

 

snip_20170411142711

I had to blog this, because the GUI option mentioned on msdn did not work on my locale (nl_nl)

https://msdn.microsoft.com/en-us/commandline/wsl/install_guide#enable-the-windows-subsystem-for-linux-feature-gui

snip_20170411143020

Read more about it on MSDN https://msdn.microsoft.com/en-us/commandline/wsl/about

Good luck!

Format large XML file fast (pretty print) Xmllint on Windows 10

$
0
0

Make sure you have Windows 10 with the anniversary update or newer.

You can verify this by pressing the winkey + R and type ‘winver’ and hit enter. The anniversary update has buildnr 14393. And make sure that you have the “Bash on Ubuntu on Windows” feature enabled.

Xmllint is not included by default, so you have to install it first.

sudo apt install libxml2-utils

You can read more about xmllint on http://xmlsoft.org/

in order to format a large XML file which has no line breaks you have to use xmllint like this:

xmllint --format input_xml_file.xml > pretty_output_xml_file.xml

You use the format option on the input_xml_file.xml and redirect the output (>) to a new file with the name pretty_output_xml_file.xml

This is a lot faster than opening the file in notepad++ and use the xml plugin to format it.

Hope it helped. Good luck!

snip_20170411144653

PiPlant: check moisture with sensor on Windows 10 IoT with C# UWP

$
0
0

It all starts with installing Windows 10 IoT on a suitable device. I used a Raspberry Pi 2 (Model B) and installed the creators update of Windows 10 IoT. You should really get the dashboard from Microsoft: https://developer.microsoft.com/en-us/windows/iot/downloads

snip_20170504105939

It is really easy to get Windows 10 IoT on your device. Here is a small manual https://developer.microsoft.com/en-us/windows/iot/docs/iotdashboard

snip_20170504111010

If you have your Visual Studio 2017 configured, you can easy deploy to it.

The hardware

I bought stuff from aliexpress. I had no rush, so saved a lot of money Smile

I was inspired by this article https://www.modmypi.com/blog/raspberry-pi-plant-pot-moisture-sensor-with-email-notification-tutorial but that referenced to a moisture sensor for 4 gbp and shipping was also 4 gbp. So just the sensor could cost me 9,40 eur. Which makes it less fun, because the whole idea of a raspberry pi is that you can make an internet of things device with little costs.

 

I spend only 42 cent on the sensor and bought some male/female, male/male, female/female jumper cables too and even an hdmi to dvi connector so I could connect an external monitor, but never used it.

Ali Urlsnip_20170504112536

€ 0,42

Ali Urlsnip_20170504112647

€ 2,19

Ali Urlsnip_20170504113017

€ 1,14

(optional)

So I had to spend € 2,61 euro including shipping to get the parts for my Pi 2.

Hardware wiring

Connect the probe to the sensor with two wires. Doesn’t matter which goes where.

Connect the sensor to the GPIO

VCC3v3Pin 1
GNDGNDPin 9
D0GPIO 17Pin 11

 

WP_20170406_17_01_50_Pro

WP_20170406_17_01_40_Pro

WP_20170406_17_01_26_Pro

WP_20170406_17_01_13_Pro

this is a good page for gpio pins: http://www.raspberrypi-spy.co.uk/2012/06/simple-guide-to-the-rpi-gpio-header-and-pins/

snip_20170504134958

Software

I hit a strange bug with the UWP but fixed it, thanks to stack overflow, by manual creating a project.json file. As said, I was inspired by this article but that is coded in Python. My preference language is still C# and I wanted to try win 10 iot. So I rewrote this python code to C# and got this: 

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Http;
using Windows.ApplicationModel.Background;
using Windows.Devices.Gpio;
using Windows.UI.Core;
using System.ServiceModel;
using LightBuzz.SMTP;
using Windows.ApplicationModel.Email;

namespace BackgroundApplication1
{
    public sealed class StartupTask : IBackgroundTask
    {
        private const int SENSOR_PIN = 17;
        private GpioPin pinSensor;
        private BackgroundTaskDeferral deferral;

        private const string SMTP_SERVER    = "smtp-mail.outlook.com";
        private const string STMP_USER      = "YOURPLANTSADDRESSHERE@hotmail.com";
        private const string SMTP_PASSWORD  = "YOURPASSWORDHERE";
        private const int    SMTP_PORT      = 587;
        private const bool   SMTP_SSL       = false;

        private const string MAIL_RECIPIENT = "iwillwatertheplants@hotmail.com";

        public void Run(IBackgroundTaskInstance taskInstance)
        {
            deferral = taskInstance.GetDeferral();

            taskInstance.Canceled += TaskInstance_Canceled;

            var gpio = GpioController.GetDefault();

            if (gpio != null)
            {
                pinSensor = gpio.OpenPin(SENSOR_PIN);

                var r = pinSensor.Read();

                pinSensor.SetDriveMode(GpioPinDriveMode.Input);

                var dm = pinSensor.GetDriveMode();

                pinSensor.DebounceTimeout = TimeSpan.FromMilliseconds(50);

                pinSensor.ValueChanged += PinIn_ValueChanged;
            }
        }

        private void PinIn_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs args)
        {
            if (pinSensor.Read() == GpioPinValue.High)
                SendMail("Thirsty", "Plant needs water");
            else
                SendMail("I am good", "Plant is fine again");
        }

        private async void SendMail(string subject, string body)
        {
            using (SmtpClient client = new SmtpClient(SMTP_SERVER, SMTP_PORT, SMTP_SSL, STMP_USER, SMTP_PASSWORD))
            {
                EmailMessage emailMessage = new EmailMessage();

                emailMessage.To.Add(new EmailRecipient(MAIL_RECIPIENT));
                emailMessage.Subject = subject;
                emailMessage.Body = body;

                await client.SendMailAsync(emailMessage);
            }
        }

        private void TaskInstance_Canceled(IBackgroundTaskInstance sender, BackgroundTaskCancellationReason reason)
        {
            pinSensor.Dispose();
        }
    }
}

I used the nuget "lightbuzz-smtp" to send mail https://github.com/LightBuzz/SMTP-WinRT

Have fun with Windows 10 IoT raspberries etc.

Put a git repo on OneDrive

$
0
0


For one of my hobby projects, I wanted to have my source code under source control. Professionally I use VSTS (Visual Studio Team Services) https://www.visualstudio.com/team-services/pricing/ which is great. But this is a hobby project which I code alone. So I did a git init and committed it locally.

I moved the complete Visual Studio solution + project (folder) and hidden .git folder to OneDrive and the cpu started to heat up. OneDrive keeps syncing and uses a lot of cpu. I tried to exclude the .git folder, but that did not help.

So what is the solution?

  1. Move the full folder inc .git hidden dir outside OneDrive
  2. git init –bare c:\Users\youruser\OneDrive\reponame.git
  3. in the dir outside OneDrive: git remote add onedrive c:\Users\youruser\OneDrive\reponame.git
  4. git push –u onedrive master

Do not forget to push sometimes to the remote. Or use in Visual Studio the “commit & push” button.

Thanks to Qiuwen Chen for pointing me in the right direction.


Good luck!


61.000 Downloads of an old Nuget package!

$
0
0

Back in 2012, I found some code online which should have been a Nuget package. I tried to reach out to the original author (even searched for him/her today) but could not find any contact info.

That person created a library to generate QR codes. I packaged it for nuget which was just 1,5 years old back then.

The package is still out there. I don’t have any code on my system for years from that lib. But you can still grab the package here: https://www.nuget.org/packages/MessagingToolkit.QRCode/ 

Or from the package manager in Visual Studio with:

Install-Package MessagingToolkit.QRCode

It has been downloaded over 61.000 times now! So Twitt88 did a great job coding it!


I am porting an other 4 to 6 year old library to .Net Standard 1.4. The current status is up on GitHub https://github.com/jphellemons/PhotoBucketNetStandard

And the Nuget package has been submitted. This one is originally build by Mark Schall so most of the credits are for him. I only rewrote the stuff that is not available in .Net Standard or requires other namespaces.


Let’s all port libs to .Net Standard!

Good luck!

Recovered my bitcoins from MultibitHD

$
0
0

My Surface Pro 3 died last October which had my bitcoin wallet on it. I forgot that I had any. I had bought them a (long) time ago for about 10 euro if I remember it correctly. But since the hardware crash of my sp3, the rate went up. Way up….

snip_20170809160659

I decided to look into my backup and try to restore my wallet to see how much I had and how much it’s worth today. I had multibit classic in the beginning and upgraded to multibit HD 0.5.x back then. During the move from classic to HD I forgot my wallet words and only had my password and the backup AES wallet files.

I started my first recovery attempt on may 30th, but failed because I had no wallet words.

My second try was last week as I found this GitHub repo with a python script which can extract words from a backup file if you have the password. Sort of brute force “attack”. https://github.com/gurnec/decrypt_bitcoinj_seed

So I installed python 2.7.x alongside with 3.6 which I already had. and ran the PowerShell script.

I had a Windows 7 style backup by the way of my Win10 device and had to navigate to “C:\Users\myUsername\AppData\Roaming\MultiBitHD” and restored the full content of that folder to a new folder on my desktop. Please do not forget to check the box to have the original folders restored. Otherwise it will replace files with the same name and path references will be broken.

But somewhere in the mutlibithd is the rolling backup which you can restore once you have your password and wallet words…. so I thought.

But the amount stayed unconfirmed. So it’s useless. I have seen a lot of people with this exact same issue. Some moved away from multibitHD just because of this. The solution was not that obvious. It also did not work for everyone.

I had to downgrade to MultiBit HD 0.1.1 https://multibit.org/releases/multibit-hd/multibit-hd-0.1.1/

and renamed “C:\Users\myUsername\AppData\Roaming\MultiBitHD” to “C:\Users\myUsername\AppData\Roaming\MultiBitHD-old” and re-restored the wallet with the password, wallet words and backup file.

snip_20170809162115

It is weird to have the old 0.1 version, but I am glad that it is confirmed again and in my wallet. Now I can step away to alternative wallets.


Good luck!

Let’s encrypt win simple and Asp.Net Forms Authentication

$
0
0

I am using https://github.com/Lone-Coder/letsencrypt-win-simple for a while now and moved to 1.9.5.1 today. It has a great new feature. Updating my webapplications was done by changing the path in IIS

For instance: C:/www/website1/20170918 had a newer version in C:/www/website1/20170919 So I just changed the path in IIS and could revert back to the older version in seconds. The Let’s Encrypt application got confused by this, because it stored the path in the registry. The latest version checks the IIS meta database for the current path, which is really nice for me.

But back on topic: The Asp.Net forms auth can be an issue. When the Let’s Encrypt tries to reach the .well-know dir, it get’s a redirect to the configured login page.

I tried to fix this by excluding the well-known dir in my web.config but that broke my web applciation (error 500)

I have also tried to escape the . (dot)

<location path=".well-known">
     <system.web>
       <authorization>
         <allow users="*" />
       </authorization>
     </system.web>
   </location>

Like this:

<location path="\.well-known">
     <system.web>
       <authorization>
         <allow users="*" />
       </authorization>
     </system.web>
   </location>

But that also gave me the 500 error. So The only workaround I could think of was to temporarily comment out some lines:

<authentication mode="Forms">
       <forms name=".ASPXAUTH" loginUrl="Login.aspx" protection="All" path="/" timeout="120" defaultUrl="Index.aspx" slidingExpiration="true" />
     </authentication>
     <authorization>
       <deny users="?" />
       <allow users="*" />
     </authorization>

And ran the letsencrypt.exe follow the wizard, and uncomment the part again and save the web.config. Please contact me if you have a better or more permanent solution by mail or tweet.

Good luck!

Move win32 and wpf apps to the Microsoft Store

$
0
0

The 15.4 update of Visual Studio has a lot of new things. Also the Fall creator update enables you to use .net Standard 2.0 in UWP apps. Adding UWP apps in the store is easy and native. But you can also pack other types and submit them as store apps.

WAP

Windows Application Packaging Project. it’s a new project template in vs15.4 You can load up the solution containing your application and add a new project of this type.

Select the target and minimum version of the Windows SDK (this is recognizable from uwp apps)

Right click applications in the solution explorer and add a reference to your main application project

Add Project Reference

Then you can use the create app packages like you would do for an UWP app

You can read more about it on the microsoft docs site

https://docs.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-packaging-dot-net

Pro tip: visit the Microsoft Docs website more often. They are really improving lately. Like a lot!

There is just one thing I would like to point out: your developer account needs extra permissions to submit such type of application.

You will need to submit your info on this page:

https://developer.microsoft.com/en-us/windows/projects/campaigns/desktop-bridge

and they will get back to you in 6 business days.

I have submitted two apps, one for the general store and one as a business app which is only available for my colleagues in a private store. Both are still waiting for approval. Hope to hear soon from the team.

So the pro-tip of today is: make sure your dev ms account has privileges to submit a desktop bridge app to the store!


Good luck!

Internal compiler error: Unable to cast object of type 'Microsoft.Cci.DummyModuleReference' to type 'Microsoft.Cci.IAssemblyReference'.

$
0
0

I was trying to create new packages for a Store application and got this error. I was updating my Nest Thermostat application and adding the new Navigation View component. Which is a great new XAML component.

The docs for the navigationview xaml control are great. But during the creation of the new store package I got this dummymodulereference error… Here is my attempt to fix it:

image

  1. cleared all nuget caches
  2. removed the .vs hidden folder in my solution folder
  3. removed in each project folder the bin and obj folder
  4. removed the project.lock
  5. Had to open my solution file in notepad++ to see that I had a project in my solution in an other (parent) dir. So had to remove bin and obj and project.lock there too.
  6. right click on solution in the solution explorer and restore nuget packages
  7. build –> rebuild solution

But unfortunately..  I Googled with Bing and found people having similar issues: https://developercommunity.visualstudio.com/content/problem/133644/internal-compiler-error-5.html

and https://developercommunity.visualstudio.com/content/problem/137629/error-on-build-for-store.html


I even removed the symbol cache (tools –> options –> debugging –> symbols –> empty symbol cache)

Also skipped the nuget restore, because creating store packages will auto restore nuget packages.


I found out that the issue was in a global nuget package:

image

So I added a reference in my store app project to the same nuget but a newer version. Not 1.7.1 but 2.0.0

That did not help, so I added the microsoft.net.native.compiler package to all my referenced projects.

Also no fix. Last resort: tweet to @VisualStudio because it is already listed in the vs feedback.




Please let me know if you have a solution.

Fix videocard iMac 2011

$
0
0

If your iMac starts with a screen similar to this:

image

don’t worry! There is a solution. Apple admit that they had bad hardware in a certain line of 2011 models. Apple offered to replace the videocard for free. But that offer has expired. I was not even aware it existed.

Never mind, the Apple store says that replacing the videocard will be between 600 and 700 euro.

That’s an expensive solution, so here is a cheaper one:

Bake your video card in the oven

I found this YouTube video about opening the iMac and put the card in the oven.

https://youtu.be/9vPM41ZmLoshttps://images-na.ssl-images-amazon.com/images/I/41wB-fA7TbL._SY355_.jpg

Here are the ingredients for the recipe:

  • Torx T10 (almost all screws are t10)
  • Torx T9 (2 screws holding the video card to the cooling system)
  • Cooling paste
  • regular Phillips screwdriver
  • 2 suction cups
  • a bit of aluminum foil (to make 4 aluminum balls to stabilize the card in the oven on the plate)
  • conventional oven (with bottom and top radiation and a plate)

I also used some alcohol, tissues and q-tips/ cotton bud to remove the old cooling paste

Start by removing the ram modules from the bottom of the iMac.

Follow the steps in the video to remove the glass with the suction cups and remove 4 screws on each side of the panel to tilt the panel and disconnect all 4 connectors. Remove the panel and disassemble the main board/ logic board. The required screws cannot be found in the video. But you can find then in this video:

https://youtu.be/6B4iCYSWlWM?t=4m55s

The link starts the video at 4 minutes and 55 seconds. Which explains the screws you need to remove for the main board. afterwards you need to remove all connectors on the front. Tilt the board and remove the connectors on the back.

Follow that video to the end and then continue with the previous one to remove the cooling from the videocard.

clean the videocard and put it on 4 aluminum balls on a plate and put it in a pre-heated oven for 8 minutes on 200 degrees Celsius.

image

put new thermal/cooling paste on the chips and re-assemble everything. Do not forget the ram modules.

Here are some pictures from my baking experience:

IMG-20171108-WA0001IMG-20171108-WA0002WP_20171108_09_32_11_ProWP_20171108_09_32_19_ProWP_20171108_09_42_30_ProWP_20171108_09_51_20_ProWP_20171108_09_51_25_ProWP_20171108_10_23_18_ProWP_20171108_10_33_18_RichWP_20171108_10_37_19_RichWP_20171108_10_48_19_RichWP_20171108_11_39_23_RichWP_20171108_11_41_24_Rich

Good luck!

Entity Framework cannot execute ‘Update-Database’

$
0
0

I am currently working on a side-project with the code-first approach. I really like how the framework does migrations and you can use the .sql files in the migration folder etc.

But I am still wrapping my head around the model/poco classes I want to use and the data structure is still changing in this stage of development. I have moved from 1-n relations to n-n etc.

I sometimes stumbled on a situation where there were foreign key constraints which made it (almost) impossible to process a migration. I also did not found how to revert one or cancel one if you have a pending one and cannot update the database.

Because I was still starting with the project I could not bother to loose all the data and start over with a clean/empty database. I have read several blogs about how to do this, but I wanted to blog my situation. Perhaps it’s useful for someone, perhaps it’s just an online note to myself.

Here is how I did it:

  1. Delete the ‘__MigrationHistory’ table
  2. Delete all files in the ‘Migrations’ folder of your project except the ‘Configuration.cs’
  3. Delete all other tables (one by one) in the DB
  4. In the package manager console, select the correct project and ‘Add-Migration <name>’
  5. Update-Database (this will recreate all tables and use the initial data from the configuration file, if you had any)

A lot of blogposts are based on keeping your data. In that case, you should skip step 3 (obvious) and comment out the ‘Up’ method when you have added your migration and have the generated file open.

This is a slightly modified version of this blogpost which uses the brand new SQL Operations Studio 0.23.6


Good luck!


Let’s encrypt kept giving a 403 in IIS

$
0
0

Perhaps it’s because I was still in holiday-mode, but I kept getting a 403 error. Even when I added a `helloworld.html` in the `.well-known` dir. Which was driving me crazy. I even thought it was .net Core 2.x related because all full framework sites were renewing just fine, both MVC and Webform applications.

The answer for my situation was in this comment:

Do you have both http/https binding? http binding is required for it to work.

I did, but I remembered something about forcing to SSL for this website.

I searched my code, but all I could find was commented out:

image

image

So how did I manage to force visitors to the SSL version? I could not remember it. There was also no URL rewriting in the web.config. It was a checkbox in IIS which I forgot that I ever changed that setting! (sorry for the Dutch screenshot of IIS 8.5)

 image

It would be nice if the new version of Let’s Encrypt Win Simple would temporary disable it and afterwards restored it.

Here is the link to the latest version 1.9.6.2


Good luck and best wishes for 2018!

Building a Neo smartcontract in C#

$
0
0

I followed the guide but did not got it to work.

It just failed at step 3 and there was no error at all. I thought it had to do with me changing the project from .net Core 1.x to 2.0

image

But it was partially related to the dropdown below it.

The startup object was not set.

I had to set it to “Neo.Compiler.Program”

But after that, the publish did not work because “neon.dll” was missing in some folder.

This GitHub comment pointed me in the right direction:

https://github.com/neo-project/docs/issues/368#issuecomment-362181887

you should copy “neon.dll” manually in that dir. it’s just one dir below.

after that, the publish succeeded and the neon.exe reference was already in the path variable, so the Visual Studio and manually commandline option both worked!

image

https://github.com/neo-project/neo-compiler/issues/90

Good luck building for the Neo blockchain!

NEO (NEO) cryptocurrency

Convert VM with managed disks to unmanaged

$
0
0

There are a lot of benefits with managed disks and it is the preferred way to create a new VM. However because of my tight budget, I wanted to move to unmanaged. I did not expect the costs to continue when the VM was stopped. It was because of the managed storage disks(s).

I found this SO answer of Jason Ye - MSFT.

$sas = Grant-AzureRmDiskAccess -ResourceGroupName "[ResourceGroupName]" -DiskName "[ManagedDiskName]" -DurationInSecond 3600 -Access Read  
$destContext = New-AzureStorageContext –StorageAccountName "[StorageAccountName]" -StorageAccountKey "[StorageAccountAccessKey]"
$blobcopy=Start-AzureStorageBlobCopy -AbsoluteUri $sas.AccessSAS -DestContainer "[ContainerName]" -DestContext $destContext -DestBlob "[NameOfVhdFileToBeCreated].vhd"

I had to create containers in the storage account but I had copied both the OS and the Data disk to the blob storage as .vhd file.

I used this powershell script and the template to create the vhd from blob storage. The datadisk can be added later in the web gui.

  1. Login-AzureRMAccount
  2. Get-AzureRmSubscription
  3. Set-AzureRmContext -SubscriptionName "my subscription name here"
  4. $sas = Grant-AzureRmDiskAccess -ResourceGroupName "resourcegroup" -DiskName "manageddiskname" -DurationInSecond 45000 -Access Read 
    $destContext = New-AzureStorageContext –StorageAccountName "storageaccount" -StorageAccountKey "myprivatekey"
    $blobcopy=Start-AzureStorageBlobCopy -AbsoluteUri $sas.AccessSAS -DestContainer "vhd-containers" -DestContext $destContext -DestBlob "givetheunmanageddiskaname.vhd"
  5. Get-AzureStorageBlobCopyState -Container "vhd-containers" -Blob "givetheunmanageddiskaname.vhd" -Context $destContext –WaitForComplete

My mistake was to use the 3600 value for ‘DurationInSecond’ which is just an hour (60 sec, 60 minutes). The 512 gb datadisk could not be copied to blob storage within an hour (or two). Found out that an hour was also insufficient when I found ‘Get-AzureStorageBlobCopyState’.

Because I already had a vnet from my vm with managed disks, I used this template to create a new vm with the os disk from blob storage: https://github.com/Azure/azure-quickstart-templates/tree/master/201-vm-specialized-vhd-existing-vnet

If you do not have a vnet yet, you should use https://github.com/Azure/azure-quickstart-templates/tree/master/101-vm-from-user-image The deploy to azure button is a useful tool!

image

Once you have a new vm with an unmanaged disk up and running, close it to add the data disk. Once you have done that and have a remote desktop connection, go to disk management and bring the datadisk online again. It took me some time to get my head around the ASM and ARM differences in the powershell tooling. Also because there is now Azure Cli and a cross plat powershell 6.0

The cloud is moving fast, so hop on. Don’t miss out!


Good luck!

Windows Subsystem for Linux (WSL) today

$
0
0

So I have installed WSL as soon as it was available in the production ring of Windows 10. It is nice/epic etc. you should try it yourself. I used it Format a large XML file fast so that I could actually read it. That was a year ago. So it has been around now for a while.

Scott tweeted that you can pipe '|' stuff between windows/powershell and linux commands! But in the screenshot there was this "wslconfig /list" command. It listed “Legacy (Default)” for me…

Everytime a software developer says “legacy” they should wash their mouth. So I had to remove it!

Scott pointed me to this article about updating the WSL. But I did not want to update it, because I have the latest from the store. That article is also a year old by the way.

So the command you are looking for in case you have a legacy WSL as default is “lxrun /uninstall /full /y

Today (19th of April 2018) there are several options in the store:

Debian GNU/Linuxhttps://www.microsoft.com/store/productId/9MSVKQC78PK6
Ubuntuhttps://www.microsoft.com/store/productId/9NBLGGH4MSV6
openSUSE Leap 42 https://www.microsoft.com/store/productId/9NJVJTS82TJX
SUSE Linux Enterprise Server 12 https://www.microsoft.com/store/productId/9P32MWBH6CNS
Kali Linuxhttps://www.microsoft.com/store/productId/9P32MWBH6CNS

Try some and enjoy!

Good luck!

Getting Google Analytics ready for GDPR

$
0
0

It’s almost the 25th of May, so it’s a bit of a rush. But I am looking into the required changes for the javascript code of Google Analytics to get it GDPR compliant.

As you probably know by now, GDPR stands for General Data Protection Regulation which should protect the European website visitors more and will probably benefit the privacy of others too.

Google has send an e-mail about that you have to accept a data processing amendment. Which is the first step for GDPR. The second one requires a change in the source code of your website! I thought it is not emphasized enough online. So that is why I wrote this blog.

IP Anonymization in Analytics

It’s required by law to make sure that you do not send the last octet of the IPv4 address (or the last part of IPv6 addresses) from the visitor to Google. Or to have them ignore it actually.


image

source: autoriteit persoonsgegevens – handleiding privacyvriendelijk instellen google analytics maart 2018

However the official Google documentation says that you just have to add a query parameter to the url of the .js file

https://support.google.com/analytics/answer/2763052?hl=en 

the aip parameter should have a one (true)

&aip=1

But it’s also possible that you have some legacy js and have to do it like this line:

_gaq.push (['_gat._anonymizeIp']);

So look into your current analytics JavaScript code and make the change. The pdf of the Dutch authority of personal data also lists that you should make a screenshot of the code and the date and time that the change went live as a proof that you made the change before the law was in state. Which is not solid evidence, so I do not understand why they suggest it.

https://www.google-analytics.com/analytics.js?aip=1 

But good luck making everything in order for the upcoming GDPR!

Viewing all 132 articles
Browse latest View live