Posts

Showing posts from October, 2009

HAPPENINGS

so - we are back from massachusetts. recorded 13 songs with the masterful will killingsworth at his dead air studios. these songs sound insane. i can't wait for everyone to hear this stuff. we're gonna be pressing another LP. should be out by early 2010. we'll keep you posted as it progresses. in other news, death by audio this thursday with pygmy shrews, passive aggressor, and our brothers, NOMOS. please come. AND Insound just named us the band of the week! check out the review: http://www.insound.com/stuffwelike/swl_ind.php?id=180&from=99933 you can get our first LP from there, too, or from us. ok - sales pitch and self shoulder patting over Mark

new flyer for boston (click for bigger view)

Image

Android DOM "Finger" Events

Image
This is the Android based device I am talking about and the installed software is version 1.6, apparently with multi-touch support for more recent devices so mine is not the case. Disclaimer The reason I am writing this post is my attempt to reproduce the Android OS interface via browser, hilariously possible with every browser except the original one: the WebKit in Android. Why would I do that? The mouse has been around for ages, thanks Xerox, but later these years we've seen so many touch screen based devices without common mouse pattern. Since I think both Android, iPhone, and others, have done an excellent work with the way we use the device UI I thought: Why not! It could be a great time to start analysis and piece of libraries to replicate in a cross browser way some device independent event. Well, as I've already said, and as you'll see next, right now it is not possible! Mouse Events .. ahem, Finger Events Every mouse related event we know does not make much sense

timber

Image
Thanks to those who came out to 538 last night to hang and see bands. It was a good time. Today we leave for Amherst to record a bunch of new shit until Monday... The info for the Boston show is on your right, and here is a flyer...

Node sourceIndex for every browser

I was doing a couple of tests in my bloody Android and I don't even know how I ended up with such snippet ... anyway, accordingly with @ ppk table sourceIndex is a node property compatible with every version of Internet Explorer and latest Opera browser but not with Chrome, Firefox, or Safari (WebKit Android and iPhone as well). Being these unsupported browsers compatible with both native Array.prototype.indexOf and __defineGetter__ and being 5 to 100 times faster than IE, I thought: why don't put this as well into vice-versa ? /** sourceIndex by vice-versa - Mit Style License * @target FireFox, Safari, Chrome */ if(typeof document.documentElement.sourceIndex == "undefined") HTMLElement.prototype.__defineGetter__("sourceIndex", (function(indexOf){ return function sourceIndex(){ return indexOf.call(this.ownerDocument.getElementsByTagName("*"), this); }; })(Array.prototype.indexOf)); ; I so much would have cac

JavaScript For In Madness

Have you never instinctively written a for in loop like the next one, instantly correcting it since you need a variable to perform it? for(var k in {oops:null}){ // cool, got "k" here ... // now how do I get // the bloody "oops" value? } This quick post talks about above nonsense case providing a solution I will explain only if anybody will be interested about it, since (I am quite lazy and tired right now and ...) I think I've been able to solve the trick using almost every JavaScript bad practice :D Runtime Assigned For In Loop (function(self, Function){ // Another (C) WebReflection Silly Idea "use strict"; // Mit Style Weirdness var $o; self.o = function o($){ if(!$) self.o = $o; else { $o = self.o; self.o = Function( "$", "return function o(" + new Array(($.length || 0) + 1).join(",k").slice(1) + "){return $(arguments[0])}"

incisions

Image
Next Friday we will be playing this show, it will be fun. The day after that we leave for Amherst, MA for 3 days to record a bunch of garbage with Mr. Will Killingsworth. When we get back we are playing a show @ Death By Audio with Pygmy Shrews for their tour kickoff, Nomos is also playing. that is on October 29th. Flyer will be posted when it is produced. LP's are still available but were going through them quickly. There is a Boston show in the works, I believe it will be somewhere on the Harvard campus so look out for that.

DOM Node Proxy

This is just a quick post from home sweet home. A common DOM related problem is to create an association between a node and a generic object. The most dirty, memory leaks prone, and obtrusive way to perform this task is this one: document.body.obj = { prop:"value", otherProp:function(){} }; Above snippet is a bad practice for different reasons. obtrusive , it's assuming that no other libraries will use "obj" property name to perform an analogue task dirty , if we associate a primitive value Internet Explorer will expose it in the node string representation memory leaks , if the object points something "live", another node, or a HTMLCollection, the generic node will never be collected by the garbage Alternatives Specially to avoid last problem, the memory consumption, it's a good practice to store an index, rather than an object. To make things less obtrusive and get rid of conflicts, we usually create a "unique id". // the array

Internet Explorer Scope Resolution

I have enclosed in only 5 steps JScript weirdness, hoping all precedent deliriums about functions, standards, and Internet Explorer, will make more sense now. Here there is the link to original HTML slides , I hope this will help everybody to have clearer ideas.

Named function expressions demystified III

Update For those interested about Internet Explorer scope resolution, I summarized everything in 5 slides . This is hopefully the end of the Named function expressions demystified trilogy, where here you can find episode I , and episode II . Juriy knows I am hard to convince, but apparently he is not better than me at all ... Inglorious Correction Sure, it's better than nothing, but after I have spent dunno how many tweets plus 2 posts, all I have obtained is a small correction in the whole article (and you have to scroll a bit before): Generally, we can emulate function statements behavior from the previous example with this standards-compliant (and unfortunately, more verbose) code: var foo; if (true) { foo = function foo(){ return 1; }; } else { foo = function foo() { return 2; }; }; // call the function, easy? foo(); Above snippet is the best solution in the entire article but probably to avoid my name in article credits, and it does not matter since I

ES5 and function default scope

This is just a quick one. One of the worst decision about ES5, after the one to remove arguments.callee when "use strict" is present, is the missed default reference to the global object. Probably the most secure trick to retrieve the native window in JavaScript is this one: // wherever we are var global = function(){return this}(); // while window, could be simply a variable // assigned somewhere else in this scope I have already talked about this, and I am still against some ES5 "feature" which aim is probably the one to make JavaScript as fast as possible, regardless all code that will break if "use strict" is present in the generic scope. Another non-sense is to allow a this in a context where there is no this. Rather than an error, ES5 will point refer this to undefined . Are you kidding me? this is a special keywords related to the context and you are telling me a context is undefined? so I guess open() , as example, should throw an error there, s

Named function expressions demystified II

Update If after this reading things are still the same, please read the part 3 of this post, thanks. I have been criticized just for fun and in a impulsive way without analysis or tests (I am not talking about Juriy who gently replied with interesting points in the part 1 of this post - and I replied back). First of all, if the purpose of an article is to describe a behavior and provide a solution, there should not be any challenge or run for the copyright ... we are developers, and we want the best solution, for us and others, if this solution has been published. Specially for a complicated language as JavaScript is, Virtual Machine and cross browser troubles speaking, is really difficult, sometimes impossible, to find the ultimate and perfect solution, so let's keep the argument in a professional way, agree? What Is Wrong With Juriy Solution Somebody does not get it, and it could be my fault. So this is about inconsistencies, and I'll show you Juriy code to avoid any kin

Named function expressions demystified

Update If after this reading things are still the same, please read the part 2 of this post , thanks. This is a re-post, and few considerations, about the good Juriy article , which I suggest for every JavaScript developer with a deeper knowledge than just an API (jQuery or others). Github For Everything! My first consideration is about github, something I've never used that much since via Google Code I feel pretty comfortable with subversion. I find truly interesting the way Juriy is tracking his documentation, I've never thought about an article, as my old JavaScript Prototypal Inheritance could be, in a code repository as kangax did: good stuff! My Alternative Solution There are few extra consideration to do over Juriy explanation, plus minor inconsistencies. The first thing is that Internet Explorer basically manages Function expressions and Function declarations in the same way, there's no such VS in the middle. The fact we assign the function to a whatever named v

devpro.it is down

As usual, when there is a merging or an acquisition, the classic " Dear customer, don't worry, everything will be just like before and even better " becomes automatically " Who are you, what'ya want from us, do we know each other? Re-buy the service if you have troubles! " ... in few words, devpro.it and 3site.it are down because there is no such thing anymore: the host! ... a little detail, that will be hopefully solved soon (next week at some point). Fortunately, I have my backup, thanks to SQLite, actually version 2, which has maintained in performances and stability for years and hundreds of thousands of records both read only or constantly changed (counters, stats, code serving). Maybe it's a good occasion to re-think devpro.it? Dunno yet, and time is zero, I am just sorry for any inconvenient caused by my different programming languages sources. At least we can have fun with a classic video from The Web Site Is Down
There is no heaven of glory bright, and no hell where sinners roast. Here and now is our day of torment. Here and now is our day of joy. Here and now is our opportunity. Choose ye this day, this hour, for no redeemer liveth. Say unto thine own heart I am mine own redeemer.

THURSDAY

Image

NWMatcher - A Quick Look

As usual, as soon as I decide it's time to go to sleep, somebody :P has to post a stunning benchmark about a selector matcher ... did I shut down? No, I had to read the entire source code of the library, and this is my quick summary, but consider I am tired ... NWMatcher , A Selector Monster First of all, I did not know or remember this project and I must congrats with Diego Perini for different reasons. The first one is that Diego used almost all best and unobtrusive technique to make it as reliable as possible, which is good, the second one is that Diego introduced something new to achieve its goal: create a Ferrari matcher via pre- compiled functions. About NWMatcher It is a lightweight stand alone library (so far, but already namespaced) which aim is to standardize some common DOM related task. The initial aim was to create a faster way to understand if a node matches a specific selector, something truly useful with event delegation. About The Technique To make things as fas

Chrome Frame Options

As posted in Frame ML, twitted after (exactly 140 chars :D), and uploaded on my chromefix page, there is a new batch script file able to launch frame and let us clear, as example, the cache or perform some other operation. start "Frame" /B "%PROGRAMFILES%\Google\Chrome Frame\Application\chrome.exe" "--user-data-dir=%APPDATA%\Google\ChromeExp\User Data\iexplore" The reason this launcher could be useful is that apparently the cache used via Frame could be blocked and the user unable to clean it via common IE options procedure. Enjoy, and thanks Tommi for the tip.

EVIL

While the red-stained mouths of machine guns ring Across the infinite expanse of day; While red or green, before their posturing King, The massed battalions break and melt away; And while a monstrous frenzy runs a course That makes of a thousand men a smoking pile- Poor fools! - dead, in summer, in the grass, On Nature's breast, who meant these men to smile; There is a God, who smiles upon us through The gleam of gold, the incense-laden air, Who drowses in a cloud of murmured prayer, And only wakes when weeping mothers bow Themselves in anguish, wrapped in old black shawls- And their last small coin into his coffer falls. -Arthur Rimbaud

[Q&D] Fix Decimal Module Operator

This is a Q&D solution for some JavaScript precision problem when we use the module operator with floating point numbers. The Problem If we are dealing with the module operator we could have this case: alert( 8.25 % .05 ); // 0.049999999999999545 We expected 0 but we have a floating point inconsistency instead. This is a well known problem, and not only with JavaScript, truly annoying when we have to show run-time computed money/trends operations. The Solution This comes from my reply in a JS forum, knowing that the module will be a simply floating point, let's say .1 to .001, if we remove floating point from the right side of the operation everything works just fine: function mod(num, mod){ // Another WebReflection silly idea var pow = Math.pow(10, (("" + mod).split(".")[1] || "").length); return ((num * pow) % (mod * pow)) / pow; }; alert( mod(8.25, .05) ); // 0 alert( mod(8.25, .1) ); // 0.5 That's it, have a nice

Randomly Speaking ...

These days have been a bit chaotic, lots of news, good and bad, unfortunately somebody decided a day has only 24 hours and somebody else decided sometimes we need to sleep, so from 24 we pass to 18 ... this is a quick random post about changes and thoughts I Am One Of The Ajaxians ! Thanks to Dion Almaer , or if you prefer " it's Dion fault!!! ", I am glad to be one of those guys there talking about everything Web related, development, techniques, news, mobiles, whatever, as long as it makes sense and will keep us updated with the latest kill app. Formaldehyde Has Been Updated My simple Ajax / PHP debugger has slightly changed to solve a couple of annoying bugs. One was a typo, another one a new XHR feature (or better, limit) so theoretically, Formaldehyde should not caouse problems anymore. The Real Problem Is Not IE6 But Windows 2000, 98, Me Google Chrome Frame demonstrated that people want a better browser but there are still so many companies stuck in deprecated op