MYSQL Backups

Posted on

There are plenty of options to back up mysql DBs.

One method is the following:

Create a backup user in mysql/mariadb like the following:


# /usr/bin/mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 253404
Server version: 5.1.54-1ubuntu4 (Ubuntu)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

mysql> GRANT LOCK TABLES, SHOW VIEW, SELECT ON *.* TO 'backupsonly'@'%' IDENTIFIED BY 'P@$$w0RD';
Query OK, 0 rows affected (0.01 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> Bye


Then, create a script “my_backup.conf” that has the following in it:


Then, run the following script to export the data.


mysqldump --defaults-extra-file=my_backup.conf -u backupsonly databasename --single-transaction --quick --lock-tables=false | gzip > databasename_full-backup-$(date +%F).sql.gz




Download a WordPress wp-content uploads folder

Posted on Updated on

There are times I work with groups and much of their online artwork is stored in a WordPress Upload folder.

There’s a few methods to get those images from that path. I like being able to use SiteSucker, but it often downloads the entire site.

The other easy option is to use wget.

Run this command in the path that you wish to save all the files to, and it’ll get everything in the upload path.

wget -r --no-parent

This is a single threaded command and will take a long time, so just be patient while it does its thing.

Try Vagrant they said…

Posted on Updated on

I’d heard good things, but installation and basic setup is not a one click solution. There are things that have to setup to get it going.

Vagrant is basically a way of controlling virtual machines on your computer, for those boxes that don’t really need or have a gui, which makes it great for web development and more.

So, while it sounds easy and great, you may run in to some dramas in setting it up.

Firstly, there aren’t really many front-end GUIs for setting this up. It’s basically command line driven.

So, go here and click on your version. For me, it was Windows x64 and run the msi file.

You also need to install VirtualBox as well.

You will also need to install git

Secondly, if you are trying to install it on a Windows 7 computer, like I was, your first hurdle will be having the correct version of Powershell. Mine came with version 2, so, I needed to find version 3 – as a minimum.

You find it here:

There’s 4 files to download (plus a readme). You’ll need either the x86, or the x64 files. Only one of them installed for me, because my system said that I didn’t need or was applicable for my computer.

After a restart, and checking I had the correct version by running in powershell:

 Get-Host | Select-Object Version

It told me I had version 3.0

So, good to go?

I started with these instructions:

It gave me a basic centos install. You can try this if you like, but there’s a big downside, because you’ll still have to install everything else that goes with it, such as php, mysql, apache/nginx as well. So, follow a little further below, and I’ll show you a setup out of the box.

vagrant -v
Vagrant 2.0.1

cd C:\
mkdir vagrant\centos
cd C:\vagrant\centos 
vagrant init bento/centos-7.3

After about 10 minutes or so, it’ll download everything. eg:

C:\>cd vagrant

Volume in drive C is WINDOWS
Volume Serial Number is 4XXX-XXXX

Directory of C:\vagrant

15/10/2018 03:35 PM <DIR> .
15/10/2018 03:35 PM <DIR> ..
15/10/2018 03:38 PM <DIR> centos
0 File(s) 0 bytes
3 Dir(s) 347,443,544,064 bytes free

C:\vagrant>cd centos

C:\vagrant\centos>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'bento/centos-7.3' could not be found. Attempting to find and i
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Loading metadata for box 'bento/centos-7.3'
default: URL:
==> default: Adding box 'bento/centos-7.3' (v201708.22.0) for provider: virtualb
default: Downloading:
default: Progress: 43% (Rate: 614k/s, Estimated time remaining: 0:05:35)

In case you didn’t know, there are many different vagrant ‘boxes’ available to download and use.

I am just using the bento/centos-7.3 box because the tutorial was easy to follow.

For ease of development, I went with a scotch/box because it contained a full LAMP setup.

cd C:\
mkdir vagrant\scotch

cd C:\vagrant\scotch

vagrant init scotch/box

vagrant up

While that downloads, go and get putty, and an ftp client and watch the videos on here:

Some basic commands:

To start the virtual machine:

vagrant up

To stop the virtual machine:

vagrant halt

To restart the virtual machine:

vagrant reload


Or… They easier way, is to do the following:

Do all the install business as mentioned at the top of this post, then, open a command box (cmd)

cd \
mkdir vagrant
git clone my-project
cd my-project
vagrant up

Then, open up the ip address of in your web browser.
The best thing though is that you can then drop and edit your files directly in to


without having to upload, ssh or ftp anything to anywhere…

Just edit away…

For MySQL operations:

Since using the scotch-box option, it’s been a brease to use, if you are content with a little bit of command line stuff.

There was only one problem I ran in to.

After working on a web app for many years, of which has been functioning well in various production and dev environments with no changes to the mysql config, I came across a problem yesterday where I couldn’t perform a query because I had the “Group By” statement in the query. See here for more details.

I solved the problem by editing /etc/mysql/mysql.conf.d/mysqld.cnf

I added the following line to the bottom of the config file.





Ionic ramblings with version 4 and version 3…

Posted on Updated on

After many hours of using Ionic to create “the perfect app” that compiled and functioned as expected, I was nearly ready to launch.

However that all changed almost overnight.

I had started out using Ionic 3, as what the original install had put on my system. Everything worked fine. As I progressed and installed more and more NPM modules, it still seemed to function ok, even with the various dependencies.

Until, I decided to upgrade my laptop to Ionic version 4. I’d read about how simple it was to upgrade and so I thought, “why not”. Sadly, what followed was a series of problems, which made the app un-usable, to the point where it wouldn’t compile and builds were failing.


In this process, I had also updated to XCode 10. This proved to also be another problem in it self, because not all of the modules I’m using are compatible with it.


OneSignal for example, have a warning message on their site to say not to use XCode 10. Oops.


Xcode 10 Notice

Cordova is currently incompatible with Xcode 10’s new build system. For a workaround, please see this post

Because of changes to Xcode’s build process, this results in the embedded.mobileprovision file not being attached to your app bundle. This breaks push notifications – it will cause Mismatched User errors.


I’ve had strange error messages such as 
“Ionic 3: Build in “prod” mode: Cannot find module “.” Yep, a module called ‘.’… This was only discovered after building my code for xcode, and then observing a white empty background (and like here) in my newly built app for my iphone. What was the cause? I have no idea – still… but, I was getting some interesting errors (and others like it) from OneSignal in the XCode build notes:

OneSignal has detected that your application delegate implements a deprecated method (application:didReceiveLocalNotification:). Please note that this method has been officially deprecated and the OneSignal SDK will no longer call it. You should use UNUserNotificationCenter instead…


Other errors such as this were also common:

no-unused-variable is deprecated. Since TypeScript 2.9. Please use the built-in compiler checks instead.

CordovaError: Promise rejected with non-error: 'ios-deploy was not found. Please download, build and install version 1.9.2 or greater from into your path, or do \'npm install -g ios-deploy\''

   at cli.catch.err (/usr/local/lib/node_modules/cordova/bin/cordova:30:15)

   at <anonymous>

   at process._tickCallback (internal/process/next_tick.js:188:7)

[ERROR] An error occurred while running cordova build ios (exit code 1).


So, after a lot of message, It was time to downgrade the app back to Ionic version 3.20.0.  Josh Morony does an excellent job at saying how to upgrade your app, but, I’ve got to be honest, this is a really crazy thing the Ionic team have proposed to do. You basically have to recreate your entire project and copy and paste and make it work again. a whole days work (and probably some more) just to have the same functionality… I can’t see it being worth it just yet.


I have no plans on touching version 4 yet – for a long time, as doing so, will break the entire build environment. In upgrading this, I also experienced NPM dependency hell as they call it. It was not fun.


I’m going back to running c4i App. V3 for the time being.


You may need this command at some stage too:

npm cache clean --force


This list is compatible with each other:

Since the “upgrade”, and then “downgrade”, this list allows for the build to go ahead, but still isn’t enough to solve the white screen of death in my app on iOS under “prod”.

sudo npm install -g ionic@3.20.0
sudo npm i cordova-ios@3.6.3

sudo npm i cordova-ios@4.5.5

sudo npm i @ionic-native/core@3.14.0 –save
sudo npm i @ionic-native/android-permissions@3.14.0 –save
sudo npm i @ionic-native/file-transfer@4.1.0 –save
sudo npm i cordova-plugin-whitelist –save
sudo npm i @ionic/app-scripts –save
sudo npm i -g typescript@2.7.2 –save
sudo npm install -g ios-deploy –unsafe-perm=true



You may have to do this command at some stage too

sudo chmod -R 775 /Users/YOU/Your_App_Path/node_modules/

I have an iOS build script for production and XCODE testing:



ionic cordova platform remove ios
ionic cordova platform add ios
#ionic cordova platform update ios@3.9.2
#ionic cordova platform update ios@3.20.0
ionic cordova build ios --prod
#ionic cordova build ios --prod --buildFlag="-UseModernBuildSystem=0"
cd platforms
cd ios
#Open XCode for building and creating
open "APP_NAME.xcworkspace"
cd ..
cd ..


My Android script is a little more complicated, but also works:
ionic cordova platform rm android
#ionic cordova platform add android
#cordova platform add android --save
ionic cordova platform add android@6.4.0
ionic cordova build android --prod --release --debug
#keytool -genkey -v -keystore my-release-key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias my-alias
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.jks platforms/android/build/outputs/apk/release/android-release-unsigned.apk my-alias
cp ~/Library/Android/sdk/build-tools/27.0.3/zipalign platforms/android/build/outputs/apk/release/
cd platforms/android/build/outputs/apk/release/
rm app_name.apk
./zipalign -v 4 android-release-unsigned.apk app_name.apk
#copy to dropbox
# cp app_name.apk /Volumes/Creative2HD/DropBox/Dropbox/
cd ..
cd ..
cd ..
cd ..
cd ..
cd ..
cd ..

So, as you read this, I’m still content to battle through and make this work, it’s just the observations I’ve had. I’ll continue to use Ionic, but will be lightly treading. If there is a way to sandbox each install or ionic version, I’d be very happy to know how. Does Vagrant, or Droplet type thing allow for this kind of Ionic development? I have no idea… but to spin up a VM would be crazy. Surely there’s another way…

I’m currently redownloading XCode version 9 from the Apple Developer site in an effort to downgrade the program.  Hopefully this will solved all problems and I’ll be back again to normal and it will build correctly.

If it ain’t broke, don’t fix it.

This is my current build environment. It’ll probably change though:

cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0

global packages:

cordova (Cordova CLI) : 8.1.1 (cordova-lib@8.1.0)

local packages:

@ionic/app-scripts : 3.2.0
Cordova Platforms : android 6.4.0 ios 4.5.5
Ionic Framework : ionic-angular 3.9.2


Node : v8.11.1
npm : 6.4.1 
OS : macOS High Sierra

Environment Variables:

ANDROID_HOME : not set


backend : pro


Now, it’s time to install Xcode 9 and see if she will compile and deploy.

So, now that I’ve spent half the day sorting this out, I’ve managed to get the app to compile – eventually, and remove the white screen of death.

Strangely enough, this was only happening on the –prod builds.

To actually diagnose this a little better, I added the browser platform and then tried to run it there. Well, the browser –prod –release platform actually shows more error messages, than Safari. This proved to be very helpful, as it it turned out that typescript or more specific @angular/cli was missing or had the wrong version.

Now, it’s time to get the Android platform to build successfully again for deployment.

Make sure you have the correct Android SDKs installed. I’m using version 27.0.3

 brew install gradle

There is also a problem with brew and using gradle on High Sierra.

As per here outlines the solution:

/usr/bin/ruby -e "$(curl -fsSL"

After you have done this and it’s working for you, the first time it runs, it’ll download a lot of necessities. Wait, and it’ll eventually load/compile.

I guess that in doing this, you really only ever set up a dev environment once, and then from there, you move on. This is a crazy ride, but I’m getting there.


As a side note, always, always, always, have your source code in a source control repository of some sort. I like Git, and use it with SourceTree and their remote git platform. It’s free for closed source and small projects.


Everything now compiles and is deployable again.

Opening A PDF in Ionic on Android

Posted on Updated on

Well, after nearly a week of trial and error of trying out other people’s tutorials and having no luck, and getting very frustrated…  I’d like to present my findings of what has worked for me.

Please understand, this example will NOT work straight out of the box. You’ll need to modify your code. I post these things, so I don’t forget how I did it, but hopefully so you can learn and use them too. The post is subject to change and be updated.

Oh, and this image too. It’s me…


I finally found the last piece to my solution here.

Firstly, this will probably (I’m guessing) on of the most important things in the future to know, as the Ionic framework, Cordova, PhoneGap, NodeJS is changing so rapidly, it could not work tomorrow. So, here are the important values of version numbers for you.

$ ionic info

cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils : 1.19.2
 ionic (Ionic CLI) : 3.20.0

global packages:

cordova (Cordova CLI) : 7.1.0

local packages:

@ionic/app-scripts : 3.1.9
 Cordova Platforms : android 6.4.0 ios 4.5.4
 Ionic Framework : ionic-angular 3.9.2


Node : v8.11.1
 npm : 5.6.0 
 OS : macOS High Sierra

Environment Variables:

ANDROID_HOME : not set


backend : pro


import { Component, NgZone } from '@angular/core';
import { IonicPage, NavController, NavParams, Platform } from 'ionic-angular';
import {Http} from '@angular/http';
import { GlobalsService } from '../../globals/globals'; 
import 'rxjs/add/operator/map';
import { File } from '@ionic-native/file';
import { FileTransfer, FileTransferObject } from '@ionic-native/file-transfer';
import { DocumentViewer } from '@ionic-native/document-viewer';
import { FileOpener } from '@ionic-native/file-opener';

 selector: 'page-newspaper',
 templateUrl: 'newspaper.html',
export class NewspaperPage {

constructor(public navCtrl: NavController, public navParams: NavParams,
 private http: Http,
 public globalsvals: GlobalsService,
 private file: File,
 private transfer: FileTransfer,
 private platform: Platform,
 private document: DocumentViewer,
 private fileOpener: FileOpener
 ) {
 posts: any;

 url: string = '/newspaper/json.php';
 myAssociativeArr: any = []; 
 items1: any = [];
 console.log('ionViewDidLoad NewspaperPage');
 if (this.globalsvals.release == true)
 this.url = this.globalsvals.newspaperpdf_json;
 this.http.get( this.url )
 .map(res => res.json())
 .subscribe(data => { 
 this.items1 = data; 
 //console.log (this.items); 

 // With this, I can now get each record as it loops through them
 for (const item of this.items1.items)
 console.log (item.url); 
 var newElement={}; 
 newElement["url"] = item.url;
 newElement["filename"] = item.filename;
itemTapped(event, item) 
 console.log("Item Tapped"); 
 let path = null;
 if ('ios')) {
 path = this.file.documentsDirectory;
 } else if ('android')) {
 path = this.file.dataDirectory;
 const transfer: FileTransferObject = this.transfer.create();
 const url = item.url;, this.file.dataDirectory + 'file.pdf').then((entry) => {
 console.log('download complete: ' + entry.toURL()); this.file.dataDirectory + 'file.pdf', 'application/pdf')
 .then(() => console.log('File is opened'))
 .catch(e => console.log('Error opening file', e)); 
 }, (error) => {
 // handle error


    <ion-title><img alt="logo" height="40"  src="./assets/images/logo.png" ></ion-title>

<ion-content padding>  
   <ion-item ion-item *ngFor="let item of myAssociativeArr" >
    <ion-item ion-item *ngFor="let item of myAssociativeArr" >
      <ion-col col-2>
       <button icon-only (click)="itemTapped($event, item);" style="background-color: white !important;"> 
         <img [src]="item.thumb">
       <ion-col col-10>
         <h1 (click)="itemTapped($event, item);" [innerHTML]="item.title_date">

My JSON feed file for PDFs can be found here: (which you’ll need to configure)

You'll probably also need to add the cordova plugins for the following:

import { File } from '@ionic-native/file'; 
import { FileTransfer, FileTransferObject } from '@ionic-native/file-transfer'; 
import { DocumentViewer } from '@ionic-native/document-viewer'; 
import { FileOpener } from '@ionic-native/file-opener';

Add them to your app.module.ts file like that, and also as a provider, in that same file.


You may notice I have a globals.ts file as well. It’s just my way of keeping track of global variables.

import { Injectable } from '@angular/core';

export class GlobalsService
    // If this is for a release, set this to true, so that all of the values will
    // not use proxie values.  
    public release:boolean = true;  
    public newspaperpdf_json:string = '';    

The other thing with my code, is you’ll also notice that I’m using a few proxies as well. This is the reason for the “release” variable. If it’s a deployed (finalised) app, then I’ll set this value to true, and it’ll change all the code to pull in the correct URLs – as well as a few other minor non-dev things.

Some sites claimed to have these lines work. They did not.

this.document.viewDocument(url, 'application/pdf', {}); + 'c4i.pdf'), '_system');

Still, other well respected sites, claimed files would work, that when their example loaded, it pointed the user to download a file from the Android Play Store to open the PDF file… ???

These to me, were not options. Some claimed to work with open the file is a webkit browser window… Why would you do it that way anyway? I have a native PDF viewer, let’s use it.

I hope this document is as clear as mud. I’ll be doing more tests, and probably updating it as I discover more things. But, as it stands, it worked… so far. 🙂

Zetta vs StationPlaylist

Posted on Updated on

Firstly, both radio playout systems are good. They just have a different set of features, and strengths and weaknesses.


Things Zetta has over SPL:

  • Ability to script the loading of audio
  • Multi-User customisation and granular permissions
  • Real-time manipulation of the playout log over network from any Zetta computer
  • A truly networked system
  • Completely database driven system
  • Multiple redundancy points
  • Connectivity with multiple Zetta sites/offices.
  • Cross Platform IVT – through web browser with Zetta2Go
  • Visual Segue Editor for the log
  • Visual Cue audio editing on files
  • Can run multiple stations from the same database
  • A non-fixed location database
  • Built-in Audio Editor
  • Multipoint audio ducking for segues
  • World wide team of 24/7 support
  • Better on-air sound
  • Better integration of the Library of songs, links and ads in the system as a whole


When integrated with GSelector as the scheduler:

  • Granular hourly depart restrictions
  • Unscheduling and scheduling of specific categories
  • Complicated Artist separation
  • Programming can be scheduled from any computer with GSelector on it
  • Multiple schedules for different stations
  • Can easily see when the station is scheduled, and what is missing from the log – very helpful when programs are delayed from suppliers.
  • Can schedule music and programming separately, or Ids, or links etc.


Advantages of SPL over Zetta

  • Smaller program size
  • Cheaper to purchase and on-going maintenance
  • Buy out licence
  • Less resources required to run it
  • DSP Plugin effects built in for audio sound
  • Streaming Module is included
  • One small database
  • Simple Audio Metadata/playlist history is stored in files
  • Lower minimum hardware requirements
  • Less computers required to run it
  • Can run on Linux or Mac (through Wine)
  • Easy to find audio, based on it’s Windows File system architecture.
  • Scheduling of programs can be potentially quicker, (but can easily be broken if a reschedule is required)

These are just the things I can think of, but I know there are plenty more differences, and similarities.

Both systems share many things in common, of which many are standard, such as Live assist, Automation, GPIO etc.

I made a comparison a few years ago here:

If you really want to know how good Zetta is, and see it fly from a guy who uses it daily at a commercial station, this video is a must see. The things on this video that are done, can not be done in SPL on the fly like this.

Radio station discovery for ARM processors

Posted on

Some thoughts. These are ideas to play audio on a linux based platform, on a low powered device.

This is a daemon console audio player. It can play playlists

How do you get the playlists generated so that it continues perpetually?



This can generate it’s own radio station based on scripting


The Raspberry Pi devices need to have an RTC, otherwise they don’t know what time, or date they are each time they are turned on, unless they are connected to the internet.

This device solves that.




I saw this on a forum post. UK Sky News Audio feed: (I don’t know if it’s current)