Category Archives: computing

WordPress Twenty Seventeen – Four-Column Footer

One of the trickiest things I found to do with the WordPress Twenty Seventeen theme was to try and have a four-column footer.  I found a couple of plugins to do the job, but they either didn’t work, or they were far too complex. In the end, I found an easy solution put a basic HTML table into a ‘custom html’ widget inside of ‘Footer 1’. To do this:

Admin > Appearance > Widgets. The drag ‘Custom HTML’ to the ‘Footer 1’ widget.

The base HTML code for a four column table is:

<table id="logo-table" style="width:100%">

<tr>
<th style="text-align: center; width:25%;">Heading One</th>
<th style="text-align: center; width:25%;">Heading Two</th> 
<th style="text-align: center; width:25%;">Heading Three</th> 
<th style="text-align: center; width:25%;">Heading Four</th>
</tr>

<tr>
<td style="text-align: center;">Item One</td>
<td style="text-align: center;">Item Two</td> 
<td style="text-align: center;">Item Three</td> 
<td style="text-align: center;">Item Four</td>
</tr>

</table>

This did 90% of the job. There was just one other thing I wanted to do: Make the footer full-width. By default, Twenty Seventeen has two half-width footers. I also went in and changed the css so that the footer was full-width.

Admin > Appearance > Customize > Additional CSS

Add in the following code:

.site-footer .widget-column.footer-widget-1
{
width: 100%;
}

.site-footer .widget-column.footer-widget-2
{
width: 100%;
}

The end result:

 

WordPress Twenty Seventeen – Change footer colours

To change the footer colours using the Twenty Seventeen theme in WordPress; go to:

Admin > Appearance > Customize > Additional CSS

Add in the following code:

.site-footer { background: #2000a1; }

.site-footer {
    color: #ffffff;
}

.site-footer a {
     color: #ffffff;
}

.site-footer a:hover {
     color: #ffffff;
}

The #ffffff is white, and #2000a1 is a blue colour. The output should look like this:

WordPress Twenty Seventeen – Change uppercase title

I’ve recently been modifying the website for the church I used to attend when I lived in Blackwater – coalcitycc.com.au

The main thing I did was change the theme from the old ‘Pinboard’ theme to the newer ‘Twenty Seventeen’ them. It’s a fantastic theme that I was able to do a lot of things with. There were a few things that I had to figure out how to do. The next couple of posts will be a few short ones so I can document the changes I made.

The most annoying thing with the new theme was the uppercase title on the homepage. To change this – go to ‘Admin > Appearance > Editor’ then select ‘Stylesheet’ ‘style.css’. Then scroll down to line 1580. The ‘site-title’ section should look like this:

.site-title {
clear: none;
font-size: 24px;
font-size: 1.5rem;
font-weight: 800;
line-height: 1.25;
letter-spacing: 0.08em;
margin: 0;
padding: 0;
/* text-transform: uppercase; */ <--- add in these comments
}

As I’ve marked above, comment out the ‘text-transform: uppercase;’ part to remove the uppercase font on the title.

As you can see from the picture below, it works well!

 

Odroid – turn off blue light

When the Odroid is running, it’s got a bright flashing blue light. I found this to be very annoying, so I found a way to switch it off. You can switch it off directly by running the code:

su -
echo none > /sys/class/leds/blue\:heartbeat/trigger

But for a more permanent solution, just add the second line to the file –

/bin/odroid-tweaks

This file gets called by odroid-tweaks.service, which gets run at startup.

Odroid XU4

I picked this up a couple of weeks ago. It’s the Odroid XU-4. It’s basically a Raspberry Pi, but with significantly enhanced specifications – it uses a Samsung Exynos processor, EMMC storage and 2GB ram.

It’s about twice the price of the Pi, but with over 4x the performance. It can run a variety of Linux and Android OS’s, with images supplied by the factory, though you can use any you want, provided you can compile up the right kernel.

You really notice the performance increase over the Pi. The eMMC storage, in particular,

I thought I’d use it as a Linux server. I wanted to try to run one at home, but I didn’t want to run my large desktop computer, with its high power needs. The Odroid only uses a few watts at peak.

So how’s it working? It works great. I’ve currently got this blog and another site that I use hosted on it, and I think it actually works quicker than the shared hosting that I was using previously.

 

Script to change keyboard on Windows 7

I’m currently working in a client’s office, on an extremely locked-down Windows 7 PC. As usual, I want to change to the dvorak keyboard layout, which is my standard. However, the environment on the computer is reset every couple of days, which wipes out my keyboard setting.

So I started looking for a way to change it through a powershell script. Unfortunately, Windows 7 only has an extremely limited version of powershell. But I was able to find a way to change it using an xml script at these two sites:

https://msdn.microsoft.com/en-us/goglobal/bb964650?f=255&mspperror=-2147217396#eyb

https://superuser.com/questions/395818/how-to-change-keyboard-layout-via-command-line-cmd-exe-on-windows-xp-7

Combining them both together, I put together the following xml file:

<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">

<gs:UserList>
<gs:User UserID="Current"/>
</gs:UserList>

<gs:InputPreferences>

<!-- Add Dvorak -->
<gs:InputLanguageID Action="add" ID="0409:00010409"/>

<!-- Remove US default-->
<gs:InputLanguageID Action="remove" ID="0409:00000409"/>

</gs:InputPreferences>
</gs:GlobalizationServices>

The trickiest part was finding the code for the dvorak keyboard, which is 0409:00010409

The code to execute the xml file is:

control intl.cpl,, /f:"Desktop\changekeyboard.xml"

Which I then put into a .bat file which I keep on the desktop. So, whenever, the keyboard changes, I just double-click the bat file, and the keyboard is fixed again, and I end up with the keyboards as so:

Permanent redirect to https

This is a bit of a follow-on from my previous post, in which I was setting up https access on my website.

Once you’ve got https set up correctly, you might, like I did, want to make sure that all traffic to your website now goes the the SSL connection, rather than through an unencrypted connection.

On Linux hosting, like I have with Quadra Hosting, this can easily be done by creating a ‘.htaccess’ file. Create one in the root level of your hosted directory (the one where you have your index.html file). In the .htaccess file, put in the following lines:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

This will redirect all traffic to the SSL connection.

Setting up Let’s Encrypt with Quadra Hosting

For the last few years, I’ve been using Quadra Hosting for my web hosting needs. Their servers are great, with good speed and connection, and they’re reasonably priced. They also have the best customer and technical support that I’ve ever seen, bar none. I highly recommend them if you’re looking for a new web host.

Let’s Encrypt is a project that has set out to ensure that all web traffic is encrypted. To that end, they have changed the traditional process of obtaining SSL keys to a much simpler one, and provide them for free.

Also, Chrome will soon be warning users anytime they visit an unencrypted website. With these two factors, I thought I’d set about trying to install a Let’s Encrypt key onto my Quadra hosting account. As you can see from the green lock in the address bar for this site, you can see that I was successful!

Let’s Encrypt’s preferred method of installation is via CertBot client that runs on the server, and installs and renews the keys. However, a quick check with the technical support team at Quadra, and I realised that this wasn’t going to work on shared hosting, where I don’t have low-enough level access to the server.

Fortunately, Let’s Encrypt and others have provided a variety of different ways to install some keys. They have scripts for a variety of different languages. One that I came across was a bash script that can run on shared hosting without root access. It’s simply called acme.sh. It worked really well.

Here’s the process that I went through to set up Let’s Encrypt with the acme.sh script.

  1. Go to your Quadra Hosting control panel, and turn on SSL connections, by going to ‘Domain Settings’, then ‘SSL’ and then clicking the ‘Generate self signed SSL certificate’.

generate-self-signed-ssl-certificate

Click ‘submit’ on the next page, then just ignore the page of keys that comes up after that. You won’t be using those keys, but it has activated the SSL functionality for the server for your domain.

2. Next you’ll need to install the acme.sh script. To do this, and most of the rest of the steps, you’ll need shell access. It’s not turned on by default, so you’ll need to fill out the shell access request form and send it through to the Quadra Hosting support team. Then, when you’re logged on, enter

curl https://get.acme.sh | sh

This will download and install the acme script. At this time, it tries to install an alias to acme.sh, but it failed for me. I had to manually edit the .bashrc file and added in the following line:

alias acme.sh='~/.acme.sh/acme.sh'

This can be done simply by entering the following line

printf "alias acme.sh=\'~/.acme.sh/acme.sh\'" >> .bashrc

then reload your bashrc by either logging out / in, or by typing

source  ~/.bashrc

3. With the script set up, you can now download and install your SSL key. The first step is done with the ‘issue’ command:

acme.sh --issue -d systematictechnology.net -d www.systematictechnology.net -w ~/systematictechnology.net/

This contacts the Let’s Encrypt servers and will generate some SSL keys, and copies them to the acme install directory. It’ll give the location of these new certificates:

[Thu Nov 10 01:46:53 GMT 2016] Your cert is in  /hsphere/local/home/xxxx/.acme.sh/systematictechnology.net/systematictechnology.net.cer
[Thu Nov 10 01:46:53 GMT 2016] Your cert key is in  /hsphere/local/home/xxxx/.acme.sh/systematictechnology.net/systematictechnology.net.key
[Thu Nov 10 01:46:53 GMT 2016] The intermediate CA cert is in  /hsphere/local/home/xxxx/.acme.sh/systematictechnology.net/ca.cer
[Thu Nov 10 01:46:53 GMT 2016] And the full chain certs is there:  /hsphere/local/home/xxxx/.acme.sh/systematictechnology.net/fullchain.cer

4. Next up, you need to install the newly created certificates. This is done in two ways. Firstly, through the control panel, then through the command line. This is so that both Quadra and the script know the certificates.

Firstly, log onto the server with an FTP client and download or view the four certificates which were listed in the key creation message (above).

On the control panel, go to ‘web options’ then select ‘edit SSL support’.

edit-ssl

This will bring up a page with some areas in which you can paste in the keys. Put in:

  1. Install yoursite.key to ‘Certificate key’
  2. Install yoursite.cer to ‘Certificate file’
  3. Install ca.cer to ‘Certificate Chain file’

 

The Certificate Key and Certificate file can be uploaded at the same time, but the Certificate Chain File will need to be uploaded separately.

Once that is done, go back to the command line. You’ll need to change the permissions on the ssl key folder:

chmod 0600 ~/ssl.conf/systematictechnology.net/*

Install the keys again using the acme script:

acme.sh --installcert -d systematictechnology.net --certpath ~/ssl.conf/systematictechnology.net/server.crt --keypath ~/ssl.conf/systematictechnology.net/server.key --capath ~/ssl.conf/systematictechnology.net/ca.crt

 

Note that this will throw a few errors: The script will also try and install some backup keys, which it won’t be able to do. I don’t consider this a problem, as the keys primary location is in the acme.sh directory anyway.

5. Reboot your apache instance to reload the new keys. There is no direct to do this, but the Quadra support team suggested a simple workaround. Go to Web Options for your domain in the control panel, then click on the ‘Mime Type’ button.
mime-typeOn the window that pops up, enter some dummy data, hit ‘submit’

mime-entry

Then click on Save / Apply in the Web Options window. Wait a few minutes, then click on the red ‘X’ next to the new Mime type. This will delete the new entry.

mime-type-2

Click Save / Apply again. This will reboot the apache instance, and load up the new keys.

6. Test the installed certificate. Wait for five minutes for the server to reboot, then go to https://yoursite.com . If all the steps above have worked then it should be working nicely. Next, check that the cron job to renew the certificates has installed correctly. This should have been done when the acme.sh script was installed. Check it now.

This can be done through either the control panel (go home -> tools -> cron) or through the command line:

crontab -l

You can also go to SSL Lab’s SSL test to see that everything is working correctly.

7. Celebrate! You’ve now got SSL working on your site, celebrate that you’re doing your small bit to make the whole web a bit more secure.

Addendum:

After I posted this article, I sent a link through to Quadra support with a note along the lines of ‘here’s a guide I made up, please feel free to send it to any other customers who might be trying to do the same thing.’

I shortly got a response from the support team. The team member who’d been helping me with this setup not only responded and corrected some mistakes I’d made, but he also wrote: “You could also mention that we would be happy to do all this for them if they asked us to, e.g. if they are not used to shell commands.”

This surprised me no end. The Quadra Hosting team sell a one-click SSL implementation, which only costs $30, and requires no technical skills at all. Rather than suggest “You could also mention that we have a cheap one-click SSL implementation if they are having difficulty with Let’s Encrypt.”, they instead suggest that they could forgo making that money, and instead spend time help you implement a no-cost alternative.

If you’re not with Quadra yet for your hosting, change. This is just a small example of how good they are.

Quad-boot Lenovo X220

After getting Mac OSX working fine on the Lenovo, I decided to reach higher and go for a real multi-boot setup – five OS’s! I wanted to put on Windows 8, so that I could play Steam games, and I wanted Linux to see how Linux has progressed over the last few years, and BSD just to see if I could.

My first step – upgrading the hard drive. The 320GB Seagate that I was using was fine for two partitions, but wouldn’t really cut it for more. So I bought a Seagate 7200rpm 750 GB Hybrid HD. With that done, I had to partition it up, which was quite a feat:

Disk Utility Screenshot

So that’s

  • 170GB for the original Windows Partition
  • 120GB for Mac OS X
  • 200GB for Windows 8 (pretty much only for Steam)
  • 60 GB for Linux
  • 50 GB for BSD and
  • 180 GB for general storage (formatted FAT, so that all the OS’s can share it.)

I used Mac OS’s Disk Manager for the partitioning – it does a good job, and it’s a lot harder to make some fatal mistakes.

Once that was done, it was a pretty straightforward, though time-consuming task to put all the OS’s on it. The Mac OS and Win 7 partitions I could copy straight across from the 320 GB drive. Windows 8 installed without too much hassle, but only once Windows 7 was on. It wouldn’t install into the non-first partition without another boot partition being in place.

For my Linux partition, I chose Ubuntu, which is definitely ‘flavour of the moment’. I’ve installed Linux in the past – Red Hat 3 on my old Pentium 2 300Mhz desktop computer, and Gentoo on a Sony Vaio Picturebook. Compared to those old installs, Ubuntu installed like a dream, I’d say fractionally easier than the Windows 8 install, and getting close to that of OSX.

I wasn’t completely thrilled with Ubuntu. It’s probably the Gnome-based Unity desktop, but I found a few of the OS choices to be quite annoying, particularly the dock on the left. There was also a surprising lack of configuration options in order to change the user experience. Sleep / wake worked just fine without any setting or configuration changes, which impressed me a lot.

One thing that impressed me though was the wireless connectivity. With my last Linux install – Gentoo on a Picturebook – getting wireless networking running required a lot of hard work, and a lot of editing of configuration files. However, Ubuntu made the experience as easy and fast as Windows or OSX does.

I was trying to go for five OS’s – with BSD being the fifth OS. Unfortunately, I wasn’t able to get it to work. It was very frustrating. The first time I tried to install it, I then discovered that it would only install into a primary partition, not into an extended partition. After much grinding of teeth, I re-partitioned the hard-drive and started from scratch.

I then moved Windows 8 to an extended partition, so that I could install BSD on a primary. Then, for some reason, I just could not create a bootable USB installer with BSD on it, it just wouldn’t work. The X220 doesn’t have a DVD-drive, so I had to go with a plan B – move the hard-drive across to another laptop which has a DVD-drive, then install, and move the HD back across for first boot.

Using this method, I was able to get PC-BSD installed and working, at least if they had full control of the bootloader. Once I tried to install another bootloader, to boot the other OS’s, then BSD would no longer work. I tried both the FreeBSD and the PC-BSD variants, but neither would boot. I eventually gave up. The BSD partition was only meant for ‘fun’ – a bit of icing on the cake, but it was proving to be more hassle than the rest of the OS’s put together.

Only after I had gone through all of that drama with installing on another computer that I realised that I had another install option. I could have used Virtualbox, and booted up the installer in Virtualbox, then installed on one of the other drives.

Getting the boot loader to work is generally a pain with these multi-boot installs, but I was able to get that sorted pretty easily. I used my Windows-to-go bootable USB to boot into Windows, and then I used EasyBCD to configure the boot loader on the computer. So my boot loader now looks like this:

IMG_1858

After I had got it all working, I went back and had another look at Ubuntu. I wasn’t completely happy with the Gnome environment. Fortunately, there’s an officially supported branch of Ubuntu called Kubuntu, which uses the KDE environment. I found this to be much more to my liking, and a lot more configurable. The only downside is that the wireless networking isn’t quite as easy or smooth as Ubuntu’s, and takes a bit longer to re-initialise itself after sleep.

All up, I’m now very happy with my work-issued Lenovo X220. It does absolutely everything I want, and can run any program I want. It’s got a good size and is extremely robust. I think that when it’s time to hand this computer back, I’ll go and pick up a 220 for myself.