Wednesday, October 2, 2013

How to manage Git or Mercurial repositories

Managing version control repositories can be a challenge in multi-user environment especially when simplification of user collaboration is your goal. There are usually two primary concerns while considering enterprise deployment for version control repositories: access control and safety of your data. Both are not directly addressed by version control itself, thus a sort of security facade is necessary.

Tuesday, September 10, 2013

wheezy web: Actors

The application design of wheezy.web application consists of several actors, each playing its unifying role. Actors are grouped into packages, e.g. models, repository, service, web, content, tests, etc. These packages (or layers) shape a subsystem.

The diagram below visualizes relations between actors, boundaries between packages, subsystems and application, giving a better picture of whole:
The sequence diagram explains request processing and interaction between actors:
You can download a pdf copy here.

Wednesday, February 6, 2013

Thoughts on SQL vs ORM

The question of persistence implementation arise often. I found repository pattern very valuable due to separation of concerns, mediate between domain model and data source (mock, file, database, web service, etc). The database data source is somewhat specific since you can proceed with SQL functions or ORM. Here are some thoughts why you might prefer SQL functions over ORM in your next project:

Wednesday, January 16, 2013

wheezy web: Quick Start i18n Project

wheezy.web is a lightweight, high performance, high concurrency WSGI web framework with the key features to build modern, efficient web. Here we will use an i18n (multilingual internationalization) project quick start to build a new project.
  1. Download quickstart-i18n.zip and extract.
  2. Rename extracted directory `quickstart-i18n` to meet your project name, e.g. mysite and open terminal in that directory.
The i18n project quick start comes with Makefile with several handy targets. Setup development environment:
make env
Internationalization is built using gettext, thus you need extract gettext messages and compile `*.po` files that you can find in i18n directory.
make po
Let run test, look at coverage and finally benchmark tests:
$ make test nose-cover benchmark
....................................
..........
Name                 Stmts   Miss  Cover   Missing
--------------------------------------------------
public                   3      0   100%   
public.web               0      0   100%   
public.web.profile       5      0   100%   
public.web.urls         10      0   100%   
public.web.views        26      0   100%   
--------------------------------------------------
TOTAL                   44      0   100%   
-----------------------------------------------------
Ran 10 tests in 0.458s

OK
public: 5 x 1000
baseline throughput change target
  100.0%    5303rps  +0.0% test_root
   94.4%    5005rps  -5.6% test_home
   98.2%    5206rps  -1.8% test_error_400
   99.2%    5258rps  -0.8% test_error_403
   97.9%    5191rps  -2.1% test_error_404
static: 3 x 1000
baseline throughput change target
  100.0%    5172rps  +0.0% test_static_files
   47.4%    2453rps -52.6% test_static_file_not_found
   52.5%    2715rps -47.5% test_static_file_forbidden
-----------------------------------------------------
Ran 2 tests in 2.286s

OK
The tests are passed let run it in web browser:
$ make run
Visit http://localhost:8080/
Alternatively you can run it using uwsgi
env/bin/easy_install uwsgi
make uwsgi
Enjoy!

Tuesday, January 15, 2013

wheezy web: Quick Start Empty Project

wheezy.web is a lightweight, high performance, high concurrency WSGI web framework with the key features to build modern, efficient web. Here we will use an empty project quick start to build a new project.
  1. Download quickstart-empty.zip and extract.
  2. Rename extracted directory `quickstart-empty` to meet your project name, e.g. mysite and open terminal in that directory.
The empty project quick start comes with Makefile with several handy targets. Setup development environment:
make env
Let run test, look at coverage and finally benchmark tests:
$ make test nose-cover benchmark
....................................
..........
Name                 Stmts   Miss  Cover   Missing
--------------------------------------------------
public                   3      0   100%   
public.web               0      0   100%   
public.web.profile       5      0   100%   
public.web.urls         10      0   100%   
public.web.views        20      0   100%   
--------------------------------------------------
TOTAL                   38      0   100%   
--------------------------------------------------
Ran 10 tests in 0.423s

OK
public: 5 x 1000
baseline throughput change target
  100.0%    5041rps  +0.0% test_root
   81.3%    4097rps -18.7% test_home
   99.4%    5008rps  -0.6% test_error_400
  100.3%    5055rps  +0.3% test_error_403
   98.7%    4975rps  -1.3% test_error_404
static: 3 x 1000
baseline throughput change target
  100.0%    4846rps  +0.0% test_static_files
   49.8%    2415rps -50.2% test_static_file_not_found
   55.0%    2663rps -45.0% test_static_file_forbidden
-----------------------------------------------------
Ran 2 tests in 2.375s

OK
The tests are passed let run it in web browser:
$ make run
Visit http://localhost:8080/
Alternatively you can run it using uwsgi
env/bin/easy_install uwsgi
make uwsgi
Enjoy!