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 remove SVN metadata using PowerShell

Recently I decided to write a PowerShell script that will delete all directories named ".svn" from given directory and all subdirectories (which effectively removes all SVN metadata). On the Stack Overflow website I've found a command which will do what I need:

Get-ChildItem $path -Recurse -Force *.svn |
    Where {$_.PSIsContainer} | Remove-Item -Recurse -Force

And what turned out? The result of its execution is correct, but PowerShell displays ugly error messages by the way:

PowerShell: Remove-SvnMetadata

To get rid of these errors, I recommend using two subsequent commands:

$itemsToRemove = Get-ChildItem $path -Recurse -Force .svn |
    Where {$_.PSIsContainer}
$itemsToRemove | Remove-Item -Recurse -Force

Of course, these commands can be put into a script file which will take the directory path as a parameter. To do this, you should create a file named for example Remove-SvnMetadata.ps1 with the following content:

$itemsToRemove = Get-ChildItem $args[0] -Recurse -Force .svn |
    Where {$_.PSIsContainer}
$itemsToRemove | Remove-Item -Recurse -Force

To use the script, you should place it in a directory that is present in your PATH environment variable (I use C:\Users\BlaSOFT\scripts) or just in PowerShell console go to directory containing the script (then before the script name you should put .\). This is an example call which will remove all SVN metadata from D:\Temp\20110507 directory and all its subdirectories:

Remove-SvnMetadata.ps1 D:\Temp\20110507

I would like to say that I am also aware of the existance of Export function in SVN (svn export), but the solution I presented allows us to do the task even if we don't have any SVN client available in the system (or we don't want to use SVN for some reason).

How to "fix" Power Manager gadget after IE9 installation

In my previous post I wrote that after IE9 installation on my laptop, the transparency of Lenovo Thinkpad PowerManager gadget was broken down. Some time passed from that moment, meanwhile Lenovo released an PowerManager update, but the gadget still doesn't work properly. Because of that, I decided to fix the problem myself.

After some experimenting, I found the reason of broken transparency and figured out a way to bypass the problem. It turned out that the bug is not in the gadget, but in Internet Explorer. Installation of IE9 introduces the following bug. After every value assignment to document.body.style.backgroundImage, the PNG background transparency is toggled on/off. Knowing exactly where the bug is I prepared a small, step-by-step tutorial on how to fix the gadget on our own:

  1. Create some temporary working folder (in my case it was D:\Temp)
  2. Copy PWRMGR.JS file into the temp folder. The file can be found in the gadget folder (in my case it's C:\Program Files\Windows Sidebar\Gadgets\PowerManager.Gadget\EN-US)
  3. From http://www.virtualconspiracy.com/content/scrdec/download download the scrdec18.exe tool and save it in the temp working folder
  4. Open Command Prompt in the temp folder. It can be done for example by holding Shift key, right clicking somewhere in the Windows Explorer window (but not on a file icon) and selecting the "Open command window here" option
  5. Decode the PWRMGR.JS, file by issuing the following command:
    scrdec18 pwrmgr.js pwrmgr_dec.js
  6. Open the decoded file - pwrmgr_dec.js - in some text editor (i.e. Notepad++)
  7. Find the resizeView() function
  8. Inside that function, replace every occurance of
    BK.style.backgroundImage
    with
    BK.style.backgroundImage = BK.style.backgroundImage

    The replacing will be necessary in 3 places, totally. Then, we save the changes, of course.

  9. Delete file PWRMGR.JS from the temp directory. Next, rename pwrmgr_dec.js into PWRMGR.JS
  10. From our temp working directory, copy PWRMGR.JS file into the folder from whick we took its original version. (in my case it's C:\Program Files\Windows Sidebar\Gadgets\PowerManager.Gadget\EN-US). Allow overwriting the file.
  11. We're done! For the changes to be visible we now have to restart the sidebar.exe process. It can be done for example by logging out and logging in again. Instead of that I recomend to issue the following command in the Command Prompt:
    tskill sidebar && "%programfiles%\Windows Sidebar\sidebar.exe"

Of course, after performing all the above steps we are free to delete the temporary working directory.

Internet Explorer 9 - first look

Today, final version of the latest web browser from Microsoft has become available. Because I always prefer using up-to-date software versions (unless there are serious reasons against it), I installed IE9 in my laptop as soon as I could and decided to share my first impressions. Before I begin I need to say that for now, Opera is my browser for casual, everyday use. However, due to the fact that there are some websites that don't work properly with Opera, sometimes I have to use some other browser - in most cases it's Internet Explorer. Moreover, I almost always use IE to browse Microsoft websites (e.g. MSDN, TechNet) because I think that these pages are optimized for use in Internet Explorer. I just want to be certain that everything will be working as expected. So, after testing the IE 9 for a while my observations are the following:

  • program launches and closes faster, than IE8
  • tabs open way faster (in case of IE8 I had to wait 1-2 seconds for a new tab to open)
  • rendering speed improvement is very noticable (it's because of the new, optimized engine that leverages hardware acceleration) - for example, in case of imaginecup.com I can see a huge difference
  • I like the new, reorganized user interface in which there is more space for webpage, whereas browser window controls take up less space
  • transparency in ThinkPad PowerManager Gadget stopped working :(

Here is the screenshot that shows how ThinkPad PowerManager gadget looks like after installing IE9:

PowerManagerGadgetBugScreenshot

I hope that lenovo releases some patch soon.

I have to say that Internet Explorer 9 is definitely worth downloading and installing, even if IE is not our default browser and we rarely used it. Internet Explorer is pretty heavily integrated with Windows OS and we often don't even realize that some third-party applications use IE engine as an "embedded browser"  (e.g. Vuze built-in serach). It's just better to have IE9 than IE8. It gives us greater user experience, improved security and many more cool features.  And now the question is: will Internet Explorer 9 become my "main" web browser? No. Not yet. There are still some issues that stop me from migrating, for example:

  • IE9 doesn't have automatic page refresh option (e.g. refresh every 30 seconds)
  • IE9 doesn't have Opera Link equivalent (yes, there is Live Mesh but it can't synchronize bookmarks with any browser in my Symbian phone)
  • IE9 doesn't have Opera Turbo equivalent

However, don't get me wrong. I truly think that Internet Explorer 9 is a huge step forward. I really recommend installing and using this product, but for now I'll stick to Opera.

What is TIC and how to use it?

Sorry, this post is available only in Polish.