science and technology

Influence of nanomedicine mechanical properties on tumor targeting delivery

Chem. Soc. Rev., 2020, 49,2273-2290
DOI: 10.1039/C9CS00575G, Tutorial Review
Zheng Li, Chen Xiao, Tuying Yong, Zifu Li, Lu Gan, Xiangliang Yang
This tutorial review summarizes the influence of nanomedicine mechanical properties on drug delivery efficiency, antitumor efficacy and safety.
The content of this RSS Feed (c) The Royal Society of Chemistry




science and technology

Polyanion-type cathode materials for sodium-ion batteries

Chem. Soc. Rev., 2020, 49,2342-2377
DOI: 10.1039/C9CS00846B, Review Article
Ting Jin, Huangxu Li, Kunjie Zhu, Peng-Fei Wang, Pei Liu, Lifang Jiao
This review summarizes the recent progress and remaining challenges of polyanion-type cathodes, providing guidelines towards high-performance cathodes for sodium ion batteries.
The content of this RSS Feed (c) The Royal Society of Chemistry




science and technology

Multifunctional sonosensitizers in sonodynamic cancer therapy

Chem. Soc. Rev., 2020, Advance Article
DOI: 10.1039/C9CS00648F, Tutorial Review
Subin Son, Ji Hyeon Kim, Xianwen Wang, Chuangli Zhang, Shin A Yoon, Jinwoo Shin, Amit Sharma, Min Hee Lee, Liang Cheng, Jiasheng Wu, Jong Seung Kim
Phototherapy, including photodynamic therapy and photothermal therapy, has the potential to treat several types of cancer.
To cite this article before page numbers are assigned, use the DOI form of citation above.
The content of this RSS Feed (c) The Royal Society of Chemistry




science and technology

Synthesis, optoelectronic properties and applications of halide perovskites

Chem. Soc. Rev., 2020, Advance Article
DOI: 10.1039/C9CS00848A, Tutorial Review
Lata Chouhan, Sushant Ghimire, Challapalli Subrahmanyam, Tsutomu Miyasaka, Vasudevanpillai Biju
Halide perovskites have emerged as a class of most promising and cost-effective semiconductor materials for next generation photoluminescent, electroluminescent and photovoltaic devices.
To cite this article before page numbers are assigned, use the DOI form of citation above.
The content of this RSS Feed (c) The Royal Society of Chemistry




science and technology

Near-infrared laser driven white light continuum generation: materials, photophysical behaviours and applications

Chem. Soc. Rev., 2020, Advance Article
DOI: 10.1039/C9CS00646J, Review Article
Jianhong Wu, Guojun Zheng, Xiaofeng Liu, Jianrong Qiu
The current understanding, applications and future perspectives on near-infrared laser driven white light continuum generation in different materials are reviewed.
To cite this article before page numbers are assigned, use the DOI form of citation above.
The content of this RSS Feed (c) The Royal Society of Chemistry




science and technology

Atomically dispersed metal–nitrogen–carbon catalysts for fuel cells: advances in catalyst design, electrode performance, and durability improvement

Chem. Soc. Rev., 2020, Advance Article
DOI: 10.1039/C9CS00903E, Review Article
Yanghua He, Shengwen Liu, Cameron Priest, Qiurong Shi, Gang Wu
The review provides a comprehensive understanding of the atomically dispersed metal–nitrogen–carbon cathode catalysts for proton-exchange membrane fuel cell applications.
To cite this article before page numbers are assigned, use the DOI form of citation above.
The content of this RSS Feed (c) The Royal Society of Chemistry




science and technology

QSAR without borders

Chem. Soc. Rev., 2020, Advance Article
DOI: 10.1039/D0CS00098A, Review Article
Open Access
Eugene N. Muratov, Jürgen Bajorath, Robert P. Sheridan, Igor V. Tetko, Dmitry Filimonov, Vladimir Poroikov, Tudor I. Oprea, Igor I. Baskin, Alexandre Varnek, Adrian Roitberg, Olexandr Isayev, Stefano Curtalolo, Denis Fourches, Yoram Cohen, Alan Aspuru-Guzik, David A. Winkler, Dimitris Agrafiotis, Artem Cherkasov, Alexander Tropsha
Word cloud summary of diverse topics associated with QSAR modeling that are discussed in this review.
To cite this article before page numbers are assigned, use the DOI form of citation above.
The content of this RSS Feed (c) The Royal Society of Chemistry




science and technology

Bulk COFs and COF nanosheets for electrochemical energy storage and conversion

Chem. Soc. Rev., 2020, Advance Article
DOI: 10.1039/D0CS00017E, Review Article
Jie Li, Xuechun Jing, Qingqing Li, Siwu Li, Xing Gao, Xiao Feng, Bo Wang
The current advances, structure-property relationship and future perspectives in covalent organic frameworks (COFs) and their nanosheets for electrochemical energy storage (EES) and conversion (EEC) are summarized.
To cite this article before page numbers are assigned, use the DOI form of citation above.
The content of this RSS Feed (c) The Royal Society of Chemistry




science and technology

New synthetic strategies toward covalent organic frameworks

Chem. Soc. Rev., 2020, Advance Article
DOI: 10.1039/D0CS00199F, Tutorial Review
Yusen Li, Weiben Chen, Guolong Xing, Donglin Jiang, Long Chen
This tutorial review highlights the representative advances in the new synthetic strategies toward covalent organic frameworks.
To cite this article before page numbers are assigned, use the DOI form of citation above.
The content of this RSS Feed (c) The Royal Society of Chemistry




science and technology

Raman spectroscopy in the undergraduate curriculum / Matthew D. Sonntag, editor, Department of Chemistry and Biochemistry, Albright College, Reading, Pennsylvania ; sponsored by the ACS Division of Chemical Education.

Washington, DC : American Chemical Society, [2018]




science and technology

Contrast agents III [electronic resource] : radiopharmaceuticals from diagnostics to therapeutics / volume editor, Werner Krause ; with contributions by R. Alberto [and others]

Berlin ; New York : Springer-Verlag, [2005]




science and technology

Conformation-dependent design of sequences in copolymers [electronic resource] / volume editor, Alexei R. Khokhlov ; with contribution by V.O. Aseyev [and others]

New York : Springer, [2006]




science and technology

Atmospheric Science for Environmental Scientists, 2nd Edition


 

Enlightens readers on the realities of global atmospheric change, including global warming and poor air quality

Climate change and air pollution are two of the most pressing issues facing Mankind. This book gives undergraduate and graduate students, researchers and professionals working in the science and policy of pollution, climate change and air quality a broad and up-to-date account of the processes that occur in the atmosphere, how these are changing



Read More...




science and technology

Rivers in the Landscape, 2nd Edition


 

Rivers are the great shapers of terrestrial landscapes. Very few points on Earth above sea level do not lie within a drainage basin. Even points distant from the nearest channel are likely to be influenced by that channel. Tectonic uplift raises rock thousands of meters above sea level. Precipitation falling on the uplifted terrain concentrates into channels that carry sediment downward to the oceans and influence the steepness of adjacent hill slopes



Read More...




science and technology

Beaches and Coasts, 2nd Edition


 

A new edition of a unique textbook that provides an exhaustive treatment of the world's different coasts—with focus on climate change sea-level rise 

Coastlines of the world are as diverse and complex as any geological setting on Earth, and understanding them is extremely important. Beaches and Coasts, Second Edition is an exciting and unique textbook that covers the world’s different coasts and details the highly varied processes that have shaped



Read More...




science and technology

Industrial Environmental Management: Engineering, Science, and Policy


 

Provides aspiring engineers with pertinent information and technological methodologies on how best to manage industry's modern-day environment concerns

This book explains why industrial environmental management is important to human environmental interactions and describes what the physical, economic, social, and technological constraints to achieving the goal of a sustainable environment are. It emphasizes recent progress in life-cycle sustainable



Read More...




science and technology

Introducing Large Rivers


 

An accessible introduction to large rivers, including coverage of the geomorphology, hydrology, ecology, and environments of large river systems

This indispensible book takes a structured and global approach to the subject of large rivers, covering geomorphology, hydrology, ecology, and anthropogenic environment. It offers a thorough foundation for readers who are new to the field and presents enlightening discussions about issues of management at



Read More...




science and technology

Applied Concepts in Fractured Reservoirs


 

A much-needed, precise and practical treatment of a key topic in the energy industry and beyond, Applied Concepts in Fractured Reservoirs is an invaluable reference for those in both industry and academia

Authored by renowned experts in the field, this book covers the understanding, evaluation, and effects of fractures in reservoirs. It offers a comprehensive yet practical discussion and description of natural fractures, their origins, characteristics



Read More...




science and technology

The World Today: Concepts and Regions in Geography, 8th Edition


 

In the 8th edition of this market-leading title, The World Today continues to break new ground in the interpretation and teaching of world regional geography. The text explains the contemporary world’s geographic realms in terms of their natural environments and human dimensions in a clear and concise fashion. The authors look at the ways people have organized their living space, adapted to changing social as well as environmental circumstances, and



Read More...




science and technology

Social Movements: An Introduction, 3rd Edition


 

A new, fully-revised and updated edition of the leading introduction to social movements and collective action –covers a broad range of approaches in the social sciences.

Now in its third edition, Social Movements is the market-leading introductory text on collective action in contemporary society. The text draws from theory-driven, systematic empirical research from across the social sciences to address central questions and concepts in the field.



Read More...




science and technology

Geology For Dummies, 2nd Edition


 

Get a rock-solid grasp on geology

Geology For Dummies is ideal reading for anyonewith an interest in the fundamental concepts of geology, whether they're lifelong learners with a fascination for the subject or college students interested in pursuing geology or earth sciences.

Presented in a straightforward, trusted format—and tracking to a typical introductory geology course at the college level—this book features a thorough introduction to the study



Read More...




science and technology

Dayside Magnetosphere Interactions


 

Exploring the processes and phenomena of Earth’s dayside magnetosphere

Energy and momentum transfer, initially taking place at the dayside magnetopause, is responsible for a variety of phenomenon that we can measure on the ground. Data obtained from observations of Earth’s dayside magnetosphere increases our knowledge of the processes by which solar wind mass, momentum, and energy enter the magnetosphere.



Read More...




science and technology

Resident Foreigners: A Philosophy of Migration


 

From the shores of Europe to the Mexican-US border, mass migration is one of the most pressing issues we face today. Yet at the same time, calls to defend national sovereignty are becoming ever more vitriolic, with those fleeing war, persecution, and famine vilified as a threat to our security as well as our social and economic order.

In this book, written amidst the dark resurgence of appeals to defend ‘blood and soil’, Donatella Di Cesare challenges



Read More...




science and technology

Resident Foreigners: A Philosophy of Migration


 

From the shores of Europe to the Mexican-US border, mass migration is one of the most pressing issues we face today. Yet at the same time, calls to defend national sovereignty are becoming ever more vitriolic, with those fleeing war, persecution, and famine vilified as a threat to our security as well as our social and economic order.

In this book, written amidst the dark resurgence of appeals to defend ‘blood and soil’, Donatella Di Cesare challenges



Read More...




science and technology

Biogeochemical Cycles: Ecological Drivers and Environmental Impact


 

Biogeochemical Cycles: Ecological Drivers and Environmental Impact is a collection of the latest information on the techniques and methods currently used in this field, focusing on biological and/or ecological effects of biogeochemical elemental cycles including carbon, nitrogen, major and trace elements, chemical weathering on multiple scales of nanometers to watersheds, and advances in technology of studying these processes.

Volume highlights include



Read More...




science and technology

Encyclopedia of Water: Science, Technology, and Society, 5 Volume Set


 

A peer reviewed, comprehensive encyclopedia that reflects the current state of water science and engineering from multidisciplinary global viewpoints

Water quantity and quality are becoming increasingly urgent environmental issues. To meet the growing water demands of our expanding global population, professionals are turning to nontraditional sources and technologies. This expansive, multidisciplinary reference work contains hundreds of articles that



Read More...




science and technology

Exploring the Solar System, 2nd Edition


 

An Exciting and Authoritative Account of the Second Golden Age of Solar System Exploration Award-winning author Peter Bond provides an up-to-date, in-depth account of the sun and its family in the 2nd edition of Exploring the Solar System. This new edition brings together the discoveries and advances in scientific understanding made during the last 60 years of solar and planetary exploration, using research conducted by the world's leading geoscientists



Read More...




science and technology

Gas Injection into Geological Formations and Related Topics, Volume 8


 
This is the eighth volume in the series, Advances in Natural Gas Engineering, focusing on gas injection into geological formations and other related topics, very important areas of natural gas engineering. This volume includes information for both upstream and downstream operations, including chapters detailing the most cutting-edge techniques in acid gas injection, carbon capture, chemical and thermodynamic models, and much more.


Read More...




science and technology

Political Geography: A Critical Introduction


 

Brings political geography to life—explores key concepts, critical debates, and contemporary research in the field. 

Political geography is the study of how power struggles both shape and are shaped by the places in which they occur—the spatial nature of political power. PoliticalGeography: A Critical Introduction helps students understand how power is related to space, place, and territory, illustrating how everyday life and the world of global conflict



Read More...




science and technology

The Mediterranean Sea in the Era of Global Change 2: 30 Years of Multidisciplinary Study of the Ligurian Sea


 

Due to its particular characteristics, the Mediterranean Sea is often viewed as a microcosm of the World Ocean. Its proportionally-reduced dimensions and peculiar hydrological circulation render it susceptible to environmental and climatic constraints, which are rapidly evolving. The Mediterranean is therefore an ideal site to examine, in order to better understand a number of key oceanographic phenomena. This is especially true of the Ligurian Sea



Read More...




science and technology

The Mediterranean Sea in the Era of Global Change 1: 30 Years of Multidisciplinary Study of the Ligurian Sea


 

Due to its particular characteristics, the Mediterranean Sea is often viewed as a microcosm of the World Ocean. Its proportionally-reduced dimensions and peculiar hydrological circulation render it susceptible to environmental and climatic constraints, which are rapidly evolving. The Mediterranean is therefore an ideal site to examine, in order to better understand a number of key oceanographic phenomena. This is especially true of the Ligurian Sea



Read More...




science and technology

Companion to Women's and Gender Studies


 

A comprehensive overview of the interdisciplinary field of Women's and Gender Studies, featuring original contributions from leading experts from around the world

The Companion to Women's and Gender Studies is a comprehensive resource for students and scholars alike, exploring the central concepts, theories, themes, debates, and events in this dynamic field. Contributions from leading scholars and researchers cover a wide range of topics while providing



Read More...




science and technology

Why you should learn Mobile Web Development

When I've decided to define 3 courses and levels, I had to include the Mobile Web Development one.
When I tell developers or random folks about such course, they ask me:
"why? come on, I know Web, how different could that be? what's the point?"

Yet Most Websites Still Fail

For instance, I've tried to book a flight yesterday from my Android 5 daily phone which is not even in developer mode and I use the default Chrome browser (I know, shocking, but you gotta test what real world users will see!).
You can see I couldn't do it via this video:

Not That Site Only!

I'm pretty sure they will fix this problem at speed light, and while same operation worked on an iOS based device, it's shocking even most popular or famous websites can fail that bad at very most basic tasks like scrolling!

Few developers still believe Mobile Web is about bringing in some Mobile library and that's it. The amount of different things happening there, different surfing paradigms, and different, really, everything, is the most under-estimated problem we have these days.

And the best part everyone is missing is that you don't need to add libraries on Mobile Web, most likely you need to drop them!

Do You Trust The App?

Every business is apparently laughing at HTML5 and Mobile, offering an App for something they cannot even make it work on a browser.
Apps, are privileged pieces of software so I ask you one thing: why do you trust apps when the easier to develop Web counterpart doesn't even work?

As Summary

You don't have to come to my courses if you think you don't need it, but if you don't test on mobile, you can also stop right now offering poor alternatives nobody cares 'cause nothing works there anyway.
But please, stop saying that HTML5 or the Mobile Web platform is the problem ... it's simply NOT!




science and technology

A Simplified EU Cookie Law Approach

Update
Thanks for everyone starring the repo, cookies-monster made it to cdnjs!


I've already talked about the EU cookie law, but moaning about it won't solve the issue. Until common sense and competence will reach European politics so that this law can be erased, we should provide some info to our users.

Not Another Library

There are already few solutions that require a manual or libraries plugins that will cost much bandwidth.
I've decided to use my "special vanilla powers" and go lightweight for real: 578 bytes once "minzipped".
There is absolutely nothing else to do than just including the script. Zero config, drop in and go.

You Are Free To Text & Style

There's no predefined template, there's no predefined style, unless you'd like to use the same I've used for the following page:



You are in charge of the message to show, and you could put an optional link or a button in it with the class cookies-monster-accepted.
If the script will find such button, it will configure it as explicit call to action and once such link/button has been clicked, it will set a cookie that will expire in a year, and it will add the class hidden to the main container which should have a cookies-monster id.
Following an example of the most basic layout.

<div id="cookies-monster" class="hidden">
This sites uses cookies. <a
class="cookies-monster-accepted"
href="#cookies-monster"
>Accept</a>
</div>

Nothing else ... really

Since you are in charge of pretty much everything, you know what to write on your banner, with the needed language, and with any extra link or option you want. Just stick the script in and you are ready to go!

What would be awesome though, is some star to its repo, even if you have your own solution, so that we can move the script in cdn.js and forget once for all about this problem.

Thank You for reading and contributing!




science and technology

ArchLinux UEFI and Dell XPS 2015

unrelated important thing first: I am blogging on my own website too, you can read my very first public entry in there!
I will keep posting here less web-centric related issues, or mostly rants, and will post there interesting stuff about HTML5, JavaScript, client/server and Mobile Web development ... now, back to the topic ...

archibold and my Dell XPS Developer Edition

So they changed my motherboard today, it suddenly stopped recognizing the Hard Drive, and even trying other drives didn't work at all.
Kudos to Dell for their assistance: the day after a person with already all necessary pieces arrived at my door and substituted the Motherboard with a very quiet and professional attitude.
... when I've asked assistance for a Lenovo Yoga Pro 3 they never even come back ...

If you've never heard about archibold, it's an installer which aim is to simplify ArchLinux and, optionally, GNOME configuration. Since I already backed up my Dell, and even if it was working like a charm, I've decided to erase it and see if I could make it work via UEFI.
Apparently this BIOS could be quite problematic and while efibootmgr seems to work without problems, it actually doesn't: it puts the EFI label into the list of Legacy boot-able devices so it won't work!

Not only the boot manager

If you have tried my installer before, I suggested to use UEFI=NO and enable Legacy mode on the bios. This was because not only I couldn't figure out how to install via UEFI, but I was using genfstab generated /etc/fstab during the installation and it was storing wrong UUIDs.

Finally Managed to install with UEFI boot!

The TL;DR story is that if you have an EFI partition created through gparted, and you have Syslinux on it, you should go in the part of the bios where you can add UEFI partitions manually, selecting syslinux/syslinux.efi file to boot from.
Full Article


science and technology

Bringing SSL To Your Private Network

In this entry I will describe and provide how to run a HTTPS server in your home network, in order to test new HTML5 APIs.




science and technology

The line between Events and Promises

In this post I will talk about Events and Promise limits, trying to fill all gaps with a 498 bytes sized library called notify-js.




science and technology

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.




science and technology

The Dumb Side Of Technology

How many times you told a machine "how stupid" it was? How much technology are you surrounding with these days? This is a quick rant about few situations I've found myself involved: enjoy!

The one with the light sensor

This is the most hilarious story I could tell these days. I've found an office (it's just a room in a renewed building) that's so sophisticated and full of sensors, that I have nothing to do when I get into the room. The conditioner and the lights switch on thanks to a sensor!
"so what's the problem?" you ask? I have a projector and there's no bloody sensor switch so I can't see anything because as soon as I move the light goes on again. More over, the sensor activates also the conditioner, and what about the window? ... well, there is one, but I cannot open it.
They'll never come back with a solution, I'll probably change office because not being in control of keeping lights switched off in your own, freaking expensive office, is very frustrating!
This is also how the conversation with office management went:
  • me: I need to keep the light off
  • they: Sir, we have highly automated office and a green policy, we have sensors for lights
  • me: I have said, I need to keep the light switched off
  • they: why would you need that Sir?
  • me: I have a projector, I can't see a thing with such bright illumination
  • they: I see, we'll ask about it and let you know how much will it cost. Meanwhile, have you tried shutting down the blinds?
  • me: .... walk away astonished ...

The 7GB free SD card that Android will not use to update

I have finally received the Lollipop 5.1 update for my Motorola E, a very Essential device that might be enough for 80% of people out there. The Motorola E first generation has its own storage of 2.something GB. Android fits together with all its pointless apps I don't use (pointless because mandatory) and it says it needs at least 850MB to be installed. I check the storage, there are 300MB left plus more than 7GB on the SD card. The SD card is mounted in recovery mode, so it's perfectly usable as alternative storage to execute a System update. No way, I had to remove a couple of apps because it is not possible to move Apps to SD card, only few awesome apps can do that, and I wonder why on earth this is not a requirement in order to be accepted in the Android store.
Why are these app so obtrusive that need to be installed in the equivalent of the Linux /boot, /etc, and /system folder? Why on earth there is an SD card if for an update I'll have same problems iPhone C had a while ago? At least iPhone C does not even accept an SD card. How dumb is being unable to use free space? What is that free space useful for? Why are all these Google apps I don't use incapable of being moved to the SD card?
These and many more questions that will never be answered in the next episode of: How dumb is the free space management in every Phone OS!

Not just updates

If you have your app in your SD card you are free to move that card in your new shiny phone and keep the precious data with you if you are still in the same OS, or a newer version of such OS. There is no reason your app needs to be in the main storage and I hope these will all change their requirements, beside modern phones have more than 2GB of main storage, the point is a completely different one.

The slower automatic checkout

Have you ever found at some supermarket an automatic checkout that won't scan the next item until it has said entirely the price of the previously scanned one? I did, and I've imagined myself staring in front of the working person telling me the price loudly of everything I've bought. What the actual heck were they thinking when they released the software for that machine?

The classic airport double lifts paradox

The book I've started and never completed is entitled: 20 Floors of JavaScript. Its title is inspired by the fact it's the 20th anniversary of JavaScript, and also its aim is to discover how to program multiple Array of lifts/elevators.
I've realized in 37 years of life that lifts are the most stupidly programmed software you can imagine, and there are tons of solutions that could be implemented but apparently the software is the same that somebody wrote in 1978 or similar years.
Just to name one utterly idiotic situation with lifts, try to take one at the airport, in a place where there are at least two lifts.
One will be inevitably full, and while its doors are closing, somebody will press the button in order to call the other lift.
The drama begins.
The lift that was going upstairs will interrupt its closing doors procedure, opening them back, and waiting other 5 seconds before eventually closing them again. While doors are closing again, the second impatient person will press the button again.
People will start shouting "DON'T PRESS THE BUTTON" and some fight might have already picked up in the queue or someone got angry with the person that is pressing the button, calling him/her idiot.
Truth is, the only idiot, and the elephant in the room nobody wants to see because it not a real entity, is the lift and its software. Not only these lift have a weight sensor, so that eventually these could ignore changing floor if the weight is too high, these lift also have a camera. Having a camera means that when the weight is 0, the lift can take a screenshot of its internal. When the weight is not zero and doors are closing, the lift can take another screenshot of its internal and compare that image, pixel per pixel, with the initial empty one, and unless every person of the lift managed to dress like a part of that lift interiors and in camera prospective, the lift could easily tell if its full enough to ignore any extra request to re-open the door and let somebody else get in. This is not too sophisticated at all, this is just basic common sense applied. Moreover, every extra button push could simply be counted as unsigned short which, if more than 2, should ignore the request. This will avoid deadlocks when people for the third time see doors closing, and somebody from the outside call the lift again. This would surely be over-engineered in any single lift situation, but it can actually speed up the logic when there are at least 2.
This, and many other little tricks I've no idea why whoever is programming lifts software is not thinking about. They are more like dumb, passive, queues, incapable of optimizing a single operation.

Rant over, share your funny story if you like!




science and technology

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?




science and technology

DOMClass To The Rescue!

In this Simplified Web Components via DOMClass post, I introduce a new project which aim is to bring Custom Elements in a Web Components fashion through an ES6 looking class syntax.

Enjoy the post, and the project ;)




science and technology

On Ignored Users Spoken Language

I think I've talked already few times about this problems but I don't see anything happening ... actually, it's getting worst and worst.

Who Is Directly Affected And Is Wasting Money

  • Companies paying for Online Advertisement
  • Companies selling online
  • Companies providing online services

Who Is Responsible

  • every service that is addressing users through their current IP address, without asking permission, and assuming if you travel to any country in this world you automatically speak that country language
  • every service that completely ignores Accept-Language on the server side, and navigator.language on the client side
This is an extract from the Accept-Language used for locale setting post directly from W3C website:
For a first contact, using the Accept-Language value to infer regional settings may be a good starting point, but be sure to allow them to change the language as needed and specify their cultural settings more exactly if necessary. Store the results in a database or a cookie for later visits.
...
By the way
Using the Accept-Language header is also a good starting point for determining the language of the user, rather than the locale ...
Accordingly, instead using users IP location to define their language, I'd rather prefer them to use my daily language of choice, which comes most likely from the fact that my entire Operating System speaks English, as example, so PLEASE, give me English content whenever I am!

It feels so straightforward simple thing, right? Wondering who is doing it right?

Nobody Is Doing It Right

I am in Germany these days, and suddenly I don't understand anything. I cannot even be "victim" of Ads, I'm rather disturbed by them.

Google

Before even asking to use my detailed location provided through the browser, if I type google.com in the URL bar I'm redirected to google.de. Why does that happen? Simple, they know by my IP I am in Germany ^_^.
If I choose the English language and I search for O2 DSL, imagining I'd like to sign for a contract, or need some help, this is the result:
Full Article


science and technology

Object.assign Side Effects and How To Copy

In How To Copy Objects post I'll explain the difference between various native ways to copy own keys and properties, describing also the fact that Object.assign is full of surprises and side effects.

As example, assigning to an object something like {get next() {return ++this.i}, i:0} instead of {i:0, get next() {return ++this.i}} will result in different values copied over: next === 1 and i === 1 in the first case, next === 1 and i === 0 in the second one.




science and technology

Exporting modules in JavaScript

In my latest entry I explain the difference about exporting a module between server side or CLI environments such Nashorn, SpiderMonkey, JSC, or micro controller and embedded engines such Duktape, Espruino, KinomaJS, and Desktop UI space via GJS.
Using this is a universal way to attach and export properties but when it comes to ES2015 modules, incompatible with CommonJS and with an undefined execution context.
Enjoy




science and technology

December 2015 ... Spaces or Tabs ?

TL;DR this post tries to explain why a compact solution based on a NON visually configurable predefined amount of spaces wins through facts and not personal style choices. If you'd like to argue please have the decency to read this post top to bottom before that. Thank you!



I've got 99 problems and "spaces VS tabs" actually is one of them!
I find it embarrassing for the entirety of the programming, developers, and designers worldwide industry and community to still have these kind of debates in year 2015!
We laugh about medieval people thoughts, modern bigotry, or how stupid is from time to time the rest of the world around us ... and yet we cannot stop whining about spaces or tabs.
Moreover, the untold story about this debate is that everyone is simply being selfish and every rationale behind is made of opinionated and volatile fluff that does not match current real-world scenarios (yeah, maybe me too, but before that, please keep reading 'till the end, thanks!).

Defining a Standard

There are few standards and protocols universally implemented in the programming world and JSON, as well as XML, are just a few and rare examples.
There is no "my XML is better than yours" or "my JSON looks nicer" discussion there, as soon as you write something not conforming with the standard you are causing troubles either to your own code and yourself or to whoever needs to consume your code!
There's not "but ..." or "because my style ..." here, there is only one way everyone understands which is the only compatible way and the best way to move forward.
Unfortunately, in the history of Computer Science (funny it's called Science in this case) there's still no agreement on the "spaces VS tabs" matter.

Fact 1: Nobody wants horizontal scroll

Not only books are read vertically since ever, "technological mouses" are not even created to simplify such task and on top of that: if you don't set yourself a limit to the amount of columns your code should actually warn you, usually 80 up to 120 chars, it doesn't actually matter what choice you made to your indentation because "'yo column is so wide I though you were a code cruncher instead of a human being".
We don't like to scroll horizontally and we would like to be able to put 2 or more different files beside each other to compare diffs and lines in a single screen ... right?
In other words, it's OK to have 80 to 120 chars column width limit because we all agree it's needed!
Then we have either developers that connect via SSH, those that use daily vi or vim, and people on Smart Phones that maybe are surfing online, studying some piece of code where they also have to scroll every single pre tag because by default each browser uses 4 or 8 spaces to represent a tab ... you say no?
This is something standard to show to you, it doesn't have any special parsing behind, it's just plain code.

// 2 spaces indentation random code
class View {
constructor(options) {
this.model = options.model;
this.template = options.template;
}

render() {
return _.template(
this.template, this.model.toObject()
);
}
}

// its tabs based equivalent
class View {
constructor(options) {
this.model = options.model;
this.template = options.template;
}

render() {
return _.template(
this.template, this.model.toObject()
);
}
}
Before asking ourselves which piece of code looks universally better, I just would like to show you a couple of cases different from your editor of choice scenario:

Full Article


science and technology

The missing analysis in JavaScript "Real" Mixins

I love hacks and unusual patterns! As logical consequence, I loved this post about "Real" Mixins!!!
The only hitch about that post is that I believe there are few points closer to a "gonna sell you my idea" discussion than a non disillusioned one.
Let's start this counter analysis remembering what are actually classes in latest JavaScript standard, so that we can move on explaining what's missing in there.

JavaScript embraces prototypal inheritance

It doesn't matter if ES6 made the previously reserved class keyword usable; at the end of the day we're dealing with a special syntactical shortcut to enrich a generic prototype object.

// class in ES2015
class A {
constructor() {}
method() {}
get accessor() {}
set accessor(value) {}
}

// where are those methods and properties defined?
console.log(
Object.getOwnPropertyNames(A.prototype)
// ["constructor", "method", "accessor"]
);
Accordingly, declaring a generic class consists in bypassing the following procedure:

function A() {}
Object.defineProperties(
A.prototype,
{
// constructor is implicitly defined
method: {
configurable: true,
writable: true,
value: function method() {}
},
accessor: {
configurable: true,
get: function get() {},
set: function set(value) {}
}
}
);
If you don't trust me, trust what a transpiler would do, summarized in the following code:

var A = (function () {
// the constructor
function A() {
_classCallCheck(this, _temporalAssertDefined(A, "A", _temporalUndefined) && A);
}
// the enriched prototype
_createClass(_temporalAssertDefined(A, "A", _temporalUndefined) && A, [{
key: "method",
value: function method() {}
}, {
key: "accessor",
get: function get() {},
set: function set(value) {}
}]);

return _temporalAssertDefined(A, "A", _temporalUndefined) && A;
})();
If there is some public static property in the definition, its assignment to the constructor would be the second bypassed part.

The super case

The extra bit in terms of syntax that makes ES6 special is the special keyword super. Being multiple inheritance not possible in JavaScript, we could think about super as the static reference to the directly extended prototype. In case of the previous B class, which extends A, we can think about super variable like if it was defined as such:

// used within the constructor
let super = (...args) => A.apply(this, arguments);

// used within any other method
super.method = (...args) => A.prototype.method.apply(this, args);

// used as accessor
Object.defineProperty(super, 'accessor', {
get: () => Object.getOwnPropertyDescriptor(
A.prototype, 'accessor'
).get.call(this),
set: (value) => Object.getOwnPropertyDescriptor(
A.prototype, 'accessor'
).set.call(this, value)
});
Now that we have a decent understanding on how inheritance works in JavaScript and what it means to declare a class, let's talk about few misleading points sold as pros or cons in the mentioned article.

Prototypes are always modified anyway!

We've just seen that defining a class technically means enriching its prototype object. This already invalidates somehow Justin point but there's more to consider.
When Justin exposes his idea on why current solutions are bad, he says that:
When using mixin libraries against prototype objects, the prototypes are directly mutated. This is a problem if the prototype is used anywhere else that the mixed-in properties are not wanted.
The way Justin describes this issue is quite misleading because mutating prototypes at runtime is a well known bad practice.
Indeed, I believe every single library he mentioned in that post, and he also forgot mine, is not designed to mutate classes prototypes at runtime ... like: not at all!
Every single mixin proposal that is capable of implementing mixins via classes is indeed designed to define these classes at definition time, not at runtime!
Moreover, whatever solution Justin proposed will not guard any class from being modified at runtime later on!
The same way he's defining his final classes during their definitions, mixins-for-classes oriented libraries have exactly the same goal: you define your class and its mixins during the class definition time!
The fact mixins add properties to a prototype is a completely hidden matter that at class definition time is everything but bad.
Also, no property is modified in place, because mixins are there to enrich, not to modify ... and having a prototype enriched means also that it's easier to spot name clashing and methods or properties conflicts ... but I'll come back to that later ...

super actually should NOT work!

The main bummer about the article is that it starts in a very reasonable way, describing mixins and classes, and also analyzing their role in a program.
The real, and only, difference between a mixin and normal subclass is that a normal subclass has a fixed superclass, while a mixin definition doesn't yet have a superclass.
Justin started right at the very beginning, and then degenerated with all sort of contradictions such:
Then finally he's back to Sanity Village with the following sentence:
super calls can be a little unintuitive for those new to mixins because the superclass isn't known at mixin definition, and sometimes developers expect super to point to the declared superclass (the parameter to the mixin), not the mixin application.
And on top of that, Justin talks about constructors too:
Constructors are a potential source of confusion with mixins. They essentially behave like methods, except that overriden methods tend to have the same signature, while constructors in a inheritance hierarchy often have different signatures.
In case you're not convinced yet how much messed up could be the situation, I'd like to add extra examples to the plate.
Let's consider the word area and its multiple meanings:
  • any particular extent of space or surface
  • a geographical region
  • any section reserved for a specific function
  • extent, range, or scope
  • field of study, or a branch of a field of study
  • a piece of unoccupied ground; an open space
  • the space or site on which a building stands
Now you really have to tell me in case you implement a basic Shape mixin with an area() method what the hack would you expect when invoking super. Moreoever, you should tell me if for every single method you are going to write within a mixin, you are also going to blindly invoke super with arbitrary amount of arguments in there ...

So here my quick advice about calling blindly a super: NO, followed by DON'T and eventually NEVER!

Oversold super ability

No kidding, and I can't stress this enough ... I've never ever in my life wrote a single mixin that was blindly trusting on a super call. That would be eventually an application based on mixins but that's a completely different story.
My feeling is that Justin tried to combine at all cost different concepts, probably mislead by his Dart background, since mentioned as reference, where composition in Dart was indeed classes based and the lang itself exposes native mixins as classes ... but here again we are in JavaScript!

instanceof what?

Another oversold point in Justin's article is that instanceof works.
This one was easy to spot ... I mean, if you create a class at runtime everytime the mixin is invoked, what exactly are you capable of "instanceoffing" and why would that benefit anyone about anything?
I'm writing down his very same examples here that will obviously all fail:

// a new anonymous class is created each time
// who's gonna benefit about the instanceof?
let MyMixin = (superclass) => class extends superclass {
foo() {
console.log('foo from MyMixin');
}
};

// let's try this class
class MyClass extends MyMixin(MyBaseClass) {
/* ... */
}

// Justin says it's cool that instanceof works ...
(new MyClass) instanceof MyMixin; // false
// false ... really, it can't be an instance of
// an arrow function prototype, isn't it?!
Accordingly, and unless I've misunderstood Justin point in which case I apologies in advance, I'm not sure what's the exact point in having instanceof working. Yes, sure the intermediate class is there, but every time the mixin is used it will create a different class so there's absolutely no advantage in having instanceof working there ... am I right?

Improving **Objects** Composition

In his Improving the Syntax paragraph, Justin exposes a very nice API summarized as such:

let mix = (superclass) => new MixinBuilder(superclass);

class MixinBuilder {
constructor(superclass) {
this.superclass = superclass;
}

with(...mixins) {
return mixins.reduce((c, mixin) => mixin(c), this.superclass);
}
}
Well, this was actually the part I've liked the most about his article, it's a very simple and semantic API, and it also doesn't need classes at all to be implemented for any kind of JS object!
How? Well, simply creating objects from objects instead:

let mix = (object) => ({
with: (...mixins) => mixins.reduce(
(c, mixin) => Object.create(
c, Object.getOwnPropertyDescriptors(mixin)
), object)
});
It could surely be improved in order to deal with classes too but you get the idea:

let a = {a: 'a'};
let b = {b: 'b'};
let c = {c: 'c'};
let d = mix(c).with(a, b);
console.log(d);
Since the main trick in Justin proposal is to place an intermediate class in the inheritance chain, defining at runtime each time the same class and its prototype, I've done something different here that doesn't need to create a new class with its own prototype or object each time, while preserving original functionalities without affecting them.

Less RAM to use, a hopefully coming soon native Object.getOwnPropertyDescriptors that should land in ES7 and make extraction faster, and the ability to use the pattern with pretty much everything out there, modern or old.
The gist is here, feel free to reuse.

As Summary ...

Wrapping up this post, with latter proposal we can actually achieve whatever Justin did with his intermediate classes approach but following different goals:
  1. Mixins are added to the prototype chain.
  2. Mixins are applied without modifying existing objects.
  3. Mixins do no magic, and don't define new semantics on top of the core language.
  4. super.foo property access won't hopefully work within mixins but it will with subclasses methods.
  5. super() calls won't hopefully work in mixins constructors because you've no idea what kind of arguments you are going to receive. Subclasses still work as expected.
  6. Mixins are able to extend other mixins.
  7. instanceof has no reason to be even considered in this scenario since we are composing objects.
  8. Mixin definitions do not require library support - they can be written in a universal style and be compatible with non classes based engines too.
  9. bonus: less memory consumption overall, there's no runtime duplication for the same logic each time
I still want to thanks Justin because he made it quite clear that still not everyone fully understands mixins but there's surely a real-world need, or better demand, in the current JavaScript community.

Let's hope the next version of ECMAScript will let all of us compose in a standard way that doesn't include a footgun like super through intermediate classes definition could do.
Thanks for your patience reading through this!




science and technology

Playing with Sockets and Geolocation

There is a little experiment I've created more than a year ago. It's incomplete and I never got time to make it an official product and finalize it. However, somebody told me it's a freaking cool idea so I've decided to share it with you.

A Dragon Ball Z Spirit Bomb like social App

Full Article


science and technology

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!




science and technology

How to serve Images on Web

Because even if you think you're doing right, many others are not. Here the catch: just use <img srcset> attribute to improve the experience in your own site, don't do the same mistake others are doing! Read the full post about it




science and technology

Simplified Custom Elements in 1K

That's the challenge for this JS1K year and this is what's my submit is about.