Blogs

roger's picture

Resetting PowerShell console colour after running badly-behaved programs

Some programs write their output in different colours. If they're badly-behaved and don't reset the colours when they've finished, your PowerShell console might be left with the wrong background or foreground colours.

This is particularly problematic, because you can't use $HOST.UI.RawUI.BackgroundColor with anything other than the built-in PowerShell colours (which don't match the background used by the default PowerShell shortcut).

roger's picture

Installing node.js, iisnode and npm on Windows

I thought I might have a quick play with node.js on Windows. There's a bunch of conflicting information out there about how to install it. Here's what works for me.

roger's picture

New Theme

New theme: Acquia Slate. It's maybe a little dark for my taste, but I'm going to leave it for a couple of weeks and see if it grows on me.

Updated: It didn't. For one thing, the background colour is all wrong in the edit preview page. I've gone to Acquia Marina instead.

roger's picture

PowerShell: ImportSystemModules

I've been using PowerShell as a better Command Prompt for a while now. Increasingly, however, it's one of the first tools I reach for when I come across a problem, rather than being an afterthought.

I've been tweaking my profile to pre-load a bunch of modules. I've got the PowerShell Community Extensions; I've got PsGet; I've got Posh-Hg.

roger's picture

FTTC FTW

I've not posted this until today, because my blog's been poorly, but the BT engineer came round last week and upgraded me to FTTC.

I'm now getting about 38Mbps downstream and about 8Mbps upstream.

I'm sticking with Andrews & Arnold, rather than changing to BT Infinity, which slightly confused the BT OpenReach engineer.

roger's picture

Did you know that .NET already had an IoC container?

Talking to @ptrelford at the TDD & Refactoring workshop run by Jason Gorman, Phil mentioned that he'd implemented a really simple IoC container in F#. "But there's a really simple one already built into .NET" says I...

In System.ComponentModel.Design, you can find the IServiceContainer and IServiceProvider interfaces along with the ServiceContainer implementation. It's really easy to use:

roger's picture

Finding it difficult to export content from Drupal

This is some background to my Finding it difficult to export content from #drupal. tweet.

I've been using drupal for about a million years, and generally like it. However, it doesn't really have first-class support for embedded images, and I always run into difficulty when upgrading it.

roger's picture

Repairing image links in drupal

Somehow -- I'm not sure how, and I'm not exactly sure when -- my website (powered by drupal) lost all of its images. They were still there in the filesystem, and the rows were still in the node table, but they'd vanished from the actual pages.

Further investigation revealed that the image and files tables had mostly forgotten about those images. So, how to quickly fix this all up?

roger's picture

Converting IEnumerable<T> to IDataReader

If you’ve got an enumerable, and you want to pass it to SqlBulkCopy, you can turn it into an IDataReader. Something like the following might be useful:

roger's picture

Reactive Extensions: Elapsed Time

I’m using SqlBulkCopy to insert a large number of rows into a database table. I used Observable.FromEvent to hook the SqlRowsCopied event. Rx provides the .TimeStamp() method, but I wanted to know the elapsed time, so I did the following:

Syndicate content