A note on Django 1.5.2 rotating CSRF token and frontend javascript applications
Django 1.5.2 introduced a change named The CSRF token now rotates when a user logs in. This isn't anything problematic for typical web applications where user submits a form and the page reloads. For applications that are based on JavaScript frameworks like ember (or angular) this becomes a problem, as the user is logged in the background with an AJAX request (for example with Facebook JS SDK) and the page in general never reloads. When he logs in the token changes and API (POST) requests (to django-rest-framework for example) will get forbidden as answers from the server.
A solution would be to return a new token with server response to the login request and insert it in the place of the old one, which was inserter when Django template was rendered:xhr.setRequestHeader("X-CSRFToken", "{{csrf_token}}");
Switching power with transistors, relays and microcontrollers
Simplest way to automate, control electronic devices is to turn them on or off with an electronic switch. We can find relays or transistors that when combined with a microcontroller board can switch power delivered to selected devices. In this article I'll showcase both components and examples of usage with pyMCU microcontroller.
Point Grey launches online store for EU customers
Point Grey have launched a eu.ptgreystore.com - online shop for European Union customers. Thanks to the new shop it's much easier to buy cameras in Europe and avoid custom duties and long shipping. You need to login to see the prices, like 249 EUR for ICX693 Blackfly camera.
Testing small external lenses for phones and other mobile devices
China can make quite interesting gadgets like for example external lenses for phones and other devices. They alter how the built-in lens works allowing for wide field, macro or telephoto effect. Some will even give you fish-eye ultra wide field effect. Such lenses cost few Euros and are quite basic in design. I'll take a look at two of them - 2x telephoto and macro/wide field lens.
django-ckeditor-updated released with Django 1.6 and storage API
django-ckeditor repository wasn't updated from a long time and a lot of issues collected. With the release of Django 1.6 django-ckeditor stopped working due to "defaults" in urls.py import. I've decided to polish and release my fork as a pypi package to make it easier to install the newer version. You can install it via pip using django-ckeditor-updated as name. Current version is 4.2.1.
Biggest change compared to the upstream is Django storage API usage for file uploads (to make it easier to configure and to allow using other backends than local folder - like S3 storage). Other updates give CKEditor 4.2.1 as well as Django 1.6 support (should also work on 1.4 and 1.5).
This application gives you the CKEditor on a model field in Django admin or in your forms. The editor can be configured (interface) and it can upload images (with the help of pillow).
Testing Point Grey Blackfly BFLY-PGE-05S2M-CS camera in planetary imaging
Point Grey Research launched some time ago a new line of cameras called Blackfly. They combine low cost with gigabit Ethernet interface. The first Blackfly model was equipped with quite popular e2v EV76C560 sensor. I've decided to test different model equipped with a new Sony CCD - ICX693. So I've got Blackfly BFLY-PGE-05S2M-CS for few weeks and started testing.
Quick and handy wheel package format for Python applications
Python packaging needs some help. A solution to at least some problems may be wheel - a new format for fast and efficient software installation and distribution. It's described in few PEPs and now it's starting to take shape. It was showcased recently on PyCon PL 2013.
There is nearly no wheels on pypi but we can use them locally to make local installations faster (handy for continuous integration systems and alike that build a project from scratch often).
Controlling electronic components with I2C bus communication and pyMCU
BlinkM is a tricolor LED board that uses I2C bus to communicate with a microcontroller. Also minipH and many other boards use this computer bus to communicate. Multiple microcontroller boards or single board computers support I2C - like Arduino, pyMCU, Raspberry Pi and others.
In this article I'll showcase how to use those two board with pyMCU, and some general I2C tips and tricks.
Controlling LED arrays with pyMCU microcontroller
LED arrays are quite popular and handy. You can make animated banners, panels displaying text or basic graphics. For a microcontroller turning a LED on and off isn't a problem. However if you would have 64 or more LEDs then it's not that easy. A solution for this problem are LED controllers. They reduce the number of pins needed to manage all the LEDs. Some of those controllers may also implement other features handy for text scrolling etc. In this article I'll showcase 8x8 LED array with MAX7219 controller.
Quick look at Allwinner A10 based pcDuino single board computer
pcDuino is one of may single board computers with ARM processor. This one combines relatively low price with some Arduino compatibility. Intended for electronic hacking it's bit more powerful than Raspberry Pi - at least in the specs. There are multiple similar boards in this price/features range so let us see how pcDuino will perform.