Posts

Showing posts from April, 2009

vice-versa sub project: css2xpath

Update I completely re-wrote the test suite. You can check a live example here where results are compared with Sizzle selector engine against the common W3C page. After this Ajaxian post and some opinion exchange in its comments, I decided to extract the css2xpath function I used inside experiments in vice-versa project , creating a separated project specific for this purpose that some how could be interesting or useful. Bugs, problems, questions, and helps are more than welcome, so far I focused my attention to SlickSpeed test selectors and nothing else but at least for that it seems to be stable and reliable.

[OT] Swine Flu ... Service Unavailable!

A quick one about how things are not that different whatever country you live ... in a page created to inform and to help to prevent this new killer flu, the NHS symptoms checker link brings to a Service Unavailable page. I wonder if countries organizations will never be ready for whatever emergency we have. Hoping people will be able to obtain more info directly from directgov website, we can do 3 things so far: CATCH IT (using tissues to sneeze or cough in), BIN IT (we don't want to travel that far with our dity tissue, do we?), KILL IT (this one is quite difficult to explain and I guess they did not choose "the proper verb" for the last action ... seriously!)

Drip under control via another IE memory leak tentative ...

Apparently, using this strategy I can obtain a flat line in Drip monitor: // function used to remove a node, every attached // attribute and every nested node via the same procedure var destroy = (function(destroy){ // WebReflection IE leaks attemp! function $destroy(node){ while(node.lastChild) destroy(node.lastChild); if(node.parentNode) node.parentNode.removeChild(node); }; return destroy = destroy.clearAttributes ? function(node){ if(node.clearAttributes) // Hedger suggestion node.clearAttributes(); $destroy(node); } : $destroy ; })(document.createElement("script")); // used to remove everything function destroyAll(){ destroy(document.documentElement); }; // used to avoid leaks when the page is refreshed // or the url is changed if(this.attachEvent) attachEvent("onunload", destroyAll); reasonable performances and apparently a relia

The Fastest Selector Engine For FireFox 3.0 ?

Image
I am putting some effort to make vice-versa project a good, production ready, alternative against common libraries, and since these days I am working hard with XML, XSL(T), and XPath I decided to try an experiment implementing CSS to XPath translator for FireFox 3.0 With version 3.1 we will have querySelector and querySelectorAll but version 3.0 is still the most used one, FireFox speaking! The nightly build of vice-versa introduces a new file, mainly used for personal experiments via vice-versa library and the first experiment is an improved document.query for those browsers with document.evaluate support without document.querySelectorAll . Unfortunately Internet Explorer < 8 does not support XPath queries over (x)HTML but at least for FireFox 3.0 I have obtained best overall performances via SlickSpeed Selector Speed Test comparing latest version of each library such Dojo , DOMAssistant , Sizzle (congrats for the new site!), Sly , and finally vice-versa project. Here the sum

Oblivion.

Image
A few things... In the first week of May our recordings will be mastered for LP format, as soon as that is done we will send it off to the pressing plant and hopefully will have them in a month after that or so. I have now made a little section to your right where you can see all of the upcoming shows we have. Newest addition being May 30th in Philly with VILE GASH, SALVATION and others. We are way excited to head out to Philly to play with such awesome bands. While I'm on the topic do yourselves a favor and order yourself a copy of the new SALVATION LP before they sell out, a fucking terrific record. Order it here www.ihateyouthattack.com Also, please give our friends in GAZA STRIPTEASE a listen if you are into spacey stuff like MBV, Slowdive, etc... Check them out here www.myspace.com/gazastripteaseband

JavaScript Is A Toy? So C#, Java, PHP, and Python Are!

Image
I wrote a truly big post about this subject ... but it was nervous and not that technical as well. I decided then to simply post this image, hosted in Pam webOS Project page: Think about the right box, it should be the state of the current Web 2.0 Era ... now think who is in charge to maintain the layer between your server application, and the customer ... I am quite sure 90% of cases will be a Web Designer, rather than a Senior skilled JavaScript Developer ... now wonder why if you ask for JavaScript skills plus Photoshop, you will rarely being able to make right profits from your business. JavaScript is not a toy, and "web speaking", is one of the most important programming language your team should know, it's time to stop to underestimate it.

Why the fuck not...

Here is the new LP we are putting out soon http://www.sendspace.com/file/ncx5da 1. Hated 2. Ailment 3. The Man 4. Sketchy Pussy Preview this joint and enjoy!

div[expando] = null OR div.removeAttribute(expando)?

Today we had an interesting conversation in the jQuery developer mailing list, and " surprise ", it was about Internet Explorer and memory leaks . I instantly started some test to understand what the hell is going on there ... and I encountered a dilemma which is not simple at all! div.prop = 1 IS NOT div.setAttribute("prop", 1) Some developer thinks that the usage of setProperty and getProperty is basically the same of a manual assignment as generic DOM Element property ... well, they are wrong . First of all, if we are working with XML we all know that it is not possible to assign a property in this way: xmlNode.prop = 123; // Error!!! xmlNode.setAttribute("prop", 123); // OK, but be careful! The main difference between manual property assignment and the usage of setAttribute/getAttribute is that we are changing HTML or XML properties of the node without control . The reason is simple, how manual properties are assigned/retrieved is browser dependent, an

vice-versa project, a philosophy rather than a library

Array.forEach(document.all, function(node, i, all){ // vice-versa project }); well, there are few things I can say here, and first one is: please, if interested, help me! The second one is my vision, a web where rather than criticisms, there is more collaboration to obtain good overall performances improving code quality. This is not my old JSL project, this is a new groove, a new project, a non library , something I hope you will all appreciate. But, if not, I am here to discuss about it :) vice-versa project Have fun with Web Development! Update Implemented a TaskSpeed test file for vice-versa project. Here first results ordered by average. browser Pure vice Moo qoox dojo YUI AVG Dom versa Tools doo -------------------------------------------------------------------- Safari 4 198 114 392 205 246 410 260.83 Chrome 1 251 273 589 279 336 692 403.33 Opera 10 215 206 764

Internet Explorer with V8 Engine :: A Partial Reality

Update now it works with Internet Explorer 7 and 8 with O3D plug-in enabled. Today, via ajaxian , I discovered the new Google O3D project and as a nerd first, and a developer after, I instantly read the API. Few seconds and I spot this: Use the V8 engine OK, OK, whatever code you read there will not instantly work ... you have to understand the library and how to retrieve the dreamed eval function to make JavaScript execution possible inside the extremely fast V8 engine. Obviously V8 integration is great with FireFox and other browsers, but a bit different in Internet Explorer. This limitation is about the DOM manipulation, something that would make IE a good browser, but everything else, executed via V8 engine and without browser engine references , will perform 5 to 100 time faster. Function creations, optimized loops, numbers, string manupulation, etc etc ... if we could use a little plugin to fully integrate V8 inside Explorer, we could all forget nowadays benchmark because it w

Heroes.

Image

Another show added!

The Men, Highway Gimps, Eleanor May 9th @ The Shea Stadium 85A Debevoise Ave, Brooklyn, New York 11222

Last Minute - Blogger and Spam Blogs

Nice one, 10 minutes after I published my last sarcastic comment about IE sort implementation, blogger sent me an email communicating that my blog has been marked as a spam blog. I am sure if I was an X-Files actor I would have though instantly about conspiracies or some sensible M$ engineer move ... but as web developer and experienced programmer I am sure it is a coincidence and any software is perfect: it does not matter who is behind that software! P.S. ok, an entry for this fact is probably too much but if you find something weird please be patience, I should be back soon ;)

Internet Explorer and its inefficient sort implementation

This is just a quick post about how much IE team cares about JavaScript performances ... // generate an array of 1000 elements var a = new Array(1000).join(",.").split(","), calls = 0; // call sort method incrementing the conter a.sort(function(a, b){ ++calls; // return zero, nothing should change return 0; }); // discover the monster alert(calls); Guess how many times Internet Explorer compare results? 17583 times, against a.length - 1 in other browsers. Nice stuff guys, I guess for big arrays a manual reimplementation could perform better, am I wrong?

[COW] A Generic ArrayObject Converter

Few days ago I wrote about a fast Array slice implementation for every browser, a callback able to convert " every collection " into an Array. For collection, I mean every instance with a length attribute and an index access Array like. This object, for example, could be considered as a collection: var generic = { length: 2, "0": "abc", "1": "def" }; Above instance is a basic model of most common libraries such jQuery, prototype, base, and every other based over an Array like prototype. Some library could coexist in the same page without problems but not every library implement a method to create a copy of another collection into a new instance of the library itself. As example, a jQuery or Sizzle result into another instance, a generic DOM collection into a jQuery object, etc etc. All these instances could be passed via Array.prototype.push to be populated, and thanks to this peculiarity we can obtain every kind of instance f

Are you italian?

Image
Hello friends, this is where you can keep track of The Men's doings if you are ever so interested. Here are some upcoming shows... La Otracina, Spaniards, Whooping Crane, The Men May 1st @ Don Pedros (Manhattan Ave between Boreum and McKibben) Brooklyn, NY Black On Brown, Aveda Vera, Highway Gimps, 7 Ton Hand, The Men May 16th @ Tommy's Tavern (Manhattan Ave. in Greenpoint) Brooklyn, NY 7 Ton Hand, Autumn People, The Men + TBA June 14th @ Don Pedro's (Manhattan Ave between Boreum and McKibben) Brooklyn, NY We just recorded 4 brand new tracks with the fabulous Will @ Dead Air Studios in Amherst, MA. It sounds great and we are excited to be releasing it on an LP in the not so distant future. If you are looking for affordable and amazing quality recordings please give Will a shout www.deadairstudios.com The following link is a couple of songs from a self released tape that is no longer in print. Soon enough a new song from the new record will be posted but for now hang out wit

Essential Selector - Cross Browser LightWeight Selector Engine

Thanks to new DOM methods introduced recently in most common browser, e.g. querySelectorAll, we will not hopefully need full libraries to implement common CSS selectors. Nowadays, this could be the basement to create any kind of selector engine but we are still stack with old fashion browsers a la Internet Explorer version 6 or 7, both far away from W3 standards and with the slowest JavaScript engine in browsers panorama. At the same time, whatever great selector API/engine we have under control, most used selectors are really few: #id .class tag tag.class Reasons behind this fact are different, but in my opinion the most valid one is that Web Developers use CSS selectors in the same way they create CSS files and since CSS has become standard only recently thaks to Internet Explorer full CSS 2.1 support (n.d. other browsers are working on the CSS 3 since ages ...) our CSS files and our selectors will be that simple for long time. Accordingly, and since we have some intermediate and co

WebReflection PureDom baseline for TaskSpeed

I just had a quick and nice chat with Peter E Higgins and I am proud to announce that my PureDom test has been integrated into TaskSpeed test suite. Why PureDom We all know how many benefits libraries give us on daily basis about Web 2.0 supersonic development, but as both libraries author and users, we should pay attention. Web Developers: sometime we delegate to our cool library some simple task which could be easily implemented manually. If performances are a problem we should use libraries only when and if necessary. There are a lot of best practices for each library and all we need to do is to read these practices to be sure our way to code is of course elegant, but not silly. // this is silly $("#items li.selected").each(function(){ $(this).css("color", "red"); $(this).css("background", "blue"); $(this).width($(this).parent().width()); }); // ... while this makes sense $("#items li.selected").each(function

JavaScript Static Collection - A New Type Of Variable

Nowadays, I am working over a crazy manager between an XML with form information, another XML with custom rules to drive the XML with form information (DropDown onchange events, validation, and much more) and both to drive a runtime Ext.form.FormPanel with runtime components manipulated runtime via those two XML and over regular (x)HTML ... a runtime nightmare, but it is not the point. While I was working over an Easy XPath Library for (x)HTML, trying to obtain best performances with the black sheep Internet Explorer, I ended up in an msdn page which explains the attributes HTML Element property. Funny enough, that kind of property has truly a weird behavior, it is between VBScript and JavaScript. There are two ways to access its key/value pairs , the normal and logical one, plus the WTF!!! one. Example: for(var attrs = document.body.attributes, len = attrs.length, i = 0; i < len; ++i ) attrs(i) === attrs[i]; // true The first though was: damn it, som

A fast Array slice for every browser

It is an extremely common task and one of the most used prototype in libraries and applications: Array.prototype.slice The peculiarity of this prototype is to create an Array from an Array like Object such arguments, HTMLCollection, other kind of lists as jQuery results. Every browser, except Internet Explorer, allows direct calls via native prototype obtaining, obviously, best performances. In IE, we have different ways to make this task possible, and these ways are mainly classic loops, or the isArray check to know when it is possible to perform the native call or not. isArray = (function(toString){ return function(obj){ return toString.call(obj) === "[object Array]"; }; })(Object.prototype.toString); Even using a closure, above function could slow down performances, specially in those libraries where Array conversions are performed almost everywhere. As we all know, Internet Explorer behaves weird "sometimes", and one of the weirdest things is tha

TaskSpeed: DOM VS Libraries

I tried to create an essential library to perform a manual implementation of the TaskSpeed test suite and results surprised me. All these web 2.0 libraries are extremely useful, cool, time-saving, whatever you want, but not a single one can compete with manual tasks implementation, specially when we are talking about the most common browser which at the same time is the slowest ever: Internet Explorer! Final Results for an Dual Core under Windows XP SP3 FireFox 3.0.8 ------------------------ library | ms ------------------------ DOM 383 plugd-a (Dojo) 734 Dojo 1.3.0 742 Dojo 1.2.3 1008 MooTools 1.2.1 1252 jQuery 1.3.2 1935 jQuery 1.2.6 3518 Safari 4 Beta (528.16) ------------------------ library | ms ------------------------ DOM 118 plugd-a (Dojo) 170 Dojo 1.3.0 186 Dojo 1.2.3 342 MooTools 1.2.1 347 jQuery 1.3.2 602 jQuery 1.2.6 1025 Opera 10.00 alpha ------------------------ library | ms ----