Is your DNS round-robin setup really round?
Just test!
Take this simple script and test on your own, with python 2 or 3.
Options:
usage: dns_round_robin_test.py [-h] [-c COUNT] [-d DELAY] name positional arguments: name DNS name to test optional arguments: -h, --help show this help message and exit -c COUNT, --count COUNT set total count of resolves -d DELAY, --delay DELAY set delay between resolves in 1/100s of second
Sample run command:
$ ./dns_round_robin_test.py google.com -c 20
Sample output:
================ google.com ================ 20/20 188.43.66.170 [ ||||| 25.0%] 5 188.43.66.187 [ ||||| 25.0%] 5 188.43.66.174 [ |||||||||| 50.0%] 10
Use placeholders in django forms
Hi there! Using django with bootstrap and want to use placeholders instead labels? Seems you have something to ask Google 🙂
If you got stuck with this particular topic, here is my solution you can use as a starting point for your own.
The idea is simple: turn labels into placeholders. We need to add placeholder attribute to inputs and remove labels from output.
Solution using intermediate class
class PlaceholderForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(PlaceholderForm, self).__init__(*args, **kwargs) for field_name in self.fields: field = self.fields.get(field_name) if field: if type(field.widget) in (forms.TextInput, ): field.widget.attrs.update( {'placeholder': field.label, 'class': 'span10'} ) if type(field.widget) in (forms.Select, ): field.widget.attrs.update({'class': 'span10'}) field.empty_label = field.label def as_p(self): return self._html_output( normal_row='<p%(html_class_attr)s>%(field)s%(help_text)s</p>', error_row='%s', row_ender='</p>', help_text_html=' <span class="helptext">%s</span>', errors_on_separate_row=True ) class MyForm(PlaceholderForm): class Meta: model = MyModel
That’s it! __init__() do a copy of label, as_p() was pasted from django source with label removed.
Поставить сервер непрерывной интеграции Jenkins на Ubuntu
Дано:
Ubuntu 12.04 LTS (серверная или настольная редакция).
Надо:*
Установить сервер непрерывной интеграции Jenkins.
Решение:
Всё очень просто (см. http://pkg.jenkins-ci.org/debian/):
- Добавляем ключ репозитория Jenkins:
wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
- Добавляем сам репозиторий:
echo "deb http://pkg.jenkins-ci.org/debian binary/" | sudo tee /etc/apt/sources.list.d/jenkins.list
- Обновляем информацию о доступности пакетов программ с учетом нового репозитория:
sudo apt-get update
- Устанавливаем нужное:
sudo apt-get install jenkins jenkins-cli ant openjdk-6-jdk
Сразу после установки у вас будет доступен сервер Jenkins по адресу http://localhost:8080/ .
Замечания:
Дополнительно установлен интерфейс командной строки для управления Jenkins. Его опции доступны по адресу http://localhost:8080/cli .
Пакеты ant и openjdk-6-jdk нужны для непосредственной работы заданий тестирования и сборки, самому Jenkins они не требуются.
Для начала работы желательно сходить в Центр управления плагинами и обновлениями: http://localhost:8080/pluginManager/ .
* Да, я тут лукавлю, ибо цель не в самом сервере НИ, а в том, что он умеет делать, но не всё сразу 😉
Установка и настройка языка в Ubuntu
Показано, как установить пакеты локализации на примере русского языка, настроить языковые предпочтения, добавить раскладки клавиатуры и установить их параметры.