1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | <% if User.current.logged? || !Setting.login_required? % > <div> <h3>Контакты</h3> <% if User.current.admin? %> <table> <%User.find( :all ). each do |user|%> <% if user.active? %> <tr> <td style= "text-align: left;" > <a href= "#<%=user.id%>" ><%=user.firstname%> <%=user.lastname%></a> </td> <td style= "text-align: left;" > <a href= "mailto:<%=user.mail%>" ><%=user.mail%></a> </td> </tr> <% end %> <% end %> </table> <% end %> </div> <% end %> |
четверг, 26 декабря 2013 г.
redmine контакты сотрудников на домашней странице
вторник, 24 декабря 2013 г.
var_dump для redmine и rails
1 2 3 | <% if User.current.logged? || !Setting.login_required? %> <%=User.current.to_json%> <% end %> |
1 2 3 | <% if User.current.logged? || !Setting.login_required? %> <%=debug n%> <% end %> |
Нужно выполнять в папке с приложением (возможно предварительно придется сделать /bin/bash --login)
$rails console --sandbox
Можно получить всех пользователей выполнив u = User.find(:all)
u.each{ |user| puts user.id}
(Прокрутите консоль вверх чтобы увидеть результат.) выход ctrl + D все транзакции откатятся.
я нахожусь в начале пути по изучению rails (надеюсь и переходу) по этому попрошу гуру меня сильно не пинать.
поле быстрого перехода по задачам в redmine
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | <% if User.current.logged? || !Setting.login_required? %> <div> <form id= "go_issues" action= "/issues/" > <script> $( function (){ $( "#issues_go" ).click( function (){ document.location.href = $( "#issues_base_url" ).attr( "value" ) + $( "#issues_numer" ).attr( "value" ); return false }); $( "#go_issues" ).submit( function (){ document.location.href = $( "#issues_base_url" ).attr( "value" ) + $( "#issues_numer" ).attr( "value" ); return false }); }); </script> <input style= "height: 10px;" type= "hidden" id= "issues_base_url" name= "issues_base_url" value= "/issues/" > <input style= "height: 10px;" type= "text" id= "issues_numer" name= "issues_numer" value= "" /> <!-- <input style= "height: 10px;" type= "button" id= "issues_go" value= "Перейти" /> --> </form> </div> <% end %> |
понедельник, 9 декабря 2013 г.
ubuntu skype шипит
найдите строку 'load-module module-udev-detect'
и замените ее на 'load-module module-udev-detect tsched=0'
*везде без кавычек.
четверг, 21 ноября 2013 г.
создаем раскрывающиеся списки проектов в redmine
vim app/views/projects/index.html.erb
вставляем туда следующий javascript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | < script type = "text/javascript" > $(function(){ $("#projects-index ul li .projects").hide();//скрываем подпроекты $("#projects-index ul").find("li.root").each(function(){ if($(this).find(".projects").size() > 0){ $(this).find("div.root").append('< a class = "show_hide" href = "#" > открыть/закрыть </ a >') } }); $(".show_hide").live("click", function(){ $(this).parent().parent().find(".projects").toggle(); return false; }); }); </ script > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | <% content_for :header_tags do %> <%= auto_discovery_link_tag( :atom , { :action => 'index' , :format => 'atom' , :key => User.current.rss_key}) %> <% end %> <div class = "contextual" > <%= link_to(l( :label_project_new ), { :controller => 'projects' , :action => 'new' }, :class => 'icon icon-add' ) + ' |' if User.current.allowed_to?( :add_project , nil , :global => true ) %> <%= link_to(l( :label_issue_view_all ), issues_path) + ' |' if User.current.allowed_to?( :view_issues , nil , :global => true ) %> <%= link_to(l( :label_overall_spent_time ), time_entries_path) + ' |' if User.current.allowed_to?( :view_time_entries , nil , :global => true ) %> <%= link_to l( :label_overall_activity ), { :controller => 'activities' , :action => 'index' , :id => nil } %> </div> <h2><%= l( :label_project_plural ) %></h2> <script type= "text/javascript" > $(function(){ $( "#projects-index ul li .projects" ).hide();//скрываем подпроекты $( "#projects-index ul" ).find( "li.root" ). each (function(){ if ($(this).find( ".projects" ).size() > 0 ){ $(this).find( "div.root" ).append( '<a class="show_hide" href="#"> открыть/закрыть </a>' ) } }); $( ".show_hide" ).live( "click" , function(){ $(this).parent().parent().find( ".projects" ).toggle(); return false ; }); }); </script> <div id= "projects-index" > <%= render_project_hierarchy( @projects ) %> </div> <% if User.current.logged? %> <p style= "text-align:right;" > <span class = "my-project" ><%= l( :label_my_projects ) %></span> </p> <% end %> <% other_formats_links do |f| %> <%= f.link_to 'Atom' , :url => { :key => User.current.rss_key} %> <% end %> <% content_for :sidebar do %> <%= form_tag({}, :method => :get ) do %> <h3><%= l( :label_project_plural ) %></h3> <label for = "closed" ><%= check_box_tag 'closed' , 1 , params[ :closed ] %> <%= l( :label_show_closed_projects ) %></label> <p><%= submit_tag l( :button_apply ), :class => 'button-small' , :name => nil %></p> <% end %> <% end %> <% html_title(l( :label_project_plural )) -%> |
понедельник, 18 ноября 2013 г.
Определение главной страницы битрикс
1 2 3 4 5 | <? if ( $APPLICATION ->GetCurPage()==SITE_DIR):?> главная <? else :?> не главная <? endif ?> |
четверг, 31 октября 2013 г.
создание конвертирование электронных книг в в ubuntu
я для себя нашел следующий выход во первых для чтения на компе и конвертации calibre
(установить sudo apt-get install calibre)
для преобразования веб страниц
сервис http://readlists.com/ (можно скачать например это http://readlists.com/1b39c067/)
пятница, 18 октября 2013 г.
сделать обязательным поле назначена в redmine
{redmine}/app/models/issue.rb
поправить строчку (67)
validates_presence_of :subject, :priority, :project, :tracker, :author, :status
на
validates_presence_of :subject, :priority, :project, :tracker, :author, :status, :assigned_to
и в
redmine/app/views/issues/_attributes.html.erb
(18)
<p><%= f.select :assigned_to_id, principals_options_for_select(@issue.assignable_users, @issue.assigned_to), :include_blank => true, :required => @issue.required_attribute?('assigned_to_id') %></p>
на
<p><%= f.select :assigned_to_id, principals_options_for_select(@issue.assignable_users, @issue.assigned_to), :include_blank => true, :required => true %></p>
среда, 16 октября 2013 г.
icq в ubuntu
четверг, 10 октября 2013 г.
Получение списка файлов на ruby
1 2 3 | Dir .open( '.' ). each do |file| puts file if file.split( "." ).pop == 'png' end |
среда, 25 сентября 2013 г.
среда, 21 августа 2013 г.
изменить количество задач в redmine в виджетах на главной
в которой правим файлы
_issuesassignedtome.html.erb _issuesreportedbyme.html.erb
1 2 3 4 5 | <% reported_issues = Issue.visible.find( :all , :conditions => { :author_id => User.current.id }, :limit => 10 , :include => [ :status , :project , :tracker ], :order => "#{Issue.table_name}.updated_on DESC" ) %> |
среда, 31 июля 2013 г.
совершенный парсинг сайтов
бывает не достаточно.
итак
- нужно чтобы код можно было выполнять на удаленном сервере (варианты с плагинами для браузеров отпадают)
- получать и хранить куки
- необходимо выполнять js в полном объеме и получать DOM измененный js (речь идет о парсинге ajax сайтов)
- получать скриншоты страниц
и т.д. и т.п.
понятно что идеальным выбором будет браузер
поэтому внимательно смотрим на phantomjs(http://phantomjs.org/) и его документацию на github
(https://github.com/ariya/phantomjs/wiki)
запихиваем бинарник (на ubuntu) в /bin даем нужные права
создаем js файл с инструкциями для phantomjs а дальше можно расстраивать архитектуру как хочешь например использовать очереди для передачи асинхронных задач phantomjs
четверг, 25 июля 2013 г.
[alias] для git
1 2 3 4 5 6 7 8 9 | [alias] hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph -- date =short co = checkout ci = commit st = status br = branch hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph -- date =short type = cat-file -t dump = cat-file -p |
суббота, 20 июля 2013 г.
начинаем изучать и использовать HTML с нуля за полчаса (или язык разметки для оптимизаторов)
понедельник, 15 июля 2013 г.
ставим и прокачиваем zsh(супер консоль) в ubuntu
sudo apt-get install zsh
затем я делаю клон репозитория oh-my-zsh (git должен стоять sudo apt-get install git)
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
хотя на гит хабе можете посмотреть и другие варианты
cd ~/.oh-my-zsh/
chmod u+x ./oh-my-zsh.sh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
chsh -s /bin/zsh
стартуем zsh
указать apache права создаваемых файлов
открываем
vim /etc/apache2/envvars
и вставляем строчку
umask 000
четверг, 27 июня 2013 г.
установка прав по умолчанию linux для файлов и директорий
unmask #без параметров узнать текущее значение
unmask 000 #установить для вновь создаваемых каталогов права 777 а для файлов 666
(в восьмеричной системе отнимаем 777 - 000)
смена цвета подсказок placeholder css
input::-webkit-input-placeholder {
color: #222;
}
textarea::-webkit-input-placeholder {
color: #222;
}
input::-moz-placeholder {
color: #222;
opacity: 1;
}
textarea::-moz-placeholder {
color: #222;
opacity: 1;
}
суббота, 15 июня 2013 г.
некоторые настройки django
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
установка mongodb в ubuntu
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10затем добавляем репозиторий в /etc/apt/sources.list
sudo vim /etc/apt/sources.listвносим эту строку в конец файла
deb http://downloads-distro.mongodb.org/repo/debian-sysvinit dist 10gen
sudo apt-get updateи устанавливаем mongo (да к слову рекомендуется использовать 64 разрядную архетектуру)
sudo apt-get install mongodb-10genпробуем запустить
mongo
суббота, 8 июня 2013 г.
ставим django на ubuntu
Забираем djngo отсюда
положим архив в папку ~/python
распакуем
tar xzvf Django-1.5.1.tar.gz
cd Django-1.5.1
и установим
sudo python setup.py install
python
>>> import django
>>> dir(django)
среда, 5 июня 2013 г.
среда, 29 мая 2013 г.
стилизуем окна в ubuntu 12.x
перед началом работы ставим следующие пакеты
sudo apt-get install git autoconf libtool libwnck1.0-cil-dev libwnck-dev intltool libdecoration0-dev gawk compizconfig-settings-manager
скачиваем emerald:
wget cgit.compiz.org/fusion/decorators/emerald/snapshot/emerald-0.9.5.tar.gz
распаковываем и переходим в папку
tar -zxvf emerald-0.9.5.tar.gz && cd emerald-0.9.5/
далее конфигурируем и устанавливаем из сырцов
./autogen.sh && make clean && make distclean && ./configure --prefix=/usr && make && sudo make install
нажимаем alt+f2 и запускаем на выполнение
emerald-theme-manager -i
далее переходим Настройка тем -> Изменить темы -> Движок окна
и устанавливаем legacy (0.1)
(с остальными у меня были проблемы)
скачиваем темы отсюда http://gnome-look.org/ файлы с расширением .emerald (да, не пытайтесь открыть их архиватором)
Возвращаемся
Настройка тем -> Темы
и импортируем наши .emerald файлы
проверяем работоспособность emerald из консоли командой
emerald --replace &
если все ок то оставляем emerald
затем запускаем ccsm (alt+f2)
находим оформление окна и заменяем
gtk-window-decorator --replace
на
emerald --replace
а если нет то либо перезагружаемся
либо вызываем консоль (ctrl+alt+t) и возвращаем один из менеджеров
metacity --replace
compiz --replace
понедельник, 27 мая 2013 г.
картинки в css
иногда возникает необходимость держать весь код в одном файле. например для плагина jquery чтобы при его подключении не приходилось возится с файлами стилей и картинками. в таких случаях удобно запихивать картинки прямо в css.
background-image: url("data:image/ТИП;base64,код картинки в base64 ");
пятница, 24 мая 2013 г.
переместить кнопки управления окном на ubuntu 12.x в право
четверг, 23 мая 2013 г.
передать данные из result_modifier.php в component_epilog.php
1 2 3 4 5 6 7 8 | //для передачи в component_epilog $cp = $this ->__component; if ( is_object ( $cp )) { $cp ->arResult[ "SUB_ELEMENTS" ] = $arResult [ "SUB_ELEMENTS" ]; //$cp->arResult = $arResult; $cp ->SetResultCacheKeys( array ( "SUB_ELEMENTS" )); //указать ключи изменение которых окажет влияние на кеш } |
капча для битрикс
1 2 3 4 5 6 7 8 9 10 11 | if ( $arParams [ "USE_CAPTCHA" ] == "Y" ){ include_once ( $_SERVER [ "DOCUMENT_ROOT" ]. "/bitrix/modules/main/classes/general/captcha.php" ); $cpt = new CCaptcha(); $captchaPass = COption::GetOptionString( "main" , "captcha_password" , "" ); if ( strLen ( $captchaPass ) <= 0){ $captchaPass = randString(10); COption::SetOptionString( "main" , "captcha_password" , $captchaPass ); } $cpt ->SetCodeCrypt( $captchaPass ); $arResult [ "CAPTCHA_CODE" ] = htmlspecialchars( $cpt ->GetCodeCrypt()); } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | <img id= "capcha_block" align= "left" alt= "Введите эти символы в поле ввода" src= "/bitrix/tools/captcha.php?captcha_code=<?=$arResult[" CAPTCHA_CODE "]?>" /> <input id= "captcha_word" type= "text" name= "captcha_word" /> <input id= "capcha_block_hidden" type= "hidden" name= "captcha_code" value= "<!--=$arResult[" CAPTCHA_CODE "]?>" /> <button id= "capcha_block_reload" style= "width: 180px;" -->Сменить картинку</button> <script type= "text/javascript" > $( function (){ $( function (){ $( "#capcha_block_reload" ).bind( "click" , function (){ $.ajax({ type: "GET" , url: "?activ=new_code_get" , <? if ( "new_code_get" == $_GET [ "activ" ]){ $GLOBALS [ 'APPLICATION' ]->RestartBuffer(); echo md5(rand(0, 10000)); die ();}?> dataType: "text" , success: function (new_code){ $( '#capcha_block' ).attr( "src" , "/bitrix/tools/captcha.php?captcha_code=" +new_code); $( '#capcha_block_hidden' ).val(new_code); } }); return false; }); }); }); </script> |
1 2 3 4 5 6 7 8 9 10 11 | include_once ( $_SERVER [ "DOCUMENT_ROOT" ]. "/bitrix/modules/main/classes/general/captcha.php" ); $cpt = new CCaptcha(); if ( strlen ( $_POST [ "captcha_code" ]) > 0) { $captchaPass = COption::GetOptionString( "main" , "captcha_password" , "" ); if (! $cpt ->CheckCodeCrypt( $_POST [ "captcha_word" ], $_POST [ "captcha_code" ], $captchaPass )){ $arResult [ "ERROR" ][ "CAPTCHA" ]= "Неправильно введена капча" ; $arResult [ "ERROR" ][ "CRITICAL_ERROR" ]=true; } } } |
к слову "об определение cms"
среда, 15 мая 2013 г.
foreach без входной переменной
1 2 3 | <? foreach ( array (8,16,32) as $value ):?> <a href= "<?=$arResult[" sUrlPath "]?>?<?=$strNavQueryString?><?=$arParams[" DISPLAY_NAME_VAR_COUNT_PAGE "]?>=<?=$value?>" rel= "nofollow" ><?= $value ?></a> <? endforeach ?> |
воскресенье, 12 мая 2013 г.
Установка subline на ubuntu
распаковываем складываем в папку /opt если такой нет то создаем
на рабочем столе создаем файл subline.desktop
следующего содержания
[Desktop Entry]
Name=subline
Name[ru_RU]=subline
Encoding=UTF-8
Type=Application
Exec=/opt/subline/sublime_text %U
GenericName=Subline
Icon=/opt/subline/Icon/48x48/sublime_text.png
Terminal=false
Categories=Application;Development;Java;IDE
Version=1.0
Type=Application
Terminal=0
вторник, 30 апреля 2013 г.
перекодировать кучу файлов из cp-1251 в utf-8
find . -name "*.php" -print0|xargs -0 recode windows1251..utf8
виртуальный хост для битрикса в utf-8
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <VirtualHost *:80> ServerName biznes.loc DocumentRoot /home/user/www/bitrix_biznes <Directory /home/user/www/bitrix_biznes> Options FollowSymLinks AllowOverride ALL </Directory> <IfModule mod_php5.c> php_value default_charset utf-8 php_admin_value mbstring.func_overload 2 php_value mbstring.internal_encoding utf-8 php_admin_value realpath_cache_size "4096k" </IfModule> </VirtualHost> |
вторник, 16 апреля 2013 г.
создание дополнительных параметров для темы компонета
./.parameters.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | <? if (!defined( "B_PROLOG_INCLUDED" ) || B_PROLOG_INCLUDED!==true) die (); $properties = CIBlockProperty::GetList(Array( "sort" => "asc" , "name" => "asc" ), Array( "ACTIVE" => "Y" , "IBLOCK_ID" => $arCurrentValues [ "IBLOCK_ID" ])); while ( $prop_fields = $properties ->GetNext()){ $elements [ $prop_fields [ "ID" ]]= $prop_fields [ "NAME" ]; } $arTemplateParameters = array ( "PROPERTY_ADRESS" => Array( "NAME" => GetMessage( "T_PROPERTY_ADRESS" ), "TYPE" => "LIST" , "VALUES" => $elements , "REFRESH" => "Y" , ), "PROPERTY_PHONE" => Array( "NAME" => GetMessage( "T_PROPERTY_PHONE" ), "TYPE" => "LIST" , "VALUES" => $elements , "REFRESH" => "Y" , ), "PROPERTY_FAX" => Array( "NAME" => GetMessage( "T_PROPERTY_FAX" ), "TYPE" => "LIST" , "VALUES" => $elements , "REFRESH" => "Y" , ), "PROPERTY_EMAIL" => Array( "NAME" => GetMessage( "T_PROPERTY_EMAIL" ), "TYPE" => "LIST" , "VALUES" => $elements , "REFRESH" => "Y" , ), ); ?> |
1 2 3 4 5 6 | <? $MESS [ "T_PROPERTY_ADRESS" ] = "Свойства адреса" ; $MESS [ "T_PROPERTY_PHONE" ] = "Свойства телефон" ; $MESS [ "T_PROPERTY_FAX" ] = "Свойства факса" ; $MESS [ "T_PROPERTY_EMAIL" ] = "Свойства Email" ; ?> |
1 2 3 4 5 6 | <? $MESS [ "T_PROPERTY_ADRESS" ] = "property adress" ; $MESS [ "T_PROPERTY_PHONE" ] = "proropery phone" ; $MESS [ "T_PROPERTY_FAX" ] = "property fax" ; $MESS [ "T_PROPERTY_EMAIL" ] = "property Email" ; ?> |
понедельник, 15 апреля 2013 г.
Устанавливаем redmine на ubuntu
sudo aptitude install redmine
установливаем модуль для апача
sudo apt-get install libapache2-mod-passenger
включаем мод rewrite если не включен
sudo a2enmod passenger rewrite
создаем виртуальную секцию
1 2 3 4 5 6 | < VirtualHost *:80> ServerName redmine.loc DocumentRoot "/usr/share/redmine/public" PassengerResolveSymlinksInDocumentRoot on Options Indexes ExecCGI FollowSymLinks </ VirtualHost > |
127.0.0.1 redmine.loc
пятница, 12 апреля 2013 г.
паттерн одиночка
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | class Singleton { protected static $instance ; private function __construct() { } private function __clone() { } private function __wakeup() { } public static function getInstance() { if ( is_null (self:: $instance ) ) { self:: $instance = new self; } return self:: $instance ; } public function method() { //вумный код; } } Singleton::getInstance()->method(); |
четверг, 11 апреля 2013 г.
создаем ajax в битрикс
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | if (!defined( "B_PROLOG_INCLUDED" ) || B_PROLOG_INCLUDED!==true) die (); IncludeTemplateLangFile( __FILE__ ); /** * благодоря данному подходу можно создавать не только пустой шаблон но и обертывать код например наример различным кодом окон * Class get_sub_themes_singleton */ class get_sub_themes_singleton { protected static $instance ; // object instance private $list_theme ; private $sub_theme ; private $dir_sub_theme ; private $params ; private function __construct(){} private function __clone(){} private function __wakeup(){} public static function getInstance() { if ( is_null (self:: $instance )) { self:: $instance = new get_sub_themes_singleton; } return self:: $instance ; } public function set_sub_theme( $sub_theme ){ //поставить при повышенных требованиях к безопасности if (! empty ( $this ->list_theme) && ! empty ( $this ->list_theme[ $sub_theme ])){ $this ->sub_theme = $this ->list_theme[ $sub_theme ]; } return self:: $instance ; } public function set_dir_sub_theme( $dir_sub_theme ){ if ( is_dir ( $dir_sub_theme )){ $this ->dir_sub_theme = $dir_sub_theme ; } else { die ( "not found sub themes" ); } return self:: $instance ; } public function set_list_theme( $list_theme ){ $this ->list_theme = $list_theme ; return self:: $instance ; } public function get_header(){ //include(""); //echo $this->sub_theme; if ( file_exists ( $this ->dir_sub_theme. $this ->sub_theme. "/header.php" )){ include_once ( $this ->dir_sub_theme. $this ->sub_theme. "/header.php" ); } } public function get_footer(){ if ( file_exists ( $this ->dir_sub_theme. $this ->sub_theme. "/footer.php" )){ include ( $this ->dir_sub_theme. $this ->sub_theme. "/footer.php" ); } } public function set_params( $key , $value ){ $this ->params[ $key ]= $value ; return self:: $instance ; } public function get_params( $key ){ return $this ->params[ $key ]; } public function theme_exists( $theme ){ if (! empty ( $this ->list_theme[ $theme ])){ return true; } else { return false; } } } /////////////////////////////////////////////////////////////////////////// get_sub_themes_singleton::getInstance() ->set_dir_sub_theme(dirname( __FILE__ ). "/sub_themes/" ) ->set_list_theme( array ( "full_html" => "full_html" , "work_arena" => "work_arena" , "simple_windows" => "simple_windows" , ))->set_sub_theme( "full_html" ); //подключаем тему из url //хотя можно поставить и в куках if (! empty ( $_REQUEST [ 'theme' ]) && get_sub_themes_singleton::getInstance()->theme_exists( $_REQUEST [ 'theme' ])){ get_sub_themes_singleton::getInstance()->set_sub_theme( $_REQUEST [ 'theme' ]); } get_sub_themes_singleton::getInstance()->get_header(); |
И такой footer,php
1 | get_sub_themes_singleton::getInstance()->get_footer(); |
в папке /bitrix/templates/AJAX_HTML/sub_themes создаем подтемы с оформлением окон и не забываем указывать темы в через метод set_list_theme (сами темы состоят из header.php и footer.php)
данную тему настраиваем в настройках сайта и указываем что она должна применяться при наличии параметра ajax=Y в url
в футере основной темы создаем базовую парковочную зону (хотя не обязательно так как вы сами будете определять куда загружать контент)
1 2 3 4 5 6 | < div class = "parking_zone" closeajax = ".parking_zone" closebind = "click" > </ div > </ body > |
в header основной темы вставляем следующий jquery скрипт
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | < script type = "text/javascript" > /** * превращаем обычные ссылки в ajax */ $(function(){ $(".ajax_link").live("click",function(){ var parking_zone=$(this).attr("parking_zone"); var close_element_control=$(parking_zone).attr("closeajax"); var action_close=$(parking_zone).attr("closebind"); $(close_element_control).bind(action_close, function(){ $(parking_zone).hide(); }); $(parking_zone).load($(".ajax_link").attr("ajaxhref"), function() { $(parking_zone).show();//настройка анимации окон }); return false; }); }); </ script > |
1 2 3 4 5 6 7 | <span class = "region-select-a" > <a id = "testid" class = "ajax_link" href= "/vibor_regiona/" ajaxhref= "/vibor_regiona/?ajax=Y&theme=simple_windows&<?=(empty($_REQUEST['параметр'])?" ":'region_geo_location='.$_REQUEST['параметр']);?>" parking_zone= ".parking_zone" >blabla</a></span> |
вторник, 9 апреля 2013 г.
раздача прав в консоли
для файлов
find . -type f -exec chmod 666 {} \;
для директорий
find . -type d -exec chmod 777 {} \;
но теперь нашел более оптимальный и быстрый
для файлов
find . -type а -print0|xargs -0 chmod 666
для директорий
find . -type d -print0|xargs -0 chmod 777
ps:
иногда необходимо раздавать права от root тогда при попытке использования
find . -type d -print0|xargs -0 sudo chmod 777
chmod выдает sudo: unable to execute /bin/chmod: Argument list too long
пятница, 8 марта 2013 г.
понедельник, 4 марта 2013 г.
администрируем свой сервер через веб или как поставить webmin
webmin очень удобная система администрирования через веб интерфейс(хорошо руссифицированая)
устанавливаем необходимые библеотек
sudo apt-get install perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl
sudo nano /etc/apt/sources.list
добавляем в файл /etc/apt/sources.list репозитарий webminа
deb http://download.webmin.com/download/repository sarge contrib
скачиваем и ставим ключ репозитария
wget http://www.webmin.com/jcameron-key.asc
sudo apt-key add jcameron-key.asc
обновляем и ставим
sudo apt-get update
sudo apt-get install webmin
https://<ваш ip>:10000
или прокидываем порт и аминим свой сервак хоть с телефона
з.ы.
входим пользователем имеющим доступ в sudo или rootом
меняем язык на русский
Webmin -> Change Language and Theme
установка KDE на ubuntu
sudo apt-get install kde-full
самая новая версия
добавляем репозитарий
sudo add-apt-repository ppa:kubuntu-ppa/backports
обновляем
sudo apt-get update
ставим
sudo apt-get install kubuntu-desktop
русифицируем
sudo apt-get install kde-l10n-ru
воскресенье, 3 марта 2013 г.
начал писать программу кубика рубика
|
|||||||||||||||||||||||||||||
|
|
|
|||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||
|
установка xdebug на ubuntu
sudo pecl install xdebug
затем ищем xdebug.so
find / -name 'xdebug.so'
у меня нащелся здесь
/usr/lib/php5/20090626+lfs/xdebug.so
или
sudo vim /etc/php5/apache2/php.ini (подразумевается что вы знаете vim это не простой редактор)
или
sudo nano /etc/php5/apache2/php.ini
добавляем в конец
zend_extension="/usr/lib/php5/20090626+lfs/xdebug.so"
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
рестарт уем апач
sudo /etc/init.d/apache2 restart
смотрим наличие xdebug в phpinfo();
в качестве бонуса xdebug.ini с более удобными настройками
zend_extension=/usr/lib/php5/<ваша версия>+lfs/xdebug.so
xdebug.default_enable = On
xdebug.auto_trace=On
xdebug.trace_output_dir=/home/user/
xdebug.var_display_max_depth=6
xdebug.remote_enable=on
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.idekey=netbeans-xdebug
xdebug.remote_autostart=1
xdebug.remote_log=/tmp/xdebug.log
xdebug.profiler_enable_trigger=1
xdebug.profiler_enable=0
xdebug.profiler_output_dir=/tmp/profiler
xdebug.show_local_vars=1
создаем его здесь
/etc/php5/mods-available/xdebug.ini
и
делаем символьную ссылку так
sudo ln -s /etc/php5/mods-available/xdebug.ini /etc/php5/apache2/conf.d/
рестартуем апач
календарь на php(продолжение)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | interface Show{ function show(); } class Calendar{ private $date ; //сдесь храним дату на которую делаем календарь private $arr_calendar ; //массив из всех дат(DateTime) месяца function __construct(DateTime $date ) { //принимаем только формат DateTime $this -> date = $date ; } /** * функция возвращает массив обектов состоящих из дат текущего месяца * @return array */ function get_calendar(){ // идем от 1 числа по всем числам месяца for ( $i =1; $this -> date ->format( 't' )>= $i ; $i ++){ $tmp_date = new DateTime( $i . "." . $this -> date ->format( 'm' ). "." . $this -> date ->format( 'Y' )); $this ->arr_calendar[] = array ( "oject_data" => $tmp_date , //дата объектом "active_data" => $this ->test_curret_date( $tmp_date ), //проверку на текущию дату ); } return $this ->arr_calendar; } /** * если переданная дата будет равна дате $this->date то вернем true * @param DateTime $current_date проверяемая дата * @return boolean */ private function test_curret_date(DateTime $current_date ){ if ( $current_date ->format( 'd.m.Y' )== $this -> date ->format( 'd.m.Y' )){ return true; } else { return false; } } } class ShowCalendar implements Show{ private $calendar ; private $calendar_format ; //формат в днях недели 1=>"Понедельник", ... 7=>"Воскресение", private $list_property = array ( "show_dat" , "dat_format" , "show_mount" ); private $show_dat =true; private $dat_format =self::DAY_SHORT_FORMAT; private $show_mount =true; private $mount_format =self::MOUNT_FULL_FORMAT; const DAY_SHORT_FORMAT = "d.m" ; const MOUNT_FULL_FORMAT = "m.Y" ; function set_params( $key , $value ){ if (in_array( $key , $this ->list_property)){ $this -> $key = $value ; } } function __construct(Calendar $calendar , array $calendar_format = array ( 1=> "Понедельник" , 2=> "Вторник" , 3=> "Среда" , 4=> "Четверг" , 5=> "Пятница" , 6=> "Суббота" , 7=> "Воскресение" , ) ) { $this ->calendar= $calendar ->get_calendar(); $this ->calendar_format= $calendar_format ; } /** * функция получения отображения * @return string */ function show() { //отдельно получаем и собираем вместе элементы (имитация темплейта) $template = $this ->show_get_style(). $this ->show_get_header(). $this ->show_get_body(). $this ->show_get_footer(); return $template ; } /** * функция получения header * @return string */ private function show_get_header(){ $template = "<table>" . "<tr>" ; if ( $this ->show_mount){ $mount_tmp =current( $this ->calendar); $template .= "<tr>" . '<td colspan=7>' . $mount_tmp [ "oject_data" ]->format( $this ->mount_format). "</td>" . "</tr>" ; } foreach ( $this ->calendar_format as $day_name ){ $template .= "<td>" . $day_name . "</td>" ; } $template .= "</tr>" ; return $template ; } /** * функция возвращает footer таблицы * @return string */ private function show_get_footer(){ $template = "</table>" ; return $template ; } /** * функция возращает основное тело таблицы * @return string */ private function show_get_body(){ //получаем календарь в виде массива $arr_calendar = array (); foreach ( $this ->calendar as $day_element ){ if (!isset( $arr_calendar [ $day_element [ "oject_data" ]->format( "W" )])){ $arr_calendar [ $day_element [ "oject_data" ]->format( "W" )]= array (); } $arr_calendar [ $day_element [ "oject_data" ]->format( "W" )][ $day_element [ "oject_data" ]->format( "N" )]= array ( "data" => $day_element [ "oject_data" ]->format( $this ->dat_format), "active" => $day_element [ "active_data" ], ); } //собираем календарь в таблицу $template = "" ; foreach ( $arr_calendar as $row ){ $template .= "<tr>" ; for ( $i =1;7>= $i ; $i ++){ if (isset( $row [ $i ])){ //ячейка определена $template .= "<td " .( $row [ $i ][ "active" ]&& $this ->show_dat? 'class="active"' : '' ). ">" ; $template .= $row [ $i ][ "data" ]; $template .= "</td>" ; } else { //ячейка пустая $template .= "<td></td>" ; } } $template .= "</tr>" ; } return $template ; } /** * функция возвращает стили для календаря * @return string */ private function show_get_style(){ $template = '<style type="text/css">' . '.active{' . " color: red;" . " background: #ccc;" . '}' . 'table tr td{' . " text-align: center;" . " border: 1px solid black; " . " padding: 5px; " . '}' . '</style>' ; return $template ; } } $n = new DateTime( "now" ); $n1 = $n ->sub( new DateInterval( 'P1M' )); $calendar = new ShowCalendar( new Calendar( $n1 )); $calendar ->set_params( "show_dat" , false); echo $calendar ->show(); $n2 = $n ->add( new DateInterval( 'P1M' )); $calendar = new ShowCalendar( new Calendar( $n2 )); echo $calendar ->show(); $n3 = $n ->add( new DateInterval( 'P1M' )); $calendar = new ShowCalendar( new Calendar( $n3 )); $calendar ->set_params( "show_dat" , false); echo $calendar ->show(); |
суббота, 2 марта 2013 г.
календарь на php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | class Calendar{ private $date ; //сдесь храним дату на которую делаем календарь private $arr_calendar ; //массив из всех дат(DateTime) месяца function __construct(DateTime $date ) { //принимаем только формат DateTime $this -> date = $date ; } /** * функция возвращает массив обектов состоящих из дат текущего месяца * @return array */ function get_calendar(){ // идем от 1 числа по всем числам месяца for ( $i =1; $this -> date ->format( 't' )>= $i ; $i ++){ $this ->arr_calendar[] = new DateTime( $i . "." . $this -> date ->format( 'm' ). "." . $this -> date ->format( 'Y' )); } return $this ->arr_calendar; } /** * отображает календарь * @param array $calendar_format * example * array( 1=>"понедельник", 2=>"вторник", 3=>"среда", 4=>"четверг", 5=>"пятница", 6=>"суббота", 7=>"воскресение", ) */ function show_calendar( $calendar_format ){ // пока сделано без MVC $this ->get_calendar(); //получаем календарь в массив $run =true; echo "<table>" ; echo "<tr>" ; echo "<td colspan=7>" ; echo $this -> date ->format( 'd.m.Y' ); echo "</td>" ; echo "</tr>" ; echo "<tr>" ; foreach ( $calendar_format as $day_name ){ echo "<td>" ; echo "<b>" . $day_name . "</b>" ; //выводим название недели в загаловке таблицы echo "</td>" ; } echo "</tr>" ; while ( $run ){ echo "<tr>" ; foreach ( $calendar_format as $key_dat => $day_name ){ if (current( $this ->arr_calendar)->format( 'N' )== $key_dat ){ echo "<td>" ; //проверяем на текущею дату если текущая то выделяем красным if ( $this ->test_curret_date(current( $this ->arr_calendar))){ echo '<b style="color: red;">' ; } echo current( $this ->arr_calendar)->format( 'd' ); //выводим активный элемент массива //проверяем на текущею дату if ( $this ->test_curret_date(current( $this ->arr_calendar))){ echo "</b>" ; } echo "</td>" ; next( $this ->arr_calendar); //переходим на следущий элемент массива // //проверка конца массива если конец выходим из цикла if (current( $this ->arr_calendar)->format( 'd' )== $this -> date ->format( 't' )){ $run =false; } } else { echo "<td></td>" ; } } } echo "</tr>" ; echo "</table>" ; } /** * если переданная дата будет равна дате $this->date то вернем true * @param DateTime $current_date проверяемая дата * @return boolean */ private function test_curret_date(DateTime $current_date ){ if ( $current_date ->format( 'd.m.Y' )== $this -> date ->format( 'd.m.Y' )){ return true; } else { return false; } } } $calendar = new Calendar( new DateTime( "11.05.2010" )); $calendar ->show_calendar( array ( 1=> "понедельник" , 2=> "вторник" , 3=> "среда" , 4=> "четверг" , 5=> "пятница" , 6=> "суббота" , 7=> "воскресение" , ) ); |
php отладка ООП кода при помощи Reflection API
1 2 3 4 5 6 7 8 9 10 | <?php $date = new DateTime( "now" ); //$date2 = new DateTime("02/03/2013"); $class_info = new ReflectionClass( $date ); ?> <pre> <? Reflection::export( $class_info ); ?> </pre> |
Class [ class DateTime ] { - Constants [11] { Constant [ string ATOM ] { Y-m-d\TH:i:sP } Constant [ string COOKIE ] { l, d-M-y H:i:s T } Constant [ string ISO8601 ] { Y-m-d\TH:i:sO } Constant [ string RFC822 ] { D, d M y H:i:s O } Constant [ string RFC850 ] { l, d-M-y H:i:s T } Constant [ string RFC1036 ] { D, d M y H:i:s O } Constant [ string RFC1123 ] { D, d M Y H:i:s O } Constant [ string RFC2822 ] { D, d M Y H:i:s O } Constant [ string RFC3339 ] { Y-m-d\TH:i:sP } Constant [ string RSS ] { D, d M Y H:i:s O } Constant [ string W3C ] { Y-m-d\TH:i:sP } } - Static properties [0] { } - Static methods [3] { Method [ static public method __set_state ] { } Method [ static public method createFromFormat ] { - Parameters [3] { Parameter #0 [ $format ] Parameter #1 [ $time ] Parameter #2 [ $object ] } } Method [ static public method getLastErrors ] { - Parameters [0] { } } } - Properties [0] { } - Methods [15] { Method [ public method __construct ] { - Parameters [2] { Parameter #0 [ $time ] Parameter #1 [ $object ] } } Method [ public method __wakeup ] { } Method [ public method format ] { - Parameters [1] { Parameter #0 [ $format ] } } Method [ public method modify ] { - Parameters [1] { Parameter #0 [ $modify ] } } Method [ public method add ] { - Parameters [1] { Parameter #0 [ $interval ] } } Method [ public method sub ] { - Parameters [1] { Parameter #0 [ $interval ] } } Method [ public method getTimezone ] { - Parameters [0] { } } Method [ public method setTimezone ] { - Parameters [1] { Parameter #0 [ $timezone ] } } Method [ public method getOffset ] { - Parameters [0] { } } Method [ public method setTime ] { - Parameters [3] { Parameter #0 [ $hour ] Parameter #1 [ $minute ] Parameter #2 [ $second ] } } Method [ public method setDate ] { - Parameters [3] { Parameter #0 [ $year ] Parameter #1 [ $month ] Parameter #2 [ $day ] } } Method [ public method setISODate ] { - Parameters [3] { Parameter #0 [ $year ] Parameter #1 [ $week ] Parameter #2 [ $day ] } } Method [ public method setTimestamp ] { - Parameters [1] { Parameter #0 [ $unixtimestamp ] } } Method [ public method getTimestamp ] { - Parameters [0] { } } Method [ public method diff ] { - Parameters [2] { Parameter #0 [ $object ] Parameter #1 [ $absolute ] } } } }
среда, 13 февраля 2013 г.
хак для firefox или как применить стиль только для firefox
/* Target all Firefox */ #selector[id=selector] { color: red; } /* Target all Firefox */ @-moz-document url-prefix() { .selector { color: red; } } /* Target all Gecko (includes Firefox) */ *>.selector { color: red; } |
создание многоуровневых раскрывающихся списков на jquery
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | <!--DOCTYPE HTML--> <meta charset= "UTF-8" > <title></title> <script type= "text/javascript" src= "https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js" > </script> ‹script type= "text/javascript" > $( function (){ $( 'li:has(ul.li-slider)' ) .click( function (event){ if (this == event.target) { if ($(this).children().is( ':hidden' )) { $(this) .css( 'list-style-image' , 'url(minus.gif)' ) .children().slideDown(); } else { $(this) .css( 'list-style-image' , 'url(plus.gif)' ) .children().slideUp(); } } return false; }) .css({cursor: 'pointer' , 'list-style-image' : 'url(plus.gif)' }) .children().hide(); $( 'li:not(:has(ul.li-slider))' ).css({ cursor: 'default' , 'list-style-image' : 'none' }); }); ‹/script> <ul class = "li-slider" > <li style= "cursor: default; list-style-image: none;" >Авто <ul class = "li-slider" > <li style= "cursor: default; list-style-image: none;" >1</li> <li style= "cursor: default; list-style-image: none;" >2</li> <li style= "cursor: default; list-style-image: none;" >3</li> <li style= "cursor: default; list-style-image: none;" >4</li> <li style= "cursor: default; list-style-image: none;" >ul ниже не будет раскрываться для того чтобы он мог раскрываться добавьте ему class = "li-slider" <ul> <li style= "cursor: default; list-style-image: none;" >1</li> <li style= "cursor: default; list-style-image: none;" >2</li> <li style= "cursor: default; list-style-image: none;" >3</li> <li style= "cursor: default; list-style-image: none;" >4</li> <li style= "cursor: default; list-style-image: none;" >5</li> </ul> </li> </ul> </li> </ul> |
- Авто
- 2
- 1
- 1
- 2
- 3
- 4
- 5
- 2
- 1
- 2
- 3
- 4
- 5
- 3
- 1
- 2
- 3
- 4
- 5
- 4
- 1
- 2
- 3
- 4
- 5
- 5
- 1
- 2
- 3
- 4
- 5
- 1
- 2
пятница, 8 февраля 2013 г.
сделать подсветку синтаксиса на вашем сайте
часто возникает необходимость встроить полсветку сетаксиса на ваш блок вставте с ваш блог следующие скрипты
1 2 3 | < pre class = "brush:php" > //ваш код < pre > |
четверг, 7 февраля 2013 г.
jquery на гугле
1 | < script type = "text/javascript" src = "https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js" > < / script > |
1 | < script type = "text/javascript" >window.jQuery || document.write('< script src = "js/jquery-1.8.1.min.js" ><\/script>') </ script > |
понедельник, 4 февраля 2013 г.
RewriteEngine
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
воскресенье, 3 февраля 2013 г.
виртуальная секция
<VirtualHost *:80>
ServerAdmin mail@mail.mail
ServerName oop
DocumentRoot /home/user/www/oop
<Directory /home/user/www/oop>
Options FollowSymLinks
AllowOverride ALL
</Directory>
</VirtualHost>
паттерн command php
реализация
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | "; ////////////////////////////////////////////// abstract class Command { abstract function execute( CommandContext $context ); } class LoginCommand extends Command{ function execute( CommandContext $context ){ $user = $context ->get( 'username' ); $pass = $context ->get( 'pass' ); Loger::write( "enter user: " . $user ); return true; } } class CommandContext { private $params = array (); private $error = "" ; function __construct() { $this ->params = $_REQUEST ; } function addParam( $key , $val ){ $this ->params[ $key ] = $val ; } function get( $key ){ return $this ->params[ $key ]; } function setError( $error ){ $this -> $error = $error ; } function getError(){ return $this ->error; } } class CommandNotFoundException extends Exception {} class CommandFactory { private static $dir = "commands" ; static function getCommand( $action = 'default' ){ if (preg_match( '/\W/' , $action )){ throw new CommandNotFoundExceptioin( 'Недопустимые символы в комманде' ); } $class = $action . "Command" ; /*//времено //возможен иклюдинг предусмотреть $class = $action.".ph $file = self::$dir.DIRECTORY_SEPARATOR if (!file_exists($file)){ throw new CommandNotFoundExceptioin('не найден файл '.$file); } require_once( $file ); */ if (! class_exists ( $class )){ throw new CommandNotFoundExceptioin( 'не найден класс ' . $class ); } $cmd = new $class (); return $cmd ; } } class Controller { private $context ; function __construct(){ $this ->context = new CommandContext(); } function getContext(){ return $this ->context; } function process(){ //var_dump( $this->context->get('action') ); $cmd = CommandFactory::getCommand( $this ->context->get( 'action' ) ); if ( ! $cmd ->execute( $this ->context) ){ //обработка ошибок } else { //все прошло успешно //Теперь отобразим результаты } } } $controler = new Controller(); //эмулируем действия пользователя $context = $controler ->getContext(); $context ->addParam( 'action' , 'Login' ); $context ->addParam( 'username' , 'jo' ); $context ->addParam( 'pass' , '1' ); $controler ->process(); ?> |
суббота, 26 января 2013 г.
GIT попытка сделать push в текущею ветку удаленном сервере
Пытаюсь по SSH вытолкнуть изменения на удаленный сервер, в результате чего получаю вот такую ошибку: REJECTED_OTHER_REASON
Для решения данной проблемы вы можете либо сделать из удаленного репозитария либо сделать bare (без исходных кодов) репозитарейgit config --bool core.bare true
либо создать ветку продакшен и сделать ее текущей а пушатся в master а затем мержится в продакшен
git checkout -b production
а затем после пуша мержимся
git merge --ff-only master
суббота, 12 января 2013 г.
GIMP 2.8 из исходников
как бы я не ненавидел gimp все равно приходится им пользоваться время от времени. Здесь краткая инструкция по установке на основе данной заметки(http://pingvinus.ru/note/gimp-install-from-sources)
сначала ставим gimp из репозитария (sudo apt-get install gimp)если же старая версия вас не устраивает как меня то можно собрать новую из исходников
собирать будем gimp 2.8 для начала нам следует установить следующие библиотеки и пакеты
sudo apt-get build-dep gimp |
sudo apt-get remove libgegl-0.0-dev libbabl-0.0-0-dev |
sudo apt-get install libavformat-dev libavcodec-dev valac-0.16 graphviz |
sudo apt-get install ruby1.9.1-dev liblua5.1-0-dev libopenexr-dev libopenraw-dev |
sudo apt-get install libexiv2-dev libsdl1.2-dev libgs-dev libjasper-dev |
sudo apt-get install git-core |
sudo apt-get install checkinstall |
сделаем директорию для хранения всех наших исходников
mkdir ~/build_gimp |
cd ~/build_gimp |
устанавливаем глобальные переменные (ВНИМАНИЕ если в процессе сборки вы будете закрывать консоль то их нужно выставлять но новой)
export PATH=/opt/gimp-2.8/bin:$PATH |
export PKG_CONFIG_PATH=/opt/gimp-2.8/lib/pkgconfig |
export LD_LIBRARY_PATH=/opt/gimp-2.8/lib |
для оптимизации под конкретное железо можно сделать
export CFLAGS="-march=native -O3" |
далее получаем через git исходники babl и собираем
git clone git://git.gnome.org/babl |
cd babl |
./autogen.sh --prefix=/opt/gimp-2.8 |
make |
sudo make install |
cd .. |
git clone git://git.gnome.org/gegl |
cd gegl |
./autogen.sh --prefix=/opt/gimp-2.8 |
make |
sudo make install |
cd .. |
скачиваем исходники gimp
wget ftp://ftp.gimp.org/pub/gimp/v2.8/gimp-2.8.0.tar.bz2 |
распаковываем
tar -xjf gimp-2.8.0.tar.bz2 |
переходим в папку с исходниками gimp
cd gimp-2.8.0 |
конфигурируем
./configure --prefix=/opt/gimp-2.8 |
компилируем
make |
устанавливаем
make install |
запустить из консоли можно
/opt/gimp-2.8/bin/gimp-2.8 |
в директории ~/.local/share/applications создать файл gimp28.desktop
[Desktop Entry] |
Name=GIMP 2.8 |
Name[ru_RU]=GIMP 2.8 |
Encoding=UTF-8 |
Type=Application |
Exec=/opt/gimp-2.8/bin/gimp-2.8 %U |
GenericName=Image Editor GIMP 2.8 |
Icon=/opt/gimp-2.8/share/icons/hicolor/48x48/apps/gimp.png |
Terminal=false |
Categories=Graphics;2DGraphics;RasterGraphics;GTK; |
X-GNOME-Bugzilla-Bugzilla=GNOME |
X-GNOME-Bugzilla-Product=GIMP |
X-GNOME-Bugzilla-Component=General |
X-GNOME-Bugzilla-Version=2.8.0 |
X-GNOME-Bugzilla-OtherBinaries=gimp-2.8 |
StartupNotify=true |
MimeType=application/postscript;application/pdf;image/bmp;image/g3fax;image/gif;image/x-fits;image/pcx;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-psd;image/x-sgi;image/x-tga;image/x-xbitmap;image/x-xwindowdump;image/x-xcf;image/x-compressed-xcf;image/x-gimp-gbr;image/x-gimp-pat;image/x-gimp-gih;image/tiff;image/jpeg;image/x-psp;image/png;image/x-icon;image/x-xpixmap;image/svg+xml;application/pdf;image/x-wmf;image/jp2;image/jpeg2000;image/jpx;image/x-xcursor; |