Posts

Showing posts from December, 2009

JS And CSS3 Snow FX? Happy Holidays!

I was expecting some sort of snow experiment after one of my posts in Ajaxian but apparently nobody tried ... and there I am :) Check out my JavaScript and CSS3 Snow Effect and have best holidays, I gonna fly tomorrow to meet my family and my friends for few days in Italy!

THIS IS THE MEN

Download a brand new song off our upcoming full length LP which will be out in early/mid March here... Problems/Burning Up

Leaving London for Berlin - Nokia Gate5

This is just a quick post. First of all, my apologies about my recent absence: you have not even a rough idea about how busy I have been these days ... Everything is a rush, but if "the rush" is for a good cause it's just a pleasure! I am organizing my relocation which means I need to close contracts here, flat included, bills, sort out any kind of paperwork I need to leave UK in basically 2 weeks, while I am working, and I still have no idea where I gonna sleep, where I gonna move, but it does not matter: I can't wait to start this new role in Nokia! Why Nokia To be honest, I had different choices, but Nokia company in my opinion has been: Perfectly Organized When you have to deal with big companies you deal with teams, and in this case I had the opportunity to meet extremely interesting teams and persons while somebody else is not even able to organize their recruitment, putting online " We Are Looking For ... " while they have "all they are looking ...

document.write(shenanigans)

As I have twitted yesterday, I have discovered one of the most weird JavaScript behaviors ever thanks to the document.write method. The Problem We All Know ... document.write has been used for ages since it is basically the only way we have to create a blocking script during a page download. The advantage is that a script included via document.write could write something else in that point of the page and again via document.write . Classic examples are Google AdSense or others similar services where we would like to put in place an iframe with banners or an external service. The most known side effect of the document.write method is that if the document has been already loaded (DOMContentLoaded or onload event) it could " destroy " our web page erasing everything and showing nothing except what we wrote via this method. This means that every time we include in our page an external resource, we should be sure this resource will be included synchronously otherwise we could...

TaskSpeed - The Real Cheat

Inline "make" test that no library should " outperform " - this is a reply to this post which has few good points, we all know about browsers VS SunSpider, and other tests, but it falls down when it criticizes the TaskSpeed aim which is completely different. "make": function(){ for(var el = document.createElement("div"), outperform_this = [], i = 0, length = 250; i < length; ++i ) outperform_this[i] = '<ul class="fromcode" id="setid' + i + '"><li>one</li><li>two</li><li>three</li></ul>' ; el.innerHTML = outperform_this.join(""); for(var i = 0, fragment = document.createDocumentFragment(), childNodes = el.childNodes; i < length; ++i) fragment.appendChild(childNodes[0]) ; document.body.appendChild(fragment); if(document.querySelectorAll) return document.querySelectorAll(...

Two Step Backward: Read Cookies!

OK, I am the first one with non updated examples in devpro, but today just as curiosity I decided to have a look into every cookie related piece of library. Apparently to retrieve cookies we have loops, splits, multiple RegExp, and any other sort of alchemy ... but are these functions the only one we need to read cookies? var Cookie = { get:function (name) { var match = document.cookie.match( new RegExp("(?:^|;\\s*)" + name + "=([^;]*?)", "g") ); return match && match[1]; }, getAll:function () { var re = new RegExp("([^=]+?)=([^;]*?)(?:;\\s*|$)", "g"), cookie = "" + document.cookie, result = {}, match ; while(match = re.exec(cookie)) result[match[1]] = match[2] ; return result; } }; I think sometimes we overload methods without a valid reason, but maybe I am missing something ... t...

Bing UK - Round 2

I've been contacted for the second time by Jordi Ribas from Bing.com but this time for a one to one chat rather than just a Round Table . First of all, even if I keep thinking why on earth they would like to know my opinion, I do appreciate the fact Microsoft teams are getting closer with developers as well (the problem is: do they know I am a web developer and not a web surfer?) One Hour Chat Nothing more and quite frenetic: I had a lot of questions while Jordi had to show me improvements since first disaster where they introduced bing UK showing us the USA version ... Different Teams Apparently Team System is not that powerful as we think. Microsoft teams are not sharing realtime code or improvements. There is a delay, that could be few days up to few months between USA and other versions and every team seems to be in charge of proper country search algorithm ... In my opinion this is a massive waste of resources for whatever IT company. The team knowledge is partially sandboxed...

mjst - Micro JavaScript Template Engine

This is the content I've written so far in the official mjst repository . I'd love to know your thoughts about this little experiment, cheers! What mjst is a lightweight, about 1Kb minified and gzipped, and performances focused template engine with standards support. There are dozens JavaScript ? Template Engines solutions out there but as far as I know this is the only one based on validation for both client and server side programming languages. How There is one single function to call: // via text (e.g. Ajax or innerHTML from a template node) var transformed = mjst ( '<?js var hello = "mjst!"; ?><js-hello/>' ); // classic template node example < script id = "mytpl" type = "text/html" >   <? js     var hello = "mjst!" ;   ?>   < js - hello /> < /script> myEl.innerHTML = mjst(document.getElementById("mytpl")); / / via XML ( e . g . Ajax or a created document ) // this is a ...

with: Some Good Example

OK, I have said my last post would have been the last one about the with statement ... well, before I close the argument, I would like to show a couple of common good examples. Solve References Problem This is what somebody defined a tiny masterpiece with({o:myreference}){ o.doStuff(); o.var1 = "whatever"; // etc etc ... }; Above example annihilate every blame about the not sure if that is the var I meant to use since there is an explicit reference as is, as example, in Python programming language (until version 3.11) // Python with open("x.txt") as f: data = f.read() // JavaScript equivalent with({f:/* as */open("x.txt")}) data = f.read() Memory Safe Operations Another recycled example before I show more interesting stuff ... apparently the whole problem is about write silly code inside with , as if everybody has to define variables or assign stuff inside this statement. Hilariously, I have basically never assigned anything inside a...

with: The World's Most Misunderstood Statement

Update If after this post and its comments you are not convinced yet, have a look into with: Some Good Example one. Every reference to this post is purely casual ... no it's NOT! It's time to talk about the fuss around the innocent with statement, and why somebody decided it's bad or it should not be part of next JavaScript. Extends the scope chain for a statement Extended chains are probably what we love more about JavaScript libraries ... $("stuff") .more() .again() .somethingElse() ; but for some sadistic reason we decided that we don't like native extended chains in our code ... with(stuff){ more() again() somethingElse() }; Bad Examples And Bad Usages Every time I say that with statement has nothing bad, somebody perpetually points out this bloody post ... OK, from Yahoo! ... so what? Honestly, I could post thousands of bad examples and point my finger into this or that library, function, method, evaluation, etc etc ... it's like th...

new years day

Image
(click for bigger view)