Musings of a Software Engineer

The gentle ramblings of a bored software engineer


Using Bind 9 for Home DNS Server

Bind9

Bind9

I’ve been with 02 for just over a year now and after having a fantastic setup from them and to be honest a really good connection (over 9MB most of the time).  One thing has really disappointed me… their DNS servers never seem to be as reliable as they should be.  I thought it was my router at first but using an IP address I can get out to the internet!

So today I decided I would use my linux machine to run as a DNS server for my network and it could cache them locally.  Hopefully it would allow my computers to ride the o2 dns storm!

Setting up Bind I thought was going to be really painful but all I had to do was install it and change one configuration file!  Using debian I did apt-get install bind9 and also apt-get install dnsutils.  This installed everything that was needed! Sometimes I think linux really is easy to use when its as easy as that to install a dns server.

The final part that needs to be done is adding my ISP’s DNS servers to the forwarders section within /etc/bind/named.conf.options.

Last put no means least just need to restart the bind server using /etc/init.d/bind restart.  Its then possible to start changing the IP settings of computers on your network to use the new DNS server.  Its also possible to test the server by using the dig command.  Running this command with a host name will return something like:


:/etc# dig lego.com

; <<>> DiG 9.6.1-P2 <<>> lego.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 27502
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 6, ADDITIONAL: 8

….

;; Query time: 2 msec
;; SERVER: xxx.xxx.xxx.xxx#53(xxx.xxx.xxx.xxx)
;; WHEN: Fri Dec 11 21:15:25 2009
;; MSG SIZE rcvd: 365

If you run the command twice you will see that the query time will have reduced to a smaller value. This means that the server has cached the request.

There is lots more information at ubuntu.com.

  • Share/Bookmark
No Comments

Max upload for eShop

Wordpress MU

Wordpress MU

I’ve been looking at setting up an eshop on one of my wordpress accounts and for the downloadable content page for eshop it shows that there is a max upload size.  After alot of hunting around and googling (which I thought might have been easier to find!)

Turns out it was quick an easy find when you know where it is :-) .  To change the max upload size that is listed in the eShop options is for wordpress mu go to the mu site admin section.  In the options section there is a max upload size and also a max blog size as well.  Changing these options changes the listed upload size on the eShop option page, but of course there is still the possible limit on the upload from the php.ini file.  This can sometimes be set by using a .htaccess file.

  • Share/Bookmark
No Comments

Regular Expression

Its been a while since I’ve ventured into regular expressions, and I always seem to find it a nightmare when I come back to it.  But I’ve found a great tutorial which gives a really good overview of each of the magic commands  / syntax that you can use when performing the matching:

http://gnosis.cx/publish/programming/regular_expressions.html

epfw testcase=validation/invalid-chars/epval-invalid-chars-bind36.xml trace_leve
l=3
  • Share/Bookmark
No Comments

Subversion making a tag using the revision number

Subversion logo

Subversion logo

I’m a user of a subversion server on a day to day basis and its probably the best free code repository that is out there.  It is fantastic to use and really simple to update and manage using things like Tortoise SVN.

But today I released that our repository had not been tagged to ensure that we could extract at certain levels easily.  I had a google and it looks like from windows its not easy to do the tag unless you have the working repository complete checked out.  When the size of the respository is probably 100MB and I do not usually have it all checked out its not good.

So after a bit more googling and thankfully I have a linux machine I have access to I found the command that makes creating tags really simply by running a single command that uses the servers own copy and creates the tag without checking out anything.


svn copy -r <revision> https://myrepro/project/trunk https://myrepro/project/tags/mytag -m "My Tag"

There must be a tool that can run this command on windows but I did not see one obviously.

  • Share/Bookmark
No Comments

Wordpress pages hit internal server error

Wordpress MU

Wordpress MU

When I was making the move to wordpress mu one of the strangess things that i encountered was a problem with pages and looking at full page articles.  When every I click on the links I would get an 500 internal server error returned.  Since the way that wordpress mu works it has to rewrite the url quite abit to understand what pages to actually get under the covers, for example:

http://phoenix.adamcoulthard.co.uk/blogs/2009/12/08/wordpress-page-hit-internal-server-error

is not an actual page on the server it gets rewritten to something that the server can handle under the covers.  I think alot of the problems were occuring because of the way that I had installed wordpress mu (at least this is what I think).  I had installed wordpress mu into a directory on the webserver rather than putting it into the root directory.  So when it created the .htaccess file with file rewrite information it added a base rewrite of that directory.  So if I installed it into wordpressmu/ then its rewrite base would have been /wordpressmu/ in the htaccess file.

After alot of googling with very little luck and attempting to use the write logging again with no luck, I started to think about what that rewrite base would mean to the system.  So I had a cPanel setup of *.adamcoulthard.co.uk pointing at /html/wordpressmu/ meaning that all the sites had to go to the wordpressmu folder straight away.  So if the rewrite base was adding on /wordpressmu/ then it would mean that it was going to be trying to navigate to /wordpressmu/wordpressmu/…. leading to the internal server error (I would have expected a 404 not found but nevermind).

So what I did was set the base to being just / and that solved the problems of loading the articles.

  • Share/Bookmark
No Comments

Where have the images gone?

Wordpress MU

Wordpress MU

After the upgrade to Wordpress MU for some reason I “lost” all of my images from this blog, oddly the other blog did not have this problem which was very strange!  After abit of digging I noticed that the url’s being returned for the images had /uploads/ in them rather than /files/ I assumed that the old blog was setup slightly different that caused this problem.

The simplest way to fix this was to manually edit all the posts to ensure that they were correct, rather than using the wordpress admin pages I decide to use phpmyadmin again because it was so much easier to edit them all in one go rather than having to navigate pages.

Now all the images are working as I would have expected with is fantastic :-) .

  • Share/Bookmark
No Comments

Wordpress MU

Wordpress MU

Wordpress MU

As you have probably noticed the site has been bouncing up and down over the last couple of days.  I got an email from my hosting provider to say that I had run out of space on my hosting account.  I had two installs of wordpress on it and wanted to add another but without the space (my hosting provider has upped my limit).

So after abit of searching I tried to use wp-hive which is suppose to be able to use the same installed wordpress code.  I gave it abit of a whirl but at that time it did not provide what I needed, ie the ability to easily move my two old wordpress sites into a central one.  After abit more googling and reading around I thought I should probably try the proper version of wordpress mulit user (WPMU) environment, this runs wordpress.com itself and a number of other high profile blogging sites.

The install of WPMU as for a normal wordpress install was really smooth and worked first time.  I suppose the biggest choice that I had to make when installing was whether to use subdomains or subdirectories.  Initially I thought subdomains so installed it, running through the rest of the install I then hit on whether I could actually update my hosting account to point to the subdomains to the correct location.  So I switched to subdirectories (using a great article).

Using the import I attempted to convert this blog first into the WPMU environment and then switched the subdomain pointer that I already had to point to WPMU.  Sadly this didnt work (still not 100% sure why but I suspect it was something on the URL rewriting), so I had to find a way to do the subdomains with my host.

More googling some time later I found a little trick for cpanel, that in the subdomain pointing its possible to use * as a subdomain and if the host has done the hardwork already in apache (or what ever is being used) all should work.  So I switched WPMU back to being subdomains and setup the blog correctly and everything seemed great!!!

Sadly I hit a few errors as you can probably see if you are reading this in the next day or so all the photos appear to have vanished from the blog! I also hit another couple of problems that I will blog in later blog posts so that they are easier to find for people searching.

  • Share/Bookmark
No Comments

Mass deleting in WordPress

PhpMyAdmin

PhpMyAdmin

What a nightmare… I’ve not really been paying much attention to the 100s of spam comments that I was getting so they had built up to a large amount.  So today I thought I would finally sort them out by just deleting all comments.  I think there was only one good comment anyway.

So I went to the standard Wordpress admin section and looked at the comments section, so I can view 20 at a time which means only being able to delete 20 at a time.  Surely there must be a better way!  The better way is phpMyAdmin, opening that up from my cpanel enabled me to quickly and easily delete all the rubbish comments that I had.

It does seem old that the wordpress admin section does not have a good spam filter built in.  At least then it might be possible to go to the Comments page and go delete all possible spam messages, similar to how an email client works.  At least that might help alittle towards the management of wordpress.  If I understood wordpress code myself / had the time I might think about doing it :-) .

  • Share/Bookmark
No Comments

Where does time go?

Wow its amazing I setup this blog with the intention of posting things to it every week at least once a week.  I think the last time I posted something was about 3 months ago!!! where does the time go.  Well I’m determinded to turn this around in december and attempt to keep an hour free each week to ensure that I do post something each week.  Kind of new Christmas resolution!

  • Share/Bookmark
No Comments

Where are all the cash machines…

Bank Logos

Bank Logos

I think I probably need to get out more, two posts about cash machines.

We were out in London a couple of weeks ago and had got to that point of the day needing some more money.  So you would like trying to find a cash machine would be simple.  Well if you know the area you are in then its probably easy, so we thought lets give the iPhone a work out and search for atm in google maps.  Well it turned out there were no cash machines (according to google maps) for 3 / 4 miles.  Not very helpful, let down by technology number one.

So after wondering around for alittle while we found a machine that was near a tube station, but sadly it had run out of money.  So off in search of another cash machine, we asked the person in a shop and they said that there was on in the tube station.  Great, run down into the tube and take one look at the machine and go mmmm that looks completely knackered.  The screen had some lovely obvious error message on the screen, not quite the blue screen of death that you can see on cash machines.

So after thinking that was it I attempted one last attempt to search for a bank this time on the iPhone, success there was a HSBC near by.  So using the maps and the compass (first time I’d used them together) and was able to navigate to the bank meaning we could get our cash.

Its rare to see a cash machine completely broken in the way above with strange messages.  Usually they just have not working on the screen.  The only other one I’ve seen broken had a great Windows NT blue screen of death on it.

  • Share/Bookmark
No Comments