Posts

Showing posts from September, 2011

RhodeCode open source HG (Mercurial) server

Download RhodeCode * http://rhodecode.org/ Prerequisites * Install Python 2.5 or later http://www.python.org/download/ * Add to PATH \Python27 and \Python27\Scripts folders * Install SetupTools http://pypi.python.org/packages/2.7/s/setuptools/ Create \RhodeCode folder Install RhodeCode * easy_install rhodecode Configure RhodeCode * paster make-config RhodeCode production.ini * paster setup-app production.ini Run RhodeCode * paster serve production.ini Server is now running here http://localhost:8000 To change default host:port edit production.ini file More info about installation and setup http://packages.python.org/RhodeCode/installation.html http://packages.python.org/RhodeCode/setup.html

C# Deep & Shallow Copy/Clone

class Program { static void Main( string [] args) { var parent1 = new Parent() {Id = 1}; parent1.Children = new List<Child>(); parent1.Children.Add( new Child() { Name = " One " }); parent1.Children.Add( new Child() { Name = " Two " }); var parent2 = new Parent() { Id = 2 }; parent2.Children = new List<Child>(); parent2.Children.Add( new Child() { Name = " One " }); parent2.Children.Add( new Child() { Name = " Two " }); var parent3 = new Parent() { Id = 3 }; parent3.Children = new List<Child>(); parent3.Children.Add( new Child() { Name = " One " }); parent3.Children.Add( new Child() { Name = " Two " }); var parentShallowCopy = parent1.ShallowCopy(); var parentDeepCopy = parent2.DeepCopy(); var parentDeepClone = parent3.DeepClone(); Console.WriteLine(" ORIGINAL(1) : {0} ", parent1); Console.WriteLine(" SHALLOW...

HG Mercurial Quick Setup Tutorial

Setting up Remote (build in) http server for multiple repositories * Create Directory Structure   - repo-root    |- Project1.hg    |- Project2.hg    hgweb.config    run.bat   * Edit hgweb.config as follows   [collections]   repos/ = .   [web]   style = gitweb   push_ssl = false   allow_push = *   * Edit run.bat as follows and run it   hg serve --webdir-conf hgweb.config Http Server is running on http://localhost:8000/     Setting up Remote Repository * Create Folder /repo-root/Project1.hg * Run hg init from within that folder Setting up Local Repository * Go to your local project directory /projects * Clone remote repository locally   hg clone http://localhost:8000/Project1.hg Project1 If you have an existing project and want to push it to remote repository * Run hg push http://localhost:8000/Proj...

Simple XML based C# Database

public class DatabaseMgr { public Database Database { get ; set ; } private static DatabaseMgr instance; private DatabaseMgr() { } public static DatabaseMgr Instance { get { if (instance == null ) { instance = new DatabaseMgr(); } return instance; } } //use temp path private static string PATH = Path.Combine(Path.GetTempPath(), " UserDatabase.xml "); public void Reload() { if (File.Exists(PATH)) { XmlSerializer xs = new XmlSerializer( typeof (Database)); using (TextReader reader = new StreamReader(PATH)) { Database = (Database)xs.Deserialize(reader); reader.Close(); } } else { Database = new Database(); } } public void Save() { XmlSerializer xmlSerializer = new XmlSerializer( typeof (Database)); using (TextWriter writer = new StreamWriter(PATH)) { xmlSerializer.Serialize(write...