Charles Bueche


Auto-vivification in Python 3.x

Are you spoiled by Perl’s auto-vivification allowing to write such code and you want to do the same in Python ? An often used, somewhat ugly code pattern where you need to add a key in a dict when it’s not there yet: There is a better way since Python 3.3 (even if Perl’s type […]


auto-upgrade pip in Ansible role/task

Lets say you have an Ansible role in which you create a virtual-environment using Python 3.x: – name: Install python venv and requirements environment: http_proxy: http://proxy.domain.com:8080 https_proxy: http://proxy.domain.com:8080 HTTP_PROXY: http://proxy.domain.com:8080 HTTPS_PROXY: http://proxy.domain.com:8080 pip: extra_args: ‘–trusted-host pypi.python.org’ requirements: /path/to/requirements.txt virtualenv: /path/to/venv virtualenv_command: /opt/python-3.7.0/bin/python3.7 -m venv If your requirements.txt only contains the modules you really need for […]


returning JSON from a view in CakePHP 1.1

I know CakePHP 3.5 is out, and before CakePHP 2.x and even before CakePHP 1.3 allowed to render JSON easily. But suppose you have a large code-base in CakePHP 1.1 you have to maintain, and suddenly someone wants JSON out of it… If upgrading your CakePHP version is possible, do it. Else, consider the code […]


lambdatrail hardware

Monitoring DeltaNet Lambdatrail WDM devices

DeltaNet has cool WDM products that one of our customer has deployed in a life-cycle project for a large WAN. In collaboration with the DeltaNet engineer, I have implemented a Zenoss ZenPack to monitor the specifics of their Lambdatrail XWDM multiplexers. The ZenPack provide these features: devices located under their own device class collect all […]