Read the article here : http://ashishware.com/ASPValid.shtml
Hii , I am Ashish.I love programing and computers.I just like to learn and do new things. Currently I am working as a .NET developer.
I am thinking of buying a new gadget. Maybe you can help me. I am looking for below mentioned features. Do you know of any gadget (mobile/laptop/tablet/handheld) that is a close match for my needs?
In languages like Ruby, function parameters are 'typeless'. So instead of passing multiple parameters we could just pass a single object that contains required values. A hash (or associative array) is a good candidate for this work.
class Myclass
def initialize ( *args)
if args.size==1 then puts "function called"
end
if args.size==2 then puts "first overload called"
end
if args.size==3 then puts "second overload called"
end
end
end
a = Myclass.new(10)
b= Myclass.new(10,"abc")
c= Myclass.new("a",1,"b")
Output:
function called
first overload called
second overload called
class WidgetBetter still, we can use the following syntax:
def initialize ( *args)
@border = args[0]["border"]? args[0]["border"].to_s : "undefined"
@color = args[0]["color"]? args[0]["color"].to_s : "undefined"
@font = args[0]["font"]? args[0]["font"].to_s : "undefined"
puts "Border:#{@border}px"
puts "Color:#{@color}"
puts "Font:#{@font}\n\n"
end
end
h = {"border" => 5,"font" => "Times","color" => "RED"}
button = Widget.new(h)
Output:
Border:5px
Color:RED
Font:Times
button = Widget.new("border" => 5,"font" => "Times","color" => "RED")Above syntax gives a clearer picture of how many and which values were passed. Javascript like Ruby, doesn’t allow method overloads. Similar solution works.
c1 = new dojo.dnd.Source("c1", {creator: node_creator,accept:Instead of passing an array, a JSON object can be passed. Below is code snipped using Dojo toolkit API.
["red","blue"],horizontal: true});

