Re: Application is not available in the launched applications list.
On Sun, Jan 24, 2010 at 11:36 PM, Ramesh P ramesh.pauldu...@gmail.com wrote: My cocoa application is running successfully. But when I use this code NSLog(@%@,[[NSWorkspace sharedworkspace]launchedapplication]); in another application, it is not printing my application name. What is the problem with my running application? Now I opened the Force Quit in my MAC. There also my application name is not available. How can solve this? Help me. First of all, case matters. +sharedworkspace is *not* the same as +sharedWorkspace. Either you didn't copy/paste your code directly, or you are ignoring compiler warnings. If your app doesn't appear in the Force Quit dialog, one of the following is happening: 1. You're not writing a regular Cocoa app. 2. You have specified LSUIElement or LSBackgroundOnly, or used TransformProcessType to achieve the same effect. --Kyle Sluder ___ 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: Frame/layout rect
Hi Kyle, On 25/01/2010, at 6:57 PM, Kyle Sluder wrote: On Sun, Jan 24, 2010 at 9:24 PM, Jo Meder jome...@ihug.co.nz wrote: I'm pretty sure I know the answer to this one already, but is anyone aware of a way to get/set the layout rect for a view? Or get a frame rect from a layout rect, that sort of thing? This is the same layout rect we see in IB, which I understand is only available in IB but which I'm hoping is somehow available at runtime as well. There's no guarantee that the methods that provide the layout information will be available outside of the IB plugin. Someone could theoretically only provide them in a category which lives in the plugin bundle. Yes, that's pretty much what I was thinking. The reason I'm asking about this is that the Cocoa way of using the frame rect to get and set view bounds makes it very hard to lay out a UI outside of IB, particularly for things like push buttons where the padding below the actual button is much more than padding at the top. It's difficult because you're supposed to lay it out in IB. Is there a specific reason you wish not to? Yes. A large part of our UI is laid out algorithmically. All the rest is created programatically one way or another. A number of parts of our UI are actually laid out in IB on the Mac. That way I get to use the guides etc. to assist with the layout. It just so happens I use Carbon nibs for that. After laying out in IB the nib is loaded into an app which loads the nib and then walks the control hierarchy to generate an XML GUI description file, rather like a nib really. Our application can then parse the XML file and the UI is recreated from that. For Windows I usually edit the Mac XML files by hand, or sometimes use IB to do a Windows appropriate layout for something more complex. I haven't yet had an inescapable need to do a similar XML description file generator on Windows. I can certainly change over to using Cocoa nibs and write a new XML GUI description file generator. Unfortunately it doesn't solve the layout problems of UI which is actually created entirely in code. Cocoa seems to specifically preclude a set of well established and perfectly valid UI construction techniques. It's very shortsighted. We use native controls to give the best platform specific experience we can. All this was perfectly feasible in Carbon. IB is a great app and I've been using it for years in various ways, but it isn't appropriate for all situations and to make it the only way to lay out UIs without a lot of hassle seems a bit of an API design failure. Regards, Jo Meder ___ 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: UIButton's Sender Control Events
Please send code that would work. All broken examples are clearly not code you can use and therefore very bad examples for what you are trying to achieve. Am 25.01.2010 um 00:22 schrieb Chunk 1978: i wanted to simplify the code (one button per method) by using the buttons UIControlEvents of touchDown and touchUpInside/touchUpOutside Please explain that. touchDown + touchUpInside = lightOn? touchDown + touchUpOutside = lightOff? or what? and produce: - (IBAction)toggleLight { //toggle light } What is wrong with Graham's example? - (IBAction) toggleSomething:(id) sender { [self setState:![self state]]; } That's exactly how you implement a toggle action. i meant it's clear that it's not possible with UIControlEvents... or at least not simply so. What is the second it's here if Graham's example is wrong? atze ___ 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: Re: Application is not available in the launched applications list.
Thanks Mr.Kyle for your quick reply, You are correct. I have added the following line in my info.plist keyNSUIElement/key string1/string I do not want to show my application on the dock. Thanks, Ramesh.P On , Kyle Sluder kyle.slu...@gmail.com wrote: On Sun, Jan 24, 2010 at 11:36 PM, Ramesh P ramesh.pauldu...@gmail.com wrote: My cocoa application is running successfully. But when I use this code NSLog(@%@,[[NSWorkspace sharedworkspace]launchedapplication]); in another application, it is not printing my application name. What is the problem with my running application? Now I opened the Force Quit in my MAC. There also my application name is not available. How can solve this? Help me. First of all, case matters. +sharedworkspace is *not* the same as +sharedWorkspace. Either you didn't copy/paste your code directly, or you are ignoring compiler warnings. If your app doesn't appear in the Force Quit dialog, one of the following is happening: 1. You're not writing a regular Cocoa app. 2. You have specified LSUIElement or LSBackgroundOnly, or used TransformProcessType to achieve the same effect. --Kyle Sluder ___ 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: Allow only root/admin users to execute the cocoa app
Le 25 janv. 2010 à 07:47, vincent habchi a écrit : Le 24 janv. 2010 à 22:31, Todd Heberlein a écrit : I want to allow my cocoa app to be only launched by root/admin users. How can i achieve this? As I think has already been mentioned, the UNIX approach is to set the application's owner as root and then make it only executable by the owner. However, Apple largely discourages programmers from developing Cocoa apps that will be run with root privileges. I know that, but, up to this point, I have failed to find any reasonable reason ;) that could justify this point of view, especially since it is always possible to drop root privileges at whatever point, just like postfix or named do. I don't see why being root is permissible for CLI apps and not for GUI ones. FWIW, from AppKit release notes: --- setuid/setgid apps disallowed As a security measure, SnowLeopard takes steps to prevent applications that use AppKit from running setuid or setgid. If AppKit detects that it is running issetugid(), the following will happen: Under 64 bit, it will log a message and then exit(EXIT_FAILURE). Under 32 bit, it will give the user a chance to authenticate as an administrator. If the attempt succeeds, the app will run as normal; if the user fails to authenticate, or cancels, it will exit(EXIT_FAILURE). If the attempt fails because the authentication dialog could not be shown, then it will perform a linked on or after check. Apps linked before SnowLeopard will be allowed to run; applications linked on or after SnowLeopard will be exited. This only affects applications that have the setuid or setgid Unix permission bit set, or apps that inherit this bit from a fork() of a setugid app. This does not affect applications run via sudo, su, or normally as root --- So unless you think you know better than Apple what you're doing, never run an GUI application with privileges. Gwynne's anwser give you some reasons why this is bad. -- Jean-Daniel ___ 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
MVC design Q - remembering Core Data selections
Hi folks, I have a Core Data app that needs to remember state of selected items between launches. The app's UI is a bit like iTunes (containers / playlists down the side and contents show in a big tableview), except that there are 3 layers of containment, so rather than Playlists and Tracks, you could think of it as Companies, Departments Employees. What I'd like is for each Company to remember the last selected Department in it, and for each Department to remember the last selected Employee in it. I'd like to remember this between launches. To clarify, I'm not just wanting to remember which Company / Dept / Employee the user was last looking at before they quit, but for each Company Department, what the last selected object within it was. So in other words say the user clicks on Apple, and then on the Upper Echelons Department, and then Steve Jobs. After this, the user then clicks on a different company, say... Slate Computing LLC... and on some department and employee within it. The user then quits. When the user relaunches, I'd like it to go straight to showing the Slate Computing LLC + selected department + selected employee. However, if the user clicks on Apple, I'd like it to remember that they were last looking at its Upper Echelons department, and Steve Jobs in particular. The hack that I can think of to do this would be for each Company entity to have a selectedDept, and for each Department entity to have a selectedEmployee relationship, but this kind of breaks MVC... other than it being easy to implement, the model shouldn't care what the user was last looking at. Furthermore if I ever implement multi- client access, then it can only remember (in the central data repository) what 1 user was last looking at, so if Fred was last using the app and I launched it, it would start me up with Fred's last selection if this is stored inside the model. What is the preferred MVC design for implementing this kind of functionality? I could be barking up the wrong tree here but I'm thinking I should override the Company Department array controllers, so that each time their selection changes, I get the managed object IDs for the new selection, and write it out to a preference list (or a separate per- user persistent store), and reading from this when the user selects something else, so we know which child item to select by default for them. Would this break when the managed objects go from being temporary (i.e. new) to permanent (i.e. saved) though? Or should I only write the file / 2nd store when the app is quitting (after everything that's staying has been committed)? Hope I've stated my problem well enough - if anything needs clarification let me know. Thanks in advance for any help you can give, Ken The app's UI is like iTunes, with playlists and songs inside playlists (except that my app has nothing to do with music etc.). Playlists and songs are all Core Data objects, and I have the equivalent of a Playlists controller and a Songs controller (whose content is bound to the selected Playlist). In my app, the playlists down the left of iTunes have an extra textfield saying what their currently selected song is (whether that playlist/song is the one playing or not). I'd like my app to remember the selected song in each playlist (not just the playlist the user was last in when quitting). What is the cleanest MVC way of accomplishing this? I can see it would be easy to have an attribute within a Playlist that has selectedSong, and the Songs controller sets that whenever its selection changes. But clearly this isn't a model issue, it's merely a GUI nicety for the user. So maybe I'm barking up the wrong tree here, but I'm considering storing the managed object IDs of all Playlists, and their selected Song, in a prefs dictionary. But I'd need to do that after the store has been committed, in order to be able to grab 'permanent' object IDs. And then upon launch, how do I set each In order to remember this state, I'd like to use managedObjectIDs (for an SQLite store). So to use an iTunes analogy, each playlist might have a lastTrackBeingPlayed managed attribute, into which I'd like to stick the managedObjectID of whatever track was being played when the user quit the app. However I'd like to ensure that I'm using permanent objectIDs, not temporary ones, so would the best route be, in my appDelegate's - applicationWillTerminate: method, to do: - (void)applicationWillTerminate:(NSNotification *)aNotification { NSManagedObjectContext *moc = [self managedObjectContext]; NSError *error = nil; [moc save:error]; //save to convert all objects to permanent [self doSomeCacheStuff]; //perform caching of managedObjectIDs here [moc save:error]; //now resave, to make sure all object IDs are permanent } I have a Core Data app that's a bit like
Re: MVC design Q - remembering Core Data selections
Doh... sorry about the length of that message, it included the various draft versions, so please ignore it (unless you like seeing the pain someone goes through when trying to state their problem concisely!) Below is the properly edited version, and I'd be grateful for any advice you can give. (Walks away with tail between his legs) Ken On 25 Jan 2010, at 9:38, Tabb, Ken wrote: Hi folks, I have a Core Data app that needs to remember state of selected items between launches. The app's UI is a bit like iTunes (containers / playlists down the side and contents show in a big tableview), except that there are 3 layers of containment, so rather than Playlists and Tracks, you could think of it as Companies, Departments Employees. What I'd like is for each Company to remember the last selected Department in it, and for each Department to remember the last selected Employee in it. I'd like to remember this between launches. To clarify, I'm not just wanting to remember which Company / Dept / Employee the user was last looking at before they quit, but for each Company Department, what the last selected object within it was. So in other words say the user clicks on Apple, and then on the Upper Echelons Department, and then Steve Jobs. After this, the user then clicks on a different company, say... Slate Computing LLC... and on some department and employee within it. The user then quits. When the user relaunches, I'd like it to go straight to showing the Slate Computing LLC + selected department + selected employee. However, if the user clicks on Apple, I'd like it to remember that they were last looking at its Upper Echelons department, and Steve Jobs in particular. The hack that I can think of to do this would be for each Company entity to have a selectedDept, and for each Department entity to have a selectedEmployee relationship, but this kind of breaks MVC... other than it being easy to implement, the model shouldn't care what the user was last looking at. Furthermore if I ever implement multi- client access, then it can only remember (in the central data repository) what 1 user was last looking at, so if Fred was last using the app and I launched it, it would start me up with Fred's last selection if this is stored inside the model. What is the preferred MVC design for implementing this kind of functionality? I could be barking up the wrong tree here but I'm thinking I should override the Company Department array controllers, so that each time their selection changes, I get the managed object IDs for the new selection, and write it out to a preference list (or a separate per- user persistent store), and reading from this when the user selects something else, so we know which child item to select by default for them. Would this break when the managed objects go from being temporary (i.e. new) to permanent (i.e. saved) though? Or should I only write the file / 2nd store when the app is quitting (after everything that's staying has been committed)? Hope I've stated my problem well enough - if anything needs clarification let me know. Thanks in advance for any help you can give, Ken - - - - - - - - - - Dr. Ken Tabb Mac UNIX Developer - Health Human Sciences Machine Vision Neural Network researcher - School of Computer Science University of Hertfordshire, UK ___ 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: MVC design Q - remembering Core Data selections
On 25/01/2010, at 8:42 PM, Ken Tabb wrote: On 25 Jan 2010, at 9:38, Tabb, Ken wrote: Hi folks, I have a Core Data app that needs to remember state of selected items between launches. The app's UI is a bit like iTunes (containers / playlists down the side and contents show in a big tableview), except that there are 3 layers of containment, so rather than Playlists and Tracks, you could think of it as Companies, Departments Employees. What I'd like is for each Company to remember the last selected Department in it, and for each Department to remember the last selected Employee in it. I'd like to remember this between launches. To clarify, I'm not just wanting to remember which Company / Dept / Employee the user was last looking at before they quit, but for each Company Department, what the last selected object within it was. So in other words say the user clicks on Apple, and then on the Upper Echelons Department, and then Steve Jobs. After this, the user then clicks on a different company, say... Slate Computing LLC... and on some department and employee within it. The user then quits. When the user relaunches, I'd like it to go straight to showing the Slate Computing LLC + selected department + selected employee. However, if the user clicks on Apple, I'd like it to remember that they were last looking at its Upper Echelons department, and Steve Jobs in particular. The hack that I can think of to do this would be for each Company entity to have a selectedDept, and for each Department entity to have a selectedEmployee relationship, but this kind of breaks MVC... other than it being easy to implement, the model shouldn't care what the user was last looking at. Furthermore if I ever implement multi- client access, then it can only remember (in the central data repository) what 1 user was last looking at, so if Fred was last using the app and I launched it, it would start me up with Fred's last selection if this is stored inside the model. What is the preferred MVC design for implementing this kind of functionality? I could be barking up the wrong tree here but I'm thinking I should override the Company Department array controllers, so that each time their selection changes, I get the managed object IDs for the new selection, and write it out to a preference list (or a separate per- user persistent store), and reading from this when the user selects something else, so we know which child item to select by default for them. Would this break when the managed objects go from being temporary (i.e. new) to permanent (i.e. saved) though? Or should I only write the file / 2nd store when the app is quitting (after everything that's staying has been committed)? Hope I've stated my problem well enough - if anything needs clarification let me know. Thanks in advance for any help you can give, Ken Hi Ken, I think this would be a job for user defaults. So at app shut down, I'd just intervene at that point and write the current selection details to user defaults. No need to futz with your model. Of course, you'd only then have the selection for one of the companies, but that is sort of what Mail does. It remembers the last selected email and the last selected mailbox, but no other. 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: NSAlert query
On 25 Jan 2010, at 04:27, Poonam Virupaxi Shigihalli wrote: hi all, When alert messages are displayed using runModal, it blocks the thread until the user clicks on the button. Is there anyway to avoid blocking of the thread when alert is displayed? Try displaying your alerts as sheets. This should allow other run loop sources to be serviced. Regards Jonathan Mitchell Developer http://www.mugginsoft.com Regards, Poonam. ___ 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/jonathan%40mugginsoft.com This email sent to jonat...@mugginsoft.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: Allow only root/admin users to execute the cocoa app
Le 25 janv. 2010 à 10:43, Jean-Daniel Dupas a écrit : So unless you think you know better than Apple what you're doing, never run an GUI application with privileges. Gwynne's anwser give you some reasons why this is bad. Je ne dis rien de tel ;) Look at the text: the security measure does not concern executing AppKit as root, it concerns applications having a setuid or setgid bit set. This is plain right. It does not, however, concern Application launched by the superuser, either as root or su/sudo. I never meant I know things better than Apple: I understand the reasons, I don't say they are pointless - in fact I agree with most of them. I just wonder why, since I know at least two or three Unix/BSD/X11 applications that run under superuser privileges, and this has never raised a strong protest amidst security addicts. But I know MacOS is not Unix :) Pas de quoi s'énerver ! ;) Ciao, Vincent ___ 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: Weird exception
On 24.01.2010, at 14:08, vincent habchi wrote: Under XCode, you select 'run with performance tool' - 'zombies'. This will launch your app with the 'zombie instrument' attached, that will signal you if you app tries to message a released entity. I'm sorry, but I don't see zombies item within Start with Performance Tool menu. I'm using XCode 3.1.4. Also it's not clear how to launch the app. Is it enough to set the target SDK to 10.4 or should I transfer my project into 10.4 system completely, then build it and run? Thanks for your help. ___ 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: Allow only root/admin users to execute the cocoa app
On 25.01.2010, at 11:15, vincent habchi wrote: I never meant I know things better than Apple: I understand the reasons, I don't say they are pointless - in fact I agree with most of them. I just wonder why, since I know at least two or three Unix/BSD/X11 applications that run under superuser privileges, and this has never raised a strong protest amidst security addicts. But I know MacOS is not Unix :) At WWDC I was told that Apple don't test AppKit against root (or at least, not much). Since the idea is to limit the time applications run as root for security reasons, there is no high priority find and fix such issues in AppKit. This means Apple can focus more of its developers on hardening the command-line part against root exploits. There have been issues like this in the past. For example, for a while, loginwindow used to load QuickTime components, which would then get loaded as root. A harmless application installing a QuickTime component could then cause the OS to crash at login time, as root. So, whatever your or my or Gwynne's personal opinion, Mac OS X has been designed under the assumption that no GUI app will be run as root (only a few tasks like loginwindow). If you do so anyway, you're tearing a hole in Apple's security policy and endangering your users' Macs. Cheers, -- Uli Kusterer The witnesses of TeachText are everywhere... ___ 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 resolve bulk warning Creating selector for nonexistent method ...?
Hi everyone. I'm building static library, whose outward API is plain C, and whose implementation is Cocoa-based. It was building and working alright, until (yesterday) something changed, and any attempt to clean/build/rebuild it produces huge amount of compilation warnings, on EVERY Obj-C message. First, there's a bulk of warnings like this: /Volumes/Data/.../FileManager_GUI_Mac.mm:224: warning: creating selector for nonexistent method 'openPanel' /Volumes/Data/.../FileManager_GUI_Mac.mm:196: warning: creating selector for nonexistent method 'release' /Volumes/Data/.../FileManager_GUI_Mac.mm:193: warning: creating selector for nonexistent method 'code' /Volumes/Data/.../FileManager_GUI_Mac.mm:190: warning: creating selector for nonexistent method 'savePanel' /Volumes/Data/.../FileManager_GUI_Mac.mm:190: warning: creating selector for nonexistent method 'alloc' /Volumes/Data/.../FileManager_GUI_Mac.mm:171: warning: creating selector for nonexistent method 'stringWithFormat:' /Volumes/Data/.../FileManager_GUI_Mac.mm:160: warning: creating selector for nonexistent method 'getCString:maxLength:encoding:' Then another bulk of warnings, complaining about DOUBLE definitions for Cocoa methods /Volumes/Data/.../FileManager_GUI_Mac.mm:244:0 /Volumes/Data/.../FileManager_GUI_Mac.mm:244: warning: multiple selectors named '+isVertical' found /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSSplitView.h:30:0 /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSSplitView.h:30: warning: found '-(BOOL)isVertical' /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSSliderCell.h:59:0 /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSSliderCell.h:59: warning: also found '-(NSInteger)isVertical' Notes: The project is building Intel-only Universal (32/64bit, architectures i386 and x86_64 I only #import Cocoa/Cocoa.h once, in a single source file (an interface header file). I added (linked) the Cocoa Framework once in the project, referencing the Current SDK. The project DOES compile, and even works. If i turn on the Build Active Architecture Only build option for the project (ONLY_ACTIVE_ARCH = YES) then I only get the warnings when I compile 32bit. 64bit compilation is free of warnings. These warnings worry me, as I might be using a wrong framework, and the code may break on a user machine. Any idea will be greatly appreciated. Motti Shneor -- Senior Software Engineer Waves Audio ltd. ___ 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: Allow only root/admin users to execute the cocoa app
Le 25 janv. 2010 à 11:56, Uli Kusterer a écrit : At WWDC I was told that Apple don't test AppKit against root (or at least, not much). Since the idea is to limit the time applications run as root for security reasons, there is no high priority find and fix such issues in AppKit. This means Apple can focus more of its developers on hardening the command-line part against root exploits. There have been issues like this in the past. For example, for a while, loginwindow used to load QuickTime components, which would then get loaded as root. A harmless application installing a QuickTime component could then cause the OS to crash at login time, as root. So, whatever your or my or Gwynne's personal opinion, Mac OS X has been designed under the assumption that no GUI app will be run as root (only a few tasks like loginwindow). If you do so anyway, you're tearing a hole in Apple's security policy and endangering your users' Macs. Okay, I didn't meant to be rude, arrogant or whatever. I just tried to understand. But I'm perfectly aware that when you develop for a given platform, you implicitly agree to abide by its philosophy. I've not been confronted to this problem up to now, so I came up with the solution I adopted before in a pure Unix/X11 environment. Hopefully, if ever I have to face it, I'll remember what you told me. Tchüß! Vincent___ 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
Notification to wake the screen?
Hi, I am using NSWorkspaceScreensDidSleepNotification and NSWorkspaceScreensDidWakeNotification notifications to detect screen sleep and awake in idle sleep mode. But on some event (eg. on timer fire) I want to the wake screen . Is there any notification I can post for screen to wake? Thanks. ___ 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: Allow only root/admin users to execute the cocoa app
Le 25 janv. 2010 à 11:15, vincent habchi a écrit : Le 25 janv. 2010 à 10:43, Jean-Daniel Dupas a écrit : So unless you think you know better than Apple what you're doing, never run an GUI application with privileges. Gwynne's anwser give you some reasons why this is bad. Je ne dis rien de tel ;) Et je n'ai pas dis que tu l'avais fait ;-) C'est juste un conditionnel. Look at the text: the security measure does not concern executing AppKit as root, it concerns applications having a setuid or setgid bit set. This is plain right. It does not, however, concern Application launched by the superuser, either as root or su/sudo. I never meant I know things better than Apple: I understand the reasons, I don't say they are pointless - in fact I agree with most of them. I just wonder why, since I know at least two or three Unix/BSD/X11 applications that run under superuser privileges, and this has never raised a strong protest amidst security addicts. But I know MacOS is not Unix :) Pas de quoi s'énerver ! ;) Sorry if my message sound rude, it was not my intend. If you want a concrete example of why you should avoid this, search Apple Remote Desktop Root Privilege Escalation in Google. -- Jean-Daniel ___ 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
What is the equivalent of SetSystemUIMode() in Leopard and above?
Hi All Are there any cocoa equivalent API's for SetSystemUIMode() available in Leopard 10.5 and above? I want to hide dock and menu item at run time in my application. Thanks Arun ___ 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: What is the equivalent of SetSystemUIMode() in Leopard and above?
Le 25 janv. 2010 à 12:47, Arun a écrit : Hi All Are there any cocoa equivalent API's for SetSystemUIMode() available in Leopard 10.5 and above? I want to hide dock and menu item at run time in my application. NSApplication presentation options, but available in Snow Leopard only. http://developer.apple.com/Mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSApplication_Class/Reference/Reference.html#//apple_ref/doc/uid/2012-SW34 -- Jean-Daniel ___ 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: Weird exception
On 25 Jan 2010, at 10:21, Alexander Bokovikov wrote: On 24.01.2010, at 14:08, vincent habchi wrote: Under XCode, you select 'run with performance tool' - 'zombies'. This will launch your app with the 'zombie instrument' attached, that will signal you if you app tries to message a released entity. I'm sorry, but I don't see zombies item within Start with Performance Tool menu. I'm using XCode 3.1.4. Also it's not clear how to launch the app. Is it enough to set the target SDK to 10.4 or should I transfer my project into 10.4 system completely, then build it and run? I think you're on a wild goose chase here - the most likely explanation to me is that something somewhere is deliberately calling -[NSString boolValue] (and it may not be 'your' code - I wouldn't put it out of the realms of possibility that a call to it sneaked into Sparkle), which didn't exist until 10.5. If this is the problem, and you want to target Tiger, the best solution would be to find the use of boolValue in the code base and replace it with something that will work on 10.4. The category method you made on NSString is not the right solution - it almost certainly does less than the 10.5+ framework implementation, and it'll replace that method when system frameworks call it, which could cause all sorts of problems (this hit me in the past - the SYCK YAML parsing framework implemented -[NSString boolValue], and it caused problems with, of all things, the iPhone keyboard in iPhone OS 3.0). Jamie.= ___ 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: MVC design Q - remembering Core Data selections
I agree with Ron that this definitely looks like a user default because it's more a part of the View than the Model, and therefore should go into user defaults instead of the Core Data model. You often find attributes like this which could go either way. For a less certain example, consider the isItemExpanded (in the outline) state of an object in some kind of hierarchical data model. This could be judged either as View or Model, and the correct answer follows from considering other factors in any given app. For document-based apps, one of the important considerations is that anything you put in the model will put the document into an unsaved state and add an Undo action whenever it is changed. ___ 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 save/restore the screen of the window in user defaults?
Hi, I'd like my app's main window to appear on the same screen where it was last closed, on a multi-monitor Mac. How do I do this? I checked the docs and found that I could use [[[window screen] deviceDescription] objectForKey:@NSScreenNumber] as a unique identifier that is permanent across system reboots. Good. But how do I restore the window on that screen? The [window screen] property is read-only. There is [window initWithContentRect:styleMask:backing:defer:screen:], but the doc is rather vague how to use it. So how do I change the screen where the window is appearing? Or maybe I should simply move the window origin? But in that case, how the coordinate systems of the different screens are welded together? It's especially hard for me because I don't have a multi-monitor Mac at my disposal to experiment with. Thanks! ___ 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: MVC design Q - remembering Core Data selections
Hi Ron, thanks for the reply. I agree just storing the last known thing that the user was looking at is doable, wouldn't require a non-MVC model- based hack, and would make for a much smaller user defaults file - as there's only 3 selections being stored (1x Company, 1x Department and 1x Employee), not A x B x C selections. However, I need to store each Company's and each Department's last known selection as the custom control / cell displays meta-info about those selections, whether or not it's what the user is currently viewing. So to try to stick to an iTunes analogy (it's actually a neural network application, hence trying to use an easier analogy), I have a playlist tableview over on the left, which, as well as telling you the playlist's name (in the tableview's cell), also tells you what was last being played in that playlist and several other things about the contents of its last selected item. So I'm thinking storing in the defaults a 1:1 pair of each Company its last selected Department, and then another 1:1 pair of each Department and its last selected Employee, would be better (for me). I can still picture a million faults firing during the app quitting stage though :-! Thanks for the ideas, Ken p.s. Mail is one up on iTunes, which remembers which playlist you were in before quitting, but not which track was being played. On 25 Jan 2010, at 10:05, Ron Fleckner wrote: On 25 Jan 2010, at 9:38, Tabb, Ken wrote: Hi folks, I have a Core Data app that needs to remember state of selected items between launches. The app's UI is a bit like iTunes (containers / playlists down the side and contents show in a big tableview), except that there are 3 layers of containment, so rather than Playlists and Tracks, you could think of it as Companies, Departments Employees. What I'd like is for each Company to remember the last selected Department in it, and for each Department to remember the last selected Employee in it. I'd like to remember this between launches. To clarify, I'm not just wanting to remember which Company / Dept / Employee the user was last looking at before they quit, but for each Company Department, what the last selected object within it was. So in other words say the user clicks on Apple, and then on the Upper Echelons Department, and then Steve Jobs. After this, the user then clicks on a different company, say... Slate Computing LLC... and on some department and employee within it. The user then quits. When the user relaunches, I'd like it to go straight to showing the Slate Computing LLC + selected department + selected employee. However, if the user clicks on Apple, I'd like it to remember that they were last looking at its Upper Echelons department, and Steve Jobs in particular. The hack that I can think of to do this would be for each Company entity to have a selectedDept, and for each Department entity to have a selectedEmployee relationship, but this kind of breaks MVC... other than it being easy to implement, the model shouldn't care what the user was last looking at. Furthermore if I ever implement multi- client access, then it can only remember (in the central data repository) what 1 user was last looking at, so if Fred was last using the app and I launched it, it would start me up with Fred's last selection if this is stored inside the model. What is the preferred MVC design for implementing this kind of functionality? I could be barking up the wrong tree here but I'm thinking I should override the Company Department array controllers, so that each time their selection changes, I get the managed object IDs for the new selection, and write it out to a preference list (or a separate per- user persistent store), and reading from this when the user selects something else, so we know which child item to select by default for them. Would this break when the managed objects go from being temporary (i.e. new) to permanent (i.e. saved) though? Or should I only write the file / 2nd store when the app is quitting (after everything that's staying has been committed)? Hope I've stated my problem well enough - if anything needs clarification let me know. Thanks in advance for any help you can give, Ken Hi Ken, I think this would be a job for user defaults. So at app shut down, I'd just intervene at that point and write the current selection details to user defaults. No need to futz with your model. Of course, you'd only then have the selection for one of the companies, but that is sort of what Mail does. It remembers the last selected email and the last selected mailbox, but no other. Ron - - - - - - - - - - Dr. Ken Tabb Mac UNIX Developer - Health Human Sciences Machine Vision Neural Network researcher - School of Computer Science University of Hertfordshire, UK ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments
Posting notifications
Notification Programming Topics for Cocoa states A notification center delivers notifications to observers synchronously. In other words, when posting a notification, control does not return to the poster until all observers have received *and processed* the notification. [my emphasis] I was wondering exactly what and processed included in the statement above. If I post a named notification to the appDelegate and that delegate, upon receipt, immediately calls func1() which calls func2() etc. where does this processed chain stop? What if this chain terminates with exactly the same notification that started it? Does this all build up a long, unterminated chain or does it end earlier somehow? Tests with NSLog() would seem to indicate that the latter occurs but it is not entirely clear from the documentation. Thanks -- and apologies for such a newbie query. -- Mike McLaughlin ___ 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 save/restore the screen of the window in user defaults?
On 25 Jan 2010, at 13:59, Oleg Krupnov wrote: Hi, I'd like my app's main window to appear on the same screen where it was last closed, on a multi-monitor Mac. How do I do this? I checked the docs and found that I could use [[[window screen] deviceDescription] objectForKey:@NSScreenNumber] as a unique identifier that is permanent across system reboots. Good. But how do I restore the window on that screen? The [window screen] property is read-only. There is [window initWithContentRect:styleMask:backing:defer:screen:], but the doc is rather vague how to use it. So how do I change the screen where the window is appearing? Or maybe I should simply move the window origin? But in that case, how the coordinate systems of the different screens are welded together? There is a single coordinate system that encompasses all screens attached to the computer. Do not worry about the screen the window is on, just the coordinates. Easiest way to do this is tell the owning window controller to autosave the window frame. It's especially hard for me because I don't have a multi-monitor Mac at my disposal to experiment with. Thanks! ___ 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/cocoadev%40mikeabdullah.net This email sent to cocoa...@mikeabdullah.net ___ 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 save/restore the screen of the window in user defaults?
If you have a MacBook, you can just plug a second montior to the mini DVI port. You might need an adapter cable - Apple will sell you one. Paul Sanders. On 25 Jan 2010, at 13:59, Oleg Krupnov wrote: It's especially hard for me because I don't have a multi-monitor Mac at my disposal to experiment with. ___ 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: Posting notifications
On Jan 25, 2010, at 7:21 AM, McLaughlin, Michael P. wrote: A notification center delivers notifications to observers synchronously. In other words, when posting a notification, control does not return to the poster until all observers have received *and processed* the notification. [my emphasis] I was wondering exactly what and processed included in the statement above. Until the observer's notification method returns. If I post a named notification to the appDelegate and that delegate, upon receipt, immediately calls func1() which calls func2() etc. where does this processed chain stop? It doesn't until the original appDelegate method returns. What if this chain terminates with exactly the same notification that started it? Not sure what you mean. If the same notification is sent before the original method returns, the whole chain executes again, potentially recursively. Does this all build up a long, unterminated chain or does it end earlier somehow? It will not end until you run out of stack space and your app crashes. I expect the docs are just there to explain the API, and not necessarily to let you know how much rope you are given to hang yourself with ;-) I think it is best to equate a notification with a plain method call. Except that I have found Cocoa doesn't like nesting notifications much. HTH, Keary Suska Esoteritech, Inc. Demystifying technology for your home or business ___ 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: NSURL crash
On Jan 24, 2010, at 8:19 PM, Scott Anguish wrote: nsurl still lives happily in Foundation. No, it was moved to CoreFoundation a while back, along with a few other Foundation objects: % otool -ov /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation [...] Module 0x18e604 version 7 size 16 name symtab 0x00191294 sel_ref_cnt 0 refs 0x (not in an __OBJC section) cls_def_cnt 1 cat_def_cnt 0 Class Definitions defs[0] 0x0018f92c isa 0x0019064c super_class 0x001423e4 NSObject name 0x001512f6 NSURL [...] 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: Cocoa-dev Digest, Vol 7, Issue 107
On 25.01.2010, at 19:14, James Montgomerie wrote: I think you're on a wild goose chase here - the most likely explanation to me is that something somewhere is deliberately calling -[NSString boolValue] (and it may not be 'your' code - I wouldn't put it out of the realms of possibility that a call to it sneaked into Sparkle), which didn't exist until 10.5. I believe you're right. I've commented some lines related to Sparkle, and now the same call occurs in a more clear location, definitely related to Sparkle. If this is the problem, and you want to target Tiger, the best solution would be to find the use of boolValue in the code base and replace it with something that will work on 10.4. I don't know how to do it, as I have no sources for Sparkle. I could make a post at the Sparkle bug tracker, indeed. The category method you made on NSString is not the right solution - it almost certainly does less than the 10.5+ framework implementation, and it'll replace that method when system frameworks call it, which could cause all sorts of problems (this hit me in the past - the SYCK YAML parsing framework implemented -[NSString boolValue], and it caused problems with, of all things, the iPhone keyboard in iPhone OS 3.0). As far as I've checked now, all calls go with the same true value. Therefore there is a chance that my simple patch will fix the issue. Of course, I understand that it would be better to replace this code with the full implementation of this method. Best, Alex ___ 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: Posting notifications
On Jan 25, 2010, at 6:21 AM, McLaughlin, Michael P. wrote: A notification center delivers notifications to observers synchronously. In other words, when posting a notification, control does not return to the poster until all observers have received *and processed* the notification. [my emphasis] Don't read too much into this — it's just regular function calls. When you post the notification, NSNotification iterates over all the observers and calls their notification methods one at a time, then returns back to you. This usually works fine. But if you're posting a notification and don't want to be blocked right then, or if you want to coalesce multiple posts of the same notification so observers are called only once, have a look at NSNotificationQueue. As an observer, if you find that you have a lot to do in response to a notification and it's taking too long (or ends up making re-entrant calls that confuse the calling code), you can change your observer method to just call performSelector:afterDelay:, to defer the actual processing. —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: runModalForWindow crash
On Jan 24, 2010, at 6:14 PM, Jo Meder wrote: My guess is that [NSApplication runModalForWindow:] is trying to send a message to my window object which has been released by now perhaps? I think I'm probably not getting something to do with object lifetimes here or something. Does anyone have any ideas what the problem might be? Try running your program in Instruments with the zombies instrument. Programs crash in objc_msgSend() when something sends a message to a deallocated object. The zombies instrument will catch this and show you the retain/release history of the bad object. 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: Decoder problem
As a note of etiquette, please don't cross post. If you've chosen the wrong list, the denizens will certainly let you know :). On Jan 22, 2010, at 6:58 PM, Austin Ray wrote: I'm trying to play video in an iPhone application. However, whenever I load the application onto my device and try to play video, I get this in the console in XCODE: warning: Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.1.2 (7D11)/Symbols/System/Library/VideoDecoders/VCH263.videodecoder (file not found). warning: Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.1.2 (7D11)/Symbols/System/Library/VideoDecoders/H264H1.videodecoder (file not found). warning: Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.1.2 (7D11)/Symbols/System/Library/VideoDecoders/MP4VH1.videodecoder (file not found). I need to fix this but don't know how. When I go through the folders that it says the file is missing from, no VideoDecoders folder even exists. There's something weird going on and I need those decoder files because the video is really buggy and incredibly slow at loading on my iPhone, which is up to date and NOT jailbroken. These aren't errors, they are warnings that the debugger couldn't find symbols for these files, which is rather common when debugging. Put simply, these symbols aren't shipped and when GDB can't find a symbol file that it expects to file it emits these warnings. The slowness in debugging is GDB reading the symbols back from the phone, which is MUCH slower than reading then back locally. There is nothing for you to do, and nothing for you to fix. It is also not the cause of your video issues (that I don't know). -- 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: Weird exception
Alexander Bokovikov wrote: I don't know how to do it, as I have no sources for Sparkle. http://sparkle.andymatuschak.org/ -- GG ___ 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
NSComboBox or Better Choice
I would like to display an image and descriptive text is some sort of popup list such as an NSComboBox. Can the NSComboBoxCell draw method be overridden to display an image along with text? Or, what is the best way to accomplish a pop up list of images and descriptive text? -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/archive%40mail-archive.com This email sent to arch...@mail-archive.com
How to hide dock item and application menu?
Hi All, In my application i need to provide an option to hide its dock icon as well as the application menu. How can i achieve this? I know that In Info.plist if i add an entry to run the application as Agent we will not see dock and menu item. This is not useful to me as my req is to provide the option to user to hide/unhide dock and menu item. Any ideas? Thanks Arun ___ 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 hide dock item and application menu?
On Jan 25, 2010, at 10:06 AM, Arun wrote: Hi All, In my application i need to provide an option to hide its dock icon as well as the application menu. How can i achieve this? I know that In Info.plist if i add an entry to run the application as Agent we will not see dock and menu item. This is not useful to me as my req is to provide the option to user to hide/unhide dock and menu item. There is no supported way to do this in Mac OS X. -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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSURL crash
On Mon, Jan 25, 2010 at 8:55 AM, Nick Zitzmann n...@chronosnet.com wrote: No, it was moved to CoreFoundation a while back, along with a few other Foundation objects: Well that's a bummer. But also good proof that you need to link against the appropriate SDK. :) --Kyle Sluder ___ 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
dynamic typing in a text field
Hi all, I want a textfield in my project which triggers a method while I´m writing in it. I saw this option 'continous' in the interface builder which works fine with sliders. While I move the slider the method executes. How can I do the same thing with a textfield? I can´t find it. Is there an example somewhere? Any hints? Greetings, Ronald --- ___ 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: dynamic typing in a text field
On Mon, Jan 25, 2010 at 11:16 AM, Ronald Hofmann pro...@jumbosoft.de wrote: I want a textfield in my project which triggers a method while I´m writing in it. I saw this option 'continous' in the interface builder which works fine with sliders. While I move the slider the method executes. How can I do the same thing with a textfield? Assign a delegate to the text field, and implement the -controlTextDidChange: method in the delegate's class. I can´t find it. Is there an example somewhere? Don't forget to look in the superclass! NSTextField is a subclass of NSControl, which is where the above delegate method is defined and documented. sherm-- -- Cocoa programming in Perl: http://www.camelbones.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: How to hide dock item and application menu?
On 25/Jan/2010, at 10:06 AM, Arun wrote: as my req is to provide the option to user to hide/unhide dock and menu item. Perhaps if you explained what you're trying to accomplish we could provide some direction? 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
CALayer maybe silly question
Hi again, the silly question is this: is it possible to redraw a CALayer in background? More specifically, I've written a delegate method drawLayer:inContext: that creates a thread that does the drawing then returns. Net result, when I do that, is void. The screen is blank, I think because nothing in drawn when the image is composited. So, is there a way to make the drawing appear when the thread has accomplished its job? I tried to put a [[layer superlayer] setNeedsDisplay] at the end of the threaded routine, the drawing appears but vanishes at once. Any clue? Thanks Vincent ___ 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
Fastest way to convert an NSDate into an NSString
Hello, I am in the process of converting the data format for my application from one that just uses the NSKeyedArchiver methods to archive my objects to a file on disk to using the NSXML classes to generate a custom XML file (I need to do this for compatibility purposes). My main data object is essentially a (potentially very long) list (or rather tree) of items, each of which have two or three dates associated with them (among other things). Having completed the initial conversion process, it turns out that currently my XML-writing methods (using NSXMLElement, NSXMLDocument etc) are much, much slower than using NSKeyedArchiver. Using Sample, it turns out that a lot of the time is spent converting the NSDates for each of the items in my list to string objects. I have tried this using two different methods: NSDate *someDate = ... [xmlElement addAttribute:[NSXMLNode attributeWithName:SomeDate stringValue:[someDate descriptionWithLocale:nil]]]; and NSXMLNode *attribute = [[NSXMLNode alloc] initWithKind:NSXMLAttributeKind]; [attribute setName:@SomeDate]; [attribute setObjectValue:someDate] [xmlElement addAttribute:attribute]; [attribute release]; But either way suffers the same performance hit. So, my question is, does anyone know of a much faster and more efficient way of converting NSDates to NSStrings? (A possible solution would be to change my data model to store these dates as strings internally so that the conversion is already done when they come to be written to file, but I was hoping for a more elegant solution.) Many thanks and all the best, Keith ___ 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: Fastest way to convert an NSDate into an NSString
On 25 Jan 2010, at 20:23, Keith Blount wrote: Hello, I am in the process of converting the data format for my application from one that just uses the NSKeyedArchiver methods to archive my objects to a file on disk to using the NSXML classes to generate a custom XML file (I need to do this for compatibility purposes). My main data object is essentially a (potentially very long) list (or rather tree) of items, each of which have two or three dates associated with them (among other things). Having completed the initial conversion process, it turns out that currently my XML-writing methods (using NSXMLElement, NSXMLDocument etc) are much, much slower than using NSKeyedArchiver. Using Sample, it turns out that a lot of the time is spent converting the NSDates for each of the items in my list to string objects. I have tried this using two different methods: NSDate *someDate = ... [xmlElement addAttribute:[NSXMLNode attributeWithName:SomeDate stringValue:[someDate descriptionWithLocale:nil]]]; and NSXMLNode *attribute = [[NSXMLNode alloc] initWithKind:NSXMLAttributeKind]; [attribute setName:@SomeDate]; [attribute setObjectValue:someDate] [xmlElement addAttribute:attribute]; [attribute release]; But either way suffers the same performance hit. So, my question is, does anyone know of a much faster and more efficient way of converting NSDates to NSStrings? (A possible solution would be to change my data model to store these dates as strings internally so that the conversion is already done when they come to be written to file, but I was hoping for a more elegant solution.) I don't know if this will help in your case. I previously noted the performance hit that occurred with NSDate but it seemed to occur largely as a result of instantiation. I reused a single static NSDate instance and saw improvements. Regards Jonathan Mitchell Developer http://www.mugginsoft.com Many thanks and all the best, Keith ___ 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/jonathan%40mugginsoft.com This email sent to jonat...@mugginsoft.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: Fastest way to convert an NSDate into an NSString
This approach is probably creating a new NSDateFormatter for each date processed. What if you create your own formatter and use that for all dates? On 25 Jan 2010, at 20:23, Keith Blount wrote: Hello, I am in the process of converting the data format for my application from one that just uses the NSKeyedArchiver methods to archive my objects to a file on disk to using the NSXML classes to generate a custom XML file (I need to do this for compatibility purposes). My main data object is essentially a (potentially very long) list (or rather tree) of items, each of which have two or three dates associated with them (among other things). Having completed the initial conversion process, it turns out that currently my XML-writing methods (using NSXMLElement, NSXMLDocument etc) are much, much slower than using NSKeyedArchiver. Using Sample, it turns out that a lot of the time is spent converting the NSDates for each of the items in my list to string objects. I have tried this using two different methods: NSDate *someDate = ... [xmlElement addAttribute:[NSXMLNode attributeWithName:SomeDate stringValue:[someDate descriptionWithLocale:nil]]]; and NSXMLNode *attribute = [[NSXMLNode alloc] initWithKind:NSXMLAttributeKind]; [attribute setName:@SomeDate]; [attribute setObjectValue:someDate] [xmlElement addAttribute:attribute]; [attribute release]; But either way suffers the same performance hit. So, my question is, does anyone know of a much faster and more efficient way of converting NSDates to NSStrings? (A possible solution would be to change my data model to store these dates as strings internally so that the conversion is already done when they come to be written to file, but I was hoping for a more elegant solution.) Many thanks and all the best, Keith ___ 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/cocoadev%40mikeabdullah.net This email sent to cocoa...@mikeabdullah.net ___ 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: Fastest way to convert an NSDate into an NSString
On Jan 25, 2010, at 1:23 PM, Keith Blount wrote: But either way suffers the same performance hit. So, my question is, does anyone know of a much faster and more efficient way of converting NSDates to NSStrings? You didn't say you needed the date to be formatted, so have you tried something like [[NSNumber numberWithDouble:[date timeIntervalSinceReferenceDate]] stringValue]? Or maybe [NSString stringWithFormat:@%f, [date timeIntervalSinceReferenceDate]]? 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: Fastest way to convert an NSDate into an NSString
On Jan 25, 2010, at 12:23 PM, Keith Blount wrote: But either way suffers the same performance hit. So, my question is, does anyone know of a much faster and more efficient way of converting NSDates to NSStrings? (A possible solution would be to change my data model to store these dates as strings internally so that the conversion is already done when they come to be written to file, but I was hoping for a more elegant solution.) The fastest thing you can do is to store the dates in numeric format, for example as the timeIntervalSinceReferenceDate. (If time-zones matter, you'd also need to save the time zone offset or name as a separate field.) —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: CALayer maybe silly question
On Jan 25, 2010, at 12:02 PM, vincent habchi wrote: the silly question is this: is it possible to redraw a CALayer in background? More specifically, I've written a delegate method drawLayer:inContext: that creates a thread that does the drawing then returns. If you want to draw to a layer on a separate thread, you need to run the runloop on that thread, as Core Animation is pretty highly dependent on the run loop operating. If you call -setNeedsDisplay on a thread where you never run the runloop, then it is likely that the layer's -display method will not be called until the thread terminates, which is likely your issue. -- 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: Fastest way to convert an NSDate into an NSString
On 25 Jan 2010, at 20:33, Mike Abdullah wrote: This approach is probably creating a new NSDateFormatter for each date processed. What if you create your own formatter and use that for all dates? I think Mike is right here. It was the NSDateFormatter that was the time sink not NSDate itself. On 25 Jan 2010, at 20:23, Keith Blount wrote: Hello, I am in the process of converting the data format for my application from one that just uses the NSKeyedArchiver methods to archive my objects to a file on disk to using the NSXML classes to generate a custom XML file (I need to do this for compatibility purposes). My main data object is essentially a (potentially very long) list (or rather tree) of items, each of which have two or three dates associated with them (among other things). Having completed the initial conversion process, it turns out that currently my XML-writing methods (using NSXMLElement, NSXMLDocument etc) are much, much slower than using NSKeyedArchiver. Using Sample, it turns out that a lot of the time is spent converting the NSDates for each of the items in my list to string objects. I have tried this using two different methods: NSDate *someDate = ... [xmlElement addAttribute:[NSXMLNode attributeWithName:SomeDate stringValue:[someDate descriptionWithLocale:nil]]]; and NSXMLNode *attribute = [[NSXMLNode alloc] initWithKind:NSXMLAttributeKind]; [attribute setName:@SomeDate]; [attribute setObjectValue:someDate] [xmlElement addAttribute:attribute]; [attribute release]; But either way suffers the same performance hit. So, my question is, does anyone know of a much faster and more efficient way of converting NSDates to NSStrings? (A possible solution would be to change my data model to store these dates as strings internally so that the conversion is already done when they come to be written to file, but I was hoping for a more elegant solution.) Many thanks and all the best, Keith ___ 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/cocoadev%40mikeabdullah.net This email sent to cocoa...@mikeabdullah.net ___ 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/jonathan%40mugginsoft.com This email sent to jonat...@mugginsoft.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] Implementing VOIP for iPhone App
On Sun, Jan 24, 2010 at 10:17 AM, Tharindu Madushanka tharindu...@gmail.com wrote: Hi I am currently in 4th year student of University of Moratuwa, Sri Lanka. I am thinking of creating iPhone client and server application (using Java) for my final year project. I have following things in my mind. I would like to have some instructions or guides about this idea specially on possibility of doing such project in kind of 6 months time. I have some experience with iPhone SDK and Objective-C published one iPhone app of my own but not much experience working with low level C coding. I want to come up with *VOIP and Voice Recognition app*. I am thinking of implementing basically voice recognition at server side. And about implementing VOIP I would like to know some steps or guides from anyone who has more idea on this stuff. So I would like to know whether its possible to come up with such app with a period of around 6 months. I have found that there is some open source work on voice recognition - sphinx - Java. And just like to know about possibility of implementing VOIP for iPhone.. or some initial steps to look into this. I think that the term VoIP is a red herring here. Yes, technically you're taking voice audio and sending it over IP, but VoIP normally refers to real-time interactive usage like internet telephony. You're just sending audio data to a server and getting some kind of response, so it's quite different. In particular, VoIP needs to achieve latencies that are as low as possible (even 200ms of round-trip delay can be pretty easily perceived by a human during a conversation), whereas you really don't care too much about network latencies. This alters the techniques you want to use considerably. So, forget about VoIP and just break your problem down normally. You really have three parts: 1) recording audio data 2) compressing it 3) sending it to a server and getting a response. Parts 1 and 2 can be achieved with CoreAudio, and there's lots of information and sample code out there. For more assistance, the coreaudio-api list has good people. Part 3 is pretty much up to you. Probably the simplest technique would be to post the audio data using HTTP, which can be done in Cocoa with NSURLConnection. Is this possible in 6 months? That's really difficult to say, because it all depends on the speed and skill of the programmer (you). Check this stuff out, come up with a plan, and decide for yourself. 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
NSPopUpButtonCell Update Smashes Focus Ring of Adjacent NSTableView: 10.4 vs. 10.5/10.6
I have a table view that can receive keyboard focus and that displays a focus ring. In addition, adjacent to its bottom is a pop-up button and a bar. The pop-up button enables/disables depending on the selection state of the table view. Under 10.5 and 10.6, the pop-up button and the focus ring of the table view all interact correctly and as-expected. However, under 10.4, when the button becomes enabled or is clicked, the piece of the table view's focus ring that was obscured or dirtied by the button is not updated (see attached) until the table loses focus and then regains it again. Based on the OS-specific behavior, this seems like it might be a table view or other super class focus ring defect; however, it's entirely possible the drawRect for the NSPopUpButtonCell is doing something it should not. Any tips on sleuthing the cause or overrides to provide in the table view that let it know, Hey, your focus ring just got dirtied, redraw (ostensibly calling setKeyboardFocusRingNeedsDisplayInRect) it.? Regards, Grant Picture 1.png Description: Binary data ___ 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: CALayer maybe silly question
David, Le 25 janv. 2010 à 21:39, David Duncan a écrit : If you want to draw to a layer on a separate thread, you need to run the runloop on that thread, as Core Animation is pretty highly dependent on the run loop operating. If you call -setNeedsDisplay on a thread where you never run the runloop, then it is likely that the layer's -display method will not be called until the thread terminates, which is likely your issue. Okay, thanks for your help. I'll need to alter completely the way the drawing routine works. At that point, I had a thread per call to DrawLayer:inContext:. Now I'll have to setup a real thread and proceed the drawings one after the other… :) Thanks again for your valuable input. Vincent___ 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
Garbage Collection Docs Puzzle
The garbage collection docs section on the interior pointer issue shows this example: NSData *myData = [someObject getMyData]; [myData retain]; const uint8_t *bytes = [myData bytes]; NSUInteger offset = 0, length = [myData length]; while (offset length) { // bytes remains valid until next message sent to myData } [myData release]; What's with the retain and release? I understand the issue of keeping myData alive until you're finished with the interior pointer, but why [myData release]? Is the release enough to keep myData alive even thought its dispatch is short circuited under GC? And the retain is there to balance the release in case someone executes under managed memory? Or did somebody mean CFRetain and CFRelease? It seems that [myData self] or [myData class] or some other harmless (return value discarded) non-sequitor might be less confusing. It would point out that this is an issue that is being worked around and not an ordinary part of memory management. ...Bob ___ 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 detect no internet connection?
Hello. What is the best way to detect that there is no internet connection from my Cocoa app? Detecting no network would work too but I'd like to be able even if the Macintosh is connected to a network that it can't reach the internet. I know I could use a test connection but is there a better way? -Laurent. -- Laurent Daudelin AIM/iChat/Skype:LaurentDaudelin http://nemesys.dyndns.org Logiciels Nemesys Software laurent.daude...@gmail.com Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries ___ 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 detect no internet connection?
On Jan 25, 2010, at 1:50 PM, Laurent Daudelin wrote: What is the best way to detect that there is no internet connection from my Cocoa app? SystemConfiguration.framework. It can even send you notifications in real-time as the network status changes. Detecting no network would work too but I'd like to be able even if the Macintosh is connected to a network that it can't reach the internet. I know I could use a test connection but is there a better way? A reasonable request, but the problem is that reach the internet is too vague a question. The main situation where it breaks down is on an intranet that requires use of a proxy to reach the outside world. In this case you are literally not connected to the Internet, even with a 1000baseT plug jacked into your computer, even though your web browser and email work fine. If on the other hand you just mean can I ping the router, this will be true on a home 802.11 network even when the DSL/cable modem is down, and there are no outside hosts reachable. Basically you have to decide based on the specific functionality of your app. In a lot of cases what the app wants to know is can I reach my server at foobar.com:12345?, and SystemConfiguration will let you ask that question. It won't be 100% accurate, though, because it gets its answer only from consulting the local routing tables, not from actually sending any packets. —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: patching the responder chain: puzzled by the docs
I went ahead and created rdar://7576845 rather than use the documentation feedback form, because I'd like to see what the answer is. --Andy On Friday, January 22, 2010, at 12:42PM, Andy Lee ag...@mac.com wrote: My understanding was that it's okay to insert things anywhere you want in the responder chain. In particular, it's okay to put a a view controller between its view and the view's superview. I know I'm not alone in this: * Buck and Yacktman say so in Cocoa Design Patterns, in the section Inserting Objects into the Responder Chain. * Jonathan Dann offered a way for view controllers to get patched in automatically, and nobody said boo: http://www.cocoabuilder.com/archive/cocoa/212830-responder-chain-patching.html#212954. * In the same thread, Matt Neuberg (no slouch) said he does it all the time, though with a custom NSResponder rather than a view controller: http://www.cocoabuilder.com/archive/cocoa/212830-responder-chain-patching.html?q=Responder+Chain+Patching#212862. * On the iPhone, UIKit's responder chain is structured this way by default. But today I noticed this: http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/EventArchitecture.html A view’s next responder is always its superview—most of the responder chain, in fact, comprises the views from a window’s first responder up to its content view. When you create a window or add subviews to existing views, either programmatically or in Interface Builder, the Application Kit automatically hooks up the next responders in the responder chain. The addSubview: method of NSView automatically sets the receiver as the new subview’s superview. You should never send setNextResponder: to an NSView object. Because of what addSubview: does, I can see you have to be careful *when* you send setNextResponder: to a NSView. But *never*? Are the docs wrong? Or is this a real Apple rule that people commonly violate at their own risk, like the rule about not starting method names with underscores? If so, what is that risk? --Andy ___ 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
simple file browser
Hi, I want to implement file browser in my app to allow to see hidden files / other. Can you suggest me code examples of cocoa file browser? -- best regards Ariel ___ 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 hide dock item and application menu?
On 25 Jan 2010, at 18:06, Arun wrote: Hi All, In my application i need to provide an option to hide its dock icon as well as the application menu. How can i achieve this? I know that In Info.plist if i add an entry to run the application as Agent we will not see dock and menu item. This is not useful to me as my req is to provide the option to user to hide/ unhide dock and menu item. Any ideas? Thanks Arun I believe QuickSilver does something like this. It might be useful to take a rummage through it's codebase: http://code.google.com/p/blacktree-alchemy/ ___ 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: simple file browser
On Jan 25, 2010, at 2:12 PM, Ariel Feinerman wrote: I want to implement file browser in my app to allow to see hidden files / other. Can you suggest me code examples of cocoa file browser? Use an NSOpenPanel, set an instance of your class as its delegate, and implement the panel:shouldShowFilename: method to always return YES, even for hidden files. Resist the urge to implement your own file-chooser UI. Most of it is pretty simple to do using NSFileManager and NSOutlineView (or NSBrowser), but there are all sorts of details like whether to show file extensions and whether to localize filenames. It's usually a much better idea to just use the standard open/save panels. —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 email a message with a NSAttributedString content
using the SBSendEmail sample code from apple, i'm able to send an email using mail.app, however i cannot figure out how to send an email containing rich text from an NSAttributedString. any suggestions? thx in advance. ___ 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 hide dock item and application menu?
On 25 Jan 2010, at 18:06, Arun wrote: Hi All, In my application i need to provide an option to hide its dock icon as well as the application menu. How can i achieve this? I know that In Info.plist if i add an entry to run the application as Agent we will not see dock and menu item. Actually the key you want is LSUIElement — this indicates that you can display a user interface but shouldn't have a menu bar or dock icon. This is not useful to me as my req is to provide the option to user to hide/ unhide dock and menu item. You can't change that while your app is running. You have to modify your own Info.plist and then relaunch. (And remember that a non-admin user typically won't have permission to modify any of the app's files, if it's in /Applications.) —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: simple file browser
On Tuesday, January 26, 2010, Ariel Feinerman arielfap...@gmail.com wrote: Hi, I want to implement file browser in my app to allow to see hidden files / other. Can you suggest me code examples of cocoa file browser? http://developer.apple.com/mac/library/samplecode/SourceView/index.html should get you started. Did you try looking in Apple's sample code section? -- 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
Re: simple file browser
On Tuesday, January 26, 2010, Matthew Lindfield Seager matt...@sagacity.com.au wrote: On Tuesday, January 26, 2010, Ariel Feinerman arielfap...@gmail.com wrote: Hi, I want to implement file browser in my app to allow to see hidden files / other. Can you suggest me code examples of cocoa file browser? http://developer.apple.com/mac/library/samplecode/SourceView/index.html should get you started. Did you try looking in Apple's sample code section? -- Matt And ditto what Jens said about not using it if all you want to do is open or save a file... ___ 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 detect no internet connection?
On Jan 25, 2010, at 13:58, Jens Alfke wrote: On Jan 25, 2010, at 1:50 PM, Laurent Daudelin wrote: What is the best way to detect that there is no internet connection from my Cocoa app? SystemConfiguration.framework. It can even send you notifications in real-time as the network status changes. Detecting no network would work too but I'd like to be able even if the Macintosh is connected to a network that it can't reach the internet. I know I could use a test connection but is there a better way? A reasonable request, but the problem is that reach the internet is too vague a question. The main situation where it breaks down is on an intranet that requires use of a proxy to reach the outside world. In this case you are literally not connected to the Internet, even with a 1000baseT plug jacked into your computer, even though your web browser and email work fine. If on the other hand you just mean can I ping the router, this will be true on a home 802.11 network even when the DSL/cable modem is down, and there are no outside hosts reachable. Basically you have to decide based on the specific functionality of your app. In a lot of cases what the app wants to know is can I reach my server at foobar.com:12345?, and SystemConfiguration will let you ask that question. It won't be 100% accurate, though, because it gets its answer only from consulting the local routing tables, not from actually sending any packets. —Jens Thanks, Jens, I'll start with SystemConfiguration! -Laurent. -- Laurent Daudelin AIM/iChat/Skype:LaurentDaudelin http://nemesys.dyndns.org Logiciels Nemesys Software laurent.daude...@gmail.com Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries ___ 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 hide dock item and application menu?
Le 25 janv. 2010 à 23:24, Jens Alfke a écrit : On 25 Jan 2010, at 18:06, Arun wrote: Hi All, In my application i need to provide an option to hide its dock icon as well as the application menu. How can i achieve this? I know that In Info.plist if i add an entry to run the application as Agent we will not see dock and menu item. Actually the key you want is LSUIElement — this indicates that you can display a user interface but shouldn't have a menu bar or dock icon. This is not useful to me as my req is to provide the option to user to hide/unhide dock and menu item. You can't change that while your app is running. You have to modify your own Info.plist and then relaunch. (And remember that a non-admin user typically won't have permission to modify any of the app's files, if it's in /Applications.) And that it will invalidate your application signature if it is signed. -- Jean-Daniel ___ 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: simple file browser
On Jan 25, 2010, at 2:25 PM, Matthew Lindfield Seager wrote: http://developer.apple.com/mac/library/samplecode/SourceView/ index.html should get you started. Did you try looking in Apple's sample code section? /Developer/Examples/OutlineView/ is even closer — it's a basic outline view that displays the contents of the filesystem. But as I said before, if you can use the standard Open panel, it's much easier than trying to roll your own. —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: simple file browser
On Jan 25, 2010, at 2:36 PM, Jens Alfke wrote: On Jan 25, 2010, at 2:25 PM, Matthew Lindfield Seager wrote: http://developer.apple.com/mac/library/samplecode/SourceView/ index.html should get you started. Did you try looking in Apple's sample code section? /Developer/Examples/OutlineView/ is even closer — it's a basic outline view that displays the contents of the filesystem. But as I said before, if you can use the standard Open panel, it's much easier than trying to roll your own. Speaking as someone who's done so, I cannot agree more. ___ 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: simple file browser
Matthew, Jens, thank you 2010/1/26 Jens Alfke j...@mooseyard.com: On Jan 25, 2010, at 2:25 PM, Matthew Lindfield Seager wrote: http://developer.apple.com/mac/library/samplecode/SourceView/index.html should get you started. Did you try looking in Apple's sample code section? /Developer/Examples/OutlineView/ is even closer — it's a basic outline view that displays the contents of the filesystem. But as I said before, if you can use the standard Open panel, it's much easier than trying to roll your own. —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
inspecting return data from NSPasteboard propertyListForType:
I have some generic code for when data is dragged into my application. I wanted to do something like this id data = [[sender draggingPasteboard] propertyListForType:type]; if ( [NSArray isSubclassOfClass:[data class]] or [NSDictionary isSubclassOfClass:[data class]]) { //do a list thing } else { //do a single thing } What I'm finding is that when the data type is NSCFArray it is not being identified by [NSArray isSubclassOfClass:. Why is that? Is there something I can do it identify what the Data type is? thanks for the help -dave ___ 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: Garbage Collection Docs Puzzle
What's with the retain and release? I understand the issue of keeping myData alive until you're finished with the interior pointer, but why [myData release]? Is the release enough to keep myData alive even thought its dispatch is short circuited under GC? And the retain is there to balance the release in case someone executes under managed memory? Or did somebody mean CFRetain and CFRelease? -retain and -release are indeed enough to prevent myData from being collected (and therefore the interior pointer from going stale). The issue being worked-around is that of the compiler; during optimization, if you stop referencing myData, the compiler may decide to reuse the stack slot reserved for it. Once that reference disappears (assuming it was the last rooted, strong reference) myData will be collected. (Note that the short-circuiting issue is irrelevant, because it doesn't occur at compile-time - it happens in objc_msgsend.) Under managed-memory, the -retain/-release will ensure that the data object is kept alive until you're threw with the interior pointer, in the case that -getMyData didn't return a -retain/-autoreleased object. It seems that [myData self] or [myData class] or some other harmless (return value discarded) non-sequitor might be less confusing. It would point out that this is an issue that is being worked around and not an ordinary part of memory management. Indeed, you can choose to send myData any message you like - perhaps an appropriately-named macro would be more fitting. And of course if you're writing GC-only code then the -retain is unnecessary - for that reason sending myData -self at the end of the method would make a lot more sense. ___ 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: inspecting return data from NSPasteboard propertyListForType:
On Jan 25, 2010, at 3:05 PM, David Alter wrote: if ( [NSArray isSubclassOfClass:[data class]] That's actually backwards — you want to find out if [data class] is a subclass of NSArray. But the usual way to write this is [data isKindOfClass: [NSArray class]] —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: Garbage Collection Docs Puzzle
Except -retain is more efficient under GC. -- Julien from his iPhone Le 26 janv. 2010 à 00:06, Dave Keck davek...@gmail.com a écrit : sending myData -self at the end of the method would make a lot more sense. ___ 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: simple file browser
On Jan 25, 2010, at 2:22 PM, Jens Alfke wrote: On Jan 25, 2010, at 2:12 PM, Ariel Feinerman wrote: I want to implement file browser in my app to allow to see hidden files / other. Can you suggest me code examples of cocoa file browser? Use an NSOpenPanel, set an instance of your class as its delegate, and implement the panel:shouldShowFilename: method to always return YES, even for hidden files. That won't work -- by default the open/save panel doesn't call it for hidden files. Instead, just call: [savePanel setShowsHiddenFiles:YES]. --corbin ___ 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
another responder chain docs bug (validateUserInterfaceItem:)
Semi-related to my previous post, I just filed rdar://7577360 (text below). As far as I can tell, it's a bug in the docs. --Andy The Overview at http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Protocols/NSUserInterfaceValidations_Protocol/Reference/Reference.html says: To validate a control, the application calls validateUserInterfaceItem: for each item in the responder chain, starting with the first responder. If no responder returns YES, the item is disabled. From my experience, this is not what happens. Rather, it works the way Jakob Olesen describes in this post on cocoa-dev: http://www.cocoabuilder.com/archive/cocoa/168662-validateuserinterfaceitem-and-chaining-actions.html 1. Find the target for my action 2. Validate using that target and nobody else. I.e., validateUserInterfaceItem: does not go up the responder chain until it gets a YES answer; it goes up the responder chain until it finds a target that responds to the action message, meaning the docs are incorrect. ___ 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: Garbage Collection Docs Puzzle
The issue being worked-around is that of the compiler; during optimization, if you stop referencing myData, [snip] Yes. As I said, I understand the issue - my only question was whether the short-circuited retain was enough to do it. I didn't know whether the compiler did this or the runtime. Thanks for enlightening me. perhaps an appropriately-named macro would be more fitting. Something on the order of _KEEP_ALIVE_( myData ) would be much more fitting and far less confusing to someone reading your code or a beginner reading the docs. Except -retain is more efficient under GC. Probably irrelevant. Any realistic thing you would be doing with any realistic number of bytes in the NSData object would swamp the difference between a short circuited retain dispatch and a dispatch of -self. ...Bob ___ 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: Fastest way to convert an NSDate into an NSString
Many thanks for all the suggestions, much appreciated. Although -timeIntervalSinceReferenceDate: may indeed be a workable solution as the XML is our own format so I could make this choice, for now I think I'd like to retain a human-readable date. Mike's suggestion of creating one NSDateFormatter and passing all of the dates through that (as opposed to relying on the standard methods which most likely create a formatter per-instance) boosted performance significantly, so I'm going to see if I can squeeze more speed elsewhere and go with that. Thanks again! All the best, Keith --- On Mon, 1/25/10, Mike Abdullah cocoa...@mikeabdullah.net wrote: From: Mike Abdullah cocoa...@mikeabdullah.net Subject: Re: Fastest way to convert an NSDate into an NSString To: Keith Blount keithblo...@yahoo.com Cc: cocoa-dev@lists.apple.com Date: Monday, January 25, 2010, 8:33 PM This approach is probably creating a new NSDateFormatter for each date processed. What if you create your own formatter and use that for all dates? On 25 Jan 2010, at 20:23, Keith Blount wrote: Hello, I am in the process of converting the data format for my application from one that just uses the NSKeyedArchiver methods to archive my objects to a file on disk to using the NSXML classes to generate a custom XML file (I need to do this for compatibility purposes). My main data object is essentially a (potentially very long) list (or rather tree) of items, each of which have two or three dates associated with them (among other things). Having completed the initial conversion process, it turns out that currently my XML-writing methods (using NSXMLElement, NSXMLDocument etc) are much, much slower than using NSKeyedArchiver. Using Sample, it turns out that a lot of the time is spent converting the NSDates for each of the items in my list to string objects. I have tried this using two different methods: NSDate *someDate = ... [xmlElement addAttribute:[NSXMLNode attributeWithName:SomeDate stringValue:[someDate descriptionWithLocale:nil]]]; and NSXMLNode *attribute = [[NSXMLNode alloc] initWithKind:NSXMLAttributeKind]; [attribute setName:@SomeDate]; [attribute setObjectValue:someDate] [xmlElement addAttribute:attribute]; [attribute release]; But either way suffers the same performance hit. So, my question is, does anyone know of a much faster and more efficient way of converting NSDates to NSStrings? (A possible solution would be to change my data model to store these dates as strings internally so that the conversion is already done when they come to be written to file, but I was hoping for a more elegant solution.) Many thanks and all the best, Keith ___ 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/cocoadev%40mikeabdullah.net This email sent to cocoa...@mikeabdullah.net ___ 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
Focus Ring and NSTextField
I have a preference panel with a NSTextField. The text field automatically gets a focus ring when showing the panel. I only want a focus ring when the user clicks in the text field. How can I do that? --Richard ___ 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: simple file browser
On Jan 25, 2010, at 3:17 PM, Corbin Dunn wrote: Instead, just call: [savePanel setShowsHiddenFiles:YES]. There's no such method in the 10.5 SDK; was it added in 10.6? —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: Focus Ring and NSTextField
On Jan 25, 2010, at 4:11 PM, Richard Somers wrote: I have a preference panel with a NSTextField. The text field automatically gets a focus ring when showing the panel. I only want a focus ring when the user clicks in the text field. How can I do that? Wire the window's initialFirstResponder outlet to whatever view you want to have focus initially. (If you don't want any view to, you can wire it to the window itself.) —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: runModalForWindow crash
Hi Nick, On 26/01/2010, at 6:06 AM, Nick Zitzmann wrote: On Jan 24, 2010, at 6:14 PM, Jo Meder wrote: My guess is that [NSApplication runModalForWindow:] is trying to send a message to my window object which has been released by now perhaps? I think I'm probably not getting something to do with object lifetimes here or something. Does anyone have any ideas what the problem might be? Try running your program in Instruments with the zombies instrument. Programs crash in objc_msgSend() when something sends a message to a deallocated object. The zombies instrument will catch this and show you the retain/release history of the bad object. Thanks for the tip, very useful. I've managed to address this problem, and a few other crashing problems when closing windows, by using performSelectorOnMainThread:withObject:waitUntilDone: with my window cleanup method as the selector. This looks to have the effect of delaying the call to the window cleanup until the current event has completed and it's safe to tear down the window etc. without pulling the rug out from under anything. I previously did a similar thing in Carbon by posting a kEventWindowClose event to the event queue. Regards, Jo Meder___ 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: simple file browser
On Jan 25, 2010, at 4:12 PM, Jens Alfke wrote: On Jan 25, 2010, at 3:17 PM, Corbin Dunn wrote: Instead, just call: [savePanel setShowsHiddenFiles:YES]. There's no such method in the 10.5 SDK; was it added in 10.6? —Jens___ Looks like--in the NSSavePanel class ref on my Snow Leopard install: setShowsHiddenFiles: Specifies whether the panel displays files that are normally hidden from the user. - (void)setShowsHiddenFiles:(BOOL)flag Parameters flag If YES, the panel displays hidden files; if NO, it does not. Availability • Available in Mac OS X v10.6 and later. See Also • – showsHiddenFiles Declared In NSSavePanel.h Cheers, Andrew___ 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
Launch process as root from cocoa app
Hello, I'm currently working on a Preference Pane with an SFAuthorizationView, my problem is simple, when I click on a switch button I need to start / stop a daemon as user using launchctl. I tried 3 different ways and the only one that is working is the slowest, here the 3 ways I tried : 1 - Using the authorizationRef object of my SFAuthorizationView and call AuthorizationExecuteWithPrivileges() (/bin/launchctl load /Library/LaunchDaemons/com.mydaemon.plist) -- Failed. daemon not launched as root, but as current user. 2 - Using /usr/bin/security with an NSTask : /usr/bin/security execute-with-privileges /bin/launchctl load /Library/LaunchDaemons/com.mydaemon.plist -- Failed. daemon not launched as root, but as current user + ask a second time for an admin password.. 3 - Using AppleScript : NSAppleScript *script = [[NSAppleScript alloc] initWithSource:@do shell script \/bin/launchctl load /Library/LaunchDaemons/com.mydaemon.plist\ with administrator privileges]; NSDictionary *errorInfo; [script executeAndReturnError:errorInfo]; [script release]; -- Worked but very slow and I have to re-enter an admin password, which is very annoying. So is there any other way to do this without enter 2 times an admin password ? Thanks for your help. Nyxem. ___ 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: Launch process as root from cocoa app
On Sun, Jan 24, 2010 at 11:57 PM, Nyxem nyx...@gmail.com wrote: I'm currently working on a Preference Pane with an SFAuthorizationView, my problem is simple, when I click on a switch button I need to start / stop a daemon as user using launchctl. Do not do use launchctl for this. Launchd has plenty of ways of determining when to start and stop jobs. You should configure your job's plist accordingly. --Kyle Sluder ___ 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
NSPredicateEditorRowTemplate and CoreData
I am trying to generate predicate editor templates for my Core Data entities. In my code I have the following: NSEntityDescription *descrip = [NSEntityDescription entityForName:@Person inManagedObjectContext:managedObjectContext]; NSArray *templates = [NSPredicateEditorRowTemplate templatesWithAttributeKeyPaths:[NSArray arrayWithObjects:@name, @age, nil] inEntityDescription:descrip]; [ibPredicateEditor setRowTemplates: templates]; NSPredicate *p = [NSPredicate predicateWithFormat:@name like 'John']; [ibPredicateEditor setObjectValue:p]; Printing out the contents of the templates array gives me the following: CFArray 0x1002d7400 [0x7fff70ff5f20]{type = immutable, count = 2, values = ( 0 : NSPredicateEditorRowTemplate 0x10025c090: [name] [99, 4, 5, 8, 9] NSStringAttributeType 1 : NSPredicateEditorRowTemplate 0x1002d2dc0: [age] [4, 5, 0, 2, 1, 3] NSInteger16AttributeType )} When this code executes I get the following on the console: Warning - unable to find template matching predicate name LIKE Worsley The interface for doing this looks extremely straight forward, so I can't seem to figure out what I am doing wrong. Any help would be greatly appreciated! Cheers, Carmen___ 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: Launch process as root from cocoa app
On Jan 25, 2010, at 12:57 AM, Nyxem wrote: 1 - Using the authorizationRef object of my SFAuthorizationView and call AuthorizationExecuteWithPrivileges() (/bin/launchctl load /Library/LaunchDaemons/com.mydaemon.plist) -- Failed. daemon not launched as root, but as current user. As you've figured out, AEWP() launches apps with root privileges, but it doesn't run them _as_ root. If you need to launch an app as root for whatever reason via AEWP(), then search the archives for a workaround, because I'm pretty sure I've posted at least one workaround for this years ago... 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: Launch process as root from cocoa app
On Jan 25, 2010, at 6:53 PM, Kyle Sluder wrote: Do not do use launchctl for this. Launchd has plenty of ways of determining when to start and stop jobs. You should configure your job's plist accordingly. The OP wants to allow a button in the UI to start and stop the job. That's not something you can configure a plist for! —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
NSTabView
I have a fixed size NSTabView that displays 4 NSTabViewITems very nicely. It is possible that the application may want to add more NSTabViewItems. Is there a flag to set (somewhere) so that added items will not be truncated to the view but display like Safari indicating more items and then displaying them in a menu? -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/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Observed behaviour - Is this expected
Class A is a subclass of NSView Class B is a subclass of Class A Class A and Class B are in a NIB. Class A as an Object - the blue cube Class B as a view in a window. When the program runs: Class A's init method is called Class B's awakeFromNib is called Class A's awakeFromNib is called NOTE that Class B's init method is not called My problem is I want to reference outlets defined in Class A in Class B awakeFromNib but they are nil at Class B awakeFromNib time. I was under the impression that at awakeFromNib time all outlets in all NIB objects are wired up. So what do I not understand? -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/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Launch process as root from cocoa app
On Mon, Jan 25, 2010 at 7:23 PM, Jens Alfke j...@mooseyard.com wrote: The OP wants to allow a button in the UI to start and stop the job. That's not something you can configure a plist for! You configure the launchd job's plist to watch for a path and create/remove that file in response to the UI action. This avoids the entire mess of running launchctl with elevated privileges; instead you only have to worry about running your own known code. --Kyle Sluder ___ 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: Observed behaviour - Is this expected
On Mon, Jan 25, 2010 at 7:43 PM, David Blanton aired...@tularosa.net wrote: Class A is a subclass of NSView Class B is a subclass of Class A Class A and Class B are in a NIB. Classes don't live in nibs. You mean an object of class A and an object of class B live in the nib. Class A as an Object - the blue cube Class B as a view in a window. So your instance of A and your instance of B are entirely unrelated. When the program runs: Class A's init method is called Class B's awakeFromNib is called Class A's awakeFromNib is called Class B will have been initialized with -initWithFrame:, as documented in the Resource Programming Guide: http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Conceptual/LoadingResources/CocoaNibs/CocoaNibs.html As the documentation explains, your instance of class A is encoded as an object placeholder, whereas your instance of class B has been encoded as a custom view placeholder. --Kyle Sluder ___ 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: Observed behaviour - Is this expected
On Jan 25, 2010, at 8:51 PM, Kyle Sluder wrote: On Mon, Jan 25, 2010 at 7:43 PM, David Blanton aired...@tularosa.net wrote: Class A is a subclass of NSView Class B is a subclass of Class A Class A and Class B are in a NIB. Classes don't live in nibs. You mean an object of class A and an object of class B live in the nib. Class A as an Object - the blue cube Class B as a view in a window. So your instance of A and your instance of B are entirely unrelated. Well, dosen't @interface ClassB : ClassA say they are related? When the program runs: Class A's init method is called Class B's awakeFromNib is called Class A's awakeFromNib is called Class B will have been initialized with -initWithFrame:, as documented in the Resource Programming Guide: http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Conceptual/LoadingResources/CocoaNibs/CocoaNibs.html I have a breakpoint on Class B's initWithFrame and it is never hit ... @implementation ClassB - (id) initWithFrame:(NSRect)frame { self = [super initWithFrame:frame]; if (self != nil) { } return self; } As the documentation explains, your instance of class A is encoded as an object placeholder, whereas your instance of class B has been encoded as a custom view placeholder. --Kyle Sluder ___ 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: Observed behaviour - Is this expected
OK. What I wanted was to have only one reference to the outlets in the 'base class' that can be used in the sub classes. I did not realize I had to connect the outlets defined in the base class through the sub class. I have the behavior I was expecting now. Thanks Kyle for the pointer to the CocoaNibs.html -db On Jan 25, 2010, at 8:51 PM, Kyle Sluder wrote: On Mon, Jan 25, 2010 at 7:43 PM, David Blanton aired...@tularosa.net wrote: Class A is a subclass of NSView Class B is a subclass of Class A Class A and Class B are in a NIB. Classes don't live in nibs. You mean an object of class A and an object of class B live in the nib. Class A as an Object - the blue cube Class B as a view in a window. So your instance of A and your instance of B are entirely unrelated. When the program runs: Class A's init method is called Class B's awakeFromNib is called Class A's awakeFromNib is called Class B will have been initialized with -initWithFrame:, as documented in the Resource Programming Guide: http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Conceptual/LoadingResources/CocoaNibs/CocoaNibs.html As the documentation explains, your instance of class A is encoded as an object placeholder, whereas your instance of class B has been encoded as a custom view placeholder. --Kyle Sluder ___ 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: NSTabView
On Jan 25, 2010, at 10:34 PM, David Blanton wrote: I have a fixed size NSTabView that displays 4 NSTabViewITems very nicely. It is possible that the application may want to add more NSTabViewItems. Is there a flag to set (somewhere) so that added items will not be truncated to the view but display like Safari indicating more items and then displaying them in a menu? No.___ 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
10.6 Clips Tooltip if you return NSTextFieldCell in -dataCellForRow:
I've been overriding -[NSTableColumn dataCellForRow:], returning a variation on NSTextFieldCell for years. However I just discovered that, in OS 10.6.2, this breaks the tooltip which shows the entire text when you hover over a truncated cell. (This tooltip feature was added in OS 10.5.) Here's how it looks: http://sheepsystems.com/engineering/ClippedToolTip.png [1] Here's the demo project: http://sheepsystems.com/engineering/ClippedToolTip.zip No problem either way in Mac OS X 10.5. Snow Leopard AppKit Release Notes don't mention anything about these tooltips. Here is the demo project code: @implementation CTDataSource - (int)numberOfRowsInTableView:(NSTableView *)aTableView { return 1 ; } - (id) tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex { if ([[aTableColumn identifier] isEqualToString:@name]) { // First column. Long name will be truncated. return @Gagikostoupomolis A. B. C. Geiristomzkimcbliskewicz ; } else { // Second column return @ga...@anwicz.com ; } } @end @implementation CTTableColumn - (id)dataCellForRow:(int)iRow { #if 1 id aCell = [super dataCell] ; #else id aCell = [[[NSTextFieldCell alloc] init] autorelease] ; #endif // This is just for logging if ([[self identifier] isEqualToString:@name]) { NSLog(@height=%0.1f width=%0.1f %p class=%@ size=%@, [[self tableView] rowHeight], [self width], aCell, [aCell class], NSStringFromSize([aCell cellSize])) ; } return aCell ; } @end Referring to -dataCellForRow:, if the #if is 1 as shown, it implements the documented fact that By default, this method just calls dataCell, and the tooltip is OK. OK behavior also if you simply invoke super. But if you change #if to 0 and return a raw NSTextFieldCell, you get the clipped tooltip. The console log raises more questions than answers: With #if 1 (super's -dataCell, good tooltip), height=20.0 width=159.0 0x5a1a2f0 class=NSTextFieldCell size={60.1641, 17} height=20.0 width=159.0 0x5a1a2f0 class=NSTextFieldCell size={343.968, 17} height=20.0 width=159.0 0x5a1a2f0 class=NSTextFieldCell size={343.968, 17} With #if 0 (Raw NSTextFieldCell, clipped tooltip), height=20.0 width=159.0 0x5a31680 class=NSTextFieldCell size={31.6094, 16} height=20.0 width=159.0 0x5b34080 class=NSTextFieldCell size={31.6094, 16} height=20.0 width=159.0 0x5a622d0 class=NSTextFieldCell size={31.6094, 16} In both cases, the first two log lines appear immediately when the table is first drawn, and the third appears when I hover my mouse over the cell with the overflow text to display the tooltip. Note: I logged later that iRow is always = 0. I'm guessing that that the problem has something to do with the cell size. Looking at those cell sizes, I have no idea where initial widths 60.1641 or 31.6094 come from. Same for the heights 16 and 17. Those heights do not vary if I change the row height. However, 343.968 is in fact the width needed to display the text on a single line in the tooltip! So here are the star questions: * Why in the world would Cocoa be invoking -dataCellForRow in order to display a tooltip? It always uses the same yellow box format with the same font. The tooltip should have no interest whatsoever in the data cell. But it's apparently getting the answer that it wants, a width of 343.968! * How in the world does -[super dataCell] know that the required width of the text in this particular cell is 343.968? It does not even know the row or column, much less the data object value. Possibly the answers to these questions will lead to a workaround. Any ideas? Thanks! Jerry [1] Here is a textual description of the clipped tooltip, for the long-term archives: * The yellow rectangle is only as wide as the column. * The yellow rectangle looks like it is tall enough to display the several lines that would be needed, if the text were wrapped, but... * The text is not wrapped. The first line is clipped in mid-character at the right edge. Below this first line, there is one or more blank lines. * The 1-pixel gray outline appears as usual around all four sides of the yellow rectangle. ___ 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: 10.6 Clips Tooltip if you return NSTextFieldCell in -dataCellForRow:
Well, it's not the cell size. I found that I could increase the cellSize.width of my raw NSTextFieldCell by doing something like this: [aCell setStringValue:@Gagikostoupomolis A. B. C. Geiristomzkimcbliskewicz] ; But the tooltip is still clipped :( How can we do custom table cells in Mac OS 10.6 without breaking the tooltip? ___ 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