Archive for the ‘Tech’ Category

Not “Go”ing anywhere

Friday, March 16th, 2012 | Tech

I recently requested an evaluation of Go, an agile release management tool from ThoughtWorks Studios.

I filed out the form but unfortunately it insisted I hadn’t filled out my city, even though I had. So I sent a support request to them and a few hours later, someone emailed me back asking where I was based so they could direct my query. I told them, but never heard back from them.

A month later I got an email from one of their sales guys asking me how I had got on with my evaluation. I emailed them back saying I never actually had an evaluation because they had never got in touch. He apologised and sent through my license key. However, at this time I was on my Mac, so I had to download the Mac client. I went to the website and this time I managed to register and download the software. Great, I thought.

Unfortunately, I didn’t get time to look at it until I was back in the office and by that time I was back on my Windows machine, so I needed to download the Windows version. I went to the website and tried to enter my email address I had used last time I registered to download.

But I just got an error. So I tried again. Another error, different this time. So I tried to go through the whole registration process again, but this once again went back to telling me that I hadn’t entered my city when in fact I had.

I sent their support another email asking for the direct download links and having been sent them, I was finally able to download and install the server. Huzzah! So I did that, but then didn’t really know what to do. It said it had started the sever, which was fine, but there was no indication of what to do next.

After some googling, I eventually found the URL I was supposed to access the dashboard with and entered that into my browser, but didn’t get anything. I tried restarting the server, no luck. I tried running it from the jar. No luck. I even tried uninstalling and reinstalling it. Still nothing.

I decided to boot up my CentOS virtual machine and try installing it there. I downloaded it and tried to run the installer but it told me I needed JDK 1.6 or greater. A quick search through yum and I had it installed. I tried to run the installer again and I got the same error, even though I now had JDK installed.

Eventually, after searching the web for awhile, I found out that they didn’t support OpenJDK yet (you know, the JDK that everyone on Linux uses) so you have to install it using the ignore dependencies flag. Finally, it installed.

It then said that Go Server was up and running and so I tried to access the URL, but it did not work. I tried Apache, and that was working fine, so my virtual machine was working fine, it was just Go Server. By this time it was quite late so I turned everything off and headed home.

The next day I got in early to have a play around with it. I booted up the virtual machine and tried to start Go Server using the service command. All I got was “Error starting Go Server”. I tried googling the phrase, but apparently, it had never before been seen on the internet.

I tried googling some more and eventually found a post that seemed to have the same problem that I had. They eventually found that the problem was to do with the hostname. I couldn’t find any way to change the hostname though, so decided to try the Windows approach and remove and reinstall it. This didn’t work either.

I tried to go look it up in the online documentation, but their website was down again with a 500 error. I waited a few minutes and did a couple of refreshes and eventually it reappeared, but I couldn’t find a solution.

By this point, I had wasted far too much time on this, so I gave up. My advice is, go elsewhere for such software.

Faster grepping with fgrep

Thursday, March 15th, 2012 | Life, Tech

If you use the Unix terminal, you’re probably familiar with grep. It’s a great search tool. But sometimes it is a little slow. Luckily, there is a faster version, with the original name of fgrep, though you might be surprised to learn it doesn’t actually stand for fast grep. But don’t be confused – it is faster.

You use it in avery similar way to the way you would use grep. So for most occasions, simply replace grep with fgrep for faster results.

How to truncate an ARCHIVE table

Friday, March 9th, 2012 | Life, Tech

Archive is a cool MySQL storage engine designed for fast inserts. In fact, it’s so optimised for this that it actually only supports INSERT and SELECT – you can’t run UPDATE or DELETE commands against it at all.

This is a problem when developing though, as you’ll often want to empty out the table and start again. But because it doesn’t support delete operations, it won’t actually let you truncate the table! So to answer the question posed in the article title – you can’t.

Therefore, you have two options.

Firstly, you can drop the table and re-create it. This is the recommended way from MySQL, so make sure you have a copy of the table creation command handy.

The second option, the lazy hacky way if you will, is to change the table storage engine over to InnoDB or MyISAM, truncate the table, and then turn it back to ARCHIVE ;).

Hashing passwords in PHP

Thursday, March 8th, 2012 | Programming, Tech

If you store passwords as part of a PHP script, you may be using md5() or sha1() to hash the password. This is common practice, but you may be suprised to know that actually, the PHP manual recommends against it.

The reason is that they are both fast but relatively insecure hashing algorithms that can be brute forced by modern computer systems if they get hold of the strings. A better approach is to use the crypt() function, which is a little more expensive in terms of resources, but worth it for the increased difficultly you create for any potential hackers.

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

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”.

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.

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.

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.