faqts : Computers : Programming : Languages : JavaScript : Language Core : Objects

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

11 of 17 people (65%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

How do I display all available methods of an object?

Nov 20th, 2001 14:50
Thor Larholm, Gareth Hay, Andreas Zschimmer,


Gareth,
an SMTP host is only blacklisted if it is an open mail relay. This 
means that your SMTP mailserver is an open mail relay that permits 
anybody to send email using it - in essense, heaven for any spammer.
Hence, your SMTP server has most likely been included in one of the 
many (!) Open MailRelay Databases around ( www.ordb.org is a good 
example ) whose sole purpose is to black SMTP servers that are used by 
spammers.
Having an open mail relay is a misconfiguration of your server, and you 
should really kick your administrator.
You can read a short explanation of the problem at
  http://www.ordb.org/faq/#why_rejected
and you can find out how to close your open relay spam server at
  http://www.ordb.org/faq/#how_to_close
I will leave this text intact for a day or two, prior to deletion - the 
original code works perfectly fine and your problem in sending mail to 
me comes solely from the fact that your SMTP server is an open mail 
relay.
------- from gareth ---
Delivery Failure Report
Your document:	Re: Thor Larholm has changed an Answer in the knowledge 
base
was not delivered to:	<thor@jubii.dk>
because:	Error transferring to relaysrv1.JUBII.DK; SMTP Protocol 
Returned a Permanent Error 550 5.7.1 This system is configured to 
reject mail from 195.173.220.134 (Host blacklisted - Found on Realtime 
Black List server 'relays.osirusoft.com')
Why our servers are blacklisted I have no idea?
You cannot have the URL as you would not be able to get through our 
firewall, and the page is not for public consumption. I find this a 
risiculous way to communicate and henceforth will not.
------ original code ---
Use the for..in construction to loop over all properties of the object, 
and check the constructor property of each property to determine wether 
the property is a method. Some example code:
function DisplayMethods(objRef){
  for (var i in objRef){
    if (typeof(objRef[i])=="function"){
      alert(objRef[i]) // Found a method
    }
  }
}
myObject = {
  myMethod : function(){ alert('test') },
  myProperty : true
}
DisplayMethods(myObject)
You could also prototype this onto every Object. Example code:
Object.prototype.displayMethods = function(){
  for (var i in this){
    if (typeof(this[i])=="function"){
      alert(this[i]) // Found a method
    }
  }
}
myObject = {
  myMethod : function(){ alert('test') },
  myProperty : true
}
myObject.displayMethods()