Blog posts


  • Turn off HTTP compression from web.config

    September 01, 2010 | Tags: ASP.NET
    Add the following lines into your web.config to disable HTTP/Gzip compression in IIS7:

    <system.webServer>
    <urlCompression doStaticCompression="false" doDynamicCompression="false"/>
    </system.webServer>

  • Enable caching from ASP.NET (in IIS7)

    September 01, 2010 | Tags: ASP.NET, Snippet
    Add the following section to your web.config to enable caching (in IIS7):

    <system.webServer>
    <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
    <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll"/>
    <dynamicTypes>
    <add mimeType="text/*" enabled="true"/>
    <add mimeType="message/*" enabled="true"/>
    <add mimeType="application/javascript" enabled="true"/>
    <add mimeType="*/*" enabled="false"/>
    </dynamicTypes>
    <staticTypes>
    <add mimeType="text/*" enabled="true"/>
    <add mimeType="message/*" enabled="true"/>
    <add mimeType="application/javascript" enabled="true"/>
    <add mimeType="*/*" enabled="false"/>
    </staticTypes>
    </httpCompression>
    <urlCompression doStaticCompression="true" doDynamicCompression="true"/>
    </system.webServer>

    Code taken from How to GZip on ASP.NET and GoDaddy

  • Fix height and overflow hidden problem in Firefox

    August 13, 2010 | Tags:
    The problem
    Older versions of Firefox (for instance 3.0) doesn't handle overflow:hidden very well. It seems to ignore the style if it contains elements (like Flash object) that is larger than the specified height and/or width. It works well in the latest versions of Firefox (3.5+) as well as IE7/8.

    Here's a sample of the problem. The whole 650 pixels high Flash object will be shown, eventhough the div containing it has overflow set to hidden.
    <div>
    <div style="width: 100%; height: 550px; overflow: hidden;">
    <div style="width: 100%;">
    <embed height="650" width="100%" src="/MyFlash.swf" type="application/x-shockwave-flash">
    </div>
    </div>
    </div>

    The solution
    The solution is simple, although not quite logical. If you add a overflow:auto style to a div outside the one you have overflow:hidden it magicly solves the problem:
    <div style="overflow: auto;">
    <div style="width: 100%; height: 550px; overflow: hidden;">
    <div style="width: 100%;">
    <embed height="650" width="100%" src="/MyFlash.swf" type="application/x-shockwave-flash">
    </div>
    </div>
    </div>

  • AS3 TextField alpha problem solved

    August 09, 2010 | Tags: Actionscript, AS3, Troubleshooting, Flash
    Recently I ran into some trouble with a TextField in a Flash/AS3 project. Since the font couldn't be embeded (due to size) the TextField was changed to _sans / "Use device fonts" (_sans and _serif are generic fonts that will use the best match from the clients computer). This introduced a problem, the alpha fades that previously worked with the embeded font suddenly stopped. Setting the alpha value didn't affect the TextField at all.

    The solution to this problem is to set a blend mode on the TextField as for some reason alpha values and device fonts doesn't play well together in the default BlendMode.Normal setting.

    Set the blend mode:
    myTextField.blendMode = BlendMode.LAYER;

    And don't forget the:
    import flash.display.BlendMode;

  • A smarter way to include javascripts and CSS to reduce page load times

    July 26, 2010 | Tags: ASP.NET, SEO, C#
    Published my first article over at CodeProject about reducing load time by combining javascript and stylesheets in one, compressed file.

    Reduce the number of HTTP requests required to render the page, resulting in faster page loads by combining and compressing multiple javascripts into one javascript file and multiple CSS files into one style sheet file.

    Read full article at CodeProject