Using Mercurial with a SVN repository in a production environment without any drama

By Matt |  Apr 5, 2012  | mercurial, svn

Why would I want to use Mercurial or any other DVCS client with a Subversion repository?

  • It lets us keep SVN as our central repository
  • Some team members prefer not to use a DVCS for whatever reason so it lets them carry on using SVN without interruption.
  • It allows me to work and commit changes (but not push!), search history and switch between branches completely disconnected. I can continue to work during network outages or while traveling when I don’t have connectivity.
  • You get full, fast history search.
  • Switching between branches is easy and fast.
  • Any automated processes which use SVN (i.e. automated builds and deployments) can continue to operate while everyone moves to DVCS.
  • It’s much easier to perform merges than regular SVN (via export/import patch queues – which I detail later)
Continue Reading...

SQL Profiler templates missing

By Matt |  Jun 1, 2011  | sql, sql-profiler

If you are connecting to a SQL server with the SQL profiler and none of your templates are showing up, compare the versions of the SQL profiler you are running and the version of SQL server that you’re connecting to; there is likely a version mismatch.

If this is the case, what’s likely happening here is that you’re connecting to a SQL 10.50 instance with a SQL 10.0 profiler and the profile templates for 10.50 aren’t present.

Continue Reading...

Loading jQuery via HTTP or HTTPS depending on the request protocol without document.write

By Matt |  May 20, 2011  | jquery, https

When running a page with HTTPS, you’ll want to also load any external resources such as javascript via HTTPS. A lot of people recommend loading jQuery from the Google CDN via the following javascript script:

<script type="text/javascript">
    var gaJsHost = (("https:" == document.location.protocol) ? "https://" : "http://");
    document.write(unescape("%3Cscript src='" + gaJsHost + "' type='text/javascript'%3E%3C/script%3E"));
    document.write(unescape("%3Cscript src='" + gaJsHost + "' type='text/javascript'%3E%3C/script%3E"));
    document.write(unescape("%3Cscript src='" + gaJsHost + "' type='text/javascript'%3E%3C/script%3E"));       

This works just fine, however you can let the browser select the protocol depending on the request by the following snippet:

Continue Reading...

How to include the Fluent NHibernate discriminator column in a composite key

By Matt |  Feb 9, 2011  | fluent-nhibernate, nhibernate, sql
In our project, we’re sub classing multiple domain classes from a single Reference Data table – i.e. Volume and Weight types. Among other things, the reference data table contains discriminator, code and value columns. The ‘discriminator’ column stores the name of the class and is used by Fluent NHibernate to determine which subclass to instantiate, the ‘value’ column is the full name of the reference data item, and the ‘code’ column is the abbreviated version of the value.
Continue Reading...

ASP.NET MVC - Multiple parameterised form submit buttons without Javascript

By Matt |  Jan 24, 2011  |, noscript
The current project I’m working on involves a search page with multiple submit buttons in a single HTML form. Each submit button triggers a different behavior while posting all of the form data to the controller. This method is compatible with both IE 6+ and Firefox. It also avoids the IE button bug where button values are not passed on HTTP POST. After discussing a few design options we decided to allow the user to add the desired search parameters via selecting them one by one from a drop down list.
Continue Reading...

Bitbucket - wrong user on commit

By Matt |  Jan 21, 2011  | bitbucket, mercurial
I was having an issue where after pushing my changes to bitbucket, the changesets listed a different user as having pushed the files. For bitbucket, the commit username has to match your bitbucket username. As commits in Mercurial are local, we have no way of controlling that you have set your username correctly. It is important for you to set this up in such a way that we can identify your user account on Bitbucket when you push your commits to us.
Continue Reading...