www.csharpblog.net

Yes I got a new address for this blog – www.csharpblog.net. I think it is quite cool that I managed to get this domain name!
You can update your favourites or just keep going to the existing one!
Thanks again for reading.
Joe
wpid-wpid-301674714449860609-281390379838761081-2007-11-25-00-12-2007-11-25-00-12.gif

Advertisements

Subversion & Visual Studio 2008 – Part 1

Most .NET developers would be comfortable working with Visual SourceSafe (VSS) when it comes to source control. VSS is good but there are several problems with it and with Team Foundation Server (TFS). First of all they are all very expensive, do not offer a very good disconnected model (“meaning that it is quite hard to work offline”). VSS also expects you to pretty much exclusively check out a file before working on it, making it harder for large teams to work together. Finally VSS and TFS’s automated build system are very heavy and do not really offer immediate deployment to development servers. But again that is only my opinion.
On the other hand Subversion (initiated in 2000 by CollabNet) is a very light, open-source and free alternative to VSS that requires minimal maintenance once installed and configured. A lot of large and well known organisations such as Google use Subversion. Arguably Subversion and CruiseControl.NET (CC.NET), a continuous build system, are more difficult to install and configure than VSS is. There’s more to it that just double-clicking an executable file like with VSS. Hopefully the series of articles on this subject will aim to provide you with a solid guide on how to configure them.
During this series, I will be using Virtual PC to demonstrate how to setup a Subversion server and a development machine. I will be setting up two different virtual machines, one running Windows Server 2008 RC0 Web Edition (this will host the Subversion server) and one running Windows Vista Home Premium with Visual Studio 2008 (this will be development workstation).
1. Setting up Apache Web Server on Subversion server machine
This guide assumes that you have already installed and configured successfully Windows Server 2008 (W2K8) RC0 Web Edition. Below is a screen shot of my server’s about screen.
wpid-wpid-aboutserver_thumb11-2007-11-25-00-05-2007-11-25-00-05.jpg
Please note that you can use Standard Edition for this as well. As a matter of fact you do not need any of the web features of W2K8 if you are only going to use this server as a Subversion repository. I decided to use the Web Edition because I will be using this server later on in this series as a web development server.
Subversion on its own gives you access remotely to the source repository only via the custom Subversion SVN protocol (default port 3690). But you can still access your repository via the HTTP/HTTPS protocols as well, with the help of a web server. Unfortunately using IIS with Subversion is extremely difficult and almost impossible. The server of choice, recommended by Subversion developers, is Apache a free web server that can run as well on a Windows platform as it does on Linux.
So once you have W2K8 installed and configured, you will need to first install Apache on your server. You can download Apache 2.0 here. I will be using version 2.0.61. There are later versions than this but are not as stable with Subversion. There are two options here you can either download a version without SSL support or with Open SSL support. I will be using the non SSL version. If though you will be providing access to your repository remotely over HTTPS then you should install the Open SSL version. I chose to download apache_2.0.61-win32-x86-no_ssl.msi.
Once you have downloaded the Apache setup executable you can go ahead and start the setup. It is straight forward really. Just fill in your server details as in the screenshot below and then choose Typical Install.
wpid-wpid-apacheinstall1_thumb2-2007-11-25-00-05-2007-11-25-00-05.jpg
Once the installer completes you should see a new tray icon appear and if all has gone smoothly the icon should be a green play-like icon.
wpid-wpid-apacheicon1-2007-11-25-00-05-2007-11-25-00-05.jpg
You can check your server’s installation by navigating in your browser to http://localhost. If you had IIS installed prior to installing Apache there is bound to be a conflict as the default port for both is port 80. To avoid this please change the default port of IIS prior to installing Apache. You can afterwards change Apache to listen to a different port (i.e. 81).
In the next article I am going to show you how to setup Subversion to work with Apache.
wpid-wpid-301674714449860609-5812906568474385020-2007-11-25-00-05-2007-11-25-00-05.gif

Subversion can play well with .NET

I don’t know about you, but I never really liked Visual Source Safe. Don’t get me wrong I love Microsoft products, but somehow I do not think VSS cuts the mustard.
Subversion is a much more light-weight, open-source, disconnected source control system that works and plays really well with Visual Studio 2008 and .NET.
In the coming days I will try to give a comprehensive guide in setting up Subversion, automated builds and integrating it with Visual Studio 2008.
The articles are to be organised as follows:

  1. Subversion & Visual Studio 2008
  2. CruiseControl.NET – Automated Builds
  3. Visual Studio 2008 Subversion Integration
  4. Other CruiseControl.NET Integration Stuff (FxCop etc.)

I hope you find this interesting. I think it is really good stuff and an excellent development environment. But let me know what you think before I start writing!

Visual Studio 2008 Review – Part 1

Visual Studio 2008 is finally here. It brings more enhancements and language features than any previous version of the Microsoft IDE. I will try to review some of these as time goes on. Today I will focus on some of my first and most obvious additions to features and the user interface of the IDE. Also I am including some screenshots to tempt all of you to download it and use it.

Find out more about purchasing Visual Studio 2008

First of all the traditional Microsoft splash screen – updated for this version:

The first thing you will notice once the IDE has finished loading is the new and slightly slicker menu and toolbars. The usual Recent Projects area and RSS news reader from MSDN are still there as well.

One of the greatest new features of Visual Studio 2008 is the ability to choose which version of the .NET Framework you wish to target your new project. Have a look at the highlighted drop down list in the New Project window. This new feature is very powerful. It will allow developers still working on legacy versions of the .NET Framework to still take advantage of the new IDE features.

One of my favourite new features is the new split view of web pages. The new view allows you to edit the source of page but still view the design of the page at the same time. This feature works well but the synchronisation of the content is not immediate. Most times for changes to appear in the design split view you need to save your code.

One of the final little helpful features I will show in this post, is the window switcher (ctrl + tab) inside the IDE. As you know using this combination allows to switch between documents in an MDI environment. Microsoft decided to add a bit of Vista magic to Visual Studio. Even though it is not as good as Flip 3D, using this feature now allows you to get a small preview of your window contents (like alt + tab in Vista)!

Hope this got your appetite going – more soon!
wpid-wpid-301674714449860609-584779541894842443-2007-11-20-10-04-2007-11-20-10-04.gif

Coding Tip 2 – Fields Change

wpid-wpid-bulb-2007-11-19-12-49-2007-11-19-12-49.jpgTip 2 – Non-constant fields should NOT be visible

Static fields that are neither constants nor read-only are not thread-safe. Access to such a field must be carefully controlled and requires advanced programming techniques for synchronizing access to the class object. Because these are difficult skills to learn and master, and testing such an object poses its own challenges, static fields are best used to store data that does not change. This rule applies to libraries; applications should not expose any fields.

Example:

WRONG: public static DateTime publicField = DateTime.Now;
//This is wrong because the field is public and not a literal

CORRECT:
public static readonly DateTime literalField = DateTime.Now;
//Correct because it is a literal read-only field
static DateTime privateField = DateTime.Now;
//Correct because it is a private field.

Coding Tip 1 – Evil Strings

Starting today I will be posting a weekly coding tip that will hopefully help us all avoid common mistakes and errors.

wpid-wpid-bulb1-2007-11-15-13-37-2007-11-15-13-37.jpgTip 1 – Evil Strings (Avoid Unnecessary String Creation)

Avoid creating strings unnecessarily. When converting strings to upper or lowercase, cache the result where necessary rather than duplicating a previous string creation. Prefer string.Compare over converting strings to upper or lowercase when performing case-insensitive comparisons. Do not create strings that are not subsequently assigned to variables. Unnecessary string creation degrades performance.

Example:

WRONG: if (string1.ToLower() == string2.ToLower()) //case insensitive string comparison
CORRECT: if (string.Compare(string1, string2, true) == 0) //case insensitive string comparison

To blog or not to blog

My name is Joseph Megkousoglou – I know it is a bit of a mouthful.

I work for Knight Frank in London. Knight Frank is the largest privately owned property services firm in the world, you can read more about them on Wikipedia. My title is Associate, Senior Lead Developer and I am responsible for the web site software engineering team at the firm. We have a number of web sites that help the firm advertise all its properties and services. You can have a look at our UK one here.

Prior to working at Knight Frank I was a Senior Software Engineer and Technical Manager for AKQA, a leading digital agency in London. During my time at AKQA, I worked mainly on the Sainsburys.co.uk and Dominos.co.uk web sites. I was also involved in other work with Microsoft, Xbox and Gucci.

I feel that, after working professionally as a Software Engineer for over 8 years and with almost 20 years of software development experience, I should help others via my blog. I will try to post technical articles relating to Microsoft programming technologies (namely C# and .NET).

I currently hold a BSc in Computer Science (Brunel University) and an MSc in User Interface Design (London Metropolitan University).

I hope you will find this blog useful and that you will visit regularly.

To blog then it is.

Joe
wpid-wpid-301674714449860609-2138800219470312702-2007-11-15-12-54-2007-11-15-12-54.gif