Good email regexp
25.08.2007 Суббота 19:45
^([\w\-\.]+)@((\[([0-9]{1,3}\.){3}[0-9]{1,3}\])|(([\w\-]+\.)+)([a-zA-Z]{2,4}))$
via Regexlib.com
Blocked Internet traffic while on VPN connection
14.08.2007 Вторник 20:43
When you connect to a remote network through VPN, sometimes it blocks other internet traffic. For example, Skype or ICQ may stop working. Other Internet aplications may still work but somewhat slow. The reason for that is that while on VPN, all of your Internet traffic goes through the remote network. That network's firewalls may have some ports closed for security reasons. To avoid streaming all the traffic through the remote network and still seeing the network's servers, do the following:
Open the properties for the VPN connection -> Networking tab -> Internet Protocol TCP/IP -> Properties -> Advanced -> General Tab -> uncheck the "Use default gateway on remote network". It will put all the things with local internet in order. Click OK for 3 times and reconnect the VPN.
Courtesy one of my collegues Anton.
CAML queries issues
27.07.2007 Пятница 17:36
Software: Microsoft SharePoint
Got this message when trying to access a SharePoint list in C# code using CAML query.
One or more field types are not installed properly. Go to the list settings page to delete these fields.
The problem was that names of fields that are to be used in CAML queries are SharePoint internal ones. Not what you see in any list configuration screens. Quite often internal names differ from displayed ones. For example, if displayed name contains a space (e.g. "Tab Order"), internal name will have "_x0020_" in place of the space character ("Tab_x0020_Order"). Another reason why internal and displayed names differ is that when you rename a field, its internal name doesn't change. Period.
To get to know what the internal name of a field is, go to its edit screen and do the View Source thing in browser. Somewhere in the code (usually close to the opening
tag) there's internal name. Also internal name, though somewhat altered, can be found in the URL of the field edit screen. It's altered because "_"'s are replaced with their encoded version. For example, this part of the URL:
... Field=Key%5Fx0020%5FOrder
really means that internal name of the field is "Key_x0020_Order".
Remote Desktop Console Connection
25.07.2007 Среда 23:17
mstsc /console
Security Update for Microsoft .NET Framework, Version 1.1 Service Pack 1 (KB886903)
02.06.2007 Суббота 14:15
Automatic Update in Windows downloaded the following item and was trying to install it:
Security Update for Microsoft .NET Framework, Version 1.1 Service Pack 1 (KB886903)
But intallation was failing with no explanation given. I'll skip details of how I found what was wrong and tell the final result. The problem was with TEMP and TMP environment variables. They contained invalid characters (in my case it was a semicolon).
Viewing Debug and Trace messages in .Net
25.05.2007 Пятница 18:25
You can put these in your .Net C# code:
System.Diagnostics.Debug.Write("A debug message");
System.Diagnostics.Trace.Write("A debug message");
And use
DebugView to view your debug and trace messages.
XmlDocument.Load locks for writing
25.05.2007 Пятница 18:01
Yesterday I saw the following error message in the Event Log:
The process cannot access the file 'C:\Bla-bla.Config.xml' because it is being used by another process.
Exception type: IOException
Source: mscorlib
Target Site: Void WinIOError(Int32, System.String)
The error was happening in a function that was attempting to write to the file. I remembered that previously I had a similar issue that was caused by incorrect locking used to prevent multiple threads from writing simultaneously to the file (link). I tweaked code to make locking mechanism work as expected but... surprisingly, I still got the same message.
I spent some time digging for real cause of the problem. Finally, I found out that XmlDocument.Load(System.String) function, that was used in other places in code to read the same file, for some reason locks the file when openning it. You can read but you can't write.
I solved the issue by replacing
XmlDocument doc = new XmlDocument();
doc.Load("C:\Bla-bla.Config.xml");
with
XmlDocument doc = new XmlDocument();
using (FileStream stream = new FileStream
("C:\Bla-bla.Config.xml", FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
doc.Load(stream);
stream.Close();
}
Question remains open as to what will happen when a thread attempts to read the file when it's being written to by another thread. May be locking should be implemented on read attempts too.
Unable to add an assembly to GAC
22.02.2007 Четверг 00:06
Got this when trying to add an assembly to the GAC using the .Net Framework configuration tool:
"Unable to add the selected assembly. The assembly must have a strong name (name, version and public key)."
When tried to use gatutil.exe got this:
"Failure adding assembly to the cache: Unknown Error"
The reason... Well, it's simple. I was trying to add a .Net 2.0 assembly to the .Net 1.1 GAC. My cold must've been giving me hard time today.
Wake-on-LAN settings
20.02.2007 Вторник 18:20
Software: Windows XP
To make Wake-on-LAN (WOL) work verify your system against the following check list:
- WOL feature should be supported by mother board
- WOL feature should be enabled in the mother board BIOS setup
- WOL feature should be supported by the LAN adapter (the network card)
- I heard some mention that in order for WOL to work, LAN adapter should be connected to the mother board with a 3-pin connector.
The drawing sourceI suspect it relates to some older hardware stuff. Wasn't required in my case because I use a built-in LAN card anyway.
- In Windows, check properties of the network adapter in Device Manager. Anything related to WOL should be enabled. For example, in Windows XP: Network card properties —> Power Management —> Allow this device to bring the computer out of standby.
- You cannot wake up a computer by an arbitraty network request, e.g. by a ping. Wake-on-LAN is a special UDP packet. It has specific format and contains computer network card's MAC address. In order to send such a packet, special software is required. This one can be recommened (it is very simple and proven to work):
http://magicpacket.free.fr/. To use it you'll need to know IP address of the computer and MAC address of the network card.
- Make sure all neccessary holes exist in the firewall. Unfortunatley, I don't know what holes are required, because in my case everything worked right away, no tweaking to the firewall was required.
btm to XSLT
14.02.2007 Среда 19:33
Software: BizTalk 2006, Visual Studio 2005
BizTalk Mapper creates files with .btm extension. At compilation time it converts it to XSLT code and embeds it into the resulting assembly. To see the generated XSLT, validate the map (right-click on the btm file in Visual Studio and select "Validate Map"). After validation is done you'll see two path lines in the output pane. They contain paths of the generated XSLT file and Extension Object XML file.
What's this "clicking" noise I hear when surfing the net?
28.01.2007 Воскресенье 14:38
Q: What's this "clicking" noise I hear when surfing the net?
A: The "click" is the sound that Microsoft Internet Explorer makes when you click on a web link. If you wish, you can turn this feature off in the Control Panel. In Windows XP, open the Sounds, Speech and Audio Devices (it's just Sounds & Multimedia in Windows 2000), then Sounds and Audio Devices, then on the Sounds tab, scroll down to the section for Windows Explorer. Click the event called "Start Navigation," and change the setting to "none" from the dropdown box. Click OK to apply the change, and the clicks are gone.
via Skype.com