Quick tip: Draw border on the inside of an element using CSS

One way that you can draw a border on the inside of an HTML element rather than on the outside is to use the box-sizing CSS property. This is supported on Firefox, Chrome, Safari, Opera and IE8+. Read the full article ...

Really disable the cross site request forgery (csrf) middleware in Django

So I said “No problem, I’ll just remove the csrf middleware”. Apparently, this doesn’t cut it for the already built applications that come from Django, like the Auth application. Read the full article ...

Add your extension’s toolbar button to Firefox at first run

The problem that most of the extensions have, is to place the toolbar button on a toolbar by default, so the users will see it. The fix for this problem is that, at first run of your extension, it should place the button on a toolbar that Firefox has by default. Read the full article ...

Custom JavaScript events

So, you want to trigger an event when something happens in you javascript code? There might be better ways to do it, but here is the solution that I use for my code which is pretty light and easy to understand. Read the full article ...

How to minify HTML output in Django

So, you want to compress the size of the HTML that Django generates? Here is the Django way to do it.

In order to do this, you’ll have to write a middleware for your application. Read the full article ...

How to set a variable in Django template

So, you need for some reason to set a variable inside a 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. Read the full article ...

Quicktip: capture the output of a Django command

So, you want to programmatically call a Django command, and then capture it’s output? The documentation is very slim when it talks about how to call a Django command from code. To call a Django command from code it’s easy: just use call_command. To solve the trick of capturing the output of this I had to dig a little intro the Django source. Read the full article ...

Fix fieldset background color in Internet Explorer

So, you like Internet Explorer ? Me neither. Oh, don’t get me started… But sometimes we need to ship pages with support for Internet Explorer because there are still people out there to lazy to install a proper web browser.

Because of this, I decided to start an article series on fixing some everyday, more or less complicated, Internet Explorer issues. For the first article, I’ve chosen a very popular problem: changing the background color of fieldsets in Internet Explorer. As you may know, as soon as you change the color of the fieldset’s background, you’ll see that the color of the background will bleed at the top of the fieldset Read the full article ...

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.

Both solutions will raise a problem: if the user will zoom deep enough, they will see a discrepancy between the route and the road (the number of points in the route will not be equal with the number of point on the road). So, the round may do a turn where your route plotting will just cut the corner. To solve this, I found a very adaptive solution that will reduce the number of point in your route the further you zoom out. Read the full article ...