Re: Persistent User Defaults
Thats not completely correct modifying the preferences file directly or deleting it can take a while for the user defaults process to pick up the change, but you can force the user defaults process to pick up the changes with killall cfprefsd it can be a little bit complicated sometimes and the process can write out changes before you kill it, so sometime you have to kill make you change and then kill again. > On 25 Apr 2018, at 3:42 am, Richard Charleswrote: > > On macOS an applications user defaults are stored in a preference plist file > located in ~/Library/Preferences. > > If this file is deleted, user preferences for the application still persist > until the machine is rebooted. In other words if you want to start with a > clean set of user preferences not only must you delete the preference plist > file but you must also restart the machine. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSTimer not firing when computer is inactive for a while.
I should make it clear, this is a Mac OS X application. Nathan Day On 14 Nov, 2017, at 01:43 PM, Nathan Day <nathan_...@mac.com> wrote: I have a background process that uses an NSTimer that is set to fire every minute, but when the computer is inactive for a while it will stop firing, its not until someone interacts with the computer the timer will start firing again. The timer is added to the main NSRunLoop, maybe the NSRunLoop needs to be kept active by user interaction, the background app has a status menu bar item to provide feedback when its active and provide a simple menu for basic user control. I have checked "Prevent computer from sleeping automatically when the display is off" in Energy Saver, I have also tried setting "Turn display off after" to never but it doesn't make a difference, these are things we can control on the users machines because it runs on company computers. The background app is kept alive by launchd as a User Agent and looks for new resources to be downloaded periodically, it needs to start downloading these resources not to long after they are available, they can take hours to download in some case, and they need to be available when the user returns to their computer. There is also a foreground app that talks to the background app to display the downloaded resources, a bit like iTunes and iTunes Helper. Nathan Day ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/nathan_day%40mac.com This email sent to nathan_...@mac.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSTimer not firing when computer is inactive for a while.
I have a background process that uses an NSTimer that is set to fire every minute, but when the computer is inactive for a while it will stop firing, its not until someone interacts with the computer the timer will start firing again. The timer is added to the main NSRunLoop, maybe the NSRunLoop needs to be kept active by user interaction, the background app has a status menu bar item to provide feedback when its active and provide a simple menu for basic user control. I have checked "Prevent computer from sleeping automatically when the display is off" in Energy Saver, I have also tried setting "Turn display off after" to never but it doesn't make a difference, these are things we can control on the users machines because it runs on company computers. The background app is kept alive by launchd as a User Agent and looks for new resources to be downloaded periodically, it needs to start downloading these resources not to long after they are available, they can take hours to download in some case, and they need to be available when the user returns to their computer. There is also a foreground app that talks to the background app to display the downloaded resources, a bit like iTunes and iTunes Helper. Nathan Day ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
iOS4.3 simulator with Xcode 4.4
Does anybody know how to get the iOS4.3 simulator to work with Xcode 4.4, we need to support iOS 4 up. I did a google search and found a way to do it with earlier Xcode 4's, but when I try it with Xcode 4.4 the simulator complains it can not find the SDK. Nathan Day ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: iOS4.3 simulator with Xcode 4.4
Sorry this really belongs on the Xcode mailing list Nathan Day On 27/07/2012, at 11:53 AM, Nathan Day nathan_...@mac.com wrote: Does anybody know how to get the iOS4.3 simulator to work with Xcode 4.4, we need to support iOS 4 up. I did a google search and found a way to do it with earlier Xcode 4's, but when I try it with Xcode 4.4 the simulator complains it can not find the SDK. Nathan Day ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Write Finder plugin
You can do this with Services if you are willing to have it in the services menu of the contextual menu, the user has to enable your service by going to System Preferences Keyboard Keyboard Shortcuts, you may be able to AppleScript that. If you are just writing scripts for you own use that you want to use from the Contextual Menu, do a google search for Mac Services AppleScripts. I think there is at least 1 app that lets you run scripts as services. Doing it in Cocoa is pretty straight forward. On 13/07/2012, at 3:45 PM, Rakesh Singhal rakesh.sing...@gmail.com wrote: Hi Eric, Thanks. I am trying to do it using Services but I couldn't find any sample code. Can I do it in python? Regards, Rakesh Singhal On Tue, Jul 3, 2012 at 12:09 AM, Eric Schlegel eri...@apple.com wrote: On Jul 2, 2012, at 9:53 AM, Rakesh Singhal rakesh.sing...@gmail.com wrote: There are applications (eg. dropbox) which are able to create items in finder's contextual menu, not service. There should be some way to do it. There is no supported way to do this. Dropbox uses various hacks to make its way into the Finder process. Frequently, the current version of Dropbox is incompatible with a new release of Mac OS X and has to be disabled. Don't use them as a model. -eric ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/nathan_day%40mac.com This email sent to nathan_...@mac.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Crash when calling va_arg()
For function you can write a macro version of your function which calls, you function and appends a NULL to the VA_ARG macro. I don't normally do this but I have done something similar where I wanted macros to add meta data to a class, that expanded out into compete class method implementations. On 05/07/2012, at 11:09 AM, r...@rols.org wrote: I prefer the NULL sentinel too. You might like to check if __attribute__((sentinel(0,1))) added to your function header gets the compiler to warn you if you forget it, very useful that. Hi Fritz and Jens, It makes total sense now. Out of the two options (NULL sentinel vs a number to indicate the number of args), I would choose NULL because out of the two, it's more foolproof. Is there a consensus about which option is considered best practice? Thanks again, -- Tito On Jul 4, 2012, at 4:43 PM, Fritz Anderson fri...@manoverboard.org wrote: On 4 Jul 2012, at 6:30 PM, Tito Ciuro wrote: void blockStep(fooBlock firstBlock, ...) { va_list args; va_start(args, firstBlock); id result = nil; do { result = firstBlock(result, nil); NSLog(@%@, result); } while (nil != (firstBlock = va_arg(args, fooBlock))); va_end(args); } The output looks like this: 2012-07-04 16:18:40.000 BlockStep[12418:303] One! 2012-07-04 16:18:56.533 BlockStep[12418:303] One!, Two! I've eliminated the crash by adding a nil sentinel in blockStep(): blockStep ( ^ (id result, NSError **error) { NSMutableString *value = [NSMutableString new]; [value appendString:@One!]; return value; }, ^ (id result, NSError **error) { NSMutableString *value = [NSMutableString new]; if (nil != result) { [value appendString:result]; [value appendString:@, ]; } [value appendString:@Two!]; return value; }, nil ); This allows it to work without crashing, but I'd like if possible to avoid having to place the sentinel. Any ideas? Not possible. Notionally, all parameters are passed to C functions in memory on a stack, which is unformatted and could contain anything. A function has no way of knowing how many parameters have been pushed onto the stack, or where the memory trails off into saved processor state and the like, or the types, or the amounts of memory they subtendâ¦. Most variadic functions require sentinels (usually NULL) to tell them to stop looking for parameters. The best-known exceptions are printf()-family functions, which know what to find on the stack because the format string tells them. â F -- Fritz Anderson Xcode 4 Unleashed: Don't bring your bathroom copy into the kitchen â were you raised in a barn? http://x4u.manoverboard.org/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/rols%40rols.org This email sent to r...@rols.org ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/nathan_day%40mac.com This email sent to nathan_...@mac.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSInteger vs int vs int32_t
You are saying that the CPU read two 32bit int from the cache at the same time, and then does some bit manipulation to get the high or low 32bit word into a 64bit register. On 03/07/2012, at 11:00 AM, Scott Ribe scott_r...@elevated-dev.com wrote: On Jul 2, 2012, at 5:42 PM, David Duncan wrote: I suspect you are both talking past each other. Jens' assertion is that if you had a 128 byte cache, you could store either 8 64-bit integers or 16 32-bit integers in it. Whereas Kyle is asserting that the CPU need only read 32-bits at a time (or less) from the cache for opcodes that deal with 32-bits (or less) of data at a time. I don't think so; I think Kyle was asserting that for a 32-bit integer on a 64-bit machine, the CPU would read 64 bits from the cache. -- Scott Ribe scott_r...@elevated-dev.com http://www.elevated-dev.com/ (303) 722-0567 voice ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/nathan_day%40mac.com This email sent to nathan_...@mac.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSInteger vs int vs int32_t
It must if 64bits is read in that mean you have just read in two 32bit words. So to put a 32bit word in a 64bit register some bit must be ditched, in some way, and if the CPU is optimise to only work with 64bit word alignment (don't know how intel does it), then to get 32 bit aligned words it must do some bit shift. On 05/07/2012, at 3:33 PM, Scott Ribe scott_r...@elevated-dev.com wrote: On Jul 4, 2012, at 11:28 PM, Nathan Day wrote: You are saying that the CPU read two 32bit int from the cache at the same time, and then does some bit manipulation to get the high or low 32bit word into a 64bit register. No, I'm not saying that at all. -- Scott Ribe scott_r...@elevated-dev.com http://www.elevated-dev.com/ (303) 722-0567 voice ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Caching Streaming video
OK here is a more detailed explanation of what I am doing I start downloading the video file with a NSURLConnection I then implement the received data delegate method like the following. - (void)connection:(NSURLConnection *)aConnection didReceiveData:(NSData *)aData { bytesFetched += aData.length; if( bytesFetched kBytesRequiredBeforeStart !hasCachedData ) // kBytesRequiredBeforeStart = 16 { [[NSNotificationCenter defaultCenter] postNotificationName:kVideoURLCacheHasDataNotification object:self]; hasCachedData = YES; } [self.fileHandle writeData:aData]; // this file handle is not closed until after the video has finished downloading } The fileHandle is created like this - (NSFileHandle *)fileHandle { if( fileHandle == nil ) { NSError * theError = nil; cachedURL = [[NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingFormat:@/%@, kTempFileName]] retain]; [[NSFileManager defaultManager] createFileAtPath:[self.cachedURL path] contents:nil attributes:nil]; fileHandle = [[NSFileHandle fileHandleForWritingToURL:self.cachedURL error:theError] retain]; if( fileHandle == nil ) [[NSNotificationCenter defaultCenter] postNotificationName:kVideoURLCacheErrorOccuredNotification object:self]; } return fileHandle; } I also have a did finish delegate handling method like this - (void)connectionDidFinishLoading:(NSURLConnection *)connection { if( hasCachedData == NO ) { [[NSNotificationCenter defaultCenter] postNotificationName:kVideoURLCacheHasDataNotification object:self]; hasCachedData = YES; } hasFinishedCaching = YES; [[NSNotificationCenter defaultCenter] postNotificationName:kVideoURLCacheDidFinishLoadingNotification object:self]; } I then have a method to observer the notification like the following - (void)videoURLCacheHasDataNotification:(NSNotification *)aNotification { [self.videoController play]; } where the videoController is an instance of MPMoviePlayerController created like below, cachedURL is the same one defined above. - (MPMoviePlayerController *)videoController { if( videoController == nil ) { NSURL * theURL = self.videoURLCache.cachedURL; NSLog( @Video URL = '%@', theURL ); videoController = [[MPMoviePlayerController alloc] initWithContentURL:theURL]; videoController.shouldAutoplay = NO; [videoController setFullscreen:NO animated:NO]; videoController.view.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleRightMargin|UIViewAutoresizingFlexibleHeight; videoController.repeatMode = MPMovieRepeatModeOne; videoController.controlStyle = MPMovieControlStyleEmbedded; videoController.view.frame = self.videoView.bounds; [videoView addSubview:self.videoController.view]; } NSParameterAssert(videoController != nil); return videoController; } Now this work fine in the iPhone simulator but on my actually iPodTouch it stops at what I am assuming is 16, (I haven't check this). To get the entire video to play on my iPodTouch I have to move the [self.videoController play]; to a notification observer for the video did finish loading notification. On 26/06/2011, at 8:05 PM, Nathan Day wrote: I am trying to playback video in my iOS app while I am loading and caching it at the same time. I fetch the video using a NSURLConnection and then store it in a local file, I start video playback of the local video file after a certain number of bytes are received. I have it working great in the simulator, I can start playing the video before I have received all of it, but when I go to run my app on my iPodTouch, I can only seem to play up to the number of bytes I had already received before I started playback. I can only play the entire video if I wait until I have receive the entire file before I start playback. I can also get the video to play completely if I stop the failed attempt with a [video stop] message and then start playing it again, pausing the video only doesn't work. Has anybody got this working, is it possible. Nathan Day Software Engineer home page:http://homepage.mac.com/nathan_day/ Nathan Day Software Engineer home page: http://homepage.mac.com/nathan_day/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http
Caching Streaming video
I am trying to playback video in my iOS app while I am loading and caching it at the same time. I fetch the video using a NSURLConnection and then store it in a local file, I start video playback of the local video file after a certain number of bytes are received. I have it working great in the simulator, I can start playing the video before I have received all of it, but when I go to run my app on my iPodTouch, I can only seem to play up to the number of bytes I had already received before I started playback. I can only play the entire video if I wait until I have receive the entire file before I start playback. I can also get the video to play completely if I stop the failed attempt with a [video stop] message and then start playing it again, pausing the video only doesn't work. Has anybody got this working, is it possible. Nathan Day Software Engineer mobile: +61 (0)4 3863 2407 home page: http://homepage.mac.com/nathan_day/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSTimer not working in a multithreaded application
NSTimers rely on there being an NSRunLoop for the current thread, so if you are creating a timer in a thread without a run loop it will not work, because the is no run loop to add the timer to. From the sounds of it you also want the timer to be executed in the main thread, in which case you will have to use one of the perform in main thread methods so the creation of you timer can happen in the main thread. You may alternatively be able to create a time and manually add it to the main runloop if the methods for that are thread safe, but I don't think they are. Sent from my iPad On 03/09/2010, at 12:37, Abhijeet Singh abhi_...@in.com wrote: Hi,I am working on a multithreaded software that runs on a medical instrument. The software has 2 parts. GUI and worker threads (worker threads sends commands to instrument). The GUI is developed using ObjectiveC and Cocoa. Worker threads are all in C and Carbon.It is a Cocoa application.I am working on GUI of the software.When the application starts it first creates worker threads ( that initializes the hardware/instrument). Once the threads are created one of the thread sends a message back to main thread. My problem isi need to start a timer when the main thread receives a message from worker thread. I am starting a timer as follows:timer = [[NSTimer scheduledTimerWithTimeInterval:10.0 target:self selector:@selector(turnOffLight:) userInfo:nil repeats:NO] retain];But it does not work. I debugged it and found that the timer is created but turnOffLight is never executed.Then I created the timer just before worker threads creation and it worked. Can anybody help me in res ol ving this problem.Thanks RegardsAbhijeetGet Yourself a cool, short @in.com Email ID now!Report spam ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/nathan_day%40mac.com This email sent to nathan_...@mac.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Non full screen video on iPhone
Is it possible to have none full screen video on the iPhone, I have try to just get a demo app going at the moment, I tried using a UIWebView with a video tag that that doesn't start playing until it becomes full screen. Any sample projects would be appreciated. Nathan Day Software Engineer mobile: +61 (0)4 3863 2407 home page: http://homepage.mac.com/nathan_day/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSCoding between iOS and Mac OS X
What about binary property lists, they should be interchangeable between iOS and Mac OS X? On 26/08/2010, at 1:29 AM, Ricky Sharp wrote: A similar question came up recently. While some objects (e.g. NSNumber) things should be binary compatible. But you may run into issues. Also depends upon what objects you are coding. Mac OS X uses NSColor whereas iOS uses UIColor. I would recommend using an intermediate normalized format instead. Then write independent code for each platform. If archiving colors, capture normalized values like color mode (ARGB, HSL), color components, etc. Then, rebuild up objects as needed. For text data, I would use UTF-8 with the original text being normalized. Sent from my iPhone On Aug 25, 2010, at 8:43 AM, Nathan Day nathan_...@mac.com wrote: Does anybody know whether NSCoding can be used to transfer data between iOS and Mac OS X. Is this documented as guaranteed to work. I have tried to do a google search but I got nothing, probably searching for the wrong thing. Nathan Day http://homepage.mac.com/nathan_day/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/rsharp%40mac.com This email sent to rsh...@mac.com Nathan Day http://homepage.mac.com/nathan_day/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSCoding between iOS and Mac OS X
Does anybody know whether NSCoding can be used to transfer data between iOS and Mac OS X. Is this documented as guaranteed to work. I have tried to do a google search but I got nothing, probably searching for the wrong thing. Nathan Day http://homepage.mac.com/nathan_day/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSXMLElement and namespaces
Can anybody help me understand how namespaces works with NSXMLNode etc. There is the method + [NSXMLNode elementWithName:(NSString *)name URI:(NSString *)URI] Which takes an namespace URI, but doesn't seem to use it. I have seems an example from google where they pass the namespace URI and then use a name which uses the namespace prefix as part of the name, for exmaple [NSXMLNode elementWithName:@xsl:value-of URI:@http://www.w3.org/1999/XSL/Transform;]; If you have to add the prefix to the name then what is the point of the URI argument. Nathan Day http://homepage.mac.com/nathan_day/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: MyDocument.xib v MainMenu.xib
If you have an application delegate you can add a IB instance variable to that. Though what I usually do in your situation is to create a separate NIB and window controller for the inspector panel, I then have a showInspector method in my application delegate which will create the window controller if necessary, and then use notifications and notification observing to keep the inspector up to date with changes to the main window/document and changes in content. On 30/12/2009, at 4:23 PM, David Blanton wrote: In a document based app I want to have some 'inspectors that reflect what i sgoing on in the document. These inspectors should float. If I make NSPanel's for the inspector in MyDocument.xib then each instance of a document gets its own set of inspectors. I would like to have just one set of inspectors whose contents change as different documents are activated. Putting the inspectors in MainMenu.xib will let me make just 'one set' for all documents but I am unsure as to how to get a reference from the inspector to the document given different xib's. Suggestion please. db ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/nathan_day%40mac.com This email sent to nathan_...@mac.com Nathan Day home page: http://homepage.mac.com/nathan_day/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: passing a method name?
You can pass the hidden parameter _cmd which is of type SEL you can then use @selector(selector_name) to do your test, this whole thing you are doing sounds really strange, it would be good to see what you are doing to find a better approach. based on what little information your are giving us I would be sending an enum with each enum describing then option. On 21/12/2009, at 12:18 AM, Chunk 1978 wrote: i have a bunch of methods that will call one method. currently, i'm passing a string object so the called method will know which method had called it, and complete the proper task based on the method that called it. instead of creating strings and passing them, is it possible to pass the method name? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/nathan_day%40mac.com This email sent to nathan_...@mac.com Nathan Day Software Engineer mobile: +61 (0)4 3863 2407 home page: http://homepage.mac.com/nathan_day/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Beach balling on mach_msg_trap
I am getting a beach balling in an application I am working on, I would of investigated more but I have noticed that some other apps on my computer seem to be doing the same thing. If I move my applications window it free up the block allowing an event to be processed), but the instantly freezes on the next event, this is why I think other applications have the same problem because they exhibit the same behaviour, this includes the Applications Safari when playing a movie, Quick Time Player but the sound keeps playing and a Third party app called Opacity. s this a known issues. It doesn't affect my MacBook Pro only my iMac and the issue occurred in 10.5 and 10.6, I am using an NSOperationQue which may have something to do with it. One thing that is different between my MacBook Pro and iMac is that my iMac is nearly always doing something in the background, without may app running there is about 15% to 20% cpu usage and about 500 thread, another difference between my iMac and my MacBook Pro is that my iMac has only 37% of 1TB hard disk space, I have heard there can be some issues with disk fragmentation at 30% or less hard disk space. (gdb) where #0 0x00010011ad7a in mach_msg_trap () #1 0x00010011b3ed in mach_msg () #2 0x00010047fce2 in __CFRunLoopRun () #3 0x00010047f03f in CFRunLoopRunSpecific () #4 0x00010242ac4e in RunCurrentEventLoopInMode () #5 0x00010242aa53 in ReceiveNextEventCommon () #6 0x00010242a90c in BlockUntilNextEventMatchingListInMode () #7 0x000100fc1520 in _DPSNextEvent () #8 0x000100fc0e89 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] () #9 0x000100f86a7d in -[NSApplication run] () #10 0x000100f7f798 in NSApplicationMain () #11 0x000134ba in main (argc=1, argv=0x7fff5fbff3c8) at XX Nathan Day Software Engineer mobile: +61 (0)4 3863 2407 home page: http://homepage.mac.com/nathan_day/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Hiding tab view items
In general hiding bit of you interface depending on the state/ selection of you app is considered bad because it can confuse the user, if you disable elements then you are tell the user that the element is not available for the current state/selection etc., if you you hide elements then the user may think they have forgotten how to get to a particular feature and become frustrated as they try to find it. Also hiding elements can in some cases cause the remaining elements to move around which can allow confuse users (menu items for example), I am not saying you are wrong to do this in your case, only you can decided that. On 13/10/2009, at 1:53 AM, BareFeet wrote: I have a hierarchical list of objects, like the typical iTunes or XCode left pane. When the user selects a node in this hierarchy, I display detail of that node in the pane on the right. This right pane is divided into tab view items. Only some of the tab view items are relevant to each type of node, so I'd like to hide the tab view items that are not relevant. How can I do this? Nathan Day http://homepage.mac.com/nathan_day/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How can we draw a horizontal line with embossing effect?
You could also try one of the draw bezel functions NSDrawDarkBezel NSDrawGrayBezel NSDrawLightBezel NSDrawWhiteBezel with a height of 2, and a y value with a .5 decimal On 11/09/2009, at 12:12 AM, Steven Degutis wrote: Arun, It's just two lines drawn on top of one another, with the top one darker than the background and the bottom one lighter. I use it in my Preference panels all the time. -- Steven Degutis http://www.thoughtfultree.com/ http://www.degutis.org/ On Thu, Sep 10, 2009 at 4:15 AM, Arun arun...@gmail.com wrote: Hi All How can we draw a horizontal line with embossing effect? The attached picture describes more clearly. Thanks Arun KA ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/steven.degutis%40gmail.com This email sent to steven.degu...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/nathan_day%40mac.com This email sent to nathan_...@mac.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: document-based application
That is the way I do it, I don't see why it wouldn't work 100% of the time, it would be nice if Apple had a way to insert a template chooser, but I would describe the way you have done it as 'an ugly hack'. On 07/09/2009, at 3:24 PM, Oftenwrong Soong wrote: Hi All, In my doc-based app, I need to initially display a startup window instead of a new empty document. Its function would be somewhat akin to that of the Template Chooser that comes up when you launch Pages. I've scoured the texts about the document architecture but cannot find pointers on how to do this. So far this is the best idea I could come up with: Implement NSApplication delegate applicationShouldOpenUntitledFile:, returning NO, and implement applicationDidFinishLaunching:, in which the startup window is launched. Then I manually call makeUntitledDocumentOfType:error. It seems an ugly hack and I have a feeling it won't work 100% right. Is there a better way to implement an initial window in a doc-based app? Thanks, Soong ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/nathan_day%40mac.com This email sent to nathan_...@mac.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Creating table rows from XML
What happens when you run it in the debugger, you say this is your first iPhone application if you are new to using a debugger then you really need to learn how to use that, it will make finding bugs like this a lot easier, for example you can break just before you add an object to you array (pages) and type 'po pages' in the terminal to see what pages is, if I have miss read you and you are familiar with the debugger then just ignore everything I have said. On 20/04/2009, at 4:30 PM, Phil Dokas wrote: Hello all, I'm writing my first iPhone application and I've run into a problem I can't seem to get a grasp on. In short I want to parse an XML file and display a UITableView with data from a set of XML elements. I've got all the code written for this but whenever I try to access my array of data inside of - tableView:cellForRowAtIndexPath: I crash without an error message in console. Here are the two relevant classes: @interface PDPagesViewController : UITableViewController { NSData* received_data; NSMutableArray* pages; } - (void)beginParsing; @end @interface PDPage : NSObject { NSNumber* page_id; NSString* title; } @property(nonatomic,retain) NSNumber* page_id; @property(nonatomic,copy) NSString* title; -(id)init; -(id)initWithID:(int)in_id andTitle:(NSString*)in_title; @end I init my PDPagesViewController as follows: - (id)init { if (self = [super init]) { pages = [[NSMutableArray alloc] init]; [self beginParsing]; } return self; } I construct my NSURLRequest and setup my parser inside of beginParsing. Here is the delegate method which then builds my array: - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict { // Handle page elements if ([elementName isEqualToString:@page]) { NSString *titleAttr = [attributeDict objectForKey:@title]; NSString *idAttr = [attributeDict objectForKey:@id]; if (titleAttr idAttr) { PDPage* newPage = [[PDPage alloc] initWithID:[idAttr intValue] andTitle:titleAttr]; [pages addObject:newPage]; [newPage release]; } return; } } Insofar as I can tell, everything is ok so far. The problem occurs in this table delegate method (again, part of PDPagesViewController), with crashing lines and received output listed in comments: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @Cell; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; } // Set up the cell... NSLog(@Setting up table cell %d, [indexPath row]); // Setting up table cell: 8 NSLog(@retain count: %d, [pages retainCount]); // retain count: 1 NSLog(@array count: %d, [pages count]); // array count: 16 NSLog(@page retain count: %d, [(PDPage*)[pages objectAtIndex: [indexPath row]] retainCount]); // page retain count: 1 NSLog(@title: %@, [(PDPage*)[pages objectAtIndex:[indexPath row]] title]); // This line causes a crash NSLog(@pages array right now: %@, pages); // This line causes a crash cell.text = [[pages objectAtIndex:[indexPath row]] title]; // This line causes a crash return cell; } It seems to me that whenever I try to interact with my NSMutableArray as such in this method it crashes, but when I use only its NSObject methods it's fine. And yet, it and its contents have the right retain count. I feel like I must be missing something basic, so any insight would be much appreciated. Thank you! -- Phil Dokas -//- p...@jetless.org ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/nathan_day%40mac.com This email sent to nathan_...@mac.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Multithreading and Mach ports
NSPort represents both ends of the communication channel you only create one NSPort. On 11/12/2008, at 4:58 AM, John Love wrote: Reference: http://developer.apple.com/documentation/Cocoa/Conceptual/Multithreading/RunLoopManagement/chapter_6_section_5.html#/ /apple_ref/doc/uid/1057i-CH16-SW7 While I'm trying to piece your replies together, I have a quick question .. reference Listing 5-15 and, in particular, the comment: // Create and configure the worker thread port. It appears that the passed (NSPort*)outPort is also the worker, or background, thread port. If true, then are we sending from a background port to another background port??? Thanks for this in-between request. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/nathan_day%40mac.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Countdown With NSTimer - Hours, Minutes, Seconds Remaining?
You need something like NSLog(@%.2d Hours, %.2d Minutes and %2d Seconds Remaining, hoursSelected-seconds/3600, (hoursSelected*60-seconds/60)%60, (hoursSelected*3600-seconds)%60 ); On 11/12/2008, at 11:03 , Chunk 1978 wrote: i believe i painted myself into a corner here... i have a NSPopUpButton with 3 items. 1 Hour, 2 Hours, 3 Hours. each item has respected tag numbers 1, 2 and 3. i'm attempting to print out time remaining but i can only get as far as displaying seconds remaining with this: NSLog(@%.2d Seconds Remaining, (hoursSelected - second)); but i would like for the log to output @%.2d Hours, %.2d Minutes and %2d Seconds Remaining; i can't wrap my head around it, and i fear that my trying to be as if/else statementless as possible by using the tag numbers of the PopUp Menu is causing me problems. -=-=-=-=- -(int)timeMenuSelection { return [[menu selectedItem] tag]; } - (IBAction)startTimer:(id)sender { startTime = [NSDate timeIntervalSinceReferenceDate]; [killTimer invalidate]; [killTimer release]; killTimer = nil; killTimer = [[NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(updateTime:) userInfo:nil repeats:YES] retain]; } - (void)updateTime:(NSTimer *)theTimer { NSTimeInterval now = [NSDate timeIntervalSinceReferenceDate]; NSTimeInterval interval = now - startTime; int second = (int)interval; //Tag #1 x 3600 Seconds = 3600 Seconds = 2 Hours. //Tag #2 x 3600 Seconds = 7200 Seconds = 2 Hours. //Tag #3 x 3600 Seconds = 10800 Seconds = 3 Hours. int hoursSelected = ([self timeMenuSelection] * 3600); if (second = hoursSelected) { NSLog(@%.2d Seconds Remaining, (hoursSelected - second)); } else { NSLog(@TIME'S UP!); [killTimer invalidate]; [killTimer release]; killTimer = nil; } } -=-=-=-=- ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/nathan_day%40mac.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: How to use NSWorkspace?
You probable do not have AppKit include into you command line tool (under the 'External Frameworks and Libraries' folder) either add it to your project or look at LaunchServices which is easy to use, I have an example/wrapper on my web site. On 08/12/2008, at 11:07 , John Velman wrote: I'm missing something obvious, but I don't know what. I want to use NSWorkspace to open an application from a command line Foundation Tool. When I try to build the simplest thing, I get -- Undefined symbols: .objc_class_name_NSWorkspace, referenced from: [EMAIL PROTECTED]@[EMAIL PROTECTED] in LaunchMyMail.o ld: symbol(s) not found collect2: ld returned 1 exit status .objc_class_name_NSWorkspace, referenced from: [EMAIL PROTECTED]@[EMAIL PROTECTED] in LaunchMyMail.o ld: symbol(s) not found collect2: ld returned 1 exit status --- This happens whatever combination of the following imports I use: #import Foundation/Foundation.h #import ApplicationServices/ApplicationServices.h #import cocoa/Cocoa.h #import AppKit/AppKit.h This also happens for [[NSWorkspace sharedWorkspace] openFile:@SomeFile withApplication:@someApp]; Examples I find, don't seem to have any problem, but when I copy them onto my machine, they don't work. Thanks, John V. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/nathan_day%40mac.com This email sent to [EMAIL PROTECTED] Nathan Day Software Engineer home: +61 (0)2 9356 4874 work: +61 (0)2 8207 8241 mobile: +61 (0)4 3863 2407 ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Multithreading and Mach ports
On 10/12/2008, at 07:36 , John Love wrote: Reference: http://developer.apple.com/documentation/Cocoa/Conceptual/Multithreading/RunLoopManagement/chapter_6_section_5.html#/ /apple_ref/doc/uid/1057i-CH16-SW7 I've got several questions since I'm just starting to investigate Mach Ports. 1) Why is +LaunchThreadWithPort: so designated, ie, a class method. It seems to me that as far as the specific code listings presented, a class method is not required? For example, [workerObj sendCheckinMessage:distantPort] could be replaced with [self sendCheckinMessage:distantPort] if LaunchThreadWithPort would be changed to an instance method. 2) Maybe the real question #1 is: What exactly is the object in the background thread, named workerObj ?? Class object can be used as any other object, it means they don't have to create an instance. It is the Class/Factory object MyWorkerClass you can treat them the same as any other object they are just created automatically for you. When you send a message you do not disquish between class objects and instance objects it is only when defining the class you use the +/- syntax to say which object(s) the method is for, the single class object or the multiple instance objects. I don't know if this helps but if you where to implement this kind of thing in C, then each class would have two struct definitions one for the class object and one for the instances that would contain a pointer to the class object. 3) I've saved my most general question to last, at least for this trip: currently when I enter my method to start up my background thread or threads, I simply call (several times if I have multiple threads: [NSThread detachNewThreadSelector:@selector(bgCalcThread:) toTarget:self withObject:nil] If I have multiple background threads, I can use a NSMutableDictionary with multiple keys for inter-thread communication As long as you use a lock yes, the point of this example is NSRunLoop and using NSPort, doing it this way mean you can have a thread wait for to be triggered on mutliple inputs source one of which is data through your port you could not do this with just passing data directly between two threads and using locks. One use for this prior to 10.4? is that you could use this to invoke methods in the main thread, my NDRunLoopMessager class did this and there was another on the net somewhere, there is now an NSObject method to do this for you, it probable uses this technique. You could not do this with a straight locks very well because you either have to use I timer so the runloop can keep polling until there is data for it to handle or it waits on a lock until the data is ready, holding up the GUI thread. So, what do Mach Ports give me that the above doesn't? John Love Touch the Future! Teach! ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/nathan_day%40mac.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Design patterns: MVC, MVP, Passive View... where is Apple heading???
I have seen that version of the MVC pattern a lot where the View and Model are directly connected sometimes only one way, never really understood how it was supposed to work, my understanding is that with cocoa the model and view where never directly connected to each and it was the purpose of the controller classes act as an interface between the two, I guess the controller acts as a presenter and a controller. On 10/12/2008, at 00:36 , Karan, Cem (Civ, ARL/CISD) wrote: To lay the groundwork for this question, I'm going to state that I'm getting my definitions for MVC, MVP, and Passive View from the following: http://en.wikipedia.org/wiki/Model-view-controller http://en.wikipedia.org/wiki/Model_View_Presenter http://www.martinfowler.com/eaaDev/PassiveScreen.html Apple has always stated that it uses the MVC design pattern, but I noticed in OS X 10.5 we've gotten NSViewController, KVO, bindings, etc., objects that seem to behave more like the Passive View design pattern. Is this where Apple wants us to head? I want to plan out my code in a manner that plays as well as possible with Apple's chosen design patterns, which is why I want to know where Apple is headed. Thanks, Cem Karan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/nathan_day%40mac.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Asynchronous timers (without a run loop)
NSRunLoop use to be based on the function select() (it was in GnuStep anyway), it waits for inputs but also has a single timeout value also, NSRunLoop works out how long the timeout value should be for the shortest NSTimer. If you want to wait on multiple timers without using run NSRunLoop then you will have to implement this kind of functionality yourself. You can then just use sleep() to make your thread wait. On 04/12/2008, at 9:32 PM, Påhl Melin wrote: I need to use timers in a low level library where I need to specify asynchronous callbacks to a timer function. I will not have any run loop so I cannot use NSTimer. Are there any low level timer API to use instead? I haven't found anything useful (yet) on google nor ADC. I assume there must exist some Mach or BSD level API:s that can be used? Any suggestions? / Påhl ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/nathan_day%40mac.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: How To Deal With Rounding Errors
The way floats work the round will always be to the same number of bits no matter what the order of magnitude (ignoring the extreme values 2^-1023 for doubles). Check that you haven't let any integers into you calculations. On 04/12/2008, at 7:08 PM, Bridger Maxwell wrote: Hey, Short version of my question: I believe I am having rounding errors because I am working with really, really small values. Would it help if I multiplied these values by a scalar (say, 1,000), did math with them, and then divided them by the scalar? I remember learning how IEEE floating point numbers are stored, but I can't remember enough about it to know if this would have any effect on precision. If not, what is a good way to get better precision? I am already using doubles instead of floats. Long explanation of my question: In my project, I have users clicking and dragging to adjust values. I would like to map values from the left-most of the view being zero, and the right-most of the view to be one. This is fairly simple. However, it feels a little unnatural if the value initially jumps to match where the mouse clicks before dragging. For example, if the initial value is 0.3, and they click in the middle of the view, the value jumps to 0.5. To take care of this I construct a polynomial which maps 0 to 0, the right-most of the view to 1, and the initial click location (middle) to the initial value (0.3). This works very well, and feels natural. However, when any of the values near the edges (the user clicks just off the left of the view), the values go crazy. I believe this is because of a rounding error. The same question still stands, would multiplying (and later dividing) everything by a scalar help me get greater precision? Thank You, Bridger Maxwell ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/nathan_day%40mac.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: self = [super init];
Usually self does not change, when the instance returned is different to the initially self then it is because the super init has decided that the initial self is not what it whats so it releases the initially self and returns a different object. This can happen for singltons or cluster object or perhaps in a suation where the object represents some resource and if there is already an object for that resource the new instance is released and a retained version of the original instance is returned in its place. On 04/12/2008, at 06:14 , EVS wrote: self = [super init]; Why does the above line of code not cause a memory leak or memory fault? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/nathan_day%40mac.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Correct location to store application data.
If the data in the dictionary is simple you could perhaps look at NSUserDefaults, you could use your dictionary file to initialise NSUserDefaults, alternatively you could create a separate file in preferences. Be warned that you can only stick property list types in NSUserDefaults. On 03/12/2008, at 21:20 , Jacob Rhoden wrote: I have an application which contains a dictionary file of sorts. Users can add/alter/and remove entries from a dictionary. I assume I will have the default dictionary stored as part of the application bundle somehow, and I should be saving a copy of some sort in a second hidden location, ie it doesnt make sense to store it in the Documents folder. Best regards, Jacob ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/nathan_day%40mac.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Converting from HTML
Try this http://www.thinkmac.co.uk/blog/2005/05/removing-entities-from-html-in-cocoa.html On 17/10/2008, at 13:17 , Drarok Ithaqua wrote: Hi all, i'm trying to find a way to convert an HTML-originated URL into one I can use in cocoa. Example input: link type=application/rss+xml rel=alternate href=/search/uniqueamp;stuffamp;here / I know the URL that this data is fetched from, so I can prefix that to achieve a full URL again, but I need to convert the amp; into plain ampersands, but there could be all kinds of HTML characters in there. Is there a category on NSString out there I could use for this? I read somewhere that I could use an NSAttributedString and initWithHTML, but that leaves me with an empty string. I'm guessing because it's inside a head tag? Not sure. I'm also open to using something more intelligent than my current method of searching the string for link to find the rss feed, if there's perhaps an easier way that would also convert the HTML characters for me. Maybe webkit has something for me? I look forward to your replies, and you have my thanks in advance. - Drarok ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/nathan_day%40mac.com This email sent to [EMAIL PROTECTED] Nathan Day [EMAIL PROTECTED] http://homepage.mac.com/nathan_day/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Objective 2.0 properties
And because they are immutable types, if they are mutable then retain is probable the appropriate behaviour. Copy will become retain for truly immutable objects and if you get a subclass that is mutable then you don't want that changing under you so copy gives you a new immutable version. Assign really is not the right thing to do in this situation, what is to stop lessonDuration from disappearing underneath you. If you are trying to stop circular retains then assign is what you use, for example a container object retains its children, the children should not retain the parent. On 17/10/2008, at 14:02 , Charles Steinman wrote: @property (nonatomic, retain) NSString* lessonTitle; @property (nonatomic, retain) NSDate *referDate; @property (assign) NSNumber * lessonDuration; Why is lessonDuration assign? That's begging for a crash. All three of these should be copy since the classes all conform to NSCopying. Nathan Day [EMAIL PROTECTED] http://homepage.mac.com/nathan_day/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]