Is your DNS round-robin setup really round?


Just test!

Take this simple script and test on your own, with python 2 or 3.


usage: [-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:

$ ./ -c 20

Sample output:

================ ================ 20/20 [                ||||| 25.0%] 5 [                ||||| 25.0%] 5 [           |||||||||| 50.0%] 10

Комментариев нет »20.12.2015 17:15:06 | English, Делаю | , , , ,

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, ):
                        {'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(
            help_text_html=' <span class="helptext">%s</span>',

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.

Комментариев нет »15.06.2013 03:41:09 | English, Делаю |

Python beginners class from Google

Just watched Google python class done by Nick Parlante. It is rather introductory but very useful and cool.

Here is the class homepage.

Lecture videos:

1.1 Introduction, strings
1.2 Lists and sorting
1.3 Dicts and files
2.1 Regular expr
2.2 Utilities
2.3 Utilities urllib
2.4 Conclusions

Комментариев нет »04.02.2012 13:18:10 | English |

Advertisements for Ubuntu


There was no actual non-russian post till today, sorry. I’ll be a good boy 😉

I’m using Ubuntu Linux (ok, Richard, GNU/Linux) from about the end of 2006. I like it very much. I’ve tried some other distros but Ubuntu made me happy: I’ve started to work and not configure the system for myself. Ubuntu works great, looks amazing and still simple and free to get, install and use.

Since 2007 I’m working to support Russian community in many ways. Supporting is my primary role now, but I’m also looking for more opportunities to express my feelings about this great system: Ubuntu.

Читать всё »

Комментариев нет »14.03.2011 02:35:13 | English, Ubuntu | , ,

Hello there!

Dear visitor!

If you came to my site you probably noticed that it is in Russian. Sorry for that but I’m Russian man and I work in Russia and I speak Russian a lot. I’ve set up this English category in order to promote my international activities.

I hope, I’ll be able to write once a year at least. BTW! Feel free to subscribe to my English posts RSS feed.

Комментариев нет »01.01.2010 17:33:05 | English | ,