Posts

Showing posts with the label protocol

Why JSON Won ... And Is Good As It Is

I keep seeing developers complaining about different things with JSON protocol and don't get me wrong, I've been the first one trying to implement any sort of alternative starting from JSOMON and many others ... OK? Well, after so many years of client/server development is not that I've given up on thinking " something could be better or different ", is just that I have learned on my skin all reasons JSON is damn good as it is, and here just a few of these reasons. Reliable Serialization ? No , 'cause YAGNI . There are few serialization processes I know that kinda work as expected and since ever, PHP serialize is a good example. Recursion is not a problem, is part of the serialization process to solve it, as well as classes together with protected and private properties. You can save almost any object within its state, even if this object won't be, as reference, the same you serialized .. and I would say: of course ! There are also two handy methods, _...

(က) Polpetta, any folder is served spiced

The quick version is: have you ever thought about using node.js to make any folder as a web-server and in a PHPish way where .njs files are required and executed runtime as node modules ? Oh well, I did, and this is the result in Github: polpetta ... enjoy!

IE8 Beta 2 - inline images, and anything else

With IE8, we finally can "play" with inline images, specially for CSS or other little decorations. The main limitation is that the length of the data protocol has a maximum fixed length, but even worst is that IE8 apparently introduced the data protocol only for images. In another scenario,where we would like to use the same technique for other purposes, IE is still the only browser that does not respect standards. This is an example: function evalazy(src, callback){ var script = document.createElement("script"), body = document.documentElement; if(callback) script.onload = callback; script.type = "application/javascript"; script.src = "data:" + script.type + "," + encodeURIComponent(src); body.removeChild(body.appendChild(script)); }; Above function is able to evaluate valid JavaScript code in an asynchronous way, calling a callback, if any, when evaluation has been completed ( kinda load runt...