Archive for the 'IT' Category

HTTP Compression in ASP.NET 2.0

These two days, I was looking for a way to enable HTTP Compression in ASP.NET 2.0 for my project - AquariumFishExporter.com.

Last time, I tried to enable to http compression in IIS6 for ASP.NET 1.1. Here is a good guide to follow - IIS Compression in IIS6.0. Currently, I am using a shared web hosting with no access to the server configuration. So, I have to find a way to enable the compression without touching the IIS settings.

At first I tried the Mads Kristensen’s way of compression.


The new System.IO.Compression namespace in .NET 2.0 makes it easy to implement HTTP compression without having to touch IIS. The best thing about it is that you no longer need any third party compression components, it’s all build directly into .NET Framework.

There are different ways to implement the compression but I think an HttpModule is the right choice for this feature. Let’s create one and call it CompressionModule.

The CompressionModule must adhere to the following rules:

  • Support both GZip and Deflate compression
  • Only compress if the browser supports it
  • Simplest possible implementation

These rules are important to make sure that the compression will run smoothly in every situation.

Implementation

Download the CompressionModule.cs file below and add it to the App_Code folder in the root of your website. Then add these lines to the web.config’s <system.web> section.

<httpModules>
    <add type="CompressionModule" name="CompressionModule" />
</httpModules>

That’s all you have to do to enable HTTP compression on an ASP.NET 2.0 website.

Download

 

CompressionModule.zip (0,75 KB)

Unfortunately, the compression is activated but all the javascript validation doesn’t work as expected. It caused by the compression on the WebResource.axd.

The .NET 2.0 framework changed the way clientside JavaScript is delivered to the browser. Previously, ASP.NET 1.1 used the aspnet_client directory whereas now 2.0 uses WebResource.axd.

The only solution to solve this problem is exclude the compression on WebResource.axd. But, I couldn’t find a way to do it.

Then, I tried a another famous Http Compression engine for ASP.NET 2.0 - Blowery.

Blowery - This is a pretty simple recompile of the version 6 source, targetting the 2.0 version of the .NET Framework. It now uses the built-in deflate and gzip streams found in System.IO.Compression instead of #ziplib. I consider this a beta release; please test it thoroughly before releasing it onto any production systems. [Binary Only, Source Only]

Here is the implementation plan:

  1. Download the Binary DLL.
  2. Extract the package and copy the extracted files into the bin folder of your .Net application.
    blowery.Web.HttpCompress.dll
    blowery.Web.HttpCompress.dll.xml
    ICSharpCode.SharpZipLib.dll
    ICSharpCode.SharpZipLib.dll.xml
  3. Modify your Web.config
    1. Add to the configSections
      <sectionGroup name="blowery.web">
       <section name="httpCompress" type="blowery.Web.HttpCompress.SectionHandler, blowery.Web.HttpCompress"/>
      </sectionGroup>
    2. Add to the httpModules section inside system.web (if httpModules section does not exist, create it)
      <httpModules>
      <add name="CompressionModule" type="blowery.Web.HttpCompress.HttpModule, blowery.web.HttpCompress"/>
      </ httpModules>
    3. Add to the configuration section
      <blowery.web>
      <httpCompress preferredAlgorithm="deflate" compressionLevel="high">
          <excludedMimeTypes>
          <add type="image/jpeg"/>
          <add type="image/gif"/>
          </excludedMimeTypes>
          <excludedPaths></excludedPaths>
      </httpCompress>
      </blowery.web>

However, it still giving the same problem on the javascript validation. Luckily, I managed to find Ross Hawkins’s Troubleshooting WebResource.axd. He suggested to download the source code from Browely and change a small code in Line 85, httpCompress.cs:

From

string realPath = app.Request.Path.Remove(0, app.Request.ApplicationPath.Length+1);

To

string realPath = Path.GetFileName(app.Request.Path);

Then, I recompile the library and add it into my project. Finally, it works.

Here is the statictic of enabling http compression:

 

Thanks to Port80 - Http compression Checker

Now, my page load 4.5 times faster. The compression rate is 79%.

Tagged Under ( )

How to create a good Affiliate Banner?

Nowadays, I was researching on internet marketing. I read tons of blogs and articles. They keep talking about TRAFFIC (not traffic jam :))- it is Web Traffic. One of the most common way to achieve a high volume of traffic is create your own affiliate program. One of the key component of the program is Affiliate Banner. Then, try to place your banner everyway such as forum, blogs and websites. Your banner must be attractive and meaningful. Here is some tips to create a Effective Affiliate Banner

  • Small file size
    • Ideal size is between 10K and 15K.
    • Why? because People have no time to wait. A large .gif or .jpg file takes a few seconds to download, wherein the visitor may have either left the page or just scrolled down the page without seeing the banner.
    • Conclusion: Big File Size = No See = No Click
  • A clear call to Action on your banner.
    • Most common message for the call are ‘click here’ or ‘sign up now’, where you guide the user to click on the banner.
    • The main reason this has to be included is that people are so used to off-line advertising where people just see banners, without having to do anything. Frankly speaking, I am one of those :) They are usually not aware that they have to click on the banner to find out more! So make it a point to have a call to action on your banner ad to improve the effectiveness of the banner.
    • Conclusion: People are stupid. Give them an instruction to CLICK.
  • Small Animation
    • People are always more attracted by moving elements in a banner.
    • As the whole idea of banner advertising is to grab the attention of the reader, using small animation in the banner is sure to achieve this.
    • However, make it small because if the file for the animation is large, then its downloading time will be long.
    • Conclusion: (Small Animation with small file size) = Attraction and Efficient
  • Color
    • Use bright colors like blue, green and yellow. This is proven as it have a higher CTR than black and white banners. The color red should be used sparingly.
    • Conclusion: Bright Color = Comfortable + higher CTR
  • FREE
    • Do you like the word "FREE". I guess everybody like it. Thus, It is quite advisable using the word “free” in the banner as you are bound to get more clicks this way.
    • Of course, you should decide on this free offer, according to the object of the banner ad. Show the reader that clicking on the banner will prove to be beneficial to him or her.
    • Conclusion: People is CHEAP. Like to look for FREE things. FREE = CATCH.
  • Ask a Question
    • People will pay more attention when looking at question compare to normal fact text.
    • You could place questions like ‘do you want more traffic’ or ‘need help with taxes’ in the banner, wherein the answer is found on your website.
    • People don’t have the patience to read long banners; so keep them short. When people click on a banner, they want to go directly to the web page to find the information they want. They don’t have the patience to end up on the home page to go hunting for the required information.
    • Once they enter your homepage, then it is the time to kill them!
    • Conclusion: Question = more attention.

Tagged Under ( )

Which is the top forum in Malaysia?

Life is bored in Malaysia. What is the best way to burn your free time?  Perhaps, forums is the most popular place to spend your free time. As I filtered the list of Most Hits webapge in Malaysia by Alexa, here is the list of forums:

  1. Cari.com.my 
  2. Low Yay.net
  3. Lelong Forum
  4. Mototrader
  5. PJNet
  6. AutoWorld

Your arew welcome to suggest your favour forum :)

Tagged Under ( No Tags )

Do you want to setup a online shop? Let’s start it !

Today, I just read through a nice blog on setting up an online shop. They are introducing a new service for us to setup online store in 5 minutes. Then start selling our products on the internet with 1 billion portential customer. It is prettty cool right?. Here is the few good online store setup services.

Pretty Cool right? 3 Steps to sell your product online. I wish to do it but I got no niche product to sell. Do you have any? Let’s share it. :)

    

This service provide a lot of Add-on widget from the other popular Web 2.0 websites. Here is some of it:

I don’t like this service. It didn’t show us the clear message on what is their core service is. Perhaps, you have to try it out before you know how it works.

Is it looks like any love-matching site? haha. You are wrong. This is the leading online store. You can print anything you like on their product such as t-shirt, mug, and glass. Then you can start selling your product online. It is veyr simple. If you are a good graphic design with creative gens, you will definately make huge of money. May be I will print our Malaysia failure project - PROTON on T-Shirt and start selling to the world. Let them know how SUCK is PROTON!

Link to

Tagged Under ( No Tags )

Are you under-paid?

Are you a Malaysian? Are you an employee? Yearly appraisal review around the corner?

Read it out. Use the surveyed salary range to request from your employer. Show him the result if your under-paid !

Software Engineer
As a software engineer, i guess the survey didn’t cover Cyberjaya region. The salary market is a bit better than other region around Kuala Lumpur, Malaysia. If you work in Cyberjaya, you may top-up another 20% of the survey result.

Are you a Software Engineer? Master in ASP.NET? Here is the opportunity for you to join me as a Monster.

This survey is done by Jobstreet, the top Job Recruitment in Malaysia. Unfortunately, a new Monster will be challenging this position soon. Let’s wait……..

Tagged Under ( No Tags )