Monthly Archives: April 2007

Dockpanels instead of the taskbar

As I said before I really like the concept of dock panels over the taskbar with start menu.

And when I was searching for something on the net I stumbled on this link to the stardock website. Apparently they have created something like that. It’s freeware and above all it’s pretty :)

I hope you like it as much as I’m enjoying it.

Disclaimer:
I am in no way getting an incentive for this anouncement. I just like this piece of software.

Subversion vs Team Foundation

I work at Xero and we were using Sourcesafe, which we always knew had to be replaced sometime.

http://www.codinghorror.com/blog/archives/000660.html

I have some experience with most of the source control systems out there. We decided to go with Team Foundation Server the reasons for it being :

  • High level of integration with visual studio 2005
  • Easily extensible with C#
  • It is currently v1, which translates to me as 2 more versions and it will be the most awesome tool out there
  • Based on Sql Server

Why didn’t we choose for Subversion, you may ask ?

  • It’s a microsoft shop we don’t need cross-platform tools
  • Not based on Sql Server
  • No webservices api ready to be consumed

I personally like the way subversion stays out of the way and you don’t have to explicitly check stuff out. But I don’t like the decentralised way of managing it.

The tools that come with Team Foundation Server, even though it’s only v1, look more slick and handle a lot better than the tools that come with Subversion.

Since everybody in our team was already familiar with source safe which made the learning curve virtually non existent.

All in all taking all the variables into account we decided that Team Foundation Server was a much better solution for our needs than subversion.

 

If you want to read some other peoples thoughts on the subject, Ayende and Roy Osherove  have been having a discussion about it through their blogs.


http://ayende.com/Blog/archive/2007/04/29/CodePlex-TFS-and-Subversion.aspx

http://weblogs.asp.net/rosherove/archive/2007/04/29/tfs-or-not-being-a-perfectionist-is-a-realistic-world.aspx

http://ayende.com/Blog/archive/2007/04/29/TFS-Zero-Friction-and-living-in-an-imperfect-world.aspx

http://weblogs.asp.net/rosherove/archive/2007/04/29/what-source-control-tool-do-you-use-and-more-on-tfs-vs-open-source-tools.aspx

http://ayende.com/Blog/archive/2007/04/29/TFS-Vs.-Open-Source-tools.aspx

http://weblogs.asp.net/bsimser/archive/2007/04/29/tfs-vs-open-source-the-battle-rages-on.aspx

http://ayende.com/Blog/archive/2007/04/29/Exensability-Ask-and-you-shall-recieve.aspx

Want to start using monorail but don’t quite know how ?

There are a couple of excellent resources available online.

Screencasts :
http://colinramsay.co.uk/2007/04/17/getting-started-with-monorail-screencast-one/
http://colinramsay.co.uk/2007/04/18/using-monorail-screencast-two/
http://colinramsay.co.uk/2007/04/19/databinding-and-activerecord-screencast-three/

 

Tutorials:
http://blog.bittercoder.com/PermaLink,guid,b298cbe4-6eff-4783-a2a1-c95e344a9de5.aspx
http://blog.bittercoder.com/PermaLink,guid,195c3d13-faf8-4f5e-8faf-861d02b0fc2e.aspx

What I would like to see changed in vista

I do see the benefit of UAC in vista but I would like it to have some type of timeout or program context so that when I open visual studio for example I don’t have to click allow for every instance I open (I often have 3 instances open)

I would definitely like to get more control over the UI.

The taskbar had out lived it’s usefullnes back in windows 98 I would love to see some panels like they have in gnome or some taskbar like mac has or a similar higly customizable option. so that i am not plagued by all those windows.

That would also solve the debacle of the shutdown menu options because a user can ultimately change what is there.  I’d like to see power more power for the people.

Tagging for any type of file would also be great and a search that works a bit faster.

I’m sure the people at Microsoft are really smart people that would be able to decouple the interface from the underlying functionality.

These customizable options are really nice and would in turn build a whole new type of community.

There will probably be more coming.. but this concludes this post for today.

Great tutorials on castle

Alex Henderson has been very busy writing a tutorial series on how to properly use and understand castle’s windsor container.

You can find them here Container tutorials

Check them out :)

Humanizing timespans in .NET

After a couple of months getting into ruby on rails I got back to .NET development, as well as back to NBlogr and back to blogging.

Now for replies I saw on some blogs the format < replied 1 month, 5 days, 2 hours and 13 minutes ago.  I wanted to find out how they did that and my first reaction was.. yay easy hello timespan.

Turns out that timespan only goes up to days, no months or anything.  A bit deeper hidden for a c# programmer there is the function datediff in vb.net  But that function doesn’t handle years properly for example the difference between today 01/01/2007 15:15 and 31/12/2007 18:00 gives a difference of 1 year instead of 1 day. So I decided to write my own class for it, turns out that the solution is quite simple.

To use the class below one would do :
NBlogr.Common.TimeSpan ts = new NBlogr.Common.TimeSpan(someStartDate, someEndDate);
string humantime = ts.ToString() + ” ago”;

 The class :

/*

 * Created by: Ivan Porto Carrero

 * Created: Thursday, 12 April 2007

 */

 

using System;

using System.IO;

using System.Text;

 

namespace NBlogr.Common

{

    public class TimeSpan

    {

        private DateTime startDate;

        private DateTime endDate;

        private int startDay;

        private int endDay;

        private int startMonth;

        private int endMonth;

        private int startYear;

        private int endYear;

        private int startHour;

        private int endHour;

        private int startMinute;

        private int endMinute;

        private int startSecond;

        private int endSecond;

        private int diffMonth;

        private int diffDays;

        private int diffHours;

        private int diffMinutes;

        private int diffYear;

        private int diffSeconds;

        private bool hasCalculated;

 

        public TimeSpan()

        {

            hasCalculated = false;

        }

 

        public TimeSpan(DateTime startDate, DateTime endDate)

        {

            StartDate = startDate;

            EndDate = endDate;

        }

 

        private void initialize()

        {

            startDay = StartDate.Day;

            endDay = EndDate.Day;

            startMonth = StartDate.Month;

            endMonth = EndDate.Month;

            startYear = StartDate.Year;

            endYear = EndDate.Year;

            startHour = StartDate.Hour;

            endHour = EndDate.Hour;

            startMinute = StartDate.Minute;

            endMinute = EndDate.Minute;

            startSecond = StartDate.Second;

            endSecond = EndDate.Second;

        }

 

        public override string ToString()

        {

            StringBuilder sb = new StringBuilder();

 

            if (Years > 0)

                sb.Append(pluralise(“year”, Years));

            if (Months > 0 && Years > 0)

                sb.Append(“, “);

            if (Months > 0)

                sb.Append(pluralise(“month”, Months));

            if ((Months > 0 || Years > 0) && Days > 0)

                sb.Append(“, “);

            if (Days > 0)

                sb.Append(pluralise(“day”, Days));

            if ((Months > 0 || Years > 0 || Days > 0) && Hours > 0)

                sb.Append(“, “);

            if (Hours > 0)

                sb.Append(pluralise(“hour”, Hours));

            if ((Months > 0 || Years > 0 || Days > 0 || Hours > 0) && Minutes > 0)

                sb.Append(“, “);

            if (Minutes > 0)

                sb.Append(pluralise(“minute”, Minutes));

            if ((Months > 0 || Years > 0 || Days > 0 || Hours > 0 || Minutes > 0) && Seconds > 0)

                sb.Append(“, “);

            if (Seconds > 0)

                sb.Append(pluralise(“second”, Seconds));

 

            return sb.ToString();

        }

 

        private void calculate()

        {

            initialize();

 

            diffYear = endYear – startYear;

            calculateMonths();

            calculateDays();

            calculateHours();

            calculateMinutes();

            calculateSeconds();

 

            hasCalculated = true;

        }

 

        private static string pluralise(string singular, int quantity)

        {

 

            return quantity != 1 ? string.Format(“{0} {1}”, quantity, singular + “s”) : string.Format(“{0} {1}”, quantity, singular);

        }

 

        private void calculateMonths()

        {

            if (endMonth >= startMonth)

                diffMonth = endMonth – startMonth;

            else

            {

                diffYear–;

                diffMonth = (12 – startMonth) + endMonth;

            }

        }

 

        private void calculateDays()

        {

            if (endDay >= startDay)

                diffDays = endDay – startDay;

            else

            {

                diffMonth–;

                diffDays = (DateTime.DaysInMonth(startYear, startMonth) – startDay) + endDay;

            }

        }

 

        private void calculateHours()

        {

            if (endHour >= startHour)

                diffHours = endHour – startHour;

            else

            {

                diffDays–;

                diffHours = (24 – startHour) + endHour;

            }

        }

 

        private void calculateMinutes()

        {

            if (endMinute >= startMinute)

                diffMinutes = endMinute – startMinute;

            else

            {

                diffHours–;

                diffMinutes = 60 – startMinute + endMinute;

            }

        }

 

        private void calculateSeconds()

        {

            if (endSecond >= startSecond)

                diffSeconds = endSecond – startSecond;

            else

            {

                diffMinutes–;

                diffSeconds = 60 – startSecond + endSecond;

            }

        }

 

        public int Months

        {

            get

            {

                if (!hasCalculated)

                    calculate();

                return diffMonth;

            }

            set { diffMonth = value; }

        }

 

        public int Days

        {

            get

            {

                if (!hasCalculated)

                    calculate();

                return diffDays;

            }

            set { diffDays = value; }

        }

 

        public int Hours

        {

            get

            {

                if (!hasCalculated)

                    calculate();

                return diffHours;

            }

            set { diffHours = value; }

        }

 

        public int Minutes

        {

            get

            {

                if (!hasCalculated)

                    calculate();

                return diffMinutes;

            }

            set { diffMinutes = value; }

        }

 

        public int Years

        {

            get

            {

                if(!hasCalculated)

                    calculate();

                return diffYear;

            }

            set { diffYear = value; }

        }

 

        public DateTime StartDate

        {

            get

            {

                if (startDate == null)

                    throw new InvalidDataException(“You need to specify a start date”);

                return startDate;

            }

            set

            {

                hasCalculated = false;

                startDate = value;

            }

        }

 

        public DateTime EndDate

        {

            get

            {

                if (endDate == null)

                    throw new InvalidDataException(“You need to specify a end date”);

                return endDate;

            }

            set

            {

                hasCalculated = false;

                endDate = value;

            }

        }

 

        public int Seconds

        {

            get { return diffSeconds; }

            set { diffSeconds = value; }

        }

    }

}

Got a pair of super headphones

My ipod headphones died on me.. so it was time to get some new stuff and preferrably better than what I had.

Because I’m a cheap skate and I find it a bit of a ridiculous sight to have these huge headphones on my head when walking down the street.

I went for the Bose in-ear headphones.

And man they are well worth the money.. I can finally get proper bass and the noises from the office/street are drastically pushed to the background.

PowerShell in the Vista Sidebar!

JD and JB are at it again.. This time they give us a powershell gadget for the vista sidebar. It’s a really cool toy.. and a valuable resource for those wanting to create a sidebar gadget.

Feel free to digg them.

Link to Digg – PowerShell in the Vista Sidebar!

Preview Handler Pack updated

I’m happy to let you know that Tatham Oddie and I have updated the preview handler pack he wrote a while ago. This pack now supports ruby, erb and rjs.

Tatham added javascript support to the pack. And I took care of the ruby side.

Thanks again to Tatham for creating the extension.

Support for ruby :

Support for javascript:

You can read all about it here :

First release of the handler pack:

http://blog.tatham.oddie.com.au/2006/12/20/vista-and-office-2007-preview-handler-pack-released/

 

Update

http://blog.tatham.oddie.com.au/2007/04/04/ruby-and-jscript-support-added-to-preview-handler-pack/