20
Oct 09

Code Spaces API

Posted by Floyd Price

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)

Posted by Floyd Price

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.


28
Sep 09

Tidy up your Java logging

Posted by Floyd Price

The logging libraries provided with Java 5 and above are pretty good, except they produce output that is almost unreadable. For example, consider the simplest example:

Logger logger = Logger.getLogger("PushServer");

logger.log(Level.SEVERE, "This is a sample message");

That produces the following log entry, on your screen and/or in a file:

Sep 28, 2009 9:30:48 PM javaloggersample.Main main
SEVERE: This is a sample message

Individually, that’s OK, but 20 messages? Messy. 1000 messages? Pretty nasty. 100 threads each generating a stream of FINE messages? Yikes.

We recently wrote a Java server application that was massively threaded, and because of the nature of the systems we were communicating with, we needed solid logging output that we could easily scan to get an idea of the health of the software. The default logging format was not it.

While you can get some degree of flexibility by changing configuration options, we found that the best solution, for us, was writing a new Formatter that the logger client could use to generate output. Here’s the above sample, using our formatter:

28/09/2009 21:41:44 SEVERE: This is a sample message

That is vastly more readable when the log file starts filling up, because each message is on a single line and each component of the message is formatted in columns. Here’s our logger class — you should add this class to your own project:

public class SingleLineFormatter extends Formatter
{
    public SingleLineFormatter()
    {
    }

    private SimpleDateFormat dateFormat;

    static final String lineSep = System.getProperty("line.separator");

    public String format(LogRecord record)
    {
        StringBuilder buf = new StringBuilder(180);

        if (dateFormat == null)
            dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");

        buf.append(dateFormat.format(new Date(record.getMillis())));
        buf.append(' ');
        buf.append(record.getLevel());
        buf.append(": ");
        buf.append(formatMessage(record));
        buf.append(lineSep);

        Throwable throwable = record.getThrown();

        if (throwable != null) {
            StringWriter sink = new StringWriter();
            throwable.printStackTrace(new PrintWriter(sink, true));
            buf.append(sink.toString());
        }

        return buf.toString();
    }
}

When you create your logger, you need to tell it not to use the default formatter, and to use this formatter instead. Since the original Apache Log4j, loggers have been hierarchical — you can set parent/child relationships between logger objects and the child will do as its parent does, plus any configuration of its own. Therefore, to disable the default logger we set UseParentHandler to false. Then, we create a handler and initialize it with our formatter:

Logger logger = Logger.getLogger("PushServer");

logger.setUseParentHandlers(false);

ConsoleHandler h = new ConsoleHandler();
h.setFormatter(new SingleLineFormatter());
h.setLevel(Level.ALL);
logger.addHandler(h);

logger.log(Level.SEVERE, "This is a sample message");

Hopefully this will be useful to somebody. We’re trying out something different here — posting coding tips to the CodeSpaces blog (rather than our company blog — Component Workshop). Also, we don’t often post Java tips, so on both of these points your feedback is most welcomed! Also, let us know if there are any topics you’d like us to cover — I think the next post might be about Middleware-Oriented-Messaging in .NET. — Adrian

This advice and any code samples are provided as-is, and without any warranty. You are free to use them as you wish. If you require professional services, or support on your own projects, get in touch with us and we’ll see if we can help. Note that we are UK based.


25
Aug 09

Some Code Space Updates.

Posted by Floyd Price

We have just publish the following updates to the Code Spaces application.

  • Fixed Require SSL Support
    If you select “Applicaion Requires SSL” or “Login Requires SSL” in the Code Spaces admin section this will be reflected by the App.
  • SVN Over SSL Option
    You have always been able to use svn over SSL, however you now have the option in the Code Spaces admin section to force SSL.
  • Activity Timeline
    You will notice a new tab names “Activity Timeline”, this is a simple top down view of your project activity.
  • Time Tracking
    We have moved the time tracking attributes to a tab inside the Work Item editor and added estimates and actual attributes (We will be creating Burn Rate and velocity graphs for the next release).
  • Language Support
    We have added support for multiple languages (although we currently only have English) and will be adding more languages this week, including German, French and Spanish. Please let us know if you require any other languages.

That’s about all for now ;-)

As always let us know if you have any issues and/or comments…

Cheers,

Floyd Price
Code Spaces


25
Jul 09

Free accounts

Posted by Floyd Price

No More Free Plan!

On the 1st of August 2009 we will be removing the FREE Code Spaces plan and replacing it with a Mini Plan that will cost $2.99 per month.

All existing FREE plan customers will be given 2 months further for FREE and will then need to either switch or move to another FREE host.

Why are we doing this?

Many of the features we are adding (and have added recently) are aimed at higher end customers who by definition do not fit on the FREE plan.

We also feel that our service is somewhat more than simple SVN hosting and as such we feel that it adds little value to our user community to continue serving Free svn users.

What about my Open Source or Non-profit project?

We are proud to support over 100 non profit (and Open Source) projects and will continue to do so, this announcement will not change our position on this.

Give us your feedback?

As always, we are happy to listen to feedback and would love to hear your thoughts, Contact us Here.


10
Jul 09

Intermittent network issues [resolved]

Posted by Floyd Price

Hi all. This is a quick service update – we’re experiencing network connectivity issues between Subversion and MySQL right now. This is affecting Subversion’s ability to authenticate usernames and passwords and, as a result, you might be getting ‘500: internal server error’ when you try and checkout, update and commit.

We’re working to resolve this ASAP. I’ll post any updates as and when I can. Our current expectation is that this will be fixed within 30 minutes.

Thank you for your patience.

Adrian

Update (17.00 GMT): These issues are now resolved and the service is stable again.


30
Jun 09

Svn Backups

Posted by Floyd Price

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


30
Jun 09

Code Spaces 2.6

Posted by Floyd Price

You may have noticed that we released an update to the CodeSpaces application last week. CodeSpaces is now at version 2.6, and these are the features and changes that make up the new version:

  • Planning We’ve added classic project management features including a Gantt chart to CodeSpaces. Work Items now have a start and end date/time field, and this is relfected in the Gantt view. The Gantt chart is a Flash component that has been developed in-house. We’re going to open source it in the very near future, but we’ve got more enhancements planned for 2.7 (zooming, weekend auto-breaking and so on).
  • Work Item numbering This is the change with the greatest impact, but we hope you’ll agree that it is worth-while. We’ve renumbered work items—before this update they used the identity field in the database, so ids were system wide and non-sequential. Now they’re scoped by project, so new work items will always have a predictable id. We know some of you were using the old work item numbers in source code/external links, so we’d like to reassure you that all of the old numbers still work, they are just not published any longer.
  • Account/Project rename You can now rename your account without needing a support ticket. It might take a few minutes depending on what other automated tasks are concurrently running
  • Dashboard and cardwall shortcuts to create new Work Items
  • Basic Help Panel You’ll notice a little text panel in the right-hand bar that changes as you move around the application. We’re going to expand this and add a full-blown help system soon.
  • Source Code Tab Now shows folders in the main section, for improved navigation/detail.
  • Commit Emails Contain summary of changes (similar to svn log etc.)
  • Project Admins You can now make a user a project admin, allowing them a certain level of control over project settings without making them a full-blown account admin.
  • Minor changes Work items now include a drop-down that contains a list of icons that you can choose for the item. This icon will be shown in the Work Items list and on the Card Wall.

Your feedback is welcomed, but please report any bugs though the usual support channels so it can be handled quickly and effectively.

Thanks,
Adrian


25
Mar 09

Code Spaces v2.5

Posted by Floyd Price

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


04
Mar 09

Code Spaces Outage for Infrastucture Upgrades

Posted by Floyd Price

UPDATE – This work has now been completed.

Code Spaces will be unavailible for a few hours on Sunday (8th of March 2009) from 10:00 GMT to 14:00 GMT

During this time the WWW site and SVN Cluster will be unavailible.

Many Thanks,

Floyd Price
Code Spaces