Thursday, January 17, 2008

Testing and politics

John Resig wrote an interesting piece on testing and its politics.

He poses a rather challenging question: how do we test real-world situations? Obviously that will depend on the applications themselves, but there are some things that I think are fairly global:

  1. Speed of loops. I've talked about this a long time ago, it's really easy to improve looping speed and brings about enormous performance boosts.
  2. Scalability. DOM querying sure can speed up development time, but speed degrades as more DOM nodes are present on a single page. There are tons of things that can be done about it: using native specialized code where possible (e.g. document.evaluate), passing the callback directly to the query function so that you only need one pass through the node list, instead of a get/use pair of passes, etc. There could also be more API functionality to avoid redundantly scanning nodes (e.g. updating events after an ajaxed DOM insertion). One idea I got from playing around with D is to inline stuff to deal away with function calls (thinking about those nested loops hidden within APIs again), but C-style macroing isn't supported by Javascript. Maybe someone will come up with a workaround.
  3. Animation FPS. Game developers have been striving for high frame rates for ages. It's quantizes smoothness of animation and in a slow language like Javascript, every frame counts. Pre-computing tween paths sounds promising.

There are probably more things that can be done in terms of speed optimization on the web development front, and I think that server-side code is going to become more and more important in the speed optimization field (I'll leave that discussion for another time).

Tuesday, January 15, 2008

JQuery and speed improvements

So, JQuery 1.2.2 is out with a headline of 300% speed improvements on DOM queries. I suppose that's a really great thing for them and kudos all around, but it does make me wonder what is the correlation between triple digit speed improvements (twice) and the quality of the code that was /still is there.

Oh well, better late than never.

Thursday, January 10, 2008

Open Source Bugs Uncovered

Go Open Source!

The neat thing about open source sponsoring is that anyone can invest as much or as little money they want into the effort, whereas in proprietary software, you're stuck with paying the cost of the product and hoping the majority of their customers need the same features as you. Think man hours.

Thursday, January 3, 2008

MD5 and a playstation 3

Now this is an interesting way to use your Playstation 3: for cracking MD5 hashes

Essentially, a single PlayStation 3 performs like a cluster of 30 PCs at the price of only one. In our experience, one chosen-prefix collision can be constructed well within 2 days of computation time, using one PlayStation 3 and a quadcore PC.

Friday, December 21, 2007

Jash is neat

I was using Jash today and I gotta say it's pretty cool.

One of the cool features is the mouseover DOM node selector. Alt+X to enter that mode and Alt+X again to capture whatever node you're mousing over. Then you can access the node via the javascript shell with this.currentNode. Now, that's neat.

For those who had the same issue as me with IE and bookmarklets, create a new bookmark and copy and paste the script below as the URL:

javascript:(function(){document.body.appendChild(document.createElement('script')).src='http://www.billyreisinger.com/jash/source/latest/Jash.js';})();

Thursday, December 20, 2007

IE8 passes acid test

Yay.

Let's hope it's not one of those internal-only-hacked-up-version-for-the-sole-purpose-of-passing-the-acid-test.

Tuesday, December 18, 2007

Jscript 5.7 out for IE

Microsoft recently released a patch for IE 6 which supposedly fixes a number of issues related to garbage collection.

Time to look at those javascript "@cc" conditional comment snippets and make sure they aren't using JScript version to sniff for IE7.

Monday, December 17, 2007

Why I think Knols will flop

So apparently, Google announced a publishing platform called Knol, which is supposedly similar to Wikipedia, in that it is supposed to provide encyclopedia-like information, but giving focus to the authors of each knol.

But without the collaborative effort and the multiple cycles of feedback that make up the core of wikipedia, will knols be as neutral and elaborated as wikipedia? Sure you could make a pretty informative and non-biased knol on ladybugs or potatoes, but what about Java strengths and weaknesses and, for that matter, Bush or Huckabee?

In my opinion, centralizing opinions around authors gives that much more room for incidents like when the Gaia guy bashed AIR, or more recently, when Resig threw a fit over a MooTools presentation.

Add to it that Google plans to add advertising to knols and you have something that scarily resembles the sensationalist tabloid newspaper business model.

Sure, we could argue that the good authors will prevail over the others, but authorities in various fields already blog, and blogs are much more adept at expressing opinions and even a certain degree of entertainment to authors, whereas factual dissertations are much more restrictive and easy targets for scrutiny.

One field where personal knowledge pages are common is the "[insert topic] for dummies", which About.com et al caters to. Thing is, whenever I'm over on those sites, I'm looking for quick answers, not looking to deepen my e-relationships with experienced people in some area where I'm not a guru.

Perhaps knols will be more socially oriented than About.com, but to say that knols will compare to Wikipedia sounds like giving individual authors way too much credit.

Friday, November 2, 2007

position:relative and AJAX quirks in IE

Today I ran into a problem because one of the sites I'm working on was breaking on a AJAX call to refresh the contents of a certain rounded corner box that uses position:relative in its CSS (btw, changing that rule is dangerous since it's used by all of the boxes in the site - which comprise 90% of the structural code)

The problem is that when you want to "refresh" only a certain node in the DOM tree and the height of the content changes, IE has a nice little bug, where it doesn't re-render relatively positioned elements correctly (unless you refresh the page, which beats the point of ajaxing in the first place).

The ideal solution would be to change the CSS, but in this case, it's not feasible, and solutions that require changing the HTML, even if just slightly, as well are out of the question.

Fortunately, there's a hack that solves this problem: just set the element's innerHTML to itself, and this will force the DOM node to redraw itself, as if it was a hard page refresh.

element.innerHTML = element.innerHTML

I'll admit it's not very pretty code, but hey, it works

Tuesday, October 30, 2007

An (almost stupid) idea on an old CSS bug

So I was compiling a list of known CSS bugs during my downtime at work, and one that sorta caught my attention was the one about form elements inheriting margins from parent elements that have layout (which, incidentally, I have never run into myself).

Here's a sample code derived from P.I.E., which will cause a margin of 100px to show to the left of the input element in IE:

.login {background-color:#eee;margin-left:100px;padding:10px;width:30em;}
<form action="ignore">
 <div class="login">
  Username:<br>
  <input type="text"><br>
 </div>
</form>
Now, wouldn't it make more sense to just have done this to begin with?
.login {background-color:#eee;margin-left:100px;padding:10px;width:30em;}
.login label {display:block;}
<form action="ignore">
 <div class="login">
  <label>Username:</label>
  <input type="text">
 </div>
</form>