Tips


30
Nov 09

SVN Status Codes

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.


20
Oct 09

Add Work Items by Email

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


20
Oct 09

Code Spaces API

We have had an API in Code Spaces for about a year now, but until now have neglected to tell a single soul… about 100 of you have spotted it and asked for details so finally here is a fancy guide.

We will be creating sample code for Ruby, C# and Java developers (and any other language you guys ask for) in the coming days.

Getting Started

In the Code Spaces admin section select the project you want to work with and select the API Settings tab.

You will notice a brief list of available functions and a check box to enable the API for this project.

Check the Enable API box and the functions you wish to use.

Now you have enabled the API you will need to use the API Key.

The Api is a simple RESTful service and uses the following URL conventions:

https://[your_account].codespaces.com/api/[resource].xml

When you hit this URL you will be prompted for a username and password, the username is your API key and the password is blank.

Resources

List Work Items – Retrieve a list of work items.
URL (GET) :

https://[your_account].codespaces.com/api/work_items

Edit Work Items – Update existing work items.
URL (PUT) :

https://[your_account].codespaces.com/api/work_items/wi_id/

Create Work Items – Create a new work items.
URL (PUT) : https://[your_account].codespaces.com/api/work_items/

Project Details – Retrieve information about the current project.
URL (PUT) : https://[your_account].codespaces.com/api/work_items/

List Project Components – Retrieve a list of Project Components.
URL (GET) : https://[your_account].codespaces.com/api/project

List Project Milestones – Retrieve a list of Project Milestones.
URL (GET) : https://[your_account].codespaces.com/api/project_milestones

List Project Users – Retrieve a list of Project Users.
URL (GET) : https://[your_account].codespaces.com/api/users

List Work Item Priorities – Retrieve a list of Work Item Priorities
URL (GET) : https://[your_account].codespaces.com/api/work_item_priorities

List Work Item Statuses – Retrieve a list of Work Item Statuses
URL (GET) : https://[your_account].codespaces.com/api/work_item_statuses

List Work Item Types – Retrieve a list of Work Item Types
URL (GET) : https://[your_account].codespaces.com/api/work_item_types


29
Sep 09

Ruby On Rails for .NET Developers (Part 1)

In this short series of posts I will document some of the steps required for an experienced .NET developer to get the most out Ruby On Rails.

Getting used to life without Visual Studio

Visual Studio really is a great IDE, in fact it is probably the best IDE I have ever used. And as a .NET developer moving from C# ASP.NET (or ASP.NET MVC) you are really going to miss the Visual Studio IDE, in fact you will at some point during your first few days without it, you will question question your decision to try another toolset.

In my experience of seeing .NET developers use Rails those that get past those first few days without the IDE make really good rails developers.

The Rails Way, Saves the Day!

Initially the lack of a great IDE can seem a real down point however, once you appreciate the mind set of a rails developer you will see that life does indeed go on without Visual Studio.

Life as a Rails developer is about designing beautiful interfaces with simple and intuitive user experiences, less of your time will be spent on heavy lifting

NOTE: At this point I should say that many “Good” IDE’s are available for Rails development, and I will mention some of them in a second ;-)

Getting Started

For the remainder of this series I will assume that you are going to continue developing on Windows, and as such will only mention tools that are available on Windows, but i strongly recommend that if you get chance to develop software using a Mac you do so, its very liberating….

To Develop Ruby on Rails apps you are going to need:

  • A Ruby Environment
  • Rails (as in Ruby on Rails)
  • A Database
  • A way to edit files (An IDE Maybe ;-)
  • An open mind (optional, but recommended)

Ruby Environment

This is really easy, go to Google and search for the Ruby One Click Installer, this simple installer will give you all you need to get started with Ruby.

One thing you will notice when developing in Ruby is the amount of time you spend in a Console Window, so lets start right now… Open a Command Prompt (Start->Run->CMD) and type the following:

  ruby -v

If your Ruby One Click installation was successful you should see something like:

ruby 1.8.6 (2007-08-11 patchlevel 111)

Don’t worry if the numbers on your system are slightly different, we are just confirming that you have a Ruby environment and it looks like you do ;-)

Rails

Ruby has a nice packaging mechanism called GEMs which is similar to package management systems on linux operating systems (apt-get) but for many .NET developers who are not exposed to Linux, its a pretty new concept, one that might even seem like a step backwards but don’t let the simplicity of it fool you, its a great system and will make you take a second look at that ‘Add/Remove programs’ dialog that you are used to using.

The One Click Installer was good enough to instal Gem for you, all you need to do is update it using the following command (command prompt again):

  gem update --system

This command (when complete) will have updated your Gem version to something equal to or greater than 1.5.3 (Depending on how old this article is when you read it), you can test this with the following command:

  gem -v

Your now ready to install rails with the following command:

gem install rails

This command will take a few minutes to complete but once it has you have almost all you need to build your first Rails app! Remember how long it took to install Visual Studio?

A Database

Rails will change the way you think about Database’s, which may or may not be a good thing but to fully embrace rails you may need to leave some of your old database habits at the door.

For this series of posts i’m going to use Mysql, and you should too (if your following along at home), but Rails works with SQLite, Mysql, PostgreSQL, SQL Server, Oracle, and more (i guess)
Go to the Mysql site and download Mysql Community Server (i’m currently using version 5.0) and while you are there get the GUI tools.

A Way to Edit Files (And IDE Maybe ;-)

I told you i would mention some Rails IDE’s… well you have a few options ranging from a simple Text editor like Notepad++ or Scintilla (this comes with the One Click Installer) to a “fully fledged” IDE like Netbeans (FREE) or RubyMine (by JetBrains, PAID).
The final choice on IDE’s is one that you have to make alone, but many of the rails guides that you come across on the WEB will assume that you are using a simple Text Editor and the Command Prompt, once you get experienced you will of course learn to love the refactoring and code completion features of IDE’s like RubyMine, but until then i recommend that you try to use your choice of IDE as a text editor and leave the “integrated” features alone.

For example I’m going to use Netbeans for these posts, but i’m not going to use any of the built in features, because they overlap many of the Command Prompt based commands that you will see referenced in this and other tutorials, once you are comfortable with them the choice is yours.

So go to www.netbeans.com and get the latest version of NetBeans

An Open Mind

Ruby (and Rails) will introduce you to a somewhat different approach to software design, you will at first find it hard to let go, particularly if you are the type of developer who thinks in terms of Interfaces and Object Orientation, Rails simply takes a lot of this out of the equation, within a few days you will think of your project in terms of User Interactions and models, which is great because it’s a nice “Agile” way to work.

Part 2

OK! Thats enough for Part 1, you now have the tools, next time I will go though the process of building and running a Rails app.

My aim with these posts is to create an app that you would have created in .NET, therefor i’m going to create a Rails version of the Time Tracking ASP.NET Starter Kit. You may have already come across this on the APS.NET Starter Kit site Time Track Web Site Starter Kit Does. Now it’s important to that i’m not going to look at the code, i’m simply going to look at the app and build in Rails using a nice Agile approach.

See you in part 2 ;-)

My name is Floyd Price, I’m a software developer (and MD an Tea boy) at Component Workshop a small software company in the UK, if you have any questions please let me know at floyd[at]componentworkshop[dot]com.


30
Jun 09

Svn Backups

Further to Adrian’s recent announcement about v2.6 I would also like to add that the SVN Backups tab is now available via the Admin tab, which gives you direct access to your SVN backups.

Please let us know if you have any feedback for any of these enhancements?

Cheers,

Floyd Price
Code Spaces


25
Mar 09

Code Spaces v2.5

We are pleased to announce the availability of Code Spaces v2.5, this is the first in a series of updates that will bring us to v3.0 over the coming months.

This update includes many foundational enhancements, performance updates and extra scaling options, including:

  • Infrastructure Update
    All the Code Spaces SVN, App and database servers are now running on Amazon EC2 and as such we have updated all components to take advantage of the almost limitless scaling opportunities.
  • Changes to Plans
    With our new found abundance of space and processing power we have updated the Code Spaces Plans, in a nut shell all plans now have unlimited projects and repositories and the FREE plan now has 500MB of disk space (10x what it was).
  • Card Walls
    A new tab has been introduced to Code Spaces between the Dashboard and Work Items called “Card Wall”.
    A Card wall is a visualization of Work items, and allows work items to be displayed as cards in virtual swim lanes that represent categories such as Work Item Status, or Assigned To. Within the context of a milestone Card Walls give Agile teams the ability to plan, estimate, do Stand Ups, etc all from the Code Spaces UI.
    The Card Wall section also allows for convenient dragging and dropping between swim lanes, so re-allocating or prioritizing work items couldn’t be easier.
  • Browser Rendering Issues
    All known IE6, 7 and 8 rendering issues have been resolved.
    Firefox 3+ exhibited rendering issues on the Code Spaces Dashboard where the timeline would bleed through any components above like menus or dialogs. This has been resolved.
  • Email Notifications
    Users can now receive email notifications from activity in the Code Spaces forums.
    Admins can now specify user notification preferences in the User Admin section.
  • Return URLs
    Previously the Code Spaces application would redirect to the login page when an login was required which is great, however the context of the request was lost and the user would not be returned back to the page they requested after a successful login, this has now been resolved.
  • Backup Changes
    We now use the snapshot feature of Amazons Elastic Block storage to take block level backups every 10 minutes, we are also taking actual backups of each repository as a commit occurs meaning we have a much greater capacity to respond to failure.

A few other not so noteworthy bugs have been fixed and many performance improvements have been applied.

As i mentioned this is one of many updates that we will be applying over the coming months, v2.6 is scheduled to go live in exactly one month from now ;-)

As always please Contact Us if you have any suggestions ;-)

Many Thanks,

Floyd Price
Code Spaces


5
Feb 08

Streaming Files to the Browser with Ruby on rails

Quite often when building a web application you need to store and send Documents, with ruby on rails, streaming files from your application to the browser is simple.


def download_file
    @document = Document.find(params[:id])
    # this is where the magic happens...
    send_file @document.file_location
end

This single line of code will stream a file from your servers filesystem directly to your browser.

The simple use described above is often enough but you have even further control over the file with the following options:

Options:

  • :filename – suggests a filename for the browser to use.
    Defaults to File.basename(path).
  • :type – specifies an HTTP content type.
    Defaults to ‘application/octet-stream’.
  • :disposition – specifies whether the file will be shown inline or downloaded.
    Valid values are ‘inline’ and ‘attachment’ (default).
  • :stream – whether to send the file to the user agent as it is read (true)
    or to read the entire file before sending (false). Defaults to true.
  • :buffer_size – specifies size (in bytes) of the buffer used to stream the file.
    Defaults to 4096.
  • :status – specifies the status code to send with the response. Defaults to ‘200 OK’.
  • :url_based_filename – set to true if you want the browser guess the filename from
    the URL, which is necessary for i18n filenames on certain browsers
    (setting :filename overrides this option).

Pay particular notice to the :disposition option, changing this from its default to ‘inline’ will enable you to display the contents of the file in the browser window rather than downloading it as an attachment.

def download_file
    @document = Document.find(params[:id])
    # this is where the magic happens (inline)...
    send_file @document.file_location, :disposition => "inline"
end

This is especially useful for things like word or excel documents when you know you target audience can read these in the browser.

EDGE RAILS

If you are brave enough to live on the Edge with Edge Rails you will get an extra treat for free, on Edge Rails the send_file method passes the correct information to your balancing server to allow it to stream the file rather than blocking your mongrel server.


21
Nov 07

Subversion Clients

Many Code Spaces users have asked my which Subversion Clinets are the best for a given platform so I a have compiled this list of Subversion Clients and grouped it by Operating System, I know this list is not complete so let me know if i have missed any really good ones ;-)

For Windows

  • TortioseSVN is the de-facto standard when it comes to Subversion clients, on windows that is, TortoiseSVN is OPEN SOURCE, and FREE and is a complete implementation, featuring visual Diff and Merge and really good integration with the windows shell.
  • Rapid SVN is a Cross Platform stand alone client. It sports a Simple interface that is familiar to most source control clients, and is OPEN SOURCE and FREE.
  • SmartSVN is a commercial Subversion Client, which includes all the standard SVN features, with some nice additions like a fancy Revision Graph. SmartSVN costs $79.99 per user but for those of you who don’t do Open Source, it’s a good alternative to TortioseSVN and RadipSVN.
  • SVN.exe is the command line Subversion client that comes with the standard Subversion install and for 90% of your subversion work is more than good enough to accomplish what you need, It isn’t a GUI and you have to learn all the commands, but once you have you will also have a much better understanding of the Subversion internals. SVN.exe is OPEN SOURCE and FREE.

Mac OS X

  • SCPlugin is an open source project that is building a Mac version of TortoiseSVN (see above), and although its far from being complete it does give you the shell integration and the basic SVN commands. it is OPEN SOURCE and FREE.
  • RapidSVN (See above) being cross platform is also a good client for Mac OS X, however the look and feel is not really what most Mac users expect. (Java tut).
  • SmartSVM (See above) being cross platform is also a good commercial Subversion client on Mac OS X.
  • The SVN command line client again is a great utility on the Mac.

Linux

  • RapidSVN and SmartSVN also run on Linux systems (java required) and are both great on this platform.
  • Svn command line is probably the tool of choice for most Linux developers. Linux users are generally more comfortable in the command line.

In my next post i will highlight some of the IDE’s and IDE Extensions that enable Subversion Integration.


3
Nov 07

Quick Access to your Code Spaces Subversion Repositories

If like us you have dozens of repositories in your Code Spaces account you can use this simple tip to get quick access to all your repositories.

Normally you would use a URL similar to this to access a specific repository:

http(s)://svn.codespaces.com/[my_account]/[my_repository]

However, if you simply go up one level to:

http(s)://svn.codespaces.com/[my_account]/

Paste this into your browsers address bar, you will see a list of all your repositories and even better, they are browsable (provided you have permission to them).