Thursday, 11 June 2015

How to configure TortoiseSVN repository with Apache and Subversion?


 Configuring SVN repository


        Most of us know how to install and use SVN Client. But we never get a chance to configure a repository and provide a http url for version control. This blog is about creating one such repo and make it available over http. Installing SVN and making a folder as a repository will only make it available locally but to access it over http from other systems, we need servers like svnserve or apache etc. We will learn about configuring svn with apache in this blog! :)
1.      Download and install TortoiseSVN 1.8.11, in the server, from “http://tortoisesvn.net/downloads.html”.

2.      Create a folder in D:\ drive with the name “SVNRoot”.

3.      Create a new folder under any drive, say E:\SVNRoot.

4.      Right click on the newly created folder and select “Create repository here” option under TortoiseSVN. Thus a repository is created locally. To make it available over http, we will configure it using Apache and subversion as mentioned below.




Fig. Creating SVN repository

 5.      Download Apache server binary version “Apache 2.4.12 x64” from “https://www.apachehaus.com/cgi-bin/download.plx”.


6.      Download Subversion modules for Apache – “Mod Subversion 1.8.11 for Apache 2.4.x x64” from “https://www.apachehaus.com/cgi-bin/download.plx”.

 

                                    Fig. Downloaded Apache Server and Subversion Modules

 7.      Copy the following subversion modules into Apache modules:

a.       mod_dav_svn.so

b.      mod_authz_svn.so

Subversion modules source path: “mod_svn-1.8.11-ap24-vc9-x64\modules”

Apache modules destination path: “httpd-2.4.12-x64-r2\Apache24\modules

8.      Copy all the dll files from “mod_svn-1.8.11-ap24-vc9-x64\bin  to “httpd-2.4.12-x64-r2\Apache24\bin

 

                                          Fig. dll files to be copied

9.      Open the “httpd.conf” file from the Apache server folder - “httpd-2.4.12-x64-r2\Apache24\conf” in notepad and make the following changes:

 
a.       Update “Listen 80” to “Listen 8078” or any other port number.

b.      Update “Define SRVROOT path to “Define SRVROOT "E:/final/httpd-2.4.12-x64-r2/Apache24"”

c.       Update ServerName to “ServerName localhost:8078”.

d.      Add the following code at the end of the file:

 
LoadModule dav_module modules/mod_dav.so

LoadModule dav_svn_module modules/mod_dav_svn.so

LoadModule authz_svn_module modules/mod_authz_svn.so

 

<Location /repos>

  DAV svn

  SVNListParentPath on

  SVNParentPath D:/SVNroot

</Location>

SVNParentPath path should point to the root directory of the repositories.
We can also add authentication details in the <Location></Location> section.

10.  Save the httpd.conf file and open the cmd prompt as administrator.

11.  Navigate to the Apache bin folder(httpd-2.4.12-x64-r2\Apache24\bin) in the cmd prompt and execute the following command:

 
httpd.exe –k install

 
12.  Now the repository will be available over http and we can check-in and checkout the code using the TortoiseSVN client in our local systems. :)

 

Monday, 27 April 2015

Ajax data not getting updated in IE

Again an issue with Ajax and JSON in IE. I was working on an application that needs the updated data to be rendered once every minute. Everything works good in Firefox and Chrome. But again IE, only the first result set was getting rendered and the subsequent ajax calls data wasn't fetching the updated one. When explored on this issue, we found it was a caching problem. I did try adding a timer to the ajax call URL so that every call is unique but that did not work either. Then tried the attribute - {cache: "false"}and it started working :) There are scenarios where changing the url by just appending some additional unique parameter to the url everytime worked in IE but there could be an issue with cache and setting the cache attribute to false helps!! :)

JSON.stringify and JSON.parse not working in IE

While working with JSON data in  an ajax call, I was using the JSON.stringify and JSON.parse methods. Everything was working good in Chrome and Firefox but, as usual, it wasn't in IE. :( Then found this json2.js file that allows JSON.parse and JSON.stringify to work in any browser i.e. it has a global JSON object that has these two methods - stringify and prase implemented :) All, I had to do was just include this js file and that is it. It started working :)