Tuesday, May 25, 2010
Install Windows Azure SDK on Windows XP
As my OS is Windows XP, the install program will give me a error page saying "To install this software, you must be running a 32-bit edition of Windows Server 2008 or a 32-bit edition of Windows Vista with Service Pack 1."
A search on this topic took me to here . I followed the steps in this post to be able to install the tools on XP.
1. Create an empty directory somewhere on your file system called Exported.
2. Navigate to the Tools folder under the install directory for the Windows Installer SDK.
In my case, this is under C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin
3. Launch MsiDb.exe
4.) In the MsiTable - Select Database for Import/Export dialog, browse to and select the WindowsAzureSDK-x86.msi file.
5.) In the MsiTable - Select Folder containing Text Files dialog, browse to and select the Exported directory you created earlier.
6.) In the MsiTable - Database table import/export window, click the Export radio button.
7.) In the list, select LaunchCondition, and then click OK.
8.) Click the Quit button.
8.) Open "...\Exported\LaunchCondition.idt" in Notepad
9.) Remove the following lines in this file:
(VersionNT = 600 AND ServicePackLevel >= 1) OR (VersionNT > 600) To install this software, you must be running a 32-bit edition of Windows Server 2008 or a 32-bit edition of Windows Vista with Service Pack 1.
IISVERSION AND ASPNET To use this software, you must enable Internet Information Services 7.0 with ASP.NET support. See the product release notes for details.
10.) Save the file.
11.) Navigate to the Tools folder under the install directory for the Windows Installer SDK
12.) Launch MsiDb.exe
13.) In the MsiTable - Select Database for Import/Export dialog, browse to and select the WindowsAzureSDK-x86.msi file.
14.) In the MsiTable - Select Folder containing Text Files dialog, browse to and select the Exported directory you created earlier.
15.) In the MsiTable - Database table import/export window, click the Import radio button.
16.) In the list, select LaunchCondition.idt, and then click OK.
17.) Click the Quit button.
18.) Launch the WindowsAzureSDK-x86.msi file, and enjoy.
Thursday, May 13, 2010
How to remove ANTI MALWARE DOCTOR
- 重启到安全模式, 删除对应的文件和注册项
- 注意病毒文件是隐藏的, 要在"Folder Options"里显示隐藏文件才能看到病毒文件
- 如果注册表工具已经被禁止
\enemies-names.txt \Antimalware Doctor.exe
HKEY_CURRENT_USER\Software\Antimalware Doctor Inc\Antimalware Doctor
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall\Antimalware Doctor
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run "Antimalware Doctor.exe"
如果"Folder Options"被禁止, 使用如下注册表恢复:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer]
"NoFolderOptions"=dword:0000000
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Internet Explorer\Restrictions]
"NoBrowserOptions"=dword:00000000
把以下内容存成vbs后缀的文件, 并运行它:
'Enable/Disable Registry Editing tools
'?Doug Knox - rev 12/06/99
Option Explicit
'Declare variables
Dim WSHShell, n, MyBox, p, t, mustboot, errnum, vers
Dim enab, disab, jobfunc, itemtype
Set WSHShell = WScript.CreateObject("WScript.Shell")
p = "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System\"
p = p & "DisableRegistryTools"
itemtype = "REG_DWORD"
mustboot = "Log off and back on, or restart your pc to" & vbCR & "effect the changes"
enab = "ENABLED"
disab = "DISABLED"
jobfunc = "Registry Editing Tools are now "
'This section tries to read the registry key value. If not present an
'error is generated. Normal error return should be 0 if value is
'present
t = "Confirmation"
Err.Clear
On Error Resume Next
n = WSHShell.RegRead (p)
On Error Goto 0
errnum = Err.Number
if errnum <> 0 then
'Create the registry key value for DisableRegistryTools with value 0
WSHShell.RegWrite p, 0, itemtype
End If
'If the key is present, or was created, it is toggled
'Confirmations can be disabled by commenting out
'the two MyBox lines below
If n = 0 Then
n = 1
WSHShell.RegWrite p, n, itemtype
Mybox = MsgBox(jobfunc & disab & vbCR & mustboot, 4096, t)
ElseIf n = 1 then
n = 0
WSHShell.RegWrite p, n, itemtype
Mybox = MsgBox(jobfunc & enab & vbCR & mustboot, 4096, t)
End If
Tuesday, June 16, 2009
WCF Serialization
WCF中的序列化
[DataContract(Namespace = "http://webabcd.cnblogs.com/")]
public class DataContractSerializerObject
{
// Name - 数据成员的名称
// Order - 数据成员的序列化和反序列化的顺序
[DataMember(Name = "UniqueID", Order = 0)]
public Guid ID { get; set; }
[DataMember(Order = 1)]
public string Name { get; set; }
[DataMember(Order = 2)]
public int Age { get; set; }
[DataMember(Order = 3)]
public DateTime Time { get; set; }
}
生成XML是怎样的? 以下的Mapping关系:
2、Namespace可以通过DataContractAttribute中的NameSpace参数定义。
Friday, September 19, 2008
Tuesday, August 19, 2008
Monday, August 18, 2008
Url Rewriting with ASP.NET
Chinese Version == > 在ASP.NET中重写URL
Free HttpModules to Perform URL Rewriting: Handling ASP.NET PostBacks with URL Rewriting
How to implement a Form Control Adapter that works with URLRewriting
IIS ISAPI URL Rewriting
IIRF(Ionic's Isapi Rewrite Filter)
Other resource==>
重提URL Rewrite(2):使用已有组件进行URL Rewrite
重提URL Rewrite(4):不同级别URL Rewrite的一些细节与特点
ScottGu's==>
Tip/Trick: Url Rewriting with ASP.NET
Friday, August 08, 2008
Use Castle Windsor as IoC container in Microsoft.MVC
There are already some articles talking about how to use Unity IoC and StructureMap in Microsoft.MVC. I've used Windsor container for quite a while. Here I want to show you how to add the Castle Windsor IoC Container to an ASP.NET MVC Framework Application to create controllers and inject their dependencies.
1. First, let's implement our WindsorContainer, here we add each MVC controller as normal Component.
// *********************
// WebContainer.cs
// *********************
using Castle.Windsor;
using Castle.Windsor.Configuration.Interpreters;
using Castle.Core.Resource;
using Shop.Frontend.Controllers;
namespace Duplium.Shop.Frontend
{
public class WebContainer : WindsorContainer
{
public WebContainer() //: base(new XmlInterpreter(new ConfigResource()))
{
AddFacilities();
AddComponents();
}
private void AddFacilities()
{
}
private void AddComponents()
{
base.AddComponent<DemoProductsDataContext>();
base.AddComponent<ProductController>();
base.AddComponent<HomeController>();
}
}
}
2. Then, implement a ControllerFactory class. It'll be used and replace MVC default controller factory.
// *********************
// ControllerFactory.cs
// *********************
using System.Web.Mvc;
using Castle.Core;
using Castle.Windsor;
namespace Shop.Frontend
{
public class ControllerFactory : DefaultControllerFactory
{
protected override IController GetControllerInstance(Type controllerType)
{
if (controllerType == null)
return (IController)null;
IWindsorContainer container = null;
try
{
container = ((GlobalApplication)(this.RequestContext.HttpContext.ApplicationInstance)).Container;
return (Controller)container.Resolve(controllerType);
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
throw;
}
}
}
}
3. At last, assembly them together in Global.asax
// *********************
// Global.asax.cs
// *********************
using Castle.Core;
using Castle.Windsor;
namespace Shop.Frontend
{
public class GlobalApplication : System.Web.HttpApplication, IContainerAccessor
{
private static IWindsorContainer container;
#region IContainerAccessor
public IWindsorContainer Container
{
get { return container; }
}
#endregion
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);
}
protected void Application_Start()
{
container = new WebContainer();
RegisterRoutes(RouteTable.Routes);
ControllerBuilder.Current.SetControllerFactory(
new ControllerFactory()
);
}
protected void Application_End(object sender, EventArgs e)
{
container.Dispose();
}
}
}