November 2007 - Posts

Kill All Processes for a Passed Database Name (SQL 2005)

We have an upcoming requirement to kick all users out of a database before running a backup.

So I'm saving this script for future reference (thanks to Chris for posting it to the SQL Down Under List):

CREATE PROC [dbo].[sp_SpidKill]
  @db VarChar(200)
AS

DECLARE @Tmp VarChar(10)
DECLARE @spid VarChar(10)
DECLARE @Kill VarChar(200)

SELECT @spid = Min(spid)
FROM master.sys.sysprocesses
WHERE dbid = DB_ID(@db)

WHILE @spid IS NOT NULL
BEGIN
  SET @Kill = 'KILL ' + @spid 
 EXEC(@Kill)

  SET @Tmp = @spid
  SET @spid = NULL

  SELECT @spid = Min(spid)
  FROM master.sys.sysprocesses
  WHERE dbid = DB_ID(@db)
   AND spid > @Tmp
END

Tags: sql server, database, development, backup, script

Book Review: Defensive Design for the Web

I've recently finished the excellent Defensive Design for the Web, authored by some of the people behind 37 Signals (Getting Real, Signal vs. Noise blog). The book is subtitled "How to improve error messages, help, forms and other crisis points", and is referenced in Steve Krug's Don't Make Me Think - one of the key reasons behind me reading it (I enjoyed Steve Krug's book a lot).

At only 246 pages, Defensive Design is a short book which means it's a quick read (and not very expensive!). There's lots of illustrations, and the book is neatly divided up into digestible chapters, like: the sort of language you should use when something goes wrong, how to display error messages, how to design forms, help design (FAQ's, Help section, contact information), search options and more.

The authors describe "defensive design" as "contingency design": "design for when things go wrong". The book includes 40 guidelines with lots of examples from actual sites (as of 2004, although in some cases not much has changed), and, helpfully, comparisons to a real-world/non-tech example (for instance, comparing searching a site for "mops" and ending up at "electronics" to the experience of walking into a Target store and getting the same directions).

Like Don't Make Me Think, there's not any code. Most of the guidelines aren't about code but about design choices, and I can understand that providing code would be tough...should the code be PHP, Ruby, ASP.NET, etc?

I would highly recommend this book. It provides clear, simple advice for what to do when coding for errors. Even though I design only intranet sites, this book has helped me rethink the help I provide, and perhaps helped give substance to the advice I read on blogs but find it hard to argue a case for with my boss!

Haven't heard enough praise? Here's some more reviews of the book.

Not sure? The publisher's site has a downloadable chapter.

Tags: book, review, usability, design, web, error

Flock, 'the Social web browser'

Flock might just be the package to make me switch browsers from IE/Maxthon for my home computer time.

Flock is billed as "the social web browser" and integrates data from sites like Facebook, Twitter, YouTube, Flickr, and Delicious, listing all your friends in the one place along with the last time they updated something. It is open source, has a built-in photo uploader for Flickr, and works with the majority of Firefox extensions (it's actually built on top of Mozilla), among other things.

I've tried Firefox in the past but just didn't see how it was any better than Maxthon, which basically wraps and enhances Internet Explorer in more ways than I could mention. Of course I'm still using Maxthon at work; it's just that Flock aggregates many of the sites I visit after hours anyway.

I've yet to try the built-in feed reader and I honestly have to say that I don't have any friends on Flickr or whatever apart from my Facebook dabbling (I'm what's known as a "Scott"..."'s Got No Friends"). However the Facebook integration is pretty good. And using Flock did convince me of the value of signing up for Delicious - which looks like a useful service.

Has anyone else had any experience of Flock, or any tips for using it?

Tags: flock, browser, social, web, facebook

CSS Layout Generator

I'm definitely CSS-challenged, so I was interested when I found the CSS Layout Generator, which allows you to enter how many columns, whether you want a header and/or footer, and colors for your page layout. It then provides the CSS and HTML, optionally validated for HTML or XHTML (link via Daniel Walzenbach, via Jason Haley).

Tags: web, layout, design, css

Scripteka.com and Prototype: Like a Cheese and Vegemite Sandwich

If you use Prototype, there's a very helpful, very new library of extensions at Scripteka.com (thanks to Ajaxian for the link).

Using Scripteka, you can browse extensions by tag, or view the latest or most popular extensions, all with links back to authors' sites and demos. The site itself also uses Prototype and has some nice examples of in-place refreshing.

If you develop web pages and don't use Prototype, check out Scripteka to see what you're missing out on. It's like adding a slice of cheese to your Vegemite sandwich...making a great thing even greater :-)

I like the fact that selecting a script from any link on the page finds and highlights it in the list. I also like the multi-select tag cloud that doubles as a simple search (all while staying on the same page).

Scripteka goes hand-in-hand with another useful site called Ajax Rain, which also collects scripts (including for other libraries like jQuery and Moo).

Tags: script, prototype, library, extension

Gripes: Outlook 2007 Interface Inconsistencies

I've been really enjoying Word and Excel 2007. They work as expected and I actually prefer the new "ribbon" to the old toolbars and menus. I even know where to find most of the functions :-)

However, the Outlook 2007 interface is a little "inconsistent" (the program itself is fine). First, a quick screenshot:

Outlook 2007 Interface Inconsistencies

Here are my five gripes on the Outlook 2007 interface:

  • Outlook should use the "ribbon" interface. I like the "ribbon". Word uses it. Excel uses it. Why can't Outlook?
  • The double-chevron above the To-Do bar expands the To-Do bar, and "pins" it. However, only the double-chevron is selectable which presents a very small target. A better way to do this would have been to remove the double-chevron and use a Visual Studio-esque "pin" icon to keep the To-Do bar open.
  • The scrollbar for the meeting request heading is not themed. The scrollbar for the meeting request content *is* themed. I have themes turned off (but Office 2007 still uses it's own visual style). This should be consistent. 
  • The meeting request buttons are not standard. They should be either a toolbar button or a normal button, but not a different style from every other button.
  • There's no mouse-over effects on column headers. I don't know if this is because I have visual styles turned off or not. It's just there's an orange mouse-over effect on just about everything else (except the blue for scrollbars, and silver for some other things) and I reckon column headers deserve a mouse-over effect.

Here's some of the things I *do* like about the new Outlook interface:

  • The entire To-Do bar on the right hand of the screen is clickable. A click expands it, and mousing away from it retracts it. This is good because the feature is easily discoverable, and repeatable with no side effects.
  • The To-Do bar is really helpful. Two thumbs up.
  • The Calendar has been improved, adding links to previous and next appointment when you're in "Day" view. This makes it easier to navigate your way around appointments.

Tags: outlook, user interface, office, ribbon