October 2007 Entries
Here's a quick way to get a clone of your serializable object in C#:
public static object GetClone(object cloneThis)
{
BinaryFormatter bf = new BinaryFormatter();
MemoryStream ms= new MemoryStream();
bf.Serialize(ms, cloneThis);
ms.Flush();
ms.Position = 0;
return bf.Deserialize(ms);
}
If you use FireFox to debug on Windows Vista, you most likely have noticed how ridiculously slow it is rendering localhost requests versus Internet Explorer. No, this isn't a conspiracy, just an issue with IPv6, FireFox, and Windows Vista.
To fix this issue, do the following:
1) Open up about:config in your FireFox browser
2) Filter or scroll down to network.dns.disableIPv6 and set this value to true
3) Restart FireFox and you should be good to go!
I have encountered a lot of bad HTML formating in my days, and one quick way to organize the HTML files via Visual Studio 2005 is to use the Format Document option from the Edit menu.
One thing about the default settings for Format Document (or Selection), is that it will wrap lines by default, which to me, can be undesirable. To change this setting, go the Tools -> Options and then navigate the tree to Text Editor -> HTML -> Format, and uncheck the Tag Wrapping check box towards the bottom of the page.
Here too you can set any specific...
To change the default editor for Internet Explorer when you right click on a page and choose "View Source", do the following:
1) Open up regedit
2) Browse to
HKEY_LOCAL_MACHINE\ Software\ Microsoft\ Internet Explorer\
3) If they don't exist, create the following "folders" (keys) within eachother and below that key:
View Source Editor\Editor Name
4) Next, modify the default value of the Editor Name key and set it to the path of your favorite editor such as
C:\Program Files\TextPad 4\textpad.exe
5) Restart IE and you are good to go!
To help make applications a bit more portable, it is nice to know you can override the appSettings group in your app.config or web.config file in the following manner:
<appSettings file="userAppSettings.config">
<add key="mysetting" value="mysetting_value" />
<add key="mysetting_2" value="mysetting_value_2" />
</appSettings>
The, in the same directory, create a file userAppSettings.config, and place the settings you want to override within:
<appSettings>
<add key="mysetting" value="mysetting_value" />
</appSettings>
Notice there is no file attribute here. Also, note that you can change the location of the file; it doesn't neccessarily have to be in the same directory as your app.config/web.config.
If you don't override a setting in your userAppSettings.config file, the "default"...
Sometimes it is a whole lot nicer to recycle the specific Application Pool of concern rather than recycling IIS with "iisreset".
There is a handy script in %windir%\system32 called iisapp.vbs and you can just run :
D:\>C:\WINDOWS\System32\iisapp.vbs /a "My Pool" /r
Connecting to server ...Done.
Application pool 'My Pool' recycled successfully.
The October 2007 issue of TechNet Magazine is out on the website. Check out my IT Toolbox column here:
http://technet.microsoft.com/magazine/3e23e94e-804a-4a57-8b32-c1a273899a14
In this issue I covered:
PowerShell Analyzer More Powerful Scripting
Auslogics Disk Defrag Defrag Disks
FileZilla Transfer Files
PE Explorer Edit Executables
Endpoint Security (Book Review)