Jun 1 2009

Back into Web Design

Screen-shot of the new design for Aimee's Website

Screen-shot of the new design for Aimee's Website

It has been a long time since I’ve actually designed a website/theme from start to finish, mocking it up, slicing and implementing it. I did one over the last few days for my girlfriend Aimee and realised how out of practise I am. It wasn’t really my CSS skills lacking but in Photoshop I really am not the most imaginative person. Anyway, I got an idea one night for a theme for Aimee’s website and got up in the morning and mocked it all up.

I never got around to fixing it in Internet Explorer, I don’t imagine it works correctly, for one, I didn’t put in the IE PNG Fix, and I definitely used 24-bit transparent PNGs in there. However, it works in Safari, Firefox and Opera and that seems to be all the Aimee cares about so that is that for now, maybe some fixes another day.

I put it live this afternoon, it could definitely use a few tweaks and finishing touches but I think I’m happy with how it came out.

Aimee is planning on moving around the structure of her site, which is using WordPress. In that respect the navigation isn’t particularly useful at the moment and the front page is going to be a static page rather than her blog.

Also, I got bored near the end and put a weird little Easter egg into the theme, try double-clicking the wings.


Jun 22 2008

Hosting Woes

Tom and I have had a hosting account with Startlogic for a few years now, it was very competitively priced and we wanted a cheap VPS. We haven’t had too many problems up until now, the uptime is good and the problems faced so far have only been with slow response times to online tickets and email.

This post gets into technical details of the DNS system and what went wrong so unless you’re interested in reading technical details, you may want to skip down to the end of this post. [skip]

In terms of DNS, our server runs named (BIND) so it can be a nameserver for any domains we host. This really isn’t a very good option for so many reasons. Two of these reasons are:

  1. You should use two separate name servers which are geographically dispersed.

    Using a single server for a nameserver means there is a single point of failure.

  2. Downtime on the VPS account will mean that after a while, the DNS records cease to exist on the internet.

    One effect this has is that if the VPS account goes down or needs to be rebuilt and it is down for longer than the Expiry time on our domains, mail sent to those domains will be bounced and not be resent automatically.

There are plenty of references for this information on the internet.

StartLogic set us up by putting our primary domain name’s DNS record on their geographically dispersed name servers meaning it would be quite resilient to network failures.

They then told us that if we wanted additional domains pointed, we could just email them. This is what we did for about 2 years.

Tom actually forgot this and has a few of our client’s domains pointing to ns1 and ns2.yigg.net (as Startlogic suggest now).

Anyway, at some stage, they accidently signed us up for an additional account, a standard hosting account, under our primary domain name. This hadn’t caused any problems at the time because they didn’t touch the DNS records.

What happened was that they recently upgraded all standard hosting accounts to a new platform. This meant the erroneous account was moved onto a new server. Last week they completed the migration and changed the DNS record.

Suddenly, I couldn’t get to our control panel*. Yigg.net was resolving to a completely different IP. So I figure there as been a problem and phone through to them.

Now I must mention here that earlier this year we received an email from a representative at IPowerWeb, the parent company (?) for StartLogic saying that he was our point of contact if we needed anything, we could call him.

So, I rang through and discussed somethings and then got put through to a technician. After a while he figured out what had gone wrong after I explained the situation and he found out VPS account and said he’d get those DNS records corrected and pointed back to our VPS account. He said he would also delete the erroneous standard hosting account.

Only the latter got done, probably a mistake, the guy I spoke to seemed really helpful and the extra hosting account got deleted quick smart. The account switched to a holding page instead of the “VDeck Default” page it was showing before. So I waited to see if their servers would update and start announcing the correct IP again.

You need to wait up to 48 hours for a DNS change to reach everyone in the world (worst-case) but there is a trick to finding out if the change has started propagating. On Mac OS (and most *nix machines) you can query a DNS server directly for what it thinks the IP address is for a domain. Because I knew the name of the authoritative server with the record on it, I could ask it directly and see whether it was announcing a the correct IP.


# dig yigg.net @ns1.startlogic.com

; < <>> DiG 9.4.1-P1 < <>> yigg.net @ns1.startlogic.com
; (1 server found)
;; global options:  printcmd
;; Got answer:
;; ->>HEADER< <- opcode: QUERY, status: NOERROR, id: 53630
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;yigg.net.			IN	A

;; ANSWER SECTION:
yigg.net.		3600	IN	A	66.96.134.55

;; Query time: 291 msec
;; SERVER: 66.96.142.100#53(66.96.142.100)
;; WHEN: Sat Jun 21 23:35:01 2008
;; MSG SIZE  rcvd: 42

It wasn’t.

I actually forgot about it until lunch time the next day when I Tom got an email from a client saying his email was no longer coming through. Turns out, his name servers were set to ns1. and ns2.yigg.net which now resolved to Startlogic’s standard hosting account, not to BIND running on our VPS account.

So I wrote a support ticket explaining the situation and then phoned America to get them to sort it out as soon as practically possible. The support representative said a technician was looking at it right then. So I hang up and waited… and waited. No change.

The next day I updated the ticket again trying to clarify what needed to be done, point yigg.net back to our VPS’s IP address and away from the IP it was incorrectly set to previously.

Today, later I rang them again to see what was going on. The representative then proceeded to tell me that what I wanted wasn’t possible any more and that I needed to set up name servers myself. I got quite confused as to what she was asking me to do because she said that I wouldn’t need to sign up with a DNS provider, I could do it all through the registrars control panel.

The main problem with that, is that I didn’t know where that was, as we registered the domain with StartLogic, they had taken care of registering it, setting up the contact information and adding their name servers to the records. I realised when she told me the URL to go to that I had been there before, to update my contact details when I was told I had to. She couldn’t tell me the username and password so I had to figure that out myself, which I did without too much trouble.

What I couldn’t figure out was what she was asking me to do. She said I needed to “create a name server” for my domain name. Now, in normal domain name management talk, that means setting up a box running BIND and telling the registrar to hold a glue record pointing to this box. It turns out that she was simply asking me to add glue records at the registry level for our VPS (which is running BIND already).

There is a difference between creating a name server and simply pointing A records at a registry level at it.

If anyone from Startlogic reads this blog post. Please reconsider this policy, the way it worked for the last two years was much more reliable and didn’t require a user to go into that unbranded OpenSRS management console to try and decipher fairly non-standard terms.

In terms of customer service, they get a low score. I got it resolved in the end, if it hadn’t I would have called my contact at IPowerWeb and got put through to someone who may’ve been more helpful, I’m not sure though.


* I could still get to our control panel as I just needed to access the correct at our IP, it doesn’t require a hostname to get into the control panel but I think I was only one who knew that (don’t know if Tom did and I knew James didn’t).

** If anyone has a problem with this post (including StartLogic), I will take it down and replace it with one about not using a single domain name server in a VPS situation, which is still relevant but applies to a few more hosting providers.


Jun 18 2008

Firefox 3

Firefox 3 was launched this morning (5am NZ time). Mozilla Foundation have made a huge marketing effort to the point of setting a world record for the most downloaded software in 24 hours. Now, you’d expect, with a market share just shy of 20% of the global web browser market share and that kind of marketing, you would need some serious distribution technology.

Mozilla.com web traffic is pushing well over 2 Gigabits a second of just pure HTTP traffic. That is in addition to the 13 Gigabits a second or so of download traffic. We are still at around 14,000 download/minute and mozilla.com is responding well! Go Mozilla community and IT team! schrep – June 17th, 2008

Considering the numerous reports of the Mozilla.com website being down for at least the first hour of the record attempt, lloks like something in the middle couldn’t quite handle the load. At 15Gb/s that is close enough to 2GB/s, that is fairly large.

The official counter at SpreadFirefox.com shows 2,135,640 as at midday here, only 7 hours in. Either their counter is off or things have calmed considerably. If they were still blasting data out at 2GB/s the counter would be closer to 7 million by now.

I’m not going to go in to the features of Firefox 3 too much but for Mac Firefox junkies, it is a massive update. The interface is now using native widgets and is much faster. It also brings Firefox back into the running with Safari and Opera again in terms of standards support.

If you download it today, from http://getfirefox.com you’ll help Mozilla set a world record, the servers seem to be coping now so it downloads quite quickly however the Mac version weighs in just over 17MB which is on the steep side.


Jun 10 2008

deleteCell may have side-effects

UPDATE:

I have created an interactive test case and an automated test case.

Turns out the behaviour is reproducible. Now, is this a bug or am I just missing something about the way that method should work?

I was debugging a client-side heavy application today in IE7 and ran up against a very weird bug. Anyway, even with the Microsoft Script debugger, it took me a couple of hours to trace down the cause of this one bug.

The system has a page which works similarly to Apple Mac OS X’s Finder windows in Column View. In IE7, I was having a problem where all the children of a node inside a table cell where being removed from the DOM when I removed the table cell itself. If you think this sounds normal, let me explain.

In Javascript, DOM Elements exist as Javascript objects and can be attached into a document at any point, they do not have to be a document, they can exist solely as fragments. The normal DOM ‘removeChild’ method does exactly this; it detaches the child from the parentNode but if there are any references to the DOM element in javascript-land, it does not get deleted (or garbage collected to be more precise). This means you can reattach the node somewhere else after some processing.

Safari, Firefox and Opera appear to do this with the deleteCell method of a ‘table’ as well but Internet Explorer appears to do something different. There is a little bit of speculation here as I haven’t created a minimal test case of this bug yet but it appear that IE detaches all the DOM Nodes recursively beneath the cell it deleted. This doesn’t appear in the MSDN documentation so I’m not sure quite what is happening, am I experiencing a bug caused by something else maybe.

How would that be useful!? I can’t see a purpose for it but whatever.

My fix was to remove all the child nodes of the ‘td’ element using removeChild first, then delete the cell. That meant the elements that were in the cell before hand still existed if there were any references to them, which there were.


Jul 30 2007

Millions of domains – Single Sign-in

Alright, “millions of domains” is a bit of an exageration, hundreds is more accurate. 613 to be exact. That’s how many domains one project I’ve been working on has. What makes this situation a little stranger is that all these domains point to the same hosting account. I’ll give a bit more information about the project in a bit.

There is one feature of this project which required a bit of extra thinking and that was having a single-sign-on from any of the domains. The feature would need to allow a user to login from one of the 600 domains and still be logged in if they accessed the site from another. The problem doesn’t get complicated until you add in that the idea was to not have the address in the address bar be a single site but stay at the domain the user typed in and that frame-based “masking” was out due to IE6 SP2 (might have been IE7) by default, blocks third-party cookies – which is what the login cookies would have been if using frame-based “masking”.

My solution to the problem probably isn’t the most elegant but it does the job for now.

When a user enters one of the domains, if there isn’t an authentication cookie in their browser for that domain, a redirect is performed. The user is sent briefly to a central domain which checks if the user is logged in on the central domain and if they are, send back the session_id in the URL. Now, because all these domains ultimately lead to one hosting account on a single server, the session_id sent back works perfectly and allows them to log in. At this point, the system also attaches a cookie to the current domain in case they come back to this one, another redirect won’t be required.

When a user goes to one of the domains but isn’t logged in, they are of course briefly sent to the central domain which comes back saying they aren’t logged in there either and the login page is shown. One filled in the login form is posted back to the central domain which authenicates the details and redirects the user back to the domain they typed in, along with the new session_id. This now means the authentication cookie is set on the central domain and it will now be set on the domain they typed in.