First time here? You are looking at the most recent posts. You may also want to check out older archives or the tag cloud. Please leave a comment, ask a question and consider subscribing to the latest posts via RSS. Thank you for visiting! (hide this)

August 2007 Blog Posts

How does an email travel around the world?

Google, together with other 1100 users, released a "behind the scene" video showing us how an email sent from gmail reaches its destination.

Ok, not really what happens, but nice to see this collaboration.

Technorati tags: , ,

New iPods on the way

There has been a lot of speculation in the last month after some mock-ups and UI video of the new iPods leaked.

Today many sources reported that Apple will be holding an event on September 5th to present some innovations to their digital music players lineup.

tn_applebeatevent

The invitation features a cover flow style front with the foremost album cover containing a silhouette iTunes dance holding an iPod (and the other album cover being Beatles' albums).

Speculations say that Apple is going to announce OS X based iPods, probably an iPod Nano 3G with a new form factor (here a mock-up), a full-screen touch iPod (here a mock-up). And probably (as the "The beat goes on" tagline and the album covers suggest) the launch of the Beatles on iTunes.

And last there is also a possibility that some of the new iPods will be able to wirelessly control iTunes, both acting as remote for iTunes and also streaming music stored on a computer to the iPod.

Personally I like to think that the new form factor mock-up is about a new 6G iPod video or maybe even a new model, but not about a 3G Nano, since it is already small, and making it even smaller will make it more difficult to handle (not saying that then all my Nike+ armband and t-shirts will be useless as they were designed for the slim 1G and 2G Nanos).

Already enough speculation and echo chambering for today: let's wait next Wednesday and we'll see what Steve Job is going to announce.

Technorati tags: , , , , ,

YUI JS Compressor becomes YUI Compressor: now with CSS compression

Julien Lecomte is riding the wave of his YUI JavaScript Compressor and has just released the version 2.0 of the YUI Compressor.

This version includes Isaac Schlueter’s regular expression based CSS minifier. Therefore now the YUI compressor can minify both JavaScript and CSS files.

Minifying CSS will not help me improve my YSlow score again, but will save a few KBytes per request.

Technorati tags: , ,

YSlow performance challenge: improved from 36 to 64

Mads Kristensen, after reading my report about the score given by YSlow to his and other blogs, improved his score and challenged me to do the same.

After 20 days, recovering from the time zone shift, and after a few days of holidays, yesterday evening I finally managed to try and improve my score: with some manual tuning to the CSS, the JavaScript files and Subtext masterpage I improved my score by 77% (28 points, from 36 to 64). I didn't beat Mads's score which is 67 (was 71 at the time of the challenge), but his improvement was 15 points, which is almost half of my score improvement. Furthermore the skin of his blog is not as graphic as mine and he never uses images in the content of the posts: YSlow gives the score based also on how many files don't comply to a certain rule, so having 10 content images without expires header and with ETag produce a score that is lower than having no image.

YSlow-before-after

So, even if I didn't beat his score (only for 3 points), I'm pretty happy with the results, since it's the most I can get without touching the server settings (which I can't since I'm on a shared hosting plan) or reducing the graphic richness of my blog (both skin and contents).

Plan to a better YSlow score

Even if YSlow's most important rules are Gzip the content, remove Etag and add an Expires Header, I noticed that reducing the number of components also improves a bit the score related to that rules since it reduces the number of files that are not compliant.

Here is the list of the changes I made to my blog:

  1. I minified all the JavaScript files using the YUI JavaScript compressor tool that is now part of Subtext build process
  2. I merged all the minified files into one file
  3. I also merged all the CSS into just one file (leaving outside only the styles for printing)
  4. Then I changed the skin definition to use the Gzip handler developed by Rodiniz to serve the two merged files
  5. Last I changed a bit the masterpage to include the JavaScripts at the bottom of the page and exclude the default style

I wanted to use CSS Sprites to merge the CSS background images, but that would have exceeded the 4 hour limit of the challenge, so I left it out.

Unfortunately the WebResource.axd file cannot be compressed, and this is where the B comes from for rule number 4.

This is a manual tuning, but I'm planning to automate the merging process so that all the blogs powered by Subtext can benefit from this performance improvement.

PS: Someone might say that Mads's score is not not 67 but somewhat higher: this is because if you "AutoRun" YSlow the DOM tree is parsed sometime before the onload is complete, while if you run the tool manually, it will include also everything that an onload handler might have added to the DOM. So I always tested, today and in my previous list, running YSlow manually after the page has completely loaded.

Technorati tags: ,

How to use YUI JS Compressor inside a NAnt build script

As I anticipated yesterday, I implemented the YUI JS compressor inside Subtext's build process, and since it took me a while to understand how to specify the arguments for the NAnt <exec> task I wanted to share the snippet of the build file I created:

<target name="JavaScript.minify">
    <echo message="${filename}" />
    <exec program="java" workingdir="${YUICompressor.dir}">
        <arg value="-jar" />
        <arg value="yuicompressor.jar" />
        <arg value="-o" />
        <arg value="${filename}.min" />
        <arg value="${filename}" />
    </exec>
    <move file="${filename}.min" tofile="${filename}" overwrite="true" />
</target>

This target takes the JavaScript file, compress it with the default settings, and overwrite the original file with the compressed one.

Below are the lines used to call the javascript.minify target:

<property 
    name="YUICompressor.dir"
    value="C:\buildTools\YUICompressor"
    />
<property name="filename" value="C:\myfolder\common.js"/>
<call target="javascript.minify" />

The filename property must be an absolute path, or relative to the folder where the file yuicompressor.jar is located.

YUI JavaScript compressor

yuicompressorFollowing the release of YSlow, there has a lot buzz around the rules it evaluates. And even if not all the 13 rules are issues for normal websites, some of them, like gzipping all the static text files (CSS and JS) and minifying JavaScript are good advices also for websites with not so many users as Yahoo!.

At Yahoo! they suggested to use JSMin, a tool developed by Douglas Crockford, a guy working for Yahoo!. JSMin is only a minifier: it removes comments, unnecessary whitespace and linefeeds but does not change the name of variables or functions to shorter identifiers since it can introduce bugs not easy to debug since the resulting code is almost impossible to read.

Douglas Crockford wrote a good article explaining his decision not to obfuscate the JavaScript:

After minifying or obfuscating, you should GZIP. GZIP can further reduce the size of the program. GZIP is so effective that the difference in the efficiency between minification and obfuscation becomes insignificant. So I prefer minification with GZIP because I don’t have time for programming tools that can inject bugs into good programs.

Last week another Yahoo! engineer, Julien Lecomte, released the YUI JavaScript compressor (and yesterday he released the first update, version 1.1), which adopts a new way of minifying or obfuscating the code:

The YUI Compressor is written in Java and relies on Rhino to tokenize the source JavaScript file. It starts by analyzing the source JavaScript file to understand how it is structured. It then prints out the token stream, replacing all local symbols by a 1 (or 2, or 3) letter symbol wherever such a substitution is appropriate.

So is more than a minifier, but is safer than an obfuscator because it doesn't rely only on string replacements to change the names of local identifiers, but builds a tree of the code before replacing the names.

Tests on the YUI library have shown savings of about 18% compared to JSMin and 10% compared to the Dojo compressor (these respectively become 10% and 5% after HTTP compression)

We have been thinking about adding a minification step in Subtext build process, and now I think the time has come to do it. A test on the core js library of Subtext "common.js" shown a 13% of savings compared to JSMin (full code was 5,11Kb, JSMin 2,34Kb and YUI Compressor 1,66Kb which is almost a 70% reduction).

Yet another "big" blogger on SubText

mighellref

Last week the UGIdotNET community blog portal migrated to Subtext, and yesterday, another Italian .NET blogger, Michele Locuratolo, C# MVP and co-founder of a regional .NET UG (dotnetside), moved from Community Server to SubText.

Seems like he had a few issues exporting his blog from CommunityServer to BlogML, so he had to transform the DB schema from CS to Subtext manually.

Happy blogging Mighel!

Technorati tags: ,

Dissecting YSlow

In the last weeks there has been a lot of talking around YSlow, the tool that the Yahoo! Developer Network released to check sites against their 13 rules of High Performance Web Sites.

Last week I used it against various blogs and I found out that my blog is rated only 36/100. So, also after the challenge started by Mads, I decided to try and improve my score.

The final score is a weighted average between the scores for each of the 13 rules. This means that some rules are more important than others and to increase the score of a site is better to have an higher rating in the rules that are weighted the most.

The weight of each rule can be found in the about:config page of Firefox, with the name: extensions.firebug.yslow.*

Here is the list of rules ordered by their weight:

  1. Rule 4 - GZip Components - 11
    Rule 13 - Configure ETags - 11
    Rule 3 - Add an Expires Header - 11
  2. Rule 10 - Minify JavaScript - 10
    Rule 5 - Put CSS at the Top - 10
    Rule 2 - Use a Content Delivery Network - 10
    Rule 11 - Avoid Redirects - 10
  3. Rule 9 - Reduce DNS Lookups - 5
    Rule 6 - Move Scripts to the Bottom - 5
    Rule 12 - Remove Duplicate Scripts - 5
  4. Rule 1 - Make Fewer HTTP Requests (CSS) - 4
    Rule 1 - Make Fewer HTTP Requests (JS) - 4
  5. Rule 1 - Make Fewer HTTP Requests (CSS Background images) - 3
  6. Rule 7 - Avoid CSS Expressions - 2

This means that gzipping your CSS and script files, configuring an Expires Header for scripts and images and removing ETags gives you double the points than combining all your CSS and scripts into one file or 3 times the points compared to using CSS Sprites to combine all the CSS background images into one.

The top 3 rules can be easily fulfilled configuring the web server but unfortunately people on shared hosting cannot change the configuration of the server, so the only way to achieve the same result is extending the scope of CMS used and to let it handles also CSS and JS files.

Since Mads challenged me to beat his score, and since I'm on WebhostForLife and I don't have access to the server configuration, I've to figure out a way to implement gzipping and Expires headers in static files served by Subtext. Wish me luck smile_regular

Technorati tags: , ,

UGIdotNET is now on Subtext

UGIdotNET goes to  Subtext

After GeeksWithBlogs, also UGIdotNET, the Italian .NET user group, migrated from .Text to Subtext.

Andrea, the president of the user group, waited for the week of "Ferragosto" when almost all the Italians are on holiday, to minimize the down time of the blog portal.

The first comments are positive, users like the new RichTextEditor, or the possibility to close the comments after N days, or to use Akismet to filter the spam.

A lot of the very old skins are not available on Subtext, so most the personal blogs changed their skin, and I'm happy to see that most have them have chosen Piyo, the skin I created with the help of my wife.

Technorati tags: ,

Singleton with VS2005 snippet

Ivan and the other guys in Wellington had their last Lunch with Geeks about Design Patterns. And came out with that idea:

The most overused design pattern : Singleton. With the remark that a singleton should only be used when you need to keep state in your object internally.

So, just to reinforce that concept, here is a VS2005 code snippet to quickly create a Singleton. I uploaded it on GotCodeSnippets.NET, a repository of code snippets.

Download the Singleton VS2005 code snippet.

It expands to the following code:

public sealed class Singleton
{
    private readonly static Singleton _instance = new Singleton();

    public static Singleton Current
    {
         get
        {
            return _instance;
        }
    }

    private Singleton()
    {
           //Implement here the initialization of your singleton
    }
}

You can get more information about the Singleton pattern on the DoFactory site and on Jon Skeet's article. But beware the Singleton: Why Singleton are Evil.

Technorati tags: ,

At home...

I just woke up after 12 hours of sleep. I landed yesterday I landed at Milano Malpensa at 11pm after almost 2 days of flights around the globe.

London Heathrow is the most paranoid airport ever. I missed my connecting flight because it took me 1 one hour and half to go through the security check: they asked me to remove the shoes, the laptop, the external USB drive, they they though I was bringing a gel somewhere in the handbag and asked me empty the bag. They couldn't spot it only looking at the contents of the bag so scanned each item separately: the "gel" was the Chocolate Fish. So I had to go with another flight, and instead of arriving at 4pm I landed 5 hours later.

Here is one very nice picture I took somewhere inside the departure lounge:

errors

Out of 4 monitors, one with the BSOD and another one with an error message.

And other two pictures, one from my old house in Khandallah, on the day of departure, with rain, and the other from my window in Milano, today, with rain.

View on the sea IMGP1734

I will really miss the color of the sky even when it was raining.

Technorati tags: , , , ,

Blogging from Melbourne

I'm here at the Melbourne airport, after 4 hours and 30 minutes of flight over the Tasman Sea. The Qantas zone of the airport has free WiFi connectivity, which is very good, compared to the 5£ per hour I paid at Heathrow coming in New Zealand 7 months ago. Now my connectivity is limited only by the short battery life of my old laptop: too bad I don't have the 6 hours battery life of a Mac yet.

introducing_lightspeed

Anyway, looking at my feeds, I just found out a very good news: my friends from Mindscape just released the first official version of their domain modeling framework LightSpeed. It's a commercial product, but there is also a "personal" edition for free (but only 8 classes in our model).

I took part in the beta phase and I really like the approach, but unfortunately the product can only applied to product built from scratch, so was not able to apply it to my current project.

If you didn't, I encourage you to check it out: the 3 guys at Mindscape built a great product.

Zero downtime guaranteed: Priceless

I was looking on my hosting's control panel to see if they allowed some configuration of the Expires Header or the ETags to improve my YSlow score and I found a new service that WH4L offers to user migrating to their hosting: they migrate the sites of the customers, files, DB, emails.

Here is the cost of the service:

wh4l_migration_list

I really love the last line: Zero Downtime Guaranteed! - PRICELESS. smile_regular

Technorati tags: ,

How Slow is your site (How to improve the performance of your site with YSlow)

A few days ago I posted about Firebug, the Swiss Army Knife of the developers' plugins.

Last week Yahoo released an add-on for Firebug: YSlow.

YSlow measures web page performance based on the best practices evangelized by Yahoo!'s Exceptional Performance team. Since many of these best practices focus on the frontend, YSlow is integrated with Joe Hewitt's Firebug, the web development tool of choice for frontend developers.

After checking your site against the 13 rules of High Performance Web Sites, it rates the performances of your site with an A to F grade.

I run the tool on a few blogs on various platforms, and here is the result ordered by score:

The average per blog engine is:

  1. MovableType (2 sites): 63 D
  2. WordPress (4 sites): 62,75 D
  3. DotNetNuke (2 sites): 61,5 D
  4. .Text (only 1 site): 61 D
  5. Community Server (3 sites): 55,667 F
  6. BlogEngine.NET (1 site): 52 F
  7. Subtext (4 sites): 40 F
    DasBlog (4 sites): 40 F

All the .NET based blogging engines have F as average. Let's see if I can improve a bit my rating (and Subtext rating as well)

Technorati tags: , ,

MacBook Pro vs CodingHorror-Hanselman rig

In the last 2 months Scott Hanselman and Jeff Atwood built the "ultimate developer rig". Probably you all are also readers of Scott's and Jeff's blog so I'm not going to repeat all the specs (here is the last Scott's post with a recap of all the steps of the decision and building process).

Basically the CodingHorror-Hanselman PC is a Intel QuadCore 2.4Ghz (overclocked to 3Ghz), 4GB of RAM, GeForce 8800 with 768MB of RAM.

And the cost for such a PC, monitors (3 of them), keyboard and mouse excluded, is US$ 1903. I don't know how much the same parts will be in NZ or in Italy, probably a bit less since the prices for Intel parts dropped a bit since they bought them. Adding 2 monitors will add other US$ 5-600, and with mouse and keyboard the total price can be US$ 2600.

I always wanted to buy a MacBook, but now this "ultimate rig" adds a new option: shall I buy a MacBook with a Cinema Display or shall I build this "ultimate PC"?

It's difficult to compare the setups since they are very different:

  • one is a laptop, the other one is desktop
  • one can run Mac, the other only Windows
  • one costs US$ 2600, the other almost one grand more (3600)
  • with one you can show off around town, with the other you can't
  • one is lot more powerful then the other

That's a very tough decision. Go for portability and the cool factor, or go for a lot of horse power (and keep my old but revived laptop to go around)?

Or I might buy the MacBook myself and ask for the desktop to the company I'll be going to work for when I finally decided what to do with my life: "Ai posteri l'ardua sentenza" (cit.).

My last day at work

Tomorrow (or today if you are reading it on Friday 3rd August) is not really my last day at work, but it is the last day on my computer in Calcium office in Wellington, so I'll have to delete all private stuff, like cookies, passwords, emails, browser history, chat history and so on.

Someone suggested just to format the disk, but unfortunately I cannot do it because it will be "recycled" by another developer, and I cannot force him to spend one day to install Vista, VS, VS SP1 and all the other tools.

But Scott Hanselman is quitting his job as well, and has the same problem I've. And he posted the checklist he will be following to delete all the private stuff from his PC: The Developer's Quitting Your Job Technology Checklist

I think I'll follow the same checklist. Thanks Scott for this, I'll buy you a beer if we ever meet sometimes, somewhere.

Technorati tags: , ,

Just passed the 70-536 MCTS exam

A bit later then what I planned 6 months ago, today I just passed 70-536: Microsoft .NET Framework 2.0 - Application Development Foundation.

I passed with 806 with a passing score of 700, but making a few calculation I didn't understand which would have been the maximum score since if 700 is 80% of the max (as in the practice tests), the max would have been 875.

But 806 out of 875 means 92,114%, that means that I correctly answered 41,45 questions, which is impossible.

Anyway, a good result since I seriously studied for the exam only one week of evenings. And I finally understood a bit more about the CAS imperative and declarative security.

Now, let's see if it doesn't take me other 2 years before I take the second exam I'd like to take: 70-528: Microsoft .NET Framework 2.0 - Web-Based Client Development.

I hope I can study for it in the next 3 months when I'll be working from home.

Technorati tags: , ,

How to debug XmlHttpRequest with Firebug

I've been using Firebug since a few months and I really love it: it allows you to inspect the HTML, to look at the CSS applied to an element and where each single attribute has been set, to visualize the box around each element, to debug JS, to view the JS stack trace, to change the CSS directly on the page. If you never used it, I really suggest having a look. A must in the web developer toolbox.

But today I found another interesting feature, that is not well advertised on the Firebug website: XmlHttpRequest debugging.

To enable it just open the options menu at the right, and select Show XmlHttpRequests.

firebugxmloptions

From now on, every time your page makes an XmlHttpRequest, you can see in the console panel the requested url, the time taken, all the headers sent and received, the request made (if the it was a POST) and the response received.

firebugajax

In the screenshot you see the request made by an asynchronous trigger to refresh the contents of an UpdatePanel, with all the parameters sent by the ASP.NET page.