Re: Getting Computer Name

2010-06-21 Thread Kyle Sluder
On Sun, Jun 20, 2010 at 6:25 PM, Steve Steinitz stein...@datatactics.com.au 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

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

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:

Re: Getting Computer Name

2010-06-21 Thread Kyle Sluder
On Jun 21, 2010, at 1:33 AM, Steve Steinitz stein...@datatactics.com.au 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

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

Re: Getting Computer Name

2010-06-20 Thread Paul Sanders
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 Subject: Getting Computer

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

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

Re: Getting Computer Name

2010-06-20 Thread Paul Sanders
Steinitz To: Paul Sanders ; 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

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

Re: Getting Computer Name

2010-06-20 Thread Paul Sanders
Are you #including CoreServices/CoreServices.h? 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

Re: Getting Computer Name

2010-06-20 Thread Steve Steinitz
Hi Paul, On 20/6/10, Paul Sanders wrote: Are you #including CoreServices/CoreServices.h? 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

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 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 CoreServices/CoreServices.h? I wasn't. I added it. Were you wondering if it would make a difference? The correct import is #import

Re: Getting Computer Name

2010-06-20 Thread Paul Sanders
The correct import is #import SystemConfiguration/SCDynamicStoreCopySpecific.h. 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

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 CoreServices/CoreServices.h? 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

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

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

Re: Getting Computer Name

2010-06-20 Thread Kyle Sluder
On Sun, Jun 20, 2010 at 4:26 PM, Steve Steinitz stein...@datatactics.com.au 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

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),

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 hardware, the