Re: Getting Computer Name

2010-06-21 Thread Kyle Sluder
On Jun 21, 2010, at 1:33 AM, Steve Steinitz wrote: > Hi Kyle, > > On 20/6/10, Kyle Sluder wrote: > >> Be aware that as of 10.6, this is an officially unsupported >> configuration, prone to breaking in point releases as happened in >> 10.6.2. > > Yes, we are more careful with Mac OS X updates n

Re: Getting Computer Name

2010-06-21 Thread Steve Steinitz
Hi Kyle, On 20/6/10, Kyle Sluder wrote: Be aware that as of 10.6, this is an officially unsupported configuration, prone to breaking in point releases as happened in 10.6.2. Yes, we are more careful with Mac OS X updates now. See Ben Trumbull's post here for the nitty-gritty: http://lists.a

Re: Getting Computer Name

2010-06-21 Thread Steve Steinitz
Hi John, not to question your own algorithms, but you may also want to consider checking the MAC address (ethernet) I see what you are saying but I want to keep specific hardware out of the equation. I want to be able to swap a new Mac Mini in at any time. The computer name is a convenienc

Re: Getting Computer Name

2010-06-20 Thread Kyle Sluder
On Sun, Jun 20, 2010 at 6:25 PM, Steve Steinitz wrote: > Each machine runs idle-time code which ensures it has recent data from the > shared store.  It was hard to get right but after a year of tweaking, it > works well.  SQLite has just enough locking capability to make it work. Be aware that as

Re: Getting Computer Name

2010-06-20 Thread John Joyce
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 hardwa

Re: Getting Computer Name

2010-06-20 Thread Steve Steinitz
Hi Kyle, On 20/6/10, Kyle Sluder wrote: to temporarily hide sales that are in progress on other machines. I currently do that but in a more awkward way, Might you instead want to make a sale an atomic thing? Perform the sale on a scratch MOC, and then when the sale is complete (or voided), me

Re: Getting Computer Name

2010-06-20 Thread Kyle Sluder
On Sun, Jun 20, 2010 at 4:26 PM, Steve Steinitz wrote: >    1. to temporarily hide sales that are in progress on other machines. >       I currently do that but in a more awkward way, Might you instead want to make a sale an atomic thing? Perform the sale on a scratch MOC, and then when the sale

Re: Getting Computer Name

2010-06-20 Thread Steve Steinitz
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 sys

Re: Getting Computer Name

2010-06-20 Thread Jens Alfke
On Jun 20, 2010, at 11:01 AM, John Joyce wrote: > This is different from a localhost name. The host name can be very different. And each active network interface will have a different hostname, just as it has a different IP address. So I might simultaneously be “jens.foocorp.com” on Ethernet w

Re: Getting Computer Name

2010-06-20 Thread John Joyce
On Jun 20, 2010, at 8:46 AM, Steve Steinitz wrote: > Hi Paul, > > On 20/6/10, Paul Sanders wrote: > Are you #including ? >> >>> I wasn't. I added it. Were you wondering if it would make a difference? >> >> Well, yes. Default return type is int. In fact I'm suprised you >> didn't get

Re: Getting Computer Name

2010-06-20 Thread Paul Sanders
> The correct import is #import > . So it is, sorry. It was half-way down my source file. Regards, Paul Sanders. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the

Re: Getting Computer Name

2010-06-20 Thread jonat...@mugginsoft.com
On 20 Jun 2010, at 14:46, Steve Steinitz wrote: > Hi Paul, > > On 20/6/10, Paul Sanders wrote: > Are you #including ? >> >>> I wasn't. I added it. Were you wondering if it would make a difference? The correct import is #import . Omitting it causes the compiler to assume integer return

Re: Getting Computer Name

2010-06-20 Thread Steve Steinitz
Hi Jonathan, Thanks for replying. On 20/6/10, Jonathan Mitchell wrote: >> Could I have done something to my project to break toll-free bridging? > You can't break toll free bridging. > The NSObject and CF type collaborate to route objects and function calls > appropriately. Thanks for that

Re: Getting Computer Name

2010-06-20 Thread Steve Steinitz
Hi Paul, On 20/6/10, Paul Sanders wrote: Are you #including ? I wasn't. I added it. Were you wondering if it would make a difference? Well, yes. Default return type is int. In fact I'm suprised you didn't get a warning about the function being undefined. My Mac is powered off or I wou

Re: Getting Computer Name

2010-06-20 Thread Paul Sanders
>> Are you #including ? > I wasn't. I added it. Were you wondering if it would make a difference? Well, yes. Default return type is int. In fact I'm suprised you didn't get a warning about the function being undefined. My Mac is powered off or I would check. Does adding the #include sort

Re: Getting Computer Name

2010-06-20 Thread Steve Steinitz
Hi Paul, On 20/6/10, Paul Sanders wrote: It looks like SCDynamicStoreCopyComputerName is not prototyped correctly so the compiler assumes it returns an int. In what I assume is a 64-bit build this will lose the top 32 bits of the CFStringRef. Yes, your diagnosis holds water. I'm building an

Re: Getting Computer Name

2010-06-20 Thread Paul Sanders
nders ; cocoa-dev@lists.apple.com Sent: Sunday, June 20, 2010 11:52 AM Subject: Re: Getting Computer Name Here is my method: + (NSString *) computerName { CFStringRef temp = SCDynamicStoreCopyComputerName (NULL, NULL); NSString* name = [NSString stringWithString: temp];

Re: Getting Computer Name

2010-06-20 Thread Steve Steinitz
Hi Paul, Thanks for your reply. On 20/6/10, Paul Sanders wrote: I use #1 and it works fine for me. Note that SCDynamicStoreCopyComputerName might return NULL, and don't forget to CFRelease temp. OK, thanks. In the case of #1, what is the NSLog statement that is failing? And I take it tha

Re: Getting Computer Name

2010-06-20 Thread jonat...@mugginsoft.com
On 20 Jun 2010, at 11:10, Steve Steinitz wrote: > > > According to the docs CFStringRef is toll-free-bridged with NSString and so > interchangeable. The authors of the examples cite no issues. Could I have > done something to my project to break toll-free bridging? I confess, I > haven't t

Re: Getting Computer Name

2010-06-20 Thread Paul Sanders
ive until the current autorelease pool 'pops'. You can look at name (and probably temp, but I'm not sure) in the debugger, of course. Regards, Paul Sanders. - Original Message - From: Steve Steinitz To: cocoa-dev@lists.apple.com Sent: Sunday, June 20, 2010 11:10 AM

Getting Computer Name

2010-06-20 Thread Steve Steinitz
Hello, I've found several examples of getting the computer Name but some give warnings about making a pointer from an integer and they all fail with signal EXC_BAD_ACCESS here objc_msgSend_vtable5 _NSDescriptionWithLocaleFunc _CFStringAppendFormatAndArgumentsAux _CFStringCreat