Menu

The Ubuntu 18.10 release is short term supported release, meaning that it will receive updates for nine months until 19.04 version. To upgrade in graphical mode open Software & Updates application, navigate to Updates tab and in the Notify me of a new Ubuntu version menu choose For any new version. Then launch Software Updated which should propose upgrading. The rest of upgrading process is guided, and basically self explaining.

Upgrading to new release of system might result in some system changes, software removal or in worst case make system unusable at all. But not in the case of updating Desktop Ubuntu from 18.04 to 18.10 which ran smoothly. There were over 1000 packages updated, very few removed - of which none were actual program, some libraries. During update there were few questions about modified config files for NGINX and X configuration. These could be avoided if the configuration were placed in different files.  Even having 26 custom PPA's did not trigger any software removal. Some PPA's were already update to cosmic release, I've enabled them automatically in a same fashion same as in previous post about updating. Then ran apt update and apt upgrade commands pair to fetch and install latest versions from custom PPA's. Upgrading to next release does disable PPA's, maybe at some day developers will add automatic enabling too:)

Knockout JS offers manual subscribing to observables, so that arbitrary code can be executed whether the observable value changes. This might be useful to update user interface when value changes, or to perform AJAX requests based on value of observable. For instance filters can be implemented, which will pull new data according to observable value. 

When using bare KnockoutJS the observable itself is object having method subscribe. Example of subscribing in bare KO:

app.model.filter.active.subscribe(function(newValue) {
    console.log("Perform AJAX request with: " + newValue);
});

However, when using EcmaScript 5 plugin, which allows using observables without parenthesis, the subscribe method is not available. The value of active field would appear as a plain JavaScript type, for instance boolean value. Luckily the KO have the method to obtain real observable with ko.getObservable where first parameter is view model, the latter one is observable name. The resulting code is a bit different that that from the bare KnockoutJS in terms of getting access to subscribe method:

ko.getObservable(app.model.filter, 'active').subscribe(function(newValue) {
    console.log("Perform AJAX request with: " + newValue);
});

When added explicit subscription with method above, just setting model value would execute function passed to subscribe method:

app.model.filter.active = true;
// console logs: Perform AJAX request with: true

From some time, PHP offers closures called also anonymous functions. The anonymous function works somewhat different than JavaScript equivalent. In JavaScript all variables are available in closure if they are defined in same scope as closure. Let's make an example in JavaScript, so that will be a bit cleaner:

// Variable $name is *outer* for $greet function
var $name = 'Joe';
var $greet = function() {
    console.log($name); // $name is `Joe` here.
}

In PHP however, these outer variables are not automatically available in function. In fact these variables are copied (with exception to objects), just like when passing variable as function argument. They need to be passed with use keyword. Equivalent in PHP:

// Variable $name is *outer* for $greet function
$name = 'Joe';
$greet = function() use ($name) {
    echo $name; // $name is `Joe` here.
}

When using our favorite IDE, we usually have option to find all implementations of interface. This gives us overview of available classes that can do certain operations or have certain purpose. When developing modular application the new types might appear when we install additional dependencies. As well some implementations - through less common - could possibly disappear on dependency upgrade. We have developers tools to to keep our applications up to date to our or external vendor dependencies. But, hey we are developers who do not like to track manually all changes, as it's error prone and tedious. For instance if we have some notification interface and bunch of notifiers. At some point we need to collect those notifiers and notify with them about our application action. The other example might product interface indicating that class represents some kind of product in our system. Then when creating new product, we've had to choose which one from the list of all implementations of product interface. To avoid hardcoding such list of available implementations we could use configuration file to set up all available options. But that's in fact hardcoding configuration, as it would likely be committed with code.