All posts by memm

Avoid losing old Time Machine backups

Every now and then you get a problem with OS X’s Time Machine function. When that happens the system asks you to start a new backup which results in you losing all previous backups.

It hasn’t happened to me for more than two years or so and even if it does usually I have something in place so that I don’t lose my backups: My NAS backs up to another NAS that can take snapshots, so usually I’d be able to rollback to a previous snapshot of the Time Machine.

Unfortunately, when this happened to me recently I had just deleted the previous snapshots because I was running out of space and didn’t want to buy another hard disk – so I couldn’t roll back to a previous snapshot.

Well, for now I have just created a new Time Machine share, meaning that if I need to go back I can access the old Time Machine in the previous share.

PS: When I had an Apple Time Capsule this problem occurred every few months. With y Synology NAS it only seems to happen every few years.

 

Synology Hyper Backup

In a previous blog post, I described how I set up my Synology NAS to create network backups on another machine using

Synology: Backup & Replication Backup Destination – Create Network Backup Destination Backup – Create Backup and set a schedule

Well, unfortunately, one of the updates from Synology, a few months ago, got rid of this function, at least in the old form, and my NAS stopped backing up to my NAS4FREE machine.

The functionality is however still available. It’s in Synology’s Hyper Backup Package. This package will even remember the old settings from the Backup & Replication Backup.

I thought I will have a lot of work getting updates going again, but luckily I just had to start Hyper Backup.

By the way, Synology does now offer Snapshots, but unfortunately not for my model.

Using Google Analytics with MediaWiki

After upgrading a Wiki to MediaWiki 1.28 I noticed that in AdSense the page views immediately dropped to 20% of the pre-upgrade values.

I am not sure why that is. I have four Hypotheses:

  1. AdSense doesn’t get displayed for all visitors anymore, even though it seems to display fine when I tried it on different desktop and mobile browsers.
  2. After the upgrade ad blockers block the ad for many visitors (but that shouldn’t cause a drop to 20% or the old numbers).
  3. The web gets cached now, so not every page view causes a new ad to be displayed
  4. The upgrade caused the wiki to feature less prominently on Google, so fewer visitors are coming (unlikely as I don’t think the effect would have been that immediate)

There could, of course, be many other reasonsindex.php?title=MediaWiki:Common.js, but everything else I came up with seems even less likely than hypothesis 2 or 4.

Installing Google Analytics

My plan now is to install Google Analytics again to give me a better idea of what is going on, i.e. to see whether the page view numbers in Google Analytics match the ones from Google AdSense.

I did have Google Analytics installed in this wiki about ten years ago, but I took it off again. Of course, I don’t remember at all how I did it, so I thought this time I write down what I did.

I took the tracking code found in Google Analytics at

Admin / Property / Tracking Info / Tracking Code

..it looks like this

(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
...
...
ga('send', 'pageview');

and added it to MediaWiki:Common.js, accessible through the wiki itself, e.g. (index.php?title=MediaWiki:Common.js).

Using Docker to localhost PHP and mysql

If we want to run mysql, too, not only php (as shown here), here’s one way of doing it.

It is a bit more complicated. One reason is that the official php apache image doesn’t come with mysql support. Another reason is that you need to find out the IP address of the mysql container.

This is for developing, not for shipping applications.

Running mysql

docker run --name mymysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -e MYSQL_DATABASE=testdb -e MYSQL_USER=testuser -e MYSQL_PASSWORD=testpw -d mysql:8.0

This time I use names, in this case mymysql. It’s easier to set a name so that  we already know the name of the container we want to link to (instead of using a randomly assigned name).

my-secret-pw is the password for the mysql root user, set with MYSQL_ROOT_PASSWORD. In the same way set the following to whatever you like, if needed

MYSQL_DATABASE=testdb,  MYSQL_USER=testuser, MYSQL_PASSWORD=testpw

You can check at the Docker Hub what mysql versions are available.

Running php

Start php as before, but use

--link mymysql:mysql

in this case mymysql because that’s the name I chose for my mysql.

We can’t use an unmodified image anymore (the official php apache image doesn’t come with mysql support), so we need a Dockerfile or we get a Class ‘mysqli’ not found error.

Create a Dockerfile with the following content

FROM php:7-apache
RUN docker-php-ext-install mysqli

go to folder with Dockerfile, then build, in this case I call is phpwsql

docker build -t phpwsql .

then run

docker run --name myphp70 --link mymysql:mysql -d -p 80:80 -v /pathtofolder/:/var/www/html/ phpwsql

Get the IP address of the mysql container

The mysql and the php containers will have different IP addresses, so localhost won’t work. To get the IP address of the mysql container type

docker inspect mymysql | grep IPAddress

which you can then use in your php code.

 

At the time of writing this blog post both mysql and php-apache are based on debian:jessie, so there’s not much overhead.

Using Docker to localhost PHP

Another reminder for myself (or my students), this time how to use Docker to localhost PHP.

Download Docker from docker.com

Localhost php

In terminal run

docker run -d -p 80:80 -v /pathtofolder/:/var/www/html/ php:7.1-apache

-d for detach, i.e. run in background
-p for publish, i.e. publish container’s port(s) to the host
-v for volume, i.e. bind mount a volume

pathtofolder example: /Users/memm/GitHub/project1/backend/

You can check at the Docker Hub what php versions are available, other than 7.1-apache. Specific versions are on the left, to the right the get less specific, so get get the latest one, but it might break your application.

See all containers

Use

docker ps

to see details of running containers. They tend to have funny names, like gigantic_snyder if you use it as described (i.e. if no name was specified).

Use

docker ps -a

to see all containers, not only running ones.

Remove all stopped containers with

docker rm $(docker ps -a -q)

Stop a container

To stop a container use

docker stop name

name example: gigantic_snyder


The PHP repository on Docker Hub is at https://hub.docker.com/_/php/

Downloading a merging a .ts stream in OS X

Another brain dump to help me remember if I need to do this again.

Install wget

Install and make wget, information taken and updated from another blog.

curl -O http://ftp.gnu.org/gnu/wget/wget-1.18.tar.gz

tar -xzf wget-1.18.tar.gz

cd wget-1.18

./configure --with-ssl=openssl

make

sudo make install

cd .. && rm -rf wget*

Download video

Find file location in Safari’s Page Resources, then use with wget

wget -r http://filelocation/filename_{1..999}.ts

Merge files

cat filename_?.ts filename_??.ts filename_???.ts > all.ts

 

Dolby S – S is for surprise

After having watched Techmoan’s Cassette video I couldn’t resist and bought myself a cassette deck with Dolby S. In my case it was a Yamaha KX-580.

How I used to use cassettes

Before I bought a Minidisc recorder in 1996 or 1997 I used Metal cassettes, recorded them on my Telefunken twin deck and played them on the Alpine stereo in my car. The sound was usually fine, except the very annoying tape hiss you got all the time.

First impressions

My first impression with the Dolby S deck: Great! Much less hiss than I remember, despite only using a ‘Normal’ cassette. It was a Maxell UR 90 tape I had lying around, still shrink-wrapped. I think my wife got it when her previous university phased out tape recorders. Reasons for the better sound compared to what I remembered? I guess I either remember there being more hiss than there actually was, my ears got worse or my Telefunken deck or Alpine stereo had a problem – or maybe it’s a combination of all of these reasons.

Dolby S

I was however brought back down to earth when I tried did a comparison and tried out Dolby S.

I was expecting a lot – having watched Techmoan’s video my expectations were pretty high, but then there were also other documents, like this PDF, which doesn’t have an author, but seemed pretty well written and said things like:

“We have found that, at the highest playback levels likely to be encountered in the home, sophisticated listeners subjected to A/B comparisons of CDs and Dolby S-type cassettes are unable to identify which is which with any regularity.”

or

Dolby S-type Cassette Decks provide performance comparable to that of a Compact Disc, utilizing standard (Type I) blank cassette tapes.

There’s also this diagram in my cassette decks’ manual:

responce
from the Yamaha KX-580 manual

It also gives the impression that Dolby S will outperform Dolby C in terms of noise reduction.

Reality / the test

What I got was very different though. For my test I recorded two songs from YouTube’s audio library on a new Maxell UR 90 cassette: Far Away by MK2 and I’m Fly by Gunnar Olsen. Both were burned on a CD-R and played back on my SEG DVD player (also available as a Yamakawa, these were affordable multi region DVD players from the 1990s that actually use an ATA DVD drive). I recorded the same two songs without Dolby, with Dolby B, then Dolby C, then Dolby S. I then played them back using the same type of Dolby used for recording, i.e. the Dolby B recording was played back using Dolby B, etc. and recorded the output using 96 kHz and 24 bit.

To my surprise the noise floor of the Dolby S recording was higher than that of the Dolby B recording. If you adjust the input levels for these songs, maybe slightly conservative, then the noise floor level without noise reduction is -48 dB, with Dolby B it’s -57 dB, with Dolby C -59 dB and with Dolby S -54 dB.

The cassette deck seemed to be in great condition, so I wonder whether something is broken or whether this is normal behaviour. It would be great to hear from you if you have a Dolby S deck.

noisefloor
Noise floor comparison

I put the recordings on YouTube, if you want to listen for yourself, but I should add that even though I recorded them with 96 kHz and 24 bit I had to use AAC with 48kHz and 320 kbps for encoding the video. I don’t know whether YouTube will then reencode the sound again. I guess what quality is sent to your machine will depend on the quality of your internet connection, so what you hear is only to some extent representative.

Here are the videos

No noise reduction

Dolby B

Dolby C

Dolby S

 


Techmoan also mentioned cassettes in his blog.