Hosting woes and glories

So I moved from the doomed UplinkEarth to ReliableSite.net, which is cheap and impressive. And then, almost immediately, they had the biggest set of downtimes in their history (that’s what they say, but others tend to verify that). We’re talking days here. My sites were down for 48 hours, then they came up for maybe 8 hours, and then went down for another 24.

And it seems like hosting companies have some sort of customer relation retardation, because they didn’t post anything, or sent out e-mail (to domains they don’t host) saying, “Hey, wow, things are really screwed up here — we’re working as hard as we can.” That would, as many customers pointed out, make a big difference. Instead you’re just left with a dead site, wondering if they is happening just to your site or to everyones.

At any rate, that was a month ago and they seem fine since then.

But in the meanwhile I acquired two Danish domains (.dk). On that my wife-to-be has for her family, and one as the Danish counterpart to my regular sites. So now I have rezio.com, rezio.net, and rezio.dk.

But Danish domains can only be hosted on approved servers. This is a good example of socialist thinking. Instead of allowing anyone, anywhere, with any kind of intention, rent space with a Danish domain, the hosting outfits have to get approval. Right or wrong, I can’t host my Danish domains with ReliableSite.

So I found a reasonable Danish hosting service (or “web hotel” as they call it.) And so far I’m quite pleased. The first thing I did was set up something that points to my main site. I used the ASP.NET AdRotator control to randomly display some of my pictures, and clicking always takes you to rezio.net.

That was fine, but for reasons that I don’t understand my gallery stopped working after ReliableSite had their blackout. So the next thing I did was set up a sub-domain for the gallery. That’s at gallery.rezio.dk.

So for now I guess I’ll just keep both hosts. It’s more than I need, but they’re both cheap — both less than $100 a year. It’s worth it to have a comparison anyway.

Just for fun, some Javascript

I’ve learned a lot about web programming since taking this job. I knew C# already, but ASP.NET, XML, AJAX, and all that was new. I didn’t know any Javascript either, nor did I understand what an important role it plays on the web. But that changed this week, when I was given the assignment to use Javascript to make the header cells in a column change color in order to improve the user interface of a large table.

Once I got that working, I threw this sample together.

The most important thing I learned is that ASP.NET often auto-generates element IDs, which means that refering to elements by the ID used in the code will fail. The solution is to use the ClientID property of the element to obtain the “real” ID that will be produced in the HTML.

Attaching the script is a two-part process. First, the script to be associated with each table cell is attached using the Attributes property.

for (int r = 1; r < table.Rows.Count; r++)
{
    string rowID = table.Rows[r].Cells[0].ClientID;
    for (int c = 1; c < table.Rows[r].Cells.Count; c++)
    {
        string colID = table.Rows[0].Cells[c].ClientID;
        TableCell cell = table.Rows[r].Cells[c];
        string colScript = string.Format(”handleOver(this,’{0}’,'{1}’);return true;”, colID, rowID);
        string rowScript = string.Format(”handleOut(this,’{0}’,'{1}’);return true;”, colID, rowID);
        cell.Attributes.Add(”onmouseover”, colScript);
        cell.Attributes.Add(”onmouseout”, rowScript);
    }
}

The onmouseover and onmouseout Javascript events are mapped to script that calls Javascript functions called handleOver and handleOut. These functions both take a reference to the cell itself (this), and the client ID of both the column and row header cells.

The handleOver and handOut functions are pretty simple. They just use the IDs to change the header cell background color, and then change the cell background. 

var origColor;

function handleOver(elem, col, row)
{
    var c = document.getElementById(col);
    origColor = c.bgColor;
    c.bgColor = “#aaaaaa”;
    var r = document.getElementById(row);
    r.bgColor = “#aaaaaa”;
    elem.bgColor = “#aaaaaa”;
}
function handleOut(elem, col, row)
{
    var c = document.getElementById(col);
    c.bgColor = origColor;
    var r = document.getElementById(row);
    r.bgColor = origColor;
    elem.bgColor = origColor;
}

Gallery on-line

Progress on the gallery itself has slowed, what with the holidays and everything, but there have been related events.

For one thing, the hosting company that I’ve been using happily for five years has become really unreliable. “UplinkEarth“, as they call themselves, has a lot of features and used to be really fast support, but they’ve had a lot of problems recently, mostly involving hacker attacks (it’s SO much fun to check your sites and discover that all the content is gone). That specific problem isn’t their fault (although apparentlly they were sending passwords as clear text) but the way they handle things is bizarre. Like changing your user name without telling you, or blocking all FTP access from Europe because some of the hackers are in Europe.

At any rate, I got mad enough to try another provider. I’m trying ReliableSite.net now. (I know, another great name.) The administration tools are better, and it’s cheaper for what you get. It’s a little more bare-bones, but that suits me. I have, unfortunately already had trouble with support. Many of the items in their “knowledge base” are either out-of-date or not-yet-in-date.

But yesterday I decided to upload my gallery and see what happens. And, after a few changes to the config file, it worked! Check it out: gallery.rezio.net. I also set up a WordPress installation to make sure the PHP support worked, and that worked perfectly.

I’m very happy about the site speed too — it seems really fast. I looked up the IP, and it’s out of the UK. That’s five times zones closer to Denmark (UplinkEarth servers are on the US East coast) so perhaps that’s all it is, but some reviewers have noted that ReliableSite.net is fast.

Gallery in progress

I’ve made a lot of progress on my image gallery. It’s in ASP.NET, and initially my idea was not to use a database at all. Instead I’d just store image names, locations, tags, and descriptions in an XML file.

I got all that working, and all the lookups using XPath, but then I started wondering if this is a wise strategy. I like the idea that I can back everything up with a single file, and that I don’t have to mess with connection strings and all that jazz, but on the other hand, I’m sure to have threading issues, and the XML file could grow to be quite large.

Furthermore, I’ve been told both that XPath is slow and that XPath is fast, so I’m not sure if performance will be an issue either.

So last night I confirmed that I can access a MySQL database from ASP.NET, and now I’m thinking that is the safer way forward…

At any rate, I’ve learned a great deal about XPath and ASP.NET along the way, and may post some examples soon. With XPath in particular, it seems like the examples that are on the web now go from dead simple to esoterically complicated, with not much between.

“Visual Studio Team Suite 2008 Development Edition”

Whoever names the products at Microsoft should have been replaced a long time ago. If this were Apple or Macromedia, this would be called “Wildcat” or something. It would sound better, be more memorable, and be one third as long.

Over the weekend I installed Visual Web Developer 2007 Express Edition (again, surely a cooler name could be given to a snappy, slick and FREE version of VS), and was really impressed.

There is, of course a massive difference between the two (including the price), but Express is just cooler. It’s faster, for one thing, and the graphics and color scheme are nicer. And (and this is what prompted this post), it was features like intellisense turned on by default.

Yes, that’s right. The big daddy version doesn’t offer any suggestions when you type: variable name dot. You have to go to Tools | Options | Text Editor | All Languages, and select “Auto list members” and “Parameter information” before you get that feature.

For a while I just blankly tried over and over, typing in something and pressing “.” and I thought there is NO way I’m doing .NET programming without this feature. If someone — for some strange reason — doesn’t like it, they can turn it off, but SURELY that person would be in the minority.

That was the first thing I noticed. The second was that it was noticeably slower than Express, but I guess that’s not surprising. The third is that it seemed a little flaky. I loaded up a project that I’d started in the Express edition, and it complained about being unable to find an ASP.NET master page, but only for default.aspx. All the other pages that used it worked fine. Default.aspx found its master page at runtime, so it wasn’t a typo or something.

I created a new page and then copied the content of default.aspx into it, then deleted default.aspx and renamed the new page to replace the default page, and the warning went away. Not the best first impression.

Technology roundup

Incredible as it seems, I’ve been at my new job for seven weeks. In that time I’ve worked on four different projects, and gotten my Sitecore level one developer certification. I’ve learned a LOT, but not any one thing very deeply. It’s been very much a survey of web technologies.

Codehouse specializes in Sitecore, a Content Management System (CMS) that is very impressive. The entire authoring and development experience is browser-based. That’s not revolutionary, but in this case the UI looks like Windows. It has a start button, start menu with applications, a control panel, etc. It feels a bit like you’re in a virtual PC image, but you’re just in a browser.

On the one hand it’s profound — one can really see that the browser is becoming the platform. One can imagine that computers will become little more than dumb terminals that run either IE, Safari, or Firefox, and all applications will be written in Javascript and Flash. (Except games, of course, but they’re all headed over to XBox and Wii anyway.)

[Read more →]