MacOS, Installing Python & pygame

Saturday 21st March, UK – the coronavirus is in full swing, today is the first day in the UK that Restaurants, Pubs, Cafe’s & leisure facilities etc have to stay closed.

So I’ve decided to install Python3 & pygame on my Mac and see what I can do – now I’m more of a Windows guy, so I thought this would be interesting – turns out is was painful.

So, if you want to install Python with Pygame how would I recommend it? Well I think using HomeBrew is the easiest by far.

To do this first you need to install Xcode and Xcode-select, this is done by running the following command:

xcode-select --install

Now, you can run the following to install HomeBrew:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

For more information see here.

Now HomeBrew is installed, install Python3 by running:

brew install python3

and Java by running:

brew cask install adoptopenjdk

and finally pygame by running:

pip3 install pygame

Now you should be good to go!

Setting up your own Minecraft server on linux – Bedrock Edition

I’ve recently setup a computer each for both my boys, my eldest – currently 8 at writing, is around the same age I was when I first got into computer (anyone remember loading games and programs from tapes… ahh the sound – good times ;))

Anyway, with the mass of available games, and a lot of inappropriate games too I decided to put Minecraft on, they both like Lego and I thought this would be an ideal start.

So, computer running and Minecraft installed, they both like it. But.. while I don’t want them to play online, I quite like the idea of them being able to interact in the same world. So, why not setup a local minecraft server they can play and be safe in (real world safe, not from creepers!)

Ideally I would of preferred a Raspberry Pi setup, doesn’t take it too much space and with the Pi 4 and 4GB ram should be enough, at the moment there isn’t an ARM version of the Bedrock server, and while I know you can create one – or even get the current one working on a Pi – I wanted something quick.

Using Ubuntu Server

This is the route I am going down, I have re purposed an old slimline desktop pc to use.

First job, get Ubunto, go to; https://ubuntu.com/download/server. I think it makes sense to use the server edition, at the time of writing the 2 versions available are version 18.04.4 LTS and 19.10. I got the 18.04.4 as this was the recommended version for the Minecraft Bedrock server, and as this was the only thing I would be using it for it was okay for me.

I used Rufus to create a bootable USB and off I went installing Linux. Wow how times have changed since my last Linux install (exluding Pi’s here), it was so.. easy. As it was so easy I am not going to go through this step by step. Follow all the prompts. At the networking one I disabled IPv6 and set a static IPv4 address for my network, make the appropriate changes for your setup – a fixed IP is preferable!

So now we have a computer running Ubunto, how easy was that.

Minecraft Bedrock

Now for minecraft, you can download it from https://www.minecraft.net/en-us/download/server/bedrock/, but I pefer to us a script to do it – fortunately someone has already created a nice script for us – James Chambers.

To get it, follow these steps;#

First, log into your Linux terminal, or SSH in.
Now to get the script, run

wget https://raw.githubusercontent.com/TheRemote/RaspberryPiMinecraft/master/SetupMinecraft.sh

We need to alter the permissions, so run

chmod +x SetupMinecraft.sh

and finally, to run the script, type

./SetupMinecraft.sh

Now it will ask you some questions for the setup, the first one being what is the name, think of this as the instance, you can have multiple instances running – remember though, if you have multiple instances make sure you change the ports to different ones. For each instance you will get a new folder within the minecraftbe folder. Follow all the prompts, and at the end you should have a running instance.

Now all I had to do log onto my sons computers and add the server, yay it works.

So.. next, how do I setup a different world?!?
I downloaded a world from the marketplace, just a cheapish one to try, I did this on the Windows 10 version, once downloaded I created the world, this is then saved to the following folder on your Windows PC

C:\Users\yourusername\AppData\Local\Packages\Microsoft.MinecraftUWP_8wekyb3d8bbwe\LocalState\games\com.mojang\minecraftWorlds

In this folder you will see a folder per world, what you can do is copy this folder into the worlds folder within the instance folder of the minecraftbe folders on your Linux server. If you aren’t sure how, you can use WinSCP from windows to transfer the folder – rename the world folder after copying to the name, within the world folder there is a file called levelname.txt, open this file and make a note of the text.

Now, open the server.properties file in the instance folder, find the line:

level-name=Bedrock level

Replace the Bedrock level text to the name from the levelname.txt.
In my case, it says Jungle Template in the txt file, so my new line would read

level-name=Jungle Template

The case is important.

Restart your instance, it should be working with the new World.

Microsoft Dynamics 365 Business Central – SOAP Codeunits not exposing functions

I’ve recently been working on a client upgrade from NAV 2009 to Business Central. This particular customer has a B2B site that talks back to NAV (which will turn into Business Central) via SOAP services.

I tried to connect the DEV site into the DEV instance of Business Central, however when trying to log in I was getting strange messages saying functions didn’t exist etc. I know they do… so what’s going on.

Ah Microsoft… So apparently they have decided as of around the April 19 release (I think this also affects Cumulative updates too) that it will only expose functions if the FunctionVisibility property is set to External, see below. Makes sense from a security point of view I suppose.

Untitled

So there we have it, now I have a load of functions in different Codeunits to go and change!

Python 3 and SSL: CERTIFICATE_VERIFY_FAILED on MacOS

So I have started to spend more time recently using Python, something I haven’t really used much but it does seem to be a powerful language, and as I’m using Raspberry Pi’s more thought I better look at it.

One of my interests is around AI, or Machine Learning, after installing the required modules and trying to download a demo csv file (for the equivalent Hello World test) I got the following error:

SSL: CERTIFICATE_VERIFY_FAILED

Puzzled… after a little research turns out that by default, in the latter Pythons on MacOS, the certs aren’t installed by default, so if you come across this and need them, do the following.

At the terminal type:

cd "/Applications/Python 3.8/"

Note: you may need to change the Python version in live above, in this line I am using 3.8
Followed by:

sudo "./Install Certificates.command"

That should install the required certificates and not give you the error any more.