My JavaScript book is out! Don't miss the opportunity to upgrade your beginner or average dev skills.

Saturday, March 08, 2014

what's in the avatar?

since even @paul_irish yesterday asked me about it, here the story of my avatar.

http://www.3site.eu/images/webreflection.jpg

Spoiler: Nothing To Do With Tech

This is one of those posts where you won't find anything techie, nothing to learn, think of, or related to what I do daily on my life so ... feel free to abandon this page if you are not interested in knowing what's on my avatar, and no offense will be taken :-)

Another Blurry Precedent

If you are asking me "why is that blurry?" I'll tell you later on, however the first time I thought about using this image I had similar reaction: "is it OK to use a blurry image as avatar?"
One of the most inspiring developers I've learned from in my past is Dean Edwards. Since Dean never bothered to change his blurry avatar, and I've no idea how many asked him about that, I thought it was OK to actually chose an avatar, no matter what it is, and stick with it as long as you want ... the face? Well, I am not even slightly as photogenic as Paul, or even the blurry Dean, plus I suck at making selfies so can you just keep recognizing me behind that non-sense image?
If you can, then it's time to tell the what, the when, and the why :-)

Keep Dreaming

One of the best friends of my childhood has always been an inspiration for me: he is a traveler, a dreamer, a story teller, a funny company or a shoulder to cry on, and last few years also a great father of 2 wonderful children.
We called him "the actor" since basically ever because of his ability to mimic people, imaginary characters out of books and fables, and also put yourself into a different surrounding because of the unexpected acting he'll might just start doing without any notice.

That was his vocation, and that is what he has studied for, dreamed about, sacrificed, to actually concretely become a real theater actor.

Acting ain't easy life, neither an easy income ... not everyone in the field does Hollywood movies and you could find thousands struggling to reach the end of the month but no matter what, they'll keep the show up!
In few words, this very dear friend never gave up and even if we are thousand kilometers from each other, he is ultra busy, and we actually have zero time to interact with each other or simply spend an evening together, I keep following his life achievements with shows he's creating with his wife too since both are wonderful actors, and have many story to tell you in a show, or during their teaching.

A Special Event

Not only I was happy knowing that my friend was getting married, I also believe that wedding was one of the best I've ever been in my entire life.
Family and friends were the one that prepared the entire wedding cooking, making cocktails, serving food and drinks, dancing folkloristic songs and even playing live music on the stage!
Yes, that has been for me one of the happiest moment of my life for a person I always admired and an event that was probably the most anti-formality wedding I could imagine within Italian culture ... OK it was never ending, and I was drunk as fuck, but when I took that picture behind a crowd of good old friends, hard to group again all together, old friends that were having fun at one of the best organized events I've been ... well, all I can say is that every time I re-think about that day, I feel that happy time again.

... After That

I kept following my dreams, keep trying and studying harder, improving my skills, writing post and Open Source software every time I could, exploring new countries, changing few companies, getting married with the most wonderful girl I've ever met and I am still running behind all achievements this friend of mine already completed ... damn it Luca, I really wish that all of us will never stop running!

Sunday, February 23, 2014

goto didn't fail;

it actually worked pretty well, and this is just my quick take on the infamous goto fail; security issue Apple had recently, an issue perfectly explained in this Adam Langley Weblog post.

what is wrong, in a sentence

Citing Adam Langley, here in my opinion exactly what is wrong in the modern software industry:
If I compile with -Wall (enable all warnings), neither GCC 4.8.2 or Clang 3.3 from Xcode make a peep about the dead code. That's surprising to me ...
Do you see that? Adam trusted the compiler to solve logic problems for him, without even mentioning for a second that a basic test would have shown the problem against an expected output apparently impossible to reach/obtain.
Bear in mind this post is not about Adam and the fact I am surprised too his example didn't warn, but that sentence represents way properly the common thinking in the actual industry, IMO (so please Adam don't take it personally, thanks).

syntax has nothing to do with security

every programming language has its own syntax gotchas, but this does not mean that every program is written badly or it can fail. The amount of criticism behind brackets, indentation, parenthesis, or the goto statement, even from the wired post, is embarhassing:
Using “goto” statements in any form has long been considered a poor programming practice, though everyone does it anyway.
It's way too easy to blame a statement and make this story a light emphasis on how bad is goto and everyone using it should burn in hell ... I wouldn't even be surprised if Apple will remove such statement from everywhere in XCode so that can go along with what really went wrong in this story ...
Truth is, an accidental early function return would have caused exactly same problem, stop blaming goto then!

missing tests and 100% code coverage

everyone knows testing might be hard and time consuming, but it does not matter how respected is your OS timeline if all your software does is to easily expose stuff due lack of time to test the most basic part of the security data exchange ... do you know what I mean?

a gently myth buster on SW development

just to remember what is not SW development about ... shall we?
  1. compilers and compiled languages do not automatically make your software secure; you can type by accident the function/method detractMoney(amount) twice and let the user with 200% less money ... now tell her it was her paying twice by accident ...
  2. linter do not make your code safer neither; indeed linters are more about code readability and practices, these have nothing to do with security and specially in JS world you must be a fool to think that varname === undefined will solve anything in your code
  3. tests are not an option, and for gosh sake this must be 120% true when "enterprise" or security related code is in place. It does not matter how cool is your programming language or the tool you are using to build your software, until you have a very high/good code coverage via any sort of test you can think of, you might be, at that point, good to go but it won't be never late to add a test or be sure that something else, just a change, didn't cause a regression
Before I've met great developers that couldn't stress more about testing everything, I've worked for companies that didn't care about tests, used the classic excuse "we have no time for that" or believed that the programming language, since compiled, was better than JavaScript and error/disaster prone by default because of types or some magic death code elimination.

This is bullshit, and I don't expect such kind of bullshit from #1 corporates that will silently pass behind the scene covered by simplification of a problem that has never been caused by missing brackets, parenthesis, or a goto statement.

Get real and solve your real problems, 'cause your scanned finger prints smells already rotten knowing that SSL abc wasn't triply reviewed, and passed to production miserably without a good code coverage for it.

Thanks for listening!
P.S. this case was just too fuzzed to not be used as example where tests outperform compilers and linters but this post has really nothing strictly to do with Apple itself! Any company/corporate lacking tests (unit, integration, smoke, etc) could easily fail in security, as well as everything else, problems

Thursday, February 20, 2014

the underestimated problem about script async attribute

While authoritative bloggers seems to suggest script async attribute as the holy grail on HTML documents for non blocking JavaScript overall performance, you might probably know async behavior is not necessarily desired at all, here I'll try to explain why.

first of all: why script async

Before talking badly about this attribute, it's necessary to understand reasons behind.
async attribute aim is to not block network traffic.
Differently from deferred, where the order of scripts is preserved and the fact scripts will be parsed and executed before the DOMContentLoaded event would be regularly fired, async scripts download and parse might occur at any time before or after the DOMContentLoaded as well as the onload event have been already fired.

<script async="shenanigans">

Yes, if your library, framework, utility, entire Web App, relies for some reason to the DOMContentLoaded event listener, or even the classic window.onload event, in order to initialize anything, such attribute will not guarantee that behavior at all: it's the other way round!
If the script tag is on top of the head of your page, the only place where defer or async make sense in order to not block the download of anything else in the page, it might be executed while the document is still donwloading as well as after everything else, in terms of DOM, has been interpreted already.
This situation is the most common one and not the less probable as you might think, 'cause the moment your script tag is interpreted, is the moment the browser knows already the content of the page.
From that point, to trigger a DOMContentLoaded event takes really nothing, milliseconds speaking.
If your script add that listener after, your script will never be triggered.

fixing the DOMContentLoaded

Long time ago, DOMContentLoaded in Firefox was the revolution for scripting initialization ... today this event looks ugly and unreliable, with its capital letters in the event type description, its past in the verb form compared with load which is not loaded indeed, and at the same time is the most used event ever for anything that would like to operate before the user.
In this universal common case, it's ridiculous that such event, happened in the past as Loaded would suggest, will never trigger again in the document unless somebody manually tries to do so, screwing all libraries, frameworks, or application logic, that forgot to removeEventListener once such event used for initialization has been fired ... you know what I mean?

Once For All: Fixed!

This script has no license on purpose ... I don't really care if you remember me once you used this script on top of your page and inline, I really don't want you to even think about this post once you can sleep well thinking the DOMContentLoaded event triggered your initialization script ... really, just use this script for reliability sake and forget about problems related to asynchronously loaded scripts and libraries.
Anything that will trust such event, will be triggered ... and yes, all CSP can be used as well without problems so ... no excuses, just enjoy!

Wednesday, February 19, 2014

quick repo updates

  • ./testardo sandbox.scrollTo(element) now works so well it can be tested with testardo itself
  • IE8 now supports XMLHttpRequest addEventListener, removeEventListener, and dispatch(event) on readystatechange event, normalized as well as everything else
  • eddy.js now passes all tests in IE8 too thanks to previous update plus it fixes a problem with obj.boundTo(method) weirdly unspotted before (huge bug that needs latest update)
For all Bower related projects, tags and versions should have been updated too.
Take care!

Monday, February 10, 2014

trapping an ES6 Proxy inside a with statement

restyle.js from Andrea Giammarchi on Vimeo.

update 2 to play with(restyle.properties){...} having a closure for variables and functions ... here an example ;-)

update I've been putting together explained ideas in both Proxy and a restyle.properties version that should work already in every ES5 capable environment.
Both files share the same alpha utilities file that can and will be enriched from time to time!
You can test current status directly in this page and you can also click the parsed area to have a link to share.
See how natural it feels? .. Now, imagine all browser prefixes are automagically added and you could also write around functions and variables to reuse code as you can already do in restyle ;-)
enjoy
too good and too powerful to be left ignored as pattern, while testing handy ways to make web developers life easier with a tool born for that as restyle is, I couldn't stop admiring how powerful is a with statement when a Proxy is passed as argument.

Next Tooling Level

Seriously, have a look at this Proxy:
var CSSProxy = new Proxy(
  {
    // borrowed from from eddy.js
    // https://github.com/WebReflection/eddy
    boundTo: function (method) {
      return this.$[method] || (
        this.$[method] = this._[method].bind(this)
      );
    },
    // CSS properties that clash with window
    special: /^(?:top|scroll)$/,
    // common camelCase RegExp
    find: /([a-z])([A-Z])/g,
    // common camelCase to camel-case replacement
    replace: function (m, $1, $2) {
      return $1 + '-' + $2.toLowerCase();
    },
    // a collection of already bound methods
    // it avoids blowed RAM for no reason
    // as eddy.js boundTo method does by default
    $: {},
    // the target.utility namespace
    _: {
      // in this case an hex example
      hex: function (r, g, b) {
        return '#'.concat(
          ('0' + r.toString(16)).slice(-2),
          ('0' + g.toString(16)).slice(-2),
          ('0' + b.toString(16)).slice(-2)
        );
      },
      // to write directly url('path.ext')
      url: function(src) {
        return 'url("' + src + '");'
      }
    }
  },
  // the proxy
  {
    // inside a with, everything that is not there
    // will be checked here
    has: function (target, name) {
      return  window.hasOwnProperty(name) ?
          target.special.test(name) : true;
    },
    // when .has(name) returns true ...
    get: function (target, name, receiver) {
      // either it's a method from here
      return target._.hasOwnProperty(name) ?
        // and it should be bound
        target.boundTo(name) :
        // or is a value name
        name.replace(
          target.find,
          target.replace
        );
    }
  }
);

The What And The How

Imagine you are writing through JS some CSS property for a server side/node.js pre-processor ...
with (CSSProxy) {
  console.log({
    // r, g, b to HEX value
    color: hex(100, 50, 150),   // #643296
    textAlign: center,          // 'center'
    backgroundRepeat: noRepeat, // 'no-repeat'
    content: noCloseQuote       // 'no-close-quote'
  });
}
Now, combine this with restyle(object) power:
with (CSSProxy) {
  var myApp = restyle({
    'html, body': {
      color: red,
      background: {
        image: url("image.png"),
        color: black,
        position: top
      }
    },
    section: {
      overflow: hidden,
      display: block,
    
    }
  });
}
Now, I don't know what you think but I believe this combination kicks every other CSS via JS processor out of the competition!

P.S. yeah, this is freaking cool stuff I am pretty sure somebody will complain about and shut it down as it was already for the awesome with statement :-(
ES3 FTW!

Saturday, February 08, 2014

restyle.js - a simplified CSS approach

Before you think about "yet another CSS preprocessor", I'd like to inform you that I've asked around to few common, well known, CSS or general web developers and it looks like this little script was still missing ... once you'll realize what is this about, you'll probably wonder yourself "how come nobody has done this already?".
My idea is that somebody probably did but I am not sure in 0.8KB minzipped and compatible with both server and client down to IE6 ... so here I am talking about restyle.

update Published object specifications explaining how the object is parsed and what will produce.
P.S. yes, absurd.js inspired somehow restyle except absurd.js won't work in your browser at runtime (yet?) does way more in about 26KB (~9KB gzipped) while restyle does not implement any magic.
Please read F.A.Q. to know more or check the restyle VS absurd page with basic features compared.

restyle.js

restyle is a function that provided a JS object creates and place in the DOM its CSS representation, using by default all possible prefixes. i.e.
var addedStyle = restyle({
  body: {
    color: '#FFF',
    background: {
      image: 'url(bla.bla)',
      color: '#000'
    }
  }
});
will result in this CSS, the string only in node.js world, a whole object in the DOM/browser world.
body {
  color: #FFF;
  background-image: url(bla.bla);
  background-color: #000;
}
to remove this new style at any time in DOM/browsers:
addedStyle.remove();
this is nothing impressive with standard styles but it becomes very handy when prefixes are in place.
restyle({
  'div > button:first-child': {
    transform: 'rotate(30deg)'
  }
}, ['moz', 'webkit']);
will become
div > button:first-child {
  -webkit-transform: rotate(30deg);
  -moz-transform: rotate(30deg);
  transform: rotate(30deg);
}
while the following
restyle({
  'body > div': {
    animation: {
      name: 'spin',
      duration: '4s'
    }
  },
  '@keyframes spin': {
    from: {
      transform: 'rotate(0deg)'
    },
    to: {
      transform: 'rotate(360deg)'
    }
  }
});
will become this
body > div{
  -webkit-animation-name:spin;
  -moz-animation-name:spin;
  -ms-animation-name:spin;
  -o-animation-name:spin;
  animation-name:spin;
  -webkit-animation-duration:4s;
  -moz-animation-duration:4s;
  -ms-animation-duration:4s;
  -o-animation-duration:4s;
  animation-duration:4s;
}
@-webkit-keyframes spin{
  from{
    -webkit-transform:rotate(0deg);
    transform:rotate(0deg);
  }
  to{
    -webkit-transform:rotate(360deg);
    transform:rotate(360deg);
  }
}
@-moz-keyframes spin{
  from{
    -moz-transform:rotate(0deg);
    transform:rotate(0deg);
  }
  to{
    -moz-transform:rotate(360deg);
    transform:rotate(360deg);
  }
}
@-ms-keyframes spin{
  from{
    -ms-transform:rotate(0deg);
    transform:rotate(0deg);
  }
  to{
    -ms-transform:rotate(360deg);
    transform:rotate(360deg);
  }
}
@-o-keyframes spin{
  from{
    -o-transform:rotate(0deg);
    transform:rotate(0deg);
  }
  to{
    -o-transform:rotate(360deg);
    transform:rotate(360deg);
  }
}
@keyframes spin{
  from{
    -webkit-transform:rotate(0deg);
    -moz-transform:rotate(0deg);
    -ms-transform:rotate(0deg);
    -o-transform:rotate(0deg);
    transform:rotate(0deg);
  }
  to{
    -webkit-transform:rotate(360deg);
    -moz-transform:rotate(360deg);
    -ms-transform:rotate(360deg);
    -o-transform:rotate(360deg);
    transform:rotate(360deg);
  }
}
and so on ... this has few advantages if done at runtime:
  • it simplifies prefixes hell effortless
  • it confines all new changes in one style element that can be dropped at any time
  • it can associate or create complex styles inline for custom components preserving size
  • it is compatible with runtime/dynamic properties for any sort of screen/case/device
Used without prefixes on the server side, it can be a pre-processor of the pre-processor, able to use variables at runtime in a JS way, instead of using SASS and company.

Moar Info and Conclusions

Everything open sourced in github, restyle is also an npm and a bower module.
If you think you got everything already, feel free to test some syntax or verify if it works for your browser at runtime ... and that's correct, it should work even in IE6 ;-)
enjoy

following

there are experiments in place able to make restyle magic, follow up in the next post if you want to know more.

update on why the DOM result has so many prefixes?

Every time we write CSS for other browsers vendors too we are creating useless noise in the file for the current browser. This is because we don't serve the CSS file accordingly with the current browser, we simply define all prefixes hoping one will be used from the current visiting browser.
Since no concrete size will be compromise when used at runtime, restyle, by default, has exactly the same careless behavior: it just create prefixes for everything simply trusting the normal browser behavior that what should work and be understood via prefix will work, everything else will be ignored, where last non prefixed version should be prevalent.
There is no way to feature detect properly weird or early CSS behaviors per each vendor, it will blow the code size and complicate the logic resulting in a non so present, past, and future proof behavior as the current one.
That said, you can pass the Array you want if at runtime you think all those prefixes are pointless, restyle purpose is to keep it simple and work ...
Although, if you have any hint on how to do this properly everywhere without adding more than 3 lines of code to the source :P I'll be happy to listen to you ;)
In node.js case, you should probably use a more complex preprocessor after creating CSS via restyle with the benefit that used logic can be applied eventually at runtime too.

Saturday, February 01, 2014

eddy.js goes promisish

This is a quick one about the tiny library I am using the most for personal projects: eddy.js

Promised Events

eddy makes the creation of event driven logic and application the easiest possible you can imagine.
var obj = {};

// at any time, in any place
obj.on('event', doSomething);
The unobtrusive, memory safe and lazily attached EventTarget logic you can even overwrite whenever you like to anywhere in your code, cannot solve tasks in a way ES6 Promises would.

... but what if I told you ...

... that jQuery nailed it in a similar way since ever?

.when(something, happened)

A very basic example of this new method is a classic document.ready approach indeed:
// even if lazily loaded!
document.when('ready', function(e){
  console.log('we are ready to go');
});

// later, even loaded asynchronously
// with or without AMD
document.when('ready', initLibrary);
Even if manually dispatched, handlers that has been fired once will not fire again unless re-attached but even doing so, these won't be fired twice if previously attached.
The best of both worlds, where listeners are stored by reference once, without the possibility to be fired more than once.
.once() is indeed the closest example to .when() except once adds a new listener, if not previously added, regardless the operation happened already in the past.
With this .when() method we are sure that the very first time the event happens, every other listener could benefit from that result.

result but no implicit reject

The "fulfill" part of this concept is provided by the way we dispatch the event either with .trigger('DOM-like', details) or .emit('node-like', null, value).
Any listener will receive the event or value passed the very first time the fulfill occurs but there is no way to understand a rejected value if not analyzing arguments.
A reject can be easily simulated indeed via .trigger('DOM-like', new Error('problem')) or .emit('node-like', new Error('problem'), null) so that any listener could handle failures.

improved .boundTo()

Another small change to library has been enriching Object#boundTo() signature so that it is possible to assign if not present once and at runtime.
I've found myself repeating this kind of pattern over and over:
obj.on('evt',
  obj.someMethod || (
  obj.someMethod = function(e) {
    // everything I need
  }
));
With the current improvement to boundTo, which I found more appropriate than creating another method for all objects, we can simply do this:
obj.on(
  'evt',
  obj.boundTo('someMethod', function(e) {
    // everything I need
  })
);
Above code will assign the second function argument only once and only if someMethod has not been assigned already. If a bound version is not required, then we could go in a less elegant way and either use the initial approach I've showed or simply addressing the property after:
obj.on(
  'evt',
  // not the bound version
  obj.boundTo('someMethod', function(e) {
    // everything I need
  }).someMethod // there it is!
);
The method does not create indeed a bound copy of the function as property, it rather addresses it once per property.

boundTo(Caveat)

It's very simple to create a foot-gun. If we address two different functions with the same property name only the first one will be used and never the last. In this case is highly recommended to delete obj.someMethod before using again boundTo ease.

Summary

eddy.js is becoming addictive and I am holding back myself every time I'd like to add some new cool thing trying to avoid mistakes old libraries did and keeping it simple and unobtrusive but I strongly suggest you to give it a shot.
Enjoy!

Wednesday, January 22, 2014

testardo - A Browser Agnostic JS Web Driver

you might think there are already so many solutions out there for testing browsers on real domains or real network interactions ... well, let me tell you why this is unfortunately not the reality until the point I show you ./testardo in action, bear with me please!

Selenium Ain't Portable

Despite being a wonderful project, Selenium WebDriver is great for Desktop but its Mobile Browser Version counter part is limited in terms of both supported platforms and supported browsers per platform.
In few words, Selenium is not suitable for all Mobile, Tablets, and Desktop browsers plus it requires knowledge of more than just JavaScript which is luckily, or unfortunately for others, the only programming language every browser understands today or did understand yesterday as well as the main one learned by Web Developers.

Simulators Are Liars

If you still trust simulators through your debugging tool, I've got a bad news for you: these are simply unreliable!
Starting from the real way events are dispatched and devices behaves compared with the browser engine you are testing on your Desktop, simulators might not be even able to give you a close scenario.
Look at this Chrome Bug to start with, for example, then realize also code behind your mobile browser is far from close to the one you are likely running on Desktop.
Not only unreliable then, simulators also give you a very fake idea of how performance will be, once landed on a real device.

Pay For Browser Testing ... No Thanks!

If testing is already something many companies and developers do not even invest some time that will inevitably pay back in both the short and the long term, imagine them investing time and money to have some test that will inevitably suffer cross browser and platform compatibility ... basically all available options I've considered and dropped these days.

Thanks Addy Anyway!

Addy Osmani has written excellent articles about testing, provided slides, examples, videos, but still there's not a complete solution.
While I really appreciate the work Addy is doing for the whole community about this field and for both client and server side world, I am pretty sure he would agree with me there's still not a simple to configure, simple to use, zero-stress config, and zero-spent money, testing solutions that satisfy the Web in its integrity, and for every old or modern device.

Episode IV - A New Hope

Considering Addy slides on Mobile Web Development Workflow, I will use same comparison points he used for those tools ... still talking about what testardo is, and what it can do at this stage.
  • [+] Free!
  • [+] Cross Platform
  • [+] Supports live reload
  • [+] Remote Inspect where supported
  • [+] Easily see how each change you save looks across devices
  • [+] Work with any modern AND not so modern Desktop and Mobile browser
  • [+] Does NOT Require you to install a package or extension
  • [+] Allows to match up scrolling and input
  • [+] Change urls and domain without needing to do that on devices
  • [-] Loads page into iframe
Long story short, almost every "plus" in Addy slides was actually a goal to reach with ./testardo, plus more:
  • [+] Loads external pages within a specific domain session
  • [+] Works and notifies even remotely
  • [+] If specified, it sends emails to the specified address and only once in order to not bother much if you are far away from "your free-time project" over the week end.
  • [+] It's entirely written in JavaScript and JavaScript is the only thing you need to know
  • [+] It allows you to inject before each test one or more external library as dependency (jQuery or others)
  • [+] It simulates as much as possible real DOM events triggered by users (note: at this time only the writing has been tested properly)
  • [+] It gives you an instant feedback with a green, yellow, or red with the eventual Error message notifying success, waiting for, or failure and the reason
  • [+] ... MOAR COMING ...
not convinced yet? Still no clue what is all this about?

testardo Live Demo

OK, the warning here is: take this video as a quick demo with a crappy setup as my home Wi-Fi router is, and considering testardo is at version 0.1.0 at the time I write this, thank you for your understanding :-)
So, here the video!

testardo - a browser and OS agnostic JS driver from Andrea Giammarchi on Vimeo.

Where, What, and How

So, everything is Open Source in Github and you are very welcome to contribute and help any way you can.
The single file you need is the built one but if you have node.js and npm installed, this is al you need to use testardo:
npm install -g testardo
After this, you should be able to run cross platform any test you want, where each test should be a module exports, similar to the one showed in this example.
I am trying to write a much better and complete documentation, right now you can find basically all you want to know and all you need inside the file itself, or simply running testardo without arguments.

Thank You All for your patience and Happy Testing!

Friday, January 10, 2014

[Webadamus] The Second Profecy

For who's not remembering, in 2009 I wrote a post about the future and it was actually quite accurate in its predictions:
  1. the blacktwit idea materialized via blocking action and anti spam features
  2. the twitcode materialized through a community called 140byt.es
  3. the twitter private service didn't land as I was expecting, but targeted and advanced ads are now part of the service
  4. Internet Explorer 9 has been the new direction, advanced browser, we were all waiting for, the one that marked the end of JScript, the one that for the first time claimed W3C standards with its engine
  5. Google OS still hasn't flied
  6. Apple introduced the fingerprints as password, others introduced 2 steps authentication to improve security
Basically all points became reality so I've decided to repeat the experiment .. I mean, what could be a better way to start the new year?
This time, due changes in the industry, it won't be strictly related to an online service or web development, this time is about tech in all its fields.
Bear in mind these are not necessarily related to this year, rather the following years of hi-tech ... ready?

The Microsoft Ongoing Decline

I have a sort of love/hate situation with this company but I am trying to be objective here:
  • wearable, embedded, Internet of Things, flying droids, watches, you name it ... there is not a bloody single new/innovative device in modern era that puts a Windows name or logo in its container: Linux, and Wrt, Android, iOS, Intel, ARM, these are the daily buzzwords in the industry since about 2 years ... no Microsoft, no Windows, it seems to me there is no space for MS software anywhere if not in good-old PCs that are selling everyday less than before
  • even if the beagleboard black has a version of Windows CE with amazing HW Acceleration capabilities ... nobody ever talked about it since it costs a fortune compared with any dev board or Android based device or TV dongle
  • Surface might sell but Microsoft is not an HW Company and the fact Windows should run in so many devices cannot make the OS easily updatable as iOS or OS X and their little circle of machines is
Dear Microsoft, I suggest you stop ignoring all developers boards, all ARM oriented projects, inevitably on Linux, and all Arduino or Raspberry PI things happening out there ... here a hint: everyone with a developer board would love to have decent drivers to use the tiny GPU at its best ... you go out with a lightweight OS that runs on Raspberry PI or any Allwinner based SoC and I assure you that will sell and put you closer to this revolution you keep seem missing.
If you'll ever listen to this post, at the same time, please never stop improving the HTML5 part that is making you one of my favorites companies when it comes to Web Development, thanks!

The Windows Phone Ongoing Rise

Not because I've worked there, simply because I know the quality behind, having NOKIA manufacturing Windows Phones, and considering improvements I could spot from 7 to 8+, cannot be anything but a Win!
WP8 is a great product many keeps ignoring or looking only at the Market side of the deal, I actually adore my relatively cheap Lumia 620 and what it's able to do daily for me.
Europe is apparently aware of the quality of these phones and the WP8 OS and I think it will keep improving in 2014 too. If only WP brand would change to a more generic Windows Mobile and be compatible with most known developers board and the underlying hardware, now that could be a nice challenge facing the Android domain in the field!

Update: Something Needs To Be Fixed!

Specially when it comes to the amount of apps and what's in the WP market, here a chat with other developers on the fact you cannot create even HTML5 for WP8 without owning a Windows 8 OS / PC.
I think Microsoft should detach WP or WinRT targets from its main Win 8 OS, MS is not Apple, and it should probably not try to be. I'd rather port Visual Studio for OS X same as Office has been available for years.

Parrots Will Stop "Free Flights"

OK, this is a very pessimistic view but I think it's inevitable. Under some silly "preserving streets security and privacy" flag different governments will make free flying parrots illegal or somehow strictly coupled to some paying service that monitors them every departing, every flying, and every landing.

So Will Wireless Devices

Did you know in some country you cannot buy a developer board with an enabled WiFi device on it?
The wearable and tiny-mobile era is also the era where digital sharing could finally get out the internet, reaching amazing transfer speed and the ease of just walking through a crowd.
The first version of bit torrent for embedded linux able to communicate with your watch and let you chose from people around you without even knowing them and without any need to log-in somewhere since no data provider is controlling the whole operation will be as successful as Napster has been at its time: you go to a party, you end up with movies, music, books, pictures, and everything else while you are dancing and totally anonymous ... now that's scary for the controlling system!

JavaScript Will "Fail"

You might read this as highly subjective point of view ... the time will tell though and I am talking about a counter direction from the success of these years.
The run for the chaos already started and it won't get any better. JavaScript development is proceeding in a way that who codes for node.js or a V8 target might be happy but who codes for the Web will be inevitably pissed off.
What makes JavaScript unique is a cross platform and engine problem no other language has: it's the only one that has fragmentation within the same version of the language ... that's where all fun is!
You chose Python 2.6, you gonna have bloody python 2.6 everywhere Python 2.6 is available. Same is for Python 3.X or whatever ... there are really few things in core that might not perfectly work as expected but the language version matters.
With JavaScript, a part from the fact "everyone makes slightly different JS engines these days", you might have major milestones like ES6 or ES7 but they all decided to promote early adoption of potentially broken API and trap themselves behind a feature detection nightmare.
Take the Proxy, already doubled in the same MDN documentation (tell me which one is not the standard at first look to these links) and not as mozProxy VS Proxy, it's same bloody thing nobody can feature-detect if not through stupid try catch over attempts, pretending these will tell us if we are within ES6 idea of Proxy or ... before that, who really knows?!
Moreover, early adoption means early problems impossible to fix once adopted and this is the trend we've been trained for last 3 years: it's early adoption, it's prefixed because not stable, you should not trust prefixed things but you know what? every freaking article on the web gonna abuse them so you'll feel comfortable using un-trustable code maybe even on production so that next step is indeed: who cares about API reliability!
There are few reason JS has been always considered a toy language ... I think dropping prefixes and promoting early unstable adoption of "whatever idea" cannot bring any benefit to anyone but apparently I am the only one that is concerned about this ... anyway ...

Transpiler Are NOT A Solution

At least at the very beginning, transpilers cannot be used for those browsers that do not support decent debugging environments, source maps, or ES6 at all. Try to imagine a target browser does not support a piece of JS in the way the transpiler creates it ... try to imagine that if a transpilers translate some ES5 magic linearly many things will break.
Try to imagine that a transpiler will not fix the DOM or any possible gotcha ... what you gonna do at that time, change the transpiler?
There are many reasons GWT didn't fly as adoption ... and these are just one part of the problem.
Another gotcha about transpilers, it's impossible to load at runtime anything, it's impossible to evaluate any piece of code, it's impossible to ... well, unless you don't want to throw a runtime transpiler in the middle!
Remember also that generators cannot be transpiled ... or better, transpilers can simulate them but if something goes wrong I wish you best luck finding out the problem AND solving it with a non capable generator ... remember, ES6 has not even a caller magic able to help debugging manually if necessary ... just saying ...
Last but not least, transpilers could also have bugs on top of buggy engines, how ideal ^_^

Evergreen Browsers Are A White Lie

I have bought for personal reason a Firefox OS phone ZTE Open and I am not receiving updates from ZTE since ever. This is just an example of broken ever green browser ... my browser is not updating since nothing is actually updating in there.
I can install Chrome in my iPod but that is not Chrome for Android and it does not update automagically as the Chrome in KitKat would do ... that is not an evergreen browser, neither is necessarily Safari mobile since I need to wait for the OS to push me updates and maybe I am not in the mood of applying them.
I could go on for hours ... passing through HW and memory limitation for some new feature as WebGL 3.0 could be, where my old phone with my old GPU that does not support Open GL ES 3.0 will simply never work as expected.
The evergreen browser is a partial myth we should re-consider ... surely Chrome demonstrated on the Desktop that it can keep update itself, but in the mobile era where the fragmentation between OS and HardWare is HUGE we must be fools to believe every device will never need to be changed again since the browser will update forever ... you know what I mean? Moreover, at least for other 2 years, there will be a big global market share where no source map, neither ES6, nor evergreen browsers will be available: welcome in the era of developing countries too!

After All, HTML5 FTW!

Even Intel Edison, the latest Quark based SD Card ... ahem, PC, has been developed "working primarily in C and Javascript" so, together with all massive improvements CSS is making and the robust framework the DOM is these days, even if slower than everything else surrounding it, HTML5 will keep pushing harder and gain unthinkable goals from embedded devices to large scale online portals/applications.

That's It For Now

And while I hope everything I wrote won't ever happen, except good things, I cannot wait to wake up in 2 years and check all things that were true and all things that were flops :-)

Thursday, November 21, 2013

Is Google Dart Death ?

Update actually it's now an ECMA Standard after SDK 1.0 release
This year more than ever, the Chrome Dev Summit event has been full of freaking interesting talks ... except one ... you guess which one ...
Despite the sensationalism of the chosen title, and just to be clear this is about my personal thoughts on such language (or better the way it keeps being introduced) so the trophy for the less interesting talk today goes to the ... drumroll ... Dart one.
Please note that in this post I am not judging speakers ability to either give a talk or their amazing programming skills, I am judging the content and the message to all developers like me.

Update on day 2 there is a Dart interview that eventually tells us more about what Dart is and how it can make web development better. Now this is what I'd like to know/see/hear and thank for, way better than how it has been re-introduced on day one. Back to the post, this was day 1

Where Are Real Achievements ?

I honestly wasn't expecting to hear again all JavaScript problems we learned and we know. At release 1.0 of the Dart language, I was expecting a talk about all the amazing things that Dart can do these days or improved 'till now ... instead, the whole talk was something like:
Dart does not have undefined as JavaScript does ... how cool is that?
Dart has classes, with scriptish syntax, much better than JavaScript ... how cool is that?
Dart has no coercion (aka easy casting through explicit + or ==) ... how cool is that? (n.d. is it?)
Dart has operators overload ... how cool is that? (n.d. so Dart has an extra problem JavaScript hadn't ...)
So now that the everyone got how shitty looks JavaScript, let's go to how Dart works ...

Dart Desugars To JavaScript

So please cut all this crap and start respecting the language able to show all your features because I'm really fed up of all these battles against JavaScript, when once again this language has demonstrated, with all its undefined "problems" thanks gosh no real developer has anymore since 2004, to be very flexible for the modern Web, coming from 14 years ago ... do you get it?
It does not matter how cool is your new language if everything it does can be done as well with JavaScript in all platforms that do not have a native Dart VM ... so just Respect The JavaScirpt and get over it: Dart lost before even trying!

Even Google Seems To Know It

The last talk of today, probably the one with less audience being late in the afternoon (but there were still many developers in that room), was about bringing native performance to the browser through Google Native Client.
Bear in mind, we are talking about native, not yet another VM that won't be able to do the impressive work that Emscripten did and asm.js is doing as well, both based on JavaScript as the target (so go home Dart, you are late to the party!)
The worst part of this post is that I don't even know anything about Dart and how great this could be on my daily basis job because all I know is that JavaScript, the language that I know the most, has coercion and an apparently infamous undefined value I can forget through the undefined == null coercion (problem solved Dart)

Be Polite And Respect JS Or Leave The House

I know I've historically been not so keen about Dart, but waiting a year to see progresses, waiting the final 1.0 release, and hear what I've heard today and from people that worked on V8 too, really got me thinking people are still wondering what the hell is all this about.
When you go at Ruby, Python, even PHP conferences, you hear about how great is any of these programming languages.
You don't need to tell everyone that JavaScript in IE8 is crap, if you are attending a scala conference, you know what I mean?
Even more disturbing, You cannot logically blame the language that makes your language work cross platform ... it's like blaming Assembler for making programming possible ... are you out of your mind?
I think if this is all I can learn about Dart V1.0, specially with ES6 and new Class syntax behind the corner already possible with transpilers, I rather would like to know it's gone ... they tried, but Google Native Client was a better possibility (and I have thoughts about that too ... a talk full of "we were in a plugin era" that talks about yet another browser plugin, even if integrated as Flash has always been in Chrome).
These are fun times Google, I think you are doing great stuff since ever ... but Dart .. show its real muscles or stop wasting ultra skilled developers on something nobody wants and nobody needs, thank you!

Tuesday, November 19, 2013

The Untold Awful Truth Behind Retina

I put in place a very simple test page made out of circles
  • first one is in svg without touching its ratio
  • second one is a canvas with anti aliases, if any, and with same svg size multiplied its ratio
  • third one, an image out of the previous canvas
  • forth one is just same canvas without anti alias, if any
At the end, little one in the left corner, the current used ratio the moment you see the page, out of my display script logic.
Discarding basically second and third circle, here the untold story about retina.


Above is the difference within SVG and same image with 2X ratio on a Nexus 5.

2X Images Aren't Enough

The fact Apple keeps telling developers "just use 2X images and you gonna be OK" does not mean it's OK. The iPad mini retina, together with the iPod retina, and I expect all others, are actually trapped behind this mythologic 2X.
That's correct, the border of both svg and aliased canvas circles in iPad retina look the same. What's the issue in here? That in 326 pixels per inches the quality cannot be that 2X same of 264 ppi or just 220 in case of MBP so basically the display is capable of more, but the software (or trapped hardware?) won't show you any difference.
How can I tell? If you check circle borders you can tell it too!

Nexus 5 3X Isn't Enough

If you check the border of both svg and aliased canvas circles again but with your Nexus 5, you'll notice that while SVG is very sharp and perfectly aliased, the canvas 3X version is not.
In order to obtain a similar result you might want to scale up the ratio a little bit, let's say 4X ... you see? with this latest link the canvas is almost as sharp as the SVG. Still not a perfect ratio with 445 pixels per inches.

Those Bad Boys

So the honest Blackberry 10 with its 2.2437500953674316 (!) ratio looks actually sharper once forced at 2X with less artifacts visible on such good display.
Android 2.X on Samsung Galaxy Y with its 0.75 ratio looks smooth and antialiased enough.
The least considered device, at least in the US, aka Windows Phone that has a ratio of 1.5 since version 7 devices, looks very sharp! It is possible to compare with blurry circle perimeter forcing ratio at 1X ... that's how every logo and/or graphics is looking these days in Windows Phone: crap, because most likely you, your framework, or your CDN, is serving 1X images thinking that's enough for that screen. I tell you there is already a huge different, you should try it!

This Is MA MA MA MA MA MA MA MA Mad Mad Madness

The last project I am working on some spare time over the week end ended up with some code like this:
function createShortcutIcon(iconCreator) {
  for(var
    link1, link2,
    // used to generate icons at runtime
    canvas = document.createElement('canvas'),
    // where to place links
    fragment = document.createDocumentFragment(),
    sizes = [
      30, 57, 60, 72, 114, 128, 144, 173, 196
      // completely random , hopefully future proof, entries
      , 214, 256
      // btw, the whole sizes and 2X idea is so wrong ...
    ],
    i = 0; i < sizes.length; i++
  ) {
    link1 = document.createElement('link');
    link2 = document.createElement('link');
    link1.rel = 'shortcut icon';
    link2.rel = 'apple-touch-icon';
    link1.type = link2.type = 'image/png';
    link1.href = link2.href = iconCreator(
      canvas, sizes[i], '#E6A72A', '#286868'
    ).toDataURL();
    link1.setAttribute('sizes', link1.sizes = sizes[i] + 'x' + sizes[i]);
    link2.setAttribute('sizes', link1.sizes);
    fragment.appendChild(link1);
    fragment.appendChild(link2);
  }
  (document.head ||
   document.querySelector('head')
  ).appendChild(fragment);
}
Above non-sense creates every sharp icon for Home Screen saving in every bloody device I have to deal with, where it does not make sense to talk pixels when we cannot know dynamically/upfront how many we need.

The FirefoxOS Joke

There is a manifest validator, which is nice, that tells you that the icon supposed to be 60x60, or 90x90, but maybe 120x120 is good too, and if you really want to cover everything, provide 256x256, 128x128, 64x64, 32x32 and 16x16 ... are you mo$#^*@&^#&*^fu&#&*!^%$#&@ng kidding me?

An Epic Fail, IMHO

This part of moving the web forward, including the inline CSS data URI that unfortunately cannot scale as well with all sort of devices pixels ratio, unless you don't inline SVG directly, took a very weird direction where nobody knows anymroe what to do to make an image, an icon, looks good across all platforms.
Raster Images Are Death, IMHO, and we should provide maximum 3 sizes for these, as it is already for stremed video: from the very-high quality, to the medium, and low one for those that have to pay for bandwidth but holy crap there's no way even Akamai will ever provide the right ratio for every device so why on bloody earth we should write stuff like this?
<img srcset="
  320.jpg .89x 400w, 480.jpg 1.33x 400w, 640.jpg 1.78x 400w,
  480.jpg 1.04x 520w, 640.jpg 1.39x 520w, 960.jpg 2.09x 520w,
  640.jpg 1.1x 639w, 960.jpg 1.66x 639w, 1280 2.2x 639w,
  320.jpg 0.89x 800w, 480.jpg 1.33x 800w, 640.jpg 1.78x 800w,
  480.jpg 1.09x 959w, 640.jpg 1.45x 959w, 960.jpg 2.18x 959w,
  320.jpg 0.89x 1200w, 480.jpg 1.33x 1200w, 640.jpg 1.78x 1200w,
  480.jpg 1.09x 1440w, 640.jpg 1.45x 1440w, 960.jpg 2.18x 1440w,
  480.jpg 0.86x 1920w, 640.jpg 1.14x 1920w, 960.jpg 1.71x 1920w, 1280 2.29x 1920w,
  640.jpg 0.86x, 960.jpg 1.29x, 1280 1.71x, 1920 2.57x
">
This is not me speculating, Mr. Tab Atkins Jr wrote a post about this and he is one of those guys that are trying to make good standards for everybody future ... do you see the problem I am talking about now?

Solution

I wish I had a silver bullet for this, unfortunately nobody can tell hardware and screen developers that they should stick with few predefined resolutions: they are competing with each other to put as many pixels as they can in a smaller part to make it sharper ... and while somebody complained our eyes cannot even spot the difference, I have created the circle test that is showing to my eyes that circles are not so sharp and crisp yet, but I don't think the web will ever go far using raster images, no matter how optimized are these since these do not scale.
SVG or make it vectorial All The Things is my current mantra ... that does not require a new manifest for FirefoxOS per each new device with a better screen in the near future.

Wednesday, November 13, 2013

A Not So Geek Person On A Nexus 5

The first day it was announced, I've ordered a Nexus 5 due its value for money ratio, probably one of the best out there, its Android KitKat support, and on top of everything, due its Google Chrome first approach when it comes to mobile browsing, and as you know I do mobile web development since quite a while so that's something I should test/take care: thanks gosh the random WebKit stock browser era is ending!
Anyway ...

This Is Not About Me

Another person got this phone for another reason: to improve a forgotten Sony Ericsson Xperia Arc S on Android 4.0.4 experience, a phone so stupid it cannot even upgrade its own preinstalled apps thanks to its inability to use the external SD card as storage for preinstalled software such Google Maps, Google Play Store, Google Whatever. This is not about me, then not about somebody that knew what was going to buy, going to appreciate as update, going to use it at its best ... this is a post on behalf of the person that received this Nexus 5 phone, a person that I rather don't even mention because it does not matter: she is just a user, and not a geek one!

First Contact

Now, the very first reaction was something like:
OMG it's huge!
Well, that's actually a valid point. Phones are getting too big, imho. Phones should be phones, this trend where phones are getting closer to mini tablets ... I honestly never got it. I want to be able to put my phone in my pockes, any pockets, as I was very happy doing that when phones like this were the best option ever.

More on the first day, I've insisted to give it a chance, 'cause it's going to work, and it's going to be better, faster, easier, stronger ... and the whole Daft Punk repertory.
And so she did ...

Few More Days

Few concerns came up, such "where are my contacts?" or simpler "where are SMS?" or stuff like "why is my battery lasting 1/3 of the old phone?" and reasonable questions like these.
I mean, I have an answer for all these questions but why a normal user should be so disoriented? Battery a part, how can the old Android SMS icon disappear like that so that nobody would click it and re-learn that hangout is now the new SMS manager? And still ...
"I don't want Google to know all about my SMS".
Specially in these days where NSA story is under everybody nose and were common users keep getting scared and aware about security every day more, and I am lucky I just know all this stuff and somehow still manage to sleep during the night, remembering to never write my plans to conquer the world via web or mobile phone data, I didn't even feel the need to blame her or reply. I mean .... right? A single software knows everything I write and receive? That's scary! How can I even start explaining that is basically what happens since the beginning of the smart phone era and even before that it was basically possible/the same?
How to even start a conversation such: "Hey, that's just an aggregator app. You still send SMS when it's about SMS and Web or MMS when it's about those things, don't panic!"
I don't indeed, and keep observing the situation ... until today ...

The Straw That Broke The Camel's Back

I am just quoting here:
I start thinking I want my old phone back.
I have enough of Google in the middle of everything I do.
I had to quickly save a mobile phone number, this phone asked me so many things I threw it on the table and grabbed pen and paper to write this number down!
Moreover, I don't want to re-login to a gmail account for everything I do with my life!
I don't know what you think about this, but this is actually another valid point I give for granted. I know Google effort to simplify users life is great, but also there are limits where asking, and making something once an easy step more complicated, because of "features" somebody may not even desire, isn't exactly UX progress.
This happened to me too, and many times, where technology that supposes to make my life easier got so selfish that made impossible for me to get a result and, as result, I had to drop such technology.
An alarm that forgets to wake you up is pointless, you know what I mean ...
We already reached that regression where either your phone is on or your alarm will never wake you up, as it has been for all devices "before smart phones" generation ... but right now ...
A phone, which historically has an easy to access contact list, should never be in the middle and ask which email or gmail account to use to store a contact, it should do that eventually after the operation and batched somehow, to be non blocking for the user, but still clever for the next time.

Last On G+

To have access to Apple, Facebook, Linked In, and any other social network, you don't need a Gmail account. To have access to Google Plus you do need a Gmail Account. I mean, that's actually fair from Google perspective, but not so cheap or easy for people that use the same email since ever and are not planning to embrace Gmail any time soon.
That's how you could reach everyone on this planet, letting them use everyday tools and stuff they are used to, still offering great services as Google Plus is.
That was actually the latest, most disappointing complain I've heard, about this "all you can Google" phone that did not match the daily life of somebody outside "that circle".

As Summary

I still believe the Nexus 5 is the best Android phone I've personally ever seen and used, but I have quite a background about Android since version 1.5, and I believe we, in IT, should never forget that some people don't like to change a phone each year, some people don't like to change anything at all, but even more adventures prone people, might want to keep having simple tasks simple, not a charger with them all the time, and no need to buy clothes with bigger pockets, as well as being able to just save a bloody contact in few steps: now that's progress, right?

P.S. I am still quite happy with my Lumia 620, I don't think there's a phone out there that could make me happier right now, but this is another story I am planning to tell you soon.
Stay tuned ;-)

Sunday, November 03, 2013

dumb.min

This is a needed explanation of a tweet of mine that has been mostly and instantly mistaken (just read through all comments):
this keeps bugging me: can we all please stop putting .min suffix when it comes to save bytes and use .max instead when size doesn't matter?
I've already posted about this a while ago but haven't seen much feedback/changes after that so here again trying to explain this matter only.
As spoiler, please don't take it personal or get offended by the abused dumb word, I am the first one that used and probably still use somewhere the .min suffix, aright?

Logically Speaking

So here the thing: we all use automations in order to create minified version of our files and if we don't we should. There are tons of easy to use tools out there, repositories such gitstrap that works with Makefile or grunt that could watch all files and keep building for us ... pick an option, create your own one, do whatever, and at the end create the build folder.

The dumb.min.js Output

Since we use automations, there's no reason on earth to provide to our users 4 extra bytes for a script, css, anything minified that is there to be served as fast as possible.
I mean ... the purpose of minification is to serve the minimum possible amount of bytes per each request, right? Where even headers and file names matter per every single network request, right?
Then .min is a name for developers that want to feel cool they are serving the minified version, throwing 4 extra bytes to every user, in every page, and for everything that uses such suffix conventions ... for who's supposed to be convenient?
The user? No! The bandwidth? No! The semantic? ...

dumb semantic

You now open any website that uses a CDN to load a common library. Let's choose jQuery, one of the most popular, right?
You go in the download page and there is no link to any CDN that does not end up with .min ... now ask yourself: who is that dumb that would ever serve the full, uncompressed, non gzipped/deflated version, of any CDN library? Develoeprs to debug? Good, they are 1% of the traffic of that website ... so is this how we do things? Penalizing the default use case in favor of dumb laziness?
What do you expect from a CDN in first place if not the best available and performant options to serve the file?

... and mootools-yui-compressed.js ...

When I've read this page I thought "this must be a joke".
Seriously, check all that Google CDN list. Actually, what does not contain .min is really not minified at all! There are developers out there serving Prototype 1.7 with comments and moreover, the gold medal for the best anti-pattern naming convention for a minified file goes to that mootools one. How about we put the date, and the list of all authors and the license name of both YUI and MooTools in there?</sarcasm>
140byt.es offers entire scripts in a tweet size, and we think naming something with 15 extra pointless-for-purpose chars as -yui-compressed is good for anyone out there?
Bear in mind this is not a real/concrete issue in using MooTools library itself, as explained later on, but a matter of logic that once applied everywhere, makes things look weird (aka: "something went terribly wrong at some point on the internet").
In this latter case, even automations could be improved and use -yc or something else if really needed (as if the tool used means different library behavior ... hopefully no, otherwise drop that tool!)

... plus min.map.js ...

If it was about having a convention able to tell the browser where to look for the file I would re-thinnk this ... but as you can see in Microsoft CDN all files need to have the equivalently named one with the map suffix so once again, who's gonna benefit from this dumb convention somebody created one day and nobody ever thought it wasn't that clever?

Quoting @craigpatik
...min.js, ...min.css, ...min.svg — one of those pieces has useful meaning; the other is redundant.

Not CDNs Fault

Absolutely not, it's entirely developers fault because their automation most likely will create those files with those names.
Still using jQuery as example, but many libraries are like this, the task to create distribution files is like:
distpaths = [
  "dist/jquery.js",
  "dist/jquery.min.map",
  "dist/jquery.min.js"
]
How utterly simple would be to have any of these variant instead ?
distpaths = [
  "dist/jquery.max.js",
  "dist/jquery.map",
  "dist/jquery.js"
]

// or ...
distpaths = [
  "dist/jquery.source.js",
  "dist/jquery.map",
  "dist/jquery.js"
]

// or ...
distpaths = [
  "dist/jquery.src.js",
  "dist/jquery.map",
  "dist/jquery.js"
]

// or ...
distpaths = [
  "dist/jquery.yo-mama-can-build-scripts-too.js",
  "dist/jquery.map",
  "dist/jquery.js"
]

What Will We Gain Doing So

So, it's not that suddenly anything will go twice as fast or any user will ever notice that, it's just a pure semantic, logic, sense sake and that feeling of "doing it right" that might show new comers on the web that we are not so silly that to serve less bytes we automatically put 4 extra on top just because ... no: we discussed about it, we thought about it, and we choose the best option available not going too far with extreme non-sense optimization as "dropping the whole name" would be, simply applying common sense and logic to the chosen pattern.

Otherwise, it's like thinking that to distribute an executable we need to use program.compiled.exe as name ... we don't, we know that's already the compiled version of an executable, same is for served files, in 2013 they should be by default optimized, and the source one, eventually available for developers purpose.

Once again, not a big deal. We can all sleep during the night keeping things in this way but every time you'll setup a build script again, maybe you'll drop that dumb repeated .min and do things logically in every single layer of your stack.

a bit of Math

Here I've quickly found some jQuery CDN related stats and I am pretty sure the amount of website using this library is more than "just 16000" but if we take that and multiply by 4, we have 64000 pointless extra bytes for jQuery only. Now, assuming every site will have some extra plugin or script, and some extra CSS, let's say a minimum of 4 total files, we'll have a minimum of 256000 pointless bytes on the air nobody needs, wants, uses. If we multiply these bytes for the extra space a name could take in any filesystem, the extra 4 bytes every single CDN request url will transport ... etc etc ... you see?

As conclusion, and even if 4 bytes aren't an issue in a singular case, can we all agree that if the whole internet uses .min in every (probably minified too) HTML file to refer external resources, there is an absurdly redundant amount of pointless data which aim is concretely unknown for everybody?
Thanks for your time and your possible, future, collaboration.