Setup sublime text 2 to work with SML

While trying out SML, I chose sublime text 2 as editor for it. There is no default syntax support for SML so l found one…

https://github.com/seanjames777/SML-Language-Definition has SML language definitions for sublime.

You need to make a small update to sublime to find the path to sml: Preferences > Package Settings > Package Control > Settings – User:

"default_extend_env": {
"PATH": "/usr/local/smlnj-110.75/bin/"
}

Command B on Mac will run the SML build. Make sure your sml files have .sml extensions.

Enjoy!

Wire ASP.NET 4 WEB API RTM with Autofac

It took me a little while to get this working but here is how I got Autofac working with the new ASP.NET MVC 4 Web API.

Call this setup method in Application Start event in global asax.

private static void SetupAutofac()
{
var builder = new ContainerBuilder();
builder.RegisterModule(new MessagingModule());
builder.RegisterControllers(Assembly.GetExecutingAssembly()).PropertiesAutowired();
builder.RegisterApiControllers(Assembly.GetExecutingAssembly()).PropertiesAutowired();
var container = builder.Build();
GlobalConfiguration.Configuration.DependencyResolver = new AutofacWebApiDependencyResolver(container);
DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
}

This sets up all API and regular controllers while injecting all the properties in them. The module (MessaagingModule) sets up the Autofac container.