Stickers

  • Apr 07 Modular JavaScript with CommonJS Compiler (slides) Follow the link
  • Mar 12 CommonJS Compiler now supports source maps, therefore all the breakpoints and console messages mapped to the original sources Follow the link
  • Mar 07 PixelPerfect Firefox extension could be a brilliant tool to finalize HTML page styles to the degree where they precisely match source PSD. Unfortunately the extension doesn't work properly in all the last browser builds. So I wrote this bookmarklet that provides similar service Follow the link
ECMAScript 5 and JS frameworks

Standards are being always approved with a slow pace. Though, the features declared in drafts usually find their implementation long before the standard release. Let’s take for an instance Websockets, which were already implemented in Chrome/Safari and Firefox 4b when standard unexpectedly changed. Apparently YUI3 and jQuery have implemented for long time the features, which are only coming up with ECMAScript 5 (the implementations is called JavaScript 1.8.5) spread.

Extending MVC on Drupal

I’ve already described an approach of using MVC in Drupal . It wasn’t bad for the beginning I hope. Though in real life you face requirements which hardly can be fulfilled with such a simplicity. In, more or less, complex application you ain’t going to be satisfied by the only controller (page controller) to serve the whole bunch of components presented on the page. So, let’s assume we have a page full of components and each of them can behave differently. It means we need controllers and views for them. Reminds of Java portlets, doesn’t it? Such components are often referred as modules in IA, but I don’t dare to call them so in this context to avoid any confusion because of Drupal modules. So, let’s go with widgets.

phpBB3 customization driven by configurable feature list

Let’s assume you have installed phpBB3 to run forums on the web-project you are working on. The forum system was re-skinned and your project manager, seems, is pretty happy for the first. But later he requests some changes, e.g. to prevent users from sending emails to each other within the board. This one is easy; you can disable it globally via ACP. However, the project manager wants only registered users not be able sending emails, when administrators and global moderators are still able to do it. Again, it is not a problem, because phpBB3 provides permissions roles which can be assigned to user groups. So, you go to ACP and create and a new role, e.g. ProjectX Registered User Features, based on existing one (All Features). Now you can set false ‘Can send e-mails’ option of Misc tab in User permissions panel and apply this role for all the registered users. Everything is fine so far, but only until the project manager requests something like ‘user search form in UCP has to be removed for unprivileged users’. You cannot find this feature in role options. We need custom option for user roles.

Building a site on Drupal using MVC

If you ought to build a new site and don’t have time to develop a CMS, you’ll likely take an open source solution. And likely it will be Joomla or Drupal. They seem as most popular. Actually they are similar in many ways. Both provide basic content management frameworks, extensible through plug-ins and customizable via themes. Both focused on block-designed sites which can be often built without any programming at all, just using downloaded theme and configurable set of extensions. So it’s personal what to choose. I prefer Drupal. Its component model seems clearer to me. The documentation is much more explicit then Joomla’s and gallery of ready-to-use modules is really impressive.


MVC on command line

If you work with Zend Framework, you likely tried ZF Console (Zend_Tool on command line). But have you tried to extend it? Why? To have common interface for all your Cli-scripts related to ZF-base project. How do you find the idea to program Cli-scripts in MVC? Zend Framework provides us with the tool to do it.


HTML5 and Server-Sent Events

Besides, already noted bidirectional communication channel, known as WebSocket, HTML5 propositions include also comet communication pattern by defining Server-Sent Events (SSE). WebSocket widely discussed by now, tons of server implementations are available and you can play already with fluent browser implementation under Chrome. However the second server-push technology of HTML5 yet stays in shadow.

YUI3 vs jQuery

Everybody time to time comes to the dilemma which JS library to choose for further development. I used to work with prototype coupled with script.aculo.us and now use YUI3 in the office and jQuery at home. I like both of them, though finding each as the best one 'sui generis'. YUI3 is a classical framework that provides design patterns and development philosophy as well as tool. jQuery is meant as a rapid, lightweight, flexible and pretty easy to start library. It's like Ruby on Rails and Python. Ruby and Python as languages are comparable (conceptual elegance against explicit consistency) and you will find APIs of both YUI3 and jQuery are quite similar.

i18n for Dynamic UI

Since YUI 3.1 version, the framework includes internationalizing utility. That’s pretty huge from the prospective of application maintenance and deserves a little review.


Error Handling for Your PHP Application

However fondly you treat your application, errors happen and they happen often when it is being developed. That’s obvious you want to get all the tracing information during the development stage and something like ‘Application Error’ page if the error occurs on the production.

Everybody knows error handler can be set in PHP through set_error_handler. The same about exceptions for which set_exception_handler is used. But it really works only for user-defined errors and uncaught exceptions. It doesn’t affect any of fatal error for instance. Well, PHP has such stuff as register_shutdown_function to deal with them. We can create ErrorHandler class and subscribe the handlers in the beginning of the script

Anonymous Functions and Closures in PHP

If you are used to switch between JS and PHP programming, it obviously happened to you to miss some of JS flexibility in PHP. I felt it every time when declaring a callback function , being eager to apply something from JS like that...