Wednesday, August 26, 2009

Xcode and SVN

Today was my first time trying to work with Xcode 3 and Subversion. Using two separate Macs to check out the shared project from SVN, I quickly discovered that it was not as straight forward to work with Subversion from inside Xcode as I had hoped (and come to know from NetBeans and Eclipse).

First of all, only one of the Macs successfully set the SCM repository after the checkout on the other one I had to manually set the repository after checkout. I think I did the very same steps on both Macs but behaviour was different - how strange.

Next thing I noticed: if you'd like to update your project but have a file already displayed in the editor, make sure you use Refresh Entire Project before selecting Update Entire Project. It seems that without calling Refresh, the file is indeed updated on the file system but the change won't be visible within the editor unless you choose a different, external editor to open the file.

If anybody can shed some light on the issue, let me know in the comments!

Friday, August 7, 2009

JsUnit

If you happen to run into problems with the Test Runner page of JsUnit in Firefox, try setting the property Security.fileuri.strict_origin_policy on your about:config page to false. Unless you do that change, the Test Runner will come to a halt while displaying the "Opening test page ...." message.

Wednesday, August 5, 2009

Transaction Logs in MS SQL Server 2005

The other day I tried to find a solution for an excessively large transaction log file in one of our production systems. It grew to an astonishing 40 GB which set off some alarms. Our middleware service provider offered to take care of this problem for a rather high monthly fee that I didn't feel like paying: after all, how difficult could it be to shrink that stupid file and keep it under control?

Turns out it with a little trickier than I thought. I, actually, have never used MS SQL Server before and have never come across any transaction logs I had to take care off. In my previous server-based project we worked with MySQL which did not provide such a facility (and I shall stand correct if you show me where I missed it). So off I went to find some information about the transaction logs for MS SQL Server and, in theory, things were supposed to be easy: execute two SQL statements, one backing up the transaction log, the other shrinking the log file - that's it.

Backing up worked (with a 40 GB log it took quite some time, of course) like a charm but shrinking did not seem to work. Once I found the command
DBCC SQLPERF (logspace)
I was at least able to verify that the backup had worked and had really set the records in the log to inactive. After some more trial and error I found that I had just passed the wrong parameter to shrinkfile: instead of the database name it expects the name of the log file (excluding the file extension.

A long story short, the following two commands executed in SQL Management Studio will successfully backup and shrink your transaction log file:
USE [database];
BACKUP LOG [database] TO DISK = '[filename]';
DBCC SHRINKFILE ([name of transaction log without extension or quotes], 1);
Here's a more tangible example:
USE BenDB;
BACKUP LOG BenDB TO DISK = 'C:\Backup\BenDB_log.bak';
DBCC SHRINKFILE (BenDB_log, 1);
Hope this can save you some time one of these days.