Christian Heilmann

You are currently browsing the archives for the General category.

Archive for the ‘General’ Category

Google’s playing with balls again – pretty but still no HTML5

Monday, February 7th, 2011

As just announced – the Google IO conference registration is open and they have created a very cool countdown animation:

Google I/O

In the blog post they describe the cool countdown as HTML5:

If you liked our HTML5 countdown, stay tuned for more surprises. We’ll keep you posted on the latest developments for Google I/O 2011 at the website, on Twitter (@Googleio) and Google Buzz. Get your tickets early—last year we sold out in record time!

Whilst awesome, there is not much new HTML in there right now. This time there is no need for beauitfying – the code is not at all minified or packed and includes comments – which I love, thanks guys! Seems most of the work was done by Matt King and the balls use the box2D physics engine.

Strangely enough, however it does not use the CANVAS tag for the animation (as box2d does), but instead creates images which get moved around. I guess this is a performance issue, but seeing that this MBA has its fan running after half a minute of the countdown it didn’t help too much.

Images created by the script on the Google IO site

There is also no sign of any of the new semantic HTML elements in the source – instead of header, section and footer there are DIVs with IDs. There’s a NOSCRIPT element telling people to go to whatbrowser.org to download a better browser and a screenshot of the animation if it doesn’t work for you. This is a good way of getting people excited but I don’t know why you would need a NOSCRIPT when you generate all the images of the balls anyways. Just replace this message when the page loads.

Just setting the record straight here, thanks for keeping the source open, Google!

Finally – a fold for the web (your clients can rest easy)

Thursday, February 3rd, 2011

For years our clients have been confused about the elusive fold on the web. We all * know * that content should be above it but designers always squirm when we ask them about it.

Time to make it easy for designers to show their clients where the fold is. For this, I wrote a bookmarklet:

Just by showing people you can stop a lot of fruitless discussions.

(might contain irony)

FUD again – Flash vs. HTML(5) – yes, open things are easy to retrieve

Wednesday, January 26th, 2011

I am very disappointed with a post released today by Serge Jespers, Adobe Evangelist entitled Stealing content was never easier than with HTML5.

I am mostly disappointed by the headline which I hope is there for link-baiting and Google juice. In other words, really cheap and lame propaganda.

The post has a good intention: there is a problem with open media standards in HTML5 that there is no way to protect premium content from being downloaded. There is no DRM, there is no encryption or watermarking. If we want premium content publishers on the bandwagon, then we need to think about that. Posts like this with this headline make it hard for us to even reach people to talk about the options. It is FUD and Adobe as a company that claims to support HTML5 should know better.

Right now, I do tell people who are paranoid about their content to use Flash as it has a certain degree of protection against simple downloading. If Adobe’s official spokespeople keep spouting messages like this, I will move to tell them to use Silverlight.

The argument that it is easy to download video in HTML5 as you can see it in the source is like saying that it is easy to steal newspapers in train stations as they are easy to reach. It is invalid – that you can steal it is not the issue here, the issue is what you do with the paper. Do you take it from the stand and go and pay it without looking at it? Do you read it on the spot and then put it back? Do you leave with it without paying? Or do you check the headlines and when you are intrigued you go and pay for it? Do you take the paper, go to a copier, copy it and then try to sell the copies? Fact is – it is dead easy to get the paper, the same way it is dead easy to get a video online.

I find myself many a time downloading YouTube videos as I am on the go a lot. Being on the go (and considering data plans and roaming) means I have no connection, or I have a flaky connection that downloads the movie to minute 3 and then stalls while the fan of my laptop spins. Instead, at home when I got my fat connection I download some talks and screencasts and watch them offline using VLC. Then I delete them – or I blog about them first linking to YouTube and advertise them that way.

To download these extremely well protected Flash movies I use one of the dozens of services, browser extensions or apps out there.

Allowing people to download a movie means you get a bigger audience. If you make people jump through hoops to watch a movie or make them watch a 5 minute ad for a 10 second film you shouldn’t be surprised if they use P2P filesharing or Hotfile, Rapidshare, Fileserve, Megaupload and dozens of other services to download the movie in 10 seconds and then watch it at their leisure.

Recognise something? The mere fact that there are thousands of downloaders for YouTube and paid for hosting services that offer easy to download pirated copies means that there is a demand for that feature. A feature that would make me damn happy to have on YouTube and I would pay for it.

So instead of demonising HTML5 as the backdoor that will allow evil doers to steal your goodies maybe it is time for premium content providers to open up to the needs of web users, and find a way to publish previews of content and the full content for subscribed users. There are ways to make money and share your products – but not if you spend most of your time and money on things that seemingly give you protection but in reality are just a glass shield.

That was the London Web Standards “Pick’n’Mix” meetup

Wednesday, January 19th, 2011

Yesterday evening I went to Holborn in London to attend the London Web Standards Pick’n’Mix event.

The place (a room under a bar with an own bar – win!) was packed and actually amazingly warm. The sound was good (except for the handheld mic which turned Jim O’Donnell’s announcements into Jungle remixes) and people were eager to hear about cool new stuff.

One thing I really liked was that instead of the normal thanking of the sponsors the organisers also listed job offers before the first talk – pretty clever way to advertise your job. If you need a London web geek, contact them!

How we’ll layout websites in 2016 – Peter Gasston

Peter was the first to take the stage with a 5 minute lighting talk about CSS layout models. He had written an article with the same title on CSS3.info in 2006 and covered what had improved since then (not much, really). His slides are available on Slideshare.

Peter did a good job (considering also that this was his first public presentation) on covering the basics of CSS layouts. What we use now, like Floats, Absolute positioning or JavaScript (Masonry.js) and what is there to come:

Peter rightfully claimed that layout is now the new challenge for CSS and browser vendors to tackle.

How to write jQueryJavaScript that doesn’t suck – Ross Bruniges

Ross is a regular in the UK scene and and overall great guy. One of those loud, drinking but also silent types that doesn’t get the credit he deserves for helping web standards rock the city. He has a special way about him which also showed in the fact that he gave out mini pork pie as prizes for questions! Ross gave a great reminder talk covering best practices in JavaScript development if you want your code to work and be taken over by other developers without calling you names. The slides and links are available on his posterous.

The first point was to organise your stuff as you you will hand over to other developers.

JSLint was next on his list, first and foremost as it helps you find simple problems with your code, like:

  • semicolon insertion which can lead to wrongly returned values (yes, { should not be on a new line in JS, sorry)

  • Double equals instead of triple equals – you should check type and value

Personally I use the JSTools Textmate Bundle which lints my JS when I save it – very simple reminder to do the right thing.

Ross then explained that long chains in JQuery are tempting but also hard to read and debug. One trick to use is to split the chain at the full stop and insert a newline and tab in front of it.

He then continued to explain that using Patterns in your JavaScript is a great idea, especially the revealing module pattern (what can I say, the man has taste) and showed off Addy Osmani’s free Essential JavaScript Design Patterns ebook.

YAGNI - you ain’t gonna need it – was next and on the back of this the reminder to create smaller, aptly named functions that do one task well instead of all-encompassing monster methods. This can also be achieved by looking at your functions once you are done, detect duplicate tasks and move them out into an own helper method.

Custom events were the next great tip and I can only agree that there is nothing better for separating your functionality from your source and allowing other developers to extend your widgets.

Commenting code is one of Ross’ fetishes and he praised the usefulness of JSDoc and Documentation driven design, as described by Frances Berriman in this year’s 24 ways.

Then we moved on to performance and that there is nothing worse than optimising prematurely and forgetting about old browsers when you think about performance testing.

For starters it is very important to write good selectors in jQuery as the sizzle engine parses your strings from right to left. This means that $('#foo div') makes IE read all DIV elements, loops through them and checks which ones have a parent with the ID foo instead of doing a getElementById and then a getElementsByTagName to achieve the same.

In the same vein it is important to cache results in variables to avoid IE doing this over and over again and to return false when elements can’t be found as jQuery is very adamant in trying to find them.

Event Delegation was the next big thing on the menu and again I can’t agree more – it is very elegant and makes your JS independent of HTML changes. It is much less expensive having one event listener than using each() to apply lots of them throughout the document. One gotcha Ross mentioned is that jQuery’s live() always goes all the way up to the document leverl whilst delegate() allows you to define a scope like “only in this DIV”. There’s a good overview at Brandon Aaron’s blog.

Reflow and repainting issues were next on the performance menu, which in essence means that you shouldn’t touch the DOM too much and instead create long HTML strings and inject them into hidden elements before showing them.

Accessibility was another topic, which started with Ross reminding us that CSS styles for hover should also get focus and blur styles and that instead of using hover you should use .bind(mouseenter focus) and mouseleave blur in jQuery.

Another reminder was that invalid markup is invalid markup – even when you add it with JavaScript and that you should play nice with screenreaders and dynamic changes by using tabindex and focus in addition to a hidden form field or – even better – ARIA live regions.

The next thing was not to forget the edge cases as things will go wrong when they can go wrong. This means using $.ajax() instead of $.getJSON() as it allows you to define timeouts and error cases (and doesn’t break caches because of callback parameters).

Ross’ last points were about sending HTML5 to IE and bewaring of HTML5shiv as it means you do the job CSS should do with JavaScript. Instead it might make more sense to use a DIV with a class around each new semantic element.

All in all Ross did a great job and I hope he inspired some of you to dig deeper (hence also my notes and more links here).

Kornel Lesinski – Hypertext Transport Protocol

With the last talk of the day just before the merriment of beverages and conversation, Kornel changed the pace a bit and also shifted the focus from front-end technologies to the server and even further into the infrastructure of the web itself.

He talked in detail about:

  • MIME type issues when serving files on the web
  • How sending headers on the servers makes a lot more sense than using a META tag
  • How to properly force a download of a file using Content-Disposition: attachment
  • Bugs in IE - especially around caching and filename attributes
  • How faking MIME types seems to be a quick solution but will bite us further down the line
  • html vs application/xhtml+xml

I am not quite sure of the percentage of people in the audience understanding what was going on but I for one was very impressed with the research and the cool no-nonsense presentation style. Bad encoding of files on the web is a big issue and can make or break your web site as in the end you want to show users files in the way they were intended to be shown.

Summary

All in all it was a great evening and I am looking forward to the next meeting of this group. My advice would be to change the structure a bit to one big talk and several lightning talks to give more people the chance to show what they are doing. This is a great meetup to get your first experiences in speaking and the audience is knowledgable and sympathetic.

Zooming and rotating video player source now available

Wednesday, January 19th, 2011

Some time ago I posted about a demo to zoom and rotate video with HTML5 and CSS3. Now I wrote up a detailed blog post on Mozilla about the techniques to rotate and zoom video. The final outcome is this player:

The source is available on GitHub and you can see it in action here. Now head over to Mozilla to get all the info :)