Note: "Left quote" replaced by #, "Right quote" replaced by ^
How do you do this? It has quotes, slashes etc. e.g.
string zzz = "#employees xsi="http://www.w3.org/2001/XMLSchema-instance"^#employee-record^#employee-id^00001#/EMPLOYEE-ID^#employee-from^01 10 2006#/EMPLOYEE-FROM^#employee-to^01 11 2006#/EMPLOYEE-TO^#employee^#employee-id^00001#/EMPLOYEE-ID^#employee-name^Washington#/EMPLOYEE-NAME^#employee-firstname^George#/EMPLOYEE-FIRSTNAME^#employee-dob^01 01 1930#/EMPLOYEE-DOB^#/employee^#/EMPLOYEE-RECORD^#/employees^";
won't compile.
You could put a "@" in front to make it a verbatim string literal but it still won't compile.
The trick is to make each quote (") a double quote ("") e.g.
string zzz = @"#employees xsi=""^#employee-record^#employee-id^00001#/EMPLOYEE-ID^#employee-from^01 10 2006#/EMPLOYEE-FROM^#employee-to^01 11 2006#/EMPLOYEE-TO^#employee^#employee-id^00001#/EMPLOYEE-ID^#employee-name^Washington#/EMPLOYEE-NAME^#employee-firstname^George#/EMPLOYEE-FIRSTNAME^#employee-dob^01 01 1930#/EMPLOYEE-DOB^#/employee^#/EMPLOYEE-RECORD^#/employees^";
which does compile.
Enjoy!
Ideas and thoughts about Microsoft Identity, C# development, cabbages and kings and random flotsam on the incoming tide
Tuesday, January 23, 2007
Thursday, January 11, 2007
Windows XP : cisvc.exe hogs the hard drive
My PC randomly just sat there with the hard disk light on but I wasn't doing anything - plus it was dog-slow.
Using the excellent Process Explorer, I discovered that the "cisvc.exe" program was the cause of the problem. This is part of indexing services.
My first solution was simply to suspend this via Process Explorer. (Right click on cisvc.exe). This helped but I had to do it every time on start-up.
So I googled and found one possible solution:
My Computer - right click on the C: drive - Properties - uncheck "Allow Indexing Service to index this disk for fast file searching" in the General tab.
This helped but the problem still remained.
Then I found another, better solution:
Control panel - Administrative Tools - Computer Management - expand "Services and Applications" - right-click on "Indexing Service" - "All Tasks -> Tune Performance". Then decide what level you want.
Enjoy!
Using the excellent Process Explorer, I discovered that the "cisvc.exe" program was the cause of the problem. This is part of indexing services.
My first solution was simply to suspend this via Process Explorer. (Right click on cisvc.exe). This helped but I had to do it every time on start-up.
So I googled and found one possible solution:
My Computer - right click on the C: drive - Properties - uncheck "Allow Indexing Service to index this disk for fast file searching" in the General tab.
This helped but the problem still remained.
Then I found another, better solution:
Control panel - Administrative Tools - Computer Management - expand "Services and Applications" - right-click on "Indexing Service" - "All Tasks -> Tune Performance". Then decide what level you want.
Enjoy!
Tuesday, December 19, 2006
Unix : Exporting a schema / stored procedure packages
Often you need to update the stored procedure packages for a schema.
So you laboriously export them via DDL and pretty them up and then run them on the target schema and then commit them.
Sometimes it's just easier to export the schema as an Oracle dump (which includes all the related stored procedures) and then import them on the target schema.
An example of the export command is:
exp login/password@schema file=target file directory/export name.dmp
Enjoy!
So you laboriously export them via DDL and pretty them up and then run them on the target schema and then commit them.
Sometimes it's just easier to export the schema as an Oracle dump (which includes all the related stored procedures) and then import them on the target schema.
An example of the export command is:
exp login/password@schema file=target file directory/export name.dmp
Enjoy!
Friday, November 10, 2006
Unix : Libraries in an executable
A useful command to do this is:
ldd executable name
This will list out all the libraries required by that executable.
Enjoy!
ldd executable name
This will list out all the libraries required by that executable.
Enjoy!
Monday, November 06, 2006
Misc : Folder / file comparisons with hard drive and FTP
I frequently have problems comparing folders on my PC with folders on a machine that is accessible mainly by FTP.
An excellent tool for this is Beyond Compare which allows all combinations of local driver and FTP including FTP to FTP.
Also allows custom compares so you could create a preprocessor to do some manipulation before the actual compare.
A massive time saver.
Enjoy!
An excellent tool for this is Beyond Compare which allows all combinations of local driver and FTP including FTP to FTP.
Also allows custom compares so you could create a preprocessor to do some manipulation before the actual compare.
A massive time saver.
Enjoy!
Misc : Formatting code in your blog
One possible solution is to use the
==blockquote==/blockquote==
construct
e.g.
void method (int a)
{
==blockquote==
==/blockquote==
}
where the "==" stands for the angled brackets.
Enjoy!
==blockquote==/blockquote==
construct
e.g.
void method (int a)
{
==blockquote==
int b = a * a;
==/blockquote==
}
where the "==" stands for the angled brackets.
Enjoy!
Friday, October 20, 2006
Unix : Finding files that start with a .
The classic "ls -l" doesn't show you any files that start with . (which is legal) (e.g. .param) and which are effectively hidden.
You need "ls -al" to ferret out these elusive beasts.
Enjoy!
You need "ls -al" to ferret out these elusive beasts.
Enjoy!
SQL : Comparing VSS stored procedures with the DB
This is a right royal pain. You have to extract every .pkg and .pkb manually e.g. if using SQL Navigator you right click, Extract DDL and save.
But how do you ensure that VSS is up-to-date?
An easy way is to right click on the heading e.g. right click on Package Bodies and then Extract DDL from here. What you are doing is creating one DDL file that contains ALL the package stored procedures.
In VSS, however, each package is stored individually. To combine them, DOS comes to the rescue! Use the copy construct "+".
e.g. copy a + b + c d.
This concatenates a, b and c and puts them in a file called d.
Now you can compare the combined DDL extract with the concatenated file from VSS.
But wait, there's more!
Part of the DDL extract puts the date on the extract and the tnsname that you use to access the DB. Different developers may have different tns names. So you need to remove these lines. This can be done very simply by writing a program to parse the file and create a new one without these lines.
e.g. in C#, something like:
(where the command line is something like 'Program 'input file' 'filtered file'')
static void Main(string[] args)
{
}
So the batch file would be:
copy concatenate statement
run filter on concatenated file
run filter on saved DDL file
compare the two filtered files
You could use something like Examdiff which is free to do the compare in which case the batch file line would be:
start ExamDiff.exe File1 File2
Enjoy!
But how do you ensure that VSS is up-to-date?
An easy way is to right click on the heading e.g. right click on Package Bodies and then Extract DDL from here. What you are doing is creating one DDL file that contains ALL the package stored procedures.
In VSS, however, each package is stored individually. To combine them, DOS comes to the rescue! Use the copy construct "+".
e.g. copy a + b + c d.
This concatenates a, b and c and puts them in a file called d.
Now you can compare the combined DDL extract with the concatenated file from VSS.
But wait, there's more!
Part of the DDL extract puts the date on the extract and the tnsname that you use to access the DB. Different developers may have different tns names. So you need to remove these lines. This can be done very simply by writing a program to parse the file and create a new one without these lines.
e.g. in C#, something like:
(where the command line is something like 'Program 'input file' 'filtered file'')
static void Main(string[] args)
{
string readBuffer = "";
int gIndex = 0;
int fIndex = 0;
if (args.Length != 2)
{
Console.WriteLine ("\nFormat is Prog 'input' 'output'");
System.Environment.Exit (0);
}
try
{
FileStream readStream = new FileStream (args[0], FileMode.Open);
StreamReader fileRead = new StreamReader (readStream);
FileStream writeStream = new FileStream (args[1], FileMode.Create);
StreamWriter fileWrite = new StreamWriter(writeStream);
while (fileRead.Peek () >= 0)
{
readBuffer = fileRead.ReadLine();
gIndex = readBuffer.IndexOf ("-- Generated");
if (gIndex == -1)
{
string tempReadBuffer = readBuffer.ToLower();
fIndex = tempReadBuffer.IndexOf ("-- from 'a specific DB string'");
if (fIndex == -1)
fileWrite.WriteLine (readBuffer);
}}
fileRead.Close ();
fileWrite.Flush ();
fileWrite.Close ();
}
catch (Exception e)
{
Console.WriteLine("Error : {0}", e.ToString());
}
}
So the batch file would be:
copy concatenate statement
run filter on concatenated file
run filter on saved DDL file
compare the two filtered files
You could use something like Examdiff which is free to do the compare in which case the batch file line would be:
start ExamDiff.exe File1 File2
Enjoy!
Tuesday, October 17, 2006
Visual Studio : Errors in the output
Quite often when you are doing a build of a large project, the build will fail when some VS utility returns an error. The problem is that you can't see why it fails.
A useful technique is to use the VS command prompt (Start - Programs - VS 2005 - VS 2005 Tools) and cut and paste the command line that failed from the VS output window.
Then execute it - you'll see all the errors.
The other option is to select Tools - Options - Projects and Solutions - Build and Run and change the build output verbosity to "Detailed" or "Diagnostic". Just change it back afterwards or you'll be swamped!
Enjoy!
A useful technique is to use the VS command prompt (Start - Programs - VS 2005 - VS 2005 Tools) and cut and paste the command line that failed from the VS output window.
Then execute it - you'll see all the errors.
The other option is to select Tools - Options - Projects and Solutions - Build and Run and change the build output verbosity to "Detailed" or "Diagnostic". Just change it back afterwards or you'll be swamped!
Enjoy!
Tuesday, September 12, 2006
Misc : Vital links
Reading List: Fog Creek Software Management Training Program here
"A combination of the best business books of all time / the best software management books of all time / every worthwhile history of a software/computer company that Joel can find."
Joel's Programmer's Bookshelf here
"This is the short list of all the books that Joel thinks that every working programmer needs to read."
Ten Must-Have Tools Every Developer Should Download Now Enjoy! here
James Avery introduces you to some of the best free tools available today that target .NET development with Visual Studio.
Visual Studio Add-Ins Every Developer Should Download Now here
James Avery creates a list of must-have tools, but this time focusing on Visual Studio add-ins as opposed to standalone tools.
Enjoy!
"A combination of the best business books of all time / the best software management books of all time / every worthwhile history of a software/computer company that Joel can find."
Joel's Programmer's Bookshelf here
"This is the short list of all the books that Joel thinks that every working programmer needs to read."
Ten Must-Have Tools Every Developer Should Download Now Enjoy! here
James Avery introduces you to some of the best free tools available today that target .NET development with Visual Studio.
Visual Studio Add-Ins Every Developer Should Download Now here
James Avery creates a list of must-have tools, but this time focusing on Visual Studio add-ins as opposed to standalone tools.
Enjoy!
Wednesday, August 30, 2006
Visual Studio : The application domain in which the thread was running has been unloaded.
Upgraded to Visual Studio 2005. With a large project, I kept getting this error when building. No clues as to what was wrong or how to fix it.
Googled the message but little joy. Eventually found a link that suggested that virtual memory was the problem so changed my XP virtual memory.
Path is Control Panel / System / Advanced / Performance / Settings / Advanced / Virtual memory and selected "System managed size".
Seems to have fixed the problem.
Enjoy!
Googled the message but little joy. Eventually found a link that suggested that virtual memory was the problem so changed my XP virtual memory.
Path is Control Panel / System / Advanced / Performance / Settings / Advanced / Virtual memory and selected "System managed size".
Seems to have fixed the problem.
Enjoy!
Subscribe to:
Posts (Atom)