Use DigitalOcean as Dynamic DNS
I have a server at my home on which I host various test projects and I needed a dynamic DNS service as my ISP assigns me an IP dynamically. Tried some dynamic DNS services, but their domain names tend to get long, and I don’t like typing URLS. So I decided to buy a domain and handle the DNS update myself.
»Disable Margin Collapse in CSS with No Visual Impact
When working with CSS you sometimes have to work around a behaviour known as margin collapsing. Basically, the top/bottom margin of two neighboring block elements will be set to the biggest margin value in-between the two elements, if their top/bottom margins are adjacent and no text, clearance, padding nor border separate them.
»How to Set a Variable in Django Template
As you may have figured by now, Django does not implement such a feature. That is, because the logic of setting the variable must go in the view, not in the template. But there are some rare cases when you actually need this.
»Capture the Output of a Django Command
The documentation is very slim when it talks about how to call a Django command from code. In order to do this, just use call_command
. To solve the trick of capturing the output of this I had to dig a little into the Django source.
Make LineString Resolution Depend on Zoom Level in OpenLayers
So, you want to render a route on your OpenLayers map. Everything will be nice and sweet until you’ll have to render a huge route, in which case no matter what computer your clients have, most probably it will stall. To solve this you have two possibilities: you either reduce the number of lines you send from the server or you reduce the number of points rendered directly on the client’s browser.
»