Category Archives: Computing

Putting together the Scene From Above podcast

In December 2017 I have started the Scene From Above podcast with my co-host Andrew Cutts. The following are a series of notes on how I host the podcast. As ever with this blog site, these notes are written for my own needs, but if they help anyone else then that’s great.

I’m hosting the podcast episodes on Amazon’s S3 service because it is cheap. The S3 service is effectively a series of online folders, although I know that a) isn’t what AWS call them (they are buckets) or b) isn’t what they are from a technology standpoint (but I’m skipping that because we just need to think of them as folders for this use case).

I’m going to assume that we have access to an AWS account and are able to set up a new bucket with public permissions. First up, to make the S3 bucket web ready, I uploaded an HTML file called index.html that included the following code:

indexhtml

This redirects traffic from the S3 bucket back to the podcast page on my company website. To make this work, and for the RSS feed to work, I enabled static hosting on the S3 bucket by clicking Properties | Static Website Hosting | Enable website hosting and listing the index.html file as both the Index Document and Error Document.

However, navigating to the hosted website will likely result in a permission error, so under Properties | Permissions I chose Add bucket policy and added the following (where name.of.the.bucket was changed to be just that!):

policy

I must confess that I’m not entirely sure what this does, but the instructions I was following called for this, and it looks like it’s allowing all (*) actions on the bucket.

As per the instructions I was following I created a data folder, images folder, and rss folder and made everything public. The podcast.xml file sits in the rss folder and links to the appropriate data files in the other folders.

Now to the bit that caused the biggest headache – creating the podcast.xml file.

The Scene From Above podcast XML feed can be found here for reference, and the feed it was built on can be found here. I tried a number of different example feeds but this one worked best for me.

Each episode is encapsulated within tags and has the following mix of standard and iTunes specific tags:

episode

Although all these tags seem to be required, the most important tag here is the tag as that provides the information about the episode location, length and format. To get this information I perform a bit of a convoluted process. I take the link for the episode mp3 file and paste it into a blog post I call Test (making sure I don’t share on social media). In WordPress I then go to WP Admin for my website, and choose Settings | Media | Podcasts and open the podcast feed in another tab. All being right with the world, the enclosure tag should be in there – I copy it and past it into the episode details in the updated podcast.xml file. I then delete the Test post.

The reason we use the podcast.xml file is to enable finer control over the information in the feed. For this to work, it assumes that the instructions at this address have been followed: https://en.support.wordpress.com/audio/podcasting/

The elements that describe the podcast itself, rather than each episode, are laid out below:

channel

Yet again, there are iTunes specific and generic tags. I think that Rawvoice is a different aggregator, similar to the iTunes store.

Apparently Apple can be quite strict in their review process. so I needed to check that the feed worked. I used Cast Feed Validator, PodBase and W3C Validator to check my feed file. It took me a while to get the feed working, although in many cases the validators accepted the xml file whilst the iTunes desktop player didn’t (File | Subscribe To Podcast and enter the path to the xml file).

The two causes of this were:

  • The podcast image has to be between 1200 and 3000 pixels in size, but also has to be perfectly square. Oh, and it can’t be a large file – about 300k is preferred so I made it a jpg.
  • I saved my podcast in .ogg format. This is fine for every podcast app out there APART FROM iTUNES! Make sure you use mp3 format when exporting from Audacity.

Once it worked in Podcast Addict and the iTunes desktop player, and I could embed the audio link into my blog I was ready to submit the feed to the iTunes store. In the iTunes desktop player, click on the store and then look for the Submit a Podcast link on the right hand side of the window. This took me to a Podcasts Connect page where I logged in with my Apple ID and then followed the simple instructions. Within 4 or 5 hours the feed had beed accepted into the store. Now, a search for Scene From Above in the store will return the podcast details, or they are available online here.


Source material:

https://www.thepolyglotdeveloper.com/2016/04/host-a-podcast-for-cheap-on-amazons-s3-service/

https://www.thepolyglotdeveloper.com/2016/02/create-podcast-xml-feed-publishing-itunes/

https://techraptor.net/content/how-to-set-up-podcast-hosting-on-amazon-s3

Advertisements
Tagged ,

VirtualBox shared folders

This helped when i didn’t have access rights to the host folder (host OSX, guest Ubuntu Mate):

https://darrenma.wordpress.com/2012/07/18/you-do-not-have-the-permissions-necessary-to-view-the-contents-of-shared_folder/

Basically, type this in Linux (changing username to that of your user):

sudo usermod -a -G vboxsf username

Tagged ,

ECW

I’ve been looking at getting ecw support in gdal on Ubuntu 16.04. It looks as if the last supported version using ubuntugis was 12.04.

Then I found this: https://gis.stackexchange.com/questions/94917/how-do-i-add-and-view-ecw-raster-images-in-qgis-2-2-0-on-ubuntu-14-04-lts/200532#200532

I was going to try and compile my own gdal (honest, I was) but it was quicker and easier to install gvSig – which just works.

Tagged ,

Rasterio conflict in Anaconda

Based on a comment from ocefpaf at https://github.com/conda-forge/gdal-feedstock/issues/69

I recently had an issue where my Anaconda environment was having issues when I wanted to import gdal or rasterio. I was getting the following error when I tried to import rasterio:

ImportError: libmfhdf.so.0: cannot open shared object file: 
No such file or directory

It seems to be a reasonably common issue based on online searches. The following fix worked for me and I was able to install other packages that I needed into the new env and it (so far) seems to be working OK.

conda create -n rasterio_test_env python=3.5 rasterio --yes -c conda-forge 
source activate rasterio_test_env
python -c "import rasterio; print(rasterio.__version__)"

 

Tagged

RDP from Ubuntu into AWS Ubuntu

Simple way to get RDP into Ubuntu AWS box:

  • Create the instance in the EC2 Management console and enable incoming RDP in Security Groups
  • Create a new user with a password
  • Add the new user to the sudoers file and copy over the AWS server’s public key
  • Log in as the new user and install xrdp
  • Load Remmina on your local machine and open a new RDP connection

Notes

In EC2 Management Console, click on the instance you want to connect to and scroll the page to the right. There will be a URL link to the relevant Security Group configuration page. Click on the Inbound tab and then the Edit button. Add a new rule, look for RDP as the type and set anywhere as the source (or make it specific if you want).

Move to the Terminal on your local machine and login to your AWS server with a command similar to:

LocalMachine:$ ssh -i ~/AWS-keypair.pem ubuntu@ec2-some-id.amazonaws.com

Create new user e.g. george

AWSMachine:$ sudo adduser george

Follow the prompts to enter the password and other optional user information. Add the new user to the sudoers file using the visudo command:

AWSMachine:$ sudo visudo

Add the following line after the comment line, “User privilege specification” and save the file.

george   ALL=(ALL:ALL) ALL

Ensure that the user george is in the sudo groupusing:

AWSMachine:$ sudo adduser george sudo

The new user account cannot be accessed (e.g. via SSH) until the public key from the AWS instance’s key pair (the .pem file) is installed for the new user. To do this, copy the public key installed for the ubuntu user and paste it into the correct file in the new user account. The public key can be found in the file ~/.ssh/authorized_keys under the ubuntu account.

AWSMachine:$ cat ~/.ssh/authorized_keys

SThe command above will print the public key. Select everything apart from the name of the key pair at the end of the key and copy it.

Next, switch to the new user account, george, and make sure you are in the home directory.

AWSMachine:$ sudo su george

Create the SSH directory and authorised users file, with the correct permissions in the home directory. Then edit the authorized_keys file with a text editor.

AWSMachine@george:$ mkdir .ssh
AWSMachine@george:$ chmod 700 .ssh
AWSMachine@george:$ touch .ssh/authorized_keys
AWSMachine@george:$ chmod 600 .ssh/authorized_keys
AWSMachine@george:$ nano .ssh/authorized_keys

Paste in the public key you previously copied and save the file, before exiting the system.

AWSMachine@george:$ exit
AWSMachine:$ exit

You should now be able to log into the new user george on the remote Amazon AWS server using the same keypair. On your local machine, use the SSH command:

LocalMachine:$ ssh -i ~/AWS-keypair.pem george@ec2-some-id.amazonaws.com

We now are logged in as user george.

Install the lxde lightweight desktop manager and start it.

 sudo apt-get update 
 sudo apt-get install lxde
 sudo start lxdm

Also install xrdp to establish a remote desktop connection.

 sudo apt-get install xrdp

Remote desktop connections require a username and password. The username will be george and the password will be the one set when the user was created. If you forget this the password can be reset using:

 sudo passwd ubuntu
In Remmina, create a new connection and paste in the public DNS of the AWS box (ec2-some-id.amazonaws.com) into the Server box. Set the user as george, make sure the protocol is RDP and set the Colour Depth as True Colour 32-bit. Save and Connect.


None of this would be known without the notes and guidance from others on the web, namely:

http://www.brianlinkletter.com/how-to-set-up-a-new-userid-on-your-amazon-aws-server-instance/

http://comtechies.com/how-to-set-up-gui-on-amazon-ec2-ubuntu-server.html

https://serverfault.com/questions/776391/unable-to-remote-connect-from-windows-to-ubuntu-desktop-using-ec2

Tagged , , , ,
Advertisements