Mongoose with TypeScript

Mongoose is a library for node.js that wraps the mongoDB driver. Since I’ve been playing with typescript, I wanted to show a short demo of strongly typing mongoose with unit tests run in nodeunit all using typescript.


First, I have a collection of definition files that represent mongoose types, nodeunit types, and my own document types (in schemaDef.d.ts).… Read the rest

When to abort a thread

When is it OK to abort a thread is a question that comes up every so often. Usually everyone jumps on the bandwagon that you should never ever do a thread abort, but I don’t agree. Certainly there are times when it’s valid and if you understand what you are doing then it’s ok to use.… Read the rest

Fixing “Calling LoadLibraryEx on ISAPI filter v4.0.30319 aspnet_filter.dll failed”

I ran into this adding a new site to my 64 bit machine, and because I haven’t had my morning coffee, I forgot to set “enable 32 bit applications” in the app pool.

If your code is built for 32 bit only (maybe you use mixed mode dll’s somewhere or call into native and can’t be 64 bit for whatever reason), make sure the app pool of your application is set to 32 bit mode.… Read the rest

Add scheduled task and run even if on battery power

Just wanted to share a little helpful snippet in case anyone needs it. To add a scheduled task and make sure it starts even when on battery power do this:

TaskService is part of Microsoft.Win32.TaskScheduler.

By default when you create a new task DisallowStartIfOnBatteries and StartIfGoingOnBatteries are true, so that’s something to keep in mind if you are writing code that can be deployed on a laptop and you must have your scheduled task continue to run.… Read the rest