Michael Ash's Regex Blog : Making Dynamic XHTML pages valid with a Regex
Thursday, May 26, 2005
Michael Ash's Regex Blog : Making Dynamic XHTML pages valid with a Regex
at 2:27 PM 0 comments Posted by roni schuetz
Wednesday, May 25, 2005
HowTo create Virtual Directiories in IIS with vbs
just take the following vbs code, adapt it and save it in a *.vbs file.
//////////////////////////////////////////////////////////////////
On error resume next
'
' Running as a VBS
'
Script = True
Source = GetPath
WebRoot = "c:\inetpub\wwwroot"
set fso = CreateObject("Scripting.FileSystemObject")
for each site in fso.GetFolder(Source).SubFolders
FolderName = fso.GetFileName(Site.Path)
if lcase(FolderName) <> "solution" then
ReinstallWebApplication FolderName
CheckError
end if
next
CheckError
Function Share(Path, Name)
Output "Sharing " & Path
'dim objServices As SWbemServices
Set objServices = GetObject _
("WinMgmts:{impersonationLevel=impersonate}!/root/cimv2")
'************************ Create the new share *********************
Set objShare = objServices.Get("Win32_Share")
Set objInParam = objShare.Methods_("Create").InParameters.SpawnInstance_()
objInParam.Properties_.Item("Description") = ""
objInParam.Properties_.Item("Name") = Name
objInParam.Properties_.Item("Path") = Path
objInParam.Properties_.Item("Type") = 0
'************************ Execute the method **********************
Set ObjOutParams = objShare.ExecMethod_("Create", objInParam)
If ObjOutParams.ReturnValue <> 0 And ObjOutParams.ReturnValue <> 22 Then
Beep
Output "***Unable to create share, return value was : " _
& "objOutParams.ReturnValue"
End If
End Function
'
' The following compatability functions allow this script to function in VB
' or as a VBS file.
'
Sub Output(s)
If Script Then
WScript.echo s
Else
Debug.Print s
End If
End Sub
Function GetPath()
If Script Then
GetPath = Left(WScript.scriptfullname, InStrRev(WScript.scriptfullname, "\") - 1)
Else
GetPath = App.Path
End If
End Function
Function Run(s)
If Script Then
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run s, ,true
Else
Shell s, vbNormalFocus
End If
End Function
Sub CheckError()
if Err.Number then
msgbox err.number & ":" & err.source & ":" & err.description
if script then
wscript.quit
else
stop
end if
end if
end sub
Sub StopService(ServiceName)
Set objServices = GetObject _
("WinMgmts:{impersonationLevel=impersonate}")
Set services = objServices.InstancesOf("Win32_Service")
For Each s In services
If s.DisplayName = ServiceName Then
s.ChangeStartMode ("Manual")
s.StopService
End If
Next
end sub
Sub DeleteGPO(nc, DisplayName)
'Dim Policies As IADsContainer
Set Policies = GetObject("LDAP://CN=Policies,CN=System," & nc)
'Dim Policy
For Each Policy In Policies
If Policy.DisplayName = DisplayName Then
'Dim c As IADsContainer
Set c = Policy
RecursiveDelete c
Policies.Delete Policy.Class, Policy.Name
Exit For
End If
Next
End Sub
Sub RecursiveDelete(c)
'Dim subc As IADsContainer
For Each subc In c
RecursiveDelete subc
Next
For Each subc In c
c.Delete subc.Class, "CN=" & subc.cn
Next
End Sub
Sub Uninstall(PartialName)
Set objServices = GetObject _
("WinMgmts:{impersonationLevel=impersonate}!/root/cimv2")
Set Products = objServices.InstancesOf("Win32_Product")
For Each product In Products
If instr(product.Name,PartialName) > 0 Then
output "Uninstalling " & product.name
product.uninstall
End If
Next
end sub
Sub ReinstallWebApplication(AppName)
UninstallWebApplication AppName
InstallWebApplication(AppName)
end Sub
sub UninstallWebApplication(AppName)
set fso = createobject("scripting.filesystemobject")
on error resume next
Set DirObj = GetObject("IIS://LocalHost/W3SVC/1/ROOT/" & AppName)
DirObj.AppDelete
on error goto 0
DeleteFolder WebRoot & "\" & AppName
end sub
sub InstallWebApplication (AppName)
set fso = createobject("scripting.filesystemobject")
output "Copying : " & Source & "\" & AppName & " to " & WebRoot & "\" & AppName
fso.CopyFolder Source & "\" & AppName, WebRoot & "\" & AppName
checkerror
Dim DirObj
Const INPROC = True
Const OUTPROC = False
output "Creating Web Application for IIS://LocalHost/W3SVC/1/ROOT/" & AppName
Set DirObj = GetObject("IIS://LocalHost/W3SVC/1/ROOT")
on error resume next
DirObj.delete "IIsWebVirtualDir", AppName
on error goto 0
set mywd = DirObj.Create ("IIsWebVirtualDir", AppName)
mywd.setinfo
mywd.AppCreate true
mywd.setinfo
run """c:\program files\common files\microsoft shared\web server extensions\40\bin\fpsrvadm.exe"" -o install -p 80 -w /" & AppName
run """c:\program files\common files\microsoft shared\web server extensions\40\bin\fpsrvadm.exe"" -o check -p 80 -w /" & AppName
end sub
function MyDocuments()
set shell = createobject("WScript.Shell")
MyDocuments = shell.SpecialFolders("MyDocuments")
end function
sub DeleteFile(FileName)
set fso = createobject("scripting.filesystemobject")
if fso.fileexists(filename) then
output "Deleting : " & filename
fso.deletefile filename, true
end if
end sub
sub DeleteFolder(FolderName)
set fso = createobject("scripting.filesystemobject")
if fso.FolderExists(Foldername) then
output "Deleting : " & Foldername
fso.deleteFolder Foldername, true
end if
end sub
at 3:29 PM 2 comments Posted by roni schuetz
Retriving Data from AssemblyInfo.cs
How to get data from the AssemblyInfo.cs can be made by a helper class inside the Assembly file:
Class1.cs
public class MyWinForm:System.Windows.Forms.Form
{
[STAThread]
static void Main()
{
Application.Run(new MyWinForm());
}
// its contains much more then the Main method but for this sample its enough.
}
AssemblyInfo.cs
// that part is generated auto. by visual studio
using System;
using System.Reflection;
[assembly: AssemblyTitle("Your Custom Assembly Title")]
[assembly: AssemblyDescription("Some information about your Assembly")]
[assembly: AssemblyCompany("Your Company Name")]
[assembly: AssemblyProduct("Your Product Name")]
[assembly: AssemblyCopyright("Who has the copyright")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyVersion("1.0.0.0")]
#region Helper class
// Your generated class does not contain the follwoing part.
public class AssemblyInfo
{
// Used by Helper Functions to access information from Assembly Attributes
private Type myType;
public AssemblyInfo()
{
myType = typeof(MyWinForm);
}
public string AsmName
{
get {return myType.Assembly.GetName().Name.ToString();}
}
public string AsmFQName
{
get {return myType.Assembly.GetName().FullName.ToString();}
}
public string CodeBase
{
get {return myType.Assembly.CodeBase;}
}
public string Copyright
{
get {
Type at = typeof(AssemblyCopyrightAttribute);
object[] r = myType.Assembly.GetCustomAttributes(at, false);
AssemblyCopyrightAttribute ct = (AssemblyCopyrightAttribute) r[0];
return ct.Copyright;
}
}
public string Company
{
get
{
Type at = typeof(AssemblyCompanyAttribute);
object[] r = myType.Assembly.GetCustomAttributes(at, false);
AssemblyCompanyAttribute ct = (AssemblyCompanyAttribute) r[0];
return ct.Company;
}
}
public string Description
{
get
{
Type at = typeof(AssemblyDescriptionAttribute);
object[] r = myType.Assembly.GetCustomAttributes(at, false);
AssemblyDescriptionAttribute da = (AssemblyDescriptionAttribute) r[0];
return da.Description;
}
}
public string Product
{
get
{
Type at = typeof(AssemblyProductAttribute);
object[] r = myType.Assembly.GetCustomAttributes(at, false);
AssemblyProductAttribute pt = (AssemblyProductAttribute) r[0];
return pt.Product;
}
}
public string Title
{
get
{
Type at = typeof(AssemblyTitleAttribute);
object[] r = myType.Assembly.GetCustomAttributes(at, false);
AssemblyTitleAttribute ta = (AssemblyTitleAttribute) r[0];
return ta.Title;
}
}
public string Version
{
get {return myType.Assembly.GetName().Version.ToString();}
}
}
#endregion
Now back to the "Class1.cs" where we see how to use it:
public class MyWinForm:System.Windows.Forms.Form
{
public void SetAnAssemblyInfoToControlOfYourChoice()
{
AssemblyInfo ainfo = new AssemblyInfo();
string title = ainfo.Title;
this.YourControlInstance.Text = string.Format("{0} ...", ainfo.Title);
}
}
at 12:48 PM 0 comments Posted by roni schuetz
Tuesday, May 24, 2005
Monday, May 23, 2005
QuickCode Forum
QuickCode Forum: "The QuickCode Forum"
at 10:59 AM 0 comments Posted by roni schuetz
Thursday, May 19, 2005
Howto implement collection, just ask msdn
the article shows how to implement a fully qualified collection based on the class collectionbase.
at 3:18 PM 0 comments Posted by roni schuetz
Monday, May 09, 2005
RSS in Outlook (Plugin)
on theire website (http://www.intravnews.com/) i have found the page with following header:
my answer to them
10 Best Reasons to Use intraVnews
Rich feature set
sometimes even to much ;-)
It simply works
thats the best thing, since i installed it i never had even one problem.
Save time
correct, instead of searching all the stuff again and again, i have now everything inside my outlook. Cool
Continuous improvements
never did an update, so i can not proof it.
Standards Support
dont know the standards, but never had a problem to add a new one.
Great customer service
never needed
Our customers are satisfied
at least myself
Great performance
great performance? well did i ever had a performance problem with it, i dont remember.
Outlook-based reader
thats a goodie, but well everything is inside.
Straight-forward installation process
thats sounds good, is it really something new?
all in all thanks to the crew for such a nice tool.
at 1:08 PM 0 comments Posted by roni schuetz
SpamBayes Outlook Plugin
During the last few months i had very good experience with this plugin. Its easy to handle and saves me many many many time to held my inbox (almoast totaly) clean :-)
thanks to developers of this tool.
at 1:04 PM 0 comments Posted by roni schuetz