1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Buying I will pay $50 to the first person to find this bug

Discussion in 'Programming' started by webnetsecure, Sep 19, 2009.

  1. #1
    In IE the page renders and operates fine but shows an error icon. The error is:

    Webpage error details

    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Win64; x64; Trident/4.0; .NET CLR 2.0.50727; SLCC1; Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30618)
    Timestamp: Sat, 19 Sep 2009 20:28:57 UTC

    Message: Object required
    Line: 109
    Char: 26
    Code: 0
    URI: http://www.askmefast.com/

    The first person to find the bug and post a fix including the exact edits necessary to fix it I will paypal $50 to. You may need to save a static copy of the HD to work with it and make sure your fix works. You must have tried and tested the fix to make sure it works.

    Thanks, Doug
     
    webnetsecure, Sep 19, 2009 IP
  2. tracesix

    tracesix Peon

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #2
    I just checked it on firefox 3.5 on mac I don't get an error.
     
    tracesix, Sep 19, 2009 IP
  3. Oli3L

    Oli3L Active Member

    Messages:
    207
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    70
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #3
    around line 144 you have this:

     d1 = GetDistance("sp1");
      d2 = GetDistance("sp2");
      d3 = GetDistance("sp3");
    Code (markup):

    there aren't any objects with the id "sp[1-3]"
    Try to remove it.
    I removed it and it worked fine.


    Or you can check whether the object exists like that:


    
    
    function GetDistance(objname) {
      var zonewidth=15;
    
     	var sp=document.getElementById(objname);
     	if(!sp) {
    	var spx=getX(sp);
    	var spy=getY(sp);
    	var spw=getWidth(sp);
    	var sph=getHeight(sp);
    
      var rx=tempX;
      var ry=tempY;
      if (tempX<spx-zonewidth) rx=spx-zonewidth;
      if (tempX>(spx+spw+zonewidth)) rx=spx+spw+zonewidth;
      if (tempY<spy-zonewidth) ry=spy-zonewidth;
      if (tempY>(spy+sph+zonewidth)) ry=spy+sph+zonewidth;
      return Math.floor(Math.sqrt(Math.pow((rx-tempX),2)+Math.pow((ry-tempY),2)));
      }
    
    }
    
    function getMouseXY(e) {
      if (IE) { // grab the x-y pos.s if browser is IE
        tempX = event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
        tempY = event.clientY +(document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
      } else {  // grab the x-y pos.s if browser is NS
        tempX = e.pageX;
        tempY = e.pageY;
      }  
      // catch possible negative values in NS4
      if (tempX < 0){tempX = 0}
      if (tempY < 0){tempY = 0}  
    
    
      d1 = GetDistance("sp1");
      d2 = GetDistance("sp2");
      d3 = GetDistance("sp3");
    
      //document.Show.msg.value="Rx:"+rx+" Ry:"+ry+" distance:"+distance;   
      //document.Show.msg.value="Height: "+sph+" distance:"+distance;   
      
      return true
    }
    
    
    Code (markup):
    (Replace the functions with the existing ones)
     
    Last edited: Sep 19, 2009
    Oli3L, Sep 19, 2009 IP
  4. shizzie

    shizzie Well-Known Member

    Messages:
    364
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    128
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #4
    yeah..that fixed it ;)

     
    shizzie, Sep 19, 2009 IP
  5. kishore415

    kishore415 Well-Known Member

    Messages:
    1,462
    Likes Received:
    41
    Best Answers:
    0
    Trophy Points:
    160
    As Seller:
    100% - 0
    As Buyer:
    25.0% - 1
    #5
    var sp=document.getElementById(objname);

    After the above line(108 line) just add

    if(!sp) return;

    it will solve your issue...
     
    kishore415, Sep 19, 2009 IP
  6. webnetsecure

    webnetsecure Active Member

    Messages:
    168
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    58
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #6
    kishore415 got it!

    shizzie came so very close! But removing the lines you suggested breaks my code because it is needed.

    kishore415's code works perfect and does not break the rest of my code.

    I am paying $50 to kishore415.

    Thanks everyone!
     
    webnetsecure, Sep 19, 2009 IP
  7. Oli3L

    Oli3L Active Member

    Messages:
    207
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    70
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #7
    That's what exactly i wrote!
     
    Oli3L, Sep 19, 2009 IP
  8. webnetsecure

    webnetsecure Active Member

    Messages:
    168
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    58
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #8
    oli3L: Yes what I said to shizzie actually applies to you. He just tested it. However, removing the code breaks other code I have. kishore415 gave me actual code and told me where to place it. I did and it worked. His code does not remove any code. It only skips the code when the variable is not defined yet. Thus fixing the problem without breaking any other code dependent on this code. It may have appeared to work for you but thats because the error it produces is not evident to the user but messes up the back end. Kishore415's solution works on both counts. Kudos to you for getting the idea, but kishore posted a working fix first.

    PS: Kishore415 please pm me your paypal id.

    Thanks to everyone, Doug
     
    webnetsecure, Sep 19, 2009 IP
  9. webnetsecure

    webnetsecure Active Member

    Messages:
    168
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    58
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #9
    oli3L I have to apologize. I now see that you did post it first under a slightly different form:

    if(!sp) {

    ahhh! so very sorry. you did win.

    Please send me your paypal and I will pay you. Sorry kishore! but he really did post it first as you can see by inspecting the sample code he posted.

    Thanks, Doug
     
    webnetsecure, Sep 19, 2009 IP
  10. kishore415

    kishore415 Well-Known Member

    Messages:
    1,462
    Likes Received:
    41
    Best Answers:
    0
    Trophy Points:
    160
    As Seller:
    100% - 0
    As Buyer:
    25.0% - 1
    #10

    you are very wrong ...


    if(!sp){

    blah....blah..
    }

    the above code never works

    if(sp)
    {

    blah....blah..

    }

    will work

    May be in a hurry he made a mistake even if he found the right solution

    What he is doing if it the sp value is null , it shudnot go inside and call other functions..but he is calling the functions only when sp null.

    You can test the function posted in the thread and confirm
     
    kishore415, Sep 19, 2009 IP
  11. pepprs

    pepprs Peon

    Messages:
    195
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #11
    with what i see, kishore415 deserves the payment. the reasons are..

    1 the earlier guy has the logic right, but it is very confusing with two ideas one f which is to remove some code. obviously the OP rejected that idea
    2. The OP actually used the suggestion of kishore to solve his problem. so he deserved the credit, since he posted a clear no-nonsense solution.

    just my two cents ;)

    Pepp
     
    pepprs, Sep 19, 2009 IP
  12. Oli3L

    Oli3L Active Member

    Messages:
    207
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    70
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #12
    So I accidently wrote "!"..
     
    Oli3L, Sep 20, 2009 IP
  13. kishore415

    kishore415 Well-Known Member

    Messages:
    1,462
    Likes Received:
    41
    Best Answers:
    0
    Trophy Points:
    160
    As Seller:
    100% - 0
    As Buyer:
    25.0% - 1
    #13
    So you agree that your code is wrong.....
     
    kishore415, Sep 20, 2009 IP
  14. webnetsecure

    webnetsecure Active Member

    Messages:
    168
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    58
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #14
    Oh boy! This is crazy.

    Looks like Kishore did win although Oli3L came up with the idea first but wrote it out wrong. I guess its up to me to make a decision. I will pay Kishore $50 and Oli3L $25. Thats the best I can do. Hope thats ok guys.
     
    webnetsecure, Sep 20, 2009 IP
    sydzapp likes this.