Tuesday, May 27, 2008
GUID Validator
Public Function IsGUID(ByVal guid As String) As Boolean
Dim rtn As Boolean = False
If Not String.IsNullOrEmpty(guid) Then
Dim guidRegEx As Regex = New Regex("^(\{{0,1}" & _
"([0-9a-fA-F]){8}-([0-9a-fA-F])" & _
"{4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-" & _
"([0-9a-fA-F]){12}\}{0,1})$")
rtn = guidRegEx.IsMatch(guid)
Else
rtn = False
End If
Return rtn
End Function
Word 2007 OOXML Tags
Saving text in word format it's quite simple, but do it in word 2007 format (.docx) it's different (it uses xml). Formatting this text is more difficult, 'cause format tags isn't well documented. This is why i put some of them above.
<p>text</p>
<w:p><w:r><w:t>TEXT</w:t></w:r></w:p>
<br />TEXT
</w:t></w:r><w:br /><w:r><w:t>TEXT
Bold
<w:r><w:rPr><w:b /></rPr>TEXT</w:r>
Underline
<w:r><w:rPr><w:u w:val="single"/></rPr>TEXT</w:r>
Italic
<w:r><w:rPr><w:i /></rPr>TEXT</w:r>
Colors
<w:r><w:rPr><w:color w:val="FF0000" /></rPr>TEXT</w:r>
Sunday, May 18, 2008
Unlocking locked files on Team Foundation Server
1. On command prompt, go to C:\Program Files\Microsoft Visual Studio 8\Common7\IDE on TFS server
2. Write:
“tf lock $/ProjectName/LockedFileName /lock:none /workspace:WorkArea;UserThatLocks /server:TFSServerName”
4. Write:
“tf undo $/ProjectName/LockedFileName /workspace:WorkArea;UserThatLocks /server:TFSServerName”
Friday, May 16, 2008
Ajax - FadeIn and FadeOut Animation
In this example, we wanna show a customized tooltip when the mouse is over a button and then that it disappears when the mouse is out. We use fadeIn and fadeOut animations, 0.5 seconds long and with a framerate of 20fps:
<cc1:AnimationExtender ID="AnimationExtender1" runat="server"
TargetControlID="ImageButton1">
<Animations>
<OnMouseOver>
<sequence>
<StyleAction AnimationTarget="info"
Attribute="display" Value="block"/>
<FadeIn AnimationTarget="info" Duration=".5"
Fps="20" />
</sequence>
</OnMouseOver>
<OnMouseOut>
<sequence>
<FadeOut AnimationTarget="info" Duration=".5"
Fps="20" />
<StyleAction AnimationTarget="info"
Attribute="display" Value="none"/>
</sequence>
</OnMouseOut>
</Animations>
</cc1:AnimationExtender>
info is a "div" that contains our tooltip. Must be written in this way:
<div id="info" style="display: none; z-index: 2; opacity: 0;">
Thursday, May 15, 2008
OpenVPN on PFSense: Site to Site
Office1 LAN: 192.168.0.0/24
Office2 LAN: 192.168.1.0/24
One office will be the VPN server, the other will be the VPN client
Let's configure Office1 as server.
Use TCP protocole and, if you have other VPN tunnels, set a diffrent port (in this example i use the port 1193). Obviously we have to creat a firewall rule to permit WAN connection on this port.
Office2 configuration
Let's configure Office2 as client.
“Remote network” must be the IP address of the Office1 LAN dell’Ufficio1.