My site INeedCoffee was first built way back in 1999 using Classic ASP. Back then it was just called ASP or Active Server Pages. It works well and doesn’t require moving to ASP.NET, so I never updated the code base. If it isn’t broke, don’t fix it.
There was one thing I wanted to address better recently and that was how I handled incoming broken links. I used to just redirect every request to the home page, but I’ve since learned that 404 error codes are OK to have. If the page is missing, returning a 404 code is appropriate.
When I studied the bad incoming links, I isolated about 15 where I could tell what article was intended in the link. For these links, I wanted to give a 404 error and provide a suggestion on what page is most likely the correct link. For this I used the Scripting.Dictionary object. In it, I matched the bad link with the good link.
RequestedBadLink = Request.ServerVariables("QUERY_STRING")
'- Dictionary of known bad URL requests
Set BadLinks = Server.CreateObject("Scripting.Dictionary")
'- add more links here If BadLinks.Exists(RequestedBadLink) Then
SuggestedURL = BadLinks.Item(RequestedBadLink)
SuggestedURL = ""
For the bad links, I added “404;” to the front of the link and embedded “:80″ after the domain. This is the format that the QUERY_STRING ServerVariables uses. Then on your 404 page, you can test to see if you found a Suggested URL and display it for the user.
Tagged with: dictionary
Posted in Classic ASP
I have paid for web hosting since 1995. When it comes to service, I’ve done pretty good. I follow a three step process when searching for web hosting.
- Web Research – Everyone does this. Find a host that meets all your requirements at the price point you are willing to pay.
- Sunday or Late Night Email – Let us say that you have 2 or 3 possible web hosts in mind. Wait until Sunday and then fire off an email to their support staff asking a question. The question shouldn’t be too difficult as to require lots of research, but not easy enough to be answered by a sales person.
- Wait For Responses – The winner of your business will be the web host that quickly and professionally responds to your off hour email question.
When I pay for web hosting I want to know that they have competent people working during non-business hours. Some of these discount web hosts are able to offer rock bottom prices, because they have bare bones technical support. They staff their rock stars during business hours, because that is when they are most likely to land a new customer. Sending an email on Sunday, or late in the night, is perfect way to test a web host before handing over your credit card data.
After you have established a relationship with a web host, periodically send an off hour email. Maybe once or twice a year. Keep them on their toes. Consider this test to be part of your website back up strategy.
This site uses WinHost, which I highly recommend for ASP.NET and SQL Server web hosting. They passed the Sunday email test.
Tagged with: web hosting
Posted in General
When I first looked over the Instapaper application I didn’t think I needed it. I used Delicious for my social bookmarketing site. Why would I need Instapaper? Then news stories came out saying that Yahoo! would either shutdown or sell Delicious, so I gave Instapaper another look.
How did I miss the primary reason for using Instapaper? It’s primary feature is not bookmarking, it is making text legible. There was this trend in web design around 2003 where font sizes got really small. I’m afraid it may be coming back and my eyes just can’t take it. Thankfully with Instapaper, I no longer have to suffer through reading painfully small fonts or gray text on a while background.
Here is how it works.
- Set up an account on Instapaper.
- Add the Read Later bookmarklet to your browser, per their instructions.
- Go to a page you wish to read that has a hideous web design with dreadful legibility. For this example, I am going to use the outstanding article Vitamin D — Problems With the Latitude Hypothesis on the Weston A Price website.
- Press your Read Later bookmarklet.
- Go back to Instapaper, locate the article on your list and click the Text button.
Add it to Instapaper and then click the Text button.
Presto. The article is now readable.
Instapaper doesn’t work for every website, but works for most. My online reading speed and comprehension has never been greater. I highly recommend Instapaper.
UPDATE: Seems Instapaper has a feature in their Extras section called Instapaper Text. Drag that bookmarklet to your toolbar and click it whenever you need text cleaned up. No account needed. Use this if you don’t need the bookmarking features. They also give a shout out to a similar solution called Readability.
DreamHost promotes unlimited domain web hosting for $8.95/month. It seemed like a sweet deal, so I signed up for it. The reality is that their offer is misleading. DreamHost offers 100 MB of memory per account. If you exceed this number – even for a second – they unleash a procwatch to kill the process.
At this point you can reach out to DreamHost’s support team. They will tell you that it is the fault of WordPress plugins and then try and upsell you on a VPS account. They promise not to kill your processes if you get a VPS account. Kind of like a shop keeper that pays the gangster protection money so his store doesn’t burn down. How sweet! My personal opinion is why should I pay for an enhanced service if the basic service is awful? I’ll just switch web hosts.
Back to the question of resources. Just how much memory does a website running WordPress with some basic plugins use? As of this writing, I have 2 WordPress sites on DreamHost (not DigitalColony.com). I installed 2 plugins to help me track my memory usage: WP-Memory-Usage and TPC! Memory Usage. Below is a screen shot from one of my sites. The other site shows similar numbers.
With these two plugins I learned a few things:
- DreamHost limits your PHP memory to just 90 MB.
- A basic install of WordPress takes about 30 MB of memory on a 64 bit installation of PHP.
- I activated and deactivated every plugin. Most used trivial amounts of memory. No plugin exceeded 2 MB of memory. Even the much aligned All-In-One SEO plugin used only 1.05 MB.
- Switching themes had almost no impact on memory usage.
- With as little as two domains using WordPress on DreamHost you are already reaching the upper limits of memory allocated. So much for unlimited domains. Perhaps they should rephrase it to unlimited unused domains?
- DreamHost has a serious LOAD AVERAGE problem. The numbers in the above screen capture were the lowest I captures. Often the Load Averages exceeded 10.
Even though I went looking for answers on memory usage, the load average numbers jumped out at me. What do they mean and what is a good number?
The article Understanding Linux CPU Load – when should you be worried? is a great tutorial on the topic. It makes the case that the maximum load should not exceed the number of cores on the server. My DreamHost server has 4 cores. I monitored this number all day and it is always in the red zone. The CPU load on DreamHost servers is excessive.
My advice is to stay away from DreamHost. Their servers are overloaded and if you plan to host more than one WordPress account you’ll experience problems.
UPDATE (Nov 25, 2010) – This morning the DreamHost Load times spiked much higher!
- Load Averages: 144.95 45.93 21.12
I just updated the code for the Row and Column Highlight for Gridview Control lab. I decided to put the CSS specific to that feature in its own style sheet. Since I am using Master Pages for the labs, I needed a way to programatically add the style sheet into the <head> when the page loaded.
Here is the C# code I used to drop in an additional style sheet.
/* add custom CSS */
HtmlLink rowCSS = new HtmlLink();
rowCSS.Href = "highlight.css";