bl

A Scramble for Virus Apps That Do No Harm

Dozens of tracking apps for smartphones are being used or developed to help contain the coronavirus pandemic. But there are worries about privacy and hastily written software.




bl

TinyCDN: a portable blazing fast CDN

In this blog post I am introducing tinyCDN, a middle-ware module and a standalone static file server that does much more than others, and it has been designed from the scratch to work on most constrained, Internet of Things, environments, as well as production server.




bl

On Cancelable Promises

Update
The awesome Lie function got improved and became an official module (yet 30 lines of code thought). Its name is Dodgy, and it's tested and even more awesome!


Ifeverydevelopertalksaboutsimilarissues with Promises, maybe we should just drop our "religion" for an instant and meditate about it ...

Not today though, today is just fine

We've been demanding from JS and Web standards to give us lower level APIs and "cut the crap", but we can do even more than that: simply solve our own problems whenever we need, and "cut our own crap" by ourselves and for our own profit, instead of keep moaning without an outcome.
Today, after reading yet another rant about what's missing in current Promise specification, I've decided to write a very simple gist:


After so many discussions and bikeshead about this topic, I believe above gist simply packs in its simplicity all good and eventually bad intents from any voice of the chorus I've heard so far:
  1. if we are in charge of creating the Promise, we are the only one that could possibly make it abortable and only if we want to, it's an opt in rather than a default or a "boring to write" subclass
  2. it's widely agreed that cancellation should be rather synonymous of a rejection, there's no forever pending issue there, just a plain simple rejection
  3. one of the Promise strength is its private scope callback, which is inevitably the only place where defining abortability would make sense. Take a request, a timer, an event handler defined inside that callback, where else would you provide the ability to explicitly abort and cleanup the behavior if not there?
  4. being the callback the best pace to resolve, reject, and optionally to abort, that's also the very same place we want to be sure that if there was a reason to abort we can pass it along the rejection, so that we could simply ignore it in our optionally abort aware Promises, and yet drop out from any other in the chain whenever the rejection occurs or it's simply ignored
  5. the moment we make the promise malleable from the outer world through a p.abort() ability, is also the very same moment we could just decide to resolve, or fully fail the promise via p.resolve(value) or p.reject(error)
As example, and shown in the gist itself, this is how we could opt in:

var p = new Lie(function (resolve, reject, onAbort) {
var timeout = setTimeout(resolve, 1000, 'OK');
// invoking onAbort will explicit our intent to opt-in
onAbort(function () {
clearTimeout(timeout);
return 'aborted'; // will be used as rejected error
// it could even be undefined
// so it's easier to distinguish
// between real errors and aborts
});
});
After that, we can p.abort() or try other resolve or reject options with that p instance and track it's faith:

p.then(
console.log.bind(console),
console.warn.bind(console)
).catch(
console.error.bind(console)
);
Cool, uh? We have full control as developers who created that promise, and we can rule it as much as we like when it's needed ... evil-laugh-meme-here

Cooperative code

In case you are wondering what's the main reason I've called it Lie in the first place, it's not because a rejected Promise can be considered a lie, simply because its behavior is not actually the one defined by default per each Promise.
Fair enough for the name I hope, the problem might appear when we'd like to ensure our special abortable, resolvable, rejectable own Promise, shouldn't be passed around as such. Here the infinite amount of logic needed in order to solve this problem once for all:

var toTheOuterWorld = p.then(
function (data) {return data},
function (error) {return error}
);
// or even ...
var toTheOuterWorld = Promise.resolve(p);
That's absolutely it, really! The moment we'd like to pass our special Promise around and we don't want any other code to be able to mess with our abortability, we can simply pass a chained Promise, 'cause that's what every Promise is about: how cool is that?

// abortable promise
var cancelable = new Lie(function (r, e, a) {
var t = setTimeout(r, 5000, 'all good');
a(function () { clearTimeout(t); });
});

// testing purpose, will it resolve or not?
setTimeout(cancelable.reject, 1000, 'nope');
// and what if we abort before?
setTimeout(cancelable.abort, 750);



// generic promise, let's log what happens
var derived = cancelable.then(
function (result) { console.log('resolved', result); },
function (error) { error ?
console.warn('rejected', error) :
console.log('ignoring the .abort() call');
}
).catch(
function (error) { console.error('cought', error); }
);

// being just a Promise, no method will be exposed
console.log(
derived.resolve,
derived.reject,
derived.abort
);

Moaaar lies

If your hands are so dirty that you're trying to solve abort-ability down the chain, don't worry, I've got you covered!

Lie.more = function more(lie) {
function wrap(previous) {
return function () {
var l = previous.apply(lie, arguments);
l.resolve = lie.resolve; // optional bonus
l.reject = lie.reject; // optional bonus
l.abort = lie.abort;
return Lie.more(l);
};
}
if (lie.abort) {
lie.then = wrap(lie.then);
lie.catch = wrap(lie.catch);
}
return lie;
};
We can now chain any lie we want and abort them at any point in time, how cool is that?

var chainedLie = new Lie(function (res, rej, onAbort) {
var t = setTimeout(res, 1000, 'OK');
onAbort(function (why) {
clearTimeout(t);
return why;
});
})
.then(
console.log.bind(console),
console.warn.bind(console)
)
.catch(
console.error.bind(console)
);

// check this out
chainedLie.abort('because');
Good, if you need anything else you know where to find me ;-)
How to opt out from lies again?

var justPromise = Promise.resolve(chainedLie);
OK then, we've really solved our day, isn't it?!

As Summary

Promises are by definition the returned or failed value from the future, and there's no room for any abort or manually resolved or rejected operation in there.
... and suddenly we remind ourselves we use software to solve our problems, not to create more, so if we can actually move on with this issue that doesn't really block anyone from creating the very same simple logic I've put in place in about 20 well indented standard lines, plus extra optional 16 for the chainable thingy ... so what are we complaining about or why do even call ourselves developers if we get stuck for such little effort?
Let's fell and be free and pick wisely our own footgun once we've understood how bad it could be, and let's try to never let some standard block our daily job: we are all hackers, after all, aren't we?




bl

new JS book finally published

Not exactly the technical book I've half written already and mentioned last year, put on a garage until few things change in the current ECMAScript specification, yet I've manged to finally publish my JavaScript glossary on demand.

I've written a whole blog post about it, and I can't wait to know your opinions!




bl

Ecotourism's promise and peril: a biological evaluation / Daniel T. Blumstein, Benjamin Geffroy, Diogo S. M. Samia, Eduardo Bessa, editors

Online Resource




bl

Sustainable tourism on a finite planet: environmental, business and policy solutions / Megan Epler Wood

Dewey Library - G156.5.S87 E64 2017




bl

Basic Principles of Topography by Blagoja Markoski

Online Resource




bl

New lines: critical GIS and the trouble of the map / Matthew W. Wilson

Rotch Library - G70.212.W55 2017




bl

Tourism, Territory and Sustainable Development: Theoretical Foundations and Empirical Applications in Japan and Europe / João Romão

Online Resource




bl

Tangible modeling with open source GIS / Anna Petrasova, Brendan Harmon, Vaclav Petras, Payam Tabrizian, Helena Mitasova

Online Resource




bl

Graphisch-statistischer Atlas der Schweiz / herausgegeben vom Statistischen Bureau des eidg. Departements des Innern = Atlas graphique et statistique de la Suisse / publié par le Bureau de statistique du Département fédéral de l'i

Hayden Library - G1896.E24 G46 1897a




bl

The phantom atlas: the greatest myths, lies and blunders on maps / Edward Brooke-Hitching

Rotch Library - GA108.7.B76 2018




bl

Feasible management of archaeological heritage sites open to tourism / Douglas C. Comer, Annemarie Willems, editors

Online Resource




bl

Geospatial Analysis of Public Health

Online Resource




bl

The news at the ends of the earth: the print culture of polar exploration / Hester Blum

Online Resource




bl

Earth observations and geospatial science in service of sustainable development goals: 12th International Conference of the African Association of Remote Sensing and the Environment / Souleye Wade, editor

Online Resource




bl

Tourism in emerging economies: the way we green, sustainable, and healthy / Wei-Ta Fang

Online Resource




bl

Sensors and Systems for Space Applications IX: 18-19 April 2016, Baltimore, Maryland, United States / Khanh D. Pham, Genshe Chen, editors ; sponsored and published by SPIE

Online Resource




bl

Algorithms and Technologies for Multispectral, Hyperspectral, and Ultraspectral Imagery XXII: 18-21 April 2016, Baltimore, Maryland, United States / Miguel Velez-Reyes, David W. Messinger, editors ; sponsored and published by SPIE

Online Resource




bl

The Palgrave handbook of organizational change thinkers edited by David B. Szabla, William A. Pasmore, Mary A. Barnes, Asha N. Gipson

Online Resource




bl

Putting design thinking to work: how large organizations can embrace messy institutions to tackle wicked problems / Steven Ney, Christoph Meinel

Online Resource




bl

Encyclopedia of sustainable management edited by Samuel Idowu, René Schmidpeter, Nicholas Capaldi, Liangrong Zu, Mara Del Baldo, Rute Abreu

Online Resource




bl

The indestructible brand: crisis management in the age of social media / Venke Sharma and Hushidar Kharas

Online Resource




bl

Rethinking strategic management: sustainable strategizing for positive impact / Thomas Wunder, editor

Online Resource




bl

The lean strategy: using lean to create competitive advantage, unleash innovation, and deliver sustainable growth / Michael Ballé, Daniel Jones, Jacques Chaize, Orest Fiume

Dewey Library - HD58.9.B35 2017




bl

The corporate startup: how established companies can develop successful innovation ecosystems / Tendayi Viki, Dan Toma, Esther Gons ; editor Rachel Faulkner

Dewey Library - HD53.V55 2017




bl

Resilient organizations: responsible leadership in times of uncertainty / Guia Beatrice Pirotti and Markus Venzin

Dewey Library - HD30.28.P524 2017




bl

Sustainable Innovation: Trends in Marketing and Management / Anshu Saxena Arora, Sabine Bacouel-Jentjens, Mohamad Sepehri, Amit Arora, editors

Online Resource




bl

Sustainable Logistics and Production in Industry 4. 0: New Opportunities and Challenges / Katarzyna Grzybowska, Anjali Awasthi, Rapinder Sawhney, editors

Online Resource




bl

Hybrid Virtual Teams in Shared Services Organizations: Practices to Overcome the Cooperation Problem / Thomas Afflerbach

Online Resource




bl

Crises, inquiries and the politics of blame / Sandra L. Resodihardjo

Online Resource




bl

Lean transformation: cultural enablers and enterprise alignment / Suresh Patel

Online Resource




bl

Learning with Lean: unleashing the potential for sustainable competitive advantage / James Zurn, Perry Mulligan

Online Resource




bl

Management dilemmas: the theory of constraints approach to problem identification and solutions / Eli Schragenheim

Online Resource




bl

Responsible innovation: business opportunities and strategies for implementation / Katharina Jarmai, editor

Online Resource




bl

Corporate social responsibility in developing and emerging markets: institutions, actors and sustainable development / edited by Onyeka Osuji, University of Essex Law School, Franklin N. Ngwu, Lagos Business School, Pan-Atlantic University (Nigeria), Dima

Dewey Library - HD60.5.D44 C674 2020




bl

Whistleblowing: toward a new theory / Kate Kenny

Dewey Library - HD60.K4822 2019




bl

Sustainable business performance and risk management: risk assessment tools in the context of business risk levels related to threats and opportunities / Ruxandra Maria Bejinariu

Online Resource




bl

Family Businesses' Growth: Unpacking the Black Box / by Laura K.C. Seibold

Online Resource




bl

Return on investment in corporate responsibility: measuring the social, economic, and environmental value of sustainable business / by Cesar Sáenz

Dewey Library - HD60.S223 2018




bl

Subir Roy: Why merge public sector banks?

Merger is about the only solution that the government seems to be capable of thinking up in seeking to get the PSBs into some degree of health




bl

Irresistible : why we can't stop checking, scrolling, clicking and watching / Adam Alter

Alter, Adam L., 1980- author




bl

Blake’s 7 (Television program)




bl

Blake's 7 (Television program)




bl

Blake’s 7 (Television program)




bl

Blake’s 7 (Television program)




bl

The intersectional Internet : race, sex, class and culture online / edited by Safiya Umoja Noble and Brendesha M. Tynes




bl

Outnumbered : from Facebook and Google to fake news and filter-bubbles -- the algorithms that control our lives / David Sumpter

Sumpter, David J. T., 1973- author




bl

Bible and cinema : an introduction / Adele Reinhartz

Reinhartz, Adele, 1953- author




bl

Close encounters between Bible and film : an interdisciplinary engagement / edited by Laura Copier and Caroline Vander Stichele