####lxml install on ubuntu
sudo aptitude install libxslt-dev
sudo aptitude install libxml2-dev
sudo aptitude install gcc
pip install lxml
| import ssl | |
| from socket import socket, AF_INET, SOCK_DGRAM | |
| from dtls import do_patch | |
| do_patch() | |
| import SocketServer | |
| class UDPEchoServer(SocketServer.ThreadingMixIn, SocketServer.UDPServer): | |
| def get_request(self):#overwritten | |
| return self.socket.accept() | |
| def server_activate(self): |
| import socket | |
| import tornado.ioloop | |
| import tornado.iostream | |
| def test(): | |
| def on_close(data): | |
| print len(data), 'test on_close' | |
| def on_data(data): |
| You need to create your own admin base_site.html template to do this. The easiest way is to create the file: | |
| /<projectdir>/templates/admin/base_site.html | |
| This should be a copy of http://code.djangoproject.com/svn/django/branches/releases/1.2.X/django/contrib/admin/templates/admin/base_site.html - except putting in your custom title: | |
| {% block branding %} | |
| <h1 id="site-name">{% trans 'my cool admin console' %}</h1> | |
| {% endblock %} | |
| For this to work, you need to have the correct settings for your project, namely in settings.py: |
| a = [1, 1, 2, 3] | |
| print reduce(lambda x, y: x if y in x else x + [y], a, []) |
| exec env LANG=zh_CN.UTF-8 wine sth.exe | |
| # or | |
| export LANG=zh_CN.UTF-8 | |
| wine sth.exe & |
####lxml install on ubuntu
sudo aptitude install libxslt-dev
sudo aptitude install libxml2-dev
sudo aptitude install gcc
pip install lxml
| from pyquery import PyQuery as pq | |
| import requests | |
| r = requests.get('https://gist.github.com/wynemo') | |
| d = pq(r.text) | |
| q = d( | |
| '#js-pjax-container')( | |
| '.site-container.js-site-container')( | |
| '.container')( |
The first thing you should do is set the username Mercurial will use for commits. It's best to configure a proper email address in ~/.hgrc (or on a Windows system in %USERPROFILE%\Mercurial.ini) by creating it and adding lines like the following:
[ui]
username = John Doe <john@example.com>
[auth]
bb.prefix = https://bitbucket.org/foo/