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

Wednesday, October 30, 2013

My Dreamed Developer Board

It looks like every single developer board out there lacks something and still not a single one, not the Raspberry Pi, not the Beaglebone Black, literally none of them, has a not great, not good, even decent GPU support. Update here a complementary post form an Open Source drivers Developer.

The Open Source World VS any GPU

It's unbelievable how many Open Source Hardware and CPUs producers there are out there and with ARM in first place, but even same producers do not ever let Linux fellas develop for them ... free men/women work they don't want because keeping their little messy driver and schema secret or protected via some NDA is the rude reality we face since basically ever. Only Intel seems to have open source drivers, but not open source schematics, and I am looking forward to their new embedded effort starting with Galileo on Arduino but still, that will be a huge step forward for the OS community, and still a wall to break for the community itself.

A Bold Approach via Kickstarter

Sir Francis Bruno and his team went out with a Complete Verilog implementation of a 2D/ 3D graphics processor capable of OpenGL and D3D w/ full test suite idea, based on some hardware they've been working since a while and 20+ years of experience on top of GPU and Graphic Cards.
Their mission and idea has been described in this post from Brian Benchoff too and I could not find rather hilarious the amount of free complaining their goal received.
So here the deal, with $200.000 USD they'll finalize, cleanup, and put in the Open Source world an embeddable 2D graphic card which is what most Linux users would love to have in order to fix all flicking, bad reverse engineering, missing updates, or slow rendering in their desktop environment ... but they complain it's too much ...
For $400.000 they'll release a full OpenGL and Direct 3D ... look, I don't even know where to start building such thing so I am the last one to judge this goal but regardless, is not that we ever had an option, right? Open Source does not mean these guys will put themselves down for few bucks without eating, testing, thinking about their families just for the cause, right? So once again, no idea how people could complain about this.
For $600.000 USD they promise performance improvements, something that will come regardless once everything is Open Source and available to the community, right ? Last, but not least, with a $1.000.000 USD they'll go further releasing a universal shader version of the whole refactored package:
This is our ultimate stretch goal and requires a complete redesign. It's something we have been wanting to do for years, but didn't have the resources. This would allow us to create a complete open source implementation of a modern day graphics accelerator. If we receive more than the above, it will allow us to devote more time and effort to the project and we'll be able to release code sooner.

I Have Backed Them!

And Kudos, because if until now nobody has ever done this is probably because:
  • it is actually not simple at all, I'd love to read all complains about the stretch goal but also see any of them doing this for less!
  • it does not pay back once everyone else could improve without royalties
  • it requires a huge amount of time (they say Q2 2015, I think that's optimistic)
  • it's like putting themselves under all Open Source world reflectors where they cannot fail, if the goal is reached, or they probably won't find a job anymore in this field
  • more I have no competences to even judge
Last thought on that would be: isn't Kickstarter excellent exactly for these kind of goals where alone is not possible due amount of resource and time required?
I'd rather bake more projects that make the real difference instead of yet another key-ring with a led light or we won't make huge progresses in the Open Source, and its embedded, scenario ... too much penalized, in my opinion, by this, and only this, HUGE gap that nobody is trying to close (or even worst, judged if trying).
I really hope they'll reach the ultimate goal, a real mini computer, with graphics and games included, with linux on top, and a fully open source hardware acceleration: still a myth at the end of 2013, only Android and its binaries are somehow working ... not Linux, no drivers and no interest for it.

Which Board Do I Dream

Well, these are features I'd buy without even thinking, for a reasonable price:
  • Dual Core (or more) CPU with a decent amount of cache and at least 1 Ghz clock, as it is for the A20 or greater
  • 2GB (or more) DDR at least @ 400Mhz as it is for the Utilite
  • 2GB (or more) Nand as it is for pcDuino
  • GPU with OpenGL ES 3.0 and OpenCL with 64MB (or more) of RAM
  • an SD card compatible with at least 32GB SD class 10 (or better) as the BBB or any other
  • an HDMI output (audio on it) as many current boards
  • a small factor size as the MarsBoard, BBB, or RPi
  • en Ethernet, as many of this
  • a Wi-Fi as the Arduino Yun has already (Bluetooth would be a plus)
These are in my opinion the bare essential to have a competitive Desktop/Server embedded system capable of much more than just watch TV or switch on/off some led but irony wants that nt a single board out there has these features all combined.
Today, such board would cost around $70, as it was the first Beaglebone at the beginning, and it was a success!
Intel, I am looking at you, hoping those GPU drivers, will be Open Source too ;-)

Sunday, October 06, 2013

Did Arduino Yún Win Them All ?

While I am still excited about Tessel release date, I've received this Arduino Yun beauty a couple of days ago and I must say this is a pretty damn good little board!

Zero Experience With Arduino? No Problems

This is the very first Arduino board for me and I've always been a bit skeptical about these boards VS Raspberry Pi, Cubieboard, BeagleBone Black, and friends potentials.
"Let's be honest, it's cool to switch on and off some lightbulb", was repeating the little voice inside my head (OMG, I hear voices!!!!), "but how much more I could do with a fully powered Linux board", was the answer from voice at analogOutput(PIN_2, 13) (jeeeeez, I'm done here!).
Anyway, the point in this paragraph is about how easy it has been to start from the scratch to have a complete software up and running via WiFi ... let's talk about that later on ...

Not Just Sketches!

400Mhz aren't bad at all for most basic common tasks, neither are 64MB of RAM. So the raw power is already higher than tessel plus the microSD card is integrated and as soon as you put your super fast class 10 or higher card in there, a new world of possibilities become instantly available even if not directly integrated with the OS.

Connecting Arduino To A SQLite3 Database

You read correctly, and probably everyone else out there has already done this. I have to admit I didn't even google for this, it has simply been conceptually the very first problem to solve.
Interoperate with Linux behind the Arduino capabilities is one thing, keep tracking, updating, exchanging data about anything between these two systems and independently, brings them in a new level of possibilities.

A Tail Of SQLite3 Wrapping Experience

One of my latest projects which is targeting every OS but is tested mainly in embedded Linux boards is called dblite and it conceptually does with a higher level of possibilities, what this sketch does too: connect to an sqlite3 database through the sqlite3-cli interface and do everything that would possible to do directly in there.
The difference between this Arduino Yun approach and dblite is that here the equivalent of nodejs spawn is performed per every single SQL statement and not once per application lifecycle.

20 Minutes Plus Some Remote Testing

Yeah, the little IDE that comes with Arduino is full of examples too and most of them specific for the Yun.
This has been the easiest, fastest, learning curve ever for something so hard to do a while ago!
Massive kudos for the team, including all connational chaps working on it, too bad this Yun is the first board not fully made in Italy though :D

What's Not So Easy Yet

Latest version of Linano could be built with a MIPS compatible gcc so that it is possible to build directly through the board some software even if it will probably take forever in bigger apps.
It is also quite painful to rebuild the whole OS instead of having some incremental update possibility directly via the package manager and all you can do right now is cross compile hoping that after 5 hours you won't have an error.
I am using an Atom based Ubuntu x64 netbook for this task so maybe that's why it takes forever, however it never took that long to prepare a linux distribution for other embedded boards ... I hope things will become easier to install, build in the board, or update thanks to the constant effort from OpenWrt community (or maybe ... some link that points me on how to do these things in a way that works? :P)

Have fun with Arduino!

Friday, October 04, 2013

Web Development Has Never Been So Beautiful !

In an era where iOS7 does many steps backward while Chrome adopt a full Home Screen App like solution, it's kinda normal to be confused about the current status of Web Development.
I won't hold it any further and tell you it's actually in the best shape ever, a situation rarely seen in the past and probably not so nice in the near feature where massive JavaScript changes will land in some ever green browser.

The DOM Is Awesome !

Developers still learn and code as if IE6 is the only browser to take care of ... well, we are lucky enough today the situation is not that anymore so that IE8 is the latest browser we might want to deal with, if we really care about those people stuck behind such jurassic browser.

DOM Level 4 For Every Browser

Not kidding here, the latest DOM Level 4 API is absolutely nice:
  • events and custom events with bubbling work as expected
  • patterns like handleEvent, a universal fast and cross browser solution to callbacks hell and hundreds of pointless bind in your code, is available for any sort of browser or event
  • dispatching events has never been so easy, with possible extra detail to carry on through the bubbling process via el.dispatchEvent(new CustomEvent('type', {bubbles:true, detail:object}))
I could talk about every single new feature that makes the DOM L4 awesome and the good news is that everything has been tested in every browser and it works, included the infamous Internet Explorer 8, thanks to this repo!

ES5 Is Everywhere

Probably not fully implemented as specs say, ES5 is in any case in every browser we can think of these days.
It was already almost fully implemented in webOS, it works like a charm in IE9, it's in every ever green browser plus it has been early adopted almost in every Mobile Browser, from iOS 5.1, the latest update available for old iPad and iPhones, through Android 2.3 and others. Seriously, even Nokia ASHA Xpress Browser scores well when it comes to ES5 support!

ES5 Can Fix The DOM Too

Thanks to its wide adoption and thanks to the fact every ES5 capable browser knows DOM Element prototypes too, included IE8 and its DOM only Object.defineProperty() functionality, the DOM can be fixed in almost all its missing parts.

This is how it was possible, as example, to implement classList and DOMTokenList behavior in both IE8 and iOS 5 or Nokia ASHA browser, where the early implementation does not accept multiple arguments and does not respect standards for toggle method.

Not Only The DOM

The current status of the web is that everything can be reasonably fixed with available tools. This is the best thing ever happened so far and all goes to the decision made in 2008 to abandon specifications that were breaking the web due different syntax.
At that time the decision was to extend ES specs or fix them with what was possible/available at that time.
This is paying back now, after 5 years, where almost everything can be normalized through amazing libraries such es5-shim, including its sham that fixes other aspects of ES5 specs in a reasonable way.

Everything Is Working Now

It sounds overall optimistic but green is what you should see once you click this link, followed by this one.
About 140 Tests Of Awesomeness I am going to explain to you after introducing yet another repository ...

The Dreamerplate

Similar to a boilerplate, the dreamerplate is a repo that includes all the needed basics to have an homogeneous environment across all modern and jurassic browsers you can imagine surfing the internet these days.
From IE8 to anything else that came after, you can try the base testing page in console, dreaming about an environment where you can:
// use de-facto standards to define methods
document.body.on('click', function (e) {
  this.append(' ' + e.timeStamp);

// give for grant all you need is there
  console.log.bind(console, 'bye bye')

// use widely adopted and future proof standards
// instead of needing this or that utility
  new CustomEvent('unload')

// or simply go the way you are used to

// or, if coming from node ...

// use a better DOM approach avoiding
// memory leaks and the need of WeakMaps
// or the need to bind everything
].forEach(function (type) {
  document.documentElement.on(type, this);
}, {
  handleEvent: function (e) {
    this['on' + e.type](e);
  onmousedown: function (e) {
    // this is the object, not the node
    this.dragging = true;
  onmousemove: function (e) {
    if (this.dragging) {
        e.pageX, e.pageY
      ].join(', '));
  onmouseup: function (e) {
    this.dragging = false;

// use window timers as they are meant to be used
// with extra arguments capabilities, i.e.
  requestAnimationFrame, // * not normalized in dreamerplate yet
  1000 / 30, // Fixed 30 FPS
  function () {
    // the expensive callback to optimize
    var marginLeft = parseFloat( || 0; = (marginLeft + 1) + 'px';

// avoid callback hell with bind and lost references
var handler = {method: function (e) {
  alert(this === handler);, this.boundTo(this.method));
  // bound to create a single bound reference per object
  // never loose a bound function again and find them
  // through the bound object these belong!
document.body.on('click', handler.boundTo('method'));

Eddy.JS To The Rescue

Most of the event handling magic, fully compatible with node.js too, is an eddy.js enrichment (word you can easily swap with addiction once you start using it ;-))
Latest eddy news are the ability to be compatible with CustomEvent, speeding also up the trigger logic too overbloated until version 0.4, and the W3C trigger returned value behavior, always false when any involved listener in the event called preventDefault() and the event was cancelable a default when non a native Event object is passed, or regardless when eddy is not invoked through DOM nodes but rather node.js or just JS scripts.
For the DOM version only, eddy relies now on dom4 and, if needed to be supported, ie8 upfront.

Eddy Array Extras

One of the most handy parts about eddy is the ability to use on, off, emit, and trigger recursively within Arrays.
].on('click', function (e) {
Being recursive, an Array of objects or DOM elements, containing eventually sub elements, can perform a single addEventListener like operation at once, promoting recycling of functions which aim is to provide the same functionality in different events or situations.

Got It, But What Does It Mean In Terms Of Bandwidth ?

The size of both eddy and dom4, the most common configuration you gonna need to provide, is 2.5 KB minzipped. Everything else is browser and sOS file dependent.

Enjoy theese days, since those when ES6 will be released will be much harder and confusing than current status as it has been, and probably always been, for the Web when new things arrive and nobody is fully ready ^_^