Fail to ssh to remote machine via hostname

3,709

The problem here is that the hostname and hosts files are only used for the computer they're on. In order for other computers to be able to use the hostname, it needs to be in the DNS zone for the domain.

Think of it like this - you get a phone, and it has a phone number 555-5555. You now know that to call California_desert, you need to dial 555-5555. But nobody else knows this. In order for others to know how to reach you, you need to register your phone number in the directory. DNS is that directory service.

Of course, you can also tell a friend that your number is 555-5555 and then they can call you directly without looking it up in the directory. For a unix system, this would be like adding the hostname and ip for California_desert to the hosts file on every server that wants to connect to it.

Share:
3,709

Related videos on Youtube

Label
Author by

Label

Updated on September 18, 2022

Comments

  • Label
    Label over 1 year

    Hey! I've been trying to add an array to an NSMutableArray using the addObject syntax. The app crashes without any explicit mention of an error. Could you please tell me how this is done?


    I have a class Stack that creates an array. So I call that class using an instance called tem that I have created. Hence, [self tem] is my call to the array. Through the program I merely add UILabels to the array(I know you'd suggest adding a string and then changing to UILabels, but I need to do it this way) and towards the end, I'd like to add this array to my 'list' array.

    -(Stack *)tem {
      if(!tem)
        tem=[[Stack alloc]init];
      return tem;
    }
    
    -(void)viewDidLoad{
      //code
      list=[NSMutableArray arrayWithArray:[self list].array];
    }
    
    -(IBAction)opPr:(UIButton *)sender
    {
      if([[[sender titleLabel]text] compare: @"="]==0) {
        //code
        UILabel *t=[[UILabel alloc]init];
        //complete creating label
        [[self tem]push:t];
        //add above label to tem array
        [list addObject:[self tem].array];
        [table reloadData];
      }
    }
    
    • Oleg Danu
      Oleg Danu over 13 years
      Share some code of yours
    • California_desert
      California_desert over 11 years
      seems the issue can not resolve on local machine but to refresh DNS server, right?
    • Paweł Rumian
      Paweł Rumian over 11 years
      No, you would need to contact the DNS server administrator and announce that computer known as pcpp3238782 should be rather called california_desert.
    • California_desert
      California_desert over 11 years
      Yes, that's correct way, thank you buddy!
  • Label
    Label over 13 years
    Okay before I post code, here's a small brief. I have a class Stack that creates an array. So I call that class using an instance called tem that I have created. Hence, [self tem] is my call to the array. Through the program I merely add UILabels to the array(I know you'd suggest adding a string and then changing to UILabels, but I need to do it this way) and towards the end, I'd like to add this array to my 'list' array. -(Stack *)list { if(!list) list=[[Stack alloc]init]; return list; }
  • Label
    Label over 13 years
    I'm sorry, I have edited the code. There was a small error. I've posted the corrected code in italics (it appears within asterisks)
  • Label
    Label over 13 years
    Please take a look at the edited code. The first method has been changed. It might help clear things up about Stack and Array. For clarification: tem: instance of class Stack that creates an NSMutableArray. list: NSMutableArray created in current class.
  • Ryan Ballantyne
    Ryan Ballantyne over 13 years
    In viewDidLoad, this line is suspect: list=[NSMutableArray arrayWithArray:[self list].array]; I'm actually surprised it doesn't crash then and there, since list should be uninitialized at that point. Or is that another mistake?
  • Label
    Label over 13 years
    How do I initialize it? I need to specify that it is an array that contains another array.
  • Ryan Ballantyne
    Ryan Ballantyne over 13 years
    list=[NSMutableArray arrayWithObject:[NSMutableArray arrayWithCapacity:10]]; // 10 is just a dummy capacity; use whatever makes sense
  • Label
    Label over 13 years
    I have infact changed it to list=[[NSMutableArray alloc]init]; Sorry about that, works perfectly! =)
  • Label
    Label over 13 years
    Having debugged that, could you please show me how to add a new row to UITableView on top of the existing row. I can't do [list addObject:x atObject:0] and call [table reload] as there is already an object at position 0 so I will have to shift the elements one position ahead.
  • Ryan Ballantyne
    Ryan Ballantyne over 13 years
    Dunno. I've never done iPhone programming, just Mac stuff. The answer is probably here: developer.apple.com/library/ios/#documentation/uikit/referen‌​ce/…
  • Label
    Label over 13 years
    Could you tell me why the following loop is executing infinite times: for(int r=[list count]-1;r>=0;r--) { NSMutableArray *temp; temp=[list objectAtIndex:r]; [list insertObject:tempatIndex:r++]; } where [list count] starts at 2 then 3 and so on
  • Ryan Ballantyne
    Ryan Ballantyne over 13 years
    That would be best asked in a new question, instead of in the comments thread on this one. Also, if you feel I've answered your original question, around here it's considered good form to mark my answer as accepted. :)
  • Label
    Label over 13 years
    Thanks for the help! How do I do that?
  • Ryan Ballantyne
    Ryan Ballantyne over 13 years
    There should be a hollow check mark next to every answer. Click the mark next to the answer you found most helpful to mark it as accepted.
  • YoloTats.com
    YoloTats.com over 11 years
    A more easier solution is to install a Zeroconf software like avahi on all computers. Then each computer announce its hostname automatically and can be pinged under TheHostname.local.
  • California_desert
    California_desert over 11 years
    Thanks for your clear&detailed explanation, very helpful!