02
Jul 10

Some Code Spaces Stats

Posted by Floyd Price

From time to time we get potential customers who ask us to describe our customer base and to list a few of our existing customers, I guess its natural to want to know who is using Code Spaces before you commit to using it yourself.

So a few stats (Correct at time of writing 2010-07-02),

USERS

  • Number of active users: 3811
  • Number of paying users: 3411

 

REPOSITORIES

  • Number of Active Subversion Repositories: 5062
  • Number of Commits per day (average): 11437
  • Average Repository Size: 71MB
  • Largest Repository: 11GB

 

WORK ITEMS (Tasks, bugs, issues, etc…)

  • Number of new work items per day (average): 1100

 

SELECTION OF CUSTOMERS

This is a selection of customers that are using Code Spaces, Obviously we can’t list them all so we cherry picked a few ;-)

ricoh.gif

New_Yell_Logo.gif

logo_msr.png

 

logo.png

 

lgo_justProud.gif

 

 

 

nationwide_childrens_logo.png

 

Want to know anything else about Code Spaces? Contact Us

 

 

 

 

 


05
Mar 10

Single instance .NET executables

Posted by Floyd Price

It’s not a common problem, which probably explains why there isn’t much information out there on the topic, but how do you make it so that your executable can only have a single running instance? That is, if you user tries to launch the same programme twice, the second instance silently closes down.

There aren’t many obvious practical uses for this, but they are out there and they do exist. We’ve come across the requirement a few times as consultants to enterprise organisations — for example, a utility that gathers information on a wire that must only be running a single instance — and it took us a while before we settled on the code to solve it.

We tried various methods — broadcasting on sockets, named pipes, magic ‘lock’ files (this is the simplest solution, and the one that a lot of software uses — it’s effectively a file with a non-sharable lock — if you can’t lock the file, the app is already running). We finally came across the .NET Mutex class, and that fit our needs beautifully. You define a string which becomes your identifier, and then create a Mutex for that identifier. Mutex stands for Mutually Exclusive. If somebody else has Mutex’ed that identified, you’ll get a fail. Here’s the code to add to your static main method:

static void main(string[] args)
{
  string identifier = "MyApplicationIdentifier";
  bool ok;

  Mutex mutex = new Mutex(true, identifier, out ok);

  if (!ok)
  {
    // Message box provides visual feedback for this demo
    MessageBox.Show("This application is already running");
    return;
  }
  else
  {
    // This becomes your application's entry point
  }

  // Don't allow the mutex to be garbage collected when it falls out of scope.
  GC.KeepAlive(mutex);
}

25
Feb 10

Built-in .NET Utility Classes for encoding/decoding strings

Posted by Floyd Price

Every now and again, you’ll will come across a string that has been encoded (or possibly you need to encode a string) and you’ll wonder whether there is a class in .NET that can help. The answer is probably yes, but they are tucked away and difficult to find. In this article I’ll show you how to easily encode/decode your strings for the three most common forms of encoding.

HTML encoding

This is also used in XML data, to quote ampersands and other characters. For example, the string “Ben & Jerry’s” will be encoded as “Ben & Jerry's”.

To escape and unescape these strings, use System.Web.HttpUtility.HtmlEncode() and System.Web.HttpUtility.HtmlDecode().

URL Encoding

URL encoded characters are the %-number elements you occasionally see in URLs. For example, “Ben & Jerry’s” this time will become “Ben+%26+Jerry’s”. Note that spaces can be represented as “+” or as “%20″. The encode method will always use +, but the Decode method handles both.

To escape and unescape these strings, use System.Web.HttpUtility.URLEncode() and System.Web.HttpUtility.URLDecode().

Note that both of the above examples require your project to have a reference to System.Web.

Escaped Strings

These characters are the \r\n and \t’s that you use to specify special characters in strings. Though it’s rare, sometimes you’ll come across these characters in plain text and need to convert them to the actual character codes (or vice versa).

To handle these strings correctly, use the frustratingly obscure Regex.Escape and Regex.Unescape methods. Escape will turn control characters in to their plain-text escaped representation (e.g., a new line will become \r\n) and Unescape will turn them back again.


12
Jan 10

An adaptation of seed-fu, to make seeds.rb a bit nicer

Posted by Floyd Price

The db:seed rake task in Rails is a nice addition and we use it a lot. The trouble is, you end up writing a lot of redundant code to check if records exist and stuff like that. Not very DRY, not very Rails.

Seed-Fu is a nice plugin that works very well, but it replaces the new db:seed rake task, and this solution is far more light-weight. You add another file to your db folder, seeds-helper.rb, and just require it at the top of seeds.rb.

Here’s the contents of seeds-helper.rb:

class SeedsHelper
  def self.seed(model_class, *keys, &block)
    s = SeedsHelper.new(model_class)
    s.parse_keys(*keys)
    yield s
    s.plant
  end

  def initialize(model_class)
    @model_class = model_class
    @keys = []
    @data = {}
  end

  def parse_keys(*keys)
    keys = [:id] if keys.empty?
    keys.each do |key|
      raise "'#{key}' is not defined in #{@model_class}" unless @model_class.column_names.include?(key.to_s)
      @keys << key.to_sym
    end
  end

  def plant
    r = find_record
    @data.each do |key, value|
      r.send("#{key}=", value)
    end
    raise "Error Seeding: #{r.inspect}" unless r.save(false)
    puts r.inspect
    return r
  end

  def find_record
    results = @model_class.find(:all, :conditions => conditions_hash)
    if results.any?
      return results.first
    else
      return @model_class.new
    end
  end

  def conditions_hash
    @keys.inject({}) {|a, c| a[c] = @data[c]; a }
  end

  def method_missing(method_name, *args)
    if args.size == 1 and (match = method_name.to_s.match(/(.*)=$/))
      @data[match[1].to_sym] = args[0]
    else
      super
    end
  end
end

class ActiveRecord::Base
  def self.seed(*keys, &block)
    SeedsHelper.seed(self, *keys, &block)
  end
end

You can now use the seed-fu magic in seeds.rb:

require 'db/seeds_helper.rb'

Account.seed(:username) do |t|
  t.username = "adrian.oconnor"
  t.name = "Adrian O'Connor"
end

The active record model object is extended with a seed method. This takes a list of symbols that act as the key — if the values passed in match the keys in an existing record, it’ll replace it, otherwise it’ll create a new record. Pretty clever stuff.

If you like this, you should definitely check the full seed-fu plugin. You can find it here: http://github.com/mbleigh/seed-fu. I just like having a single additional file that is only used by seeds.rb.


05
Dec 09

A few minor updates.

Posted by Floyd Price

We have just pushed a small update to the production servers. the fixes include:

  • Internet Explorer 6,7 and 8 rendering issues on the Dashboard
  • Internet Explorer 6,7 and 8 Gantt Chart didn’t always show
  • Create Milestone button on the Planning Tab didn’t work

As always your feedback is greatly appreciated!

Cheers,

Floyd


03
Dec 09

New Payment Option – PayPal

Posted by Floyd Price

Hi Guys,

This is a quick post to let you know that we have introduced a new payment option, PayPal!

You go through the same process as normal but select the PayPal option on the payment page, everything else is the same.

 

Cheers

Floyd Price

Code Spaces


30
Nov 09

A Visual Guide to Version Control

Posted by Floyd Price

If your new to the concept of Version Control check out this great article over at betterexplained.com

For all your graphic designers our there, this on is for you.


30
Nov 09

SVN Status Codes

Posted by Floyd Price

If like me you do a lot of your SVN work in the command line you will be familiar with the SVN status codes, you know when you do an svn status you see a list of files, some have been modified (M), some have been added (A), and other are well in a state of limbo (!).

This is a quick explanation of most of the codes and what it means to your the user if you see them

For those of you who use a nice GUI to manage your working copies, Look Away Now

>svn status
  ? file1.txt
  ! file2.txt
  A file3.txt
  M file4.txt
  A+ file5.txt
  G file6.txt
  C file7.txt
  D file8.txt
  U file9.txt
  ...

So the above console output isn’t quite what you would see every day but it illustrates most of the status codes you will run in to when working with your working copy from the command line.

? – This file is not under version control

As the sumary suggests the ? code is SVN’s way of telling your that a file exists in the working copy that isn’t under version control and as such will not be send to the server on the next commit.

If you want to add a file you will do use the svn add command

  svn add file1.txt

There are many cases when you don’t want a file to be under version control for instance if tis a config file that contains passwords, in this case you can tell svn to ignore the file using the svn:ignore property like so:

  svn propedit svn:ignore

A – This file will be added to version control, after the commit

you have done an svn:add already and this file is going to be part of the next commit

! – This file is under version control but is missing from the working copy

I see this all the time, and can happen in a number of scenarios but its basically svn’s way of telling you that a file that should be in the working copy isnt!

This usually happens when you (or your editor) removes a file but does not tell svn, to delete a file the correct way you must submit an svn delete command

  svn delete file1.txt

However this will only work if the file is still there, in the scenario where it has been removed and svn is showing a ! in the status, you can force delete it with :

  svn delete file1.txt --force

M – Working copy has been modified

This is the most common status code on an active project, its simply means that a file has been modified and the updated version will be committed next time you do a commit.

G – Changes on the repository were automatically merged into the working copy

You will see this when you do an update (svn up) rather that a status but its important all the same, svn is telling you that is automatically merged changes that somebody else has made into your working copy, In most cases this is a good queue to re-test your own changes (or run that test suite again).

C – Changes on the repository could not be merged in the working copy, manual intervention required

Like G this is svn’s way of telling you that changes exist on the server but unlike G the svn client was not able to automatically merge in the changes, its now up to you the developer with the assistance of the developer who made the change in the repository to collaborate and decide which lines of code stay and which ones go.

As of svn version 1.5 interactive conflict resolution was introduced which will allow you to resolve conflicts when you perform an SVN up, providing you have the SVN_EDITOR environment variable set you can open the effected file and see the conflict:


-Just buy a sandwich.
+<<<<<<< .mine
+Go pick up a cheesesteak.
+=======
+Bring me a taco!
+>>>>>>> .r32
blah blah blah
...

I will write a detailed article about conflict resolution in a later post as it is somewhat out of the scope of this brief guide but for now I would suggest you look at the SVN book for further details.

There are many more status codes, and I welcome your comments on them but for me these are the ones I come across most in my travels and from 2 years of manning the Code Spaces support desk these are the ones that catch out users who are new to Subversion.


12
Nov 09

Updates this Sunday (15th Nov 2009)

Posted by Floyd Price

We will be performing some updates to the Subversion Cluster on Sunday the 15th Nov 2009, the updates will cause a 30 minute outage from 10:00 (GMT) to 10:30 (GMT).

The update includes a Subversion Update which will bring all the SVN servers up to version 1.6.6

This change will not effect your working copies in any way, you will not need to update anything (unless you want to).

Please Contact Us if you have any queries about this?

Cheers,

Floyd Price
Code Spaces


20
Oct 09

Add Work Items by Email

Posted by Floyd Price

As well as the super extensive API we offer you can also enable Work Item creation by email.

Getting Started

In the project setting tab you will see a check box labeled “Email In Work Items” once checked your project email address will become active.

Usage

Using the email address displayed in the project settings tab you can email work items directly in to your project, this is a great way to give your users mechanism to send in bugs.

You can also get notification messages when this happened if you have check the the appropriate options in your user profile

As always we are really keen to here your thoughts about this, so please Contact Us