Sublime Text 2 хитрости »
Пришла пора миграций.
Дорогою добра
Ремонт L-образного magsafe

Симптомы:
Провалися контакт в magsafe и не возвращается обратно.
Ремонт:
1) Вынимаем из magsafe часть, которая прилегает к разъему ноутбука. Для этого подойдут обычные плоскогубцы. Хвататься нужно за короткие стороны, там находятся специальные крепления(см. фото)
2) Вынимаем сам контакт. Внутри будет пружинка рекомендую подстраховаться чтобы не потерять ее.
3) Вытаскиваем пружинку. Слегка расправляем.
4) Собираем все в обратном порядке.
Requiescat in pace, Dennis MacAlistair Ritchie”
Requiescat in pace, Steve”
Умер один из дисков в группе LVM. Что делать?
Так бывает. Кроме того, иногда необходимо вытащить информацию из не полного LVM, например подключив по очереди диски, участвующие в LVM, к ноутбуку.
В случае сабж. Загрузиться с live cd. Открыть терминал.
vgchange -a y и добавить здесь же ключик -P (перед этим рекомендую ознакомиться с man lvm).
Проверяем, lvscan. Интересующая группа томов должна быть активной.
Далее, монтируем диск и спасаем все, что можем.
Этот метод справедлив и для других подобных случаев.
Prawn и русский язык
Если попробовать поработать с Prawn из “коробки”, то 100% наткнешься на сюрприз с кириллическими шрифтами. Собственно проблема именно в шрифтах, их нужно подменить укаав свои. Из документации к Prawn:
# Registering a DFONT package font_path = "#{Prawn::BASEDIR}/data/fonts/Action Man.dfont" font_families.update("Action Man" => { :normal => { :file => font_path, :font => "ActionMan" }, :italic => { :file => font_path, :font => "ActionMan-Italic" }, :bold => { :file => font_path, :font => "ActionMan-Bold" }, :bold_italic => { :file => font_path, :font => "ActionMan-BoldItalic" } }) font "Action Man" text "Also using the Action Man by providing only its name
Остается порыться у себя на компе в поисках шрифтов или спросить гугл.
Ссылки по теме:
http://prawn.majesticseacreature.com/ - Prawn
https://github.com/Volundr/prawn-rails - гем для удобства работы из rails
http://prawn.majesticseacreature.com/manual.pdf - дока
Mysql + ubuntu + gem mysql (rvm)
sudo apt-get install mysql-server libmysqlclient-dev
gem install mysql
RVM на Ubuntu 11.04
sudo apt-get install curl git
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
rvm pkg install zlib
rvm install 1.8.7 или 1.9.2
gem install rdoc-data
gem install bundle
git clone user@repo:/path/project
cd project
bundle install
Вроде ничего не забыл.
Особенности check_box_tag
<%= check_box_tag 'check_for[]', c.id %> <%= check_box_tag 'check_for', c.id %>
Обе строчки рабочие, но в певом случае мы получим следующие параметры:
Parameters: {"check_for"=>["8", "10", "27"], "commit"=>"Submit", "authenticity_token"=>"P6V5lacVnxwPidemELGPse9LGvMrqWOh2BaLdLQ/YG0=", "utf8"=>"✓"} Parameters: {"check_for"=>["27"], "commit"=>"Submit", "authenticity_token"=>"P6V5lacVnxwPidemELGPse9LGvMrqWOh2BaLdLQ/YG0=", "utf8"=>"✓"}
А во втором при тех же исходных:
Rei: вииии, у меня на балконе халявный вай-фааааай!
Rei: что-то мне подсказывает, что я возненавижу эту зиму…
A good man one day found himself in conversation with God and so he asked Him:
My Lord, I’d like to know what is Heaven and what is Hell.
God led the man towards two doors, opened one and asked the good man to look inside. There was an enormous round table, in the middle of which was a massive bowl filled with food that smelled delicious. The good man felt his mouth water. The people sat around that table looked malnourished and ill. They all looked famished. They had spoons with very. very long handles attached to their arms, but since the spoon handle was longer than their own arms they couldn’t bring the food to their mouth. The good man shook at the sight of their misery
God said: “You have just seen Hell”.
God and the good man then went to the second door. God opened it. The scene that the good man saw was identical to the previous one. There was the same vast round table, the same large bowl that made his mouth water. The people sat around the table held the same spoons with the very long handles.Only this time they all looked well nourished, happy and were engaged in pleasant conversations with one another.
The good man said to God: “I don’t understand”
“It’s simple”, God answered him, “These have learned to take nourishment from one another. The other ones, instead, only think of themselves.
Hell and Heaven are built in the same way. The difference lies within us”.
— Хорошая притча.
