Showing posts with label geek. Show all posts
Showing posts with label geek. Show all posts

Monday, September 8, 2008

Safari kicks ass, again

Sometimes, while at home, I really miss working so I bring work to home . So, this time was the turn of a cross-browser JavaScript madness, the problem manifests like this:

There's a grid, big one, in which each cell has 3 image/buttons, each image has 2 states and they are exclusive, as in Low, Med, Hi, get the picture? Well, when the grid gets big (my HTML file right now has about 20.000 lines) performance goes down a lot, that means that when a user clicks a button the state change takes a noticeable second to happen, in IE 6 and 7.


I didn't code that so I had no idea of what was causing the problem so I asked the guys working in that project to email me a static version of the page so that I had something to fill my evening with .

Besides the JavaScript in that page is painfully awful (I'm sorry guys, I had to say it) I managed to isolate the piece of code that was causing trouble. Many of you geeks might already be blaming some obscure for(;;) over every single element, or a diabolic recursion; well my friends this is not the case, or at least the for(;;) is not where you think it is, read on.

The offending code was merely a dozen of document.getElementById() calls. But wait, think about it, getElementById in 20.000 lines worth of elements, that's something we should handle more efficiently, well yes and no. Yes, you should narrow your element "universe" and work with subsets as much as you can, and also use CSS selectors to get your target. And No because the browser's engine could do us the favor of optimising it, can't it? That seems to be the case for Safari, whose performance is not affected *at all* by this experiment, and remains as snappy as always. Next in the podium is Firefox, whose performance degrades slightly, regarding the button state change, but fails terribly at the very beginning when it almost hangs up while loading the page. At the bottom of the podium (if any) there's IE6 which fails in every single aspect, and degrades much more with a much lesser number of elements.

Very well then, what have we learned with this? You have to code well, don't trust the browser's engine too much, Firefox is really good but it still has some issues and that IE6 sucks at rendering web pages and executing javascript code.

I just wanted to share my findings on this noble area of knowledge. Your comments are more than welcome.

Oh god, I really need a pint right now, make it a brown ale please.

Wednesday, September 3, 2008

Farewell EcmaScript 4, Adobe are you in deep pain?

According to this email from Brendan Eich the discussions on EcmaScript 4 are over, finalized, ended, dead, buried - you get the picture. Everyone will have to move on and continue to work on EcmaScript 3.1.

For those of you who haven't been following this soap opera here's a quick review: version 4 of the standard was mainly backed by Adobe who wanted to have a proper standard behind its product ActionScript, remember that the language is the main workhorse behind Flash, Flex and threrefore a wealth of derived products. 

But who cares about standards anyway? mostly everyone. Picture a world where TCP is not backed by RFC 793 and to browse the web you don't use HTTP but a protocol developed by, say, AT&T that might be open, well documented and whatever else, but there will never be an official consensus about its use. 

You might say, well there is no standard behind MS Word .doc file format for instance and you would be right, but here we are talking about mindblowingly massive stuff, and that's what Adobe was aiming for, remember the latest addition to the family, AIR that takes ActionScript programming out of the browser cage and into the world of desktop programming.

So now Adobe ended up with a language that's a bit compliant with EcmaScript 3, with some extensions - so it _does no comply_ - after all the effort...

Aaaaanyway, this was supposed to be merely an informative post, much more info about the background of the issue can be found in this blog.


Monday, August 25, 2008

Globant stand at JRSL '08

María José and I 'posing' for the cameras at Globant's JSRL '08 stand. 
Few times  in the history of men, the world has seen such a nerdy picture like this one.

Note: the apples are a courtesy of the chinese market in L. M. Campos and Zabala (well, Majo actually had to pay for them).

Anyway, there is nothing to say about this post, I just wanted to blog the picture, but it seemed so empty without text, so I had to invent something. This should be enough. Well, just let me finish this line. Ok, this is it, bye.

Thursday, August 21, 2008

Este JAR te salva la vida... XHTMLRenderer

Hace mucho tiempo estaba perdido y desesperado, ya nada importaba en mi vida, hasta que conocí este proyecto: https://xhtmlrenderer.dev.java.net/

Bueno, en serio, es un motor de rendering de XHMTL + CSS, que anda MUY bien, de hecho mejor que cualquier navegador que tengan a mano. Para qué sirve? Bueno, yo tenía este problema: Una página generada dinámicamente que tenía que mandar a imprimir y/o a PDF. Para hacer esto normalmente uno tendría que romperse la cabeza codeando el PDF hasta que quede igual a lo que se muestra en la página. O bien, usar su motor de rendering amigo y alimentarlo directamente al generador de PDF.

El resultado? simplemente fantástico, a priori no tenía muchas esperanzas, teniendo en cuenta la disparidad de los motores de los navegadores, pero mientras uno respete XHTML y CSS, anda ferpecto.

Que lo disfruten...

PD: No se asusten por el beta. Ah, y está pensado originalmente para embeber contenido html en aplicaciones de escritorio.

Thursday, April 24, 2008

Oops! This really conforms the Accesibility rules

Today we found that one of our projects -which has been shown to a myriad of the client's top managers in the last few days- contains the following String in its home page:
We have an avanced search with filters, and a really really simple search for the intellectually challenged.
The funny thing is that this was found by a really simple minded tester who stated in his report:
Under the "Search for Postcards" heading on the home page, avanced should be
spelled advanced.

Oh dear... this is job of mine is so funny...

PS: If you don't know what accessibility is you probably need to read this.

Tuesday, April 22, 2008

!!""==false

Dijo el gran filósofo contemporáneo César D.:
Not not string vacío es una buena forma de castear un string a boolean.

Friday, April 18, 2008

Tiny bit of corporative marketing

I'm not a big fan of corporative marketing and we all know the company I work for is really into it.

That being said, I thought this might me an interesting event, Google and the major social networks are behind this and I'm pretty sure they'll be able to gather interesting people.

So, here's the link: OpenSocial Hackathon

I don't know if I'll be able to go though.

Cheers!

Caveat geek: Now you have to be sweet too...

http://www.cnn.com/2008/TECH/04/15/bejeweled.proposal.ap/index.html

Yes! Now you'll have not only your boss, but also you girlfriend asking you to code for her. Enjoy!