Updates from December, 2010 Toggle Comment Threads | Keyboard Shortcuts

  • danielsaidi 1:53 pm on December 21, 2010 Permalink | Reply
    Tags: imagegen   

    ImageGen Cache Problem 

    We will probably use ImageGen in a project that I am currently working on. People who have used it before really like it, so I look forward to try it out. However, the more than one year old 2.0.1 release has a cache issue, which is described here.

    The cache problem causes the cache folder to grow and grow, which perhaps is not the best of things. The solution above involves downloading a file and replacing parts of the 2.0.1 release.

    Unfortunately, the file link on the page is dead. After some Googling, I found another copy of the file. You can download it here.

     
  • danielsaidi 3:30 pm on December 20, 2010 Permalink | Reply
    Tags: asp.net, combres, , squishIt   

    Get Combres to work with ASP.NET 

    After having some problems with getting SquishIt to work with JavaScript closures, we decided to give Combres a try. However, while SquishIt works right out of the box, Combres needs to be configured a bit. This page describes how.

    In short, you need to:

    • Create a custom Combres configuration file
    • Add the following to web.config:
      • A Combres configSection tag
      • A Combres section tag (which you point to the Combres config file)
      • Two httpModule tags
    • Add RouteTable.Routes.AddCombresRoute(“Combres Route”); to the Global.asax Application_Start method
    • Add <%= WebExtensions.CombresLink(“…”) %>wherever you want to add JS or CSS tags.

    With SquishIt, you only need to add a bundle tag to your page, which is way easier. Still, Combres is said to perform better compression…and handles JavaScript closures without any problems.

    With Combres up and running, I noticed that it does not work with IIS7 / Integrated pipeline mode. If you run into this problem, remove all mumbo jumbo content in within the Combres section tag, so that it looks like this:

    <section name=”combres” type=”Combres.ConfigSectionSetting” />

    Then, instead of:

    <httpModules>
            <add name="ScriptModule" type="System.Web.Handlers.ScriptModule,
    	System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
    	PublicKeyToken=31BF3856AD364E35"/>
            <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule,
    	System.Web.Routing, Version=3.5.0.0, Culture=neutral,
    	PublicKeyToken=31BF3856AD364E35"/>
    </httpModules>

    You also need to add the modules to the system.webServer/modules tag, since that is the one used by IIS7  (keep the ones above as well, though):

    <modules>
            <add name="ScriptModule" type="System.Web.Handlers.ScriptModule,
    	System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
    	PublicKeyToken=31BF3856AD364E35"/>
            <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule,
    	System.Web.Routing, Version=3.5.0.0, Culture=neutral,
    	PublicKeyToken=31BF3856AD364E35"/>
    </modules>

    If you follow these steps, Combres should work.

     
    • John 10:42 am on January 2, 2012 Permalink | Reply

      Thats great information, Thanks !

    • John 10:44 am on January 2, 2012 Permalink | Reply

      Application is working perfect on Local Development Server but after publish it’s not working if running on IIS 7 Pipeline Mode. Tested your suggestion and it’s worked, thanks.

    • Arun 7:28 am on March 24, 2013 Permalink | Reply

      I have worked in global.asax file and using Combres.The method RouteTable.Routes.AddCombresRoute() is not find.

      • danielsaidi 9:55 am on March 24, 2013 Permalink | Reply

        This is a rather old blog post, and Combres has probably changed a great deal since then. Do you mean that this solution is no longer applicable?

  • danielsaidi 11:57 pm on December 9, 2010 Permalink | Reply
    Tags: , localstorage   

    HTML5 localstorage 

    I have spend some time experimenting with the new HTML5 localStorage feature. It is a new feature that makes it easy to store data in the web browser, using JavaScript.

    Local storage does NOT replace a real database, since it is unique for the browser and cannot hold that large amounts of data,  but it is a really great tool for many smaller tasks.

    For instance, say that you have an iPhone web application that needs to uniquely identify the mobile device. The device itself does not send any such information (like the MAC address, phone number etc.) so, you’re at a loss…

    …but with localStorage, you can easily create a unique ID (e.g. a GUID) and store it in the local storage. The browser can then use that ID to identify itself to the system.

    For instance, this is all you need to store a small string into the localStorage:

    function hasLocalStorage() {
       return !typeof(localStorage) == "undefined";
    }
    localStorage.setItem("name", "Daniel");
    var name = localStorage.getItem("name");
    localStorage.removeItem("name");

    As you can see, it’s really easy and really powerful.

     
    • Johan 4:04 pm on December 10, 2010 Permalink | Reply

      Isn’t that almost exactly what cookies are? I assume that you can store more in the localStorage than in cookies, but since it still is open to manipulation by the user, may not be there the next time, etc, it still seems to have all the disadvantages of using cookies.

      Do you see any advantages with localStorage compared to storing an identifier in a cookie and the rest server side (except for the coolness of something new)?

      • danielsaidi 11:48 pm on December 10, 2010 Permalink | Reply

        Well, having an ID in cookie and using it to retrieve more data server-side works as well, but for the AJAX-based iPhone web app that I am working on now (for which I know that localStorage will work), the localStorage approach simplifies the data handling a lot.

        Have you had a look at globalStorage and sessionStorage?

c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel