Today I was just looking for photos to illustrate an article. Yes, it really did take me all day. Quite annoying.
Friday, 4 March 2016
This morning I had a dream that there was an Elephant on Welland Park road, and I think I was trying to wash its ear. I was around the same height as it though, maybe I was standing on top of a car or something. I'm not even sure it was actually an Elephant at this point either, it may have been a giant wood pigeon.
Anyway, the Elephant walked down the street and then turned left at the mini roundabout to go up Farndon road. As it started going up the road, I saw that the skin just under the backs of the knees on its rear legs was ripped. It was as if the elephant's skin was just an outer covering over its pink body, and the skin covering had been torn in this location.
There was a bloke walking the other way down the road, and he said the elephant had its trunk cut off. While the elephant actually had a trunk in my dream, it was also true at the same time that its trunk had been cut off. It must have been a quantum trunk.
I explained that it was from a circus (the point being that as it was from a circus, it had been badly abused). When I looked at it again all the skin had been ripped around its bum and you could see its pink buttocks through the hanging flaps of torn skin.
Then the bloke started riding the elephant. Suddenly we were on top of a cliff on the coast, and the elephant was running really fast towards the edge of the cliff. There was a single storey hotel (or similar) building that blocked my view as the elephant was heading over the edge of the cliff. So I ran into the hotel and went into the room at the far end of the building so I could look out of the window and see what happened.
I could see that the elephant had landed in the sea. I think it was still alive and swimming out into the ocean, but I can't quite remember. Near the shore there was a person coming out of the sea while holding another person in their arms. The person they were holding had either been killed or badly injured when the elephant jumped off the cliff into the sea.
Then the bloke who had been riding the elephant ran into the room with me to look out the window and see what was happening below. He had managed to jump off the elephant just as it jumped off the cliff. Then he had ran round the hotel and down the corridor into the room where I was really fast. But in the dream it wasn't weird how quickly he'd got there, or that you needed to look out the window in this hotel room to see what was happening over the cliff edge.
Then we ran away, back down the corridor and out the front of the hotel or whatever building it was. (It didn't have a reception area, but there were rooms along the corridor like in a hotel and the room we'd been in was like a hotel room). In my dream (and also now), I thought it was weird that you could just go into this building and go into an unlocked room.
Then I was feeling like I was partly responsible for the injury or death of the person who I had seen being carried out of the sea. And I wanted to get away in case anyone found out I had anything to do with the elephant, which could lead to me being arrested in connection with the incident.
That was the end of the dream.
BTW I don't actually think that all circus animals are badly abused, that was just dream logic.
Thursday, 11 February 2016
Recently I decided to finally do something about my rubbish Alliance & Pester / Santander bank account that pays no interest, and go through the hassle of opening a new bank account that pays a better rate of interest. TSB offer quite a good rate, so I applied to open an account with them online. Their sign-up / security process is pretty bad though:
As you can see, it didn't like my username containing non-alphanumeric chars. Underneath the username section it says
Your user IS must be between 9 and 30 characters long and can include letters, numbers and special characters (see the tip section above for ideas on which special characters to include). (emphasis mine).
Yet when you look at the tip section, it makes no mention of special characters. And with alphanumeric only password but 'special chars' in my username I was not able to continue. But without 'special chars' in the username I could continue onto the next page. So clearly special characters are not allowed in the username.
As well as giving incorrect information on the signup page, the fact that they don't allow special characters and also make the username / password case insensitive is bad for security. The smaller the number of possible character combinations, the easier it is for someone to make a brute force attack and guess a correct user ID / password combination.
It wouldn't surprise me if the user id and password are also ASCII only. While this also decreases security, it's more of a problem from an accessibility standpoint. If I was Chinese, my preferred User ID may well be something in Chinese. But you'd be forced to use something in ASCII. It's not a big problem - you could still use the same keystrokes combination, but you'd see a jumble of random letters rather than the Chinese characters, making identifying typos a bit more difficult.
Thursday, 28 January 2016
Well, the I've spent the last few days just trying to get the latest version of mysql installed. Yesterday I spent ages installing the latest version of gcc on the webserver, as the one installed was too old to build mysql with. (Don't I love shared hosting). GCC takes hours to build and it was also complicated by the unusual way in which it must be configured, which I wasn't aware of until after a few failed attempts at compiling it in the normal way.
Installation of mysql was further complicated by it still trying to use the old version of gcc. Following the instructions to
make clean and
rm CMakeCache.txt didn't help. After trying a few different things I deleted the directory and extracted the tarball again to start clean. This did work.
But after all that work, my webhost killed all my processes while mysql was still building. I guess I can't blame them - I have a 512MB plan, and the mysql build process alone was taking up nearly a gig. I tried to see if there was any way to limit the amount of memory used during make, but couldn't find anything.
So today I checked if there was any way of changing where a pre-compiled binary package could be installed to. It turns out that for rpm (the server is CentOS and mysql offers an rpm package) you can use
rpm --prefix= or
rpm --relocate, but mysql packages are not relocatable.
However, I later found this information about using the generic binaries: Installing MySQL on Unix/Linux Using Generic Binaries. This indicates you can just extract the tarball to your preferred installation directory, and that's it. So I did that and it worked! Could've saved myself several days work and fustration!
Tuesday, 26 January 2016
Today I was just doing more work on configuring nginx and trying to install the latest version of mysql. For things like mysql I install them first on my local PC, writing the commands in a text document using gedit. That way I can easily alter the commands when something doesn't work and try it again by just copy-pasting from gedit to the terminal.
When I tried configuring mysql today though, it was as if the escape new line character wasn't working - when I pasted in my multi-line with escaped line endings command, the shell just executed each line of the command separately (which of course didn't work). The problem was that the file had been saved with windows line endings (\r\n) instead of linux (\n). But how on earth that could happen I don't know. When I was using this file the other day I could copy and paste the multi-line command from it into the terminal no problem.
After compiling mysql again (twice) I got a bit further. But when I ran mysqld_safe, it just said:
160126 21:13:44 mysqld_safe Logging to './data/rusty-ubuntu.err'. 160126 21:13:44 mysqld_safe Starting mysqld daemon with databases from ./data 160126 21:13:45 mysqld_safe mysqld from pid file ./data/rusty-ubuntu.pid ended
Checking the log, all it contained was:
160126 19:27:48 mysqld_safe Starting mysqld daemon with databases from ./data 160126 19:27:48 mysqld_safe mysqld from pid file ./data/rusty-ubuntu.pid ended
I did quite a bit of googling, but all the results seemed to be either where the error log actually contained an error, or a permissions error. Then eventually I found this blog entry: MySQL error mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended, which seemed to be pretty similar to my problem with the lack of error log information. They suggest running
mysql_safe, which doesn't exist in my bin dir and I think might just be a mistake in their write-up. But it gave me the thought of just running
mysqld rather than
mysqld ran without any issues. So I then tried to access the mysql client to change the temporary password that had been assigned to root when running
mysqld with the
--initialize parameter to setup the data store. But this gave me an error that it couldn't connect to the mysql server:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket './mysql.sock' (2)
The problem was that I was using relative paths in
my.cnf and it seems the paths get resolved differently.
mysqld had resolved ./mysql.sock to the data dir (no idea why). Whereas mysql resolved it to the bin dir. After replacing all the relative paths in my.cnf with absolute paths, I restarted mysqld and then tried mysql again.
mysql could now connect to the server, but said that the temporary password that had been assigned to root wasn't valid. So I then had to delete the data dir and initiailise it again. After this I could get in okay and change the root password. I then shut down mysqld and tried running the mysqld_safe script, and lo and behold, it actually worked.
So it seems the problems in mysqld_safe starting and ending straight away (or likely just not starting at all in reality) were down to the use of relative paths in the configuration options. Annoying that it didn't give any errors to indicate this though.
I still have to actually setup the databases and switch it over as the active mysql server, not to mention get it up and running on the web server, so there are still plenty more things that can go wrong yet.
Monday, 25 January 2016
I spent quite a while today trying to figure out why my wordpress blog wouldn't work when a query string was added to the url. At first I just got an access denied error in the browser. Checking nginx's error log for the site in question I saw:
FastCGI sent in stderr: "Access to the script '/path/to/document_root/url' has been denied (see security.limit_extensions)" while reading response header from upstream
security.limit_extensions, I found it was a php-fpm configuration option (so php-fpm.conf, not php.ini). Adding
security.limit_extensions= (so no value) to the php-fpm conf (and restarting php) I got a bit further. I now got a 404, and the error message in the nginx logs was:
FastCGI sent in stderr: "Unable to open primary script: /path/to/document_root/url (No such file or directory)" while reading response header from upstream
I then spent ages trying to figure out why it was trying to open this uri, instead of trying to open index.php as my
After a while I traced the error down to the use of
if ($query_string... within the location block for my blog. I remembered that I had actually had such an issue some time ago, and I'm pretty sure I spent ages trying to figure out the problem then too.
The problem is down to having the
if statement within the location block. Move it outside the location block and all is fine.
I also had trouble with mysql today, (installed the latest version, but got stuck in getting it setup). I haven't resolved that yet. I've asked for help on the mysql forums, so I'll see if any is forthcoming before I try and fix it myself. (It is likely to involve trial and error in setting options when compiling mysql and mysql is extremely slooow to configure, make and install).
The other thing I spent some time on was trying to get Firefox to send an
If-Modified-Since header. After some testing it only sends it if the cached response had a
Last-Modified header. I suspect that's per the spec, though I had naively thought that it might just use the
Date header in the absence of a
I thought it would be nice if nginx could just set the
Last-Modified header for cacheable responses (that lack a
Last-Modified header) to the current time, but I couldn't find how to do this. And it's not a big deal really, I don't think many people request the same page more than once unless they're expecting it to be updated. If it was a big deal, then sending the
Last-Modified header from PHP would work fine.
Sunday, 24 January 2016
I had a problem today when I tried copying some files from my Linux VM to my Windows host OS today. The problem was that one of the folders ended in a dot / period, and my backup software (Beyond Compare) couldn't create this directory. Looking into it, I found that apparently Windows / Windows Explorer doesn't support directory names ending in dots, but the underlying file system (NTFS) and Windows API do.
I managed to find the solution here: Making an folder end with a dot. Basically you need to specify the full path, and precede it with
mkdir "\\?\C:\path\to\dir.". After doing this, Beyond Compare could copy the files across to the folder with no problems.
However, weirdly the folder shows up in Windows Explorer, and is not hidden / inaccessible, unlike what all posts on the web seem to indicate. Also, a folder without the dot on the end of the name has been created. Both folders are identical, and I guess one is actually a link to the other.
Looking at the 8.3 directory names, the folder without the dot on the end, has a .C tagged onto the end of its 8.3 name (so it is 10 chars long rather than 8). It is definitely listed as a dir rather than as a file though.