3 posts tagged “microsoft”
In a recent job interview, the hiring manager was looking over my résumé, and noted that I said I had experience with ".Net 3.0". He then asked, "You mean .Net 3.5, right?" At the moment, I really didn't know what the differences were between the two, even though I was pretty sure the answer was yes. I bluffed with a "yes." He took my answer at face value, but it has bothered me since then. So, for those who are curious, here's a link to where the author untangles Microsoft's branding/versioning mess with the latest releases of .Net, C# and Visual Studio:
It turns out that I was correct. My skill set is fully up to date with .Net 3.5, C# 3 and VS 2008.
My wife actually cried as we drove the final 5 mile stretch of highway to her parents' house yesterday. Tears of joy. Seattle has been so miserable for us, disconnected from good weather, and familiar and friendly people. After a false start last night trying to connect to work, I am solidly connected today from a different laptop.
OneCare and VPN
Don't ever play around with putting 3rd party security software on systems that you need to connect to your corporate VPN servers. In my case, I had Windows Live OneCare on my system. It had to have anti-virus disabled in order to allow my company-mandated AV software to work. This caused OneCare to always be in a warning status mode, telling me I need to turn on AV protection. I asked on the OneCare forum what to do, and they recommended I not have it on my system, as it could mess with other AV software in unpredictable ways. I hadn't had any problems so far, but took that as my cue to uninstall to get rid of the annoying red icon in my system tray.
Now, previously, I had to enable some ports in OneCare's firewall to enable VPN connectivity. After uninstalling it, I tried to connect to my work VPN, and got an error message stating that I needed to enable OneCare's firewall to connect. 2 hours later, my corporate IT support had tried to help me through clearing any remnants of OneCare from my system. No success. The VPN connection manager still insists that OneCare is on my system.
Last Resort
Aside from paving the system, which I am reluctant to do since my system disks are in storage, and we our primary copies of family photos and videos are on it, my last option was to re-install OneCare. This is proving impossible. This is not an uncommon problem, judging from the OneCare forums. Microsoft needs to really improve its install/upgrade/uninstall picture for OneCare. I never recall having these kinds of issues with Norton or McAffee. Blame also lies with my IT department's VPN software for failing to realize that I've actually uninstalled the dang thing.
I recently ran into a situation where my test code was failing only under certain types of test pass runs on machines that I have no access to. To diagnose the problem, I wanted to log the contents of the filesystem under certain directories.
I was already familiar with System.Diagnostics.Process and System.Diagnostics.ProcessStartInfo, which exist to let you launch processes from your .Net program. In fact, the problem was that I was attempting to launch an executable using these classes, but the executable file wasn't being found. I struggled for over an hour with trying to run 'dir /s', the command for recursively listing the contents of a folder and all subfolders, using the Process class. Eventually, I worked out one solution, shown in the C# fragment below, that allows me to run the command and grab the output into a string.
using System.Diagnostics;
using System.IO;
/// <summary>
/// Outputs recursively the contents of the specified path to
/// the test log.
/// </summary>
/// <param name="path">The path to list contents from.</param>
private static void LogRecursiveDirectoryContents(string path)
{
string batchFile = Path.ChangeExtension(Path.GetTempFileName(),".bat");
string commands = "dir /s" + Environment.NewLine;
File.WriteAllText(batchFile, commands);
ProcessStartInfo batchInfo = new ProcessStartInfo(batchFile);
batchInfo.UseShellExecute = false;
batchInfo.RedirectStandardOutput = true;
batchInfo.WorkingDirectory = path;
using (Process batchProcess = Process.Start(batchInfo))
{
SuiteLogger.LogInfo(batchProcess.StandardOutput.ReadToEnd());
batchProcess.WaitForExit();
}
}
As you can see, I used static methods in System.IO.Path and System.IO.File to generate a temporary batch file with my shell command as the contents. Then, I create a ProcessStartInfo object for running the batch file, setting 'UseShellExecute' to false and 'RedirectStandardOutput' to true. Setting these two properties will allow me to get the ouput of the batch file process from the Process's StandardOutput stream. The final step before launching the process is to set the 'WorkingDirectory' where the batch file will be executing from. In my case, I used the result of Environment.GetEnvironmentVariable("programfiles").
Finally, the process is launched in the context of a 'using' block, since Process uses native resources and needs to have Dispose() called on it in order to release them. I log the output using boilerplate code from the documentation of Process.StandardOutput and my test environment's logger.
I hope you found this useful and interesting.