Category Archives: misc

Django send_mail “Connection refused” on MacOS X

Connection refused

If you are getting “Connection refused” error message when trying to send an email from Django with send_mail then one thing to check is whether Postfix is running on your Mac OS X.

For that try the following in the terminal:

sudo postfix status

If Postfix is not running then start it.

postfix/postfix-script: the Postfix mail system is not running

sudo postfix start
postfix/postfix-script: starting the Postfix mail system

This should solve the problem (assuming email settings are correct). For example for localhost:

EMAIL_HOST = 'localhost'

For debugging purposes you could use a local smtp server:

python -m smtpd -n -c DebuggingServer localhost:1025

Try to send an email with Django and you should see it in your terminal:

---------- MESSAGE FOLLOWS ----------
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Subject: Subject here
Date: Sat, 28 May 2011 18:31:04 -0000
Message-ID: <20110528183104.11696.10011@dasha-salos-macbook-pro.local>

Here is the message.
------------ END MESSAGE ------------

You can find more info on testing Django email in the documentation.

Leave a comment

Posted by on May 29, 2011 in misc


Tags: , ,

Add icons to NestedList in Sencha Touch

NestedList with icons

Unlike most other components NestedLists is missing itemTpl property.

According to Sencha documentation we should use the method called getItemTextTpl instead.

The quick example. Assuming your store looks something like this:

var eventsListStore = new{
    model: 'EventItem',
    root: {
        items: [
            {leaf: true, eventName: 'Event 1', eventImage: 'http://url to image'},
            {leaf: true, eventName: 'Event 2', eventImage: 'http://url to image 2'},
    proxy: {
        type: 'ajax',
        reader: {
            type: 'tree',
            root: 'items'

Then NestedList configuration would be:

store: eventsListStore,
getItemTextTpl: function() {
    return '<img class="eventIcon" src="{eventImage}"> {eventName}';

Posted by on April 29, 2011 in misc


EditorGridPanel not firing afteredit event if value didn’t change


If you are using EditorGridPanel plugin for ExtJS grids chances are you want to know when user starts and finishes editing a cell.

There is no problem to find out when edit starts with beforeedit event. But afteredit event ExtJS provides for capturing edit completion only fires if the content of the cell has changed. But if the user leaves the cell without modifying it there is no way of capturing this with afteredit.

But we can always override ExtJS internal methods to achieve required functionality ;). In this case we extend EditorGridPanel’s onEditComplete function:

Ext.grid.EditorGridPanel.prototype.onEditComplete = function(ed, value, startValue)
        this.editing = false;
        this.lastActiveEditor = this.activeEditor;
        this.activeEditor = null;

        var r = ed.record,
            field = this.colModel.getDataIndex(ed.col);
        value = this.postEditValue(value, startValue, r, field);
        if(this.forceValidation === true || String(value) !== String(startValue)){
            var e = {
                grid: this,
                record: r,
                field: field,
                originalValue: startValue,
                value: value,
                row: ed.row,
                column: ed.col,
            if(this.fireEvent("validateedit", e) !== false && !e.cancel /* && String(value) !== String(startValue) */){
                r.set(field, e.value);
                delete e.cancel;
                this.fireEvent("afteredit", e);
        this.view.focusCell(ed.row, ed.col);
Leave a comment

Posted by on April 15, 2011 in misc, Sencha


Tags: , ,

Regular Expression for URL / IP with Port Number

Regular expression for checking URL for protocol, subdomain, domain, IP address, port number, path or/and filename.



var regexp = /^((([hH][tT][tT][pP][sS]?|[fF][tT][pP])\:\/\/)?([\w\.\-]+(\:[\w\.\&%\$\-]+)*@)?((([^\s\(\)\<\>\\\"\.\[\]\,@;:]+)(\.[^\s\(\)\<\>\\\"\.\[\]\,@;:]+)*(\.[a-zA-Z]{2,4}))|((([01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}([01]?\d{1,2}|2[0-4]\d|25[0-5])))(\b\:(6553[0-5]|655[0-2]\d|65[0-4]\d{2}|6[0-4]\d{3}|[1-5]\d{4}|[1-9]\d{0,3}|0)\b)?((\/[^\/][\w\.\,\?\'\\\/\+&%\$#\=~_\-@]*)*[^\.\,\?\"\'\(\)\[\]!;<>{}\s\x7F-\xFF])?)$/;


Leave a comment

Posted by on February 10, 2011 in misc


Tags: , , , ,

ExtJS: Radiobutton and checkbox show scrollbar in Firefox on Mac

If you are using ExtJs prior to version 3.3.1 you might face the following problem with radio buttons and checkboxes in FF on Mac:

radiobutton with scroll

The quick solution is to add the following CSS to your page:

.ext-gecko .x-window-body .x-form-item 
    overflow: hidden;
Leave a comment

Posted by on February 1, 2011 in misc, Sencha


Tags: , , ,

Setting up Mercurial + Eclipse + Fogbugz on Mac OS

Step 1. Installing Mercurial

Download the suitable version of Mercurial from (for Mac OS X 10.4 download Mercurial 1.2.1). After installing type ‘hg’ in the Terminal to check if Mercurial was installed successfully. If Terminal says ‘Command not found’ then add the path to Mercurial installation (/usr/local/bin) to your ~/.profile file:

export PATH=/opt/local/bin:/opt/local/sbin:$PATH

To check if directory is in your PATH now type the following in the Terminal:

echo $PATH

The directory in question should appear in the list

$ echo $PATH 

Step 2. Configuring Mercurial

Before making commits it’s required to setup the username of Mercurial user. To do this open ~/.hgrc file for editing. If the file is not visible in Finder do the following in terminal to make hidden files visible or alternatively just edit the file in terminal:

To make hidden files visible in Finder:

defaults write AppleShowAllFiles TRUE 
killall Finder

Then add username to the [ui] section of .hgrc file:

username = dashas 

Step 3. Setting up an initial repository

Go to your webroot folder (~/sites) and make sure it doesn’t already contain the folder with the same name of the repository you want to create (MediaAlbumWeb).

To set up a local repository you have to clone it from the existing one. If you don’t have such a repository available for cloning then you will have to create one.

If there is a latest Mercurial repository available to clone then go to the step 7.

Then in the Terminal do the following:

$ cd ~/sites/
$ hg init MediaAlbumWebServer

Using Finder copy files you want to store in the repository to the newly created MediaAlbumWebServer repository and run the following command in terminal:

$ cd MediaAlbumWebServer
$ hg add

Then make a commit to the repository:

$ hg commit -m 'Initial commit'

Step 4. Installing Eclipse

Download and install Eclipse from or find it on Taopix DataShare/Eclipse.

For Mac OS X 10.4 download Mac Carbon version.

Step 5. Installing Mercurial plugin for Eclipse

First install Mac GnuPGP. Download the files or take it from Taopix DataShare/Eclipse folder.

Install the package from using Eclipse Help->Install New Software option.

For Mac OS X 10.4 install Mercurial Eclipse plugin instead from


Select HgEclipse -> HgEclipse (uncheck Mercurial executable for Windows).

Step 6. Configure Eclipse plugin for Mercurial

Go to Eclipse Preferences -> Team -> Mercurial and specify the paths to hg and gpg2 files on your local machine.


Step 7. Setting up a local repository

To create a local repository open Eclipse and go to menu File -> Import -> Mercurial -> Clone repository using Mercurial and click Next button. Select the location of the repository to clone and enter your authentication details if applicable. In the clone destination enter the path where you want your local repository (MediaAlbumWeb) folder to be created. And then click Finish.

Then when you see the list of folders in your repository, mark what files and folders you would want to exclude from repository. For example, right click on ‘parsed’, ‘templates_c’ folders and config/mediaalbumweb.conf file and mark them as ignored.


Step 8. Installing Fogbugz plugin

Install the plugin (Help -> Install New Software menu) from

In order to work Fogbugz plugin needs a Fogbugz RSS feed. To get one go to Fogbugz Filters -> Manage saved filters saved filters and click on RSS icon. If you don’t have any saved filters create one and you will see an icon.

As an example, feed:


Leave a comment

Posted by on January 30, 2010 in misc


Tags: , , ,

Productivity question

An interesting fact – efficiency of most of Russian organisations nowadays is only 30-50% due to the low productivity of the staff. Which means every full time employee wage is for less than a half of possible work done. And the more money you pay to a worker – the more money you lose. As statistics says the average wage in Russia now is about 18,000 roubles then the employer could lose up to 9,000 per person per month. This turns into 108,000 roubles a year. Huge amount of money if you have, say, 10 employees…

Motivate us!!!


Posted by on September 20, 2009 in misc



%d bloggers like this: