Tuesday, October 30, 2007
The Local Security Authority cannot be contacted
the web server does register the error:
Event Type: Failure Audit
Event Source: Security
Event Category: Logon/Logoff
Event ID: 537
Date: 10/30/2007
Time: 10:53:03 AM
User: NT AUTHORITY\SYSTEM
Computer: XXXX-XXX
Description:
Logon Failure:
Reason: An error occurred during logon
User Name: XXXX@XXXX.XXX
Domain:
Logon Type: 3
Logon Process: NtLmSsp
Authentication Package: NTLM
Workstation Name: TELESTO
Status code: 0xC0000225
Substatus code: 0x0
Caller User Name: -
Caller Domain: -
Caller Logon ID: -
Caller Process ID: -
Transited Services: -
Source Network Address: 192.###.##.###
Source Port: 2705
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
While I am looking into this more if anyone has any ideas PLEASE let me know.
One more tidbit it does not have the same problem on all computers, some workstations seem to work as expected.
Wednesday, October 3, 2007
Recursively adding files to Visual Source Safe
Actually hate isn't right I despise it, I loath it, it is the worst source control software I have ever used! Well I feel better getting that of my chest.
Anyway back to the reason for this post. If you need to recursively add files and folders to VSS you simple drag the folder from Windows Explorer and drop in in the correct location in your VSS project.
You might think there is a menu option to do this but there isn't. You may also think well if I hit insert I will be asked to recursively add, and you would be wrong. Then you may think Let me look in the doc, maybe it is a command line option, good luck.
Anyway I hope I am not the only id10t to forget how to do this and had to go hunting for it.
Friday, September 7, 2007
Redirecting DOS stdout stderr
Every time I need to redirect DOS output I have to go look it up. There is only so much space in my brain and unless I want to forget how to speak something had to go. Well I got tired of searching thru different sites to get what I wanted, so the last time I came across this info (this happens to be from Microsoft) I posted it here.
Using command redirection operators
The following table lists operators that you can use to redirect command input and output streams.
Redirection operator | Description |
> | Writes the command output to a file or a device, such as a printer, instead of the Command Prompt window. |
< | Reads the command input from a file, instead of reading input from the keyboard. |
>> | Appends the command output to the end of a file without deleting the information that is already in the file. |
>& | Writes the output from one handle to the input of another handle. |
<& | Reads the input from one handle and writes it to the output of another handle. |
| | Reads the output from one command and writes it to the input of another command. Also known as a pipe. |
By default, you send the command input (that is, the STDIN handle) from your keyboard to Cmd.exe, and then Cmd.exe sends the command output (that is, the STDOUT handle) to the Command Prompt window.
The following table lists the available handles.
Handle | Numeric equivalent of handle | Description |
STDIN | 0 | Keyboard input |
STDOUT | 1 | Output to the Command Prompt window |
STDERR | 2 | Error output to the Command Prompt window |
UNDEFINED | 3-9 | These handles are defined individually by the application and are specific to each tool. |
The numbers zero through nine (that is, 0-9) represent the first 10 handles. You can use Cmd.exe to run a program and redirect any of the first 10 handles for the program. To specify which handle you want to use, type the number of the handle before the redirection operator. If you do not define a handle, the default < redirection input operator is zero (0) and the default > redirection output operator is one (1). After you type the < or > operator, you must specify where you want to read or write the data. You can specify a file name or another existing handle.
To specify redirection to existing handles, use the ampersand (&) character followed by the handle number that you want to redirect (that is, &handle#). For example, the following command redirects handle 2 (that is, STDERR) into handle 1 (that is, STDOUT):
1<&2
Duplicating handles
The & redirection operator duplicates output or input from one specified handle to another specified handle. For example, to send dir output to File.txt and send the error output to File.txt, type:
dir>c:\file.txt 2>&1
When you duplicate a handle, you duplicate all characteristics of the original occurrence of the handle. For example, if a handle has write-only access, all duplicates of that handle have write-only access. You cannot duplicate a handle with read-only access into a handle with write-only access.
Redirecting command input (<)
To redirect command input from the keyboard to a file or device, use the < operator. For example, to get the command input for the sort command from File.txt:
sort<file.txt
The contents of File.txt appear in the Command Prompt window as an alphabetized list.
The < operator opens the specified file name with read-only access. As a result, you cannot write to the file when you use this operator. For example, if you start a program with <&2, all attempts to read handle 0 fail because handle 2 is initially opened with write-only access.
Redirecting command output (>)
Almost all commands send output to your Command Prompt window. Even commands that send output to a drive or printer display messages and prompts in the Command Prompt window.
To redirect command output from the Command Prompt window to a file or device, use the > operator. You can use this operator with most commands. For example, to redirect dir output to Dirlist.txt:
dir>dirlist.txt
If Dirlist.txt does not exist, Cmd.exe creates it. If Dirlist.txt exists, Cmd.exe replaces the information in the file with the output from the dir command.
To run the netsh routing dump command and then send the command output to Route.cfg, type:
netsh routing dump>c:\route.cfg
The > operator opens the specified file with write-only access. As a result, you cannot read the file when you use this operator. For example, if you start a program with redirection >&0, all attempts to write handle 1 fail because handle 0 is initially opened with read-only access.
Note
• | One is the default handle for the > redirection output operator. |
Using the <& operator to redirect input and duplicate
To use the redirection input operator <&, the file you specify must already exist. If the input file exists, Cmd.exe opens it as read-only and sends the characters contained in the file as input to the command as if they were input from the keyboard. If you specify a handle, Cmd.exe duplicates the handle you specify onto the existing handle in the system.
For example, to open File.txt as input read to handle 0 (that is, STDIN), type:
<file.txt
To open File.txt, sort the contents and then send the output to the Command Prompt window (that is, STDOUT), type:
sort<file.txt
To find File.txt, and then redirect handle 1 (that is, STDOUT) and handle 2 (that is, STDERR) to the Search.txt, type:
findfile file.txt>search.txt 2<&1
To duplicate a user-defined handle 3 as input read to handle 0 (that is, STDIN), type:
<&3
Using the >& operator to redirect output and duplicate
If you redirect output to a file and you specify an existing file name, Cmd.exe opens the file as write-only and overwrites the file's contents. If you specify a handle, Cmd.exe duplicates the file onto the existing handle.
To duplicate a user-defined handle 3 into handle 1, type:
>&3
To redirect all of the output, including handle 2 (that is, STDERR), from the ipconfig command to handle 1 (that is, STDOUT), and then redirect the ouput to Output.log, type:
ipconfig.exe>>output.log 2>&1
Using the >> redirection operator to append output
To add the output from a command to the end of a file without losing any of the information already in the file, use two consecutive greater than signs (that is, >>). For example, the following command appends the directory list produced by the dir command to the Dirlist.txt file:
dir>>dirlist.txt
To append the output of the netstat command to the end of Tcpinfo.txt, type:
netstat>>tcpinfo.txt
Using the pipe operator (|)
The pipe operator (|) takes the output (by default, STDOUT) of one command and directs it into the input (by default, STDIN) of another command. For example, the following command sorts a directory:
dir | sort
In this example, both commands start simultaneously, but then the sort command pauses until it receives the dir command's output. The sort command uses the dir command's output as its input, and then sends its output to handle 1 (that is, STDOUT).
Combining commands with redirection operators
You can create custom commands by combining filter commands with other commands and file names. For example, you can use the following command to store the names of files that contain the string "LOG":
dir /b | find "LOG" > loglist.txt
The dir command's output is sent through the find filter command. File names that contain the string "LOG" are stored as a list of file names (for example, NetshConfig.log, Logdat.svd, and Mylog.bat) in the Loglist.txt file.
To use more than one filter in the same command, separate the filters with a pipe (|). For example, the following command searches every directory on drive C:, finds the file names that include the string "Log", and then displays them in one Command Prompt window at a time:
dir c:\ /s /b | find "LOG" | more
By using a pipe (|), you direct Cmd.exe to send the dir command output through the find filter command. The find command selects only file names that contain the string "LOG." The more command displays the file names that are selected by the find command, one Command Prompt window at a time. For more information about filter commands, see Using filters
Wednesday, August 22, 2007
Upgrading GuidanceAutomationExtensions and GuidanceAutomationToolkit
So I downloaded the new installs and went about the task of installing the new versions. Well they still don't have an upgrade path in the installation program so I had to go and uninstall the old products. I had the "Web Service Software Factory - December 2006 (refresh)" installed as well so I started there. As I expected this uninstall did not go well.
After trying multiple time to uninstall (with reboots and everything else I could think of) I accidentally installed the "Web Client Software Factory - January 2007". Well to my surprise the Web Service Factory now uninstalled. Well I assumed that was the hard part, and boy was I wrong. Next after uninstalling the accidental install of "Web Client Factory" I tried uninstalling "Enterprise Library April 2007". This went as good as the Web Service Factory. So I thought maybe something in my environment got corrupted and i repaired the GuidanceAutomationExtensions, Toolkit and Enterprise Library. Still no joy.
After doing a lot of googling I came across Savij blog. His/Her problem wasn't the same as mine but the solution worked.
I tracked down the file RecipeFramework.xml in Documents and Settings\All Users\Application Data\Microsoft\Recipe Framework folder. I removed
GuidancePackage Name="StrongNamingGuidancePackage" Version="1.0" Caption="Strong Naming Guidance Package" Description="Guidance Package that simplifies strong-naming of multiple projects" Host="VisualStudio" Guid="2d4b99e7-3126-4452-8882-edfd826ea78a" ConfigurationFile="C:\Program Files\Microsoft Enterprise Library 3.0 - April 2007\Strong Naming Guidance Package\StrongNamingGuidancePackage.xml" Timestamp="633113779240000000"
GuidancePackage Name="GuidanceBlockFactory" Version="1.0" Caption="Application Block Software Factory" Description="Application Block Software Factory" Host="VisualStudio" Guid="8643B63B-A2A4-4ccc-933E-379645A3002E" ConfigurationFile="C:\Program Files\Microsoft Enterprise Library 3.0 - April 2007\Application Block Software Factory\BlockFactory.xml" Timestamp="633113779040000000"
from the GuidancePackages elements and tried to uninstall GuidanceAutomationExtensions again.
Hooray, it worked.
The only thing left now was to try the Enterprise Library and to my surprise that uninstalled successfully also.
Now I am of to try and reinstall it all again.
Friday, June 22, 2007
Introducing XslCompiledTransform
http://blogs.msdn.com/xmlteam/articles/Introducing_XslCompiledTransform.aspx
Thursday, April 26, 2007
Retrieving application settings from another assembly
Well he/she had done exactly what I was working on so I had to copy their post here so I would have it later.
Thank you Niall
dotNET - Use app.config ApplicationSettings and UserSettings
When using Settings in an Assembly or .exe you can use the Settings Designer to generate a config file using Settings. The Settings Designer provides a wrapper class which allows you to provide defaults and access the config data using Properties.
But what if you're not working inside that Assembly or .exe? this presents a problem.
If your loading the Assembly externally and want to access that Assembly's .config file you'll probably wish to use something in the System.Configuration namespace... unfortunately it's not of much use if you've created the .config file from the Settings Designer in Visual Studio!!
This is because the Designer creates Sections and ApplicationSettings and UserSettings, the System.Configuration namespace does not provide a method to access these (it has a method to access AppSettings which are a different thing.
Below I've written a workaround which locates the app.config and accesses the ApplicationSettings and UserSettings using XML instead of System.Configuration.
_server = GetAssemblySettingOrDefault(Path.Combine("C:\temp\MyAssembly.dll"), "serverLocation", "http://localhost/mydefaultserver/mydefaultserver.asmx");
Return a key/value list of ApplicationSettings and UserSettings for a given .exe's of .dll's .config file.
public static KeyValueConfigurationCollection GetAssemblySettings(string assemblyPath)
{
Configuration config = ConfigurationManager.OpenExeConfiguration(assemblyPath);
XmlDocument dom = new XmlDocument();
dom.Load(config.FilePath);
//UserSettings and ApplicationSettings
KeyValueConfigurationCollection returnList = new KeyValueConfigurationCollection();
string[] settingsTypes = { "applicationSettings", "userSettings" };
foreach (string settingType in settingsTypes)
{
XmlNode node = dom.SelectSingleNode("//configuration//" + settingType);
if (node != null)
{
try
{
if (node.HasChildNodes)
{
foreach (XmlNode childNode in node.ChildNodes)
{
if (childNode.HasChildNodes)
{
foreach (XmlNode settingNode in childNode.ChildNodes)
{
if (settingNode != null)//the Settings node
{
if (settingNode.Attributes.Count > 0) //there should be at least one attribute
returnList.Add(settingNode.Attributes[0].Value, settingNode.InnerText);//the setting name and the setting/value
}
}
}
}
}
}
catch { throw; }
}
}
return returnList;
}
// Get the value of the Assembly ApplicationSetting or UserSetting from the key.
// If the key does not have a value then return the default supplied by the caller.
public static string GetAssemblySettingOrDefault(string assemblyPath, string assemblySettingKey, string assemblySettingDefaultValue)
{
string result = assemblySettingDefaultValue;
KeyValueConfigurationCollection settings = GetAssemblySettings(assemblyPath);
if(settings != null)
{
KeyValueConfigurationElement key = settings[assemblySettingKey];
if(key != null)
result = key.Value;
}
return result;
}
Friday, March 30, 2007
Getting Multiple file extensions with Directory.GetFiles()
public static string[] GetFiles(
string path,
string searchPattern)
{
string[] m_arExt = searchPattern.Split(';');
List<string> strFiles = new List<string>();
foreach(string filter in m_arExt)
{
strFiles.AddRange(
System.IO.Directory.GetFiles(path, filter));
}
return strFiles.ToArray();
}
Thanks Andreas.
Monday, March 26, 2007
SelectSingleNode with a default namespace
< test xmlns="http://www.shaune.net/test">
< config>
< data>test< /data>
< settings>
< moredata>test< /moredata>
< /settings>
< /config>
< /test>
I loaded the xml file using
XmlTextReader reader = new XmlTextReader("C:\\xml\\My.Config.xml" );
nsm = new XmlNamespaceManager(reader.NameTable);
//I read that this is how you specify a default namespace
nsm.AddNamespace("", "http://www.shaune.net/test");
configDoc.Load(reader);
reader.Close();
and then I do a SelectSingleNode
XmlNode test2 = configDoc.SelectSingleNode("//Config");
This should work right? Wrong!!!
It turns out that XPath 1.0 doesn't support default namespace. XPath 2.0 does but I guess that doesn't help right now with .net 2.0.
What I needed to do was give the default namespace a name
nsm.AddNamespace("cfg", "http://www.shaune.net/test");
Then all my selects need to specify this namespace
XmlNode test2 = configDoc.SelectSingleNode("//cfg:Config");
What a pain.
Wednesday, February 28, 2007
Sharepoint 2007 OpenDocuments Class ActiveX Control
I have tracked down the problem to an ActiveX Control Sharepoint adds to your browser "SharePoint OpenDocuments Class".
If you disable this Add-on the SharePoint Site behaves like you would expect except you don't get the Edit Document option in you Dropdown. This is by no means a solution to my problem, but I have at least tracked it down. I hope to find a Real solution soon.
Anyone have any idea? Anyone having the same problem?
Anyway I will let you know if I find more info.
---
Ok I did a little more research on this and found that many other people are having the same problem. It turns out to be a conflict with Sharepoint Designer 2007 OWSSUPP.DLL version 12 and Office 2003 OWSSUPP.DLL version 11.
I really didn't have the option to remove Sharepoint Designer since we are using it for custom workflow creation.
I ran Microsoft Office Diagnostics and it found 1 problem but unfortunately it didn't go into any detail as to what the problem was.
Lets hope this solves the problem once and for all!