Random Data Generator
Posted by Seth on December 1st, 2006Just stumbled across an interesting .NET library for randomly generating data. Useful for building large datasets for load testing. Check it out at http://www.codeplex.com/datagenerator.
Just stumbled across an interesting .NET library for randomly generating data. Useful for building large datasets for load testing. Check it out at http://www.codeplex.com/datagenerator.
I recently wanted to have a method I could call to get a type-safe AppSetting, with an optional default value if the AppSetting wasn’t set. In C# 2.0, I came up with this:
public static T GetSetting<T>(string name, T defaultValue)
{
string input = ConfigurationManager.AppSettings[name];
if (input != null)
{
return (T)Convert.ChangeType(input, typeof(T));
}
else
{
return defaultValue;
}
}
Mark came up with an idea to use Enums to drive lookups. I told him I could go one better by providing user-friendly names instead of programmer-friendly enum value names. The idea is to loop through the literal fields of the enum type and check for a DescriptionAttribute on each field. Anyway, here’s the source, with caching for top performance.
Apress have released a free downloadable PDF eBook on REST Web Services: Google, Amazon, and Beyond: Creating and Consuming Web Services. Its an interesting read if you’re into RESTful Web Services. The only downside (for me atleast) is that the book has a very heavy Java bend. Would have been nice to see a bit more of a balanced view.
Scott Guthrie writes about some cool new IIS7 features and APIs:
#5 especially is great. Finally, we can build some rich programs to administer IIS and web applications without having to resort to ADSI or WMI..yuck!).
#1 will also be interesting in relation to url rewriting. This would mean that you wouldn’t have to use wildcard mapping to send every request to ASP.NET.
A few new features added to the open source url rewriter, including:
Download UrlRewriter.NET 1.6 here.
No, I’m not going to proffer any sage advice because I’m still banging away trying to do this myself, but Dirk Knemeyer at Digital Web has a great article with some insights for budding tech entrepreneurs, including “Five Steps Before Making the Leap”:
Sound advice for any business, really, not specifically a Web 2.0 startup.
I installed Subversion tonight. Took about five minutes and I was up and running with all the latest and greatest. I used the Subversion 1-Click Setup at Tigris. It installs Subversion as a service, TortoiseSVN and all the command-line utilities.
The Subversion Book is surprising well written for open-source documentation and provides a good Subversion for CVS Users guide.
Another great resource is James Higg’s blog. Drop by his blog if you need some pointers to more information.
I’ve decided to release the UrlRewriter.NET product for free now, and make it open source. Hopefully with it being free and open source, it will receive the coverage it deserves.
The TestDriven.NET tool is fantastic. I love the agility it gives you, as you can quickly build your unit tests, write your code and at a right-click, you can run your unit tests from Visual Studio.
One of the problems it currently has (I notice somebody has asked for this in their wishlist) is custom configuration. If the code you’re testing requires settings that would normally be in your web.config or App.config file, you have to ensure these settings are in a file called <your-assembly-name>.dll.config in your bin\Debug directory. A bit inconvenient. NUnit allows you to have a .config file in the root of your project with the same name as your project (e.g., Foo.Bar.config), so why should you do without this feature in Visual Studio?
Well, until the author adds this enhancement (hopefully soon), one workaround I’ve come across for this is to create a Post-Build event in Visual Studio.NET, which copies the config file from the root of your project to the required place in your bin directory.
To set this up, right-click Properties on your Project in Visual Studio.NET. Under Common Properties, click on Build Events. In the Post-build Event Command Line property, add the following: copy $(ProjectDir)$(ProjectName).config $(TargetPath).config
Then, whenever you have a successful build, your latest config changes will be available to TestDriven.NET’s in-built TestRunner.