Enabling UserDir on only one Apache VirtualHost

Let’s say you have a web server running apache and you have a bunch of virtual hosts for a bunch of domains. You want to enable UserDir so that example.com/~user URLs automatically map to (by default) the public_html directory in each user’s home directory. Apache already includes a userdir module, so you go and enable it. But, oops, by default it enables it on all your hosts, not just one. You want it enabled on just one, not all of them. So you go and google and there are a bunch of complicated solutions to this that seem way too much like overkill. Fortunately there is a much simpler solution:

First, go to your apache configuration directory, for example on Debian:

cd /etc/apache2

Second, enable the userdir module:

sudo a2enmod userdir

Third, delete the enabled userdir configuration file:

sudo rm mods-enabled/userdir.conf

Fourth, edit the virtual host configuration file, e.g. sites-enabled/example.com.conf, that you want to use userdir on and add this line within the VirtualHost scope:

Include mods-available/userdir.conf

Fifth, reload apache, usually by running (if you use systemd):

sudo systemctl reload apache2

Really simple, right? An explanation of this is in order: Why did we enable it only to delete the configuration? Enabling a module actually does two things: First it adds a .conf file that tells apache the default configuration of the module. Second it adds a .load file that tells apache to load a dynamic library with the executable code that apache runs when the module is used.

By default, the .conf file applies globally, i.e. to all of the sites in use. This is great if you want all of your sites to do the same thing. It’s not so great if you want the module enabled only on one or a few sites. The effect of the above is to load the dynamic library so that apache can use it, but not to add the global configuration. The “Include” in the virtual host configuration file will enable the configuration for the module for that virtual host only.

If you need to further tweak things (enable or disable specific usernames, the path, etc.) then instead of using “Include” you can copy the contents of mods-available/userdir.conf into your virtual host configuration file and customize as needed.

In principle, the same procedure should work for other modules you want to use only on specific virtual hosts.

Lyrics: Warning Shots (IAMOMNI ft. Torii Wolf)

Artist: IAMOMNI ft. Torii Wolf
Song: Warning Shots
Album: Warning Shots EP

help me for me it’s ok
help me for me
help me for me oh
help me for me yeah

we come from the concrete
and grow like orchids
when we’re watered
when we’re fathered
we come from them broken homes
where nobody bothered
just ignored it
when they saw it
and paradise is a block away
and we can go but we can’t stay
maybe we’re different and that’s ok
but there’ll be no warning shots ’round here for ya
there’ll be no warning shots

i’m not the same as all the others
and maybe we’re just different and that’s ok
look how our souls are changing colors
yeah this is how we’re different and it’s ok

help me for me yeah it’s ok
help me for me

perfect diamond
finest fragrance
deserted islands
designer faces
mercedes taste
defines beauty
we don’t cage
we’re unruly
we don’t applaud
your façade
she’s no madonna
you’re not a god
you know my voice
this rebel yells
bow and arrows
new york pearls
magazines
movie clips
fully loaded
full of sh..
i give my neighbor
my fruit of labor
to help another
is human nature
but fame is power
and sex sells
fool’s gold
and wooden nails
you have a choice
heads or tails
archimedes or galileo (uh)

i’m not the same as all the others
and maybe we’re just different and that’s ok
look how our souls are changing colors
that this is how we’re different and it’s ok

help me for me yeah (there’ll be no warning shots)
help me for me (there’ll be no warning shots)
help me for me

there’ll be no warning shots round here for ya
ain’t no love out on them corners
and them young boys can’t afford lawyers
when it’s over for them it’s over
they playin hood down lock em up
stand your ground shoot em down
bring em out line em up
hundred rounds in your crown
play the game this is chess
pick a side do or die
there’s no freedom to the press
to tell the truth is suicide

i’m not the same as all the others
and maybe we’re just different and that’s ok
look how our souls are changing colors
that this is how we’re different and that’s ok

help me for me (there’ll be no warning shots) oh yeah
help me for me (there’ll be no warning shots)
help me for me (there’ll be no warning shots) oh
help me for me (there’ll be no warning shots)

help me for me

Character set error

Because this blog was set up a long time ago, the character set settings in the database were not consistent. As a result of this and a recent WordPress upgrade, all Chinese characters on the blog were corrupted. I’ve fixed everything in the user interface, but any Chinese text in posts has been corrupted. Unfortunately due to an error in backups, no fixable backup copy was available.

The mirror at LiveJournal was unaffected by this error.

How to sideload VLC on Fire TV

Many of you may be familiar with the VLC video player from its Windows version, but they also have a version for Android which also works on Fire TV devices. VLC is a great addition to Fire TV for moderate to advanced users, as it allows you to stream videos from internal storage, from Windows Shares over your local network, or from standard video streaming services. I use it mostly to access videos from Windows/Samba shares on my local network. Unlike other solutions like Plex which require additional software to be installed and index your content, VLC can play a video straight over the network share. Just share a folder to the network, and you can play anything in there without any complications.

Why sideload though? Amazon Appstore has the VLC for Fire app already there. You can just click to install and you’re ready to go. Unfortunately the version in the appstore is old, flaky, and rarely updated. At this writing, the Amazon Appstore has version 2.1.11 of VLC, while the latest available is 3.0.5. With the version from the appstore, I was having frequent problems with hangs, crashes, buffering during playback, and problems playing some files. After sideloading the latest version, all of these problems disappeared.

Sideloading is a bit complex, but it’s not too hard. Even if you’ve never sideloaded before, you can go through this step by step and be running the latest VLC in no time.

There are a couple of things to prepare your Fire TV to sideload VLC:

First, you need to turn on the ability to install sideloaded apps. This may sound a bit scary, but all this does is let you install things that didn’t come directly from Amazon. As long as you are careful to install only apps from reputable sources, you should be fine. On your Fire TV, go to Settings at the top right of the home screen, then click on “Device”, then “Developer options”, then look if it says ON or OFF under “Apps from Unknown Sources”. If it says “ON”, you’re already set. If not, press it and then select “Turn On”.

Second, you’ll need to uninstall VLC if it you’ve already installed it from the appstore. If you don’t do this, it will try to upgrade it during sideloading but fail because the application source was different, so you have to uninstall what you have first. Go to “Settings”, then “Applications”, then “Manage Installed Applications”. Scroll down to VLC and if it is there, click on it, then click on “Uninstall”. When it is done, repeat these steps again to confirm that VLC is no longer listed.

Next you have to get the APK which is the application package installer loaded on your Fire TV. If you’ve ever done sideloading on a phone or tablet you probably just hooked it up via USB to your computer and dragged and dropped the file to the device’s storage. You can’t really do things that easily with Fire TV. Fortunately there’s an app for that. Go to the home screen on your Fire TV device. If you have an Alexa enabled Fire TV device, just hold down the microphone button and say “Downloader” or, go to the main screen’s search feature in the upper left and type in “Downloader”. You should see a big orange button called “Downloader”. Click on that and install it.

Now that “Downloader” is installed, go to the home screen and click on and run “Downloader”. If it isn’t on the apps list on the main screen you may need to search for it in your apps list. It will then prompt you to enter the source you want to download and install from. For VLC, you want to enter “get.videolan.org” and then press the “Go” button. This is the official VLC website. Be careful not to get it from any other source. Next scroll down and click on “vlc-android”. On the next screen select the version you want to install. You’ll usually want the latest version.

On the next screen you’ll see a list of APKs for various platforms. Which one should you choose for Fire TV? If you have a 4K Fire TV device, then you probably want the ARMv8.apk package. If you have a 1080p Fire TV device, you want ARMv7.apk. Click on the appropriate version and a few seconds later the download should start. It may take a few seconds or minutes to download depending on your network speed. Once it does it should prompt you to install. Scroll down and click “Install” and a few seconds later it will say “App installed” if it was successful.

If for some reason it says “App not installed” then something went wrong. If you were trying to install the ARMv8.apk package, go back and try the ARMv7.apk package instead. Otherwise go back to the start of this guide and make sure that unknown sources is turned on, and any existing VLC package is uninstalled.

Once it installs successfully you can go back to the home screen and look for it in your list of apps or search your apps for VLC and run it. Then scroll down to the “Other” menu and make sure “About” shows the correct version number. That wasn’t so hard, was it?

One thing to keep in mind is that since you manually installed VLC, it will not be automatically updated by the appstore. You should periodically upgrade to the latest available version if you want to keep up to date. If you upgrade using the same source then you can install it without needing to uninstall the current version.

Upmost M.2 to PCI-e Adapter Card

(tldr: This inexpensive board is compatible with M.2 PCIe X4 SSDs.)

I was finally getting around to moving the hard disks to my new desktop system when I discovered a few drawbacks to the new system’s motherboard. I had bought a motherboard which supports two M.2 PCIe X4 slots. M.2 is the followon to the old mSATA standard for SSD storage in tiny slots. While it was originally intended for laptops and compact “brick” computing devices, it’s now becoming standard on desktop motherboards as well.

The reason is that the SATA standard has peaked out on performance. SATA-3 performance tops out at 600MB/s and SSDs have already run into that limit for a couple of years now which is why you may notice that pretty much every current SATA SSD drive now has a rated read performance of 550MB/s. After overhead, that’s pretty much the best SATA can do.

SATA’s answer to this is a clunky solution called SATA Express that takes two SATA connectors plus an additional connector to run PCIe X2 to a drive. Implementation wise, this halves the number of drives supported by a motherboard, and requires a huge clunky cable to the drive. Motherboards are out which support SATA Express (including mine), but actual drives which support it are essentially non-existent.

Unlike mSATA which supports just SATA and has a restricted slot size, M.2 was designed to be much more flexible. It can do SATA, it can do USB, it can do PCIe at X2 or X4 speed, and more. It also supports multiple slot sizes. Basically they wanted it to be a jack-of-all-trades slot instead of a one-trick-pony. And since it support X4, it can go twice as fast as SATA Express.

For SSDs the first generation of M.2 drives was all SATA, with the same performance limitations, but at least the drives took up a fraction of the space of the traditional 2.5″ SSD drive. This year saw the introduction of several models of M.2 PCIe X4 drives. The big advantage here is performance, with the PCie 3.0 X4 standard supporting speeds of over 3900MB/s, or about 7 times faster than SATA. The actual drives quickly leapfrogged SATA performance with the early drives offering performance of 1400MB/s or higher. Samsung has a drive coming soon with a top speed of 3500MB/s, almost reaching the limits of the interface. (Don’t worry, PCIe 4.0 is coming next year with even higher speeds.)

So after all that introduction, I built my new desktop back in June based on a 240GB Kingston HyperX Predator SSD which at the time was the fastest SSD readily available on the market in Taiwan. It cost over twice as much as a regular SATA SSD, but performance was 1400MB/s, well over twice as fast. Several months later, the Intel 600P SSDs came out, offering a bit better performance but a much more reasonable price premium of around 20% more than an M.2 SATA SSD, so I added on the 512GB model offering performance of 1775MB/S.

Some time after this, I attempted to start migrating my HDDs over from the old desktop which is when I ran into problems. I moved over a couple of HDDs, got everything hooked up, powered up, and… nothing. Drives didn’t show up in the BIOS or in Windows. I tried different cables, tried twiddling BIOS settings, and got nothing until I tried different SATA ports on the motherboard and by process of elimination found that SATA ports 0-3 didn’t work, but ports 4 and 5 did.

What the heck was going on? Was my motherboard broken? But why did two ports work instead of all six being defective? Finally I dove into the motherboard manual and discovered the reason. Chipsets only support a limited number of PCIe lanes, and each M.2 X4 slot uses up 4 of these, so I was using 8 lanes for my M.2 slots. As a tradeoff, the first M.2 slot shares lanes with the traditional PCIe X4 slot, while the second M.2 slot shares lanes with the controller for the first SATA controller serving the first four SATA ports. Only one of each pair of devices could be used at the same time, and the M.2 slot had priority.

Well, that kinda sucks. Either I only get 2 HDDs in the new desktop, or I have to give up on one of my SSDs (which I had just recently bought), neither a good option. I have 4 HDDs in my old system that I was planning to migrate and wanted room for growth. (The case and power supply both support six.)

At first I was thinking of adding on a SATA controller, but the cheap ones had limited performance and typically only supported two drives, while the ones with good specs were pretty expensive. That didn’t seem like a good option.

Then I found a few PCIe add-in boards that allow putting an M.2 PCIe drive in a PCIe slot. You need to be careful here because most M.2 PCIe add-in cards support controller-less M.2 SATA only, not M.2 PCIe X4. Eventually I found this board from Upmost which looked like it fit the bill, and it was only TW$399/US$12.50. It looked like it would work, but I wasn’t quite sure.

But wait, this uses one X4 slot but my motherboard only has one X4 slot, and it is disabled when the first M.2 slot is in use. No problem! It also has one X8 and one X16 slot, and these can also reportedly support X4 cards. Or at least I thought so.

Well, I bought the board, took my Intel 600P SSD out of the motherboard M.2 slot and moved it to the Upmost board and slipped it into the X8 slot. Booted up… and it worked! Drive showed up in Windows, benchmarks the same, and all my SATA ports worked too.

Now time to start moving those HDDs over.

http://www.upmostgroup.com/tw/product/info/86/1976

Lyrics: Bother (Tricky)

Artist: Tricky
Song: Bother
Album: Skilled Mechanics

(Note: Cover of “Bother” by Stone Sour.)

Wish I was too dead to cry
Self-affliction fades
Stones to throw at my creator
Masochists to which I cater

You don’t need to bother
I don’t need to be
I’ll keep slipping farther
But once I hold on
I won’t let go ’til it bleeds

Wish I was too dead to care
If indeed I cared at all
Never had a voice to protest
So you fed me shit to digest

I wish I had a reason
My flaws are open season
For this I gave up trying
One good turn deserves my dying

You don’t need to bother
I don’t need to breathe
I’ll keep slipping farther
But once I hold on
I won’t let go ’til it bleeds

Lyrics: Joker (Francesca Belmonte)

Artist: Francesca Belmonte
Song: Joker
Album: Anima

I sing for the Joker
Our kingdom is vast
And he sets me free

No tricks or scams
He leaves me be
In return for my melodies

We scheme together
Through riddle and rhyme
Pending our subjects
To run out of time

Hand in hand, him and I
We smile wide disguised
Prey we search
And pretty prey we find

Weaving beds of lust and shame
Franabelle and Joker
Been together again
Discussing lies, dismissing cries
Of our prisoners spun in our game

Hand in hand, him and I
We smile wide disguised
Prey we search
And pretty prey, pretty prey we find

Sparkly eyes, that heavy smile
Sparkly eyes, that heavy smile
Your last sight
As you fall through the well

Hand in hand, him and I
We smile wide disguised
Prey we search
And pretty prey, pretty prey we find

Lyrics: Take Me Away (Zero 7 ft. Only Girl)

Artist: Zero 7 ft. Only Girl
Song: Take Me Away
Album: Simple Science (EP)

Hold me and never let go
Love me, I’m ready to show
Love, let me hold you
Love, let me hold you

Heart beat, don’t ever slow
Falling and flying, I’m flying and falling
I’m not afraid
Long as you never leave me
Long as you stay

So take me away
Take me away
Take me away
Yeah, yeah, yeah, yeah

Search me, and I’ll let you see
You hold the best part of me
Love, let me breathe you
Love, let me breathe you

Heart beat, don’t ever slow
Falling and flying, I’m flying and falling
I’m not afraid
Long as you never leave me
Long as you stay

So take me away
Take me away
Take me away
Yeah, yeah, yeah, yeah

Lyrics: Ulla (Goldfrapp)

because typos and format

Artist: Goldfrapp
Song: Ulla
Album: Tales Of Us

swirling horses throw you high
carried on their tales the tides
sailing on the seven seas
seven suns & seven winds were we blinded

take me where the camphor grows
where the moon & freedom sigh
caribou are crossing out
multing elk and where we found you a sunset

sailors sail on all night all day
I’m not lost I’m wandering your way
I know you’re waiting
carry me there

float on glass a mirror hot
with the universe above
try to find a line connect
with a world that makes no sense I’ve a feeling

stream you babble in a rush
busy river flow and wind
always ask the lake it knows
always ask the lake you’ll get all the answers

sailors sail on all night all day
I’m not lost I’m wandering your way
I know you’re waiting
carry me there

Analyzing the mtDNA of descendants of Richard III’s mother

(Followup to my previous post about Richard III’s mtDNA.)

When I posted earlier today, I was aware that Joy and Michael Ibsen who are descendants of Richard III’s mother and who would share the same mtDNA sequence had been tested as being in haplogroup J. At the time, I was unaware of and had not been able to find more details about their DNA tests.

It turns out that some details of Joy Ibsen’s test had been published in the book The Last Days of Richard III by John Ashdown-Hill (Kindle link; hardcover and paperback also available) published in 2010. Helen Riding was kind enough to post the results to facebook:

This isn’t a full sequence, and only a subset of HVR1 and HVR2 were sequenced, but this gets us 682bp of sequence, significantly better than the 53bp we have for Richard III. (There are two sequencing results because it was sequenced twice by separate labs.)

So let’s see what this reveals to us in mthap. First, let’s convert that table to a format usable by mthap and save that to a file:

16069T 16126C
73G 146C 185A 188G 263G 295T 315.1C

Next we’ll again visit the advanced options page because the HVR1 and HVR2 ranges weren’t fully sequenced. This time we want to check HVR1 and enter positions 16020-16390 and check HVR2 and enter positions 58-367. After clicking “Upload” and waiting 10-15 seconds we get this result:

Based on this, Joy Ibsen’s haplogroup is most likely J1c2c. J1c2 is pretty definite. J1c2c is based on optional marker 146C, but since we’re already pretty sure about J1c2, then J1c2c is also a good bet. According to Behar et. al. 2012 the estimated age for this haplogroup is about 4543 years old. J1c2c2 and J1c2c2a are also possibilities but the defining markers are not included in the sequence. (UPDATE 2: J1c2c1 is also possible; see below.) Note that 228A is missing, but it is an optional marker because reversions are very common within J1c.

Now, this isn’t Richard III’s sequence, but I would assume that they wouldn’t be so certain about the DNA matching if they didn’t already know it at least matched this much. Therefore it is likely that Richard III was also J1c2c. We’ll have to wait for more details on his sequence to be released to be sure.

UPDATE: This Science News article also says that Ibsen and the Richard III remains are J1c2c.

UPDATE 2: The above originally omitted J1c2c1 as a possibility due to lack of the 222T marker. Based on Ian Logan’s observations, 222T is an unstable marker prone to reversion, so lack of this marker is not necessarily significant. J1c2c1a would still be excluded.