abidibo.net

Posted in "programming"

Deploy django applications with nginx, uwsgi, virtualenv, south, git and fabric, part 1

deploy django nginx programming virtualenv

After googling for a while, asking my guru and some tests I was able to setup a deploy environment for django projects.

The web server is nginx, the database server mysql, I use uwsgi as wsgi server, all the code is versioned using git, the python libraries are installed in a virtualenv, db migration is assured by South and the deploy is automated using fabric.

While writing this post the whole environment is working but I think it may be adjusted in some ways, so let's take what follows as a guideline to improve in many aspects.

I assume we are working in locale and deploying directly to a production server, ignoring the staging phase.

Installing some packages (locale and remote)

To set up the environment we need python >= 2.6, python-dev, python-setuptools, pip and virtualenv, so (in a debian/ubuntu os):

$ sudo apt-get install python python-dev python-setuptools
$ sudo easy_install pip
$ pip install virtualenv

Ok that's all, the other python packages will be installed in the virtualenv, so now let's continue installing git and mysql

$ sudo apt-get install git ...

read the full post


Private static and instance members in mootools classes

javascript mootools patterns programming

Let's see two patterns that may be used to have private members in mootools classes.

Private static members

Here is quite simple, it's enough to use a single execution function and js closures and provide the setter and getter methods to change and retrieve the member's values.

var myclass = (function() {
  var _name = null,
      _age = null;
  return new Class({
    initialize: function() {
      // do some stuffs
    },
    setName: function(name) {
      // do some checks here
      _name = name;
    },
    setAge: function(age) {
      // do some checks here
      _age = age.toInt();
    },
    getName: function() {
      return _name;
    },
    getAge: function() {
      return _age;
    }
  });
}());
var myinstance = new myclass();
console.log(myinstance.name); // undefined
myinstance.setName('jack');
console.log(myinstance.name); // undefined
console.log(myinstance.getName()); // jack

So what happens here is that the two variables

_name and _age

are in the scope of the single execution function, and so not accessible from outside. But their value is retained by the returned object which yes can access them since it is ...

read the full post


Vim for php programmers

php programming vim

Il succo è questo:
ho scritto due post sul blog della otto (la tanto cara azienda in cui lavoro), in cui illustro come si possa fare per rendere vim un editor perfetto per sviluppare codice php. Allora siccome sarebbe inutile ripetere qui le stesse cose e soprattutto non ne ho voglia, vi linko semplicemente i due post in questione, buona lettura.

Vim for php programmers parte 1

Vim for php programmers parte 2


jeff-flatpages, html page module for jeff framework

jeff php programming webmaster

jeff-flatpage is a jeff module that lets you store simple "flat" HTML content in a database and handles the management for you via jeff’s admin interface. It is the right module to use for the creation of "About" or "Privacy Policy" type pages, which don't need a specific module and implementation.

So it's ready! The first jeff module for the management of HTML contents is available for the download in the otto github account, release v1.0.

Let's see the main features:

  • Management of html pages (date, title, subtitle abstract, text, images, videos, visualization privileges)
  • Visualization through customizable templates
  • Translations availables for english and italian
  • Error pages 404 (not found) and 403 (forbidden)
  • Possibility to restrict the access to contents to a set of chosen system groups.

Please for complete instructions about the module installation refer to the README file of the github repository.

Please comment here for general considerations, use the proper github area for bug reporting.

Enjoy it ;)


Welcome mooReadAll

javascript mooReadAll mootools plugin programming webmaster

logo

E' online la release 0.1  di mooReadAll, un plugin javascript per troncare contenuto html mantenendo la formattazione corretta.
Che c'è di nuovo direte voi, da sempre i CMS gestisono questa cosa e ci sono svariate funzioni php o python che lo fanno... Vero, ma questo plugin ottiene lo stesso risultato clientside! Dunque se non avete modo di mettere mano al sorgente, al linguaggio server etc... potete comunque troncare contenuti troppo lunghi usando questo script che lavora solo clientside!

mooReadAll è altamente e facilmente configurabile, sia nel comportamento che nella grafica. Quest'ultima è totalmente controllabile tramite css, il pacchetto comprende già un css di base con delle immagini che potete modificare a vostro piacimento.

Per quanto riguarda il comportamento, la caratteristica principale di mooReadAll è quella di consentire diversi tipi di azione in seguito al click sul classico link "leggi tutto", in particolare:

  • "inplace": l'intero contenuto viene mostrato ...

read the full post


The Jeff Wiki is out

jeff php webmaster programming

Mr ans Mrs, señores y señoras the first release of the Jeff Wiki is ready. It contains some sections that covers almost all the development stuffs:

  • Requirements
  • Installation
  • Structure
  • Core classes
  • Libraries
  • Modules
  • Default installed themes
This guide is written for development purposes. Contains the declaration and description of all Jeff classes, modules and libraries. After reading it a developer should be able to extend the framework at his like and to build new modules.

Requirements

Explains the system requirements

Installation

Explains how to install Jeff and get ready with it. jeff is a php framework but has also some CMS characteristics so that after installation it's possible to surf to a default index page and the default administrative area.

Structure

This is a tour in the process that led to the document page rendering. Starting from the entry point,index.php, and ending with the single method output ...

read the full post


Your Smartwatch Loves Tasker!

Your Smartwatch Loves Tasker!

Now available for purchase!

Featured