Yet Another Forum (YAF) for Windows Azure

Lately, while I was learning the basics of Windows Azure, I tried to deploy Yet Another Forum 1.9.5.5 to the Azure platform.

It turned out that it's not that easy as the differences between SQL Server and SQL Azure can be quite painful despite the fact they theoretically aren't so big. Because SQL Azure requires every table to have CLUSTERED INDEX, I had to modify the YAF's database setup SQL scripts accordingly. Moreover, in the application code there were some places where I had to remove calls of the obsolete SQL stored procedures (those which are not supported in SQL Azure) and replace them with the non-obsolete ones. Also, there were some glitches with .config files, so I had to move some of the settings directly to the web.config.

However, I've eventually managed to prepare a working version of Yet Another Forum which is compatible with Windows Azure and SQL Azure. In this post, I'd like to publish the modified source code - I hope it'll be useful for someone out there :).

Here are the steps you need to take in order to prepare ready-to-deploy Azure package:

  1. Install Windows Azure SDK if you haven't done this yet.
  2. Download YAF source code (link below) and extract it somewhere on the hard drive.
  3. Open yetanotherforum.net-2010.sln with Visual Studio 2010.
  4. In YAF project, open db.config and fill the database information (server address, database name, login credentials, etc.).
  5. In YAF project, open mail.config and fill the SMTP mail server information.
  6. In YAF project, open web.config. Review the settings and change them if necessary.
  7. Compile the solution.
  8. In Solution Explorer, right click the YAF.Azure project and choose Package... option to create Azure deployment package
  9. Go to the Windows Azure Management Portal and upload the package along with configuration file (both can be found in the app.publish directory

And finally, the most important thing:

 

YAF Download Link (GNU GPL v2 license):
Yet Another Forum v1.9.5.5 for Windows Azure

 

How to use TFS 2010 without launching VS 2010

Visual Studio 2010 is a very demanding IDE, as far as hardware requirements are concerned. Due to that fact, its usability on low-end machines (e.g. netbooks) is seriously limited. However, sometimes we might need to use such kind of "weakly equipped" computer to work on some project which is developed with Visual Studio 2010 and Team Foundation Server 2010. In this post I will show you how to do the following activities without the need of launching the whole Visual Studio IDE:

  1. Download latest versions of project files from the TFS
  2. Edit one of the files using an editor with syntax highliting
  3. Upload modified file to the TFS

To do this, in fact we need to perform the following steps:

  1. Create a new workspace
  2. Get the latest versions of project files
  3. Check Out a file
  4. Modify a file
  5. Check In the modified file

We won't launch Visual Studio, but it has to be installed on our machine. Further description is based on the following configuration:

TFS address: http://tfs-server:8080/tfs
Project Collection name: DefaultCollection
Team Project name: TeamProject1
Source Control project directory: $/TeamProject1

So let's begin. We will use tf command-line utility, which was installed along with VS IDE.  First, we have to open Visual Studio Command Prompt, which can be found in Start Menu.

Then, we create a new folder and change current dir to that folder:

Now, we create a new TFS workspace and name it TeamProject1Workspace:

tf workspace /new ^
  /s:http://tfs-server:8080/tfs/DefaultCollection/ TeamProject1Workspace

It might be necessary to enter our TFS credentials:

Next, we can verify displayed settings and click OK:

Finally, we are able to get latest versions of TeamProject1 files which are stored in Source Control:

tf get TeamProject1 /recursive

After downloading, all files have "read only" attribute set, because they shouldn't be modified before they're checked out. Now we may enter the directory which contains file we want to edit:

We perform Check Out:

tf checkout Program.cs

Now we can open and modify this file, for example using the free and lightweight Notepad++ text editor:

After making some modifications, we save changes and close the editor. Now, we perform Check In:

tf checkin Program.cs

And that's it! We're done :)

If we would like to work on the same team project in future, we won't need to create new TFS workspace. We can just use tha one that was created before. However, before starting our work I recommend downloading latest versions of files with tf get some_path /recursive command.

On the other hand, if we're not going to work on this project (using the same computer) any more, we are free to delete the TFS workspace and remove the working directory along with it's content:

tf workspace /delete TeamProject1Workspace

Microsoft Visual Studio 2008 - first steps

Some time ago, I've noticed that many novice C++ programmers still use obsolete Dev-C++ IDE, which is in my opinion quite uncomfortable and buggy. I wonder why they won't try something else, e.g. Code::Blocks or... Microsoft Visual Studio. I think it's one of the best IDEs for Windows. At first glance, one might feel a bit overwhelmed with the huge number of features it offers. The truth is that when one learns the basics, VS appears to be very easy and convenient in use. To prove it, I've written the short step-by-step tutorial showing how to compile the simpliest "Hello World" program with Visual Studio 2008:

  1. Choose File --> New --> Project...
  2. Select  Win32 Console Application template and click OK.
  3. Click Next.
  4. Deselect Precompiled header option and click Finish.
  5. Go to Solution Explorer. If it isn't shown by default, you can make it visible by choosing View --> Solution Explorer menu option. Then delete the following files: stdafx.h, targetver.h, stdafx.cpp and ReadMe.txt .
  6. There should be only one .cpp file left. Its default content looks like this:

    We will make it simplier by removing fragments marked red:

    // HelloWorld.cpp : Defines the entry point for the console application.
    //
    #include "stdafx.h"
    
    int _tmain(int argc, _TCHAR* argv[])
    {
        return 0;
    }

    So the modified code is:

    int main()
    {
        return 0;
    }
  7. Now you can type some simple C/C++ code and press F5 to compile and run the application.
As you can see, Visual Studio is not so scary and I'm sure that every programmer (even beginner) can successfully use it. So why won't you have a try?