Re: Archiving / Unarchiving Question

2011-06-02 Thread Kyle Sluder
On Jun 1, 2011, at 6:42 PM, Dave DeLong wrote: > Your archive includes an instance of "DataObject", but the process doing the > unarchiving does not have that class definition. Which is a good reason why you should not use archiving as a representation of your data. Use an implementation-agno

Re: Archiving / Unarchiving Question

2011-06-02 Thread Jens Alfke
On Jun 2, 2011, at 12:09 AM, Kyle Sluder wrote: > Which is a good reason why you should not use archiving as a representation > of your data. Well, I think archiving can make sense as long as the producer and consumer are the same application, and you know that the file/data format will never

Re: Notify With Parameters

2011-06-02 Thread Jens Alfke
On Jun 1, 2011, at 11:45 PM, Bing Li wrote: > My question is if it is possible to transmit data from WorkingApp to > AppController? Sure; that’s what the userInfo dictionary in NSNotification is for. >// The following code cannot be compiled. >// NSString *message = "Happy holi

Re: Notify With Parameters

2011-06-02 Thread Roland King
can't be compiled because he's done NSString *message = "Happy Holidays!"; instead of the proper syntax for a string constant NSString *message = @"Merry Christmas!"; or else the compiler hates 'Happy Holidays' as much as I do. On 02-Jun-2011, at 3:32 PM, Jens Alfke wrote:

Re: Notify With Parameters

2011-06-02 Thread Jens Alfke
On Jun 2, 2011, at 12:32 AM, I wrote: >> // The following code cannot be compiled. >> // NSString *message = "Happy holidays!"; >> // [[NSNotificationCenter defaultCenter] postNotificationName:@"Done" >> object:message]; > > Why can’t it be compiled? I don’t see any errors in t

Re: Declaring and initialization of C array.

2011-06-02 Thread Vyacheslav Karamov
I agree with you, but I guess he missed semicolon just before an array declaration because he got *compiler* error, not linker! Correct declaration could be of two forms: 1) In header file static int a[2] = {1,2}; or static int a[] = {1,2}; 2) In header file extern int a[2]; In *.m file: int a

Re: Code style (was: Notify With Parameters)

2011-06-02 Thread Conrad Shultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 6/1/11 11:45 PM, Bing Li wrote: > Dear all, > > I have a question on delegate/notification techniques in Cocoa. Roland and Jens have already addressed your main issue (you can also look at my response to Dan Hopwood a few days ago on a related iss

NSInputStream created from NSData - expected it to close at end of data, did not happen

2011-06-02 Thread Jodischlange
Hi all, I wanted to have a very basic TCP server that could return arbitrary bytes when a client connected to it to test whether some protocol (on top of TCP) code I wrote works as expected. To do so I adapted the CocoaEcho example (http://developer.apple.com/library/mac/samplecode/CocoaEcho/In

NSNotificationQueue Should Be Collected?

2011-06-02 Thread Bing Li
Dear all, In my system, when a remote message is received, a notification must be raised as follows. [[[NSNotificationQueue alloc] initWithNotificationCenter:[NSNotificationCenter defaultCenter]] enqueueNotification:[NSNotification notificationWithName:"MessageReceived" object:self userIn

Fwd: NSNotificationQueue Should Be Collected?

2011-06-02 Thread Bing Li
Dear all, I plan to initialize an instance variable of NSNotificationQueue in the object. Then, the notification can be done in this way. [notificationQueue enqueueNotification:[NSNotification notificationWithName:"MessageReceived" object:self userInfo: messageDictionary] postingStyle:NSPost

CoreData problem - AttributeDescription seems invalid --- What am I doing wrong?

2011-06-02 Thread Motti Shneor
Hello everyone. We work with a CoreData model that is memory-based. However, at times I would want to (partially) save an entity to the UserDefaults, as a dictionary. For that, I wrote a little NSManagedObject extension (Category) with the following method: @interface NSManagedObject (OUREx

RE: What is the point of a host-reachability test that doesn't test the reachability of the host?

2011-06-02 Thread Jim Adams
In a recent app I wrote I used the Reachability API but then when attempting to log on to my host I pinged 5 tries at the same time as attempting to log on. My thinking was that I could either wait the very long time for the logon attempt to time out or I could decide after 5 failed ping attempt

Re: What is the point of a host-reachability test that doesn't test the reachability of the host?

2011-06-02 Thread Kyle Sluder
On Jun 2, 2011, at 6:04 AM, Jim Adams wrote: > In a recent app I wrote I used the Reachability API but then when attempting > to log on to my host I pinged 5 tries at the same time as attempting to log > on. My thinking was that I could either wait the very long time for the logon > attempt to

Re: Archiving / Unarchiving Question

2011-06-02 Thread Tony S. Wu
Thanks for all the suggestions. Dave was right, the class was not included in the server target (bang my head). Using XML, however, does seem to make more sense, so I will look into that as well. Thanks a lot, Tony S. Wu tonyswu@gmail.com On Jun 2, 2011, at 12:26 AM, Jens Alfke wrote:

Re: What is the point of a host-reachability test that doesn't test the reachability of the host?

2011-06-02 Thread Sherm Pendley
On Thu, Jun 2, 2011 at 11:16 AM, Kyle Sluder wrote: > > Why does everyone insist on using roundabout ways to detect if maybe a host > will accept connections on a completely unrelated port ... when it may not even accept *those* on the next attempt. Can you say "race condition?" I knew you could

Re: Code style (was: Notify With Parameters)

2011-06-02 Thread Jeffrey Walton
On Thu, Jun 2, 2011 at 4:17 AM, Conrad Shultz wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 6/1/11 11:45 PM, Bing Li wrote: >> Dear all, >> >> I have a question on delegate/notification techniques in Cocoa. > > Roland and Jens have already addressed your main issue (you can also

Re: NSNotificationQueue Should Be Collected?

2011-06-02 Thread Conrad Shultz
As with virtually any leak-related question to arise: Please reread the memory management rules (http://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmRules.html). They are not long and the APIs are designed so that following them assiduously will prevent

RE: What is the point of a host-reachability test that doesn't test the reachability of the host?

2011-06-02 Thread Jim Adams
Why? Because the timeout was inordinately long with no way to shorten it other than create my own timeout. Users want responsiveness. One of the things I hate more than anything is when an app won't start because it can't contact its host. Its bad enough if it can contact the host but the respon

Re: What is the point of a host-reachability test that doesn't test the reachability of the host?

2011-06-02 Thread David Duncan
On Jun 2, 2011, at 10:31 AM, Jim Adams wrote: > Why? Because the timeout was inordinately long with no way to shorten it > other than create my own timeout. Users want responsiveness. One of the > things I hate more than anything is when an app won't start because it can't > contact its host. I

RE: What is the point of a host-reachability test that doesn't test the reachability of the host?

2011-06-02 Thread Jim Adams
True. But the situation we were running into was that a server might not be up and I could tell faster with ping than a timer. -Original Message- From: David Duncan [mailto:david.dun...@apple.com] Sent: Thursday, June 02, 2011 1:37 PM To: Jim Adams Cc: cocoa-dev Subject: Re: What is the p

Re: Setting text field as first responder in an NSView

2011-06-02 Thread Eric Williams
Jens, This worked, once I fixed my typos. Thanks! Eric Williams AIM: wile...@gmail.com Skype: wilersh On Jun 1, 2011, at 1:49 PM, Jens Alfke wrote: > > On Jun 1, 2011, at 9:15 AM, Eric Williams wrote: > >> I want to set the first responder for the window to be a text field in the >>

Re: Code style (was: Notify With Parameters)

2011-06-02 Thread Steven Woolgar
> Slightly OT: Does Apple offer a tool similar to 'indent' for > formatting? I've never tried indent on Objective C files because it > does a miserable job on C++ source files. I use Uncrustify Hope that helps. W. ___

Re: What is the point of a host-reachability test that doesn't test the reachability of the host?

2011-06-02 Thread Hank Heijink (Mailinglists)
On Jun 2, 2011, at 1:44 PM, Jim Adams wrote: > True. But the situation we were running into was that a server might not be > up and I could tell faster with ping than a timer. The point (that others have already made) is not that ping is fast, but that (a) a successful ping doesn't tell you if

Re: What is the point of a host-reachability test that doesn't test the reachability of the host?

2011-06-02 Thread Nathan Sims
On Jun 2, 2011, at 10:36 AM, David Duncan wrote: > On Jun 2, 2011, at 10:31 AM, Jim Adams wrote: > >> Why? Because the timeout was inordinately long with no way to shorten it >> other than create my own timeout. Users want responsiveness. One of the >> things I hate more than anything is when a

create custom window - NSMenu bar

2011-06-02 Thread Martin Batholdy
Hi, How can you create a custom window view that looks like this: http://s2.macupdate.com/images/screens/uploaded/JPG/32791_scr.jpg?e=79618 or this: http://a5.mzstatic.com/us/r1000/049/Purple/b1/33/08/mzl.bmiomoxu.800x500-75.jpg thanks!___ Cocoa-

Accessing information from applications

2011-06-02 Thread Abhinav K Tyagi
Hi, Is there any method to know what files are opened by any application? Thanks Abhinav K Tyagi abhityag...@gmail.com --- * Composed using Mac Mail. ___ Cocoa-dev mailing list (Cocoa-dev@li

Re: What is the point of a host-reachability test that doesn't test the reachability of the host?

2011-06-02 Thread David Duncan
On Jun 2, 2011, at 11:16 AM, Nathan Sims wrote: > On Jun 2, 2011, at 10:36 AM, David Duncan wrote: > >> On Jun 2, 2011, at 10:31 AM, Jim Adams wrote: >> >>> Why? Because the timeout was inordinately long with no way to shorten it >>> other than create my own timeout. Users want responsiveness.

Re: Accessing information from applications

2011-06-02 Thread Jens Alfke
On Jun 2, 2011, at 11:18 AM, Abhinav K Tyagi wrote: > Is there any method to know what files are opened by any application? I think you have to use fairly low-level POSIX or BSD APIs. The tool /usr/bin/lsof does this; you could get its source code from the Darwin repository (opensource.apple.c

Re: create custom window - NSMenu bar

2011-06-02 Thread Evadne Wu
Hello Martin, It looks like a mutant MAAttachedWindow, not sure though: http://mattgemmell.com/2007/10/03/maattachedwindow-nswindow-subclass — for custom scrollers, I knew that both BGHUDAppKit and BWToolkit has HUD controls, or you can probably roll your own. -ev On Jun 3, 2011, at 02:17, Ma

Re: create custom window - NSMenu bar

2011-06-02 Thread Jens Alfke
On Jun 2, 2011, at 11:17 AM, Martin Batholdy wrote: > How can you create a custom window view that looks like this: Create a borderless window (NSBorderlessWindowMask), set its ‘opaque’ property to NO, and in its root view’s drawRect method fill the entire bounds with transparent color using t

Re: Code style (was: Notify With Parameters)

2011-06-02 Thread Jens Alfke
On Jun 2, 2011, at 1:17 AM, Conrad Shultz wrote: > Google's Objective-C style guide > (http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml) > directs that spaces in method declarations be minimized. For example: There’s a lot of Google’s code style that I hate, and I wouldn’t hold i

Re: NSInputStream created from NSData - expected it to close at end of data, did not happen

2011-06-02 Thread Jens Alfke
On Jun 2, 2011, at 2:10 AM, jodischla...@gmx.de wrote: > Hi all, > > I wanted to have a very basic TCP server that could return arbitrary bytes > when a client connected to it to test whether some protocol (on top of TCP) > code I wrote works as expected. To do so I adapted the CocoaEcho examp

app store policy question

2011-06-02 Thread Allyn Bauer
We are developing a platform that will have a mobile component. Each licensee (in this case, Banks and Credit Unions) would have their own mobile app. We are going back and forth between releasing one app in the App Store and having some sort of login procedure for the users of each respective i

Re: Accessing information from applications

2011-06-02 Thread Abhinav K Tyagi
Hi list members, I have searched for and have seen "lsof" command can be used and the output can be then filtered out. Although i can filter the information based on the extensions of files but how can i get the information if the opened file is a url. The best case can be of an audio stream

Re: Accessing information from applications

2011-06-02 Thread James Montgomerie
Note that, depending on what you're wanting to do, this might not actually give you what you want (and getting what you want may be impossible). Lots of apps (word processors etc.) that have document files 'open' as far as the user is concerned actually open the file, read/unarchive it into mem

Re: Code style (was: Notify With Parameters)

2011-06-02 Thread Nathan Sims
On Jun 2, 2011, at 11:38 AM, Jens Alfke wrote: > > On Jun 2, 2011, at 1:17 AM, Conrad Shultz wrote: > >> Google's Objective-C style guide >> (http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml) >> directs that spaces in method declarations be minimized. For example: > > There’s a l

Re: Accessing information from applications

2011-06-02 Thread Bhatnagar, Arvin
>From the man page you can do something like this: lsof -F | grep MyApp Excerpt from the man page of lsof: OUTPUT FOR OTHER PROGRAMS When the -F option is specified, lsof produces output that is suitable for processing by another program - e.g, an awk or Perl script, or a C program. Run

Re: Code style (was: Notify With Parameters)

2011-06-02 Thread Dave DeLong
On Jun 2, 2011, at 11:56 AM, Nathan Sims wrote: > On Jun 2, 2011, at 11:38 AM, Jens Alfke wrote: >> >> On Jun 2, 2011, at 1:17 AM, Conrad Shultz wrote: >> >>> Google's Objective-C style guide >>> (http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml) >>> directs that spaces in method

Re: Accessing information from applications

2011-06-02 Thread Jens Alfke
On Jun 2, 2011, at 11:50 AM, Abhinav K Tyagi wrote: > Although i can filter the information based on the extensions of files but > how can i get the information if the opened file is a url. The best case can > be of an audio stream or something like that. URLs aren’t files. All the kernel know

Re: Accessing information from applications

2011-06-02 Thread James Montgomerie
This is indeed impossible to do generally. If you have /specific/ apps in mind (rather than 'any application'), it might be possible to tell this on an app-by-app basis at a higher level. For example, for Safari, you could use Applescript to get the URLs of the open windows: tell application "

Re: Code style (was: Notify With Parameters)

2011-06-02 Thread Jens Alfke
On Jun 2, 2011, at 11:56 AM, Nathan Sims wrote: > Why would Google have an Objective-C style guide? Doesn't Apple own > Objective-C? Anyone can make a style guide for anything. Google has their own [screwy] homegrown coding style for C++ and Java that they use in their own code, and they writ

Re: Code style

2011-06-02 Thread Conrad Shultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 6/2/11 11:38 AM, Jens Alfke wrote: > There’s a lot of Google’s code style that I hate, and I wouldn’t hold it > up as something everyone should follow. (The 80-character line length > and 2-space indents are particularly infuriating.) Sorry, perhap

Re: Accessing information from applications

2011-06-02 Thread Bhatnagar, Arvin
FYI: If you open Activity Monitor and double click on a process. Then you can see a list of open files and ports. Also, iN terminal if you enter 'lsof -p ' then you should see the exact same output. On 6/2/11 2:56 PM, "Bhatnagar, Arvin" wrote: >>From the man page you can do something like thi

Re: Accessing information from applications

2011-06-02 Thread Abhinav K Tyagi
Thanks for your reply Arvin. the concern however is not loading the system if the query is to be performed frequently and fetching metadata of media files locally played. We can avoid complex process like electronic music fingerprinting. The intermediate objective is something like that.

Re: Accessing information from applications

2011-06-02 Thread Abhinav K Tyagi
yes but process id will give hell lot of undesired data. and i can access info from multiple process by lsof | grep -i ".mp3" (any extension not just mp3) Thanks Abhinav K Tyagi abhityag...@gmail.com --- * Composed using Mac Mail. On

Re: Code style (was: Notify With Parameters)

2011-06-02 Thread Sean McBride
On Thu, 2 Jun 2011 12:16:09 -0400, Jeffrey Walton said: >Slightly OT: Does Apple offer a tool similar to 'indent' for >formatting? I've never tried indent on Objective C files because it >does a miserable job on C++ source files. In Xcode, see Edit > Format > Re-Indent. -- __

Re: Code style (was: Notify With Parameters)

2011-06-02 Thread Lee Ann Rucker
On Jun 2, 2011, at 1:05 PM, Sean McBride wrote: > On Thu, 2 Jun 2011 12:16:09 -0400, Jeffrey Walton said: > >> Slightly OT: Does Apple offer a tool similar to 'indent' for >> formatting? I've never tried indent on Objective C files because it >> does a miserable job on C++ source files. > > In

Re: CoreData problem - AttributeDescription seems invalid --- What am I doing wrong?

2011-06-02 Thread Steve Steinitz
Hi Matti, On 2/06/11, Motti Shneor wrote: @interface NSManagedObject (OURExtension) @property (readonly) NSMutableDictionary *attributesAsDictionary; @end - (NSMutableDictionary *)attributesAsDictionary { NSMutableDictionary *attributesDictionary = [NSMutableDictionary dictionaryWithCapacit

Re: CoreData problem - AttributeDescription seems invalid --- What am I doing wrong?

2011-06-02 Thread Quincey Morris
On Jun 2, 2011, at 16:17, Steve Steinitz wrote: > On 2/06/11, Motti Shneor wrote: > >> for (NSAttributeDescription* attribute in self.entity.attributesByName ) This actually got answered yesterday (http://lists.apple.com/archives/cocoa-dev/2011/Jun/msg00039.html). 'attributesByName' returns a

Programmatically displaying UISplitViewController popover?

2011-06-02 Thread Rick Mann
To aid discoverability, we'd like for our app, which presents a UISplitViewController, when launched in portrait mode, to automatically open the popover to reveal the contents of the left-hand side of the split view. However, all my efforts to open this up programmatically so far have failed. D

Handling NSRunLoop with AUGraph

2011-06-02 Thread Sasikumar JP
Hi, I am working on streaming audio application. Sorry for cross posting, I am facing the issue with NSRunLoop and AUGraph. What is the correct approach to handle the runloop with AUGraph. I have gone through the apple documentation and implemented the following. 1. Created a secondary thread