Ryan LanciauxNew Media Mercenary

Some tools for working with distributed teams

June 11, 2008 by ryan
Whether you're creating a project for fun or freelancing (etc.), working remotely as part of a team is becoming more and more common. Communication is still key to a successful project, however, it's much more difficult when your working with people in different locations and on different schedules. Although, you will not be able to achieve the same level of communication as face-to-face, there are some tools beyond E-mail, IMs and Remote Desktop that could make your life a little easier. Here are some of the tools I use when I'm not in the vicinity of as the team I'm working with.

Source Control
Obviously, source control is a must-have. This is a given for development projects; even if you're working by yourself. I use Subversion for all of my code because it's relatively easy to set up and, for the most part, pretty intuitive for newer users. When creating a source repository you need to choose to:
  1. Host your own
  2. Go through a third party
    • Assembla -Although there are many options in this arena, this is the host that I use for remote collaboration so it's the one I'm going to focus on. You can set up a Subversion repository simply by adding a new project to your workspace and specifying that you want to use subversion (in the setup configuration). From there you can add users or make your project open to the public. Apart from Subversion, there are many other features that may make Assembla a worthwhile site to check into.
Finally when running Subversion, you're either going to need an IDE that supports SVN, use the command line or download a client. I use Tortoise SVN and the command prompt, however, Visual SVN for Visual Studio looks nice (and when I'm using Eclipse, the SubVersion plugin is wonderful).


Screen capture software
It can be confusing trying to fix an issue based on a text description. Having a screenshot or video that explains how to reproduce a bug can be invaluable. Coupled with a bug tracking application, this can be an extremely effective way to quickly resolve issues. Camtasia is probably the ideal application for creating screen casts of a bug but for the price tag it might be overkill (especially if it's just for fun / open source). Currently, I usually use Wink by Debug mode for this sort of functionality. Although it's definitely not as feature rich as Camtasia, it gets the job done.

Also see: Jing

Real-Time Collaboration
Some situations require an extra level of involvement from team members. Vyew has been an awesome addition to the tool belt. With it, I can collaborate / share desktop / share files real time with someone else anywhere in the world in. Similar to the screen capture application, it really helps to communicate something that otherwise may be difficult to explain. Earlier in the week, for example, I was having some trouble with an Eclipse setting for a project I'm working on. Rather than sending e-mails back and forth trying to explain the issue, I used Vyew to share my desktop with a friend half way across the country. In a matter of minutes, he was able to diagnosis the problem and I was back in business. Vyew is free if you don't mind having ads on the page. Otherwise, it's $6.95/month for the Plus Package and $13.95/month the Professional version. For more information, vist the Vyew site or check-out Guy Kawasaki's synopsis of Vyew.

 

What tools do you use to stay connected with your team? 

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList



Quick Tip - Visual Studio Keybindings

June 5, 2008 by ryan

This may be common knowledge but it was new to me. If you're ever hand mangling control position in a winforms designer you can setup keybindings for Bring to Front Send to Back options that are normally available on the controls context menu. This is really useful if you have layers of controls and you can't always get to the Context.

  1. Click on Tools -> Options
  2. Under Environment, Select the Keyboard menu
  3. Type "Format.BringtoFront" (or "Format.SendtoBack") in the "Show Commands Containing" box
  4. Choose your shortcut keys
  5. Press Assign




Thanks to my friend Ross for pointing this out.



Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList



RhinoCommons, NHibernate and ASP.NET MVC Part 5 - LINQ to NHibernate

June 3, 2008 by ryan

Settings 

Up until now, we've been using  NHibernate Query Generator for all of our data access. Although this is a great way to retrieve our data, there is another option we can play around with -- LINQ for NHibernate. To set this up in our existing application (see Part 1, Part 2, Part 3 and Part 4 on creating the ASP.NET MVC Application) we'll first need to grab the code out of subversion https://rhino-tools.svn.sourceforge.net/svnroot/rhino-tools/experiments/NHibernate.Linq/ and build it using MSBuild or Visual Studio. After that we want to add a reference to it in our application.

Simple Code 

Next we'll want to update our controller to use Linq for NHibernate instead of NHQG (Service layer would be better place for this type of code but since this is a demo it'll be okay -- for more on using a service layer to handle all the repository code check out Michael Hanney's post on ActiveRecord, NHibernate and ASP.NET MVC). The initial NHGQ code is:

var p = Repository<Product>.FindOne(Where.Product.Title == ID);


Our LINQ for NHibernate query will look like this:

            var p = (from item in UnitOfWork.CurrentSession.Linq<Product>()

                        where item.Title == ID

                        select item).First();

It's pretty obvious that the Linq code is a bit longer than the NHQG code. Although that in itself is not a bad thing, it may turn some people away. Momentarily, we'll see some scenarios where Linq for NH is very useful.

Paging and Sorting 

One nice thing we can easily do with Linq for NHibernate is page and sort our data. If we simply want to get a list of all products it would look like this.  

            var p = (from item in UnitOfWork.CurrentSession.Linq<Product>()

                    select item

                    ).ToList()

To page/sort the data it's just a slight addition to the list all code.

            int itemsPerPage = 5;

            int startIndex = (ID.Value - 1)* itemsPerPage;

 

            var p = (from item in UnitOfWork.CurrentSession.Linq<Product>()

                    orderby item.Title ascending

                    select item

            ).Skip(startIndex).Take(itemsPerPage).ToList();


More Advanced Usage

Kyle Baley's article on Linq for Nhibernate shows a more interesting use for Linq for NHibernate; we can create a generic method that adds query criteria on the fly. This would make our code much more reusable so we're going to go ahead and make a demo class heavily based on these concepts.

    public class QueryHandler<T>

    {

        private IList<linqExpression.Expression<Func<T, bool>>>  _criteria;

        public QueryHandler()

        {

            _criteria = new List<linqExpression.Expression<Func<T, bool>>>();

        }

        public void AddCriteria(linqExpression.Expression<Func<T, bool>> LambdaFunc)

        {

            _criteria.Add(LambdaFunc);

        }

 

        public IList<T> GetList()

        {

            var query = from item in UnitOfWork.CurrentSession.Linq<T>()

                        select item;

            //Tack on our query Criteria

            foreach (var criterion in _criteria)

            {

                query = query.Where<T>(criterion);

            }

            return query.ToList();

        }

    }

Here, we've created a class that has a private list of criteria, a method to add criteria to the list and a method to get the list based on the given criteria. I realize it may be a little intimidating but we can perfom most of our select queries through this method due to the use of Generics. 

Updating the controllers to use this functionality is not too difficult. For pages that simply retrieve lists we call the GetList method without specifying any criteria:

            var queryHandler = new QueryHandler<Product>();

            var p = queryHandler.GetList().Skip(startIndex).Take(itemsPerPage).ToList();

 Pass in new lambda expressions to add query criteria

            var queryHandler = new QueryHandler<Product>();

            queryHandler.AddCriteria(item => item.Title == ID);

 

            var p = queryHandler.GetList().First();


Now we see there are multiple options for interacting with our ActiveRecord Repository. Please let me know of any changes that you would make. I've updated the demo code in Assembla -- http://svn2.assembla.com/svn/NHibernateTest - Standard disclaimer does apply (some of the code is less than ideal but for learning it should be okay).

 

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList







© 2008 Ryan Lanciaux :: powered by BlogEngine.NET