Posts

  • Mobile phone reviews

    Mobile phones I had owned in the past: Nexus 4 4/5 Great in most ways, the only problem it had is the lack of support for external memory. Moto G2 4/5 Greats in most ways, but slightly underpowered and no notification led. Moto G3

  • Django isnullfield admin filter

    Made for django 1.11, based on the BooleanFieldListFilter

    class IsNullFieldListFilter(FieldListFilter):
        def __init__(self, field, request, params, model, model_admin, field_path):
            self.lookup_kwarg = '%s__isnull' % field_path
            self.lookup_remove = '%s__exact' % field_path
            self.lookup_val = request.GET.get(self.lookup_kwarg)
            super().__init__(field, request, params, model, model_admin, field_path)
            if (self.used_parameters and self.lookup_kwarg in self.used_parameters and
                    self.used_parameters[self.lookup_kwarg] in ('1', '0')):
                self.used_parameters[self.lookup_kwarg] = bool(int(self.used_parameters[self.lookup_kwarg]))
    
        def expected_parameters(self):
            return [self.lookup_kwarg]
    
        def choices(self, changelist):
            for lookup, title in (
                    (None, 'All'),
                    ('1', 'No'),
                    ('0', 'Yes')):
    
                yield {
                    'selected': self.lookup_val == lookup,
                    'query_string': changelist.get_query_string({self.lookup_kwarg: lookup,}, remove=[self.lookup_remove]),
                    'display': title,
                }

  • Linux Acer one s1003 D16H1

    This post describes how to install linux on a Acer One. There are some things that don’t work yet and some others that require some work Distributions uefi 32 only. Only debian 32 and multiarch seem to work fine. The system itself is 64bit Tried and failed: ubuntu 32...

  • Git notes

    Diff to the common ancestor (like github and bitbucket)

       git diff master... < common ancestor
    

    Merge but always resolve towards the branch merging in

    git merge –strategy-option theirs master

  • How to make code more reliable

    There are a few techniques to make code more reliable: Contracts It is a set of pre and postconditions attached to functions or types, which can be functions themselves. They might be enforced both at compile and execution time, or by external tools against the code See: ADA implementation...

  • OPML

    I was playing with the OPML format so I can have an open list of RSS feeds.

    I found Akregator for the desktop, and sparse-rss through f-droid for the phone. Both open source

  • Parser classification

    Recursive descent parser Left to right Calls a recursive function with a slice of the input and a symbol, trying all productions, until a terminal symbol is reached. At that point, the input is compared with the terminal symbol. If there is a match, the previous recursion receives...

  • Implementing Domain-driven Design

    Implementing Domain-driven Design by Vaughn Vernon Following DDD by Eric Evans, Implementing Domain-driven design attempts a more pragmatic style on the same topic. One of the advantages of this book is that it highlights the importance of bounded context/subdomains earlier and more deeply than the original book. However, the...

  • Domain Driven Design

    Domain Driven Design by Eric Evans Domain Driven Design is a set of concepts and paradigms invented by Eric Evans, and converted into a book. I own a digital copy of it, and I find it one of the most useful paradigms for development. The basic idea is that...

  • How to make bad code

    A function is named after the caller rather than what it does The name of a function represents its contents, no where it is used def calculate_score_for_table(a, b): return sqrt(a**2 +...

  • Practical Vim

    I have bought Practical Vim by Drew Neil. The book is really solid and to the point, it feels like a short reference for vim with loads on effort on what can be done. It is a good book to open at random and read about something new, and...

  • Domain Driven Design in python

    This is a collection of notes specific to Domain driven design when implemented with python. The structure I have followed is the same than in the main DDD book by Eric Evans. The building blocks of Model driven design Isolating the domain In the context of the layer...

  • Dumping json from django preserving order and indentation

    In python3 the hash function is randomized by default, hence the need to set the hashseed to 0.

    PYTHONHASHSEED=0 python manage.py dumpdata --indent 2
    

  • name: Copy user keys authorized_key: exclusive=yes user= state=present key=” " become: yes tags: keys

  • Python 2 to Python 3

    Part of my work in different companies has been about the transition fromp python2 to python3 print This is the most obvious point of conflict. The old print “string” doesn’t work anymore. print "abc" vs print(abc) New modules and classes...

  • How to spot fake news

    The source is defined exists, its role is defined, it is directly connected to the topic, doesn’t make money on its opinion The article is easy to read, and the headline refers to the actual content The article is not plain false from the title The article doesn’t tell...

  • Organizing ten years of code

    I’m populating the snippet repository with all the random crap I can find in my hard disk which is mostly abandoned projects and university stuff.

  • First tyre puncture in my life

    Yesterday First tyre puncture in my life Today First puncture repair in my life

  • DSLs and Towers of Abstraction with Gershom Bazerman at NY Haskell

    https://vimeo.com/72870861 (also reddit link)

  • Introduction to Parsley

    Worry-Free Parsers with Parsley by Allen Short introduces PEGs and Parsley implementation

  • git branch model

    When googling “git branch model”, this is the first entry. It is very close to what we do at iwoca. In pydsl I don’t use a development branch; I just use master and feature branches, merging them whenever they are ready. The more I use git, the more...

  • MongoDB verification

    As many other IT startups, we are using mongodb at iwoca. Mongo is a database that belongs to the NoSQL family. It stores documents in BSON format (a slightly enhanced binary version of JSON) without enforcing any structure. Mongo interacts very well with dynamic languages like Python; BSON objects...

  • Internal DSL vs External DSL

    #Internal vs External DSLs When creating DSLs from a programming languages, there are two ways of implementing it: Internal and External. Implementing an External DSL implies creating the code for all the steps: Lexer -> Parser -> ASTTranslator (Frontend) -> Interpreter/Output/Bytecode (Backend) An internal (embedded) DSL...