Why having DNS separate from hosting is a good idea

Yesterday my hosting account got suspended due to another domain using excess bandwidth. This meant visitors to my site were redirected to an error page, and I couldn’t log into the control panel or even access the site via SSH or FTP. Normally this would be a disaster, as you’re locked out of your own site at the mercy of customer support. Not for me however!

I had configured my domain’s DNS servers to use freedns.afraid.org, which in turn pointed to the ukhost4u account. Sure, this adds an extra layer of requests to the loading time, but when the hosting goes down, all I had to do was import the latest database backup on my home server, flip the DNS records to my own ip at freedns, and my site was back online with minimal downtime. Slightly annoyingly after that work, ukhost4u’s customer service turned out to be excellent, and we had the issue resolved in a couple of hours. Now I just need to swap the DNS records back again…

Should I use Dreamweaver to write PHP code?

That’s a question I was asking myself about a year ago now, when I was approached to write a database system for a betting tipster. The concept was fairly simple, the employees of this business need an online form to add tips for each betting system the company runs, and later update these tips with the result of the race.  Then a paying customer can access this information as a nice table, with the ability to filter a specific date and/or betting system. He can also choose to download the data to process in his own Excel spreadsheet, for example. Pretty simple, no?

Edit Screen

This was, however, the first project I’d ever chosen to write in PHP, so I had to learn to adapt my knowledge of  Visual Basic and Access via ODBC, a client-side language, to the server-side nature of PHP and MySQL. The cient didn’t really want to hang around forever, so I thought I could speed up the whole process by using Dreamweaver’s ability to ‘build applications visually’, then tweak and add to the resultant code to add the custom features they requested. These included automatically defaulting to editing today’s date, a rich text editor for notes, easily editable drop down menus for the betting system, automatically moving to the next tip once saving, and some other stuff. It still sounded pretty easy, even for a PHP novice.

After some initial confusion regarding using phpMyAdmin to create the database (solved by the hosting provider,) I was amazed at how quickly and easily I could piece together the bones of this program in Dreamweaver without even touching the code. It seemed a great way to work, letting Dreamweaver do the hard work and then tweaking the result. I was getting paid to click and drag! However, I soon ran into problems. Once I had a few server behaviours on the page, they started to clash, as they were all trying to use the same variables. This took a few hours to hunt down, and even more to correct the problems I caused (Coming from my VB background, I kept forgetting that lines had to be ended with a semicolon.) The biggest problems arose when I finished the structure and came to tweaking Dreamweaver’s generated code. What seemed to happen when I made a change to the code, is that Dreamweaver would no longer recognise its own code, the server behaviour would disappear from the side panel, and then it would decide that the code was ‘wrong’ or redundant and try automatically correcting it or even deleting it. I can’t remember the specific problems now, but it really felt that it was me versus Dreamweaver, with it battling to keep its code and me trying to hack it up with my keyboard. In the end, I got a working system presented to the client, and thought that was it.

TinyMCE (The text editor) was really easy to integrate, and has options for every scenario

Now, a year or so later, I’ve been asked to add some more features to the code. Since then, I’ve moved from CS3 to CS4, and immediately I ran into problems with Dreamweaver not recognising the spry tabbed panels I used to separate the different actions the user can take (see the screenshots). From there I ran into the same sort of problems as last time, but I was now better prepared to deal with them. Last night I got the extra features finished, and saved the files ready to deliver to the client on Monday. This morning I had a quick check of the finished page, and spotted a line of text that could be better worded. I changed the text, which involved no changes to the PHP code, uploaded to the server to test once more, and what?! Suddenly the save button is broken! The code goes through all the motions of saving to the database, the page refreshes, the confirmation message shows, but the change has not stuck. But this was working last night, and I haven’t even changed the PHP code! Now I remember last time, Dreamweaver played this game with me, and it took ages to find that it had automatically added a closing tag or something where I didn’t want one. For some reason the update record server behaviour has disappeared from the panel. Now I’m going to have to look through all the code to find something I didn’t even cause. This sort of thing adds loads of time to a project that can otherwise be complete, and I can’t even imagine a timescale that I can find this bug in. It’s really frustrating, Adobe.

Why didn’t I just stop using Dreamweaver for this project and code manually? I’m a stubborn guy, and I really believe the concept of building applications visually, then adding on custom features can speed things along, if only Dreamweaver could keep its nose out!

New Server

Today I moved teamtownend.com to a new server hosted with ukhost4u.com. I used them in the past for another project and they were for the most part okay to work with, and excellent value. Previously, I hosted teamtownend.com on my own homemade IIS7 server in our attic. It worked very well, however the myriad other roles the attic server has (file server for our household, print server, Orb server) pushed the little AMD Sempron 2GHz processor and 1GB RAM to the limit at times. Also, our ADSL connection with Be Unlimited has a feeble 1Mb/s maximum upload speed. Things should be a lot quicker now!

The swap went as smoothly as one could have hoped, I exported the MySQL database using phpmyadmin, copied over the files, updated wp-config.php, and away WordPress went. Then I had to manually convert IIS7′s config.ini files to .htaccess since the new server used Apache. Finally, it was just a case of adding the DNS and CNAME records on the new server, before setting the name servers for the domain (to ensure a seamless swap with zero downtime, not that I get enough visitors to really matter, but it was still fun.) The Sempron is sighing with relief now!