Posts

SSDT With Visual Studio 2012 and Using Custom Assemblies

Image
SQL Server Data Tools SSIS 2012 / SQL Server Data Tools (SSDT) offers considerable benefits over SSIS 2008 / Business Intelligence Development Studio (BIDS). The UX is much quicker, smoother, feature rich (undo and redo, woohoo!), and one of the best new features is that we can finally attach the debugger to script components - which has been a bit of an issue in the past . It's not exactly perfect (opening the VSTA environment seems to take a lot longer than it used to, breakpoints are unpredictable, and there are a few little issues surrounding package encryption that I keep running in to), but the improvements are more than welcome, and certainly enhance development. If you're familiar with SSIS, but you've avoided script tasks / components before, I have to say you're missing out; they're very powerful tools in the right hands, and basically allow you to do anything you can do in a .Net app within the context of a control flow or data flow in a package. Do...

TDD and Unit Testing with Moq

In my last post, I mentioned that I've been using TDD and mocking quite a bit this year, and I've fallen in love. It's something I'm very keen on continuing with, as I've now seen that the benefits outweigh the extra time needed to develop your tests. I've written my fair share of stand alone unit and integration tests throughout the years, but until recently I've not used object mocking or stubbing. I've never really appreciated what tests are, and what benefits they give me as a developer, other than they let me write a quick bit of throw-away code that enables me to test the functionality of a class or a method. Only now - 16 years in to my career - do I realise how critical unit tests are to an application, especially in enterprise level systems that have a lot of code reuse and crossover. Not only do well written tests test the functionality of your code base, they also allow you to modify anything with complete confidence that your changes aren...

2012: The Year The World Would End

Image
Despite my growing cynicism towards anything even remotely joyous and celebratory, 2012 has been the best year of my life so far. I married my wonderful wife; celebrated 30 years on the Earth; visited a number of historic landmarks and cities in the UK; spent August travelling through nine American states, sampling a vast array of cuisine and witnessing some amazing sights; and dug my teeth in to a lot of patterns and technology that's really interested me. I've also started on the path to clearing out all of the junk I've accumulated over the past 15 years, which has turned out to be an extremely liberating experience, even if it means I had to bite the bullet and chuck out a vast number of things that "I might use before I die". Fig 1. A shit tip I could prattle on about how awesome married life is, or regale you with my adventures across land and sea, but this isn't one of those god-awful social networking sites whe...

Windows 7: One Network Adapter, Two Connections; No Internet Connection

Image
For the past week, my main PC has been occasionally booting with a lovely little yellow exclamation mark over the network icon in the system tray. The only way to rectify it was to reboot once or twice, which confused me a little bit. Anyway, to cut a long story short, it's the Bonjour network service that was recently installed with Skype (I'm currently working at home and we're using Skype to communicate). It seems that the best way to solve this (without affecting Skype) is to "Delay Start" the service. The service (and it doesn't sound like this happens on everyone's machine) is pretty easy to find, only because it's got a GUID for a name in the Services snap-in (Start Menu -> Administrative Tools -> Services): GUIDs: scaring the shit out of advanced computer users since 1998. Suffice to say, it looks dodgy, so it was investigated. Luckily, there's plenty of info on Google about it. Just change the startup type to "Automati...

AutoMapper: UseValue vs ResolveUsing vs MapFrom

I just hit a confusing mapping bug whilst using AutoMapper  to map DateTime.Now to a field in my database. Every item that was being added to the database had the same value in the "DateAdded" - to the millisecond. This was because I was using the following mapping expression: Mapper.CreateMap<SourceObject, DestObject>() .ForMember(m => m.DateAdded, o => o.UseValue(DateTime.Now)); UseValue() retrieves a value on first-run and stores it in the mapping (hence the static DateTime value that's being stored in the database), whereas ResolveUsing() resolves at run-time - which is obviously why it's called Resolve Using(). A minor oversight, but confusing nonetheless. Use ResolveUsing(s => {}) when you want to resolve a destination field from a derived value. This should be used for any DateTime mappings, and any more complicated mapping functions. Use MapFrom(s => s.MemberName) when you return an actual source object member. Use UseValue() if you...

IMDB API Lookup JQuery Plugin

I spent a few hours last night writing my first ever JQuery plugin, only to realise today that it's completely useless to me! I wanted an easy way to populate the "Add medium" form on RustyShark , as it tends to take me a few hours every time I add a new review (and therefore medium) to the website (y'know, looking up information, finding images, finding box art, editing the review etc), and I wanted to increase my production rate :) IMDB offers its data for free, for non commercial use, but only in text files. I found an API at http://www.imdbapi.com/ , which has gone a long way to simplifying and serializing the information in to something useful, so I decided to use this opportunity to teach myself how to write JQuery plugins. Below is my resulting plugin, queryable by Title + Year, or IMDB ID: ; (function ($) { $.fn.imdbLookup = function (options) { // Default options var defaults = { complete: function (imdbData) { ...

RustyShark.com is finally online!

Regular readers will know that I've been working on my new game and film review site for a good while now. I've been spending my spare time in the past few weeks editing the reviews I've written and gathered from friends, which has been a task in itself. Unfortunately, because the site is a bit of a movie and game database as well as a review site, it takes me a while to gather all of the information for each one, so I've not been able to launch with too many published! Suffice to say, I've got a lot more to get through, but when I've caught up I should be able to edit and publish reviews as they come in. All of the reviews I've received will be dealt with ASAP! I've still got a long way to go until version 1 of the site is completely finished. I still have to write the news editing tools and there are lots of additional features I want to implement, like a Facebook login, more products from different sites and RSS feeds. Of course, I've still got ...