"Programming is fun"
import mx.controls.DateField;
var d:Date = DateField.stringToDate("30-12-2007","DD-MM-YYYY");
private function bindData():void
|
//get the selected indices in the array
|
using System.DirectoryServices; public static string GetFullName(string strLogin) { string str = ""; string strDomain; string strName; // Parse the string to check if domain name is present. int idx = strLogin.IndexOf('\\'); if (idx == -1) { idx = strLogin.IndexOf('@'); } if (idx != -1) { strDomain = strLogin.Substring(0, idx); strName = strLogin.Substring(idx + 1); } else { strDomain = Environment.MachineName; strName = strLogin; } DirectoryEntry obDirEntry = null; try { obDirEntry = new DirectoryEntry("WinNT://" + strDomain + "/" + strName); System.DirectoryServices.PropertyCollection coll = obDirEntry.Properties; object obVal = coll["FullName"].Value; str = obVal.ToString(); } catch (Exception ex) { str = ex.Message; } return str; }
svnadmin dump /path/to/repo > dumpfile.txt2. Move your repository folder to somewhere else in order to backup, just in case
mv /path/to/repo /path/to/repo_backup3. Now, manually change the "Node-path:" and "Copy-to-path:" headers to insert "trunk/" into them
sed -e 's/^\(Node-path: \)\(.*\)/\1trunk\/\2/;s/^\(Copy-from-path:\)\(.*\)/\1trunk\/\2/' dumpfile > dumpfile.newIf you find above command too hard, just open the dumpfile in any text editor and do find and replace. :-) You should be replacing "Node-path:" with "Node-path:trunk/" and "Copy-to-path:" with "Copy-to-path:trunk/". Simple huh! 4. Create new repository
svnadmin create /path/to/repo5. Load modified dump file into newly created repository
svnadmin load newdumpfile.txt path/to/repo6. Finally, import 'tags' and 'branches' folder in the repository. Now, you will see your repository with proper structure in which you can make branches and tags of your project.
Plan of implementation
In order to make SVK work, the plan is to mirror the central repository in the local machine. Then the local branch is created. Instead of using the mirrored trunk, user will be accessing this branch. At the end of the day, when everybody is done with their work, the local branch is merged into mirrored trunk. At the same time, the central repository is automatically updated.
Installing SVK
SVK is written completely in Perl and kind of pain to install. Luckily, in my Fedora Core 4 system, Subversion was already installed with perl binding, all I needed to fire the command;
perl -MCPAN -e 'install SVK'This command install SVK and all of it's many dependencies.
Setting up local 'depotmap'
To set up local repository, the following command does the trick;
svk depotmap --initThis will create a default depotmap. Alternatively, if you want to make a depotmap to the desire location, just issue the command
svk depotmapThis will open a default text editor and let you edit the depotmap name and the location.
Mirroring the central repository
svk mirror svn://mydomain.com/myproject/trunk //localrepo/trunkTo ensure that mirror has been setup,
svk mirror --list command can be used. Now that the mirror has been set up, the local copy is sync with mirror using
svk sync //localrepo/trunkCreating a local branch
svk cp -m "local branch" //localrepo/trunk /localrepo/localbranchYou can check the branch by issuing the following command;
svk ls //localrepo/localbranchNow user is able to work with the local branch using TortoiseSVN or anyother Subversion client tool.
Merging from local branch to the mirror
At the end of the day, after everybody is done with the work, local branch must be merged to the mirror. This can be done with the command svk smerge command.
svk smerge -C //localrepo/localbranch //localrepo/trunkThe C option checks for the conflict that may have. Now, if there is no conflict, the actual merger can be done using following command;
svk smerge -l //localrepo/localbranch //localrepo/trunkThis command also updates the repository automatically that the mirror points to.
Authors aut = new Authors();
aut.AuId = id;
aut.AuFname = fName;
aut.AuLname = lName;
aut.Phone = phone;
db.Authors.Add(aut);
db.SubmitChanges();
Continuing the work I left last time, I made an object of Authors and added ID, first name, last name and phone to it. Then calling the SubmitChanges method, the actual data is written to database.
Similarly, deleting a record is also not so hard.
var authors = (
from a in db.Authors
where a.AuId == id
orderby a.AuFname
select a).First();
db.Authors.Remove(authors);
db.SubmitChanges();
In order to delete a record, First method is called with the query, which returns a particular record. By passing this record to the Remove method of Authors object, a record will be deleted. With this, record deletion is only limited to memory data. Actual record will be deleted only after calling SubmitChanges method.
The next step is to explore transaction in LINQ.
using System;
using System.Collections .Generic;
using System.Text;
using System.Query;
using System.Xml.XLinq;
using System.Data.DLinq;
using System.Data.SqlClient;
using pubs;
namespace LINQApp
{
class Program
{
static void Main(string[] args)
{
dbQuery();
}
static void dbQuery()
{
SqlConnection conn =
new SqlConnection(@"SERVER={YourDBServer};user id={uid};password=;database=pubs;");
Pubs db = new Pubs(conn);
var authors =
from a in db.Authors
select a;
foreach (var auth in authors)
{
Console.WriteLine(" {0} {1} | {2} | {3} ",
auth.AuFname, auth.AuLname, auth.Address, auth.Phone);
}
Console.ReadLine();
}
}
}