home · blog · groups · about us · contact us
DevelopmentNow Blog
 Wednesday, November 22, 2006
 
 
Got an email today about Google Apps for Domains. Basically you can have Google Calendar, GMail, Talk (chat), and Page Creator (wiki) on yourdomain.com. Free during the beta period, and I suspect that Google will soon include other apps like Google docs, too. Get yourself one of those Outlook/Google Calendar sync tools, and you've got a tempting small business solution.
November 22, 2006    Bookmark to Digg or other social bookmarking
#    Disclaimer  |  Comments [0]



 Tuesday, November 21, 2006
 
 

Some good comments at accessify.com about screen reader testing tools:

Some good points were also raised about sighted developers using screen readers for testing

Adrian Higginbotham: Personally I never recommend anyone to try testing a site with a screenreader product unless they are already a confident screenreader user. you simply don’t use the tool in the same way

Adam Perry: I am sure Adrians comments are correct: a Visually Impaired (VI?) person will use the screen reader in a very different way. Nevertheless I found using a screen reader helped to identify areas of HTML which require improvement (inadequate or missing ALT, TITLE and SUMMARY attributes, for instance).

November 21, 2006    Bookmark to Digg or other social bookmarking
#    Disclaimer  |  Comments [0]



 
 

When developing a web site for screen readers and other accessible browsers, you often have to wrestle with the demands of Section 508 compliance and a nice design.

One WCAG guideline is to provide a "skip navigation" link near the top of the pages. Since you want this link to be available for screen readers, but hidden for normal browsers, your first instinct would be to do something like this:

<div style="display:none"><a href="#content">skip to main content</a></div>

... a bunch of navigation here ...

<a name="content" />
Main content here ...

However, you'd be wrong. I found this screen reader test at Access Matters that indicates that many screen readers try to obey CSS commands, and so many "hidden CSS tricks" like display:none or a 1x1 blank pixel with ALT text end up not getting read aloud by browsers.

It seems like the best solution, if you need to hide the "skip to content" link, is to use something like this

<div style="position:absolute;top:-100px;"><a href="#content">skip to main content</a></div>

Edit: FYI, Jaws and Window-Eyes are the first & second most popular screen readers, at least in 2003 when they commanded 65 & 35 percent of the market, respectively. But more recent articles imply the same thing -- those are the two to support.

 

November 21, 2006    Bookmark to Digg or other social bookmarking
#    Disclaimer  |  Comments [0]



 Monday, November 20, 2006
 
 

...or, why should I get RAID?

Like I said before, if you're getting a dedicated server for web hosting, you should get RAID. Just get it. But if you really want to know why, keep reading.

How likely is my hard drive to fail?

There are a lot of factors that contribute to hard drive failures.

Usage

If you run your hard drive 24x7, and run applications that read & write the hard drive a lot, that causes more wear on the hard drive than using it infrequently.

Environment

If your hard drive is inside a hot computer case and a hot room, it's more likely to fail.

Expected lifetime: MTBF and Service Life

The mean time between failures (MTBF) for modern hard drives is 50 years or more. MTBF is measured by running a bunch of hard drives for days or weeks and seeing how many fail during that time. That data is then extrapolated out to an MTBF number. You can search on Google or read this tutorial for more info.

However, a MTBF of 50 years does not mean your hard drive will last for 50 years. Instead, it's an average. So some hard drives will last longer, while others will last shorter. Sometimes much shorter.

That MTBF number also assumes you only use your hard drive within its specified service life (usually 3-5 years). So a 50 year MTBF for a hard drive with a 5 year service life means that, if you replaced the hard drive with a new one every 5 years, it should last 50 years on average before failing.

A rule of thumb

Ok, so we really don't know exactly when your hard drive will fail. We do know that you shouldn't use it past the end of its service life, so I tell clients that a rule of thumb for a hard drive with a 5 year service life is that you have a 2% chance that the hard drive will fail in the first year, a 4% chance it will fail in the second year, 8% in the third, 16% in the fourth, 32% in the fifth, and just keep doubling it.

What happens if I lose a hard drive?

Hard drives are near the top of the list of things to fail, and a server with a single failed hard drive can be down for 4, 8, even 24 hours as you and/or the hosting company support staff

  • notice the site is down
  • figure out the hard drive is dead
  • find a replacement hard drive & install it
  • restore your machine by restoring from backup and/or reinstalling & reconfiguring things
  • test to make sure that everything is working correctly and fix any issues

So if you lose a hard drive and don't have a backup web server your site could be down for 8-24 hours depending on your backup strategy & the quality of your support team.

Compare that to the loss of a fan or power supply which can be swapped out in under an hour. Some fans you can even swap out while the server is still running.

You need to think about what downtime means to your company. Will you lose money if your site is down for a day, either through lost sales, departing customers, or uptime fees paid to your clients? Will it be an embarrassment? Remember that sites can often fail at the worst time. Think about what 8-24 hours of downtime will "cost" your company. It could be a dollar amount or something non-monetary.

Then you can multiply this cost by the chance of your hard drive to fail (see the rule of thumb below) to come up with the expected cost to your company due to non-RAID hard drive failure.

So how do I decide to buy RAID or not?

So based on the above rule of thumb, plus the potential downtime, you can estimate whether it's worth paying for RAID or not.

You might decide that up to 24 hours down isn't acceptable at all, in which case you should go for RAID. Otherwise, if it's a potentially acceptable loss, you can think of RAID as insurance. Is the extra cost of RAID more or less than the expected downtime cost?

But what if I have two web servers?

If you're running multiple web servers and load-balancing across them, you might not need RAID, since you can simply direct all traffic to the "good" web server if one fails. Remember, though, that to be able to fail over successfully, you need to be capable of supporting all your traffic on a single web server. Since servers seem to enjoy failing at the worst times (which is often when your traffic is highest), you should expect that it'll be a good amount of traffic on that single server.

If you have two load-balanced web servers and both are at 80% capacity, what happens if one server fails and you redirect all traffic onto the good server? That's right -- your good server will get overloaded & some percentage of your users will get errors and long load times, or even worse your good server will redline and crash, and then you're totally down.

So...thats all for now.

 

November 20, 2006    Bookmark to Digg or other social bookmarking
#    Disclaimer  |  Comments [1]



 
 

I was reading about NewsHutch, yet another web-based RSS aggregator. Although it looks nice.

Anyhow, their blog post about looking for a new services yielded some suggestions on hosting plans. You can skim through the comments and see.

I've personally worked with Hostway and Rackspace in terms of hosting. Rackspace is expensive but has IMO great support and service. Hostway has a decent array of plans but I've had issues with their responsiveness.

Railsmachine seems interesting for RoR shops. SuperbServers seems like it has great prices (2gb Conroe with RAID for $200/mo) -- the question would be how good their service is. I guess at those prices maybe you just buy two web servers & load balance them. There were also a few kudos for ThePlanet, whose prices also seemed decent. 

If you're in the market for a dedicated server, I would highly suggest getting a RAID setup.

November 20, 2006    Bookmark to Digg or other social bookmarking
#    Disclaimer  |  Comments [0]



 Saturday, November 04, 2006
 
 

Mobile Web Sites in ASP.NET

I've been working on a mobile-enabled ASP.NET application lately, and overall it seems like pages did best when I

  • Used valid XHTML
  • Used as few tables & images as possible
  • Kept styles & scripting to a minimum & put them in a separate css
  • When I wanted to emphasize things I'd use standard tags like h1, h2, em, etc.

Remember that ASP.NET will degrade some of its functionality (e.g. client-side javascript validation) if it thinks the browser can't handle it. Since mobile browsers have a distinct user agent string, that means they'll be treated like a very basic web browser by ASP.NET. So you should make sure that your application still works (and looks ok) by using some emulators to test functionality.

Openwave Phone Simulator

Openwave provides a few versions of the Openwave Phone Simulator that lets you see how your site performs on the Openwave Mobile Browser. It's pretty easy to install -- log in, download the simulator, run it, & type in the URL you want to surf. Note that there are different versions of the simulator based on the browser version to want to emulate. So you can check this list of phones, see which version of the Openwave browser they use, & then get the matching Simulator version. So yes you're probably gonna be downloading at least 5.1, 6.2.2, and 7.0.

Generic devices on the Openwave Simulator version 7.0 (left) and version 6.2.2 (right):

CropperCapture[3].Jpg Openwave 6.2.2 on google.com

 

Windows Mobile Device Emulator

You can also use the Windows Mobile Device Emulator to emulate Pocket PC & Windows CE devices. Note that to use it easily you'll also want to install the Virtual Machine Network Driver and ActiveSync 4.2. Then reboot, even if it doesn't prompt you to.

Then in order to surf the web with your emulated mobile device, you

  • Open up Device Emulator Manager
  • Right-click an Emulated Phone & click Connect
  • Once the phone fires up, go into Device Emulator Manager, right-click the same phone and click Cradle.
  • After a few seconds, ActiveSync will open up & ask you what kind of connection to create. Choose a Guest connection.
  • Then you should be able to open up Internet Explorer on the emulated phone & surf around. You can type using your keyboard and navigate around the page using the arrow keys (on your keyboard).

Smartphone 2003 SE device profile on Windows Mobile Device Emulator:

Pocket PC

 

November 4, 2006    Bookmark to Digg or other social bookmarking
#    Disclaimer  |  Comments [0]



 Friday, November 03, 2006
 
 

I took a look at NaturalDocs today for documenting C# code.  It works by looking at normal comments (/* */ or //) above your methods. It then parses those comments & pretties them up.

All I can say is -- meh. It's very fast, but doesn't parse XML (triple-slash) comments, and it seemed to miss a number of my classes (I think partial classes messes it up).

I don't mean to slight it, because I think it's helpful and fast. I just think it's probably better for documenting stuff like Javascript, Actionscript, etc. If they added support for triple-slash comments & partial classes then it might be more useful for C# etc in terms of its sheer speed.

November 3, 2006    Bookmark to Digg or other social bookmarking
#    Disclaimer  |  Comments [0]



 Sunday, October 29, 2006
 
 

http://ankhsvn.tigris.org/screenshots.htmlRC4 of AnkhSVN, a Visual Studio plugin that works with Subversion, was released yesterday. From the site:

AnkhSVN is a Visual Studio .NET addin for the Subversion version control system. It allows you to perform the most common version control operations directly from inside the VS.NET IDE. Not all the functionality provided by SVN is (yet) supported, but the majority of operations that support the daily workflow are implemented.

A screenshot from the screenshots page:

Code | Tools
October 29, 2006    Bookmark to Digg or other social bookmarking
#    Disclaimer  |  Comments [0]



 Wednesday, October 25, 2006
 
 

Ok so this is one of my favorite tips in .NET. Of course, there are a lot of things I like about the framework, but anyhow...

A lot of times you'll want to create an array of items, but you don't know how big the array is going to be. You're hoping you can declare an array & just dynamically add items to it like you can with an ArrayList. The first impulse might be to do something like

string[] foo = new string[] { };
foo[1] = "some text";
foo[2] = "some text";

But, that won't work -- you'll get an System.IndexOutOfBoundsException.

However, in .NET 1.1, your friend the ArrayList comes to the rescue with this fun stuff:

ArrayList fooArrayList = new ArrayList();
fooArrayList.Add("some text");
fooArrayList.Add("some more text");

string[] foo = (string[])fooArrayList.ToArray(typeof(string));

Yay! Now you can dynamically add stuff to an array. But wait, there's more -- with .NET 2.0, the Array class somes with a new Resize() generic method, so you can also do this:

string[] foo3 = new string[]{};

// resize array & add an item
Array.Resize<string>(ref foo3, foo3.Length + 1);
foo3[foo3.Length - 1] = "some text";

// resize array & add an item
Array.Resize<string>(ref foo3, foo3.Length + 1);
foo3[foo3.Length - 1] = "some text";

So that's cool. But which is faster, you ask? Let's see, here's the code we used to add 10,000 items to an array.

const int MAX_ITEMS = 100000;
DateTime start;
TimeSpan timeTaken;

// time ArrayList
start = DateTime.Now;
ArrayList fooArrayList = new ArrayList();
for (int i = 0; i < MAX_ITEMS; i++)
{
fooArrayList.Add("some text");
}
string[] foo2 = (string[])fooArrayList.ToArray(typeof(string));
timeTaken = DateTime.Now.Subtract(start);
Console.WriteLine("ArrayList\t" + timeTaken.Milliseconds + " msec\n\n");

// time Array.Resize
start = DateTime.Now;
string[] foo3 = new string[] { };
for (int i = 0; i < MAX_ITEMS; i++)
{
Array.Resize<string>(ref foo3, foo3.Length + 1);
foo3[foo3.Length - 1] = "some text";
}
timeTaken = DateTime.Now.Subtract(start);
Console.WriteLine("Resize\t" + timeTaken.Milliseconds + " msec\n\n");

// prompt for ENTER
Console.WriteLine("Press ENTER.");
Console.ReadLine();

Final result: ArrayList 0 msec, Array.Resize 250 msec. If we go for 100,000 items, it ends up being ArrayList 10 msec, Array.Resize 45000 msec. ;(

So, that's not surprising. The ArrayList probably only resizes things when it needs to and keeps a buffer. So what if we change Array.Resize to resize the Array in chunks of, say, 10,000? And let's go for 1,000,000 items in the array.

const int MAX_ITEMS = 1000000;
DateTime start;
TimeSpan timeTaken;

// time ArrayList
start = DateTime.Now;
ArrayList fooArrayList = new ArrayList();
for (int i = 0; i < MAX_ITEMS; i++)
{
fooArrayList.Add("some text");
}
string[] foo2 = (string[])fooArrayList.ToArray(typeof(string));
timeTaken = DateTime.Now.Subtract(start);
Console.WriteLine("ArrayList\t" + timeTaken.Milliseconds + " msec\n\n");

// time Array.Resize
start = DateTime.Now;
string[] foo3 = new string[] { };
int itemCount = 0;
int arrayChunkSize = 10000;
for (int i = 0; i < MAX_ITEMS; i++)
{
// only resize the array if we need to, and do it in chunks
if (foo3.Length <= itemCount)
Array.Resize<string>(ref foo3, itemCount + arrayChunkSize);
foo3[itemCount] = "some text";
itemCount++;
}
// trim the final size of the array
Array.Resize<string>(ref foo3, itemCount);
timeTaken = DateTime.Now.Subtract(start);
Console.WriteLine("Resize\t" + timeTaken.Milliseconds + " msec\n\n");

// prompt for ENTER
Console.WriteLine("Press ENTER.");
Console.ReadLine();

Much better. ArrayList 150 msec, Array.Resize (chunked) 700 msec. But, ArrayList is still faster. So I guess ArrayList is pretty efficient about expanding its buffer when you add items to it, which is a good thing, since I like ArrayLists.

So...there's your tip, plus we looked at a new Array generic method, and did a bit of performance analysis. If you need a dynamically-sized array, just use an ArrayList and cast it to an array using the .ToArray function. Remember, you can do this for any array, even an array of custom objects.

October 25, 2006    Bookmark to Digg or other social bookmarking
#    Disclaimer  |  Comments [2]



 Tuesday, October 24, 2006
 
 

Data Dictionary Creator was recently released by Jon Galloway. It's a UI allowing you to document your SQL Server databases by storing the documentation in extended properties, and then exporting it as Excel, XML, etc. The nice thing is it stores the documentation in the same place that SQL Server normally stores its descriptions.

So instead of using the SQL Server tools to update your descriptions like this (ugh):

sqlserverfielddescription.gif

You can now use a cool lil' UI to do it, like this!

Screenshot

October 24, 2006    Bookmark to Digg or other social bookmarking
#    Disclaimer  |  Comments [0]



 
 

Google just announced Google Custom Search Engine, which allows you to create your own custom search engine and stick it on your site with a few lines of code. I was able to add one to http://www.developmentnow.com is about 5 minutes (look at the bottom of the blog page, or in the groups section e.g. at the bottom of this thread about web services).

One downside is that it relies on Google's index, so if your site isn't well indexed by Google (which mine isn't) your results are limited. But, it would be a nice thing for budding webmasters who don't want to build or maintain their own search engine, especially if they made sure to populate Google's index with Google sitemaps. And of course they make it really easy to incorporate AdSense into the search results.

October 24, 2006    Bookmark to Digg or other social bookmarking
#    Disclaimer  |  Comments [0]