Categories
Agile Community Startup

Hack Cafe Idea

I believe in startup communities. Idealistic, some may say but I like to think that I never stopped believing in doing small (or big) things to make the world a better place and startups contribute a lot.

And one way to help build those communities is having a space to encourage it.
Sharing one idea I’ve been thinking (and hoping) can be implemented in Manila and Philippines (my home country) in general. I’m sure I’m not the only one but sharing nevertheless and if someone beats me to it all the better.

A coffee place where generating great ideas/work comes first before great (or even just good coffee).

Disclaimer: I do not claim any intellectual property on this (and in fact this is brought upon by different ideas from friends and people I’ve met). I hope that by sharing this, it becomes real (or if it’s already real I can help market/support it)

Categories
Agile Career Growth Tools and Utilities

remove/delete svn folders

Since I’ve been using SVN and stumbled upon this technique I’ve also been using since then

This is one of the many (but easiest way) to remove SVN folders (.svn) recursively from a given folder. Effectively “unbinding a folder from SVN

Follow these easy steps: [more]

1) download this registry file : DeleteSVNFolders.reg (313.00 bytes) – see below notes for more information (security issues/verification and code source). I urge you to review them but if you don’t want to worry about the details and trust me enough then please go ahead and download.

2) double click on the file you downloaded

    you will be prompted to confirm that you really want to perform the action (differs depending on your OS). just continue and should all go well you will have a successful message/dialog

3) then to see it work go to the folder you want to remove the .svn folders from, then right click it

you should see the “Delete SVN folders” menu item

4) Click the said menu item and the .svn folders will be removed (there will be a command window that will show up displaying progress too – though if the folder structure is not that deep enough it might disappear very quickly).

 

And you’re done

** Notes

1) altering your registry not for the faint-hearted and you’d have to trust the author/publisher. In this case I do and I have been using it for years

    and if you could also look into it (edit e.g. notepad or text editor) and understand what it does if you want to make sure you’re not letting it do something you don’t want

    i have taken this from : Jon Galloway’s Shell Command – Remove SVN Folder and simply created the reg file to be downloadable (for those who are not so confident on how to deal with reg files)

Categories
.NET Agile Tools and Utilities

Link: Sandcastle Source Code published in Codeplex

After some issues regarding the license and terms of SandCastle in CodePlex, the project is now again available at CodePlex; this time with source code and not just the executable and documentation.

You can read more on this at this SandCastle blog post : Sandcastle Source Code published in Codeplex

Or go directly to their site at CodePlex : http://www.codeplex.com/Sandcastle 

Categories
Agile

Subversion Branches, Tags and Merges

I found this great article by Bill Simser on Day-to-day with Subversion where he explains practical use of Subversion branches, tags and merges. As a additional reading it might help if you read the documentation on branching and merging from the SVN Book from here but Bill's explanations made me understand better. And allow me to share my notes on this. [more]

I haven't had much experience on branching/merging with SVN yet but in the scenario presented in the article where you create a branch when you need to work on new features but maintain fixes on the currently deployed version in production what I've known is that the developer would work on the new features locally while the rest of the team works on main codebase (trunk). That poor developer will not check in any changes he/she made to the repository until he/she has it done.

From time to time the developer should retrieve/merge changes made to the trunk (to his/her working copy) to make sure that he/she gets the changes in increments rather than a whole bunch of merges when he/she finally checks in the code. This daily merge is applicable in both Bill's suggested approach and the one I've known (let's call it "no check ins until feature is done").

The disadvantage with "no check ins until feature is done" is that the poor developer looses any version control capability on his/her daily changes or worst since no check ins are made to the repository, once the local machine crashes, all those days/weeks of new features changes are bye bye.

So branching and merging may seem a little complicated than simply maintaining a trunk and doing all changes there and for any new feature no changes will be checked in until all changes to accomodate the feature is stable and integrated succesfully. But the former will enable the poor developer working on the new feature to version his/her own changes in his/her own small new features world and prevent the risk of loosing it bigtime.

Another common scenario when maintaining a trunk but poor developer still wants to check in small changes for the new feature from time to time is to comment out the new feature code before checking it in. In that way, there is revisions are tracked but doesn't affect the application since they're commented out. But this leaves us with a lot of commented out code not being used or as mentioned in the article, a ghost button where if clicked doesn't do anything or a cardinal rule which says "don't click this button, it's there but it's not implemented yet".

Warning though, branching and merging should not be abused too and would take some skill/experience to determine when to branch versus making the new version changes on the trunk directly. Out if my head I could think of simple refactoring and bug fixes should be made to the trunk but new major revisions such as migrating from .NET 1.1 to .NET 3.5 or architectural changes should go with branching/merging.

FInally, note that regardless of your approach to branching and merging vs.
making all changes to trunk, tagging on the other hand is another story
and must always be used when labelling/cutting versions.

Categories
Agile Tools and Utilities

VisualSVN Server

In a previos post on My SubVersion experience I received a comment from
Ivan Zhakov of VisualSVN to try out the said product (which by the way is free) and so I did. [more]

Not much to say except that it was an amazing experience. No issues with installation, simple but does it wizard steps (eg. option to use port or HTTPS, default repository folder et al) and an MMC management console. Now I don't have to edit config files manually and instead do it from a GUI. They also have a windows service to start VisualSVN which also handles the management of the Apache server.

As mentioned it comes with Apache installed, lets you choose which port to run apache and since I don't really need it running all the time the windows service did it for me. If you do need to tweak things in your apache installation I'm sure you could also do as you please since I can see the files are just in the VisualSVN installation folder (default ProgramFiles/VisualSVN). Not an apache guru here but the conf files are editable and probably so are the rest of the features (modules whatsoever).

No issues so far (and I hope for good). Good to know some things about SubVersion binary packages installation and some things you can do from command prompt but if don't want to complicate things and need a simple enough solution to have subversion working I suggest you use VisualSVN server as I do now.

Categories
Agile Tools and Utilities

My Subversion (Version/Source Code Control) Experience

I had a chance to look into subversion today and here are some of my notes. It's a version control system (source code control but it's really more than just code) along side Visual SourceSafe, SourceGear Vault among others. Why subversion [more]of all other is worthy of another post but first one, it's free (Vault is also free for single user/personal i think but in that case Subversion is more widely accepted in the community and some issues with JetBrains TeamCity support for Vault made me think that Vault may not be that frictionless when it comes to Continuous Integration – not sure if CruiseControl.NET supports it).

Moving on, there's just not much to say my experience but it just works. Some caveats since I haven't read the documentation and instead jumped right in but I'm happy with my first checkin/checkout after a few minutes.

1. I got the latest (i think) Windows Installer (with the basic win32 binaries) from the following link:
svn-1.4.6-setup.exe
.

Also note that you can get to this from their home page by clicking on Downloads from the treeview on the left of the site. Then go to the windows section. Furthermore you could reach the same page by clicking on Documents and Files from the same treeview on the left. After redirection to the Documents & files page, on the treeview that appears in the main content of the page, traverse subversion > releases > windows (or further to windows apache 2.2.x node for binaries built against the famous apache web server version 2.2).

2. Install (in my case I installed on a Virtual Machine I have with Windows XP)

4. I then created a sample repository by issuing the following command (command line dialog/cmd) "svnadmin create C:svntest_repository" where C:svntest_repository is an existing folder in my system. There are some articles that mentioned issues when the directory doesn't exist and rather than test and verify it, I created the folder before issuing the command (but feel free to try it and tell us how it goes). Looking at the C:svntest_repository directory I found new directories/files created so on the right track here.

6. Then I was wondering now that I have SVN setup, what will be my server URL? I have worked with http/https/svn URLs before but merely as a client who connects to it. I tried to connect to it using SmartSVN (client) which I'm already familiar wit. You can also use TortoiseSVN but coming from Visual Source Safe and Vault background, I prefer not to work with SVN from the windows explorer (as TortoiseSVN does).

So I was trying to connect without knowing my SVN server URL (yeah, using SmartSVN but not so smart there) and just trying random URLs like say my internal IP was 192.168.1.7 so I tried http://192.168.1.7 or svn://192.168.1.7 with or without the test_repository relative path. Obviously no luck there and getting some thing like "connection refused" (sorry should have noted the specific messages).

After some digging it turns out that you have to have a server to access the repositories (duh, so that's why apache has been mentioned all over)

I don't have apache setup so I was wondering if I could live without it. So after some walk around the documentation I found Overview of Server Configuration and there it is svnserve. The documentation is very impressive if only I've read through it first but diving right in without reading much still worked for me. Here's a link to the main page for the Subversion Book multi-page html edition index. Or you can also check out the the Subversion Book for other available editions (eg. PDF)

6. I started svnserve as a standalone daemo using the -d switch and tried to access it using SmartSVN (from my host machine). The command was svnserver -d. Tried to connect using SmartSVN again.

(File > Create Module menu item > "select local directory to import to repository" > setup repository profile). Hmm, should probably have made a post on SmartSVN or tortoise but feel free to drop me questions if ever or chekc out documentation for SmartSVN or Tortoise on "importing local files to repository"

Moving on. Oops, I was getting new errors along the lines of "no repository can be found at URL (svn://192.168.1.7/test_repository)". Hmmm, sounds bad but not so bad coz somehow it is now able to recognize the server, it just can't find a repository in there. Again, checking the documentation, it turns out that you have to use svnserve's -r switch if you have to use that path. That is without the -r switch your repository URL should append the full path of the repository (C:svntest_repository). The samples given are in UNIX so not sure how it should look like in windows (will try when i can), maybe svn://192.168.1.7/"c:svntest_repository"? But bottom line is that i started svnserve with this command instead "svnserve -d -r c:svn" and accessing the repository URL as svn://192.168.1.7/test_repository now works. great.

So guess that's it. Pardon any incoherent thoughts above (if any) but hope this benefits someone other than future me. Back to work.

Categories
.NET Agile Data

Unit Testing Data Access with .NET TransactionScope

I was curious how to maintain my database at a consistent state while unit testing (technically integration testing already – but since it uses unit testing framework as they say the lines are terminologies are getting blurry) so I looked around for "database unit testing" write ups.

It turns out that [more]mbUnit has [Rollback] which makes use of COM born out of Roy Osherove's article on Simplified Database Unit testing using Enterprise Services (and a number of related articles).

But I'm using NUnit (at least for now until I have checked out mbUnit) and again although there are a number of articles on extending NUnit (using Roy's approaches among others), it's a little messy to extend, create new DLLs and all. So seeing that the approach made use of Enterprise Service, it made me wonder whether it's possible to use .NET 2.0 TransactionScope (and possibly other upcoming enhancements to System.Transactions).

I tried to come up with a simple test/project to see if it would work and it did the job so posting it. (also adding a link to compressed sample project at the bottom)

using System.Data.SqlClient;

using System.Transactions;

using NUnit.Framework;

 

namespace TransactionScopeNUnitTest

{

    [TestFixture]

    public class TestClass

    {

        private const string connString = @"Server=.sql2005;database=test;uid=<yourUID>;pwd=<yourPassword>";

 

        private TransactionScope scope;

 

        [TestFixtureSetUp]

        public void Setup()

        {

            scope = new TransactionScope(TransactionScopeOption.RequiresNew);

        }

 

        [TestFixtureTearDown]

        public void TearDown()

        {

            if (scope != null)

            {

                scope.Dispose();

            }

        }

 

        [Test]

        public void Delete()

        {

            // test runner could run the tests in any order

            // so we insert the a known entry first

            Insert();

 

            using (SqlConnection conn = new SqlConnection(connString))

            {

                using (SqlCommand cmd = new SqlCommand(

                    "DELETE FROM Table1 WHERE Col1 = 1"))

                {

                    cmd.Connection = conn;

                    conn.Open();

                    cmd.ExecuteNonQuery();

                    Verify();

                }

            }

        }

 

        [Test]

        public void Insert()

        {

            using (SqlConnection conn = new SqlConnection(connString))

            {

                using (SqlCommand cmd = new SqlCommand(

                    "INSERT INTO Table1 (Col1, Col2) VALUES (2, '2')"))

                {

                    cmd.Connection = conn;

                    conn.Open();

                    int retval = cmd.ExecuteNonQuery();

                    Assert.Greater(retval, 0);

                }

            }

        }

 

        [Test]

        public void Verify()

        {

            using (SqlConnection conn = new SqlConnection(connString))

            {

                using (SqlCommand cmd = new SqlCommand(

                    "SELECT * FROM Table1 WHERE Col1 = 2"))

                {

                    cmd.Connection = conn;

                    conn.Open();

                    SqlDataReader rdr = cmd.ExecuteReader();

                    Assert.IsTrue(rdr.HasRows, "Inserted Row Not Found");

                }

            }

        }

    }

}

Here's the simple SQL script for the test 'Table1' too

CREATE TABLE [dbo].[Table1](
    [Col1] [int] NOT NULL,
    [Col2] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]

 

NOTE: When I ran this, despite using just one connection string, it required "Distributed Transaction Coordinator" service to be running on the machine (Start > Run > type "services.msc"). I used to think that it is only needed if the transaction is escalated to a distributed transaction but more on that next time.

Also, System.Transactions is not added by default to new projects (at least for class library template) so you would need to explicitly add a reference to it. 

This is really not a discovery so to speak and I'm sure there are other articles out there on this as it's only brought about by the introduction of TransactionScope as an alternative to previous approaches but for those running on .NET 2.0 and want a simpler solution than extensions or more complicated stuff, I think this would suffice. 

Download sample – TransopeNUnitTest.zip (59.95 kb)

Related Links:

TransactionScope on MSDN

TransactionScope's advantages over ADO.NET and Enterprise Services

Test-Driven Development in Microsoft.NET book

Categories
Agile

Enterprise Library 4.0 March 2008 CTP released

Just a quick Accouncement relay from the Patterns and Practices team. Enterprise Library 4.0 March 2008 CTP released.

Check out from [more]George Melniks post for a short intro or check it out directly from here

It's interesting to note that Enterprise Library 4.0 has the Allow Partially-Trusted Caller attribute (APTCA) on all assemblies which prompted some patches and work-arounds to make them work on some environments (eg. usually shared hosting)

Personally I only had the chance to get to know Logging Application Block, Exception Handling Application Block and a little of Data Access Block but I invite everyone to have a look and I'm looking forward to having these integrated with my apps. Enterprise Library is something so powerful that a lot of companies/developers are missing out. IMHO, this is a must for any great developer. If not use it then at least see how it works.

Categories
Agile

Model View Presenter – Building from Scratch

Rodolfo Cerrada, one of the best minds in software development that I know of just opened up his "Learn by Example" blog with a a simple to understand but comphrehensive post on the Model View Presenter pattern. Including a downloadable solution for everyone to explore.

Check out the article with following link: Model View Presenter Part I – Building from Scratch

Keep 'em coming Rod.

Categories
.NET Agile Tools and Utilities

My first bug catch with WatiN

I caught my first bug (regression) because of WatiN and NUnit just now. Something I wasn't able to catch during my previous manual tests. [more]

Two items that I run into but got over with:
1. AJAX (UpdatePanel). I show/hide controls with AJAX and previously finding elements by id had some issues if it's hidden and AJAX has still not finished showing the said control. Resolution: WaitUntilExists (and the likes) 

2. Catching Javascript confir. Resolution : Capture confirm dialog with WatiN

Finished my first set of tests. Insert, Update, Load, Delete pages for one entity and doing fine so far. Hopefully until the end. So I would suggest you try out WatiN yourself.