An “obvious” improvement

It’s been a long time since I felt such satisfaction debuging something so I decided to write about it. Let’s assume that you need to store (cache) in memory a large object tree during some operations. In practice this happens because some regulatory constraints so you end up having to parse a very large file and store the resulting object tree. Actually you have a single entry cache. You parse your object, store it in memory for search and processing while the current object tree is used....

October 20, 2017 · len

Remove old kernels

for i in $(dpkg --list | grep linux-image | cut -c5-48 | grep -v $(uname -r) | grep -v linux-image-generic); do apt-get remove --purge -y $i; done

May 28, 2017 · len

Java SAML2 + simplesamlphp

The use case is as follows: the java application (SP) must use simplesamlphp as an IdP. I tested 2 libraries, these are the required configs. SimpleSAMLphp Please note that the default install from ubuntu (16.04.2) of simplesamlphp (14.0) does not work with the php version installed (php7) because of this bug so I ended installing everything from the tar.gz provided (14.14). Onelogin This is the first library I tested. To install it:...

May 24, 2017 · len

Simple pomodoro script

This is a very basic pomodoro script I am using to avoid getting in a fixed position for hours at a time: <pre lang="shell"> #!/bin/bash UNIT=5 UNIT_CNT=5 PAUSE=6 notify-send -i clock "Starting interval..." for i in $(seq $UNIT_CNT); do sleep ${UNIT}m let c=$i*$UNIT notify-send -i clock "$c minutes" done (for i in $(seq $PAUSE); do let c=$PAUSE-$i+1; echo -n "Pause ${c}m"; echo -e '\f'; sleep 1m; done; echo -e '\f'; echo "Work";) | sm -

December 22, 2016 · len

Simple hdmi activate script

This is a simple script I bound to ‘meta+F7’ to activate a second hdmi display I am using: <pre lang="shell"> INTERNAL=eDP1 EXTERNAL=HDMI2 LOCK=/tmp/${EXTERNAL}.on disper -l | grep $EXTERNAL function on { disper -e -d $INTERNAL,$EXTERNAL -r 1920x1080,1920x1080 touch $LOCK } function off { disper -s -d $INTERNAL -r auto rm -f $LOCK } if [ $? -eq 1 ]; then #there is no EXTERNAL, run single command off elif [ -f $LOCK ]; then off else on fi

December 22, 2016 · len

The dark side of the force

I have been spending a lot of time lately working on a new javascript based interface. As with any js project we ended up with a lot of layers. For instance for a simple numeric input there are: the html input the kendo numerictextbox the aurelia-kendo-bridge wrapper our own wrapper to allow for some level of DRY The fun part is that we needed of course some functionality which did not existed in the kendo component (adding support for financial shortcuts: 10k => 10,000)....

December 22, 2016 · len

A few thoughts about http fetch

Fetch is the “de facto” standard now if building a new javascript code. Even if not yet supported by all browsers it is warmly recommended. There are numerous examples of usage but after reading a lot of them most of them seemed to miss the answer to my questions. These where: how to proper do error handling including having a default error handler which can be overriden how to do http POST?...

December 22, 2016 · len

Dynamic Aurelia

From someone used to developing in a “traditional” way, switching to a javascript framework is like crossing over to a different universe where the laws of physics do not really apply. They might seem similar but they’re not. Take inheritance for instance, the foundation stone of OOP and throw it down the drain. No more inheritance, everything is composition right now. Yet in time you will learn the new laws and adapt....

September 9, 2016 · len

Update NumericTextBox precision on the fly

As currency selection changed you naturally want to change the precision and format of a NumericTextBox which contains an amount in the given currency (damn JPY for not using the same precision as everyone else). At a first glance one might think this can be accomplished using computed properties and something like: <pre lang="javascript"> @bindable precision:number = 2; @computedFrom('precision') get step():number { return Math.pow(10, - this.precision); } @computedFrom('precision') get format():string { return "n" + this....

August 23, 2016 · len

Dispatch change events in custom components

This is the first post about Aurelia and the Kendo-UI-Bridge. It’s a brave new world for me. The goal was to create a custom component (which wraps a ak-combobox) and dispatch a change event in a similar way to the standard components (i.e ak-combobox, ak-datepicker, etc.). <pre lang="html"> <input ak-datepicker="k-value.two-way: model.date" k-on-change.delegate="onChange($event)"></input> For these components, the change event is dispatched after the model changes. In my component code I had initially wrapped the k-on-change from the base component and continued dispatching it....

August 10, 2016 · len