<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>Ruby vs Python - Home</title>
  <id>tag:alexanders.in.ua,2010:mephisto/</id>
  <generator version="0.8.0" uri="http://mephistoblog.com">Mephisto Drax</generator>
  <link href="http://alexanders.in.ua/feed/atom.xml" rel="self" type="application/atom+xml"/>
  <link href="http://alexanders.in.ua/" rel="alternate" type="text/html"/>
  <updated>2010-08-26T09:21:30Z</updated>
  <entry xml:base="http://alexanders.in.ua/">
    <author>
      <name>DeViL</name>
    </author>
    <id>tag:alexanders.in.ua,2010-08-26:178</id>
    <published>2010-08-26T09:19:00Z</published>
    <updated>2010-08-26T09:21:30Z</updated>
    <link href="http://alexanders.in.ua/2010/8/26/2-2" rel="alternate" type="text/html"/>
    <title>&#1052;&#1099; &#1074;&#1077;&#1088;&#1085;&#1091;&#1083;&#1080;&#1089;&#1100;!</title>
<content type="html">
            И так после долго перерыва, переездов и тд и тп мы вернулись!

Я начинаю серию постов про Rails 3.0
Как раз выйдет релиз и мы разберемся что и как и куда мы движемся.

Оставайтесь с нами!
          </content>  </entry>
  <entry xml:base="http://alexanders.in.ua/">
    <author>
      <name>AlexanderAD</name>
    </author>
    <id>tag:alexanders.in.ua,2009-01-05:130</id>
    <published>2009-01-05T11:57:00Z</published>
    <updated>2009-01-09T15:52:28Z</updated>
    <category term="PostgreSQL"/>
    <category term="bucardo"/>
    <category term="postgresql"/>
    <category term="&#1072;&#1089;&#1080;&#1085;&#1093;&#1088;&#1086;&#1085;&#1085;&#1072;&#1103;"/>
    <category term="&#1084;&#1072;&#1089;&#1090;&#1077;&#1088;-&#1084;&#1072;&#1089;&#1090;&#1077;&#1088;"/>
    <category term="&#1084;&#1091;&#1083;&#1100;&#1090;&#1080;-&#1084;&#1072;&#1089;&#1090;&#1077;&#1088;"/>
    <category term="&#1088;&#1077;&#1087;&#1083;&#1080;&#1082;&#1072;&#1094;&#1080;&#1103;"/>
    <category term="&#1089;&#1091;&#1073;&#1076;"/>
    <link href="http://alexanders.in.ua/2009/1/5/postgresql" rel="alternate" type="text/html"/>
    <title>&#1040;&#1089;&#1080;&#1085;&#1093;&#1088;&#1086;&#1085;&#1085;&#1072;&#1103; &#1084;&#1091;&#1083;&#1100;&#1090;&#1080;-&#1084;&#1072;&#1089;&#1090;&#1077;&#1088; &#1088;&#1077;&#1087;&#1083;&#1080;&#1082;&#1072;&#1094;&#1080;&#1103; &#1074; PostgreSQL</title>
<content type="html">
            &lt;h3&gt;Задача&lt;/h3&gt;

&lt;p&gt;Такая: есть два отделения одной конторы, в разных странах. Работают с одной базой и хочется, чтобы изменения с одной стороны были сразу же видны с другой и наоборот. При этом обе стороны испытавают разного рода проблемы с интернетом -- где-то трафик считают, а где-то временное отсутствие интернета -- обычное дело. Доступ к данным необходим всегда. Решение напрашивается следующее: обе конторы ставят локальный сервер с БД и работают непосредственно с ним, а сами сервера синхронизируются друг с другом. При этом вся конструкция должна терпимо относиться к проблемам с линком, уметь решать все конфликтные ситуации не отрывая меня, скажем, от просмотра &quot;Семнадцати мгновений весны&quot;.  &lt;/p&gt;

&lt;h2&gt;Теория (это где почти все грустно)&lt;/h2&gt;

&lt;p&gt;Рассматривая возможные решения сразу отбрасываем самый распространенный тип репликации -- вида master/slave, т.к. у нас оба участника должны уметь писать в базу. Отбрасываем и синхронную мастер-мастер репликацию, т.к. мы не гарантируем постоянного соединения между серверами баз, а гарантируем периодическое отсутствие этого самого соединения. Кстати, синхронная репликация само по себе дело всячески мрачное. Такое решение частично снимает вопрос о конфликтных ситуациях, чем и основательно замедляет работу всей схемы. Даже на сверхбыстром линке едва ли гарантируют половину быстродействия самого Postgres'а. Постойте возражать, мы не говорим исключительно о выборках на чтение.&lt;/p&gt;

&lt;p&gt;Итого, нам остается только экстремально асинхронная репликация с решением возможных конфликтов. Если MySQL умеет строить репликацию &quot;из коробки&quot;, то для Postgres'а это (пока) возможно только сторонними разработками. Поставляются они либо в виде самостоятельного приложения/демона (&lt;a href=&quot;http://bucardo.org/&quot;&gt;Bucardo&lt;/a&gt;, &lt;a href=&quot;http://community.continuent.com/community/sequoia&quot;&gt;Sequoia&lt;/a&gt;, &lt;a href=&quot;http://dbreplicator.org/&quot;&gt;DBReplicator&lt;/a&gt;)  , либо как патч к самому postgres'у или его самостоятельная сборка (&lt;a href=&quot;http://pgcluster.projects.postgresql.org/&quot;&gt;PGCluster&lt;/a&gt;, &lt;a href=&quot;http://pgpool.projects.postgresql.org/&quot;&gt;PGPool I/II&lt;/a&gt;, &lt;a href=&quot;http://www.postgres-r.org/&quot;&gt;Postgres-R&lt;/a&gt;). Казалось бы, решений целая куча (среди открытых), да вот только что-то уже давно зачахло и застряло на 7-8.1 ветках postgres'a, что-то умеет только синхронную, что-то еще не готово для промышленного использования, а что-то вообще написано на Джаве &gt;_&amp;lt; (да простят меня все ее почитатели) :)  &lt;/p&gt;

&lt;h2&gt;Выход есть&lt;/h2&gt;

&lt;p&gt;Наш герой -- &lt;a href=&quot;http://bucardo.org/&quot;&gt;Bucardo&lt;/a&gt;, состоит из демона, написанного на Perl'e и триггеров на Pl/Perl и Pl/pgsql. Bucardo умеет мульти-мастер репликацию (и традиционную мастер-слейв) и весьма гибок. Для всей схемы нужен лишь один демон. Он хранит свою базу с данными об изменениях и подконтрольных базах/таблицах. Минимальная единица для синхронизации -- таблица. Действует, в нашей схеме, следующим образом (это катастрофически схематическое описание процесса):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;в таблицу внесены изменения, они записываются в дельта таблицу&lt;/li&gt;
&lt;li&gt;демону сообщается об изменениях&lt;/li&gt;
&lt;li&gt;демон сообщает контроллеру соответсвующей синхронизации и продолжает слушать&lt;/li&gt;
&lt;li&gt;контроллер создает соединение или сообщает одному из доступных&lt;/li&gt;
&lt;li&gt;соединение просматривает изменения, сравнивает, пробует разрешить конфликты одним из стандартных или нашим методом (об этом далее)&lt;/li&gt;
&lt;li&gt;если все хорошо, проводится транзакция и соединение отчитывается перед контроллером&lt;/li&gt;
&lt;li&gt;если транзакция не удалась, эксепшн, со всеми обстоятельствами, передается в руки наших обработчиков&lt;/li&gt;
&lt;li&gt;если на момент синхронизации были проблемы с линком, контроллер откладывает дельта записи и ждет восстановления соединения  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Среди ограничений:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;мастер-мастер репликация лишь для двух мастеров (пока)&lt;/li&gt;
&lt;li&gt;изменения в структуре таблиц приходится отрабатывать собственноручно&lt;/li&gt;
&lt;li&gt;в каждой реплицируемой таблице должен быть PK одного из поддерживаемых типов&lt;/li&gt;
&lt;li&gt;найдите еще что-нибудь для себя&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Я рассмотрю лишь малую часть того, что можно сделать с помощью Bucardo.&lt;/p&gt;

&lt;h2&gt;Практика&lt;/h2&gt;

&lt;p&gt;Делаем следущую магию (это версия для Debian систем, переделайте под себя). Здесь -dev пакет нужен для pg_config'а, который с некоторых пор находится именно в нем.&lt;/p&gt;

&lt;pre class=&quot;pastels_on_dark&quot;&gt;
aptitude install  postgresql-server-8.3-dev postgresql-plperl-8.3
&lt;/pre&gt;

&lt;p&gt;Нам нужен сам Perl и следующие модули для него: &lt;code&gt;DBI 1.51, DBD::Pg 1.49, Moose 0.18, IO::Handle 1.24, Sys::Hostname 1.1, Sys::Syslog, Mail::Sendmail 0.79,  ExtUtils::MakeMaker 6.32, Test::Simple 0.30, Test::More 0.61, Test::Harness 2.03&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;С порядком разбирайтесь сами, скажу только, что удобно ставить через &lt;code&gt;cpan&lt;/code&gt;,  а &lt;code&gt;prerequisites_policy follow&lt;/code&gt; -- чтобы само давило Enter по зависимостям модулей.&lt;/p&gt;

&lt;pre class=&quot;pastels_on_dark&quot;&gt;
perl  -MCPAN -e shell
cpan&lt;span class=&quot;Operators&quot;&gt;&amp;gt;&lt;/span&gt; o conf prerequisites_policy follow
cpan&lt;span class=&quot;Operators&quot;&gt;&amp;gt;&lt;/span&gt; o conf commit
cpan&lt;span class=&quot;Operators&quot;&gt;&amp;gt;&lt;/span&gt; install DBI Moose IO:Handle Sys::Hostname Sys::Syslog Mail::Sendmail ExtUtils::MakeMaker DBD::Pg Test::Simple Test::Harness Test::More
&lt;/pre&gt;

&lt;p&gt;Дальше ставим еще два модуля, которые идут в поставке Bucardo (написаны автором последнего):&lt;/p&gt;

&lt;pre class=&quot;pastels_on_dark&quot;&gt;
wget http://bucardo.org/downloads/Bucardo-3.0.9.tar.gz
tar zxvf Bucardo-3.0.8.tar.gz
cd Test-Dynamic-1.3.2/ &lt;span class=&quot;Operators&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; perl Makefile.PL &lt;span class=&quot;Operators&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; make &lt;span class=&quot;Operators&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; make test &lt;span class=&quot;Operators&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; sudo make install
cd DBIx-Safe-1.2.4/ &lt;span class=&quot;Operators&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; perl Makefile.PL &lt;span class=&quot;Operators&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; make &lt;span class=&quot;Operators&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; make test &lt;span class=&quot;Operators&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; sudo make install
cd Bucardo-3.0.9/ &lt;span class=&quot;Operators&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; perl Makefile.PL &lt;span class=&quot;Operators&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; make
&lt;/pre&gt;

&lt;p&gt;Теперь, по-хорошему, надо бы сделать &lt;code&gt;make test&lt;/code&gt; и поглядеть, что получится. Но поделюсь опытом -- &lt;code&gt;make test&lt;/code&gt; в этом случае может отработать некорректно, хотя особых причин тому быть не должно. В рассылке &lt;code&gt;[Bucardo-general]&lt;/code&gt; этот вопрос много раз поднимался, и автор в &lt;code&gt;git&lt;/code&gt; версии &lt;code&gt;Bucardo&lt;/code&gt; уже пишет новые тесты. У меня тесты лишь однажды отработали хорошо, но тем не менее, во всех случаях из всех демон работает исправно.&lt;/p&gt;

&lt;h2&gt;Сестра, скальпель!&lt;/h2&gt;

&lt;p&gt;А мы продолжим вскрытие. Теперь создаем базу, это строка &lt;code&gt;psql'я&lt;/code&gt;:&lt;/p&gt;

&lt;pre class=&quot;pastels_on_dark&quot;&gt;
&lt;span class=&quot;Keywords&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;Keywords&quot;&gt;USER&lt;/span&gt; bucardo SUPERUSER;
&lt;span class=&quot;Keywords&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;Keywords&quot;&gt;DATABASE&lt;/span&gt; bucardo OWNER bucardo;
\c bucardo
&lt;span class=&quot;Keywords&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;Keywords&quot;&gt;LANGUAGE&lt;/span&gt; plpgsql;
&lt;span class=&quot;Keywords&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;Keywords&quot;&gt;LANGUAGE&lt;/span&gt; plperlu;
&lt;span class=&quot;Comments&quot;&gt;&lt;span class=&quot;Comments&quot;&gt;#&lt;/span&gt; мы находимся в папке с bucardo&lt;/span&gt;
\i bucardo.schema
&lt;/pre&gt;

&lt;p&gt;Если ругается на одну из строк CREATE LANGUAGE, возвращаемся к началу (это там, где мы ставили postgresql-plperl-8.3) и смотрим что пропустили. Если на этом этапе что-то не получается, дальше лучше не продолжать, пока не получится.&lt;/p&gt;

&lt;p&gt;Создадим две базы. По прежнему в psql:&lt;/p&gt;

&lt;pre class=&quot;pastels_on_dark&quot;&gt;
&lt;span class=&quot;Keywords&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;Keywords&quot;&gt;DATABASE&lt;/span&gt; db_kyiv OWNER bucardo;
&lt;span class=&quot;Keywords&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;Keywords&quot;&gt;DATABASE&lt;/span&gt; db_lviv OWNER bucardo;
&lt;span class=&quot;Comments&quot;&gt;&lt;span class=&quot;Comments&quot;&gt;#&lt;/span&gt; и для обеих надо будет выполнить&lt;/span&gt;
&lt;span class=&quot;Keywords&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;Keywords&quot;&gt;LANGUAGE&lt;/span&gt; plpgsql;
&lt;span class=&quot;Keywords&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;Keywords&quot;&gt;LANGUAGE&lt;/span&gt; plperlu;
&lt;/pre&gt;

&lt;p&gt;Теперь создадим пару таблиц, которые будем реплицировать. Здесь следующий момент -- нам надо разрулить PK, в нашем случае, id,  таким образом, чтобы не было конфликтов при создании записей в разных базах. Для этого есть куча вариантов -- от разных интервалов, до процедуры, которая будет согласовывать выдачу nextval'а централизованно. Мы пойдем простой дорогой -- мастера у нас два, пусть один идет по четным id'ам, другой по нечетным:&lt;/p&gt;

&lt;pre class=&quot;pastels_on_dark&quot;&gt;
\c db_kyiv
&lt;span class=&quot;Keywords&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;Keywords&quot;&gt;SEQUENCE&lt;/span&gt; user_id_seq
increment &lt;span class=&quot;Numbers&quot;&gt;2&lt;/span&gt;
start &lt;span class=&quot;Numbers&quot;&gt;1&lt;/span&gt;;
&lt;span class=&quot;Keywords&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;Keywords&quot;&gt;TABLE&lt;/span&gt; users (
    id integer DEFAULT nextval(&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;user_id_seq'&lt;/span&gt;) PRIMARY KEY,
    name varchar(&lt;span class=&quot;Numbers&quot;&gt;50&lt;/span&gt;)
);
\c db_lviv
&lt;span class=&quot;Keywords&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;Keywords&quot;&gt;SEQUENCE&lt;/span&gt; user_id_seq
increment &lt;span class=&quot;Numbers&quot;&gt;2&lt;/span&gt;
start &lt;span class=&quot;Numbers&quot;&gt;2&lt;/span&gt;;
&lt;span class=&quot;Keywords&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;Keywords&quot;&gt;TABLE&lt;/span&gt; users(...
&lt;/pre&gt;

&lt;p&gt;Теперь займемся заполнением конфигурации Bucardo:&lt;/p&gt;

&lt;pre class=&quot;pastels_on_dark&quot;&gt;
\c bucardo
&lt;span class=&quot;Comments&quot;&gt;&lt;span class=&quot;Comments&quot;&gt;#&lt;/span&gt; базы -- нашем случае мы заведем обе базы на localhost, но это лишь для чистоты эксперимента&lt;/span&gt;
&lt;span class=&quot;Keywords&quot;&gt;INSERT INTO&lt;/span&gt;  db(name, dbname, dbhost, dbuser) &lt;span class=&quot;Keywords&quot;&gt;VALUES&lt;/span&gt; (&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;kyiv'&lt;/span&gt;,&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;db_kyiv'&lt;/span&gt;,&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;localhost'&lt;/span&gt;,&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;bucardo'&lt;/span&gt;);
&lt;span class=&quot;Keywords&quot;&gt;INSERT INTO&lt;/span&gt;  db(name, dbname, dbhost, dbuser) &lt;span class=&quot;Keywords&quot;&gt;VALUES&lt;/span&gt; (&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;lviv'&lt;/span&gt;,&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;db_lviv'&lt;/span&gt;,&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;localhost'&lt;/span&gt;,&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;bucardo'&lt;/span&gt;);
&lt;span class=&quot;Comments&quot;&gt;&lt;span class=&quot;Comments&quot;&gt;#&lt;/span&gt; группы баз (удобнее всего, когда вида master-slave)&lt;/span&gt;
&lt;span class=&quot;Keywords&quot;&gt;INSERT INTO&lt;/span&gt;  dbgroup(name) &lt;span class=&quot;Keywords&quot;&gt;VALUES&lt;/span&gt; (&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;remote_dbs'&lt;/span&gt;);
&lt;span class=&quot;Keywords&quot;&gt;INSERT INTO&lt;/span&gt;  dbmap(db,dbgroup) &lt;span class=&quot;Keywords&quot;&gt;VALUES&lt;/span&gt; (&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;lviv'&lt;/span&gt;,&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;remote_dbs'&lt;/span&gt;);
&lt;span class=&quot;Comments&quot;&gt;&lt;span class=&quot;Comments&quot;&gt;#&lt;/span&gt; таблицы (мы заносим таблицы одной из сторон, т.е. из нашей пары только одну)&lt;/span&gt;
&lt;span class=&quot;Keywords&quot;&gt;INSERT INTO&lt;/span&gt;  goat(db, tablename, pkey, standard_conflict, schemaname) &lt;span class=&quot;Keywords&quot;&gt;VALUES&lt;/span&gt;(&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;kyiv'&lt;/span&gt;, &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;users'&lt;/span&gt;, &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;id'&lt;/span&gt;, &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;latest'&lt;/span&gt;, &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;public'&lt;/span&gt;);
&lt;/pre&gt;

&lt;p&gt;Здесь интересно поле standard_conflict, которое определяет поведение Bucardo в случае обнаружения конфликта, скажем, с двух сторон во время отсутствия линка обновилась одна и та же запись:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;source/target -- база источник/назначение всегда права. Какая из баз является источником, какая назначением определяет синхронизация (это будет далее).&lt;/li&gt;
&lt;li&gt;random    -- победитель выбирается случайным образом&lt;/li&gt;
&lt;li&gt;latest -- кто последний, тот и прав&lt;/li&gt;
&lt;li&gt;abort -- прекратить синхронизацию, в случае конфликта&lt;/li&gt;
&lt;li&gt;skip -- пропустить конфликтную запись&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Источник синхронизации -- всегда группа таблиц. Скажем, можно объединить таблицы в группы по какому-то признаку. У себя я выделил сильно нагруженные таблицы в отдельные потоки синхронизации, а вспомогательные объединил в одну группу, соответственно выделил для всей группы один поток синхронизации.&lt;/p&gt;

&lt;pre class=&quot;pastels_on_dark&quot;&gt;
&lt;span class=&quot;Keywords&quot;&gt;INSERT INTO&lt;/span&gt; herd(name) &lt;span class=&quot;Keywords&quot;&gt;VALUES&lt;/span&gt; (&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;main'&lt;/span&gt;);
&lt;span class=&quot;Keywords&quot;&gt;INSERT INTO&lt;/span&gt; herdmap(herd,goat) &lt;span class=&quot;Keywords&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;main'&lt;/span&gt;, id &lt;span class=&quot;Keywords&quot;&gt;FROM&lt;/span&gt; goat &lt;span class=&quot;Keywords&quot;&gt;WHERE&lt;/span&gt; db=&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;kyiv'&lt;/span&gt; &lt;span class=&quot;Keywords&quot;&gt;AND&lt;/span&gt; tablename &lt;span class=&quot;Keywords&quot;&gt;IN&lt;/span&gt; (&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;users'&lt;/span&gt;);
&lt;/pre&gt;

&lt;p&gt;И, наконец, мы добавляем синхронизацию. Этот этап, самый последний, создает во всех вовлеченных в процесс синхронизации базах и таблицах, триггеры и соответсвующие функции:&lt;/p&gt;

&lt;pre class=&quot;pastels_on_dark&quot;&gt;
&lt;span class=&quot;Keywords&quot;&gt;INSERT INTO&lt;/span&gt;  sync (name,source,targetdb,synctype,checktime,disable_triggers,disable_rules) &lt;span class=&quot;Keywords&quot;&gt;VALUES&lt;/span&gt; (&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;main_sync'&lt;/span&gt;,&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;main'&lt;/span&gt;,&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;lviv'&lt;/span&gt;,&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;swap'&lt;/span&gt;,&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;10 minutes'&lt;/span&gt;, &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;replica'&lt;/span&gt;, &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;replica'&lt;/span&gt;);
&lt;/pre&gt;

&lt;p&gt;Таблица sync самая интересная. В нашем случае synctype=swap, т.е. мы организовываем мастер-мастер репликацию. Именно эта таблица определяет правила синхронизации -- для каждой записи создается отдельный контроллер, который в свою очередь порождает и командует соединениями, выполняющими update'ы/insert'ы/delete'ы. Соединения, или kid'ы, отчитываются перед контроллером, контроллер в свою очередь, перед демоном. checktime определяет частоту проведения синхронизации в случае отсутствия какой-либо активности. Благодаря триггерам, любые изменения вызывают соответсвующую синхронизацию мгновенно, в противном же случае, если синхронизация по каким то причинам не состоялась, она произойдет &quot;насильственно&quot; через checktime.&lt;/p&gt;

&lt;h2&gt;Does it bark?&lt;/h2&gt;

&lt;p&gt;Запускаем демона. Кстати, Bucardo требует указывать причину запуска или останова.&lt;/p&gt;

&lt;pre class=&quot;pastels_on_dark&quot;&gt;
./bucardo_ctl start &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;First start&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
Checking &lt;span class=&quot;ControlStructures&quot;&gt;for&lt;/span&gt; existing processes
Removing /var/run/bucardo/fullstopbucardo
Starting Bucardo
ps ax &lt;span class=&quot;Operators&quot;&gt;|&lt;/span&gt; grep Bucardo
 6517 ?        S      0:00 Bucardo Master Control Program v3.2.5. Active sync:main_sync
 6522 ?        S      0:00 Bucardo Controller. Sync &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;main_sync&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; (swap) &lt;span class=&quot;ControlStructures&quot;&gt;for&lt;/span&gt; source &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;main&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
 6524 ?        S      0:00 Bucardo Kid. Sync &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;main_sync&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;: (swap) &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;kyiv&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; -&lt;span class=&quot;Operators&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;lviv&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;Проверяем&lt;/p&gt;

&lt;pre class=&quot;pastels_on_dark&quot;&gt;
bucardo=# \c db_lviv 
You are now connected to database &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;db_lviv&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;.
db_lviv=# insert into users(name) values (&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;Львовский&lt;/span&gt; юзер&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;)&lt;span class=&quot;Comments&quot;&gt;&lt;span class=&quot;Comments&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
INSERT 0 1
db_lviv=# \c db_kyiv
You are now connected to database &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;db_kyiv&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;.
db_kyiv=# select &lt;span class=&quot;Functions&quot;&gt;*&lt;/span&gt; from users&lt;span class=&quot;Comments&quot;&gt;&lt;span class=&quot;Comments&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
 id |      name      
----+----------------
  2 | Львовский юзер
(&lt;span class=&quot;Numbers&quot;&gt;1&lt;/span&gt; row)

db_kyiv=# insert into users(name) values (&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;Киевский&lt;/span&gt; юзер&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;)&lt;span class=&quot;Comments&quot;&gt;&lt;span class=&quot;Comments&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
INSERT 0 1
db_kyiv=# update users set name=&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;Львовский&lt;/span&gt; пузер&lt;span class=&quot;Constants&quot;&gt;&lt;span class=&quot;Constants&quot;&gt;'&lt;/span&gt; where&lt;/span&gt; id=2&lt;span class=&quot;Comments&quot;&gt;&lt;span class=&quot;Comments&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
UPDATE 1
db_kyiv=# \c db_lviv
You are now connected to database &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;db_lviv&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;.
db_lviv=# select &lt;span class=&quot;Functions&quot;&gt;*&lt;/span&gt; from users&lt;span class=&quot;Comments&quot;&gt;&lt;span class=&quot;Comments&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
 id |      name       
----+-----------------
  1 | Киевский юзер
  2 | Львовский пузер
(&lt;span class=&quot;Numbers&quot;&gt;2&lt;/span&gt; rows)
&lt;/pre&gt;

&lt;p&gt;Тем временем в логе&lt;/p&gt;

&lt;pre class=&quot;pastels_on_dark&quot;&gt;
KID Got a notice &lt;span class=&quot;ControlStructures&quot;&gt;for&lt;/span&gt; main_sync: kyiv -&lt;span class=&quot;Operators&quot;&gt;&amp;gt;&lt;/span&gt; lviv
KID Source delta count &lt;span class=&quot;ControlStructures&quot;&gt;for&lt;/span&gt; public.users: 1
...
KID Total delta count: 1
KID No conflict, source only &lt;span class=&quot;ControlStructures&quot;&gt;for&lt;/span&gt; public.users.id: 1
KID Action summary: 1:1
KID [1/1] public.users INSERT source to target pk 1
KID Issuing final commit &lt;span class=&quot;ControlStructures&quot;&gt;for&lt;/span&gt; source and target
KID Marking as &lt;span class=&quot;ControlStructures&quot;&gt;done&lt;/span&gt; &lt;span class=&quot;ControlStructures&quot;&gt;in&lt;/span&gt; the q table, notifying controller
KID Finished syncing. Time: 0. Updates: 0+0 Inserts: 0+1 Deletes: 0+0 Sync: main_sync. Keepalive: 1
...
KID Got a notice &lt;span class=&quot;ControlStructures&quot;&gt;for&lt;/span&gt; main_sync: kyiv -&lt;span class=&quot;Operators&quot;&gt;&amp;gt;&lt;/span&gt; lviv
...
KID No conflict, source only &lt;span class=&quot;ControlStructures&quot;&gt;for&lt;/span&gt; public.users.id: 2
KID Action summary: 1:1
KID [1/1] public.users UPDATE source to target pk 2
...
&lt;/pre&gt;

&lt;p&gt;Если все хорошо, значит все хорошо, в противном случае что-то пошло не так. Лог пишется local1.*. В lenny уже rsyslog, потому в /etc/rsyslog.conf:&lt;/p&gt;

&lt;pre class=&quot;pastels_on_dark&quot;&gt;
local1.* -/var/log/bucardo.log
&lt;/pre&gt;

&lt;h2&gt;Это еще не все&lt;/h2&gt;

&lt;p&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://bucardo.org&quot;&gt;Bucardo&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://bucardo.org/bucardo.html&quot;&gt;подробно обо всех возможных опциях&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;на грани: &lt;/p&gt;

&lt;blockquote&gt;
    &lt;p&gt;git-clone http://bucardo.org/bucardo.git/&lt;br /&gt;
    git-clone http://bucardo.org/dbixsafe.git/&lt;br /&gt;
    git-clone http://bucardo.org/testdynamic.git/  &lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;https://mail.endcrypt.com/mailman/listinfo/bucardo-general&quot;&gt;Bucardo-general&lt;/a&gt;, где есть ответы на много вопросов&lt;/li&gt;
    &lt;/ul&gt;&lt;/p&gt;
&lt;/blockquote&gt;
          </content>  </entry>
  <entry xml:base="http://alexanders.in.ua/">
    <author>
      <name>DeViL</name>
    </author>
    <id>tag:alexanders.in.ua,2008-11-16:75</id>
    <published>2008-11-16T15:32:00Z</published>
    <updated>2008-11-16T16:56:08Z</updated>
    <category term="Ruby"/>
    <category term="git"/>
    <category term="github"/>
    <category term="ruby"/>
    <link href="http://alexanders.in.ua/2008/11/16/gitnub-github" rel="alternate" type="text/html"/>
    <title>GitNub - github &#1085;&#1072; &#1074;&#1072;&#1096;&#1077;&#1084; &#1084;&#1072;&#1082;&#1077;</title>
<content type="html">
            &lt;p&gt;Сегодня я вам расскажу о такой вещи как Gitnub. Это &lt;span class=&quot;caps&quot;&gt;GUI&lt;/span&gt; для github под MacOS X.&lt;/p&gt;


Итак&#8230; Для установки Gitnub нам надо будет следующее:
	&lt;ul&gt;
	&lt;li&gt;&lt;span class=&quot;caps&quot;&gt;OS X&lt;/span&gt; Leopard 10.5&lt;/li&gt;
		&lt;li&gt;Open4 `gem install open4`&lt;/li&gt;
		&lt;li&gt;RubyCocoa&lt;/li&gt;
	&lt;/ul&gt;


Причем Open4 надо ставить в системный руби:
&lt;pre class=&quot;pastels_on_dark&quot;&gt;
-&lt;span class=&quot;Operators&quot;&gt;&amp;lt;&lt;/span&gt;devil@Hor.local:&lt;span class=&quot;Operators&quot;&gt;~&lt;/span&gt;/Works/Ruby&lt;span class=&quot;Operators&quot;&gt;&amp;gt;&lt;/span&gt;-
-&lt;span class=&quot;Operators&quot;&gt;&amp;lt;&lt;/span&gt;%&lt;span class=&quot;Operators&quot;&gt;&amp;gt;&lt;/span&gt;- sudo /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/gem install open4
Password:
Bulk updating Gem source index &lt;span class=&quot;ControlStructures&quot;&gt;for&lt;/span&gt;: http://gems.rubyforge.org/
Bulk updating Gem source index &lt;span class=&quot;ControlStructures&quot;&gt;for&lt;/span&gt;: http://gems.github.com/
Successfully installed open4-0.9.6
1 gem installed
&lt;/pre&gt;

Далее нам надо установить сам gitnub.Есть два варианта. Стянуть готовый пакет и второй вариант &#8211; стянуть git репозиторий.
Я пойду вторым вариантом.
&lt;pre class=&quot;pastels_on_dark&quot;&gt;
-&lt;span class=&quot;Operators&quot;&gt;&amp;lt;&lt;/span&gt;devil@Hor.local:&lt;span class=&quot;Operators&quot;&gt;~&lt;/span&gt;/Works/Ruby&lt;span class=&quot;Operators&quot;&gt;&amp;gt;&lt;/span&gt;-
-&lt;span class=&quot;Operators&quot;&gt;&amp;lt;&lt;/span&gt;%&lt;span class=&quot;Operators&quot;&gt;&amp;gt;&lt;/span&gt;- git clone git://github.com/Caged/gitnub.git
Initialized empty Git repository &lt;span class=&quot;ControlStructures&quot;&gt;in&lt;/span&gt; /Users/devil/Works/Ruby/gitnub/.git/
remote: Counting objects: 1299, &lt;span class=&quot;ControlStructures&quot;&gt;done&lt;/span&gt;.
remote: Compressing objects: 100% (682/682), &lt;span class=&quot;ControlStructures&quot;&gt;done&lt;/span&gt;.
remote: Total 1299 (delta 700), reused 1071 (delta 558)
Receiving objects: 100% (1299/1299), 2.88 MiB &lt;span class=&quot;Operators&quot;&gt;|&lt;/span&gt; 396 KiB/s, &lt;span class=&quot;ControlStructures&quot;&gt;done&lt;/span&gt;.
Resolving deltas: 100% (700/700), &lt;span class=&quot;ControlStructures&quot;&gt;done&lt;/span&gt;.
-&lt;span class=&quot;Operators&quot;&gt;&amp;lt;&lt;/span&gt;devil@Hor.local:&lt;span class=&quot;Operators&quot;&gt;~&lt;/span&gt;/Works/Ruby&lt;span class=&quot;Operators&quot;&gt;&amp;gt;&lt;/span&gt;-
-&lt;span class=&quot;Operators&quot;&gt;&amp;lt;&lt;/span&gt;%&lt;span class=&quot;Operators&quot;&gt;&amp;gt;&lt;/span&gt;- cd gitnub
-&lt;span class=&quot;Operators&quot;&gt;&amp;lt;&lt;/span&gt;devil@Hor.local:&lt;span class=&quot;Operators&quot;&gt;~&lt;/span&gt;/Works/Ruby/gitnub&lt;span class=&quot;Operators&quot;&gt;&amp;gt;&lt;/span&gt;-
-&lt;span class=&quot;Operators&quot;&gt;&amp;lt;&lt;/span&gt;%&lt;span class=&quot;Operators&quot;&gt;&amp;gt;&lt;/span&gt;- git submodule init
Submodule &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;lib/grit&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt; (git://github.com/mojombo/grit.git) registered &lt;span class=&quot;ControlStructures&quot;&gt;for&lt;/span&gt; path &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;lib/grit&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;
-&lt;span class=&quot;Operators&quot;&gt;&amp;lt;&lt;/span&gt;devil@Hor.local:&lt;span class=&quot;Operators&quot;&gt;~&lt;/span&gt;/Works/Ruby/gitnub&lt;span class=&quot;Operators&quot;&gt;&amp;gt;&lt;/span&gt;-
-&lt;span class=&quot;Operators&quot;&gt;&amp;lt;&lt;/span&gt;%&lt;span class=&quot;Operators&quot;&gt;&amp;gt;&lt;/span&gt;- git submodule update
Initialized empty Git repository &lt;span class=&quot;ControlStructures&quot;&gt;in&lt;/span&gt; /Users/devil/Works/Ruby/gitnub/lib/grit/.git/
remote: Counting objects: 3392, &lt;span class=&quot;ControlStructures&quot;&gt;done&lt;/span&gt;.
remote: Compressing objects: 100% (2177/2177), &lt;span class=&quot;ControlStructures&quot;&gt;done&lt;/span&gt;.
remote: Total 3392 (delta 1243), reused 3261 (delta 1169)
Receiving objects: 100% (3392/3392), 1.80 MiB &lt;span class=&quot;Operators&quot;&gt;|&lt;/span&gt; 184 KiB/s, &lt;span class=&quot;ControlStructures&quot;&gt;done&lt;/span&gt;.
Resolving deltas: 100% (1243/1243), &lt;span class=&quot;ControlStructures&quot;&gt;done&lt;/span&gt;.
Submodule path &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;lib/grit&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;: checked out &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;6b86674364a7adf98fff10154db7fc706326271d&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;
-&lt;span class=&quot;Operators&quot;&gt;&amp;lt;&lt;/span&gt;devil@Hor.local:&lt;span class=&quot;Operators&quot;&gt;~&lt;/span&gt;/Works/Ruby/gitnub&lt;span class=&quot;Operators&quot;&gt;&amp;gt;&lt;/span&gt;-
-&lt;span class=&quot;Operators&quot;&gt;&amp;lt;&lt;/span&gt;%&lt;span class=&quot;Operators&quot;&gt;&amp;gt;&lt;/span&gt;- xcodebuild
=== BUILDING NATIVE TARGET GitNub WITH THE DEFAULT CONFIGURATION (Release) ===

Checking Dependencies...

---------- skipped -------------

Touch /Users/devil/Works/Ruby/gitnub/build/Release/GitNub.app
    cd /Users/devil/Works/Ruby/gitnub
    /usr/bin/touch -c /Users/devil/Works/Ruby/gitnub/build/Release/GitNub.app
** BUILD SUCCEEDED **
&lt;/pre&gt;

Копируем GitNub.app в /Application/ и nub в /usr/local/bin/.
&lt;pre class=&quot;pastels_on_dark&quot;&gt;
-&lt;span class=&quot;Operators&quot;&gt;&amp;lt;&lt;/span&gt;devil@Hor.local:&lt;span class=&quot;Operators&quot;&gt;~&lt;/span&gt;/Works/Ruby/gitnub&lt;span class=&quot;Operators&quot;&gt;&amp;gt;&lt;/span&gt;-
-&lt;span class=&quot;Operators&quot;&gt;&amp;lt;&lt;/span&gt;%&lt;span class=&quot;Operators&quot;&gt;&amp;gt;&lt;/span&gt;- cp -rf build/Release/GitNub.app /Applications/
-&lt;span class=&quot;Operators&quot;&gt;&amp;lt;&lt;/span&gt;devil@Hor.local:&lt;span class=&quot;Operators&quot;&gt;~&lt;/span&gt;/Works/Ruby/gitnub&lt;span class=&quot;Operators&quot;&gt;&amp;gt;&lt;/span&gt;-
-&lt;span class=&quot;Operators&quot;&gt;&amp;lt;&lt;/span&gt;%&lt;span class=&quot;Operators&quot;&gt;&amp;gt;&lt;/span&gt;- cp nub /usr/local/bin/
&lt;/pre&gt;

Далее проверяем как работает:
&lt;pre class=&quot;pastels_on_dark&quot;&gt;
-&lt;span class=&quot;Operators&quot;&gt;&amp;lt;&lt;/span&gt;devil@Hor.local:&lt;span class=&quot;Operators&quot;&gt;~&lt;/span&gt;/Works/Ruby/gitnub&lt;span class=&quot;Operators&quot;&gt;&amp;gt;&lt;/span&gt;-
-&lt;span class=&quot;Operators&quot;&gt;&amp;lt;&lt;/span&gt;%&lt;span class=&quot;Operators&quot;&gt;&amp;gt;&lt;/span&gt;- nub
&lt;/pre&gt;
И получаем следующее:
&lt;div&gt;
&lt;a href=&quot;http://alexanders.in.ua/assets/2008/11/16/gitnub_main.png&quot; title=&quot;GitNub main window
&quot;&gt;
&lt;img src=&quot;http://alexanders.in.ua/assets/2008/11/16/gitnub_main_thumb.png&quot; /&gt;&lt;/a&gt;
&lt;div&gt;&lt;/div&gt;&lt;/div&gt;
Если перейти на другую вкладку, то получим древовидный просмотр исходников:
&lt;div&gt;
&lt;a href=&quot;http://alexanders.in.ua/assets/2008/11/16/gitnub_sources.png&quot; title=&quot;GitNub sources view
&quot;&gt;
&lt;img src=&quot;http://alexanders.in.ua/assets/2008/11/16/gitnub_sources_thumb.png&quot; /&gt;&lt;/a&gt;
&lt;div&gt;&lt;/div&gt;&lt;/div&gt;
Еще одна фишка GitNub&#8217;а в том что он может быть интегрирован с github. Для этого есть так называемая вкладка Network.
&lt;div&gt;
&lt;a href=&quot;http://alexanders.in.ua/assets/2008/11/16/gitnub_network.png&quot; title=&quot;GitNub network
&quot;&gt;
&lt;img src=&quot;http://alexanders.in.ua/assets/2008/11/16/gitnub_network_thumb.png&quot; /&gt;&lt;/a&gt;
&lt;div&gt;&lt;/div&gt;&lt;/div&gt;
Для того что бы вкладка работала и показывала статистику github нам надо сделать то что просит нас программа:
&lt;pre class=&quot;pastels_on_dark&quot;&gt;
-&lt;span class=&quot;Operators&quot;&gt;&amp;lt;&lt;/span&gt;devil@Hor.local:&lt;span class=&quot;Operators&quot;&gt;~&lt;/span&gt;/Works/Ruby/gitnub&lt;span class=&quot;Operators&quot;&gt;&amp;gt;&lt;/span&gt;-
-&lt;span class=&quot;Operators&quot;&gt;&amp;lt;&lt;/span&gt;%&lt;span class=&quot;Operators&quot;&gt;&amp;gt;&lt;/span&gt;- git config github.user Caged
-&lt;span class=&quot;Operators&quot;&gt;&amp;lt;&lt;/span&gt;devil@Hor.local:&lt;span class=&quot;Operators&quot;&gt;~&lt;/span&gt;/Works/Ruby/gitnub&lt;span class=&quot;Operators&quot;&gt;&amp;gt;&lt;/span&gt;-
-&lt;span class=&quot;Operators&quot;&gt;&amp;lt;&lt;/span&gt;%&lt;span class=&quot;Operators&quot;&gt;&amp;gt;&lt;/span&gt;- git config github.repo gitnub
&lt;/pre&gt;
В итоге мы получим следующее:
&lt;div&gt;
&lt;a href=&quot;http://alexanders.in.ua/assets/2008/11/16/gitnub_github.png&quot; title=&quot;GitNub GitHub network view
&quot;&gt;
&lt;img src=&quot;http://alexanders.in.ua/assets/2008/11/16/gitnub_github_thumb.png&quot; /&gt;&lt;/a&gt;
&lt;div&gt;&lt;/div&gt;&lt;/div&gt;

	&lt;p&gt;Наконец-то под мак появился нормальный &lt;span class=&quot;caps&quot;&gt;GUI&lt;/span&gt; для git.
Пожелаем проекту дальнейшего развития!&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://alexanders.in.ua/">
    <author>
      <name>AlexanderAD</name>
    </author>
    <id>tag:alexanders.in.ua,2008-09-03:66</id>
    <published>2008-09-03T20:37:00Z</published>
    <updated>2008-09-04T05:38:29Z</updated>
    <category term="Django"/>
    <category term="django"/>
    <category term="python"/>
    <link href="http://alexanders.in.ua/2008/9/3/django-2" rel="alternate" type="text/html"/>
    <title>Django &#1088;&#1077;&#1083;&#1080;&#1079;!</title>
<content type="html">
            &lt;p&gt;Три года тому Джанго был представлен сообществу питонистов и с тех пор было закомичено не мало строк кода, добавлено багов, исправлено фич. И вот сегодня мы, все питонисты, можем с гордостью показать язык коллегам (Ruby/RoR), ведь у нас теперь тоже есть отличный фреймворк :P&lt;br /&gt;
Официально &lt;a href=&quot;http://www.djangoproject.com/weblog/2008/sep/03/1/&quot;&gt;вот здесь&lt;/a&gt;, &lt;a href=&quot;http://docs.djangoproject.com/en/dev/releases/1.0/&quot;&gt;вот так&lt;/a&gt; и &lt;a href=&quot;http://www.djangoproject.com/download/&quot;&gt;отсюда&lt;/a&gt;.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://alexanders.in.ua/">
    <author>
      <name>DeViL</name>
    </author>
    <id>tag:alexanders.in.ua,2008-08-17:63</id>
    <published>2008-08-17T18:28:00Z</published>
    <updated>2008-08-25T05:52:31Z</updated>
    <category term="RoR"/>
    <category term="Ruby"/>
    <category term="macos x"/>
    <category term="mod_rails"/>
    <category term="passenges"/>
    <link href="http://alexanders.in.ua/2008/8/17/passenger-prefpane-macos-x" rel="alternate" type="text/html"/>
    <title>&#1091;&#1076;&#1086;&#1073;&#1085;&#1072;&#1103; &#1088;&#1072;&#1079;&#1088;&#1072;&#1073;&#1086;&#1090;&#1082;&#1072; rails &#1087;&#1088;&#1080;&#1083;&#1086;&#1078;&#1077;&#1085;&#1080;&#1081; &#1085;&#1072; MacOS X</title>
<content type="html">
            &lt;p&gt;Продолжаю серию статей про Passenger, модуль для Apache, который позволяет запускать rails и rack(merb) приложения руби.&lt;/p&gt;

&lt;p&gt;Тут недавно наткнулся на очень удобную вещь - &lt;a href=&quot;http://www.fngtps.com/2008/06/putting-the-pane-back-into-deployment&quot; title=&quot;Passenger Pref pane&quot;&gt;Passenger Pref pane&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Скачиваем архив. Устанавливаем.
&lt;img title=&quot;Установка Passenger Pref Pane&quot; src=&quot;http://alexanders.in.ua/assets/2008/8/17/prefpane_install.jpg&quot; alt=&quot;Установка Passenger Pref Pane&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Далее в системных настройках в разделе &lt;strong&gt;Другие&lt;/strong&gt; у нас появляеться Passenger.
&lt;img title=&quot;Passenger&quot; src=&quot;http://alexanders.in.ua/assets/2008/8/17/settings.jpg&quot; alt=&quot;Passenger&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Нажимаем на него и добавляем свои rails приложения.
&lt;img title=&quot;Passenger apps&quot; src=&quot;http://alexanders.in.ua/assets/2008/8/17/prefpane.jpg&quot; alt=&quot;Passenger apps&quot; /&gt;&lt;/p&gt;

&lt;p&gt;После этого перезагружаем Apache:&lt;/p&gt;

&lt;pre class=&quot;pastels_on_dark&quot;&gt;
root@host &lt;span class=&quot;Operators&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;Comments&quot;&gt;&lt;span class=&quot;Comments&quot;&gt;#&lt;/span&gt; apachectl graceful&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;Да , модуль работает по умолчанию с Apache, который идет в поставке с системой, но это можно обойти.
Все файлы виртуальных хостов лежат в папке &lt;em&gt;/etc/apache2/passenger_pane_vhosts&lt;/em&gt;.
Потому я у себя в сборке macports Apache в файле &lt;em&gt;/opt/local/apache2/conf/extra/httpd-vhosts.conf&lt;/em&gt; прописал следующее:&lt;/p&gt;

&lt;pre class=&quot;pastels_on_dark&quot;&gt;
Include &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;/etc/apache2/passenger_pane_vhosts/*.conf&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;После этого каждое приложение можно удобно открывать в браузере, например, betstats.local.
&lt;img title=&quot;App&quot; src=&quot;http://alexanders.in.ua/assets/2008/8/17/apps.jpg&quot; alt=&quot;App&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Вот и все что нужно, зато разработка стала намного удобнее. Не требуеться запускать ./script/server,
держать mongrel и nginx(конфиги нада править:) ).&lt;/p&gt;

&lt;p&gt;В следующей статье думаю протестировать производительность Passenger и mongrel.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;P.S.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Для того что бы поставить PassengerPref.pane на систему где mod_passenger есть только в сборке Apache из macports нужно подправить один файлик - &lt;em&gt;Passenger.prefPane/Contents/Resources/PassengerPref.rb&lt;/em&gt;:&lt;/p&gt;

&lt;pre class=&quot;pastels_on_dark&quot;&gt;
&lt;span class=&quot;Numbers&quot;&gt;197&lt;/span&gt;  &lt;span class=&quot;ControlStructures&quot;&gt;def&lt;/span&gt; passenger_installed?
&lt;span class=&quot;Numbers&quot;&gt;198&lt;/span&gt;    &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;`&lt;/span&gt;/usr/sbin/httpd -t -D DUMP_MODULES 2&amp;gt;&amp;amp;1&lt;span class=&quot;Strings&quot;&gt;`&lt;/span&gt;&lt;/span&gt;.include? &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;passenger_module&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;Numbers&quot;&gt;199&lt;/span&gt;  &lt;span class=&quot;ControlStructures&quot;&gt;end&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;Нужно поменять путь к апачу, потому как он так проверяет есть ли модуль passenger или нет.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://alexanders.in.ua/">
    <author>
      <name>DeViL</name>
    </author>
    <id>tag:alexanders.in.ua,2008-07-09:59</id>
    <published>2008-07-09T18:14:00Z</published>
    <updated>2008-07-09T18:15:21Z</updated>
    <category term="JavaScript"/>
    <category term="ajax"/>
    <category term="ie"/>
    <category term="javascript"/>
    <link href="http://alexanders.in.ua/2008/7/9/ajax_ie7_fuck" rel="alternate" type="text/html"/>
    <title>Axaj.Updater &amp;&amp; IE 7 bug(?)</title>
<content type="html">
            &lt;h2&gt;Анотация&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;История в двух частях о тяжелых буднях пользователей IE 7&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;Часть первая &quot;&lt;strong&gt;Bug&lt;/strong&gt;&quot;&lt;/h2&gt;

&lt;p&gt;Все началось с того что мне надо было сделать на одном сайте обновлялку рендомных цитат фсяких там философов.
Сделал через прототайп и егошный движок аякса, потому как там юзался lightbox 2. Использовал метод &lt;em&gt;Axaj.Updater&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Проверил во всех своих браузерах, все работает классно. Но не тут-то было!
IE 7 упорно показывает первое изменение и все! И хоть ты тресни! &lt;/p&gt;

&lt;p&gt;Мучался долго... Целый час...&lt;/p&gt;

&lt;h2&gt;Часть вторая, заключительная &quot;&lt;strong&gt;Cache&lt;/strong&gt;&quot;&lt;/h2&gt;

&lt;p&gt;А как оказалось у нас IE 7 сильно умный и кеширует однотипные аякс запросы полностью! И его не волнует что у нас может быть разный контент... Ну да ладно! У нас есть решение!!!&lt;/p&gt;

&lt;p&gt;Всего-то что надо - это поставить нужные хидеры, которые нам возвращает скрипт!&lt;/p&gt;

&lt;p&gt;А именно:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Pragma: public&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Expires: 0&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Cache-Control: must-revalidate, post-check=0, pre-check=0&lt;/em&gt;&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://alexanders.in.ua/">
    <author>
      <name>DeViL</name>
    </author>
    <id>tag:alexanders.in.ua,2008-07-03:49</id>
    <published>2008-07-03T08:53:00Z</published>
    <updated>2008-07-03T09:03:51Z</updated>
    <category term="RoR"/>
    <category term="Ruby"/>
    <category term="apache"/>
    <category term="mod_rails"/>
    <category term="ruby"/>
    <category term="ruby on rails"/>
    <link href="http://alexanders.in.ua/2008/7/3/mod_rails" rel="alternate" type="text/html"/>
    <title>mod_rails!</title>
<content type="html">
            &lt;h2&gt;Лирическое вступление&lt;/h2&gt;

&lt;p&gt;Вот давеча надо было сделать виртуальных хост для одного клиента. Он попросил ему сделать хостинг под RoR проект.&lt;/p&gt;

&lt;p&gt;Сначала я думал сделать как всегда - mongrel_cluster + nginx, но не тут-то было! Клиент попросил что бы он полностью 
имел доступ к управлению своего рельсового приложения. И вот тут-то у меня начались проблемы.&lt;/p&gt;

&lt;p&gt;Дело в том что у меня на сервере нету реальных пользователей для хостинга. Все пользователи в базе, они имеют только FTP и все. Шелл если и даю , то только jail.&lt;/p&gt;

&lt;p&gt;И тут мне пришла мысль! Есть же mod_rails! Я правда его не тестировал на продакшене, но почитать информацию в интернете решил что этот модуль уже готов к полноценной стабильной работе.&lt;/p&gt;

&lt;p&gt;Итак, что же нам требуеться? &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;установить gem модуль passenger&lt;/li&gt;
&lt;li&gt;настроить apache&lt;/li&gt;
&lt;li&gt;сделать виртуальных хост для рельсового приложения&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Итак! Приступим!&lt;/p&gt;

&lt;h2&gt;Установка mod_rails и настройка apache&lt;/h2&gt;

&lt;pre class=&quot;pastels_on_dark&quot;&gt;
root@host &lt;span class=&quot;Operators&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;Comments&quot;&gt;&lt;span class=&quot;Comments&quot;&gt;#&lt;/span&gt; gem install passenger&lt;/span&gt;
Building native extensions.  This could take a &lt;span class=&quot;ControlStructures&quot;&gt;while&lt;/span&gt;...
Successfully installed passenger-2.0.1
1 gem installed
Installing ri documentation &lt;span class=&quot;ControlStructures&quot;&gt;for&lt;/span&gt; passenger-2.0.1...
Installing RDoc documentation &lt;span class=&quot;ControlStructures&quot;&gt;for&lt;/span&gt; passenger-2.0.1...
root@host &lt;span class=&quot;Operators&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;Comments&quot;&gt;&lt;span class=&quot;Comments&quot;&gt;#&lt;/span&gt; passenger-install-apache2-module&lt;/span&gt;
Welcome to the Phusion Passenger Apache 2 module installer, v2.0.1.

This installer will guide you through the entire installation process. It
shouldn&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;t take more than 3 minutes in total.&lt;/span&gt;
&lt;span class=&quot;Strings&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;Strings&quot;&gt;Here&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;s what you can expect from the installation process:

 1. The Apache 2 module will be installed &lt;span class=&quot;ControlStructures&quot;&gt;for&lt;/span&gt; you.
 2. You&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;ll learn how to configure Apache.&lt;/span&gt;
&lt;span class=&quot;Strings&quot;&gt; 3. You&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;ll learn how to deploy a Ruby on Rails application.

Don&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;t worry if anything goes wrong. This installer will advise you on how to&lt;/span&gt;
&lt;span class=&quot;Strings&quot;&gt;solve any problems.&lt;/span&gt;
&lt;span class=&quot;Strings&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;Strings&quot;&gt;Press Enter to continue, or Ctrl-C to abort.&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;Последняя команда установит модуль к apache, причем у вас должны быть установлены Apache Portable Runtime (APR) development headers. После этого будет собран модуль и инсталятор выдаст вам информации он том как подключить модуль.&lt;/p&gt;

&lt;p&gt;Вот мои настройки модуля:&lt;/p&gt;

&lt;pre class=&quot;pastels_on_dark&quot;&gt;
LoadModule passenger_module /opt/ree/lib/ruby/gems/1.8/gems/passenger-2.0.1/ext/apache2/mod_passenger.so                                                                 
PassengerRoot /opt/ree/lib/ruby/gems/1.8/gems/passenger-2.0.1                                                                                                            
PassengerRuby /opt/ree/bin/ruby                                                                                                                                          
PassengerLogLevel 3                                                                                                                                                                  
PassengerUserSwitching on                                                                                                                                                            
PassengerDefaultUser wwwrun                                                                                                                                                          
PassengerMaxPoolSize 20 
&lt;/pre&gt;

&lt;p&gt;Для тестинга я включил полное логгирование.&lt;/p&gt;

&lt;h2&gt;Виртуальный хост&lt;/h2&gt;

&lt;pre class=&quot;pastels_on_dark&quot;&gt;
&amp;lt;VirtualHost xxx.xxx.xxx.xxx:80&amp;gt;                                                                                                                                                        
  ServerName example.com                                                                                                                                                          
  ServerAlias www.example.com                                                                                                                                                     
  ServerAdmin admin@example.com                                                                                                                                                
  DocumentRoot &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;/srv/www/virtuals/example.com/public/&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;                                                                                                                                        
  ErrorLog &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;/srv/www/logs/example.com-error.log&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;                                                                                                                                      
  CustomLog &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;/srv/www/logs/example.com-access.log&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; combined                                                                                                                           

    &amp;lt;Directory &amp;quot;/srv/www/virtuals/example.com/public/&amp;quot;&amp;gt;                                                                                                                                                                                                                                                                      
        AllowOverride All                                                                                                                                                            
        Order allow,deny                                                                                                                                                             
        Allow from all                                                                                                                                                               
    &amp;lt;/Directory&amp;gt;                                                                                                                                                                     
&amp;lt;/VirtualHost&amp;gt;
&lt;/pre&gt;

&lt;p&gt;Все! Наш mod_rails настолько умный что если наш каталог public не являеться public рельсового проекта - то он и не будет его обрабатывать как rails app.
После этого можно просматривать статистику :)&lt;/p&gt;

&lt;pre class=&quot;pastels_on_dark&quot;&gt;
root@host:&lt;span class=&quot;Operators&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;Comments&quot;&gt;&lt;span class=&quot;Comments&quot;&gt;#&lt;/span&gt; /opt/ree/bin/passenger-memory-stats &lt;/span&gt;
------------- Apache processes --------------
PID   PPID  Threads  VMSize    Private  Name
---------------------------------------------
7214  9001  1        302.3 MB  1.6 MB   /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -DSSL -DAWSTATS -DSTATUS
7216  9001  1        302.4 MB  2.6 MB   /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -DSSL -DAWSTATS -DSTATUS
7233  9001  1        302.5 MB  2.8 MB   /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -DSSL -DAWSTATS -DSTATUS
7367  9001  1        302.4 MB  2.5 MB   /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -DSSL -DAWSTATS -DSTATUS
7370  9001  1        302.3 MB  1.9 MB   /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -DSSL -DAWSTATS -DSTATUS
7375  9001  1        302.2 MB  1.4 MB   /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -DSSL -DAWSTATS -DSTATUS
7380  9001  1        302.5 MB  2.6 MB   /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -DSSL -DAWSTATS -DSTATUS
7382  9001  1        302.4 MB  2.6 MB   /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -DSSL -DAWSTATS -DSTATUS
7386  9001  1        302.2 MB  1.5 MB   /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -DSSL -DAWSTATS -DSTATUS
7387  9001  1        302.1 MB  1.3 MB   /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -DSSL -DAWSTATS -DSTATUS
7390  9001  1        301.6 MB  0.4 MB   /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -DSSL -DAWSTATS -DSTATUS
7394  9001  1        302.2 MB  1.5 MB   /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -DSSL -DAWSTATS -DSTATUS
7879  9001  1        301.6 MB  0.4 MB   /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -DSSL -DAWSTATS -DSTATUS
9001  1     1        301.3 MB  0.4 MB   /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -DSSL -DAWSTATS -DSTATUS
&lt;span class=&quot;Comments&quot;&gt;&lt;span class=&quot;Comments&quot;&gt;#&lt;/span&gt;## Processes: 14&lt;/span&gt;
&lt;span class=&quot;Comments&quot;&gt;&lt;span class=&quot;Comments&quot;&gt;#&lt;/span&gt;## Total private dirty RSS: 23.54 MB&lt;/span&gt;

--------- Passenger processes ----------
PID    Threads  VMSize    Private  Name
----------------------------------------
8105   1        75.7 MB   6.6 MB   Passenger FrameworkSpawner: 2.1.0
8134   1        82.9 MB   8.7 MB   Passenger ApplicationSpawner: /srv/www/virtuals/example.com/
8136   1        103.7 MB  25.3 MB  Rails: /srv/www/virtuals/example.com
32446  39       58.4 MB   4.9 MB   /opt/ree/lib/ruby/gems/1.8/gems/passenger-2.0.1/ext/apache2/ApplicationPoolServerExecutable 3 /opt/ree/lib/ruby/gems/1.8/gems/passenger-2.0.1/bin/passenger-spawn-server  /opt/ree/bin/ruby  /tmp/passenger_status.9001.fifo
32449  1        24.5 MB   7.7 MB   Passenger spawn server
&lt;span class=&quot;Comments&quot;&gt;&lt;span class=&quot;Comments&quot;&gt;#&lt;/span&gt;## Processes: 5&lt;/span&gt;
&lt;span class=&quot;Comments&quot;&gt;&lt;span class=&quot;Comments&quot;&gt;#&lt;/span&gt;## Total private dirty RSS: 53.08 MB&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;Рестартинг приложения происходит после создания в папке tmp проекта файла restart.txt.
Он автоматом потом удаляеться после рестарта приложения!&lt;/p&gt;

&lt;h2&gt;Выводы :)&lt;/h2&gt;

&lt;p&gt;Просто, удобно, безопасно. Как для шаред хостинга - то что доктор прописал!&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://alexanders.in.ua/">
    <author>
      <name>AlexanderAD</name>
    </author>
    <id>tag:alexanders.in.ua,2008-06-24:47</id>
    <published>2008-06-24T18:20:00Z</published>
    <updated>2008-06-24T18:21:49Z</updated>
    <category term="Offtopic"/>
    <category term="RoR"/>
    <category term="man"/>
    <link href="http://alexanders.in.ua/2008/6/24/" rel="alternate" type="text/html"/>
    <title>&#1055;&#1077;&#1095;&#1072;&#1090;&#1072;&#1077;&#1084; &#1084;&#1072;&#1085;&#1099;</title>
<content type="html">
            &lt;p&gt;Наверное, каждый уже придумал способ распечатывать ман страницы, но я, все же, повторюсь -- отличную штуку узнал на днях.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;man -t python &amp;gt; man_python.ps &amp;amp;&amp;amp; ps2pdf man_python.ps &amp;amp;&amp;amp; rm -rf man_python.ps&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Получается красиво и печатабельно.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://alexanders.in.ua/">
    <author>
      <name>DeViL</name>
    </author>
    <id>tag:alexanders.in.ua,2008-06-21:46</id>
    <published>2008-06-21T04:55:00Z</published>
    <updated>2008-06-21T05:44:49Z</updated>
    <category term="Ruby"/>
    <category term="ruby"/>
    <category term="security"/>
    <link href="http://alexanders.in.ua/2008/6/21/ruby-bug" rel="alternate" type="text/html"/>
    <title>&#1057;&#1088;&#1086;&#1095;&#1085;&#1086;&#1077; &#1086;&#1073;&#1085;&#1086;&#1074;&#1083;&#1077;&#1085;&#1080;&#1077; &#1088;&#1091;&#1073;&#1080;</title>
<content type="html">
            &lt;br /&gt;
&lt;h3&gt;Описание&lt;/h3&gt;
Множественные уязвимости в Ruby могут привести к отказу в обслуживании (DoS) или позволяют выполнение произвольного кода.&lt;br /&gt;&lt;br /&gt;

&lt;h3&gt;Воздействие&lt;/h3&gt;&lt;br /&gt; 

В следующую уязвимость, злоумышленник может привести к отказу в обслуживании из условий или выполнить произвольный код.  &lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-2662&quot;&gt;CVE-2008-2662&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-2663&quot;&gt;CVE-2008-2663&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-2725&quot;&gt;CVE-2008-2725&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-2726&quot;&gt;CVE-2008-2726&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-2664&quot;&gt;CVE-2008-2664&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;h3&gt;Уязвимые версии &lt;/h3&gt;&lt;br /&gt;

1.8 серии &lt;br /&gt;
1.8.4 и все предыдущие версии&lt;br /&gt; 
1.8.5-p230 и все предыдущие версии&lt;br /&gt; 
1.8.6-p229 и все предыдущие версии &lt;br /&gt;
1.8.7-p21 и все предыдущие версии &lt;br /&gt;
1.9 серии &lt;br /&gt;
1.9.0-1 и все предыдущие версии&lt;br /&gt;&lt;br /&gt;

&lt;h3&gt;Учтите!&lt;/h3&gt;&lt;br /&gt;
В Ruby 1.8.7 поломана обратная совместимость и он совместим только с RoR 2.1, потому не стоит сгоряча обновляться.&lt;br /&gt;
Есть некоторые проблемы при использовании 1.8.6p230 на linux.&lt;br /&gt;
          </content>  </entry>
  <entry xml:base="http://alexanders.in.ua/">
    <author>
      <name>AlexanderAD</name>
    </author>
    <id>tag:alexanders.in.ua,2008-06-20:45</id>
    <published>2008-06-20T09:31:00Z</published>
    <updated>2008-06-20T09:31:45Z</updated>
    <category term="Python"/>
    <category term="python"/>
    <category term="python2.6"/>
    <category term="python3000"/>
    <link href="http://alexanders.in.ua/2008/6/20/python-2-6-python-3-0" rel="alternate" type="text/html"/>
    <title>Python 2.6 &#1080; Python 3.0</title>
<content type="html">
            &lt;p&gt;via &lt;a href=&quot;http://www.opennet.ru&quot;&gt;http://www.opennet.ru&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Началось бета-тестирование &lt;a href=&quot;http://www.python.org/download/releases/2.6/&quot;&gt;Python 2.6&lt;/a&gt; и &lt;a href=&quot;http://www.python.org/download/releases/2.6/&quot;&gt;Python 3.0&lt;/a&gt;. Финальные релизы 2.6 и 3.0 запланированы на сентябрь. &lt;/p&gt;

&lt;p&gt;Python 2.6 представляет собой переходный релиз, облегчающий переход с Python 2.x на Python 3.0, например появятся предупреждения для разработчиков о тех конструкциях языка, которые могут вызвать проблемы при переходе на версию 3.0. Многие возможности Python 3.0 будут портированы в ветку 2.6 не нарушая совместимости с ранее написанными для Python 2.x скриптами.  &lt;/p&gt;

&lt;p&gt;Из новых возможностей (и невозможностей) Python 3.0 можно отметить: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;нарушение обратной совместимости со скриптами, разработанными для более ранних версий Python; &lt;/li&gt;
&lt;li&gt;удаление дублирующих конструкторов и модулей; &lt;/li&gt;
&lt;li&gt;вместо оператора форматирования строк &lt;code&gt;%&lt;/code&gt; будет использован глобальная функция и метод &lt;code&gt;format()&lt;/code&gt;, например &lt;code&gt;&quot;The story of {0}, {1}, and {c}&quot;.format(a, b, c=d)&lt;/code&gt; или &lt;code&gt;print(format(10.0, &quot;7.3g&quot;))&lt;/code&gt;;&lt;/li&gt;
&lt;li&gt;будут удалены методы &lt;code&gt;dict.iterkeys(), dict.itervalues()&lt;/code&gt; и &lt;code&gt;dict.iteritems()&lt;/code&gt;. Методы &lt;code&gt;dict.keys(), dict.values()&lt;/code&gt; и &lt;code&gt;dict.items()&lt;/code&gt; будут возвращать контейнер объектов (итератор); &lt;/li&gt;
&lt;li&gt;возможность аннотирования параметров функций и возвращаемых значений, например &lt;code&gt;def compile(source: &quot;something compilable&quot;)&lt;/code&gt;;&lt;/li&gt;
&lt;li&gt;замена оператора &lt;code&gt;print&lt;/code&gt;, который широко используется для вывода, на функцию &lt;code&gt;print()&lt;/code&gt;; &lt;/li&gt;
&lt;li&gt;использование &lt;code&gt;Unicode&lt;/code&gt; в качестве основной кодировки представления строк (единый тип &lt;code&gt;str&lt;/code&gt;, вместо раздельных &lt;code&gt;str&lt;/code&gt; и &lt;code&gt;unicode&lt;/code&gt;); &lt;/li&gt;
&lt;li&gt;для хранения бинарных данных представлен тип &lt;code&gt;bytes&lt;/code&gt;;&lt;/li&gt;
&lt;li&gt;тип &lt;code&gt;long&lt;/code&gt; переименован в &lt;code&gt;int&lt;/code&gt;, деление &lt;code&gt;int&lt;/code&gt; переменных возвращает &lt;code&gt;float&lt;/code&gt;, для получения целого результата нужно использовать &lt;code&gt;//&lt;/code&gt;; &lt;/li&gt;
&lt;li&gt;для обозначения неравенств, вместо &lt;code&gt;&amp;lt;&amp;gt;&lt;/code&gt; нужно будет использовать &lt;code&gt;!=&lt;/code&gt;; &lt;/li&gt;
&lt;li&gt;признаны устаревшими модули: &lt;code&gt;cPickle, imageop, audiodev, Bastion, bsddb185, exceptions, linuxaudiodev, md5, MimeWriter, mimify, popen2, rexec, sets, sha, stringold, strop, sunaudiodev, timing, xmllib, new&lt;/code&gt;; &lt;/li&gt;
&lt;li&gt;удалены функции &lt;code&gt;os.tmpnam(), os.tempnam() и os.tmpfile()&lt;/code&gt;, вместо них нужно использовать модуль &lt;code&gt;tempfile&lt;/code&gt;; &lt;/li&gt;
&lt;li&gt;все исключения теперь должны порождаться от класса &lt;code&gt;BaseException&lt;/code&gt;; &lt;/li&gt;
&lt;li&gt;новый синтаксис для создания мета-классов &lt;code&gt;(Metaclass)&lt;/code&gt;, реализация абстрактных базовых классов &lt;code&gt;(Abstract Base Class)&lt;/code&gt;, возможность использования декораторов для классов; &lt;/li&gt;
&lt;li&gt;новая реализация библиотеки ввода/вывода, имеющая обратно совместимый &lt;code&gt;API&lt;/code&gt;;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Вот такие вот пироги. Честно говоря, не все в тексте выше звучит так уж радостно, а кое что вообще вызывает недоумение. Впрочем, &lt;em&gt;им там&lt;/em&gt; виднее :) Либо привыкнем, либо останемся на 2.5 :P&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://alexanders.in.ua/">
    <author>
      <name>DeViL</name>
    </author>
    <id>tag:alexanders.in.ua,2008-06-19:44</id>
    <published>2008-06-19T14:15:00Z</published>
    <updated>2008-06-19T14:20:41Z</updated>
    <category term="RoR"/>
    <category term="plugins"/>
    <category term="rails"/>
    <category term="ruby"/>
    <category term="sms"/>
    <link href="http://alexanders.in.ua/2008/6/19/smslink" rel="alternate" type="text/html"/>
    <title>smslink rails plugin</title>
<content type="html">
            &lt;h3&gt;&lt;b&gt;Свершилось!&lt;/b&gt;&lt;/h3&gt;&lt;br /&gt;
Я наконец-то выложил в общий доступ свой первый плагин к smslink,&lt;br /&gt;
демону который позволяет рассылать смс, если у вас конечно есть подходящая железка :)&lt;br /&gt;
Правда он не очень-то гибкий(пока!), но я надеюсь что кому-то он да понадобиться!&lt;br /&gt;

Находиться он на &lt;a href=&quot;http://github.com/simonoff/rails-smslink-plugin/tree/master&quot;&gt;github&lt;/a&gt;
          </content>  </entry>
  <entry xml:base="http://alexanders.in.ua/">
    <author>
      <name>DeViL</name>
    </author>
    <id>tag:alexanders.in.ua,2008-06-05:35</id>
    <published>2008-06-05T21:11:00Z</published>
    <updated>2008-06-06T19:35:18Z</updated>
    <category term="Offtopic"/>
    <category term="Ruby"/>
    <category term="cidr"/>
    <category term="ruby"/>
    <link href="http://alexanders.in.ua/2008/6/5/ruby-cidr-p" rel="alternate" type="text/html"/>
    <title>Ruby: CIDR &#1074; &#1086;&#1076;&#1085;&#1091; &#1089;&#1090;&#1088;&#1086;&#1082;&#1091;</title>
<content type="html">
            В ответку предыдущему посту :P
&lt;br /&gt;
&lt;div&gt;(0..32).each{|x| a=('1'*x+'0'*(32-x)); printf &quot;/%s %d.%d.%d.%d %d\n&quot;, x, a[0,8].to_i(2), a[8,8].to_i(2),a[16,8].to_i(2),a[24,8].to_i(2), 2**(32-x) }&lt;/div&gt;

&lt;pre class=&quot;pastels_on_dark&quot;&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;0 0.0.0.0 4294967296&lt;/span&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;/span&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Numbers&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;Numbers&quot;&gt;128.0&lt;/span&gt;.&lt;span class=&quot;Numbers&quot;&gt;0.0&lt;/span&gt; &lt;span class=&quot;Numbers&quot;&gt;2147483648&lt;/span&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;2 192.0.0.0 1073741824&lt;/span&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;/span&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Numbers&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;Numbers&quot;&gt;224.0&lt;/span&gt;.&lt;span class=&quot;Numbers&quot;&gt;0.0&lt;/span&gt; &lt;span class=&quot;Numbers&quot;&gt;536870912&lt;/span&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;4 240.0.0.0 268435456&lt;/span&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;/span&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Numbers&quot;&gt;5&lt;/span&gt; &lt;span class=&quot;Numbers&quot;&gt;248.0&lt;/span&gt;.&lt;span class=&quot;Numbers&quot;&gt;0.0&lt;/span&gt; &lt;span class=&quot;Numbers&quot;&gt;134217728&lt;/span&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;6 252.0.0.0 67108864&lt;/span&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;/span&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Numbers&quot;&gt;7&lt;/span&gt; &lt;span class=&quot;Numbers&quot;&gt;254.0&lt;/span&gt;.&lt;span class=&quot;Numbers&quot;&gt;0.0&lt;/span&gt; &lt;span class=&quot;Numbers&quot;&gt;33554432&lt;/span&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;8 255.0.0.0 16777216&lt;/span&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;/span&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Numbers&quot;&gt;9&lt;/span&gt; &lt;span class=&quot;Numbers&quot;&gt;255.128&lt;/span&gt;.&lt;span class=&quot;Numbers&quot;&gt;0.0&lt;/span&gt; &lt;span class=&quot;Numbers&quot;&gt;8388608&lt;/span&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;10 255.192.0.0 4194304&lt;/span&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;/span&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Numbers&quot;&gt;11&lt;/span&gt; &lt;span class=&quot;Numbers&quot;&gt;255.224&lt;/span&gt;.&lt;span class=&quot;Numbers&quot;&gt;0.0&lt;/span&gt; &lt;span class=&quot;Numbers&quot;&gt;2097152&lt;/span&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;12 255.240.0.0 1048576&lt;/span&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;/span&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Numbers&quot;&gt;13&lt;/span&gt; &lt;span class=&quot;Numbers&quot;&gt;255.248&lt;/span&gt;.&lt;span class=&quot;Numbers&quot;&gt;0.0&lt;/span&gt; &lt;span class=&quot;Numbers&quot;&gt;524288&lt;/span&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;14 255.252.0.0 262144&lt;/span&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;/span&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Numbers&quot;&gt;15&lt;/span&gt; &lt;span class=&quot;Numbers&quot;&gt;255.254&lt;/span&gt;.&lt;span class=&quot;Numbers&quot;&gt;0.0&lt;/span&gt; &lt;span class=&quot;Numbers&quot;&gt;131072&lt;/span&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;16 255.255.0.0 65536&lt;/span&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;/span&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Numbers&quot;&gt;17&lt;/span&gt; &lt;span class=&quot;Numbers&quot;&gt;255.255&lt;/span&gt;.&lt;span class=&quot;Numbers&quot;&gt;128.0&lt;/span&gt; &lt;span class=&quot;Numbers&quot;&gt;32768&lt;/span&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;18 255.255.192.0 16384&lt;/span&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;/span&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Numbers&quot;&gt;19&lt;/span&gt; &lt;span class=&quot;Numbers&quot;&gt;255.255&lt;/span&gt;.&lt;span class=&quot;Numbers&quot;&gt;224.0&lt;/span&gt; &lt;span class=&quot;Numbers&quot;&gt;8192&lt;/span&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;20 255.255.240.0 4096&lt;/span&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;/span&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Numbers&quot;&gt;21&lt;/span&gt; &lt;span class=&quot;Numbers&quot;&gt;255.255&lt;/span&gt;.&lt;span class=&quot;Numbers&quot;&gt;248.0&lt;/span&gt; &lt;span class=&quot;Numbers&quot;&gt;2048&lt;/span&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;22 255.255.252.0 1024&lt;/span&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;/span&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Numbers&quot;&gt;23&lt;/span&gt; &lt;span class=&quot;Numbers&quot;&gt;255.255&lt;/span&gt;.&lt;span class=&quot;Numbers&quot;&gt;254.0&lt;/span&gt; &lt;span class=&quot;Numbers&quot;&gt;512&lt;/span&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;24 255.255.255.0 256&lt;/span&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;/span&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Numbers&quot;&gt;25&lt;/span&gt; &lt;span class=&quot;Numbers&quot;&gt;255.255&lt;/span&gt;.&lt;span class=&quot;Numbers&quot;&gt;255.128&lt;/span&gt; &lt;span class=&quot;Numbers&quot;&gt;128&lt;/span&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;26 255.255.255.192 64&lt;/span&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;/span&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Numbers&quot;&gt;27&lt;/span&gt; &lt;span class=&quot;Numbers&quot;&gt;255.255&lt;/span&gt;.&lt;span class=&quot;Numbers&quot;&gt;255.224&lt;/span&gt; &lt;span class=&quot;Numbers&quot;&gt;32&lt;/span&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;28 255.255.255.240 16&lt;/span&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;/span&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Numbers&quot;&gt;29&lt;/span&gt; &lt;span class=&quot;Numbers&quot;&gt;255.255&lt;/span&gt;.&lt;span class=&quot;Numbers&quot;&gt;255.248&lt;/span&gt; &lt;span class=&quot;Numbers&quot;&gt;8&lt;/span&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;30 255.255.255.252 4&lt;/span&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;/span&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Numbers&quot;&gt;31&lt;/span&gt; &lt;span class=&quot;Numbers&quot;&gt;255.255&lt;/span&gt;.&lt;span class=&quot;Numbers&quot;&gt;255.254&lt;/span&gt; &lt;span class=&quot;Numbers&quot;&gt;2&lt;/span&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;RegularExpressions&quot;&gt;32 255.255.255.255 1&lt;/span&gt;
&lt;span class=&quot;RegularExpressions&quot;&gt;# =&amp;gt; 0..32&lt;/span&gt;
&lt;/pre&gt;

UPDATE: DM предложил более компактный вариант:
&lt;div&gt;(0..32).each{|x| a=2**(32-x); quad = []; (0...4).each{|q| quad.push(4294967296-a&gt;&gt;(24-q*8)&amp;255) }; puts &quot;/#{x} #{quad.join('.')} #{a}&quot; }&lt;/div&gt;
          </content>  </entry>
  <entry xml:base="http://alexanders.in.ua/">
    <author>
      <name>AlexanderAD</name>
    </author>
    <id>tag:alexanders.in.ua,2008-06-05:34</id>
    <published>2008-06-05T17:58:00Z</published>
    <updated>2008-06-06T10:14:01Z</updated>
    <category term="Offtopic"/>
    <category term="Python"/>
    <category term="cidr"/>
    <category term="python"/>
    <link href="http://alexanders.in.ua/2008/6/5/python-cidr-p" rel="alternate" type="text/html"/>
    <title>Python: CIDR &#1074; &#1086;&#1076;&#1085;&#1091; &#1089;&#1090;&#1088;&#1086;&#1082;&#1091; :P</title>
<content type="html">
            &lt;p&gt;Трям. На днях надо было для Джанговой &lt;code&gt;newform&lt;/code&gt;'ы составить кортеж для &lt;code&gt;&amp;lt;select&amp;gt;&lt;/code&gt;'a по маскам, как то:&lt;/p&gt;

&lt;pre class=&quot;pastels_on_dark&quot;&gt;
In [&lt;span class=&quot;Numbers&quot;&gt;4&lt;/span&gt;]: [(&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;Constants&quot;&gt;%s&lt;/span&gt;&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;Operators&quot;&gt;%&lt;/span&gt; i, &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;/&lt;span class=&quot;Constants&quot;&gt;%s&lt;/span&gt; - &lt;span class=&quot;Constants&quot;&gt;%d&lt;/span&gt;&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;Operators&quot;&gt;%&lt;/span&gt; (i, &lt;span class=&quot;Functions&quot;&gt;pow&lt;/span&gt;(&lt;span class=&quot;Numbers&quot;&gt;2&lt;/span&gt;, &lt;span class=&quot;Numbers&quot;&gt;32&lt;/span&gt;&lt;span class=&quot;Operators&quot;&gt;-&lt;/span&gt;i))) &lt;span class=&quot;ControlStructures&quot;&gt;for&lt;/span&gt; i &lt;span class=&quot;Operators&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;Functions&quot;&gt;range&lt;/span&gt;(&lt;span class=&quot;Numbers&quot;&gt;23&lt;/span&gt;, &lt;span class=&quot;Numbers&quot;&gt;31&lt;/span&gt;)]
Out[&lt;span class=&quot;Numbers&quot;&gt;4&lt;/span&gt;]: 
[(&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;23&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/23 - 512&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;),
 (&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;24&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/24 - 256&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;),
 (&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;25&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/25 - 128&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;),
 (&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;26&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/26 - 64&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;),
 (&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;27&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/27 - 32&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;),
 (&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;28&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/28 - 16&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;),
 (&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;29&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/29 - 8&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;),
 (&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;30&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/30 - 4&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;)]
&lt;/pre&gt;

&lt;p&gt;А потом работать стало лень. И я сочинил такое:&lt;/p&gt;

&lt;div&gt;In [28]: [(&quot;/%s %d.%d.%d.%d %d&quot; % (i, string.atoi(('1'*i+'0'*(32-i))[0:8], 2), string.atoi(('1'*i+'0'*(32-i))[8:16], 2), string.atoi(('1'*i +'0'*(32-i))[16:24], 2), string.atoi(('1'*i+'0'*(32-i))[24:32], 2), pow(2, 32-i))) for i in range(0, 32+1)]&lt;/div&gt;

&lt;pre class=&quot;pastels_on_dark&quot;&gt;
Out[&lt;span class=&quot;Numbers&quot;&gt;28&lt;/span&gt;]: 
[&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/0 0.0.0.0 4294967296&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
 &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/1 128.0.0.0 2147483648&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
 &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/2 192.0.0.0 1073741824&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
 &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/3 224.0.0.0 536870912&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
 &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/4 240.0.0.0 268435456&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
 &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/5 248.0.0.0 134217728&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
 &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/6 252.0.0.0 67108864&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
 &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/7 254.0.0.0 33554432&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
 &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/8 255.0.0.0 16777216&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
 &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/9 255.128.0.0 8388608&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
 &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/10 255.192.0.0 4194304&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
 &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/11 255.224.0.0 2097152&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
 &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/12 255.240.0.0 1048576&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
 &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/13 255.248.0.0 524288&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
 &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/14 255.252.0.0 262144&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
 &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/15 255.254.0.0 131072&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
 &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/16 255.255.0.0 65536&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
 &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/17 255.255.128.0 32768&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
 &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/18 255.255.192.0 16384&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
 &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/19 255.255.224.0 8192&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
 &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/20 255.255.240.0 4096&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
 &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/21 255.255.248.0 2048&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
 &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/22 255.255.252.0 1024&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
 &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/23 255.255.254.0 512&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
 &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/24 255.255.255.0 256&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
 &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/25 255.255.255.128 128&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
 &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/26 255.255.255.192 64&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
 &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/27 255.255.255.224 32&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
 &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/28 255.255.255.240 16&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
 &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/29 255.255.255.248 8&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
 &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/30 255.255.255.252 4&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
 &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/31 255.255.255.254 2&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
 &lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;/32 255.255.255.255 1&lt;span class=&quot;Strings&quot;&gt;'&lt;/span&gt;&lt;/span&gt;]
&lt;span class=&quot;Comments&quot;&gt;&lt;span class=&quot;Comments&quot;&gt;#&lt;/span&gt; а если добавить в конце [::-1] то получим CIDR задом на перед.&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;Правда есть косяки. 1) надо делать &lt;code&gt;import string&lt;/code&gt; -- мелочь, а не приятно. 2) не придумал, как сделать срез, составляя маску, чтобы не повторять &lt;code&gt;string.atoi((&lt;/code&gt;.&lt;br /&gt;
Девил, я жду рубинового варианта :P&lt;/p&gt;

&lt;p&gt;update:
тов. &lt;a href=&quot;http://otkds.blogspot.com/&quot;&gt;ods&lt;/a&gt; предложил в комментариях куда более красивый вариант, который ликвидирует моменты 1 и 2, а кроме того еще и короче и всячески изящней:&lt;/p&gt;

&lt;div&gt; ['/%d %d.%d.%d.%d %d' % ((i,) + tuple([(2**32-2**(32-i)&gt;&gt;(24-j*8))&amp;255 for j in range(4)]) + (2**(32-i),)) for i in range(33)]&lt;/div&gt;
          </content>  </entry>
  <entry xml:base="http://alexanders.in.ua/">
    <author>
      <name>DeViL</name>
    </author>
    <id>tag:alexanders.in.ua,2008-05-29:30</id>
    <published>2008-05-29T16:11:00Z</published>
    <updated>2008-05-29T16:22:39Z</updated>
    <category term="webdesign"/>
    <link href="http://alexanders.in.ua/2008/5/29/sites" rel="alternate" type="text/html"/>
    <title>&#1089;&#1072;&#1081;&#1090;&#1099;, &#1089;&#1072;&#1081;&#1090;&#1099;, &#1089;&#1072;&#1081;&#1090;&#1099;....</title>
<content type="html">
            &lt;p&gt;Блин как мне это все надоело если честно....&lt;/p&gt;

&lt;p&gt;Вот все восхищаються дизайном Артемия Лебедева... Как крута... Как дорого... И тд и тп....
А вы смотрели ЧТО он делает? Да согласен дизайн хороший, мне вообще-то судить трудно, я такой же дизайнер, как балерина :)
Посмотрите в HTML код этих страниц! Берем егошный сайт, проверяем в валидаторе - и что мы видем? Мы видем туевую кучу ошибок, windows-1251 как кодировка и тд и тп. А CSS? Таже фигня....&lt;/p&gt;

&lt;p&gt;И я смотрю всем на это пофиг, ведь это Тёма сказал, Тёма сделал и тд и тп. И так делает не только студия Лебедева, но и остальные студии пост-советского пространства.&lt;/p&gt;

&lt;p&gt;А то что существуют стандарты наши современные веб студии не знают? Или это не нужно? Обьясните мне, что так трудно?
Я вот постоянно со своим дизайнером воюю на этот счет, но мне в ответ - &quot;под осликом работает и хорошо&quot;.&lt;/p&gt;

&lt;p&gt;Это грустно, печально и тд и тп.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://alexanders.in.ua/">
    <author>
      <name>AlexanderAD</name>
    </author>
    <id>tag:alexanders.in.ua,2008-05-18:29</id>
    <published>2008-05-18T11:43:00Z</published>
    <updated>2008-05-18T11:46:17Z</updated>
    <category term="Offtopic"/>
    <category term="linux"/>
    <category term="offtopic"/>
    <category term="qt"/>
    <category term="windows"/>
    <category term="&#1082;&#1080;&#1088;&#1080;&#1083;&#1083;&#1080;&#1094;&#1072; qt"/>
    <link href="http://alexanders.in.ua/2008/5/18/qt-linux-offtopic" rel="alternate" type="text/html"/>
    <title>Qt: &#1088;&#1091;&#1089;&#1089;&#1082;&#1080;&#1081; &#1087;&#1086;&#1076; linux'&#1086;&#1084; &#1080; offtopic'&#1086;&#1084;</title>
<content type="html">
            &lt;p&gt;&lt;em&gt;disclaimer: скоро будет про PyQt, а пока, собственно, не по теме :)&lt;/em&gt;&lt;br /&gt;
Ужасная участь постигла и меня, товарищи -- да, заставили использовать милый Qt :)&lt;br /&gt;
Открытие номер один о великом и русском на всех платформах. Перечитал кучу советов про разные &lt;code&gt;QString::fromLocal8Bit&lt;/code&gt; и разные извращения на постоянной основе с &lt;code&gt;codec -&amp;gt; toUnicode ( s );&lt;/code&gt; а потом таки устроил все как надо в две строки :) Делюсь со страждущими. Не знаю, как вам, но я за мир и utf во всем мире.&lt;/p&gt;

&lt;p&gt;Итак:&lt;/p&gt;

&lt;pre class=&quot;pastels_on_dark&quot;&gt;
&lt;span class=&quot;Comments&quot;&gt;&lt;span class=&quot;Comments&quot;&gt;#&lt;/span&gt;include &amp;lt;QTextCodec&amp;gt;&lt;/span&gt;
...
int main(int argc, char &lt;span class=&quot;Operators&quot;&gt;*&lt;/span&gt;argv[])
{
    QApplication app(argc, argv);
    QTextCodec::setCodecForTr(QTextCodec::codecForName(&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;utf-8&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;));
              ...
}
тогда
{
    ...
    QPushButton &lt;span class=&quot;Operators&quot;&gt;*&lt;/span&gt;quit &lt;span class=&quot;Operators&quot;&gt;=&lt;/span&gt; new QPushButton(tr(&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;выход&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;));
    painter.drawText(&lt;span class=&quot;Numbers&quot;&gt;200&lt;/span&gt;, &lt;span class=&quot;Numbers&quot;&gt;200&lt;/span&gt;, tr(&lt;span class=&quot;Strings&quot;&gt;&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;привет&lt;span class=&quot;Strings&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;));
    ...
}
&lt;/pre&gt;

&lt;p&gt;Резалт:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://alexanders.in.ua/assets/2008/5/18/linux_windows_qt.png&quot; alt=&quot;QT кириллица в Windows и Linux&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Сильно не пинайтесь, пожалуйста :) Пожелания, предложения и [не]конструктивная критика принимается.&lt;/p&gt;
          </content>  </entry>
</feed>
