ETag magic with Django
An ETag is a feature of HTTP that allows for a web server to know if content has changed since the last time the browser visited the page. The client sends the ETag from the cached page in a header. If the ETag in the header matches the current ETag then the server lets the browser know that the cached is up-to-date by sending back a 304 Not Modified response.
Making tileable images with Python
Here's an interesting bit of Python code I hacked together – it's a script that takes an image and warps it so that it is tileable (making it suitable for a repeating backgound or a texture in a game).
If you use it on a photograph, it will come out looking like a fair-ground mirror. But it works well when applied to a pattern, or something more abstract, such as the fractal image on the left.
The code is public domain – use it for whatever the heck you want!
Python Job Alert
My employer is looking for a new Python developer to work here in Oxford, UK. The company I work for runs 2degreesnetwork.com, which is collaboration service for sustainable business. Basically, it's a social networking type of site for businesses to collaborate on climate change and related issues. I'm not officially allowed to say this, but the closest analogy is ‘Facebook for Businesses’.
I take it back, this is the most inneficient code ever
Here's the most convoluted “Hello World!” script I could come up with (in response to this). I don't know if it works. I've proven it correct, but I haven't tested it.
from random import choice from itertools import count from zlib import crc32 import sys any(crc32(h)==472456355 and not sys.stdout.write(h) for h in(''.join(choice('! edHlorW')for _ in '.'*12)for _ in count()))
I promise my production code is (marginally) more readable this this…
-
4 posts
-
2 posts
-
1 post
-
1 post
-
4 posts
-
1 post
-
2 posts
-
8 posts
-
5 posts
-
2 posts
-
1 post
-
1 post
-
1 post
-
4 posts
-
5 posts
-
1 post
-
6 posts
-
8 posts
-
2 posts
-
4 posts
-
2 posts
-
13 posts
-
3 posts
-
6 posts
-
5 posts
-
13 posts
-
5 posts
-
2 posts