Monday, June 30, 2008

Install Subversion server on windows computer

步骤1, 创建一个空目录, 比如d:/source
步骤2, 打开d:\source目录, 使用windows explorer的context menu中tortoisesvn/create a repository here菜单项, 在d:\source中创建必要的repository控制文件和数据库文件.
步骤3, 创建一个svn service服务, 并将服务的工作目录指向d:\source即可. 下面有详细的步骤.

We can register subversion service. the steps are easy. Windows system have a sc command tool to help you register.
If path of subversion contains space or other chars that must be escaped, then you must enclose the path to svnserve.exe with double-quotes, which themselves must be quoted using a backslash. Fortunately the syntax is similar to that on Unix platforms:


Create service methods:
1)On your computer if the path of svnserve.exe does not contain spaces
sc create subversion_local binpath= "c:\svn\bin\svnserve.exe --service -r d:\source" displayname= "Local Subversion Repository" depend= Tcpip
删除这个服务的命令是 sc delete subversion_local
2)On your computer if the path of svnserve.exe contains spaces
sc create subversion_local binpath= "\"c:\program files\subversion\bin\svnserve.exe\" --service -r d:\source" displayname= "Local Subversion Repository" depend= Tcpip

Access the subversion repository by tortoiseSVN, you need a repository url.
1)Browse the repository on local computer,the repository url is just like,
file:///d:/source/docs
2)Browse the repository on remote computer, 前提是computer22机器上的source/docs必须共享出来, 这样才能通过file协议来访问. 访问方式是:
file:///\computer22/source/docs
这是基于file协议的svn访问方式, 多人项目最好不用file协议(因为共享目录安全性较差, 无法做到精细化权限管理). 最好是用svn协议或https协议. 参见我的另一blog( svn authorization)
3)Browse the repository across internet, the repository url is just like,
https://xxxx.svn.sourceforge.net/svnroot/xxxx

more info : http://svn.collab.net/repos/svn/trunk/notes/windows-service.txt

Monday, June 23, 2008

Software dev environment

1. Version control tool
SubVersion and TortoiseSVN
2. A bug administration tool
Mantis, hosted by sourceforge, http://www.mantisbt.org/download.php
Trac, this is a open source bug admin web system. and it provides an interface to subversion, and it has an integrated Wiki and reporting facilities. http://trac.edgewall.org/
3. Continuous Build Tool
CruiseControl.net http://www.codeproject.com/KB/architecture/ContinuousIntegration.aspx

Delphi software dev environment

1. IDE Expert tools
GExpert, www.gexperts.org
DelphiSpeedUp, http://andy.jgknet.de/dspeedup/
DDevExtensions, http://andy.jgknet.de/dspeedup/index.php?page=DDevExtensions
DelforExp, Format Expert

2. Dunit and DUnitLite
http://dunit.sourceforge.net/
http://code.google.com/p/dunitlite

3. madExcept, this is an excellent exception catcher

Tuesday, June 10, 2008

Freesoftware and opensoftwares

优秀开源和免费软件下载网站有:
http://portableapps.com/
http://nirsoft.net/
http://www.pendriveapps.com/
http://www.downloadsquad.com/
http://www.osalt.com/

24 Killer Portable Apps For Your USB Flash Drive
http://www.downloadsquad.com/2008/09/02/24-killer-portable-apps-for-your-usb-flash-drive/


Database Browser(Portable Edition,支持Oracle, SQL Server,ODBC)
http://www.dbsoftlab.com/index.php/Freeware/Database-Browser.html


NetSetManagement (portable Edition) 方便切换多个IP和网关
http://www.pendriveapps.com/2008/03/31/netsetman-portable-network-settings-manager/


WinDirStatPortable(分析磁盘文件的占用情况)
http://portableapps.com/apps/utilities/windirstat_portable


PidginPortable(MSN, QQ等IM 客户端)
http://portableapps.com/apps/internet/pidgin_portable


EraserPortable(securely Delete file/folder)
http://portableapps.com/apps/utilities/eraser_portable


MyUninstaller(非常好用的卸载工具)
http://www.nirsoft.net/utils/myuninst.html


Sumatra PDF Portable (PDF Reader)
http://portableapps.com/apps/office/sumatra_pdf_portable


Keepass--Protect your password
http://keepass.info/

italc--Local network computer projector, for team learning and team computer control.
http://italc.sourceforge.net

Desktops--Virtual Windows desktop manager, just like linux multi-desktop
http://technet.microsoft.com/en-us/sysinternals/cc817881.aspx

EyeDefender--Alert you when you have used computer for a period
http://eterlab.com/

Locate--Just the linux locate command
http://locate32.webhop.org/

WordWeb--English thesaurus and dictionary lookup
http://wordweb.info/free/

Wednesday, June 4, 2008

how to change file folder in subversion

Subversion是一个非常好的Source版本控制软件.
TortoiseSVN是一个Windows平台上Subversion客户端. 操作非常方便, 但有一个问题是: 在TortoiseSVN的菜单中, 怎么也找不到Move file to...或者是change file folder这样的菜单项目, 不知道怎样才能移动文件.
google一搜, 才发现不仅仅是我有这样的困惑.
实际上TortoiseSVN已经考虑了这个问题, 只不过它不是将功能体现在菜单项上, 右键拖拉一个文件到一个versioned folder, 就会出现看到TortoiseSVN已经为你提供了移动功能.

http://svn.haxx.se/tsvnusers/archive-2006-02/0167.shtml

Monday, May 26, 2008

C_Sharp edition StringList Class

Delphi有一个常用的类StringList, 它有一个特点是你可以一行一行加String, 如果你所加的每行String都是Name=Value格式的,它会帮你提取出Name列表和Value列表, 这个类我在用Delphi时候, 常使用它. 下面是C#版的StringList类.



namespace LiuHarry.Utils.Foundation
{
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;

public class DelphiStrList
{
private List<string> M_Items = new List<string>();
private List<string> M_Keys = new List<string>();
private string M_KeyValueEqualmark = "=";
private List<string> M_Values = new List<string>();

public virtual void Add(string item)
{
string str;
string str2;
this.M_Items.Add(item);
DivideKeyValue(item, this.M_KeyValueEqualmark, out str2, out str);
this.M_Keys.Add(str2);
this.M_Values.Add(str);
}

public virtual void Clear()
{
this.M_Items.Clear();
this.M_Keys.Clear();
this.M_Values.Clear();
}

protected void DevideKeyValuesByItems()
{
this.M_Keys.Clear();
this.M_Values.Clear();
foreach (string str3 in this.M_Items)
{
string str;
string str2;
DivideKeyValue(str3, this.M_KeyValueEqualmark, out str2, out str);
this.M_Keys.Add(str2);
this.M_Values.Add(str);
}
}

public static void DivideKeyValue(string entireStr, string keyValueEqualmark, out string keyStr, out string valueStr)
{
int index = entireStr.IndexOf(keyValueEqualmark);
if (index > 0)
{
keyStr = entireStr.Substring(0, index);
if (index < (entireStr.Length - 1))
{
valueStr = entireStr.Substring(index + 1);
}
else
{
valueStr = "";
}
}
else
{
keyStr = entireStr;
valueStr = "";
}
}

public virtual int IndexOf(string item)
{
return this.M_Items.IndexOf(item);
}

public virtual void Insert(int index, string item)
{
string str;
string str2;
this.M_Items.Insert(index, item);
DivideKeyValue(item, this.M_KeyValueEqualmark, out str2, out str);
this.M_Keys.Insert(index, str2);
this.M_Values.Insert(index, str);
}

public string MakeItemsToText(string ItemSeperator)
{
return this.MakeStrlistToText(this.M_Items, ItemSeperator);
}

public string MakeKeyItemsToText(string ItemSeperator)
{
return this.MakeStrlistToText(this.M_Keys, ItemSeperator);
}

private string MakeStrlistToText(List<string> items, string ItemSeperator)
{
StringBuilder builder = new StringBuilder();
foreach (string str in items)
{
builder.Append(str);
builder.Append(ItemSeperator);
}
return builder.ToString();
}

public string MakeValueItemsToText(string ItemSeperator)
{
return this.MakeStrlistToText(this.M_Keys, ItemSeperator);
}

public virtual bool Remove(string item)
{
int index = this.IndexOf(item);
if (index >= 0)
{
this.M_Keys.RemoveAt(index);
this.M_Values.RemoveAt(index);
}
return this.M_Items.Remove(item);
}

public virtual void RemoveAt(int index)
{
this.M_Items.RemoveAt(index);
this.M_Keys.RemoveAt(index);
this.M_Values.RemoveAt(index);
}

public virtual void Sort()
{
this.M_Items.Sort();
this.DevideKeyValuesByItems();
}

public int Count
{
get
{
return this.M_Items.Count;
}
}

public List<string> Items
{
get
{
return this.M_Items;
}
}

public List<string> Keys
{
get
{
return this.M_Keys;
}
}

public string KeyValueEqualmark
{
get
{
return this.M_KeyValueEqualmark;
}
set
{
this.M_KeyValueEqualmark = value;
}
}

public List<string> Values
{
get
{
return this.M_Values;
}
}
}
}

How to hide or show TabPage of TabControl

C# 的TabControl功能严重不足, 尤其是你用它来制作Wizard界面时候, 下面代码会有所帮助的.


namespace LiuHarry.Utils.Components
{
using System;
using System.Windows.Forms;

public class TabControlHelper
{
private TabControl m_tabControl;

public TabControlHelper(TabControl tabCtrl)
{
this.m_tabControl = tabCtrl;
}

public void HideTabPage(TabPage tp)
{
if (this.m_tabControl.TabPages.Contains(tp))
{
this.m_tabControl.TabPages.Remove(tp);
}
}

private void InsertTabPage(TabPage tabpage, int index)
{
if ((index < 0) || (index > this.m_tabControl.TabCount))
{
throw new ArgumentException("Index out of Range.");
}
this.m_tabControl.TabPages.Add(tabpage);
if (index < (this.m_tabControl.TabCount - 1))
{
do
{
this.SwapTabPages(tabpage, this.m_tabControl.TabPages[this.m_tabControl.TabPages.IndexOf(tabpage) - 1]);
}
while (this.m_tabControl.TabPages.IndexOf(tabpage) != index);
}
this.m_tabControl.SelectedTab = tabpage;
}

public void ShowTabPage(TabPage tp)
{
this.ShowTabPage(tp, this.m_tabControl.TabPages.Count);
}

public void ShowTabPage(TabPage tp, int index)
{
if (!this.m_tabControl.TabPages.Contains(tp))
{
this.InsertTabPage(tp, index);
}
}

private void SwapTabPages(TabPage tp1, TabPage tp2)
{
if (!(this.m_tabControl.TabPages.Contains(tp1) && this.m_tabControl.TabPages.Contains(tp2)))
{
throw new ArgumentException("TabPages must be in the TabControls TabPageCollection.");
}
int index = this.m_tabControl.TabPages.IndexOf(tp1);
int num2 = this.m_tabControl.TabPages.IndexOf(tp2);
this.m_tabControl.TabPages[index] = tp2;
this.m_tabControl.TabPages[num2] = tp1;
this.m_tabControl.SelectedIndex = this.m_tabControl.SelectedIndex;
string text = tp1.Text;
string str2 = tp2.Text;
tp1.Text = str2;
tp2.Text = text;
}
}
}