Microsoft HTTPAPI/2.0 use Port 80 – Cannot Start WAMP Apache

December 10th, 2011
Screenshot of Microsoft Web Deployment Service

Microsoft Web Deployment Service

I just installed fresh Microsoft Windows 7, and I installed WAMP for my APACHE – PHP server. When I want to start the server, the WAMP icon turn yellow (not green). Upon further investigation, I found out that when I go to WAMP dock icon -> Apache -> Service -> Test Port 80, I received a message that Port 80 is used Microsoft HTTPAPI/2.0.

I fire up Google and most of the solutions mentioned about turning off Microsoft SQL Server Reporting Services (SSRS). I have browsed my Services and couldn’t find any SSRS installed (although I have SQL Server 2008 Express installed).

Luckily I came across this forum which gives me the solution.

We must stop Web Deployment Agent Service (MsDepSvc) from Administrative Tools > Services area. You can disable the service, to have port 80 ready when you boot your system.

The following article will explain about this service, you can follow the link below to read more.

Microsoft Web Deploy

Web Deploy is a free technology built by my team that can improve web deployment. It is a deployment service that runs on a server, and enables you to either locally or remotely deploy applications onto it. Web Deploy includes built-in support for creating virtual directories and applications within IIS, copying files and folders, provisioning databases (both SQL Server and MySQL), setting file-system ACLs and more (it even includes built-in providers for things like setting registry entries, registering COM components, etc). In addition to having these built-in deployment features, it also supports a .NET based provider API that enables you to create and plug-in your own custom deployment actions – which allow you to customize it however you want.

http://weblogs.asp.net/scottgu/archive/2010/09/13/automating-deployment-with-microsoft-web-deploy.aspx

How it works: ASP.NET Custom Validator

June 23rd, 2011

This time I will highlight how ASP.NET validator works (in particular the Custom Validator). This control has almost the same attributes as the other validation controls, but with Custom Validator you can specify your own method (Server code and Client script) to validate.

When to use ASP.NET Custom Validator?

Custom Validator is a suitable for the following scenario:

  • Validating checkbox (Agreements, Terms and Conditions checkbox). Please note that you cannot use Required Field validator for check box control.
  • Validation that involves multiple controls. For example: provide at least one telephone number from three available inputs (mobile, work phone, and home phone text boxes).
  • Validation that involves certain calculation or custom logic

How to use ASP.NET Custom Validator

You can assign two validation functions into Custom Validator. They are Server side in code behind and client script (VB or JavaScript).

  1. Create the server side function in code behind to validate the values in server (mandatory). This is important because we do not have control over the client script and it can be easily bypassed.
    Public void ServerValidation (object source, ServerValidateEventArgs arguments)
    {
    int i = int.Parse(arguments.Value);
    arguments.IsValid = ((i%2) == 0);
    }
  2. Create the client side JavaScript function to create validation on client side.
    <script language="javascript">
    function ClientValidate(source, arguments)
    {
    if ((arguments.Value % 2) == 0)
    arguments.IsValid=true;
    else
    arguments.IsValid=false;
    }
    </script>

Your Control will look like

<asp:CustomValidator id="CustomValidator1"
ControlToValidate="Text1"
ClientValidationFunction="ClientValidate"
OnServerValidate="ServerValidation"
Display="Static"
ErrorMessage="Not an even number!"
runat="server" />

Why Custom Validator is not working

  • Do not set ControlToValidate, if you want to validate multiple fields. Since Custom Validator will not run if the ControlToValidate is empty value.
  • Call Page_ClientValidate(); in JavaScript and Page.IsValid in Page Behind to check if the validation is fulfilled.

Further Information

http://msdn.microsoft.com/en-us/library/9eee01cx%28VS.90%29.aspx

Floating Element Causes Disappearing (Phantom) Background Image CSS in IE7, IE6

January 13th, 2011

Symptom: When you set background image in a div, and have a floating element on top of the background image, it will cause the image to flicker, disappear, or missing some part of the image. This happens when you scroll the page up and down and occur in IE prior version 8 (mainly I experienced it in IE7 and IE6).

If you have been working with HTML and CSS for a long time, you should be familiar with this bug. If it’s not, then probably you haven’t done something advanced in your design.

Solution:

  1. You can set the element with background to have relative position.
    #div1 { background: url(‘../images/bg.jpg’) top left no-repeat; position:relative; }
  2. Or, you can set the height of the DIV with the background. Easiest way is to have CSS specific for IE6 / IE7 and set the height to 1%
    #div1 { background: url(‘../images/bg.jpg’) top left no-repeat; height: 1%; }

Submit A Read-only or Disabled Form Field – Microsoft Dynamic CRM

May 17th, 2010

Disabling or setting a form field to read-only will cause CRM to ignore any changes to that field on save. For any reason, a form field maybe disabled or set to read-only to prevent the user change the data manually. In some cases, we may need to set the value via form Javascript.

In this case, CRM Form will not save/submit when you make any changes to these disabled fields via form script. Put the following line of script on your form onload event for every disabled/read-only field, to force CRM to submit any changes made to the field.

crmForm.all.NEW_CUSTOMFIELDNAME.ForceSubmit = true;

CRM 4.0 Create customeraddress 0x80040216 An unexpected error occurred

March 4th, 2010

When I tried to add more address into an account in CRM, I keep getting this error with error message that doesn’t really help you nail down the problem. If you face the same error or you want to know how to create customeraddress using CRM 4.0 SDK DynamicEntity, please read through. The following simple code highlight how to add address into an account (You can also do on contact by changing the entity name “account” to “contact”. Please note that the values (i.e. street1, street2, city, …) is already set.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
var newAddress = new DynamicEntity
  {
     Name = NameOfEntity,
     Properties = new PropertyCollection()
  };
 
var prop = newAddress.Properties;
string addressName = street1 + " " + street2 + " " + city;
prop.Add(new StringProperty("name", addressName));
 
prop.Add(new StringProperty("line1", street1));
prop.Add(new StringProperty("line2", street2));
prop.Add(new StringProperty("city", city));
// .... add other details as necessary ....
prop.Add(new StringProperty("fax", fax));
prop.Add(new StringProperty("primarycontactname", contactName));
 
// .... this is the important property that you should add ...                       
prop.Add(new EntityNameReferenceProperty(AttrObjectType, new EntityNameReference("account")));
prop.Add(new LookupProperty(AttrParent, new Lookup("account", parentId)));
 
var targetCreate = new TargetCreateDynamic {Entity = newAddress};
var request = new CreateRequest {Target = targetCreate};
var response = (CreateResponse)CrmServiceUtil.GetCrmService().Execute(request);
return response.id;

Rule of thumb, do not forget to set the ParentId attribute, as well as ObjectTypeCodeId. That should do the trick. The above code uses .NET 3.0.