ManagementSpeak: Work space will be designed to create an environment that promotes teamwork and effectiveness, while improving space utilization. Translation: We’re going to cram twice as many employees into the same floor space.
"The underpromise, overdeliver principle tells us that we should manage our customer's expectations in such a way that we are able to deliver more than the customer asked for."
"There are so many development organizations where specs are a monument to mindless bureaucratic paperwork that entire movements sprung up organized around the idea of not writing specs. These people are misguided. Writing a functional specification is at the very heart of agile development, because it lets you iterate rapidly over many possible designs before you write code."
"Measuring employees is a bad idea because employees have a remarkable talent for gaming the system. They can: Work the system so the numbers look good; behave in ways that make the numbers look good while circumstances deteriorate; or just falsify the data outright. I pointed this out once in an executive meeting, and one of the participants recommended firing any employee who would behave this way. Interesting concept, as I was referring to a very large number of American CEOs."
Software
Avidemux is a free video editor designed for simple cutting, filtering and encoding tasks.
Summary: Transact-SQL function that converts a string of comma-separated numbers to a table of integers.
Here is a common SQL programming scenario. Your code receives a string holding comma-separated values (CSVs), such as IDs of records stored in a table (say "98,256,17,34"). Now it needs to retrieve these records from the database. How do you do this?
[Note: For the sake of simplicity, I use a comma-separated value (CSV) holding numbers, but the string can contain other values, such as dates, or other strings, which can be separated by semicolons or other delimeters.]
Option #1. Use EXEC (not recommended).
The obvious option would be to generate a dynamic SQL query and execute it via an EXEC statement. For example, you can do the following:
USE AdventureWorks
DECLARE @ProductIDs varchar(256)
DECLARE @Query varchar(256)
SELECT @ProductIDs = '1,350,400,440'
SELECT @Query =
'select
ProductID,
[Name],
ProductNumber
FROM
Production.Product
WHERE
ProductID in (' + @ProductIDs + ')'
exec(@Query)
There are two major problems with this approach. First, generating the query -- in this example it's a SELECT query, but it can be any query -- as a string will degrade readability: you will lose syntax highlighting and IntelliSense (if you're using a new SQL Server 2008 IntelliSense feature or some other third-party tool, such as SQL Prompt). Second, and even more important, this approach is prone to SQL injectionattack. Even if you use a command parameter to pass a comma-separated value (CSV) to the stored procedure, since you're simply appending it to dynamic SQL, you must make sure that it does not contain suspicious characters. Whether you do it in T-SQL code or in the application code (C#, or whatever), it's a hassle.
Option #2. Convert string of values to a table of values (recommended).
A better alternative would be to convert the CSV to a table of numbers (again, I use numbers in this example, but the values can be of any type). You can accomplish this with the help of a user-defined function (UDF), such as this one:
CREATE FUNCTION [dbo].[ConvertCsvToNumbers]
(
@String AS VARCHAR(8000)
)
RETURNS
@Numbers TABLE (Number INT)
AS
BEGIN
SELECT @String =
LTRIM(
RTRIM(
REPLACE(
ISNULL(@String, ''), ' ' /* tab */, ' ')))
IF (LEN(@String) = 0)
RETURN
DECLARE @StartIdx INT
DECLARE @NextIdx INT
DECLARE @TokenLength INT
DECLARE @Token VARCHAR(16)
SELECT @StartIdx = 0
SELECT @NextIdx = 1
WHILE @NextIdx > 0
BEGIN
SELECT @NextIdx = CHARINDEX(',', @String, @StartIdx + 1)
SELECT @TokenLength =
CASE WHEN @NextIdx > 0 THEN @NextIdx
ELSE LEN(@String) + 1
END - @StartIdx - 1
SELECT @Token =
LTRIM(
RTRIM(
SUBSTRING(@String, @StartIdx + 1, @TokenLength)))
IF LEN(@Token) > 0
INSERT
@Numbers(Number)
VALUES
(CAST(@Token AS INT))
SELECT @StartIdx = @NextIdx
END
RETURN
END
Now you can reference this UDF in a query, such as:
SELECT
ProductID,
[Name],
ProductNumber
FROM
Production.Product prod,
dbo.ConvertCsvToNumbers(@ProductIDs) numbers
WHERE
prod.ProductID = numbers.Number
In addition to improving readability and security, this method lets you treat data contained in the CSV as a regular table. If you want to try this approach, you can download the script generating the UDF, which is more robust than the listing above (the script sets the permissions and contains code for repeated compilation):
Summary: My favorite presentations from the MIX09 conference.
If you are interested in design and web technologies, but did not have a chance to attend MIX09 (the annual Microsoft conference focusing on design and web technologies), here are some of the free online presentations that I would recommend.
Best talks
If you do not have much time, just watch just these two presentations (they both focus on design):
Web Form Design (74:36) by Luke Wrobleski, Senior Director of Product Design, Yahoo! This session focuses on the most common design mistakes and introduces 10 best practices for web form design. The presentation covers such topics as form organization, alignment rules, input validation, using help and tips, progress indicators, error reporting, and more.
Ten Ways to Ensure RIA Failure (39:34) by Anthony Franco, President, EffectiveUI Great (and short) talk focusing on what NOT to do in web design and development. My favorite points include:
"If you're looking to fail, trust developers to make good design decisions."
As well as:
"If you're looking to fail, value the process over the product."
The following presentations mostly focus on design, development, deployment, and security:
Design
Interactive Prototyping with DHTML (75:11) by Bill Scott, Director UI Engineering, Netflix Bill is a co-author of Designing Web Interfaces, an excellent book for web designers and developers. This talk offers many tips and recommendations on prototyping techniques and related topics, such as CSS frameworks. Great references also.
Design Prototyping: Bringing Wireframes to Life (59:49) by Dan Harrelson, Senior Technologist, Adaptive Path Dan Harrelson explains how to build great prototypes. After watching this presentation, I learned that I could easily created interactive (animated) prototypes in PowerPoint (did you know that?). (Bonus: Dan also published a list of prototyping tools.)
Choosing between ASP.NET Web Forms and MVC (65:34) by Rachel Appel, Wintellect This presentation illustrates the differences between two ASP.NET frameworks: Web Forms and MVC (you can skip the first part -- intro and history -- if you're familiar with classic ASP and Web Forms).
Securing Web Applications (75:30) by Eric Lawrence, Security Program Manager (Internet Explorer), Microsoft This talk is more about IE 8 features, but it still raises a few interesting points about web application security.
Summary: How to manage documents, photos, music, passwords, e-mails, contacts, personal information, and other files and data.
Can you relate to the following scenarios?
Scenario #1: You bought a new computer and now you need to migrate your bookmarks, e-mail messages, music, and other important files from your old PC to the new system.
Scenario #2: You are using several computer (like work PC and home PC) and would like to keep some files in sync between them.
Scenario #4: You backed up your photos to CDs, but you have so many of then that you cannot find your favorite photo of your cat.
Scenario #5: You're losing track of your Internet passwords, usernames, etc.
I can go on, but the point I'm trying to make is: managing personal information (files and data) on multiple computers and avoiding data loss from a hardware crash is not trivial. In this article, I'll explain how (with minimum effort) you can keep your data safe, up-to-date, and accessible. My recommendations are intended for PC users, but some of them can be applicable to Mac and Linux fans, too.
Before I get to the recommendations, let me emphasize the following: your personal computer -- whether it's running Windows, Mac OS, or Linux -- is not reliable: its hard drive can fail, the operating system can get corrupted (e.g. via a virus), it can get stolen. To avoid data loss with the loss of your computer (or its parts), you must keep copies of your data somewhere else.
A traditional approach is to back up files to an external drive. Although, it's a praiseworthy strategy, it has several limitations. First, it requires additional hardware. Second, it does not address the issue of accessibility (not a big deal, if you have only one computer, but can be a problem if you want to keep some data in sync between several machines). Third, have you actually tried to recover data from your backup? If you haven't, you may be up to an unpleasant surprise. Finally, most people don't perform regular backups because they consider them a hassle.
Whether you regularly back up your hard drive(s) or not, consider an alternative (or complementing) approach: keep important data online using what techies call cloud computing. Here is how you can use cloud computing services from reputable providers and software to keep your data safe, manageable, and accessible.
Internet bookmarks/favorites
First a suggestion: do not add every interesting page you find on the Internet to your browser's bookmarks/favorites; only bookmark the sites which you visit regularly (daily, weekly); for everything else use a social bookmarking service such as Delicious (or any of the alternatives). If you're not familiar with social bookmarking, watch this short (3:25 min) video:
For regular bookmarks/favorites, use the Xmarks browser add-on(s), which will keep your bookmarks (and optionally passwords and cookies) in sync between different machines and browsers.
E-mail/calendar/contacts
For e-mail needs, I have two words: use Gmail. Why? First, Gmail is the only service that lets you forward your e-mail to any other address for free. You can forward your messages to your work e-mail, your ISP's account, or anywhere else. This way, you will not lose any messages if you switch jobs or ISPs. Second, Gmail's generous storage capacity (currently, over 7 GB) lets you archive important messages without the risk of running out of space. Third, if you do not like the web-based interface, you can use Gmail with most mail clients (also see these), such as Microsoft Outlook, Outlook Express, and Mozilla Thunderbird.
Tip: If you are using a desktop e-mail client and keep the incoming e-mail in local/personal folders (.PST files in Outlook), you need to back these up.
Google offers tools to automatically sync your Google calendar with Microsoft Outlook and mobile devices (BlackBerry, iPhone), but to sync Google contacts (with Outlook), either transfer them manually or get a commercial tool, such as kiGoo (Google released the Contacts Data API about a year ago, but I still cannot find a good and free contact syncing tool).
Passwords
For storing passwords (and other sensitive information, such as user IDs, bank accounts, etc), I can recommend any one of these two options. Option 1: Use the free web-based password manager LastPass (other alternatives include Clipperz and Passpack, but LastPass seems to be the most capable). LastPass can protect your browser passwords better than the browser. It can also auto-populate login forms. When using LastPass along with Foxmarks, you may need to disable the Foxmarks' password synchronization feature. Option 2: Use the free KeePass application and synchronize the KeePass' data file across multiple computers with the help of DropBox or Sincplicity mentioned below.
Photos
You can use online photo storage to back up your photos and to share them with friends and family. Many sites, including MySpace and Facebook support photo sharing, but most of them are too restrictive: they resize photos, limit the number of photos you can upload, and so on. Among the sites I tried, Flickr (now owned by Yahoo!) seems to be the most feature rich: it supports multiple sizes of photos (including original size), photo downloads, slide shows, videos, and more. A free Flickr account imposes a few limitations, but it's still better than most alternatives. After trying a Pro account, I decided to keep it for $24.95/year ($2/month is not that much for unlimited photo uploads and storage). Google's own Picasa Web Albums is another online photo storage alternative similar to Flickr (as Flickr, it also offers a free as well as a fee-based plan).
Music
Most sites that let you upload and listen to music, such as Deezer and Imeem, do not allow downloading MP3 files (including the ones you uploaded). There are two exceptions: mp3Tunes and tunesBag (currently in beta). Mp3Tunes gives you 2 GB of online storage for music and video files; tunesBag offers at least 5 GB. I have been using tunesBag for a few months and so far I have few reasons to complain: it lets me back up my music and listen to it from anywhere. I was a bit disappointed with the mp3Tunes' and tunesBag's upload tools intended to automatically keep the local and online audio libraries in sync: neither of them worked for me (well, they worked, but both had bugs that made them useless). Nevertheless, these two sites are worth considering if you are looking for an online storage option for your music files that also allow playback and other listening and sharing features.
UPDATE: I take back my comment about tunesBag's uploader. It works fine, BUT it does not sync files automatically; you need to run the tool manually to upload the files.
UPDATE: For storing and playing music online, you can try Amazon Cloud Dive (5 GB free; allows you to store any files including audio; you can listen to your music from any web-connected computer with Amazon Cloud Player; works with portable devices) or Google Music (20,000 songs max; can listen online or portable devices). Also see other options (and more).
Software keys
Use Keyfiler to store your software license and registration info (serial keys, activation keys, etc).
Documents
For Microsoft Office users, Office Live Workspace allows storing and sharing documents (Word documents, PowerPoint presentations, Excel spreadsheets, etc) online. If you do not use Microsoft Office, you can try switching completely to a web-based office suite, such as Google Docs, Zoho, or ThinkFree. If you prefer a free desktop alternative to Microsoft Office, such as SoftMaker Office or OpenOffice.org, you can back up your documents and synchronize them across multiple computers with the help of file synchronization and backup tools.
Sync tools
File synchronization tools allow you to duplicate files across multiple computers. Manual file synchronization tools, such as Microsoft SyncToy that must be launched by the user, are okay for occasional use, but they are not well suited for continuous synchronization. Out of automatic file synchronization services I tried, I liked DropBox and Syncplicity most. Both services offer 2 GB of free online storage and they just work: they work on my home laptop as well as my work PC, they work over firewalls and corporate proxy servers, they work on Windows and Mac OS. The only limitations I can think of include relatively high memory footprint (the running process takes about 50 MB of RAM for DropBox and 70 MB for Symplicity). Also DropBox can synchronize only one root folder (which can contain multiple subfolders), while Syncplicity can synchronizes Desktop, Documents, Favorites, Music, and Pictures. I highly recommend DropBox and Symplicity to anyone who wants to synchronize files across multiple machines. There are other file synchronization services, such as Microsoft Live Mesh (currently in beta), Windows Live FolderShare (currently transforming into Windows Live Sync), but I did not have much luck with these (for one, Mesh and Live Sync do not seem to work across corporate firewalls (also here), and I could not use FolderShare, because our corporate proxy server settings block access to the site); however, they work for some some users, so depending on your settings, they may work for you. [Update: See list of cloud hosting services at Cloud Drive Price Comparison: Amazon, Apple, Google, Box, Dropbox, Skydrive and SugarSync or Compare SkyDrive, Google Drive and Dropbox.]
Backup tools
You can (and should) use scheduled backup to save important files online with the help of such services as:
Online storage
Finally, for occasions when you just want to save a files or two online once in a while, you can use the following online file storage services:
Initially, it may take you a bit of effort to follow these recommendations, but once you adopt them, you will make your digital life easier and data safer.
Summary: Some interesting stuff from Jurgen Appelo.
Jurgen Apello just published a new quarterly list of the Top 100 Blogs for Developers. I'm glad that Jurgen's own blog made the list because it's gooood. Here are some quotes from a few recent articles:
"I want to suggest the acronym AINO (Agile In Name Only) for those cases where there is a significant gap between preaching and practising the agile approach."
"I believe it is time for a new manifesto. A manifesto of complexity. With this manifesto we must recognize that it is human to prefer simple solutions, but also that the world is more complex than we think."
"Agility is about staying successful in ever-changing environments. That's it. There's nothing more to it. This includes defying any expert who claims that practice X is essential for your organization. Because, quite likely, practice X happens to be something this expert is very good at, and is willing to assist you with, for a considerable consultancy fee."
While we're on the topic of Agile development, here is a very good and brief interview with Jurgen Appelo, where he discuss his experiences of introducing and using Scrum and the curse of dogmatic use of "recipes for success" in software development:
Summary: Analogy screensaver is a thing of beauty.
Today, my small token of appreciation goes to Analogy screensaver written by Jesson Yip (you can see Analogy in action on Jesson's web site).
Quoting the author:
"Analogy is a typographic clock which fuses the immediacy of digital with the visual-spatial quality of analogue into a hybrid format. It presents an everyday object with a fresh twist."
Normally, I would not consider a third-party screen saver a necessity, but being a sucker for minimalism and elegance, I just can't keep my eyes off it. Great job Jesson. You deserve a drink. ;-)
I'm not a fan of VBScript, but I have been using it extensively for writing utility scripts. In this post, I want to share one technique that I found helpful when working with VBScript files.
The scripts I write share many functions, such as processing command-line parameters, connecting to SQL Server, and so on. To make my life easier, I combined these common functions in a reusable helper file. I called this helper file Common.vbs. Here are some of the most helpful functions implemented in Common.vbs:
GetParamValue: Returns the value of the specified parameter for a given command-line switch; command-line switches are case insensitive and support name variations, such as "h|help|?" (i.e. /h, /help, and /? are considered identical).
GetParamValues: Returns an array of values for the specified command-line parameter (command-line switches use the format {/|-}switch[:Value1[,Value2[...]]], such as /in:c:\data1.txt,c:\data2.txt).
GetFile: Prompts user to select a file using the standard File Open dialog box.
GetSecretValue: Prompts user to enter a password (or any other sensitive value) and masks the entered characters.
RevertToCscript: Forces script to be run by the CSCRIPT engine (instead of WSCRIPT).
SqlConnect: Opens connection to SQL Server via OLE DB provider (supports Windows authentication).
ExcelConnect: Opens an ADO database connection to an Excel file.
GetComError: Generates formatted error message retrieved from the Err object.
GetExcelWorksheetName: Returns the name of the first worksheet in the Excel file.
You can find the detailed description of these and other methods in the file comments. Use the following link to get the Common.vbs file:
To reference the Common.vbs file from another script, implement your script as a Windows Script File (.wsf). Unlike regular VBScript (.vbs) files, .wsf files can reference other VBScript files (you must specify the location of the referenced file using either an absolute or relative path).
To implement a script as a .WSF file, just wrap you VBScript code in XML elements and add a <script> element referencing the Common.vbs file, such as: