Re: Mysterious Snow Crash
On Sep 23, 2009, at 10:52 PM, Gerriet M. Denkmann wrote: NSLog(@%s setting url to Downloads; was %@,__FUNCTION__, [self fileURL]); // was: file://localhost/dev/rdisk1s10 Wait. What? Where the HECK did that URL come from? /dev/rdisk1s10 is a raw device. It isn't a filesystem, not at all. Maybe your apps preferences -- recent documents or something -- got whacked. Try removing ~/Library/Preferences/ com.whatever.your.apps.preferences.plist b.bum ___ 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: Mysterious Snow Crash
On 24 Sep 2009, at 13:15, Bill Bumgarner wrote: On Sep 23, 2009, at 10:52 PM, Gerriet M. Denkmann wrote: NSLog(@%s setting url to Downloads; was %@,__FUNCTION__, [self fileURL]); // was: file://localhost/dev/rdisk1s10 Wait. What? Where the HECK did that URL come from? I entered it. /dev/rdisk1s10 is a raw device. It isn't a filesystem, not at all. You are absolutely right. The app is called HFS+ Checker and it does just this: it reads a raw partition (which contains an HFS+ filesystem) and supplies all sorts of useful information. And all cats from 10.3.4 to 10.5.8 had no problem of getting some icon for it. Snow Leopard also supplies appropriate icons for non-existing files (like: /sillyName). There really is no reason it should crash. Currently I have replaced /dev/rdisk1s10 with the (non-existing) / rdisk1s10 which avoids the crash. Any suggestions of better ways to avoid the crash would be most welcome. Kind regards, Gerriet. ___ 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: Mysterious Snow Crash
On Sep 24, 2009, at 12:05 AM, Gerriet M. Denkmann wrote: Where the HECK did that URL come from? I entered it. /dev/rdisk1s10 is a raw device. It isn't a filesystem, not at all. You are absolutely right. The app is called HFS+ Checker and it does just this: it reads a raw partition (which contains an HFS+ filesystem) and supplies all sorts of useful information. And all cats from 10.3.4 to 10.5.8 had no problem of getting some icon for it. Snow Leopard also supplies appropriate icons for non-existing files (like: /sillyName). There really is no reason it should crash. Currently I have replaced /dev/rdisk1s10 with the (non-existing) / rdisk1s10 which avoids the crash. Any suggestions of better ways to avoid the crash would be most welcome. Hah! OK. One possibility would be to swizzle or override-in-a-subclass the one NSDocument method in that backtrace and see what the key is and if that provides a clue. b.bum ___ 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: System preferences plugin in Snow Leopard
On Sep 23, 2009, at 7:43 PM, Bill Bumgarner wrote: On Sep 23, 2009, at 6:37 AM, Jakub Bednar wrote: Does please anybody know, what am I missing? Maybe some explicit specification that my plugin is 64-bit capable? Did you turn on GC? System Preferences running under 64 bit mode on Snow Leopard is garbage collected. Thanks a lot Bill, that was the problem. Jakub ___ 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
Hide keyboard in iPhone application
___ 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: Exit screen saver programmatically?
Post a mouse down event and the sceensaver engine will remove it for you. That is a good idea -- except I have no idea how to do that. Could you give me a hint how to achieve that? (class / method names?) (Sorry, for asking shuch a dumbquestion.) BTW: just a mouse move event would suffice, is that possible, too? (that way, I wouldn't have to worry about coordinates) It's possible; you'd have to discriminate based on the bundle identifier returned by the main NSBundle. what exactly are you trying to accomplish? I want to catch a few key events in my screen saver (like cursor keys, space, return), but if the user clicks any other key, I want the screen saver to exit, just like other screen savers that don't catch any keyboard events. So, right now, I tried this: if ( ! [self isPreview] ) [NSApp terminate: self]; but this has the disadvantage in the following scenario: 1. User opens System Preferences / Screen Saver, and activates my screensaver 2. User clicks 'Test', my screen saver runs in full screen mode 3. User clicks any key (other than the few above mentioned ones) Problem is: after that the System Preferences app is gone, too! Currently, the complete key handling code in my screen saver looks like this: - (void) keyDown: (NSEvent *) theEvent { if ( [theEvent modifierFlags] NSNumericPadKeyMask ) { [self interpretKeyEvents: [NSArray arrayWithObject:theEvent] ]; } else { // exit gracefully if ( ! [self isPreview] ) [NSApp terminate: self]; } } - (IBAction) moveLeft: (id) sender { ... } Eigentlich bin ich ganz anders, nur komme ich so selten dazu. ( Ödön von Horváth ) http://zach.in.tu-clausthal.de smime.p7s Description: S/MIME cryptographic signature ___ 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
How to use Authenticator example to a remote machine?
Hi, I've been looking at the Authenticator example code as a starting point for a (very simple) Cocoa client/server message-passing program. Now in the 'client' section there is a line // Lookup the server connection NSConnection *conn = [NSConnection connectionWithRegisteredName:CONNECTION_NAME host: nil]; However when I fill in @127.0.0.1 or @localhost for 'host', it cannot find the server (which is in fact running). Why is this? Are my ports closed? The example is for inter-application communication on one machine; I'd like to have that between two machines... Thanks for your time, Arthur C. ___ 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
login items hide box
hello, i have an app that when added to a user's login items with the hide box checked it still shows its main window when starting up on leopard. on snow leopard it properly stays hidden. on a personal note i had this same issue with mail on leopard and i have a feeling there might be some kind of bug regarding using that hide box on leopard as some apps seem to follow it and some not. my question is can it be my code that's causing the issue and i can make some adjustments to resolve this? but i don't make a specific call to my main window upon launch (at least not in code) it's only the checkbox in IB Visible At Launch. thank you for your input, rick __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.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
CoreData Mysterious Conditional Data Loss
Hi all, I'm experiencing the weirdest conditional data loss that I've seen in a long time. One of my managed objects has an NSImage property (stored as Transformable). Now here's the bug in summary: If the app bundle which initially created the persistence file (SQLite or XML) gets moved, the icon property doesn't get restored. If I move the bundle back to where it originally was, it gets restored. Here's an example of what steps I took to reproduce. Imagine we have the following configuration: ~/Desktop/Folder1/MyApp.app ~/Desktop/Folder2 I launch MyApp for the first time from Folder1 and it all works fine - icons are drawn in the sidebar, etc. Now I quit it and decide to move it Folder2 using Finder. I relaunch MyApp from Folder2 and now all the icons are gone. Quit again, move back to Folder1 and relaunch - icons are back. In fact, if MyApp is run from any location *except* Folder1, there are no icons. I'm really baffled by this and I have no idea how to go about the problem (considering all the magic happens in the CoreData layers which I have no way to debug). So I decided to log the object and property before I draw it. Case 1 (running from Folder1): ... icon = (...not nil..);--- log of the managed object ... Logging [obj icon] gives: icon=NSImage 0x15fc7a20 Size={16, 16} Reps=( NSBitmapImageRep 0x15fe5dc0 Size={16, 16} ColorSpace=NSCalibratedRGBColorSpace BPS=8 BPP=32 Pixels=16x16 Alpha=YES Planar=NO Format=2 CGImage=0x15fe6510 ) Case 2 (any other folder apart from Folder1): ... icon = (...not nil..); ... [obj icon] gives: icon=NSImage 0x15fc7ef0 Size={0, 0} Reps=( ) Any hints on what might be causing this are greatly appreciated. M ___ 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: login items hide box
On 24/09/2009, at 10:14 PM, Rick C. wrote: hello, i have an app that when added to a user's login items with the hide box checked it still shows its main window when starting up on leopard. on snow leopard it properly stays hidden. on a personal note i had this same issue with mail on leopard and i have a feeling there might be some kind of bug regarding using that hide box on leopard as some apps seem to follow it and some not. my question is can it be my code that's causing the issue and i can make some adjustments to resolve this? but i don't make a specific call to my main window upon launch (at least not in code) it's only the checkbox in IB Visible At Launch. thank you for your input, rick Hi Rick, have a look at http://developer.apple.com/mac/library/samplecode/LoginItemsAE/index.html and the Readme file that comes with it. In part, it says: Due to a bug rdar://problem/4052117 in Mac OS X 10.4 and later (up to including 10.4.2, which is the latest release at the time this was written), LoginItemsAE can't handle hidden login items properly. That is, the value of kLIAEHidden is always false and you can't add a hidden login item. This bug does not affect earlier systems. Are you using Apple Events to create your login item? If so, this bug could be causing your problem. I haven't yet examined the sample code (just looked at it quickly today), but I think you can get the hidden part to work using one of the other methods of creating a login item. Ron ___ 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: login items hide box
On 2009 Sep 24, at 05:47, Ron Fleckner wrote: In part, it says: Due to a bug rdar://problem/4052117 in Mac OS X 10.4 and later (up to including 10.4.2, which is the latest release at the time this was written), LoginItemsAE can't handle hidden login items properly. That is, the value of kLIAEHidden is always false and you can't add a hidden login item. This bug does not affect earlier systems. Are you using Apple Events to create your login item? If so, this bug could be causing your problem. Well, actually the same bug appears to affect not only LoginItemsAE, but also if you use the more modern method (requires 10.5), LSSharedFileList. I reported this bug to Apple on 2008-04-30. It appears that Apple has marked this bug as closed, but they never added any details. Problem ID 5901742 30-Apr-2008 02:48 PM Jerry Krinock: * SUMMARY The 'hidden' attribute for Login Items in the LSSharedList API has a disconnect with the reality. In more detail, when reading a Login Item, the 'hidden' attribute is read as 0, even if it is in fact '1', unless the 'hidden' attribute has been set by the LSSharedList API. In that case, it doesn't really set, but when you read it back with the API, it says that it is set, even though in fact it is not. * STEPS TO REPRODUCE Build and run the attached project. Follow the prompts shown in the the console. * EXPECTED RESULTS In all tests, the values read and written using the LSSharedList API and shown in the log should agree with what is shown in the System Preferences application. * ACTUAL RESULTS In Test #1, items which have the Hide box checked in System Preferences read from the API hidden=0. In Test #5, although the API set Safari to Hide and the API read it back as hidden=1, if you look in System Preferences you see that the Hide box is not checked. 'SSLoginItems.zip' was successfully uploaded ___ 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: CoreData Mysterious Conditional Data Loss
On Sep 24, 2009, at 8:38 AM, Milen Dzhumerov wrote: Hi all, I'm experiencing the weirdest conditional data loss that I've seen in a long time. One of my managed objects has an NSImage property (stored as Transformable). Now here's the bug in summary: If the app bundle which initially created the persistence file (SQLite or XML) gets moved, the icon property doesn't get restored. If I move the bundle back to where it originally was, it gets restored. We're probably going to need a bit more information than this. You say the icons are gone. I assume your entity instances are still there and all their other properties are present but only the NSImage attribute is coming back with an empty image? In that case, how exactly are you creating / storing / accessing this image? That seems to be the most relevant part to all this but one which you've completely left out. -- I.S. ___ 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
iPhone to Mac Synchronization
I am thinking about an iPhone app which (while it is running) collects data and stores it into some file. And there should be a Mac app, which, when the iPhone is connected to the computer, transfers the collected data to the Mac. Like iPhoto does with photos. Is this possible? Or are iTunes and iPhoto the only apps which can synchronize data between Mac and iPhone? Kind regards, Gerriet. ___ 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: login items hide box
thank you both. yes apple events and i just confirmed that adding it manually does work. so i do need to update my code. but i'll be on the lookout for potential LSSharedFileList issues. thank you! rick From: Jerry Krinock je...@ieee.org To: cocoa dev cocoa-dev@lists.apple.com Sent: Thursday, September 24, 2009 9:03:17 PM Subject: Re: login items hide box On 2009 Sep 24, at 05:47, Ron Fleckner wrote: In part, it says: Due to a bug rdar://problem/4052117 in Mac OS X 10.4 and later (up to including 10.4.2, which is the latest release at the time this was written), LoginItemsAE can't handle hidden login items properly. That is, the value of kLIAEHidden is always false and you can't add a hidden login item. This bug does not affect earlier systems. Are you using Apple Events to create your login item? If so, this bug could be causing your problem. Well, actually the same bug appears to affect not only LoginItemsAE, but also if you use the more modern method (requires 10.5), LSSharedFileList. I reported this bug to Apple on 2008-04-30. It appears that Apple has marked this bug as closed, but they never added any details. Problem ID 5901742 30-Apr-2008 02:48 PM Jerry Krinock: * SUMMARY The 'hidden' attribute for Login Items in the LSSharedList API has a disconnect with the reality. In more detail, when reading a Login Item, the 'hidden' attribute is read as 0, even if it is in fact '1', unless the 'hidden' attribute has been set by the LSSharedList API. In that case, it doesn't really set, but when you read it back with the API, it says that it is set, even though in fact it is not. * STEPS TO REPRODUCE Build and run the attached project. Follow the prompts shown in the the console. * EXPECTED RESULTS In all tests, the values read and written using the LSSharedList API and shown in the log should agree with what is shown in the System Preferences application. * ACTUAL RESULTS In Test #1, items which have the Hide box checked in System Preferences read from the API hidden=0. In Test #5, although the API set Safari to Hide and the API read it back as hidden=1, if you look in System Preferences you see that the Hide box is not checked. 'SSLoginItems.zip' was successfully uploaded ___ 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/jo_phls%40yahoo.com This email sent to jo_p...@yahoo.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: iPhone to Mac Synchronization
This is possible, but only over WiFi. I'm currently working on a feature to do bi-directional syncing between the Mac and iPhone versions of my app. I'm also using Bonjour for self-discovery (if you go this route, make sure to register your service at www.dns-sd.org) Feel free to file an enhancement request to allow a connection to be made over the dock connector. Sent from my iPhone On Sep 24, 2009, at 8:20 AM, Gerriet M. Denkmann gerr...@mdenkmann.de wrote: I am thinking about an iPhone app which (while it is running) collects data and stores it into some file. And there should be a Mac app, which, when the iPhone is connected to the computer, transfers the collected data to the Mac. Like iPhoto does with photos. Is this possible? Or are iTunes and iPhoto the only apps which can synchronize data between Mac and iPhone? Kind regards, Gerriet. ___ 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 ___ 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: CoreData Mysterious Conditional Data Loss
On 24 Sep 2009, at 14:20, I. Savant wrote: We're probably going to need a bit more information than this. You say the icons are gone. I assume your entity instances are still there and all their other properties are present but only the NSImage attribute is coming back with an empty image? Correct. In that case, how exactly are you creating / storing / accessing this image? That seems to be the most relevant part to all this but one which you've completely left out. You got it right first time, many thanks. The images were created using NSImage's initByReferencingFile: which I presume only references the image file. That's what I thought at first (that CoreData stored the path to the image within the bundle so when the bundle was moved, it couldn't find the file) but then I looked at the raw data stored in the XML file (which was base64 encoded) and saw the actual PNG data with no filesystem paths. It seems that I there's more magic going on behind the scenes. In any case, thanks for the help. M ___ 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: CoreData Mysterious Conditional Data Loss
On Sep 24, 2009, at 9:59 AM, Milen Dzhumerov wrote: You got it right first time, many thanks. The images were created using NSImage's initByReferencingFile: which I presume only references the image file. That's what I thought at first (that CoreData stored the path to the image within the bundle so when the bundle was moved, it couldn't find the file) but then I looked at the raw data stored in the XML file (which was base64 encoded) and saw the actual PNG data with no filesystem paths. It seems that I there's more magic going on behind the scenes. In any case, thanks for the help. I don't think this is Core Data magic so much as NSImageView's caching magic. I would expect an archived copy of this image to be stored only with its file reference, not with its data (while still attempting to reference the file when it's recreated). I would call this a bug if a careful review of the documentation doesn't reveal something you missed. Since I haven't used -initByReferencingFile: or tried to archive an image created with it, I haven't read the documentation regarding this approach, so I leave that to you. In any case, you need to decide if you want to store the image itself (ie, its data) or just a reference to it. If you only need a file reference, you can use an FSRef (lots of convenient Cocoa wrappers exist on the web) for anything before Snow Leopard or use Snow Leopard's latest FSRef-loving NSURL goodness. If you need the image data itself, try leaving your attribute as Transformable and creating the image with –initWithContentsOfFile: or – initWithContentsOfURL: and storing that. I think that'll work for you. Alternatively, you could store the image's data as an NSData attribute. -- I.S. ___ 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: Exit screen saver programmatically?
On Sep 24, 2009, at 2:14 AM, Gabriel Zachmann wrote: I want to catch a few key events in my screen saver (like cursor keys, space, return), but if the user clicks any other key, I want the screen saver to exit, just like other screen savers that don't catch any keyboard events. In that case, then you should pass the unwanted event to the superclass, which will handle the event in that case. Don't quit ScreenSaverEngine for any reason. If the user has a password on their screen saver, then they probably will not appreciate your screen saver compromising their security (unless ScreenSaverEngine catches this and cancels the terminate message, I'm not sure). Nick Zitzmann http://www.chronosnet.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: Can I recompose the Carbon-based app to a Cocoa-based app?
On Sep 23, 2009, at 6:31 PM, James wrote: Hi all, I have downloaded the RecordAudioToFile sample from the apple.dev sample code. I want to implement to record the users voice, so the sample is useful for me. But it is a Carbon-base application. The application I am working on is a Cocoa-Based App, so I want to modify the sample to a Cocoa-Based App.I have tried several times. But, I am not successful. From the looks of it the Carbon UI just provides enough framework for you to select a location to record to and start/stop recording, but all the work is actually done by the UI agnostic DCAudioFileRecorder class. You could just take that class with some small modifications and use it directly in your Cocoa app... -- David Duncan Apple DTS Animation and Printing ___ 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: iPhone to Mac Synchronization
On Sep 24, 2009, at 6:38 AM, Ricky Sharp wrote: This is possible, but only over WiFi. I'm currently working on a feature to do bi-directional syncing between the Mac and iPhone versions of my app. I'm also using Bonjour for self-discovery (if you go this route, make sure to register your service at www.dns-sd.org ) Another plug for my MYNetwork library, which is being used by several Mac-and-iPhone apps (including VoodooPad) for exactly this purpose. It takes care of the Bonjour discovery and socket gunk and lets your app send messages and replies back and forth, which is a lot easier than making up your own protocol. http://bitbucket.org/snej/mynetwork/ —Jens___ 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 to use Authenticator example to a remote machine?
On Sep 24, 2009, at 4:11 AM, Arthur C. wrote: The example is for inter-application communication on one machine; I'd like to have that between two machines... NSConnection is part of Distributed Objects. It's possible to run DO between two machines across a TCP connection, but it takes a bit more work and you have to initialize the connection differently. I believe Apple has sample code showing how to do it. I'm not a fan of using DO for this. IMHO, there are a number of subtle issues with it that aren't immediately apparent but will bite you if you try to develop a real app using it; the nastiest being the potential security problems. I wrote a blog post about this a few months ago: http://jens.mooseyard.com/2009/07/the-subtle-dangers-of-distributed-objects/ See my previous cocoa-dev post from a few minutes ago, for a blatant ad for my own open-source framework that implements easy distributed messaging in a way that is somewhat lower level but I think a lot more robust. :) —Jens___ 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
NSConnection ignores setRequestTimeout: on first request
I'm using NSConnections (based on NSSocketPorts) for distributed object communications. We just Bonjour to publish NSConnection server availability on the network. However, if you just disconnect the ethernet from the server machine the Bonjour publish 'lingers' for a bit on the client machine ( this is 'ok' for now). This leads to a case where our client may try to initiate a new NSConnection to the server side. We use -[NSConnection setRequestTimeout:] to set a 10s timeout, but in the first message case it seems to ignore this parameter and instead gets hung up by (what I think is) the TCP SYN SENT timeout (60+seconds). This seems like a problem in NSConnection to me. Is there a workaround? I've tried using setsockopt for the TCP TCP_CONN_ABORT_THRESHOLD and TCP_CONN_NOTIFY_THRESHOLD parameters, but this seems to have no effect. Mike ___ 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: Exit screen saver programmatically?
In that case, then you should pass the unwanted event to the superclass, which will handle the event in that case. Ah, you mean like this, I suppose? [super keyDown: theEvent]; That seems to work like a charm. Thanks a million! (For the record, I thought that user code is not supposed to call keyDown and the likes, that's why I tried this: CGEventRef ourEvent = CGEventCreate(NULL); CGPoint point = CGEventGetLocation(ourEvent);// get current mouse location point.x += 1.0; ourEvent = CGEventCreateMouseEvent( NULL, kCGEventMouseMoved, point, kCGMouseButtonCenter ); CGEventSetType(ourEvent, kCGEventMouseMoved); CGEventPost( kCGSessionEventTap, ourEvent );// post mouse moved event CFRelease( ourEvent ); But that sometimes worked, sometimes not.) Best regards, Gabriel. smime.p7s Description: S/MIME cryptographic signature ___ 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: Drawing text chunks (e.g. paras) in a text view with alternating background colours
Hi, Keith. Couple of thoughts: In my NSTextView subclass’s -drawViewBackgroundInRect: method, I get the range of characters in the current -visibleRect: using code similar to this: -visibleRect is a much larger rect than you need, I should think. What's wrong with using the rect passed to -drawViewBackgroundInRect:? To draw the background colours, ensuring that they fit perfectly behind my alternating ranges of text, I use NSLayoutManager’s - rectArrayForCharacterRange:... on the component ranges that are visible, then join the resultant rects (and expand to allow for the text container inset if necessary) and fill them with colour. Aren't you drawing rects that do not need to be redrawn? Or maybe you are using needsToDrawRect:? So my question is, can anyone think of a better, more efficient way of solving this problem? Perhaps I am overcomplicating things. In case I haven’t explained clearly enough, what I am trying to do is very similar to, say, drawing alternating paragraphs in a text view with a different background colour (and again, I don’t mean as in NSBackgroundColorAttributeName, but a rectangle of background colour going from the left of the view to the right). Only in my case, each component may contain multiple paragraphs, of course. These things come to mind. They might or might not work: 1. I don't know whether the NSBackgroundColorAttributeName attribute is (or could be) the same color as the one you are drawing for the view background. If it is, you could let the text system handle the bg color for the text areas, and just worry about the rects that are not getting painted by the text system. 2. Rather than calculate the range of characters from a drawing rect, use the information provided in NSLayoutManager - drawBackgroundForGlyphRange:atPoint:. 3. Use QuartzDebug with Flash Identical Screen Updates to look for areas that are getting redrawn needlessly. 4. Cache some of this information instead of recalculating it. For example, if you have one text view in a scroll view, all you really need to know is the origin.y of the first glyph of each text storage. Because the view background color is always a rectangle as wide as the text view, if you have an array of all the origin.y values of the text storages, you can take any rect and calculate the rects that need to be drawn in the respective colors. Hope this helps! Ross___ 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
Core Data: relationship 'too large' when saving
Hi all, I am encountering an error that I have not seen before. While saving in a NSManagedObjectContext I am encountering an error that reports a to-many relationship as 'too large'. This relationship has ~10,000 members but each member is relatively simple consisting of a few short strings and numbers. I have no problems operating on this relation; the error only occurs while saving. Many GB of disk space are available. Error occurs independent of store type, SQLite, binary, or xml. Smaller (different) relations of ~1000 members are correctly saved. 1) Is this really a size problem? 2) can someone point me to relevant documentation? Many thanks. Frederick Bartram *- * Stop spam before it gets to your mailbox! Support blocklists. * I use http://www.spamcop.net/. * my PGP key id: 0x63fa758 keyserver: http://keyserver1.pgp.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
Reduce CPU usage in screensaver?
I wrote a screen saver that basically zooms images at a frame rate of 10 frames/sec. When running, it uses about 60% CPU ! This could be a bit annoying sometimes, if there are other compute intensive processes running, such as video conversions. Is there anything I could do to reduce the CPU usage of my screensaver? (Other than reducing the frame rate?) The method that seems to be the most compute intensive one is the following: [imageRep_ drawInRect: zoomed_frame_ fromRect: NSZeroRect operation: NSCompositeCopy fraction: 1.0]; It gets invoked every frame (in -animateOneFrame, which computes a slightly larger zoomed_frame_ every frame). I analyzed my screen saver with Shark, and it says that this method call costs about 85%. If it helps, here is the complete source code: http://zach.in.tu-clausthal.de/tmp/ArtSaver.m Any ideas or hints will be highly appreciated. Best regards, Gabriel. smime.p7s Description: S/MIME cryptographic signature ___ 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: Reduce CPU usage in screensaver?
On Thu, Sep 24, 2009 at 11:43 AM, Gabriel Zachmann z...@tu-clausthal.dewrote: I wrote a screen saver that basically zooms images at a frame rate of 10 frames/sec. When running, it uses about 60% CPU ! This could be a bit annoying sometimes, if there are other compute intensive processes running, such as video conversions. Is there anything I could do to reduce the CPU usage of my screensaver? Use the video adapter to do the work instead of the CPU. Off the top of my head consider using... Core Animation, CGLayers, or dropping down to OpenGL. -Shawn ___ 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
Predicate matching for entire to-many relationship
Hey list - I'm trying to determine what the best approach for writing a Core Data fetch predicate to match objects with a specific set for a to-many relationship is, so I'd appreciate some guidance. A portion of my Core Data model looks like so -- http://is.gd/3Dyp4 I am attempting to fetch all Type objects with a coreExponents relationship that equals a specific comparison set of Exponents. This comparison set is essentially just an NSDictionary with integer keys corresponding to the coreType.index key path of the Exponent entity, and integer values corresponding to the magnitude key path of the Exponent entity. This NSDictionary could be turned into an NSSet of Exponent objects (that would not be tied to a context and would not be saved to a store, of course) if necessary for the predicate comparison. For example, if I have a type with a coreExponents relationship that looks like so: coreExponents = {( { coreType.index = 0, magnitude = 2 }, { coreType.index = 1, magnitude = -1 }, { coreType.index = 4, magnitude = 1 } )} And I want to fetch that Type object based on a dictionary structured as such (of course the pairs are unordered in reality): { 0 = 2, 1 = -1, 4 = 1 } What would be the best approach to take for designing my NSFetchRequest's predicate? Thanks! - Bryan ___ 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
Background application is visible when I try to display a transparent backgrounded image into my app
Hi, I am trying to display an Image whose background is transparent as a buttoncell. Then the application background of my app or the desktop is visible and when I clicked on it, it focuses to the visible app. Why it is so happening. Code goes like this. Subclassed the NSButtonCell and tried to associate my Buttoncell from IB. mImage = [NSImage imageNamed:@TransparentImage]; - (void)drawWithFrame:(NSRect)bounds inView:(NSView *)controlView { NSRect imageRect = bounds;//[self imageRectForBounds:bounds]; if (mImage != nil) { [mImage setFlipped:[controlView isFlipped]]; [mImage drawInRect:imageRect fromRect:NSZeroRect operation: NSCompositeSourceIn fraction:1.0]; } } What am I missing here. Kindly help me in this regards. Best regards Mustafa Shaik ___ 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: Exit screen saver programmatically?
If you send the unwanted events to ScreenSaverView parent of your view then it should terminate gracefully. [super theEvent]; -- john On Sep 24, 2009, at 1:14 AM, Gabriel Zachmann wrote: Post a mouse down event and the sceensaver engine will remove it for you. That is a good idea -- except I have no idea how to do that. Could you give me a hint how to achieve that? (class / method names?) (Sorry, for asking shuch a dumbquestion.) BTW: just a mouse move event would suffice, is that possible, too? (that way, I wouldn't have to worry about coordinates) It's possible; you'd have to discriminate based on the bundle identifier returned by the main NSBundle. what exactly are you trying to accomplish? I want to catch a few key events in my screen saver (like cursor keys, space, return), but if the user clicks any other key, I want the screen saver to exit, just like other screen savers that don't catch any keyboard events. So, right now, I tried this: if ( ! [self isPreview] ) [NSApp terminate: self]; but this has the disadvantage in the following scenario: 1. User opens System Preferences / Screen Saver, and activates my screensaver 2. User clicks 'Test', my screen saver runs in full screen mode 3. User clicks any key (other than the few above mentioned ones) Problem is: after that the System Preferences app is gone, too! Currently, the complete key handling code in my screen saver looks like this: - (void) keyDown: (NSEvent *) theEvent { if ( [theEvent modifierFlags] NSNumericPadKeyMask ) { [self interpretKeyEvents: [NSArray arrayWithObject:theEvent] ]; } else { // exit gracefully if ( ! [self isPreview] ) [NSApp terminate: self]; } } - (IBAction) moveLeft: (id) sender { ... } Eigentlich bin ich ganz anders, nur komme ich so selten dazu. ( Ödön von Horváth ) http://zach.in.tu-clausthal.de ___ 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
Core Data: relationship 'too large' when saving
My bad. I apologize for wasting bandwidth. Problem had nothing to do with relation set size. *- * Stop spam before it gets to your mailbox! Support blocklists. * I use http://www.spamcop.net/. * my PGP key id: 0x63fa758 keyserver: http://keyserver1.pgp.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
UIPickerView: How do I LOOP data, as is done in UIDatePicker {looping Jan thru Dec} vs a mere list?
Greetings: I have a customized UIPickerView containing a list of names. Let’s say I have an array of ten (10) names = {“Alfred”... “Zena”}. The normal way of showing this list is a singular, static list of an array from beginning to end. I would have to return to the beginning vs automatically cycle AROUND (loop) to the beginning; as is down with the UIDatePicker. Question: How can I change this behavior to allow LOOPING to the beginning of the scroll list? That is, from ‘Alfred’ -- 'Zena' -- 'Alfred' -- etc. Ric. ___ 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: Background application is visible when I try to display a transparent backgrounded image into my app
On Wed, Sep 23, 2009 at 11:21 PM, Symadept symad...@gmail.com wrote: Hi, I am trying to display an Image whose background is transparent as a buttoncell. Then the application background of my app or the desktop is visible and when I clicked on it, it focuses to the visible app. Why it is so happening. Code goes like this. Subclassed the NSButtonCell and tried to associate my Buttoncell from IB. mImage = [NSImage imageNamed:@TransparentImage]; - (void)drawWithFrame:(NSRect)bounds inView:(NSView *)controlView { NSRect imageRect = bounds;//[self imageRectForBounds:bounds]; if (mImage != nil) { [mImage setFlipped:[controlView isFlipped]]; This is not your immediate problem, but -setFlipped: is deprecated, and it's deprecated because people try to use it like this, which is incorrect. Please see the AppKit release notes, or, say, http://www.noodlesoft.com/blog/2009/02/02/understanding-flipped-coordinate-systems/ . [mImage drawInRect:imageRect fromRect:NSZeroRect operation: * NSCompositeSourceIn* fraction:1.0]; NSCompositeSourceIn is an unusual compositing operation that you only want in very specific circumstances. You almost certainly want NSCompositeSourceOver. This is probably the problem. } } What am I missing here. Kindly help me in this regards. Best regards Mustafa Shaik ___ 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/kenferry%40gmail.com This email sent to kenfe...@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/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Possible to set control's action in IB, set target programmatically?
I want to to set some controls' targets programmatically, but don't need to change their actions. Interface Builder shows a binding for Target, which is perfect, but I can't find a way to set a control's action in IB *without* hooking up a target. What's the right way to do this? I could create an object with stub methods, or even put them on an existing object (like the file's owner, the one to which I'm binding the controls' targets), but those are ugly solutions. ___ 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: Core Data: relationship 'too large' when saving
In my embarrassment at my haste to post to the list I have compounded the error. :( For archive posterity, the 'bug' was a case of mistaken identity. As I have since learned, the 'too large' error notification was triggered by a value-violation in a bounded, 'Number'-attribute that happened to have the same name as a relation in in different entity on which I had been working. The error did not indicate the entity, only the attribute name, in which the violation had been detected so I jumped to the conclusion that the error was in the entity on which I had been working when, in fact, the application was behaving 'correctly'. No bug, No foul. Note to self: Make sure error messages contain sufficient identifying information! Frederick Bartram *- * Stop spam before it gets to your mailbox! Support blocklists. * I use http://www.spamcop.net/. * my PGP key id: 0x63fa758 keyserver: http://keyserver1.pgp.com */ On Sep 24, 2009, at 5:02 PM, Fritz Anderson wrote: On 24 Sep 2009, at 3:24 PM, Frederick Bartram wrote: My bad. I apologize for wasting bandwidth. Problem had nothing to do with relation set size. It won't have been a waste of bandwidth if you post the meaning of the error message, and the solution, for the benefit of the archives. — F -- Fritz Anderson -- Xcode 3 Unleashed: Now in its second printing -- http://x3u.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Possible to set control's action in IB, set target programmatically?
I just found and looked at the BoundButton sample code, and see that I missed the big, obvious Selector Name field in the inspector's target binding section. I feel special. All's working now. On Thu, Sep 24, 2009 at 5:11 PM, Sidney San Martín s...@sidneysm.com wrote: I want to to set some controls' targets programmatically, but don't need to change their actions. Interface Builder shows a binding for Target, which is perfect, but I can't find a way to set a control's action in IB *without* hooking up a target. What's the right way to do this? I could create an object with stub methods, or even put them on an existing object (like the file's owner, the one to which I'm binding the controls' targets), but those are ugly solutions. ___ 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: Possible to set control's action in IB, set target programmatically?
All right, so my original question still stands after all (and, I'm sorry, I should've done more poking around before posting here). target/action binding behaves differently from a connection: I can't implement validateMenuItem: (it's never called) and I don't see a way to send the control itself as an argument (to emulate the usual selector:(id)sender pattern). What I want is to be able to preset actions (selectors), like the binding, but get behavior which includes validateMenuItem:. It's not the end of the world if it isn't possible, I'll just hook everything up at runtime with a big pile of [control setAction:@selector(...)]; [control setTarget:target]; in the controller's awakeFromNib. On Thu, Sep 24, 2009 at 5:53 PM, Sidney San Martín s...@sidneysm.com wrote: I just found and looked at the BoundButton sample code, and see that I missed the big, obvious Selector Name field in the inspector's target binding section. I feel special. All's working now. On Thu, Sep 24, 2009 at 5:11 PM, Sidney San Martín s...@sidneysm.com wrote: I want to to set some controls' targets programmatically, but don't need to change their actions. Interface Builder shows a binding for Target, which is perfect, but I can't find a way to set a control's action in IB *without* hooking up a target. What's the right way to do this? I could create an object with stub methods, or even put them on an existing object (like the file's owner, the one to which I'm binding the controls' targets), but those are ugly solutions. ___ 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: Drawing text chunks (e.g. paras) in a text view with alternating background colours
Hi Ross, Many thanks for the reply. The reason I have to use a larger rect than just what gets passed in is that I had so many drawing problems and artefacts if I didn't expand it to the whole visible rect, for some reason. 4. Cache some of this information instead of recalculating it. For example, if you have one text view in a scroll view, all you really need to know is the origin.y of the first glyph of each text storage. Because the view background color is always a rectangle as wide as the text view, if you have an array of all the origin.y values of the text storages, you can take any rect and calculate the rects that need to be drawn in the respective colors. The trouble with this is that it still has to calculate the Y position each time a letter is typed, because there's no way of knowing if the letter typed has moved all of the text beneath down (or up in the case of a deletion) or not. 2. Rather than calculate the range of characters from a drawing rect, use the information provided in NSLayoutManager -drawBackgroundForGlyphRange:atPoint:. You know, I think this might be a good solution. I think I may need to get rid of the alternating colours altogether and draw some sort of separator between the different text storages using this NSLayoutManager method. Either way, I'm hopeful that this will be a better solution than trying to get the character range in the text view's drawing methods. Many thanks again! All the best, Keith --- On Thu, 9/24/09, Ross Carter rosscarter...@me.com wrote: From: Ross Carter rosscarter...@me.com Subject: Re: Drawing text chunks (e.g. paras) in a text view with alternating background colours To: Keith Blount keithblo...@yahoo.com, Cocoa-dev cocoa-dev@lists.apple.com Date: Thursday, September 24, 2009, 5:20 PM Hi, Keith. Couple of thoughts: In my NSTextView subclass’s -drawViewBackgroundInRect: method, I get the range of characters in the current -visibleRect: using code similar to this: -visibleRect is a much larger rect than you need, I should think. What's wrong with using the rect passed to -drawViewBackgroundInRect:? To draw the background colours, ensuring that they fit perfectly behind my alternating ranges of text, I use NSLayoutManager’s -rectArrayForCharacterRange:... on the component ranges that are visible, then join the resultant rects (and expand to allow for the text container inset if necessary) and fill them with colour. Aren't you drawing rects that do not need to be redrawn? Or maybe you are using needsToDrawRect:? So my question is, can anyone think of a better, more efficient way of solving this problem? Perhaps I am overcomplicating things. In case I haven’t explained clearly enough, what I am trying to do is very similar to, say, drawing alternating paragraphs in a text view with a different background colour (and again, I don’t mean as in NSBackgroundColorAttributeName, but a rectangle of background colour going from the left of the view to the right). Only in my case, each component may contain multiple paragraphs, of course. These things come to mind. They might or might not work: 1. I don't know whether the NSBackgroundColorAttributeName attribute is (or could be) the same color as the one you are drawing for the view background. If it is, you could let the text system handle the bg color for the text areas, and just worry about the rects that are not getting painted by the text system. 2. Rather than calculate the range of characters from a drawing rect, use the information provided in NSLayoutManager -drawBackgroundForGlyphRange:atPoint:. 3. Use QuartzDebug with Flash Identical Screen Updates to look for areas that are getting redrawn needlessly. 4. Cache some of this information instead of recalculating it. For example, if you have one text view in a scroll view, all you really need to know is the origin.y of the first glyph of each text storage. Because the view background color is always a rectangle as wide as the text view, if you have an array of all the origin.y values of the text storages, you can take any rect and calculate the rects that need to be drawn in the respective colors. Hope this helps! Ross ___ 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: UIPickerView: How do I LOOP data, as is done in UIDatePicker {looping Jan thru Dec} vs a mere list?
Question: How can I change this behavior to allow LOOPING to the beginning of the scroll list? Ric, I just did a quick search for continuous UIPicker and found a page discussing this... http://www.iphonedevsdk.com/forum/iphone-sdk-development/4479-uipickerview-circular.html Most common solution seems to be to provide a very large (repeated) selection of values and start the user off in the middle somewhere. There are some other suggestions on that page though. Regards, Matt ___ 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
Subview drawn with reverted order
Hi, In IB I have put some subview (NSImageView) within a NSView. Now, in IB, I can clearly see that the subview A is over the subview B. Instead when I build and run the application, the subview B is over the subview A. Too bad! It seems that the Front-Back drawing order of the subviews has been reverted. How to fix this problem? Thanks -- LL ___ 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: CoreData Mysterious Conditional Data Loss
On Thu, Sep 24, 2009 at 6:59 AM, Milen Dzhumerov md...@doc.ic.ac.uk wrote: On 24 Sep 2009, at 14:20, I. Savant wrote: We're probably going to need a bit more information than this. You say the icons are gone. I assume your entity instances are still there and all their other properties are present but only the NSImage attribute is coming back with an empty image? Correct. In that case, how exactly are you creating / storing / accessing this image? That seems to be the most relevant part to all this but one which you've completely left out. You got it right first time, many thanks. The images were created using NSImage's initByReferencingFile: which I presume only references the image file. That's what I thought at first (that CoreData stored the path to the image within the bundle so when the bundle was moved, it couldn't find the file) but then I looked at the raw data stored in the XML file (which was base64 encoded) and saw the actual PNG data with no filesystem paths. It seems that I there's more magic going on behind the scenes. In any case, thanks for the help. I'm not what sure you saw here (perhaps another image?) but you were right the first time. If your image is created with initByReferencing:, then the system may treat the in-memory NSImage as only a cache for the image on disk. It is undefined when the file is accessed, and the image could choose to throw away data and later go back to disk if it wanted to. And in practice, yeah, archiving only saves the URL. initWithContentsOfURL: makes no such assumptions. The data is brought in right away and there is no persistent connection to the URL. M ___ 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/kenferry%40gmail.com This email sent to kenfe...@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/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Global Hotkeys - Trouble with sizeof EventHotKeyRef
Hi all. I have a menu-bar background app that relies on global hotkeys. I have been using Carbon¹s RegisterEventHotKey to register callbacks for my hotkeys in Leopard. Is this still the preferred/only method for global hotkeys in Snow Leopard? Presuming it is, here is my problem, which relates to making my code 64-bit clean: I am using the Carbon/Cocoa hybrid approach described in this somewhat dated blog post: http://unsanity.org/archives/45.php I call ³RegisterEventHotKey² from CarbonEvents.h to register the hotkeys, and then listen for them in my app delegate¹s ³sendEvent:² method, checking for event subtype 6¹ (hotkey pressed). The RegisterEventHotKey function is passed the address of an ³EventHotKeyRef² variable, and returns a unique reference to the hotkey. In the NSEvent received by ³sendEvent:², the data1¹ attribute contains the same EventHotKeyRef, allowing one to correlate the hotkey event with a specific hot key. After registering the hotkeys, I convert the EventHotKeyRef to an NSValue using ³valueFromPointer² and then use those values as keys to an NSMutableDictionary which I then reference in sendEvent to figure out which action goes with the hotkey that was pressed. Later on, I can unregister all of the hotkeys by iterating through the dictionary keys, reconverting the NSValues to pointers (and casting as EventHotKeyRef), and passing to UnregisterEventHotKey¹. All this worked fine in 32-bit mode. However, in 64-bit mode, the EventHotKeyRef passed by CarbonEvents as data1¹ of the NSEvent object does not match up with the values I am getting back from the RegisterEventHotKey function. When I register the hotkeys and convert the EventHotKeyRef to an NSValue, they typically look something like this: ³20ed1200 0100². However, when I take the data1¹ field from NSEvent on the same hotkey and convert that to an NSValue, it will look like this: ³20ed1200 ². Thus, I can¹t look up the right hotkey in my dictionary. It appears that whatever mechanism converts the Carbon Event to an NSEvent is munging the EventHotKeyRef it passes as data1¹ of the NSEvent by truncating the size. I clearly don¹t have a good grasp of precisely what the EventHotKeyRef¹ type is (it is typedef¹d to an opaque type). I think that I messing things up when I convert the EventHotKeyRef to an NSValue using valueFromPointer¹, but I am not really clear what the better/correct method would be. So, I need a way to (1) record the EventHotKeyRef returned by RegisterEventHotKey and correlate it to the desired action; (2) unpack the EventHotKeyRef returned by data1¹ of the NSEvent and look up the desired action; and (3) iterate through the stored EventHotKeyRefs for the purpose of calling UnregisterEventHotKey¹. One approach would be to find the right combination of typecasts/conversions to store the EventHotKeyRef in a dictionary and have consistent results between the RegisterEventHotKey and data1 of the NSEvent. Another approach would be to store the ³good² EventHotKeyRefs in a primitive array for use in the unregister calls, and then create my lookup dictionary with a shortened version of the ref that chops off the padding bytes that are getting munged so that the results are the same when looking up the data1¹ field. I have not tried going the pure-Carbon route (e.g., as described here http://dbachrach.com/blog/2005/11/program-global-hotkeys-in-cocoa-easily/ ), as I am hoping to find a workaround that lets me stay with the (in my opinion) simpler Cocoa ³sendEvent² method. (I am also not sure why my NSDictionary lookup works in 32-bit mode if the NSValue created from the NSEvent data1¹ is a different (but numerically equivalent) object from the one originally stored in the dictionary key (I gather NSDictionary¹s objectForKey¹ will return the entry for any NSValue that returns true from isEqualToValue¹ of the comparator?) Any and all advice on this would be appreciated. Relevant code is below. Thanks in advance Tobias Zimmerman /* Method to register hotkeys /* - (void)assignHotKey: (UInt32)keyEquiv modifiers: (UInt32)mods hotKeyNumber: (NSInteger)menuIndex //the menu item index of the associated action { EventHotKeyID hotKeyID; EventHotKeyRef theRef; hotKeyID.signature = 'SWMN'; hotKeyID.id = keyEquiv; RegisterEventHotKey( keyEquiv, mods, hotKeyID, GetApplicationEventTarget(), 0, theRef ); NSValue *HKValue = [NSValue valueWithPointer:(EventHotKeyRef)theRef]; NSLog(@Storing HKValue: %@, HKValue); // in 64-bit, e.g., ³20ed1200 0100² [hotKeys setObject: [NSNumber numberWithInteger: menuIndex] forKey: HKValue]; //hotkeys is an NSMutableDictionary } /*method that processes hotkey events */ -
Re: Subview drawn with reverted order
On Sep 24, 2009, at 4:28 PM, gMail.com wrote: It seems that the Front-Back drawing order of the subviews has been reverted. How to fix this problem? Overlapping sibling views aren't really supported in AppKit. If you want to do this kind of thing, you're better off using CoreAnimation layers. —Jens___ 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: Subview drawn with reverted order
On 25/09/2009, at 9:28 AM, gMail.com wrote: It seems that the Front-Back drawing order of the subviews has been reverted. How to fix this problem? Make sure view A is an actual subview of view B, not just sitting at the same level. Views at the same level can't overlap. --Graham ___ 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: Subview drawn with reverted order
On Thu, Sep 24, 2009 at 5:36 PM, Jens Alfke j...@mooseyard.com wrote: On Sep 24, 2009, at 4:28 PM, gMail.com wrote: It seems that the Front-Back drawing order of the subviews has been reverted. How to fix this problem? Overlapping sibling views aren't really supported in AppKit. If you want to do this kind of thing, you're better off using CoreAnimation layers. Overlapping subviews are supported in 10.5 and later. You might be running afoul of the bug Jon Hess discusses at http://www.cocoabuilder.com/archive/message/cocoa/2008/11/13/222599. ___ 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: Core Data: relationship 'too large' when saving
On 24 Sep 2009, at 3:24 PM, Frederick Bartram wrote: My bad. I apologize for wasting bandwidth. Problem had nothing to do with relation set size. It won't have been a waste of bandwidth if you post the meaning of the error message, and the solution, for the benefit of the archives. — F -- Fritz Anderson -- Xcode 3 Unleashed: Now in its second printing -- http://x3u.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Remove NSTableView Default Selection
Hello all. I am working on an application that contains a NSTableView. The table view has a single column which display several options. Based on the row that the user selects, something is displayed. When the application is first launched, the first row in the table is selected by default (but not processed as a selection because it was not actually clicked). I want no rows to be selected when it is first launched. So, the functionality is correct now, but I need the first (or any other) row not to be preselected. I have a button to clear the selection. In its code, I send a deselectAll message to the table which correctly clears the selection. I assumed that I could send the same deselectAll message in either an awakeFromNib function or applicationDidFinishLaunching. However, neither of these clears the selection. I would greatly appreciate any advice. Thank you. John ___ 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: Subview drawn with reverted order
On Sep 24, 2009, at 8:36 PM, Jens Alfke wrote: Overlapping sibling views aren't really supported in AppKit. No longer true as of Leopard. -- I.S. ___ 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
Correct way to tell if a path is to a .bundle?
I'm scanning a directory for plugins for my app. Given a path, what's the right way to tell if it's a path to a bundle? TIA -- Rick ___ 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
NSTableView Drag Drop as a string
I have an NSTableView and I have Drag Drop working between table views for my application where I encode the object to an NSData and write it to the NSPasteboard. But now I want to create a string representation of the object, add it to the pasteboard as well, and then when the object is dragged to something like an email, the string representation of the object is written in. The content does seem to be written to the pasteboard, but the drop doesn't seem to happen in an appropriate target (email message, editor, etc.) The same basic code works in -copy: but it doesn't seem to work in - tableView:writeRowsWithIndexes:toPasteboard: The line of code is: [pboard setString:str forType:NSStringPboardType]; Is there something different with the NSPasteboard passed into - tableView:writeRowsWithIndexes:toPasteboard: versus the pasteboard you get from [NSPasteboard generalPasteboard]? Any suggestions on what I am doing wrong? Thanks, Todd ___ 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
NSTableView able to display different background images
Hi, I am trying to make my NSTableView display various images for various states of the cells. Say, Default, Highlighted and MouseOver. Can anybody help me how to achieve this. I know MouseOver will be pretty difficult. Immediately I want to hit the two things first, Default Highlighted and Dimmed. Regards Mustafa ___ 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: Correct way to tell if a path is to a .bundle?
On Sep 24, 2009, at 6:41 PM, Rick Mann wrote: I'm scanning a directory for plugins for my app. Given a path, what's the right way to tell if it's a path to a bundle? -[NSWorkspace isFilePackageAtPath:]. —Jens___ 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: Remove NSTableView Default Selection
On Sep 24, 2009, at 5:07 PM, John McIntosh wrote: I assumed that I could send the same deselectAll message in either an awakeFromNib function or applicationDidFinishLaunching. However, neither of these clears the selection. Make sure you've checked the table's Empty checkbox (allow empty selection) in the nib. Also, if there's a controller bound to the table, uncheck its Avoid empty selection checkbox. —Jens___ 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
How to create a control just as RGB Sphere and Alpha bar
Hi, Can any help me how to create a view which contains Spectrum Bar (Just as RGB Sphere in NSColorPanel) and an Alpha bar? Thanks in advance Regards Mustafa ___ 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: Correct way to tell if a path is to a .bundle?
On Sep 24, 2009, at 20:09:02, Jens Alfke wrote: On Sep 24, 2009, at 6:41 PM, Rick Mann wrote: I'm scanning a directory for plugins for my app. Given a path, what's the right way to tell if it's a path to a bundle? -[NSWorkspace isFilePackageAtPath:]. Thanks Jens. If I create a custom extension for my plugins (not even sure I can do that), will this still work? ___ 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 to create a control just as RGB Sphere and Alpha bar
On 25/09/2009, at 1:14 PM, Symadept wrote: Can any help me how to create a view which contains Spectrum Bar (Just as RGB Sphere in NSColorPanel) and an Alpha bar? NSImageView? --Graham ___ 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: Core Data: relationship 'too large' when saving
I am encountering an error that I have not seen before. While saving in a NSManagedObjectContext I am encountering an error that reports a to-many relationship as 'too large'. This relationship has ~10,000 members but each member is relatively simple consisting of a few short strings and numbers. I have no problems operating on this relation; the error only occurs while saving. Many GB of disk space are available. Error occurs independent of store type, SQLite, binary, or xml. Smaller (different) relations of ~1000 members are correctly saved. 1) Is this really a size problem? No. I suppose it's possible there's a 16 bit overflow bug somewhere, but there shouldn't be (obviously), and I can't imagine any issue with 10,000. It is possible for you to set the maximum size of a to-many relationship in your model. Did you check the property validation rules for this relationship ? 2) can someone point me to relevant documentation? You sure it's not NSValidationNumberTooLargeError for one of the numbers being outside the range you specified acceptable in the model ? - Ben ___ 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