How to send short text messages from your U8 smartwatch

android smartwatch tasker u8

With this entry I should gain a mention from U8 boss, whoever he is.

It's a shame that the wrist dialer can transmit to the phone only ~ 40 numbers, otherwise all this stuff could be even more cool. But first things first...

Some one told you that your cheap and stupid smartwatch can't send text messages?

Well, he was wrong! At least a bit wrong. Actually you can send very short text messages from your wrist and here I'll tell ...

read the full post

U8 smartwatch - Calculator App - Proof of Concept

android smartwatch tasker u8

This is a proof of concept of how we can develop a simple calculator app (basic operations over two numbers) for the U8 smartwatch taking advantage from the tasker+notification method described in my prevoius post. Read the "How to get the best of your U8 smartwatch" entry before going on if you've not done it yet.

Your Smartwatch Loves Tasker!

Since the whole post series about U8 smartwatch and tasker had a good following, I decided to ...

read the full post

Serve private media with angular, DRF, CORS and token authentication

angularjs django drf rest

A long time has passed since my last post, I was fighting hard with a project learning django REST framework and angularjs, and now time has come to share some interesting knowledges.

This entry talks about serving private media from a django REST webservice, developed with django REST framework, to angularjs, in a scenario which uses a token authentication schema and CORS requests.

The problems to face

Let's see the problems we have to deal with.

  • Media with django are normally served directly by the web server, so they are out of the authentication/permission logic of the application
  • The token authentication schema needs every request to contain an header 'Authentication' part providing the token key (also when requesting files ...

read the full post

Decorators with Python

decorator patterns python

Decorators in python can be quite easy to use and understand, but flexible decorators using the new syntax introduced by python 2.4 can be a bit more complex.

Here I'll try to explain (especially to myself) the world of decorators in python, starting from simple cases and ending with complex ones. Ideas and notions taken from the Pro Django book by Marty Alchin.

Decorators without extra arguments

Let's create a simple cache decorator you can use to store complex operations:

>>> def cache(func):
...   cache_dict = {}
...   def wrapper(*args, **kwargs):
...     key = '%s-%s' % (repr(args), repr(kwargs))
...     if key not in cache_dict:
...       cache_dict[key] = func(*args, **kwargs)
...       print 'cached'
...     return cache_dict[key]
...   return wrapper

A simple decorator function takes ...

read the full post

Python's excess arguments

programming python

What I've always really appreciated of python is the ability to give a function an arbitrary number of positional and keyword arguments, something that in PHP is not possible and is indeed very powerful.

When declaring a function, we can define 4 different types of arguments:

  • required arguments
  • optional arguments (a default is provided)
  • excess positional arguments
  • excess keyword arguments

for example:

def myfunc(a, b=3, *c, **d)
  • a is a required argument
  • b is an optional one since it's default value it's 3
  • the single asterisk before the c argument allows the function to accept any number of positional arguments
  • the two asterisks before the d argument allow the function to support arbitrary kewyword arguments

The order of ...

read the full post

How to get the best of your U8 smartwatch

android smartwatch tasker u8

Yesterday my new U8 smartwatch arrived to me after a long trip around the world.
I'm happy with it, ok it is not as smart as the samsung gear or the sony smartwatch, but it's a super cheap product and you can't expect too much from it.

Nevertheless it has some nice functionalities:

  • receive and make calls from your watch
  • receive phone notifications
  • control your camera and take photos
  • sync your phonebook and call log
  • play music
  • anti lost feature
  • barometer, altimeter and pedometer

Wow, but it's not my intention to talk here about such things, there are trillions of youtube videos reviewing them on youtube.

Here I want to deepen how we can use two of such functions in ...

read the full post

How to exclude choices of m2m raw_id_field in django admin

django programming django-admin

This procedure took a lot of effort to be understood, but now it seems quite easy.


Imagine we need to create a recursive m2m relationship, something like a "related posts" field assigned to a Post model. It would be nice if we could exclude the current editing post from the available choices.

This is quite straightforward if we go with the default select multiple widget. In fact we only need to create a custom form class and override the queryset property of the related_posts field in the __init__ function, excluding the id of the current instance, and then assign such form class in the ModelAdmin class, see this SO question for more info.

But things become more ...

read the full post

Lightscribe on ubuntu 14.04 64-bit, what worked for me

lightscribe linux

Lightscribe technology is cool, but almost noone uses it. Actually it can be hard also to find writable disks,  at least in Italy.

I think this is the reason why having this technology working in ubuntu 64-bit can be a mess. You may find some discussions about the installation of the necessary software, but it seems that there isn't a "widely working" solution, so let's add another "worked for me" solution.

Install the ia32-libs

This package contains runtime libraries for the ia32/i386 architecture, configured for use on an ...

read the full post

Pretty raw_id_fields with django-salmonella and django-grappelli

django django-admin programming tips grappelli

Sometimes, when dealing with m2m relationships, we need to use the raw_id_fields property of the ModelAdmin class, in order to choose the related objects in a new page, where we can sort and filter the available items.

Without doubt the information that the widget used by django to treat such fields gives us is a bit poor. We only see the related objects's ids, it would be nicer to have the string representation of the object.

Here comes django-salmonella:

A raw_id_fields widget replacement that handles display of an object's string ...

read the full post

Responsive menu for bootstrap

bootstrap css3 javascript jquery

This is a nice one.

Bootstrap is a nice framework, the great advantage of using it is that it saves you a lot of time while building a responsive web site (the same can be said of other css frameworks out there).
The drawback is that the web sites coming out in the last years very often looks the same, all of them have the same navbar and the same menu behavior which collapses for extra-small devices, showing a menu button which reveals the content when pressed.

A good way to differentiate your web site from the others could be a change in the menu collapsing behavior.

Datmenu is a nice responsive menu plugin for Wordpress, so the idea is ...

read the full post

Your Smartwatch Loves Tasker!

Your Smartwatch Loves Tasker!

Now available for purchase!