'Software development' Category

  • How to “include” shell source in Perl script

    June 27, 2017

    Often times you’d want to share a set of environment variables between shell scripts and Perl scripts. Suppose that our variables are defined in a script called “etc/env”: FOO=BARoo GURGLE="throbbozongo" In shell, we can easily include our “env” script with “source” command: #!/bin/sh . etc/env # Or equivalent but more readable: source etc/env Right, but […]

  • How to get Ext JS Component by a DOM element

    February 13, 2014

    Sometimes you need to operate at the DOM level, with DOM elements. And sometimes when you’re doing something with an element, you need to know which Component it belongs to. Since a Component may actually consist of many elements, finding a Component from DOM may seem hard to do, when in fact it is not. […]

  • Using render selectors to capture element references

    August 14, 2013

    One of the little known features of Ext JS is renderSelectors. It is used mostly internally but can come handy from time to time on the application side, too. The main purpose of the renderSelectors is to support compound Component templates: when you create a Component that consists of several DOM elements, grabbing the references […]

  • Using synchronous bidirectional communication with Controllers

    August 8, 2013

    In a big application, Controllers often need to communicate between each other in both directions; i.e. requesting some information and acting upon receiving it. Direct method calls are usually used for this: Ext.define('My.controller.Foo', { extend: 'Ext.app.Controller', onPanelButtonClick: function(button) { // Before dispatching a message to Bar, we need to ask Baz // if it has […]

  • Controller events in Ext JS 4.2

    July 19, 2013

    This is a kind of follow up to the last year’s “Improving Ext JS MVC Implementation” post. Since then I have joined Sencha and have been working on Ext JS team for several months. Bringing MVC improvements into Ext JS core made all kinds of sense, so here goes. In any application that has more […]

  • Abstract Controllers

    July 11, 2013

    In a typical real world application there might be quite a number of Views and Controllers similar to each other but doing different things, e.g., operating on different data sets. It is inefficient to repeat the same code over and over in different classes, and some code sharing technique is required. For Views, we can […]

  • Ext JS MVC: Controlling multiple View instances

    July 2, 2013

    Oftentimes we need to control multiple instances of the same View class, and in majority of such cases we can share the same Controller instance between all of these Views. The key here is to make use of `xtype` and properly configured component selectors. Suppose that we have a form; in that form we need […]

  • DOM event handling in Ext JS MVC

    June 19, 2013

    Sometimes you need to work with DOM elements in your custom Components, or stock Ext JS Components do not fire events in certain conditions that you would like to react to in your Controllers. What do you do in such case? You can refire DOM event as Component event. Suppose you want Panel’s `mouseover` events […]

  • Improving Ext JS MVC implementation

    August 16, 2012

    UPDATE:┬áThe ideas and code described in this article have been incorporated into the Ext JS MVC subsystem; the solution has been released as part of Ext JS 4.2. The Ext.ux.Application is still relevant for Ext JS 4.1 applications though.     Anybody who has been working with Ext JS 4.x probably tried to use what […]

  • How to insert Unix time as PostgreSQL timestamp

    July 22, 2012

    Quick googling turned up lots of insane (or just outdated) type conversion advice, while the answer is very simple: use standard function to_timestamp(), like this: INSERT INTO foo VALUES ( to_timestamp(1342986162) ) Reverse operation is equally easy: SELECT EXTRACT( EPOCH FROM now() ) Hopefully next time when I forget how to do that, I’ll remember […]

Powered by Wordpress and MySQL. Theme by Shlomi Noach, openark.org