If you needed a reason to switch to Google Chrome, I just found one more. Go to your chrome history by typing Ctrl+H or going through Tools -> History. Type in any text you remember reading throughout your viewing history and chrome will do a regular google search through your history. I’ve always wanted to build this feature into Firefox, but now I don’t have to. Now the only thing chrome needs for me to be a full convert is Tree Style Tabs.
google, internet
chrome, firefox, google, google chrome, help, tip, tutorial
Browsers do a lousy job of providing an interface to the HTML document. The DOM is supposed to be that interface but it is horribly slow, and clunky. Traversing the DOM tree extensively is one of the sure-fire way to slow down your site. In an effort to help out Javascript coders, the DOM does have functions like getElementsByTagName, getElementsByClassName and getElementsByName, but they do not all work across all browsers. This why you should create a function called getElementsByID:
var groupCache = {};
function getElementsById(id){
if(!groupCache[id]){
groupCache[id] = [];
}
var nodes = groupCache[id];
for(var x=0; x<nodes .length; x++){
if(nodes[x].id != ""){
nodes.splice(x, 1);
x--;
}
}
var tmpNode = document.getElementById(id);
while(tmpNode){
nodes.push(tmpNode);
tmpNode.id = "";
tmpNode = document.getElementById(id);
}
return nodes;
}
Now whenever you want a collection of DOM objects, just give all of them the same id and call this function to grab an array of the objects you want. This is not the most ideal way and its actually a pretty big hack. But sometimes, speed is more important than form.
programming
browser, browsers, dom, getelementbyid, getelementsbyid, help, html, html document, javascript, javascript tip, tip, tips
The key to web2.0 is customer service. Look at all of the major websites created after the bubble and the one thing they have in common is their community. Flickr is the best example: They actually started out as an online game but evolved into an image service from constant communication with their user base.
As a developer, it’s especially important that we constantly use the site and interact with our users. Not only do we get a feel for what the users are dealing with, it also gives us a firsthand account on what the users are thinking. I recently had an eye opening encounter with a user that really gave me a new perspective on Grooveshark.
The user just downloaded Sharkbyte, the Grooveshark helper application, and when he went on the site, he didn’t immediately see all of his songs. Of course the user would think something is broken. What they don’t realize is that we are constantly getting new files added to the system so it takes some time processing all of that data. After sending a couple of messages back and forth between the user and me, the user became frustrated and actually said, “Now Im lost maybe I should just go back to youtube…”
Now that is a scary moment when someone would rather listen to music on a low quality video site instead of a site specifically made for music. After explaining the situation and giving him a $5 dollar gift code (tactic I got from Jay). Now that user has been listening, rating and buying songs. It’s a really big turnaround from going back to Youtube to listen to music, to using Grooveshark and all of its features.
Grooveshark, music
customer, customer service, Grooveshark, help, music, service, users