Sam Stephens: Free-spirited Software
Learnings, ponderings, and questions from my life as a software developer
Browse: Home / SamStephens

SamStephens

SamStephens

Experienced business systems developer, passionate about OO patterns, tidy modular code, and understanding the various tensions and contradictions that are involved in navigating life as a business developer, and delivering superior quality results.

Currently developing in C#, Java and Ruby, building ASP.NET, Android, and Rails applications.

I’m a senior internet banking developer for a bank.

Contact me.

Scripting WordPress upgrades

By SamStephens on December 3, 2012

Wordpress has been nagging at me to upgrade for a little while, and I finally got around to it. I’m getting more comfortable with shell scripting, and thought that I should script this upgrade process.

I put the script together basically mirroring the manual upgrade instructions given on the Wordpress website. I’ll show you the script, and then walk you through it.

Posted in Shell scripting, Wordpress | Tagged MySQL, Shell Scripting, Wordpress | Leave a response

Mocking ASP.NET providers

By SamStephens on May 13, 2012

When playing around with ASP.NET membership, I found myself in a situation where I wanted to mock the ASP.NET Providers. This is something the design of providers makes non-trivial. Mark Seemann summarises: “Since a Provider creates instances of interfaces based on XML configuration and Activator.CreateInstance, there’s no way to inject a dynamic mock.”. See Provider is not a pattern.

Posted in .NET | Tagged .NET, ASP.NET, ASP.NET Providers, C#, Mocking, Testing | Leave a response

Mass-assignment – don’t control access at the model level

By SamStephens on March 8, 2012

I followed with some interest the debate around the “mass assignment vulnerability” recently reported in Rails. I dislike the way the whole debate is couched assuming access control at the model level. When you are stating that an attribute cannot be assigned, you are stating that to assign this attribute from the controller, you can’t use the normal update_attributes method, and must update it explicitly.

Posted in Rails | Tagged Opinion, rails, ViewModel | Leave a response

WordPress.com don’t get the Principle of least privilege

By SamStephens on February 11, 2012

Wordpress.com wanted to be able to read, update and post to my Twitter account in order for me to authenticate as a commenter.

Posted in Opinion | Tagged Authentication, Identity, Privacy | Leave a response

Generating multiple files from one T4 template

By SamStephens on January 28, 2012

I extend my previous T4 work to be able to “Duck Type” using a number of interfaces, generating a file per interface.

Posted in .NET | Tagged C#, Code Generation, Entity Framework, T4 | 1 Response

Duck typing Entity Framework classes using T4 Templates

By SamStephens on November 23, 2011

Duck typing is an interesting concept, and alien to C# generally. But using the techniques of my previous post about T4 and Entity Framework, it is possible to have your entities implement interfaces if they have the required properties, resulting in behaviour similar to duck typing. Please read the previous blog post before reading this one.

Posted in .NET | Tagged C#, Code Generation, Duck Typing, Entity Framework, T4 | 1 Response

Using T4 Templates to extend your Entity Framework classes

By SamStephens on November 5, 2011

All my entities for a current project have a UserName column. I used T4 templating to generate a common interface and an implementation for each entity class.

Posted in .NET | Tagged C#, Code Generation, Entity Framework, T4 | Leave a response

Automatically username stamping entities as they’re saved

By SamStephens on October 25, 2011

The application I am currently working on has a requirement to audit which application user last created or updated database records. I used the ObjectContext event SavingChanges to keep this concern out of my application code.

Posted in C# | Tagged .NET, C#, Entity Framework | 2 Responses

Deploying database contents using Capistrano

By SamStephens on May 24, 2011

I run a pair of Ruby on Rails sites, http://janeallnatt.co.nz and http://postmoderncore.com. I use Capistrano to deploy updates to both of these sites. Once I built these sites and got Capistrano working, I realised that the database should be deployed as part of the Capistrano deploy.

Posted in Rails | Tagged Capristrano, Database, Deploy, rails, ruby | 2 Responses

Extensible processing classes using reflection

By SamStephens on February 14, 2011

I recently wanted to build an extensible set of processing classes. Each class can process certain objects it is provided.

I decided the simplest way to do this was to create an processor interface. The set of processing classes then is all classes that implement this interface. I use reflection to then find all the processors: that is, all implementations of the processor interface.

Posted in C# | Tagged .NET, C#, Reflection | Leave a response

Next »
Subscribe

Search

Categories

  • .NET
  • Android
  • C#
  • Javascript
  • Meta
  • MSBuild
  • Opinion
  • Ruby
    • Rails
  • Shell scripting
  • Wordpress

Archives

  • December 2012
  • May 2012
  • March 2012
  • February 2012
  • January 2012
  • November 2011
  • October 2011
  • May 2011
  • February 2011
  • January 2011
  • December 2010
  • November 2010
  • October 2010

Websites

  • A List Apart
  • The Daily WTF
  • Ars Technica

My other sites

  • On Twitter
  • On LinkedIn
  • On Stack Overflow

Blogroll

  • charlie.collins's blog
  • The Radioactive Yak
  • Android Developers Blog
  • Scott Hanselman's Computer Zen
  • ScottGu's Blog
  • Mark's Blog
  • Dare Obasanjo aka Carnage4Life
  • Ayende @ Rahien
  • The WHATWG Blog
  • Fabulous Adventures In Coding
  • Ajaxian
  • Tatham Oddie
  • Marcin On ASP.NET
  • Object Mentor Blog: Category Uncle Bob's Blatherings
  • Schneier on Security
  • CommonsWare

Copyright © 2013 Sam Stephens: Free-spirited Software.

Powered by WordPress and Hybrid.

The opinions expressed on this site are my own and do not necessarily represent those of my employer. Contact me.