Friday, April 18, 2014

Randomizing Data

Ideally, development and testing data is reasonably robust to allow for realistic testing. Occasionally though, pulling in a copy of the production database is useful to hunt down specific cases. Personal information should be scrubbed from this though.

http://www.generatedata.com/ is a great tool for generating large amounts of random data. It's easy to install a local copy too. Data sets can be saved and re-used. Large amounts of seed data for testing can also be created.

To replace existing columns with random data, its fairly straight forward to create an SQL script to do this.



The general script runs as follows:

  1. Create a temp table to store our random data for the duration of the transaction
  2. Insert random data, generated from www.generatedata.com. This will need to be massaged a bit if going to MsSql.
  3. Update appropriate tables and fields using CROSS APPLY
  4. Woot! Data scrubbed!

Tuesday, April 15, 2014

String Manipulation with Humanize

Humanizer looks like a great string manipulation library for handling common readability tasks. This looks like it would remove a couple of my extension methods while adding a lot of extra functionality.

Tasks like hinting the number of items found and properly handling the singular case, ie 1 Item, 2 Items.