Archive for the ‘Life’ Category

Following files using tail

Saturday, March 3rd, 2012 | Life, Tech

Tail is a useful command which allows you to see the end of a file. This is probably most commonly used when you want to look at log files as the entries of most interest are usually at the bottom. For example, if you wanted to view the last 50 lines of a log file you could use the following command.

tail -n 50 filename.log

A cool feature of tail is that you can also follow a file – that means continually monitoring it as changes come in. So if you are looking at the Apache error log for example, you could begin tailing the log and then cause an error and you will see it instantly come through on the log.

tail -f error_log

February 2012 Wendy House

Monday, February 27th, 2012 | Life

This month’s Wendy House represented the last Wendylicious that would be taking place at Apartment 31, given we were moving out a mere three days afterwards. Sad times indeed, but enough time at least to squeeze one more night of partying in.

View all PHP scripts currently running

Friday, February 24th, 2012 | Life, Tech

Need to get a list of all the PHP scripts currently running? Actually, this technique works for everything, you just need to change the argument you pass to grep, but for the purpose of this example, I’m going to say we’re looking for PHP scripts.

ps aux | grep php

This will then produce a list of all the scripts. The ps aux command gives us a list of every processing running on the system. We then pass this through to grep and search for what we want – in this case processing which contain “php”.

Valentine’s card

Thursday, February 23rd, 2012 | Life

I love my Moomins Valentine’s card :D.

Installing MongoDB on CentOS 6

Sunday, February 19th, 2012 | Life, Tech

I would have written a guide on how I did this, but the blog post over on If Not True Then False covers it perfectly, so just go over there and follow their guide.

Home sweet home

Thursday, February 16th, 2012 | Life

Having decided it had been far too long since we last had a house warming, there was really only one thing we could do to fix this – move. So this is our new place. Actually, it isn’t, but ours is almost identical to this one, but with nicer carpets and air conditioning.

If you’re wondering why the photos are rubbish quality, it’s because they were compressed into GIF accidentally and then re-compressed to JPEG. I could redo them, but I have more important things to do.

Saving files in memory

Thursday, February 16th, 2012 | Life, Tech

If you need super quick access to a file, for example a log file which isn’t going to be too big but it being used by a script which is time critical, then rather than writing it to disk, you can mount part of your file system in memory and write to it there.

This has the disadvantage that when you restart your system, you will lose the data. But for test scripts, logs or other temporary files that you don’t mind getting lost, it can really speed up performance.

Luckily, most systems come with a an area mounted in memory already – so you don’t even need to configure it!

cd /dev/shm

If said directory exists, you’ll have a memory mounted directory already and can start using it immediately.

Editing your hosts file

Friday, February 10th, 2012 | Life, Tech

If you want to put custom entries in your computer’s DNS (for running addresses for a local server for example) you need to edit your system’s hosts file. On Unix systems this can be found at:

/etc/hosts

On Windows systems, you need to go to:

C:\Windows\system32\drivers\etc\hosts

To add a custom entry, first enter the IP address (if you’re running a local server you’ll want to set this as 127.0.0.1), then put a tab and then the host name.

Lloyds TSB headaches

Wednesday, February 8th, 2012 | Life

Recently, I received a letter from Lloyds TSB saying they had begun charging the charity a fee for its bank account. This seemed strange given we had a fee-free small charity account. So I phoned them up to find out what was going on.

Turns out, they hadn’t actually set it up as a charity account but had instead set it up as a regular business account. This meant they needed to transfer the account to a whole different area of the bank – something which is apparently quite complicated as when I phoned back to check two weeks later, the action which I was told I didn’t need to check up on because it would just be done, had not been done.

I gave it another few weeks and then I decided to log into my internet banking to see if I could see if it had been fixed. This is no small task because Lloyds TSB require you to use a card authentication system. But, because they don’t give debit cards out to small charities, they have to send you a special card, which isn’t a debit card, but which can be used in the card carder.

The card reader is massive btw, it’s not the kind of thing you can keep on your keyring, like you potentially could with the HSBC one, if you had seriously big pockets anyway, it’s not like theirs is tiny either.

So I arrived at the Lloyds TSB website and selected logon to business banking. First, I had to enter my user ID. This wasn’t easy because my user ID isn’t a memorable username as you would expect – it’s a string of nine random digits.

Luckily, they send you out a card to remember this. Though it isn’t a card with it printed on, it’s just a piece of cardboard with a white box that you can write it in yourself and hope that it doesn’t get rubbed off on the gloss finish.

I finally found my card and punched in my user ID. Step one was complete! Next I had to input the security code generated from the machine. So I dropped my authentication card into the authentication machine and typed in my PIN. It rejected it.

I tried again. It rejected it again.

So I clicked on the “I am having trouble logging in” link and it began asking me more questions about myself, for security purposes of courses. After four times of it telling me I didn’t exist, it finally let me through – only to tell me the only thing I could do was to phone the call centre.

I did phone the call centre and the nice woman at the other end of the phone said that she would have to get a new PIN sent out to me, and this would take a week to arrive (they can’t give it out over the phone to allow me to access my account now or anything). so I asked her to do that.

Next question, she needed two of the digits from my telephone banking password. I gave her those digits. She said they were incorrect. So now I can’t use telephone banking either apparently.

We eventually managed to bumble through, involving a shot in the dark guess about the year that I set up the account and a new PIN has now been dispatched to me in the post. As soon as I get that, I will be able to log into the account to check if they have changed it to the correct account type yet and refund the erroneous charge they put on the account. Wonderful.

Using TextEdit as a text editor

Saturday, February 4th, 2012 | Life, Tech

One utility Mac OS X seems to be lacking is a simple text editor such as Notepad for Windows. It comes with TextEdit but the problem is that this uses rich text format (RTF) which is very annoying when editing system files or code.

Thankfully, you can reconfigure it to use plain text.

Simply go to TextEdit on the menu bar and hit Preferences. The top option should allow you to toggle between Plain Text and Rich Text.