Mikael Lofjärd

The End of May

The blog has been silent lately but i certainly have not been sitting still. About a month ago I started to remake the administration area of the blog into something a bit more fashionable (today it consists of a few input boxes and a "publish" button). Halfway through I decided to rewrite it using AngularJS. Needles to say, I’m not quite done with it yet but it’s a work in progress and it’s going to be awesome. My great friend and fellow coder Mattias spent a long weekend here and we put together a little P2P file sharing site using Node.js, AngularJS and Web RTC data channels. It’s really cool but like most things, it needs a little more work. It’s up on GitHub though if anyone wants to take a peek at it. The day before yesterday I beefed up security on my server and it’s been quite in…

The End of May Läs mer »

Decreasing Load Time When Using Google Web Fonts

I’ve been using Google Web Fonts ever since I started building this blog. It’s an awesome service with a great user interface and it makes it really easy to add fonts to your web site. Of course I had to find something wrong with it. Earlier this week our company released our new web site. On our Yammer page, one of my colleagues posted a link to a WebPageTest result for it and it fared reasonably well. It got an "F" on the "First Byte Time" test, but that test is really finicky and could just as well show an "A" if you retake the test (as I later became aware). This triggered my inner masochist and I just had to run the same test on this blog. The first result was this: Test | Score —-|:–: First Byte Time | A Keep-alive Enabled | A Compress Transfer | A Compress Images | C Cache st…

Decreasing Load Time When Using Google Web Fonts Läs mer »

Async File Uploads in HTML5

Uploading files using HTML forms has always felt a bit off for me. You had to set your encoding to `multipart/form-data` and the synchronous nature of form posts always made it a waiting game when uploading larger files. Then came AJAX and the dawn of "single page applications" and such buzzwords, but file uploads somehow got left behind. Javascript didn’t have the access it needed to send files with the `XMLHttpRequest`. Years passed and along came the File API and XMLHttpRequest Level 2 (it seems to be called that again) with its `upload` attribute, support for byte streams and progress events. Today I’m going to show you how to build an asynchronous file uploader with it. We’ll start with the HTML part: There’s nothing weird going on here; just a regular file selector and a list o…

Async File Uploads in HTML5 Läs mer »