Posts

Showing posts from November, 2009

XML To HTML Snippet

This John Resig post about nodeName demonstrates once again how trustfulness are edge cases in JavaScript. I must agree 100% with @jdalton : frameworks or selector libraries should not be concerned about these cases. First of all there is no universal solution so whatever effort able to slow down libraries won't be perfect, then why bother? Secondly, I cannot even understand why on earth somebody could need to adopt XML nodes in that way. Agreed that importNode or adoptNode should not be that buggy, but at the same time I have always used XSL(T) to inject XML into HTML and I have never had problems. Different Worlds In an XML document a tag is just a tag. It does not matter which name we chose or which JavaScript event we attached, XML is simply a data protocol, or transporter, and nothing else. A link, a div, an head, the html node itself, does not mean anything different in XML so again: why do we need to import in that way? In Internet Explorer we have the xml property which i...

On element.dataset And data-* Attribute

Why on earth? I mean why we should put a data-whatever attribute into our layout? Where is the good old MVC? How can you consider data-* more semantic? more semantic than what? Why we would like to kill truly semantic pages and graceful enhancements? Why we need JavaScript redundant info inside nodes attributes but we cannot understand a script tag in the middle of the page? Why in the performances matter era we would like to let users download stuff that they will probably never use? What Am I Talking About We can find the " magic " data attribute description in the W3C Semantics, structure, and APIs for HTML documents page. These days there is a page that is going around even too much ... finally somebody realized that this data- thingy is nothing different than what we could have always used since ages: XML . Why We Are Doing Wrong If we are enthusiast about a custom attribute able to bring whatever information, we should ask ourself why on earth we are not using simp...

LOSERS OF THE WORLD UNITE

hello everyone here's some footage from the latest nerd convention we attended: http://www.youtube.com/watch?v=-YtJjURvADs This song is going to be on our new LP btw.... "Problems" Audio is almost indecipherable, which is probably a pretty accurate representation of our live show -Mark

TOMORROW

Image

195 Chars To Help Lazy Loading

Update removed named function expression Update I wrote events letters in the wrong place, please use the latest script We have talked many times about performances, and not only here. One common technique to speed up a generic online page is the lazy loading. For lazy loading I mean: runtime dependencies resolution via script injection, preferably including all dependencies we need in a shot rather than script after script Google comments style, where code is evaluated when required but the size is still there namespaced strings, an example I have explained via code in Ajaxian whatever else, because sometimes we need this or that library only in certain conditions What Is The Problem If we would like to widely adopt this lazy load pattern, we should be aware about a " little detail ": Firefox < 3.6 does not support document.readyState , an historically valid Internet Explorer feature adopted in HTML5 and present in basically every other browsers. We can find the readySta...

Why Samsung N510

Image
An unusual topic for this blog but this toy turned into a wonderful surprise and maybe, somebody would like to know how come that a developers decides to buy a netbook, rather than latest ultra speedy tech on the go ... Decide What You Need It was about 5 years or more I bought another elegant toy : the VAIO vgns2hp , with an extra 512Mb of RAM in order to reach the mythical Gig of RAM which did not come for free. I spent a fortune by that time but it was for a good reason: in 2009 I was still able to perform every task I had to perform ... except gaming. Please note I am talking about a daily basis "back home from work" computer and not necessary about development environments, where compilation time as example has to bee fast or we gonna spend our life compiling and nothing else ... So, being a performances maniac I always thought dated hardware is the best proof that we are doing well. Specially Web speaking, it does not matter if we have the 16 core 128 bit monster, ...

Inline Downloads with Data URLs

A quick post about another silly idea ... With Data URLs we can incorporate images in layout or CSS . The schema is really simple: data:[<mediatype>][;base64],<data> Since we need to specify a mediatype we could play around creating something unexpected ;-) My Silly Idea If we select something in a web page we can perform different actions via right click. So far so good ... but one thing we are missing, at least in Firefox, is a "Save As" option. If we want bring a piece of code, text, something else, into another software or editor we need to select, right click, copy, open or find the editor, right click, paste. The ultra skilled developers goes well with ctrl+c and ctrl+v but there are still 3 operations to do: copy, find the destination, paste What about making possible to simply save that part and go on reading or surfing in order to do not distract too much our lecture and review eventually later that piece of text or code? Firefox Inline Download function ...

How To Map Your Code

Most of the tools we use on daily basis to develop applications with any kind of programming language need to understand our code in order to help us while we are writing, reading, or creating code. We open an editor, we read highlighted code, we like suggestions when we write a dot and we use compilers, minifiers, compressors, obfuscators, converters, documentation generators ... but have we ever though about the program behind our same program? Have we never thought that highlights, suggestions, minifications, and syntax analyzer do not come for free and these are primordial programs we've ever used often without even realizing we are using it? This post is about general suggestions, techniques, and practices, used to map code. In this specific case, we will analyze step by step the logic behind a code mapper using the most used programming language in the world: JavaScript . Map VS Tokens First of all we need to understand what we need. A Map could be considered a generic list...

Literal Regular Expression Safe Regular Expression

... sorry for the redundant title but that's exactly what is this post about ... after yesterday explanation about problem, logic, and solution, to grab valid strings inside JS code, here I am with the literal RegExp able to grab literals RegExps in a generic JavaScript code. Why Do Not Add Just A "/" Into Other Strings RegExp One comment gave me the hint to write this second post about RegExps. While time is a bit over during days, this answer is simple, but not obvious! Differences between strings and literal regular expressions are basically these: there must be at least one char, or the parser will consider the literal RegExp an inline comment // the slash does NOT necessary need to be escaped. If we have a slash inside a range [a/b] the latter one won't break the RegExp and the slash will be considered just one valid char in that range there could be one or more chars after, where i(ignore case), g(match all), and m(multi line) can be present one or more times L...

some dribble

Image
First and foremost, this Friday there will be a benefit show for Nick Poot of Absurd System. He was recently diagnosed with Hodgkin's Lymphoma and does not have health insurance. If you want to see rad bands, and help donate money to Nick's cause, please come out to this show... (click for bigger view) Saturday, The Men will be heading to Boston to play on the Harvard campus with General Interest and Vile Bodies, it should be a great time, there is a flyer with all the info that I posted a few posts down. The following Friday we are playing at 538 Johnson Ave with Philly punks LEATHER and just confirmed that after a bit of a hiatus, Brooklyn's PREGNANT will be playing as well, and we are stoked. As far as our new recordings go, we are exploring our options and should hopefully have a full length LP out in early 2010... Also, another kind dude reviewed our first LP, check that out here... http://www.builtonaweakspot.com/2009/11/men-we-are-men-12-ep.html See you in hell, - ...

String Escape Safe Regular Expression

I should have probably investigated more but apparently I did it ... the most problematic I've encountered so far with JavaScript RegExp seems to be solved! Update Indeed, I should have investigated ... I just like to find solutions by my own. I am not surprised somebody already investigated this classic parsing problem. Steve talked about it a year ago, using the lookbehind missed feature I talked in this post. Above post has much more details than mine (and much more Edits as well). The good part I am happy about is that both me and Steve came out with basically the same solution, but His one is definitively more compact: // Steves Levithan compact solution /(["'])(?:(?=(\\?))\2.)*?\1/g The assumption of above regexp is that if there is a char followed by an escape one, there must be another char that cannot be the initial single or double quote, being the latter one outside the second un captured part, and after a non greedy operation. If the second condition, \2, does...

Google Closure ? I'm Not Impressed

We all know that Google is synonym of performances, simplicity, and again performances. A search engine that uses a truncated body for a not valid W3 markup should be the most bytes and performances maniac in the current web era, isn't it? Well, Google Closure Tools has been a negative surprise, at least this is what I can tell about it after a first quick review. Closure Compiler It's since ages I am wondering what kind of tool Big G is using to produce their scripts and finally we got the answer: Closure Compiler ... ooooh yeah! Packer , YUIC , it does not matter, when Google needs something, it creates something. This is almost intrinsic, as developers, in our DNA: we spot some interesting concept? We rewrite it from the scratch pretending we are doing it better! This is not the case, or better, something could go terribly wrong ! // ==ClosureCompiler== // @compilation_level ADVANCED_OPTIMIZATIONS // @output_file_name default.js // ==/ClosureCompiler== (function(){ ...

review

hey, you can check out a review of our 12" here if you are interested... http://mishkanyc.com/bloglin/2009/11/05/review-the-men-we-are-the-men-ep/ we have some things lined up, stay tuned...

FUCK "THE GUEST TOWELS"

This might not even be needed considering this band is way below mediocre and won't even make much of a difference because they are shit. BUT, tonight a bunch of dear friends of ours performed a Ramones cover set in the spirit of rad punk and halloween only to be fucked over by these bunch of dicks...Not only did our friends lend these dudes amps, but were super supportive and nice to these guys. Later on in the evening our friend Russell noticed that his custom telecaster and fender jazz bass were missing. We assumed that someone might have taken them by accident. I called the singer Victor of The Guest Towels to ask about the situation and he got really defensive and kind of scared. We were obviously weird-ed out. They show up back at the show not only with a trunk full of their own equipment (so obviously they had their own shit so nothing could have been mixed up) but they also had Russell's TWO guitars along with them. These dudes didn't even try for the most part to d...