Archive

Archive for October, 2005

base.google.com

Google base.
 
It seems to be still under development. but rumour has it, that it is going to be a competitor to Ebay. Interesting!
Categories: Uncategorized

Javascript: prevent entering of Email addresses

I just designed a nice piece of Javascript that I thought I’d like to share. Its some code that can be used to prevent people typing email addresses into textboxes – where for instance, you want to control the flow of communication between client and end-user.
 
<BODY onkeypress="removeEmailsFromAll(‘textarea’)">
Then the Javascript
 
  function removeEmailsFromAll(type)
  {
  elements = document.getElementsByTagName(type);
  for (var i = 0; i < elements.length; i++) {
     removeEmails(elements[i]);
  }
   }
  function removeEmails(element)
  {
    var EmailRegex = "([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})";
 var re = new RegExp(EmailRegex, "g");
 try
 {
     element.value =  element.value.replace(re,"");
 }
 catch(ex)
 {
     element.innerHTML =  element.innerHTML.replace(re,"");
 }
  }
 
 
 
Categories: Uncategorized

Javascript compression

I was looking today at some applications that could be used to comnpress javascript files. I tried this on a 32Kb Calendar javascript file, with several different applications, and here are the results
(where 100% filesize is no compression, 0% is infinite compression – which, if anybody figures out how this is done, it would probobly violate the laws of physics, and could get you into alot of trouble with theoretical scientists).
 
Creativyst – 99.16% file size
Dithered – Hung then crashed
JCEPro – Crashed
CodeProject – 96.39% of origional file size
Saltstorm – 94.07% file size
JSCruncher – Failed to compress.
 
 
Categories: Uncategorized