Developing on Staxmanade

NuGet Project Uncovered: Nancy

If you are coming to this series of posts for the first time you might check out my introductory post for a little context.

Nancy is another project founded by an elegant coder. Andreas has blogged about it a number of times here on ElegantCode.

Nancy is a lightweight HTTP framework for building web services and sites. The framework runs on both the .net framework and Mono.

I have not used this project myself, but as I started to look it over I think I might have to spin up a site quickly just to try it out.

NuGet Project Uncovered: Extended.Wpf.Toolkit

If you are coming to this series of posts for the first time you might check out my introductory post for a little context.

Extended.Wpf.Toolkit is a project that should not need an introduction, and if you follow this blog you’ve probably heard Brian talk about it. If not, check out some of the posts on the Extended WPF Toolkit!

This project is one of the most download on codeplex, discussed on Channel9, Coding4Fun, and is being leveraged by Telerik in their Open Access ORM product.

Below is a sample of some of the controls you can find in the toolkit:
(but make sure you check out the project site for the full list of controls)
  • BusyIndicator
  • Calculator
  • ChildWindow
  • ColorCanvas
  • ColorPicker
  • DateTimePicker
  • Magnifier
  • MultiLineTextEditor
  • PrimitiveTypeCollectionEditor
  • RichTextBox
  • SplitButton
  • WatermarkTextBox
  • Wizard

NuGet Project Uncovered: TranslatorService.Speech

If you are coming to this series of posts for the first time you might check out my introductory post for a little context.

TranslatorService.Speech is a small little wrapper around the Bing text to speech API. You will need to get a Bing api key to leverage this.

Below is a sample usage of the library.

SpeechSynthesizer speech = new SpeechSynthesizer(APP_ID);   


// To obtain a Bing Application ID, go to http://msdn.microsoft.com/en-us/library/ff512420.aspx  

string text = "Have a nice day!";
string language = "en";

using (Stream stream = speech.GetSpeakStream(text, language))
{
using (SoundPlayer player = new SoundPlayer(stream))
player.PlaySync();
}



I threw that into a quick test and was quite impress with how fast it worked.



Unfortunately I tried to translate a larger “paragraph” or so of text and saw.




System.Net.WebException : The remote server returned an error: (400) Bad Request.



at System.Net.HttpWebRequest.GetResponse()

at TranslatorService.Speech.SpeechSynthesizer.GetSpeakStream(String text, String language)


at NuGetTestProject.Sample.SampleTest() in Class1.cs: line 14




I didn’t take the time to diagnose why, whether it’s a Bing problem or this library.



Some other observations:




  • + It supports some Async methods as well


  • - The Async methods don’t support the standard APM so I couldn’t easily wrap a task around. (I know there are some ways to make it work, but it’s not out of the box easy…)

NuGet Project Uncovered: JsValidator

If you are coming to this series of posts for the first time you might check out my introductory post for a little context.

JsValidator, on first glance, is a down right awesome gem of a NuGet. I’ve heard of Google’s Closure Compiler before, but have never used it. This NuGet makes it a snap to use inside Visual Studio.

When you first install the package:

Install-Package JsValidator;

This NuGet tool automatically updates your project so it will execute the tool on compilation. Awesome if you are not an MSBuild expert as it just configures itself for you straight from the package install.

Once installed, run a build on your solution. On first build you get an error. You’re probably thinking '”How can this tool be erroring, we just added it to the project”. This error is a good thing. It’s telling you that you now have a manual step to configure it correctly.

Go check out the codeplex site as it will explain more on how to use it.

I just might consider this on my next new javascript project in Visual Studio.net.

NuGet Project Uncovered: FastMember

If you are coming to this series of posts for the first time you might check out my introductory post for a little context.

FastMember would be something you pull in if you’re trying to do reflection to read properties of your objects, but starting to notice some performance issues. This project will emit some IL at runtime that can read your properties much faster than good old reflection (like below)

var value = typeof(MyObject).GetProperty(“MyProp”).GetValue(myObjInstance, new object[0]);

Replace the above with.

var accessor = TypeAccessor.Create(typeof(MyObject)); 
var value = accessor[obj, “MyProp”];



This project lets you either read or assign values to properties. (See my test below)



image_thumb1_thumb

NuGet Project Uncovered: FakeO

If you are coming to this series of posts for the first time you might check out my introductory post for a little context.

FakeO is a fake object generation library. It doesn’t seem to play nicely with objects that require parameters in the constructor. However if you have lots of classes that have a default constructor and plain old get/set properties this project might be very useful.

You can even specify not just random text or numbers to generate, but some specific context driven data.

For example:

  • Random company name
  • Lorem Ipsum to various lengths.
  • Phone numbers
  • Random strings based on a regex.
  • etc…
// example FakeO call
var comp = FakeO.Create.Fake<Company>(
c => c.Name = FakeO.Company.Name(),
c => c.Phone = FakeO.Phone.Number(),
c => c.EmployeeCount = FakeO.Number.Next(100,200)); // random number from 100 to 200

NuGet Project Uncovered: NaturalSpec

If you are coming to this series of posts for the first time you might check out my introductory post for a little context.

NaturalSpec is a BDD framework written in F#. This one is interesting due to F#’s concise nature and can give you very readable tests/specs.

The below sample was pulled from the github readme.

[<Scenario>]
let ``When removing an element from a list it should not contain the element``() =
Given [1;2;3;4;5] // "Arrange" test context
|> When removing 3 // "Act"
|> It shouldn't contain 3 // "Assert"
|> It should contain 4 // another assertion
|> It should have (length 4) // Assertion for length
|> It shouldn't have duplicates // Tests if the context contains duplicates
|> Verify // Verify scenario



It says you don’t have to learn F# to use it. Which I’d argue you may not have to learn F# as deep as you might to be able to code a production product in it, but you will definitely benefit from learning some as you go. You will also spend a bit of time learning the DSL that this project has created.



Regardless, this project has enough interest factor for me to play around with someday.

NuGet Project Uncovered: SpecsFor

If you are coming to this series of posts for the first time you might check out my introductory post for a little context.

SpecsFor is a BDD framework. This project is nice in that it has packaged many of my favorite testing tools all into one package. Instead of pulling down NUnit, Moq, Should, Automocking, and ExpectedObjects creating your own base fixture class. This project wraps all that up for you with a solid base spec class.

The creator of this project spent some time and created a nice project site with examples and documentation.

NuGet Project Uncovered: Nukito

If you are coming to this series of posts for the first time you might check out my introductory post for a little context.

Nukito is a project that’s taking AutoMocking to another level and baking it into the tooling/framework. If you use xUnit and Moq and want to avoid much of your redundant mock setup/verify code. You might want to take a look at this project.

I didn’t dig very deep into this project, but it smells somewhat like AutoFixture which I believe has more support for other frameworks and is a bit more popular. (Again I didn’t dig deep enough to understand the core differences).