May 2012
3 posts
Dependency Injection in JavaScript
There are several ways to build a stable and testable application. Probably the most common approach is dependency injection (DI). The core DI concept is that components don’t look up their dependencies somewhere in a global context or using a service locator but simply declare what they need and their creator is the one responsible for delivering the dependencies. In a dependency...
May 14th
Constructor Arguments from an Array
There are times at which you need to instantiate something and you have the arguments you want to pass in an array. The only way is utilizing the apply method of the constructor function. The problem is that this method cannot be combined with the new keyword. The trick lays in the way JavaScript object model works—the prototypal inheritance. When you have two constructors sharing one...
May 14th
3 tags
Vyšší maturity z matematiky (2012)
This post is written in Czech because it has nothing to do with international problems, web development or any other stuff I usually post about. It is about this year’s graduation tests in the Czech Republic. Před týdnem se konaly státní maturitní zkoušky. Taty zkoušky jsou nyní silně zpochybňovány a na CERMAT (instituci, která testy sestavuje) je vrháno černé světlo. Včera byl v pořadu...
May 11th
March 2012
3 posts
3 tags
Dot vs. Array-Access Property Notation
If you’re just learning JavaScript, you probably know that the dot property notation is always the preferred way while the array-access notation should be used only when we cannot use the dot notation. This is definitely true if you simply include your source JavaScript files in the page. Your production code should, however, be compiled or minified to save the user some time...
Mar 4th
6 tags
Google Closure Development Environment
I am a big fan of the Google Closure Tools, mainly the Google Closure Compiler. They help me a lot; my production code is minified, obfuscated and my source files are consistent in code-style BUT the main advantage of using Google Closure Tools is that it helps me to find many subtle errors that would otherwise cause my code to behavior to be wrong. Compiler The core component of the...
Mar 4th
4 tags
Wildcard Fallback AppCache Entries Are Needed
The Application Cache (or AppCache) which is a W3C standard developed in order to bring offline support to the web has been around for some time now. It has been two years or so since the browser support started to be good enough for the standard to be taken seriously. Many of us experimented with this technology and some fundamental issues surfaced. To quickly describe the standard, we...
Mar 1st
September 2011
2 posts
7 tags
Sep 30th
29,033 notes
2 tags
Templating without the with statement
One of the limitations that ECMAScript 5 strict mode brings is the removal of the with statement. This is great news in general as the statement just makes code less readable. var x = 6; with (obj) { // You cannot be certain that the "x" you use in this block // is the one you want since obj.x can be present. alert(x); } There is, however, one type of libraries that are built upon this...
Sep 30th
1 note
July 2011
3 posts
6 tags
Client-side Rendering Engine, Take 1
Since two days ago, I have been recreating the Google Feedback Tool. It is a pretty big challenge. One of the key features is taking screenshots of the page on which is being given feedback. When Elliott Sprehn, the tech lead behind the Google Feedback Tool, commented on my previous post saying that Google developed their own client-side rendering engine which does not require Flash or ActiveX...
Jul 8th
7 notes
7 tags
“Hey, Google+ Feedback Tool, I'm stealing you” –...
Have you noticed the feedback tool that Google placed on every page in Google+?. (It is actually available in other Google products as well.) I would say it’s the best feedback tool out there in terms of simplicity, user-friendliness and the overall idea. When I saw it, I was like “Dude… I’m stealing that!” …and I am. I mean, I’m not actually stealing...
Jul 6th
1 note
8 tags
Offline File Uploads Using File API Explained
With the growing number of offline-capable web applications also grow the requirements developers have. One of those is to be able to upload files while the user is offline or their connection crashes a lot and larger uploads fail. Fortunately, W3C defined a great set of standards that allow web apps to do just that. This post explains what is happening behind the scenes of this ultimate solution...
Jul 2nd
8 notes