<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-782965157715811373</id><updated>2024-09-10T17:55:50.825+03:00</updated><category term="Windows"/><category term="Visual Studio"/><category term="Python"/><category term="FireBird"/><category term="Jabber"/><category term="Microsoft"/><category term="asm"/><category term="ИМХО"/><title type='text'>Lunar Designer</title><subtitle type='html'>Основной идеей этого журнала является выкладывание информации о моих &quot;изысканиях&quot;.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://lunardesigner.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/782965157715811373/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://lunardesigner.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Nathaniel</name><uri>http://www.blogger.com/profile/07511324146686122911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>7</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-782965157715811373.post-7876582858629204307</id><published>2012-02-12T03:03:00.005+04:00</published><updated>2012-02-12T03:38:02.022+04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="FireBird"/><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows"/><title type='text'>Как подружить Python 3 и Firebird а результат их дружбы выгрузить в таблицу.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&amp;nbsp; &amp;nbsp;Оказывается драйвер для взаимодействия с FireBird (&lt;a href=&quot;http://www.firebirdsql.org/en/python-driver/&quot; target=&quot;_blank&quot;&gt;KInterbasDB&lt;/a&gt;) доступен только для Python 2.x, так что будем использовать ODBC. Для этого качаем:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://sourceforge.net/projects/pywin32/&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;Python for Windows Extensions&lt;/span&gt;&lt;/b&gt;&lt;/a&gt;&amp;nbsp;– Python расширение для работы с COM, сервисами, буфером обмена и т.д.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.firebirdsql.org/en/odbc-driver/&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;Firebird ODBC Driver&lt;/span&gt;&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp;Результат работы скрипта будем писать в csv-файл с помощью &lt;a href=&quot;http://docs.python.org/py3k/library/csv.html?highlight=csv#module-csv&quot; target=&quot;_blank&quot;&gt;csv-модуля&lt;/a&gt;.&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp;Затем создаем файл конфигурации conf.ini&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; color: #222222; font-family: monospace; font-size: 14px; line-height: 25px; text-align: -webkit-auto;&quot;&gt;[base]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #222222; font-family: monospace; font-size: 14px; line-height: 25px; text-align: -webkit-auto;&quot;&gt;base=127.0.0.1:D:\BASE\BASE.FDB&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #222222; font-family: monospace; font-size: 14px; line-height: 25px; text-align: -webkit-auto;&quot;&gt;user=SYSDBA&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #222222; font-family: monospace; font-size: 14px; line-height: 25px; text-align: -webkit-auto;&quot;&gt;password=masterkey&lt;/span&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; color: #222222; font-family: monospace; font-size: 14px; line-height: 25px; text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Затем создаем сам скрипт, с таким содержанием:&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style=&quot;color: #ff7700;&quot;&gt;import&lt;/span&gt;&amp;nbsp;configparser&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #ff7700;&quot;&gt;import&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: crimson;&quot;&gt;os&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #ff7700;&quot;&gt;import&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: crimson;&quot;&gt;sys&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #ff7700;&quot;&gt;import&lt;/span&gt;&amp;nbsp;odbc&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #ff7700;&quot;&gt;import&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: crimson;&quot;&gt;csv&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: grey;&quot;&gt;#&amp;nbsp;---&amp;nbsp;читаем&amp;nbsp;настройки&amp;nbsp;---&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;ini_file&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: crimson;&quot;&gt;os&lt;/span&gt;.path.dirname(&lt;span style=&quot;color: crimson;&quot;&gt;sys&lt;/span&gt;.argv[&lt;span style=&quot;color: orangered;&quot;&gt;0&lt;/span&gt;])&lt;span style=&quot;color: #66cc66;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #ff7700;&quot;&gt;if&lt;/span&gt;&amp;nbsp;ini_file[-&lt;span style=&quot;color: orangered;&quot;&gt;1&lt;/span&gt;]&amp;nbsp;&lt;span style=&quot;color: #66cc66;&quot;&gt;!&lt;/span&gt;=&amp;nbsp;&lt;span style=&quot;color: crimson;&quot;&gt;os&lt;/span&gt;.sep:&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ini_file&amp;nbsp;=&amp;nbsp;ini_file&amp;nbsp;+&amp;nbsp;&lt;span style=&quot;color: crimson;&quot;&gt;os&lt;/span&gt;.sep&lt;/li&gt;
&lt;li&gt;ini_file&amp;nbsp;=&amp;nbsp;ini_file&amp;nbsp;+&amp;nbsp;&lt;span style=&quot;color: darkslateblue;&quot;&gt;&#39;conf.ini&#39;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #ff7700;&quot;&gt;print&lt;/span&gt;(&lt;span style=&quot;color: darkslateblue;&quot;&gt;&#39;Файл&amp;nbsp;кофигурации:&amp;nbsp;&#39;&lt;/span&gt;&amp;nbsp;+&amp;nbsp;ini_file)&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #ff7700;&quot;&gt;if&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff7700;&quot;&gt;not&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: crimson;&quot;&gt;os&lt;/span&gt;.path.exists(ini_file):&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff7700;&quot;&gt;print&lt;/span&gt;(&lt;span style=&quot;color: darkslateblue;&quot;&gt;&#39;!!!&amp;nbsp;Файл&amp;nbsp;конфигурации&amp;nbsp;не&amp;nbsp;найден.&#39;&lt;/span&gt;)&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: crimson;&quot;&gt;sys&lt;/span&gt;.exit(&lt;span style=&quot;color: orangered;&quot;&gt;0&lt;/span&gt;)&amp;nbsp; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #ff7700;&quot;&gt;try&lt;/span&gt;:&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;config&amp;nbsp;=&amp;nbsp;configparser.&lt;span style=&quot;color: crimson;&quot;&gt;ConfigParser&lt;/span&gt;()&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;config.read(ini_file)&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff7700;&quot;&gt;if&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff7700;&quot;&gt;not&lt;/span&gt;&amp;nbsp;config.has_section(&lt;span style=&quot;color: darkslateblue;&quot;&gt;&#39;base&#39;&lt;/span&gt;):&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff7700;&quot;&gt;print&lt;/span&gt;(&lt;span style=&quot;color: darkslateblue;&quot;&gt;&#39;В&amp;nbsp;ini&amp;nbsp;файле&amp;nbsp;не&amp;nbsp;обнаружена&amp;nbsp;секция&amp;nbsp;&quot;Base&quot;&#39;&lt;/span&gt;)&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: crimson;&quot;&gt;sys&lt;/span&gt;.exit(&lt;span style=&quot;color: orangered;&quot;&gt;0&lt;/span&gt;)&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;pBase&amp;nbsp;=&amp;nbsp;{}&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;list_key&amp;nbsp;=&amp;nbsp;config.options(&lt;span style=&quot;color: darkslateblue;&quot;&gt;&#39;base&#39;&lt;/span&gt;)&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff7700;&quot;&gt;for&lt;/span&gt;&amp;nbsp;key&amp;nbsp;&lt;span style=&quot;color: #ff7700;&quot;&gt;in&lt;/span&gt;&amp;nbsp;list_key:&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;pBase[key]&amp;nbsp;=config.get(&lt;span style=&quot;color: darkslateblue;&quot;&gt;&#39;base&#39;&lt;/span&gt;,key)&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #ff7700;&quot;&gt;except&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: green;&quot;&gt;Exception&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff7700;&quot;&gt;as&lt;/span&gt;&amp;nbsp;info:&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff7700;&quot;&gt;print&lt;/span&gt;(&lt;span style=&quot;color: darkslateblue;&quot;&gt;&#39;!!!&amp;nbsp;Ошибка&amp;nbsp;чтения&amp;nbsp;настроек:&amp;nbsp;&#39;&lt;/span&gt;&amp;nbsp;+&amp;nbsp;&lt;span style=&quot;color: green;&quot;&gt;str&lt;/span&gt;(info))&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: crimson;&quot;&gt;sys&lt;/span&gt;.exit(&lt;span style=&quot;color: orangered;&quot;&gt;0&lt;/span&gt;)&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: grey;&quot;&gt;#&amp;nbsp;---&amp;nbsp;работаем&amp;nbsp;с&amp;nbsp;базой&amp;nbsp;---&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;str_connect&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: darkslateblue;&quot;&gt;&quot;Driver=Firebird/InterBase(r)&amp;nbsp;driver;UID=%s;PWD=%s;DBNAME=%s;&quot;&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #66cc66;&quot;&gt;%&lt;/span&gt;&amp;nbsp;(pBase[&lt;span style=&quot;color: darkslateblue;&quot;&gt;&#39;user&#39;&lt;/span&gt;],pBase[&lt;span style=&quot;color: darkslateblue;&quot;&gt;&#39;password&#39;&lt;/span&gt;],pBase[&lt;span style=&quot;color: darkslateblue;&quot;&gt;&#39;base&#39;&lt;/span&gt;])&lt;span style=&quot;color: #66cc66;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #ff7700;&quot;&gt;print&lt;/span&gt;(str_connect)&lt;/li&gt;
&lt;li&gt;db&amp;nbsp;=&amp;nbsp;odbc.odbc(str_connect)&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;cursor&amp;nbsp;=&amp;nbsp;db.cursor()&lt;/li&gt;
&lt;li&gt;cursor.execute(&lt;span style=&quot;color: darkslateblue;&quot;&gt;&quot;select&amp;nbsp;*&amp;nbsp;from&amp;nbsp;AVTO_IN_TMP&quot;&lt;/span&gt;)&lt;/li&gt;
&lt;li&gt;result&amp;nbsp;=&amp;nbsp;cursor.fetchall()&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: grey;&quot;&gt;#&amp;nbsp;----&amp;nbsp;writing&amp;nbsp;results&amp;nbsp;----&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #ff7700;&quot;&gt;with&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: green;&quot;&gt;open&lt;/span&gt;(&lt;span style=&quot;color: darkslateblue;&quot;&gt;&#39;some.csv&#39;&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;color: darkslateblue;&quot;&gt;&#39;w+&#39;&lt;/span&gt;,&amp;nbsp;encoding=&lt;span style=&quot;color: darkslateblue;&quot;&gt;&#39;cp1251&#39;&lt;/span&gt;,&amp;nbsp;newline=&lt;span style=&quot;color: darkslateblue;&quot;&gt;&#39;&#39;&lt;/span&gt;)&amp;nbsp;&lt;span style=&quot;color: #ff7700;&quot;&gt;as&lt;/span&gt;&amp;nbsp;f:&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;writer=&lt;span style=&quot;color: crimson;&quot;&gt;csv&lt;/span&gt;.writer(f,&amp;nbsp;dialect=&lt;span style=&quot;color: crimson;&quot;&gt;csv&lt;/span&gt;.excel)&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;writer.writerows(result)&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;f.close()&lt;/li&gt;
&lt;li&gt;db.close()&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;
&amp;nbsp; &amp;nbsp; Всё оказывается очень просто;)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Идея&amp;nbsp;&lt;a href=&quot;http://borisnote.wordpress.com/2010/04/26/pythonodbcfirebird/&quot;&gt;http://borisnote.wordpress.com/2010/04/26/pythonodbcfirebird/&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lunardesigner.blogspot.com/feeds/7876582858629204307/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://lunardesigner.blogspot.com/2012/02/python-3-firebird.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/782965157715811373/posts/default/7876582858629204307'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/782965157715811373/posts/default/7876582858629204307'/><link rel='alternate' type='text/html' href='http://lunardesigner.blogspot.com/2012/02/python-3-firebird.html' title='Как подружить Python 3 и Firebird а результат их дружбы выгрузить в таблицу.'/><author><name>Nathaniel</name><uri>http://www.blogger.com/profile/07511324146686122911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-782965157715811373.post-1273002500788201430</id><published>2011-12-18T13:20:00.002+04:00</published><updated>2011-12-18T13:24:02.796+04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft"/><category scheme="http://www.blogger.com/atom/ns#" term="Visual Studio"/><category scheme="http://www.blogger.com/atom/ns#" term="ИМХО"/><title type='text'>Трёп</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&amp;nbsp; &amp;nbsp;Что ж когда работа отнимает все время это не гуд))&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;А вообще заметил что MS не использует&amp;nbsp;MFC&amp;nbsp;в Office, собственно как и в большей части стандартных приложений виндовс за исключением WordPad, там используется MFC 4.2 (времен моего дедушки). При этом рассматривал &amp;nbsp;2к3, 2к7, 2к10.&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Из этого следует, что не стоит, не имея большого желания, использовать MFC в своих проектах.&lt;br /&gt;
&lt;br /&gt;
UPD: потыкал MS VS 2011 developer preview, что-то сыроват еще или у меня так глючил, но работать не возможно!&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lunardesigner.blogspot.com/feeds/1273002500788201430/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://lunardesigner.blogspot.com/2011/12/blog-post.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/782965157715811373/posts/default/1273002500788201430'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/782965157715811373/posts/default/1273002500788201430'/><link rel='alternate' type='text/html' href='http://lunardesigner.blogspot.com/2011/12/blog-post.html' title='Трёп'/><author><name>Nathaniel</name><uri>http://www.blogger.com/profile/07511324146686122911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-782965157715811373.post-5430354932754107869</id><published>2011-06-17T11:30:00.002+04:00</published><updated>2011-09-29T15:42:58.330+04:00</updated><title type='text'>О расцвечивании исходников</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&amp;nbsp; &amp;nbsp;Выложил вчера исходники и понял - чего-то не хватает, а не хватает подсветки кода! Решать проблему буду с помощью полюбившегося &quot;Питона&quot;.&lt;br /&gt;
&lt;br /&gt;
Продолжение следует...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Update on 29-09-11&lt;br /&gt;
Жаль не было времени писать((&lt;br /&gt;
Правда полностью отпала идея писать&amp;nbsp;highlighter, так что решил пользоваться&amp;nbsp;&lt;a href=&quot;http://quickhighlighter.com/&quot;&gt;http://quickhighlighter.com/&lt;/a&gt;, но у него нет поддержки&amp;nbsp;кириллических символов, так что иногда использую&amp;nbsp;&lt;a href=&quot;http://highlight.hohli.com/&quot;&gt;http://highlight.hohli.com/&lt;/a&gt;.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lunardesigner.blogspot.com/feeds/5430354932754107869/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://lunardesigner.blogspot.com/2011/06/blog-post_17.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/782965157715811373/posts/default/5430354932754107869'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/782965157715811373/posts/default/5430354932754107869'/><link rel='alternate' type='text/html' href='http://lunardesigner.blogspot.com/2011/06/blog-post_17.html' title='О расцвечивании исходников'/><author><name>Nathaniel</name><uri>http://www.blogger.com/profile/07511324146686122911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-782965157715811373.post-832169470501356705</id><published>2011-06-16T11:17:00.002+04:00</published><updated>2012-02-12T03:06:39.729+04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Jabber"/><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><title type='text'>Бот для админа</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&amp;nbsp; &amp;nbsp;С наступлением лета пришла пора выездов на природу, дачу, отдых и т.д.&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Встала проблемам как же управлять сервером или другим удаленным компьютером находясь в отрыве от цивилизации ;)&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Для решения этой проблемы я решил создать Jabber-бота на прекрасном языке Python. Для упрощения написания использую библиотеку &lt;a href=&quot;http://xmpppy.sourceforge.net/&quot;&gt;XMPPPY&lt;/a&gt; В процессе понял, что хочется добавить еще некоторый функционал, в следствии чего реализовал систему плагинов для легкой расширяемости ;)&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Самая интересная часть - реализация поддержки плагинов&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #f0f0f0; font-style: normal;&quot;&gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;ol&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;
&lt;li style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
def loadPlugins&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;:&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp;import os&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp;commands&amp;nbsp;&lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #009900;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;]&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp;public_commands&amp;nbsp;&lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #009900;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;]&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;color: #006060; font-weight: bold; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #b1b100;&quot;&gt;for&lt;/span&gt;&amp;nbsp;fname in os&lt;span style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt;listdir&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&#39;plugins/&#39;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;:&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&amp;nbsp;fname&lt;span style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt;endswith&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&#39;.py&#39;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;:&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; plugin_name&amp;nbsp;&lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;&amp;nbsp;fname&lt;span style=&quot;color: #009900;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;:-&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;]&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&amp;nbsp;plugin_name&amp;nbsp;&lt;span style=&quot;color: #339933;&quot;&gt;!=&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;&#39;__init__&#39;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;:&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; plugins&amp;nbsp;&lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;&amp;nbsp;__import__&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&#39;plugins.&#39;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;plugin_name&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;color: #006060; font-weight: bold; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; plugin&amp;nbsp;&lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;&amp;nbsp;getattr&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;plugins&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt;plugin_name&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&amp;nbsp;plugin&lt;span style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt;init&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;:&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; commands&lt;span style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt;append&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;plugin_name&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #b1b100;&quot;&gt;else&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;:&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public_commands&lt;span style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt;append&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;plugin_name&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;font-weight: bold; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #000020;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #000020;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&#39;plugins&#39;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #000020;&quot;&gt;plugins&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&#39;commands&#39;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #000020;&quot;&gt;commands&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&#39;public_commands&#39;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #000020;&quot;&gt;public_commands&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/span&gt;&lt;/i&gt;&lt;/ol&gt;
&lt;br /&gt;
&lt;br /&gt;
Для примера приведу реализацию плагина-переводчика.&lt;br /&gt;
&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #f0f0f0; color: #000066; font-family: monospace; font-style: normal;&quot;&gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;ol&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;
&lt;li class=&quot;li1&quot; style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de1&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
import urllib&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot; style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de1&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
import json&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot; style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de1&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
import string&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt;&amp;nbsp;re&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot; style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de1&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
import xmpp&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li2&quot; style=&quot;color: #006060; font-weight: bold; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de2&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot; style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de1&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
def init&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;:&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot; style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de1&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;nu0&quot; style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot; style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de1&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot; style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de1&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
def run&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;bot&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt;mess&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;:&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li2&quot; style=&quot;color: #006060; font-weight: bold; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de2&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp;text&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;&amp;nbsp;mess&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt;getBody&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot; style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de1&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp;user&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;&amp;nbsp;mess&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt;getFrom&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot; style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de1&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp;langpair&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;st_h&quot; style=&quot;color: blue;&quot;&gt;&#39;en|ru&#39;&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;co2&quot; style=&quot;color: #666666; font-style: italic;&quot;&gt;#PEREDELAT&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot; style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de1&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot; style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de1&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&amp;nbsp;text&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;:&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li2&quot; style=&quot;color: #006060; font-weight: bold; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de2&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; lines&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;&amp;nbsp;text&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt;splitlines&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot; style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de1&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot; style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de1&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot; style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de1&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; regexp&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;&amp;nbsp;re&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt;compile&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;st_h&quot; style=&quot;color: blue;&quot;&gt;&#39;^\w{2}\|\w{2}$&#39;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt;&amp;nbsp;re&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt;IGNORECASE&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot; style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de1&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&amp;nbsp;regexp&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt;match&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;lines&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;:&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li2&quot; style=&quot;color: #006060; font-weight: bold; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de2&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;langpair&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;&amp;nbsp;lines&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;]&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot; style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de1&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;del lines&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;]&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot; style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de1&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot; style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de1&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; text&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;&amp;nbsp;string&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt;&lt;a href=&quot;http://www.php.net/join&quot; style=&quot;color: #000060;&quot;&gt;&lt;span class=&quot;kw3&quot; style=&quot;color: #990000;&quot;&gt;join&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;lines&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot; style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de1&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; reply&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;&amp;nbsp;translate&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;text&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt;&amp;nbsp;langpair&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li2&quot; style=&quot;color: #006060; font-weight: bold; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de2&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; bot&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt;send&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;xmpp&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt;Message&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;mess&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt;getFrom&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt;reply&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot; style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de1&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot; style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de1&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot; style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de1&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
def translate&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;text&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt;&amp;nbsp;langpair&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;:&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot; style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de1&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp;query&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;&amp;nbsp;urllib&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt;&lt;a href=&quot;http://www.php.net/urlencode&quot; style=&quot;color: #000060;&quot;&gt;&lt;span class=&quot;kw3&quot; style=&quot;color: #990000;&quot;&gt;urlencode&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;st_h&quot; style=&quot;color: blue;&quot;&gt;&#39;q&#39;&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;:&lt;/span&gt;&amp;nbsp;text&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt;encode&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;st0&quot; style=&quot;color: blue;&quot;&gt;&quot;utf-8&quot;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;st_h&quot; style=&quot;color: blue;&quot;&gt;&#39;langpair&#39;&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;:&lt;/span&gt;&amp;nbsp;langpair&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li2&quot; style=&quot;color: #006060; font-weight: bold; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de2&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp;url&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;&amp;nbsp;u&lt;span class=&quot;st_h&quot; style=&quot;color: blue;&quot;&gt;&#39;http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&amp;amp;%s&#39;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt;encode&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;st0&quot; style=&quot;color: blue;&quot;&gt;&quot;utf-8&quot;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;%&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;query&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot; style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de1&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot; style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de1&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp;result&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;&amp;nbsp;urllib&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt;urlopen&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;url&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot; style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de1&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;response&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;&amp;nbsp;json&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt;loads&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;result&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt;read&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot; style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de1&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&amp;nbsp;response&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;st_h&quot; style=&quot;color: blue;&quot;&gt;&#39;responseStatus&#39;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;]&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;!=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;nu0&quot; style=&quot;color: #cc66cc;&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;:&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li2&quot; style=&quot;color: #006060; font-weight: bold; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de2&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; mess&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;&amp;nbsp;response&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;st_h&quot; style=&quot;color: blue;&quot;&gt;&#39;responseDetails&#39;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;]&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot; style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de1&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #b1b100;&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;:&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot; style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de1&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; mess&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;&amp;nbsp;response&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;st_h&quot; style=&quot;color: blue;&quot;&gt;&#39;responseData&#39;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;st_h&quot; style=&quot;color: blue;&quot;&gt;&#39;translatedText&#39;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;]&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot; style=&quot;color: #003030; font: normal normal normal 130%/normal &#39;Courier New&#39;, Courier, monospace; vertical-align: top;&quot;&gt;&lt;div class=&quot;de1&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; color: #000020; font: normal normal normal 1em/1.2em monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: top;&quot;&gt;
&amp;nbsp; &amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt;&amp;nbsp;mess&lt;/div&gt;
&lt;/li&gt;
&lt;/span&gt;&lt;/i&gt;&lt;/ol&gt;
&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;br /&gt;
Остальные плагины не столь интересны. Реализация бота довольно стандартна, так что примеры без труда можно найти с помощью &lt;a href=&quot;http://www.google.com/&quot;&gt;Великого и Ужасного&lt;/a&gt;.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lunardesigner.blogspot.com/feeds/832169470501356705/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://lunardesigner.blogspot.com/2011/06/blog-post_16.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/782965157715811373/posts/default/832169470501356705'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/782965157715811373/posts/default/832169470501356705'/><link rel='alternate' type='text/html' href='http://lunardesigner.blogspot.com/2011/06/blog-post_16.html' title='Бот для админа'/><author><name>Nathaniel</name><uri>http://www.blogger.com/profile/07511324146686122911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-782965157715811373.post-8799366610449484191</id><published>2011-06-08T11:17:00.001+04:00</published><updated>2012-02-12T03:07:40.167+04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Visual Studio"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows"/><title type='text'>Options compilations for optimizations for VC 10</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b&gt;&lt;i&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;b&gt;&lt;i&gt;/arch&lt;/i&gt;&lt;/b&gt; - enable SSE and SSE2&lt;br /&gt;
&lt;b&gt;&lt;i&gt;/GL&lt;/i&gt;&lt;/b&gt; - include optimization of the entire program&lt;br /&gt;
&lt;b&gt;&lt;i&gt;/O1&lt;/i&gt;&lt;/b&gt; - Reduces code size.&lt;br /&gt;
&lt;b&gt;&lt;i&gt;/O2&lt;/i&gt;&lt;/b&gt; - Creates fast code.&lt;br /&gt;
&lt;b&gt;&lt;i&gt;/Og&lt;/i&gt;&lt;/b&gt; - Uses a global optimization.&lt;br /&gt;
&lt;b&gt;&lt;i&gt;/Os&lt;/i&gt;&lt;/b&gt; - Gives priority to reduce code size. &lt;br /&gt;
&lt;b&gt;&lt;i&gt;/Ox&lt;/i&gt;&lt;/b&gt; - Uses maximum optimization (for speed)&lt;br /&gt;
Задание параметра компилятора /Ox дает тот же результат, что и использование следующих параметров.&lt;br /&gt;
Параметр /Ob (расширение встроенных функций), где параметр варианта равен 2 (/Ob2)&lt;br /&gt;
&lt;b&gt;&lt;i&gt;/Og&lt;/i&gt;&lt;/b&gt; (Виды глобальной оптимизации)&lt;br /&gt;
&lt;b&gt;&lt;i&gt;/Oi&lt;/i&gt;&lt;/b&gt; (создание встроенных функций)&lt;br /&gt;
&lt;b&gt;&lt;i&gt;/Ot&lt;/i&gt;&lt;/b&gt; (приоритет скорости выполнения кода)&lt;br /&gt;
&lt;b&gt;&lt;i&gt;/Oy&lt;/i&gt;&lt;/b&gt; (подавление указателей фрейма)&lt;br /&gt;
Параметр /Ox несовместим со следующими параметрами:&lt;br /&gt;
&lt;b&gt;&lt;i&gt;/O1&lt;/i&gt;&lt;/b&gt; (минимизировать размер)&lt;br /&gt;
&lt;b&gt;&lt;i&gt;/O2&lt;/i&gt;&lt;/b&gt; (максимизировать скорость)&lt;br /&gt;
&lt;b&gt;&lt;i&gt;/Od&lt;/i&gt;&lt;/b&gt; (Выключение (отладчика))&lt;br /&gt;
Параметр компилятора /Ox также включает оптимизацию именованных возвращаемых значений, после чего для стековых возвращаемых значений не используются конструкторы копирования и деструкторы. Дополнительные сведения см. в разделе /O1, &lt;b&gt;&lt;i&gt;/O2&lt;/i&gt;&lt;/b&gt; (минимизировать размер, максимизировать скорость).&lt;br /&gt;
Можно отменить параметр компилятора /Ox, если задать параметр /Oxs, который сочетает параметр компилятора&lt;br /&gt;
&lt;b&gt;&lt;i&gt;/Ox с /Os&lt;/i&gt;&lt;/b&gt; (приоритет небольшому размеру кода). Объединенные параметры отдают приоритет меньшему размеру &lt;br /&gt;
кода.Как правило, следует задавать параметр /O2 (максимизировать скорость) вместо /Ox и /O1 &lt;br /&gt;
(минимизировать размер) вместо /Oxs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Программирование без RTL&lt;/b&gt;&lt;br /&gt;
По умолчанию си-программы собираются вместе с библиотекой времени исполнения (она же RTL), которая занимает много &lt;br /&gt;
килобайт и обеспечивает работу функций типа spritnf. Но ведь Windows NT уже включает в себя RTL, реализованную в NTDLL.&lt;br /&gt;
DLL, так зачем же нам еще одна?чтобы собрать программу без RTL, достаточно назвать главную &lt;br /&gt;
функцию не main, а как-нибудь иначе, например _start. умные линкеры сами поймут, что это — точка входа. глупым (к которым, &lt;br /&gt;
в частности, относится MS LINKER) потребуется указать точку входа явно:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;cl.exe /c file_name.c /Ox&lt;br /&gt;
link.exe file_name.obj /ENTRY:start /SUBSYSTEM:WINDOWS USER32.lib&lt;br /&gt;
&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
Сравнивая размеры программы с RTL и без нее, мы практически не обнаружим разницы в размерах, поскольку минимальная кратность выравнивания в 9x составляет 4 кб, она же используется линкером по умолчанию. В NT минимальная кратность составляет всего 16 байт, но линкер отказывается собирать такой файл, пока мы не притворимся, что &lt;br /&gt;
собираем драйвер:&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;link.exe file_name .obj /ENTRY:start USER32.lib /DRIVER /ALIGN:16&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
На этом примере, при компиляции MS VC 6 с RTL размер исполняемого файла составляет 24,576 кб, без RTL — 16,384 кб и, наконец, без RTL с минимальным выравниванием — 816 байт. как говорится, почувствуй разницу!&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lunardesigner.blogspot.com/feeds/8799366610449484191/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://lunardesigner.blogspot.com/2011/06/options-compilations-for-optimizations.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/782965157715811373/posts/default/8799366610449484191'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/782965157715811373/posts/default/8799366610449484191'/><link rel='alternate' type='text/html' href='http://lunardesigner.blogspot.com/2011/06/options-compilations-for-optimizations.html' title='Options compilations for optimizations for VC 10'/><author><name>Nathaniel</name><uri>http://www.blogger.com/profile/07511324146686122911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-782965157715811373.post-399420123499138298</id><published>2011-06-08T11:15:00.002+04:00</published><updated>2012-02-12T03:08:13.936+04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="asm"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows"/><title type='text'>SEH &amp; VEH in win 7</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&amp;nbsp; &amp;nbsp;Решил продолжить исследования работоспособности антиотладочных приемов на платформе Windows 7.&lt;br /&gt;
&amp;nbsp; &amp;nbsp;В своих исследованиях я как всегда буду опираться на статьи Криса Касперского, в данном случае &lt;a href=&quot;http://www.xakep.ru/magazine/xa/114/062/1.asp&quot;&gt;&quot;Трассировка — в погоне на TF или SEH на виражах&quot;&lt;/a&gt;&amp;nbsp;и &lt;a href=&quot;http://www.xakep.ru/magazine/xa/120/056/1.asp&quot;&gt;&quot;cкрытая установка SEH-обработчиков&quot;&lt;/a&gt;&amp;nbsp;из&amp;nbsp;небезызвестного &lt;a href=&quot;http://www.xakep.ru/&quot;&gt;журнала&lt;/a&gt;, а так же на цикл статей Мэтта Питрека &lt;a href=&quot;http://www.wasm.ru/article.php?article=Win32SEHPietrek1&quot;&gt;&quot;Win32™ SEH изнутри&quot;&lt;/a&gt;&amp;nbsp;и &lt;a href=&quot;http://www.wasm.ru/article.php?article=veh&quot;&gt;&quot;Новая векторная обработка исключений в Windows XP&quot;&lt;/a&gt;&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Начнем с &lt;a href=&quot;http://ru.wikipedia.org/wiki/%D0%A1%D1%82%D1%80%D1%83%D0%BA%D1%82%D1%83%D1%80%D0%BD%D0%B0%D1%8F_%D0%BE%D0%B1%D1%80%D0%B0%D0%B1%D0%BE%D1%82%D0%BA%D0%B0_%D0%B8%D1%81%D0%BA%D0%BB%D1%8E%D1%87%D0%B5%D0%BD%D0%B8%D0%B9&quot;&gt;SEH&lt;/a&gt; (structured exceptions handling). Начиная с висты в виндовс используется технология &lt;a href=&quot;http://msdn.microsoft.com/ru-ru/library/9a89h429.aspx&quot;&gt;S&lt;/a&gt;&lt;i&gt;&lt;a href=&quot;http://msdn.microsoft.com/ru-ru/library/9a89h429.aspx&quot;&gt;afeSEH&lt;/a&gt;, &lt;/i&gt;обеспечивающая защиту от подмены SEH обработчика. Раньше&amp;nbsp;указатели на обработчики структурных исключений хранились в стеке, беспрепятственно доступном на запись/чтение, то теперь они переместились в специальные секции PE-файла, доступные только на чтение и формируемые статическим образом еще на этапе сборки программы при активном участии со стороны линкера и компилятора. Поэтому при использовании установки обработчика таким образом:&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #f0f0f0; color: #000066;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #00007f; font-weight: bold;&quot;&gt;mov&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw3&quot; style=&quot;color: #00007f;&quot;&gt;ecx&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw3&quot; style=&quot;color: #00007f;&quot;&gt;fs&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900; font-weight: bold;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: blue;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900; font-weight: bold;&quot;&gt;]&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;co1&quot; style=&quot;color: #666666; font-style: italic;&quot;&gt;; // save old SEH handler&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: #00007f; font-weight: bold;&quot;&gt;mov&lt;/span&gt;&amp;nbsp;old_seh&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw3&quot; style=&quot;color: #00007f;&quot;&gt;ecx&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: #00007f; font-weight: bold;&quot;&gt;push&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: blue;&quot;&gt;1&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;co1&quot; style=&quot;color: #666666; font-style: italic;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: #00007f; font-weight: bold;&quot;&gt;push&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw4&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;offset&lt;/span&gt;&amp;nbsp;main_handler&amp;nbsp;&lt;span class=&quot;co1&quot; style=&quot;color: #666666; font-style: italic;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: #00007f; font-weight: bold;&quot;&gt;mov&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw3&quot; style=&quot;color: #00007f;&quot;&gt;fs&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900; font-weight: bold;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: blue;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900; font-weight: bold;&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw3&quot; style=&quot;color: #00007f;&quot;&gt;esp&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;co1&quot; style=&quot;color: #666666; font-style: italic;&quot;&gt;; // set-up our SEH handler chain&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Нужно указывать линкеру /SAFESEH:NO, для того чтобы он не создавал таблицу обработчиков. Конечно лучше использовать явную инициализацию обработчика:&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #f0f0f0; color: #000066; font-style: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw4&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;386&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;kw4&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;.model&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw5&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;flat&lt;/span&gt;&lt;br /&gt;
MyHandler&amp;nbsp;&lt;span class=&quot;kw4&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;proto&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt;safeseh MyHandler&lt;br /&gt;
&lt;span class=&quot;kw4&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Теперь поговорим о VEH(vectored exception handling).&amp;nbsp;SEH и VEH очень схожи. Они предоставляют аналогичные возможности и вся разница между ними в том, что вместо ручного манипулирования со списками обработчиков теперь у нас есть API-функции AddVectoredExceptionHandler/RemoveVectoredExceptionHandler, устанавливающие/удаляющие векторные обработчики из списка, указатель на который хранится в неэкспортируемой переменной _RtlpCalloutEntryList внутри NTDLL.DLL (по одному экземпляру на каждый процесс). Плюс, упростилось написание локальных/глобальных обработчиков исключений, что в случае с SEH – большая проблема. А&amp;nbsp;OllyDBG2.0 все также палится по флагу трассировки, если его чтение происходит в обработчике исключений((.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lunardesigner.blogspot.com/feeds/399420123499138298/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://lunardesigner.blogspot.com/2011/06/seh-veh-in-win-7.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/782965157715811373/posts/default/399420123499138298'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/782965157715811373/posts/default/399420123499138298'/><link rel='alternate' type='text/html' href='http://lunardesigner.blogspot.com/2011/06/seh-veh-in-win-7.html' title='SEH &amp; VEH in win 7'/><author><name>Nathaniel</name><uri>http://www.blogger.com/profile/07511324146686122911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-782965157715811373.post-4800296354660419693</id><published>2011-06-08T11:13:00.001+04:00</published><updated>2012-02-12T03:11:42.738+04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Visual Studio"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows"/><title type='text'>&quot;Трассировка и как её избежать&quot; -&gt; особенности сборки приложений компилятором VC 10.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&amp;nbsp; &amp;nbsp;Что такое трассировка и с чем её едят Вы можете узнать и из &lt;a href=&quot;http://google.com/&quot;&gt;великого_и_ужасного&lt;/a&gt;. Основой для моих изысканий была статья Криса Касперского &lt;a href=&quot;http://www.xakep.ru/magazine/xa/112/080/1.asp&quot;&gt;&quot;Трассировка или игры в прятки&quot;&lt;/a&gt;&amp;nbsp;в журнале &lt;a href=&quot;http://www.xakep.ru/&quot;&gt;&quot;Хакер&quot;&lt;/a&gt;. Все описываемые в статье техники отслеживания трассировки прекрасно работают на Windows 7. В ходе тестирования примеры для Win 7 пришлось пересобирать, т.к. собранные для Win XP, не запускались(( Опции сборки для всех примеров одинаковы.&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Первоначальные ключи компилятора:&amp;nbsp;&lt;i&gt;/c /Ox  /Os /G6&lt;/i&gt;.&amp;nbsp;Начнем с того что новый компилятор не поддерживает ключи /G{3|4|5|6|7|8},&amp;nbsp;поддерживаются&amp;nbsp;только ключи /G{1|2} для платформы Itanium 1|2. Больше вопросов у компилятора не возникло. (Опции компиляции в итоге:&amp;nbsp;&lt;i&gt;/c /Ox /O.&lt;/i&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Перейдем к линкеру. Изначальные опции линкования:&lt;i&gt; /ALIGN:16 /DRIVER /FIXED /SUBSYSTEM:CONSOLE KERNEL32.LIB USER32.lib. &lt;/i&gt;При попытке сборки линкер наконец начал собирать драйвер, а не обыкновенный PE (см. ключ /DRIVER). Убираем это ключ. Линкер выдает &quot;Warning LNK4108 : параметр /ALIGN указан без параметра /DRIVER; образ нельзя запустить&quot;. При этом пример собирается и нормально запускается. Вот такие чудеса;)&lt;br /&gt;
&amp;nbsp; &amp;nbsp;В ходе экспериментов замечено, что OllyDBG2.0 на &lt;i&gt;PUSHFD &lt;/i&gt;&amp;nbsp;в любом виде не ведется, что конечно не может не радовать!&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lunardesigner.blogspot.com/feeds/4800296354660419693/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://lunardesigner.blogspot.com/2011/06/vc-10.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/782965157715811373/posts/default/4800296354660419693'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/782965157715811373/posts/default/4800296354660419693'/><link rel='alternate' type='text/html' href='http://lunardesigner.blogspot.com/2011/06/vc-10.html' title='&quot;Трассировка и как её избежать&quot; -&gt; особенности сборки приложений компилятором VC 10.'/><author><name>Nathaniel</name><uri>http://www.blogger.com/profile/07511324146686122911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>