Posts

Showing posts from May, 2007

.NET 2.0 modifying content of app.config file (C#)

Before you start, make sure you have added reference to System.Configuration.dll for .NET 2.0. I think the default the Visual Studio C# Express referenced to is from .NET 1.1 which will not compile.

using System.Configuration;
using System.Collections.Specialized;

//to write
System.Configuration.Configuration config =
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

config.AppSettings.Settings.Remove("myKey");
config.AppSettings.Settings.Add("myKey", "123");

config.Save(ConfigurationSaveMode.Modified);

ConfigurationManager.RefreshSection("appSettings");

//to read
NameValueCollection appSettings = System.Configuration.ConfigurationManager.AppSettings;
string strRead = (string)appSettings["myKey"];


Content of app.config

<?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings>
<add key="myKey" value = "123"/>
</appSettings> </configu…

Clearcase check in/uncheck out all the checked out files script

I am so used to source safe recursive check in and found troublesome in clearcase having to do it manually one by one.

This is the Unix script that I have come out with

//for undo check out all the checked out files
cleartool lsco -cview -avobs | cleartool unco -rm `awk '{ print $(5) }' | sed -e 's/^\"*//' -e 's/ *\"$//'`
//for check in all the checked out files
cleartool lsco -cview -avobs | cleartool ci -nc `awk '{ print $(5) }' | sed -e 's/^\"*//' -e 's/ *\"$//'`


//Using xargs

cleartool lsco -cview -avobs -short | xargs cleartool ci