• Aug 18 Screencast from chapter `Debugging and Profiling` of my book `JavaScript Unlocked` Follow the link
  • Aug 02 Do you want simply import/include HTML blocks on a page? Here is the directive Follow the link
  • Oct 06 ByContract 0.0.5 released. ByContract is a small library that implements Design by Contract -like validation in JavaScript code, using JSDoc expression for contracts. From now it supports custom types (union/complex) declared in the fashion of @typedef JSDoc tag. Follow the link
Taking advantage of HTML5 Forms

Since the very beginning of HTML there were no much of changes regarding forms until recently. Yet, there was an attempt to bring a new API with XForms, but it was never really supported by any of major browsers. Now we have a comprehensive consistent Form API which allows us to create full-fledged forms even with not help of JavaScript. Everything sounds so exciting until you try to use HTML 5 Forms on real projects.

Bringing Google Analytics Reports to Your Application

Reasonably statistic analyses belong to CMS ACP reports. So, CMS vendors tend to include some into their products. However, they often make statistical data collection and analysis a part of CMS. It usually gains some primitive reports and affects application performance. I believe any sound statistic analysis can be delivered only by a dedicated specialized application. Meantime CMS can be used to represent the reports prepared by that application. Have you ever fancied displaying Google Analytics Reports in your CMS?

JavaScript Asynchronous Dependency Loader

A substantial web application doesn’t need to wait until all the required JavaScript libraries loaded. Usually most of them can load asynchronously and start acting whenever they are ready. Most commonly used approach here would be AMD. That’s a sophisticated and time-proved solution. However to use it with libraries, you must have them converted to modules. I don’t appreciate the idea to interfere with 3-rd party library code. At the same time I still need non-blocking loading and dependency being resolved in my code. Thus, I worked out a very simple, but yet working solution.

My book `JavaScript Unit Testing` is out

As client-side application is getting more and more complex, front-end automated testing is more in demand. Before deployment we have to validate HTML according to given DTD, lint CSS and JavaScript, run performance tests, run unit-tests and do functional testing. Front-end unit testing has its quirks. We have to run tests on every browser and platform defined by our requirements. That is supposed to be automated and it's no easy task. There two widely spread approaches applicable in CI: Selenium Remote Control, which fires up any number of browsers, navigates to specific pages and performs tests and TestSwarm, where any number of clients listen for testing tasks on the server, perform test when requested and return results back to the server. As a budget solution, one can use Rhino with env.js, which emulates a the common browser environment.

Besides, JavaScript units don't often fit the model "assign function arguments and check the result code". Let's take a generic widget. It is being fired on some event (e.g. DOM is ready), gets references on required nodes by provided selectors, modifies DOM if necessary (render UI), subscribes handlers for specific events (button clicked, control value changed, key pressed). Thus to test a widget, we have to make a fixture emulating some initial state of DOM, check if the widget managed to find all the required nodes, check if it modified DOM as intended and trigger events to check handlers, provide mock end-points for Ajax-requests.

Harmony with TypeScript

Not so long ago Microsoft announced a new language, targeting on front-end developers. Everybody's first reaction was like "Why on Earth?!" Is it just Microsoft darting back to Google? Is that a trick to promote their Visual Studio?

But anyway, what's wrong with JavaScript? Why everybody is so keen to replace it? JavaScript for a language designed in only 2 weeks is freakishly powerful and flexible. But JavaScript still has its bad parts.

Review: PHP Application Development with NetBeans

Recently I've laid my hands on a copy of "PHP Application Development with NetBeans" by M A Hossain Tonu ( It appeared to be a really nice reading. One of those where it's hard to put the book down until the end. It must be valuable as for beginners as for experienced NetBeans users. I, personally, have been using NetBeans for about 4 years and still find in the book the features I wasn't aware about or unfairly ignored for so long. Yeah, NetBeans is like an iceberg. At the first glance it looks quite simple, but the deeper you are, the more layers you discover. After years of usage you still can run into an overlooked tool which remarkably boosts your coding productivity. In order to avoid the case "Why didn't I use it for all this time?!", I would even call it as a must-read book for anybody working with NetBeans. Besides, covering the common facilities of NetBeas the books provides comprehensive input regarding automated-testing flow, version control integrated tools on Git example, PHPDoc practices and API-documentation generation.

Tuning site navigation for mobile devices

Making design responsive means not only certain representations on different screens, but also particular behavior on different devices. Usually on mobile devices mouse is not available, keyboard with navigation keys is out of reach. So we are short of controls to provide a useful navigation.

Let’s take image viewer. User taps a thumbnail and gets an overlay with the image. We don’t have much screen space on the smartphone. So the image goes fullscreen. Well, how is the user supposed to close the overlay? On desktop we would place close button on the frame. Besides, we would use Esc and any click outside the frame. Here on mobile we just have this fullscreen image and no keyboard. If we place “close” button on the image, it will hide a part of image. Let’s add to the list “previous” and “next” buttons, all big enough to tap easily by a finger. So what are we to do?

My lovely Mac OS X web-development environment

A few months ago I bought a new Macbook. I’m really fond of the development environment I set up on it. The more I work with it, the more I love it. However, while building the environment I couldn’t find any decent step-by-step manual. So, it took me for a while to get what I wanted. Here’s my experience

Getting started with TypeScript

After Microsoft released TypeScript I took a look at their examples and found the idea pretty promising. I do love JavaScript. However, it has its bad parts. JavaScript doesn’t provide any built-in facilities to declare interfaces or object abstraction. There is no explicit way to have type annotations and type checking. Well, even class-based OOP is not a part of the language. Flexibility of JavaScript is incredible. So, there are tons of libraries meant to work-around these inconveniences. It hardly helps with code readability. At the same time TypeScript is a separate consistent language, which is, nonetheless, first and foremost a superset of JavaScript. You can use regular JavaScript within TypeScript and TypeScript is being transformed to JavaScript by TypeScript compiler.

I went through the specification and started writing design pattern examples on TypeScript to get a feel on the language.

10 things you need to know about JavaScript

JavaScript seems so simple that many people don't even bother to learn the language while using it. And yet it works! However, it turned out to be one of the reasons why JavaScript was dramatically misunderstood . Yes, it looks like a language of the C-family and, when starting with JavaScript, programers are just writing in C, Java, PHP or other language style. But JavaScript is no subset of any of these languages. You may find JavaScript even a superior language, but you have to know how to do things in JavaScript way. You cannot learn this from the documentation. References and, even more so, the specs are not meant to cover programming patterns, but the language itself. Of course, there is plenty of books and you may find some (e.g. "Secrets of the JavaScript Ninja" by John Resig, "Learning JavaScript Design Patterns" by Addy Osmani ) pretty useful. Besides, you can learn straight from the code, since we are lucky to have tons of substantial JavaScript applications available in open-source (,,,, and so on). In either case you may stumble over programming techniques unknown to you. I've collected here some commonly used practices which may help you.