Is it possible to compress a HTTP request?

Recently I was asked (related to my articles [^] [^] about HTTP compression) if it was possible to compress the contents of a web service call.

The way HTTP compression works (as far as I know) is by the client announcing to the server (using the accept-encondig request HTTP header) what compression methods is capable of handling.

If the server is capable of using one of the accepted compression methods, compresses the response and specifies (using the content-encoding HTTP response header) the compression method used.

The client usually doesn’t know if the server accepts any kind of encoding, so it shouldn’t impose any compression to the server.

One way to allow request compression and having the server handling it would be to send a content-encoding HTTP header specifying the compression method of the request and having the server handling it and the BeginRequest event by setting a HttpResponse.Filter capable of uncompressing the request. This way it would be transparent to the request handling.

NOTE: I didn’t test this.

Web Authoring Component install fails when installing Visual Studio 2008

While trying to install Visual Studio 2008 Team Suite in my Windows XP Professional system it kept failing when installing Visual Studio because it couldn’t find the Web Authoring Component (after installing having just successfully installed it).

I’ve looked around for occurrences of this problem but I didn’t find anyone with such a problem.

I tried to install Visual Studio several times, successfully installing the Web Authoring Component (you can find it on the DVD – \WCU\WebDesignerCore\WebDesignerCore.EXE) before, but it always failed in the same step and for the same reason as before. And, even more strangely, after that, the Web Authoring Component was no longer installed.

I went through the install log file (%temp%\dd_depcheck_VS_VSTS_90.txt) and found this:

Microsoft Visual Studio Web Authoring Component ==  
    This component uses the FileRegVerCheck version check method. It will compare a given version against the version of a regkey on your machine. Registry key being interrogated: HKLM,SOFTWARE\Microsoft\Web Designer Tools\1033; Value: InstalledVersion; Version: 12.0.4518.1066. Version on user's machine:    12.0.4518.1064 Version to be installed:    12.0.4518.1066 Microsoft Visual Studio Web Authoring Component == Component to be installed.


I went to the registry and changed the value of the installed version to the one expected by Visual Studio installer and it installed it with no problems. And looks like it’s working fine.



What strikes me as the most strange is not the fact that the component on the DVD has the wrong version. What strikes me the most is the fact that I had already installed Visual Studio using the same DVD without any problems.



Good System Bad System
Windows Vista Ultimate 64bit with SP1 (clean install) Windows XP Professional with SP2
Office 2007 with SP1 (clean install) Office 2007 with SP1 (upgraded from Office 2003)
  Visual Studio 2003
  Visual Studio 2005 with SP1
  Expression Web


The Web Authoring Component installer uses a Office 2007 wrapper. I wonder if that was the problem.

Windows Home Server + Tsunami Tidal: To the Family 2.0

During TechDays Portugal 2008, Microsoft Portugal and JP Sá Couto S.A., via its Tsunami brand, launched the first Portuguese machine with Windows Home Server: the Tsunami Tidal.

To mark the event, Tsunami held a contest offering one of these machines to the best sentence about it.

When you hear everyone talking about Web 2.0, Enterprise 2.0, Life 2.0 and being at an event that promoted a World 2.0, the sentence that immediately popped my mind was: To the Family 2.0.

And it was with this sentence that I won the contest.

As I was giving my session wihle at the same time, Tsunami kindly allowed me to receive the price by proxy: my friend Nuno Gomes.

See the videos and photos of the event.

Upgrading the WCSF EventBroker Extension to WCSF 2.0

While preparing the demos for my session at TechDays Portugal 2008, I’ve noticed some changes in the Web Client Software Factory 2.0 that prevented the EventBroker Extension from compiling and running.

The problem ended out just being a little change in the WebClientApplication class. The virtual methods related to creating the builders changed.

To fix this, all it’s needed is editing the WebClientApplication class (CompositeWeb\WebClientApplication.cs, line 35).

Just replace the CreateBuilder override:

protected override Microsoft.Practices.CompositeWeb.ObjectBuilder.WCSFBuilder CreateBuilder(bool isSingleton)
{
    // Our builder adds an EventBrokerStrategy to the build.
    WCSFBuilder builder = new WCSFBuilder();
    builder.Policies.SetDefault<ISingletonPolicy>(new SingletonPolicy(isSingleton));
    return builder;
}



with an override of the AddBuilderStrategies method:



protected override void AddBuilderStrategies(IBuilder<Microsoft.Practices.CompositeWeb.ObjectBuilder.WCSFBuilderStage> builder)
{
    base.AddBuilderStrategies(builder);
    builder.Strategies.AddNew<EventBrokerStrategy>(Microsoft.Practices.CompositeWeb.ObjectBuilder.WCSFBuilderStage.PostInitialization);
}


Don’t forget that if you want to run it in IIS7 Integrated Pipeline mode, you have a few more changes to make.

WCSF 2.0 And IIS7 Integrated Pipeline Mode

While preparing the demos for my session at TechDays Portugal 2008, I’ve noticed that the Web Client Software Factory 2.0 doesn’t work with IIS7 in integrated pipeline mode because it’s trying to access the Request property of the current HTTP Context from the HTTP Application Start “event”, which is not available at this point.


This is an already known issue and you can vote to get it solved.


Meanwhile, there are two ways to work around this:


Changing the Composite Web Application Block


If you are comfortable with having your own build of this block instead of the provided strong named one, you only need to change one statement in the WebConfigModuleInfoStore class (WCSFBlocks-Feb2008\CompositeWeb\Source\CompositeWeb\Services\WebConfigModuleInfoStore.cs, line 105).


Just replace:

configuration =
    WebConfigurationManager.OpenWebConfiguration(context.Request.ApplicationPath + “/” +
                                                 configFilePath.Replace(context.Request.PhysicalApplicationPath, “”));

with:

configuration =
    WebConfigurationManager.OpenWebConfiguration(HttpRuntime.AppDomainAppVirtualPath + “/” +
                                                 configFilePath.Substring(HttpRuntime.AppDomainAppPath.Length));

Changing the application


If you prefer to (or have to) use the provided and strong named version of the Composite Web Application Block, you can always change your application.


Just open the generated global.asax file:

<%@ Application Language=”C#” Inherits=”Microsoft.Practices.CompositeWeb.WebClientApplication” %>

and add:

<script RunAt=”server”>

    private bool initialized;

    protected override void Application_Start(object sender, EventArgs e)
    {
        this.initialized = false;
    }

    protected void Application_BeginRequest(object sender, EventArgs e)
    {
        if (!this.initialized)
        {
            this.initialized = true;

            base.Application_Start(sender, e);
        }
    }

</script>

IE8 Beta 1 is out

If you want to download IE8 Beta 1 and test it, it’s here. Read the Release notes and the IE8 Readiness Toolkit which will give a detailed description of the features.

If you have any feedback, use the feedback form, which allows you to submit bugs directly to the IE team!

Several updates have been made to the IE8: Technical Beta Program  available on connect. Check it out!

Also check out the IE team’s blog:

Upcoming Typemock Webcast on March 12

Typemock is having a special Webcast on Wednesday March 12, 16:00 GMT

The live demo will include:

  • The Support of the new .NET 3.5 framework and specifically how to mock LINQ statements.
  • The improved IDE based on using colors to emphasize mocked methods.
  • Seamless integration with  Microsoft’s Visual Studio 2008.

It is also an opportunity to meet Typemock’s development team, ask questions online and share some tips.

…..and one of you can win a Nintendo Wii during in the webcast!

Click here to participate in the Webcast

TypeMock Isolator 4.2 Released

TypeMock has released version 4.2 of its mocking framework: TypeMock Insulator. Check out the release notes.

My four favorite new features in this release are:

Improved mock chaining

(If you want to learn more about chains, read this post from Gil)

Take this class to be tested:

public class TestedClass1
{
    public IDictionary<string, object> Dictionary
    {
        get { throw new NotImplementedException(); }
    }

    public object Method(bool cond)
    {
        if (cond)
        {
            return Dictionary["true"];
        }
        else
        {
            return Dictionary["false"];
        }
    }
}

The following test:

[TestMethod]
[VerifyMocks]
public void TestMethod1()
{
    object trueObject = new object();
    object falseObject = new object();

    TestedClass1 target = RecorderManager.CreateMockedObject<TestedClass1>();

    using (RecordExpectations recorder = RecorderManager.StartRecording())
    {
        recorder.DefaultBehavior.CheckArguments();

        recorder.ExpectAndReturn(target.Dictionary["true"], trueObject);
        recorder.FailWhenCalled(target.Dictionary["false"]);
    }

    object value = target.Method(true);
    Assert.AreEqual(trueObject, value);
}

Would simply fail with:

Test method TestProject1.UnitTest1.TestMethod1 threw exception:  TypeMock.VerifyException: 
TypeMock Verification: Method TestProject1.TestedClass1.get_Dictionary() has 1 more expected calls
.

Now, it just passes.


Debugger evaluation doesn’t change the test behavior


Now you can debug your code without having to change your tests. You can query mocked values without influencing your tests.


You can do this and still have the test passing:


Debugger Support


The debugger can be run inside a recording block without confusing the test


You can now step into the recording block and debug it without affecting the recording process and the test.


Recording Block


When you step in the debugger into a mocked method, the mocked method will be painted


When you step into a mocked method (or property) I’ll see that it’s mocked.


Visual Studio Cues