As a Firefox user, one of the extensions that I can’t live without is Userstyles. They allow me to remove tons of ads and format some webpages that I use in my daily life in the way I want.
A few months ago I started using IE8 as my main browser in my personal laptop. And very happy about it because it’s lighter than Firefox, and I don’t really need all the extensions outside work. But I missed Userstyles…
After searching for a while I found information about custom cascade style sheets in IE in a Microsoft article.
By following this step-by-step tutorial, you can set a custom css file for your browser. The changes are applied after browser restart, and it’s somewhat limited when compared with userstyles, since you can’t turn on/off setting on the fly and the css rules are global, which means that you change a class properties for a website, and you happen to navigate to another one that uses the same class, the css rules will also be applied.
Nevertheless, now I was able to remove ads from Windows Live Hotmail in IE8, remove the search bar that I don’t use and so on.
I’ve been using a feature of ASP.NET called Output Cache. It allows you to have server-side cache for your ASP.NET webpages. You can define several profiles and cache expiration rules. You can read more about it in a simple and short article at MSDN or in the full documentation also at MSDN.
A feature that I wasn’t able to find was cleaning all the cached data. You can remove cache for a specific page using HttpResponse.RemoveOutputCacheItem(”pagename”) but to remove all pages (which can have several cached versions each) you have to use some kind of workaround. You can use a Cache dependency relying in a item stored in HttpContext.Cache items collection, but for my particular scenario it wasn’t the right solution. Why?
If you have several front-end servers serving your website, you have independent cache systems, so when forcing a cache cleaning, you will force it only for the front-end serving your request. To solve this issue I’ve created a cache system relying on a file dependency. This way, when I change that file, all the front-end servers will clean their cache. I’ve included a CacheManager class that has the usual Add method, that automatically add the file dependency to cached data ( usually using Response.Cache.Add) and not only output cache.
Download source code and have fun exploring it.
If you are an ASP.NET developer you must be familiar with web.config. Something that maybe you haven’t tried yet is to create custom configuration sections to store you application specific settings. Bellow you can see a web.config file that uses a custom configuration section. In the configuration/configSections element you must define which class is responsible for handling your configuration section. Then you can add your custom settings to the file as shown bellow.

The usage of your settings is shown bellow. The configuration section handler class is used in order to access the configuration properties.

I’ve shown you the usage of a class called SiteSettings, but how does it’s definition look? It is a class that inherits the ConfigurationSection class. The configuration section properties are defined by adding public properties that correspond to Configuration Elements. While adding these properties you can define the name of the XML node that you will use in the web.config file and either if the property is required or not. In the example bellow you can see the Singleton design pattern in order do avoid creating several instances of the class and loading the section from the configuration file each time I access the values.

In this example, we only have one configuration property. It is defined in the class bellow. It corresponds to a contact information. Each property of this class correspond to an XML attribute, and by using annotations you can define the name of the XML attribute, it’s default value, if it is required and even add validators such as regular expression validators. You can use several variable types such as strings, integers and event enumerables.

By using custom configuration settings this way instead of accessing ConfigurationManager.AppSettings as a dictionary of string values you get intellisense while using configuration settings, and best of all, automatic validation of the types, constraints and structure of the settings (checked when the settings are accessed for the first time).
The full demo project is available for download. I hope it gets useful to you.

Foi lançado hoje um novo portal português destinado aos mais novos. É o Sapo Kids! Além de diversos conteúdos lúdicos e didácticos reunidos a partir dos diversos serviços do mundo Sapo, conta com parcerias como a Porto Editora ou até mesmo o MIT.
Realço a integração do Scratch no portal. O Scratch que nasceu no MIT permite aos mais novos criarem animações interactivas de forma simples e divertida enquanto aprendem. O Sapo Kids tem a plataforma Scratch totalmente em Português, tornando-a ainda mais atractiva às crianças portuguesas.
Antes mesmo do projecto criar raízes em Portugal já existia uma escola pioneira a utilizar o sistema do MIT. Espero que outras lhe sigam o exemplo agora com este portal Português.
Mais informações no site http://kids.sapo.pt
Today I got access to the new Hotmail interface. Pretty, but lacks the usual icons. I feel lost. The icons were a great help on finding what I needed. Now I just have to read the labels… I’m not feeling as a happy user right now…
Keep it simple, but not too simple.
