Re: Getting Computer Name
Re: Getting Computer Name
- Subject: Re: Getting Computer Name
- From: John Joyce <email@hidden>
- Date: Mon, 21 Jun 2010 00:48:31 -0500
On Jun 20, 2010, at 6:26 PM, Steve Steinitz wrote:
> Thanks Jonathan Mitchell, John Joyce, Paul Sanders and Jens Alfke.
>
>
> John:
>
> Bingo! CSCopyMachineName() works perfectly.
>
> To answer your question, I want a human-readable machine identifier, but one that's not tied to the hardware, the way, say, serial number is.
>
> Our Core Data point-of-sale system has 8 machines making sales and I'm thinking of tagging each sale, for several reasons. Some examples:
>
> 1. to temporarily hide sales that are in progress on other machines.
> I currently do that but in a more awkward way,
>
> 2. to know where sales are actually occurring, to get a sense of
> wear and tear on printers and other disposable hardware, etc.
>
> 3. Maybe to compare the performance of the different shop floors in
> an employee-independant way. The director suspects that employees
> who go downstairs become "slackers" :)
>
>
> Jonathan:
>
> I confirm that
>
> #import <SystemConfiguration/SCDynamicStoreCopySpecific.h>
>
> allows
>
> NSLog (@"machine %@", NSMakeCollectable (SCDynamicStoreCopyLocalHostName (NULL)));
>
> and, I assume, similar forms, to work. Who'd a thunk it?
>
> Thanks again to all of you.
>
> Cheers,
>
> Steve
>
Hi Steve,
Glad to hear it.
Glad it's also in the archives for others to search and find now.
One thing, not to question your own algorithms, but you may also want to consider checking the MAC address (ethernet) or the a host of combinations of identifiers in addition to the computer name.
It's really just a sanity check.
Admin users can change their computer name at anytime, and more than one machine can have the same computer name.
Hence, the hostname and the way Bonjour manages that scenario.
Also, simply taking a user ID system to identify a user and hiding the sale in progress from others is more reliable like with any web commerce site.
It's a good idea to use a multitude of criteria to identify a system.
I don't know if you need the data in real time, but you can also generate logs and parse local logs for particular activities as well.
It's still admirable and user-friendly to attempt to refer to the computer name properly for the end user. Love it when people keep it about the users.
Regards,
John Joyce_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden