Re: Get specified window from nib
Am Di,12.08.2008 um 05:08 schrieb Fosse: In fact, in my another application, there are more than one hundred windows.. H split them into one hundred nib? Yes, but: … and create one hundred Outlet? No, only one. Typically a window has a window controller. The relationship between window-controller and window is (typically but not neccessarily) 1:1. One window controller per window, one window per window controller. So you have 100 window controllers? Yes, if all these 100 windows are on screen at the same time. You load the nib (the window controller) dynamically. So you have as many window controllers (and loaded nibs) as open windows. The window cotrollers are typically stored in an array. You have one array. If you use a subclass of NSDocument, the document will do that for you. If you do not have a subclass of NSDocument, probably your application-delegate should have a window controller array. Beside the advantages of this design in relation to memory usage you get the ability to reinstantiate the same window type as many times as you want. I cannot believe, that you have 100 windows of different types. If you have 10 windows of 10 different types, you need 10 nibs (for each type) and as many instances (loaded nibs) as windows are on the screen. Seems a little too crazy! Yup, the reason is, that 100 windows are a little too crazy. Amin On Tue, Aug 12, 2008 at 12:59 AM, Michael Ash [EMAIL PROTECTED] wrote: On Sun, Aug 10, 2008 at 10:01 PM, Fosse [EMAIL PROTECTED] wrote: I have one nib containing more than ten dialogs and want to get the specified window after nib is loading.. Don't take this badly, but if you have one nib with ten windows and you only want to access one of them, you're doing it wrong. Separate nibs will be easier to work with and will be more efficient (you don't have to create and then destroy nine windows you don't care about every time you load one you do care about). If I use FileOwner and binding, I need to add a lot of Outlets in the fileOwner class and create the binding in the IB.. Is there a more convenient way to get the specified window by passing the window name and nib reference like Carbon? Create one outlet to each window. Ten outlets doesn't seem like an enormous hardship. 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/macdev08%40gmail.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/negm-awad%40cocoading.de This email sent to [EMAIL PROTECTED] Amin Negm-Awad [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Creating popup window/panel
Hi all, I am trying to create a window that pops up from the toolbar (like say the project selection window in Pages or the window that pops up if you drag an existing source file onto XCode). I am trying design a UI so the user doesn't have to bring up a separate window. Is this done using a normal window and these are just display properties or is this done using a view? Thanks. -- I never look back darling, it distracts from the now, Edna Mode (The Incredibles) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Creating popup window/panel
On Aug 12, 2008, at 12:01 AM, Devraj Mukherjee wrote: I am trying to create a window that pops up from the toolbar (like say the project selection window in Pages or the window that pops up if you drag an existing source file onto XCode). I am trying design a UI so the user doesn't have to bring up a separate window. Is this done using a normal window and these are just display properties or is this done using a view? Such windows are called Sheets. Here are all the details: http://developer.apple.com/documentation/Cocoa/Conceptual/Sheets/Sheets.html more specifically http://developer.apple.com/documentation/Cocoa/Conceptual/Sheets/Tasks/UsingCustomSheets.html and http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSApplication_Class/Reference/Reference.html#/ /apple_ref/doc/uid/2012-BAJJGDJB Markus -- __ Markus Spoettl smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
moving subviews
Hello, I have a big document view. On it I place some small subviews. I f I scroll the document view, the subviews should move with it but only till it reaches the edge of the visible area of the main view. e.g: if i move the main view down, and the subview hits the scrollbar, it should stick there. is there a sane way of achieving this or do I better lock for an other behavior? Thanks Georg ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: moving subviews
Am Di,12.08.2008 um 09:49 schrieb Georg Seifert: down, and the subview hits the scrollbar, it should stick there. is there a sane way of achieving this or do I better lock for an other behavior? You can overwrite the origin-changing methods -setFrame: and - setFrameOrigin: of your document view to do recalculations of your subviews. The visible part of your document view is that one, that is covered by the content view (your superview, an instance of NSClipView). Please read the documentation about scrollviews to get a closer look to its view hierarchy. Du kannst die Methoden -setFrame: und -setFrameOrigin:, die den Ursprung verändern, überschreiben und dort die Lage deiner Subviews neu berechnen. Den sichtbaren Teil erhältst du als den Teil deines Dokumentenviews, der vom Content-View überdeckt wird. Lese noch einmal die Doku zu Scrollviews. Die Viewhierarchie wird dort genauer beschrieben. Grüße Amin Negm-Awad [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSTextField Bug? Can't be!
Right. I figure though that asking for stringValue grabs the text from the field editor, so why doesn't setEnabled do the same to commit current editing? Seems logical to me. I can't imagine a situation where you'd want text the user typed into a field to be ignored after they already typed it. -- Seth Willits On Aug 11, 2008, at 10:40 PM, Graham Cox wrote: I suspect it's because of the Field Editor. The text isn't really in the field, it's in the shared field editor. If the field is disabled, it won't be updated from the field editor because disabled means refuse input. Also, it may be that when a control that is using the field editor is disabled, it disconnects from the field editor and clears its contents. You could try calling -validateEditing on the field prior to disabling it, which should copy over the text content from the field editor so that the field indeed does have this value. hth, cheers, Graham On 12 Aug 2008, at 3:31 pm, Seth Willits wrote: If a text field has focus, you type blah blah blah into it, and then click a button which asks for its string value and disables the text field, you get blah blah blah back. If a text field has focus, you type blah blah blah into it, and then click a button which disables the text field first and then asks for its string value, you get an empty string... I can make up some reasoning in my head for why that'd make sense, but it just doesn't sit well with me. If the text is *IN THE FIELD* before the field is disabled, then clearly it should be considered its string value. I can't imagine this being a bug simply because *somebody* would have noticed and fixed it by now, but I can't understand why this would be desirable behavior. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: I don't understand why this is leaking...
On 9 Aug 2008, at 17:39:20 -0600, Jonathan deWerd [EMAIL PROTECTED]wrote: On Aug 9, 2008, at 4:48 PM, Cate Tony wrote: This code is leaking: - (void)saveItemExtensions:(id)sender { NSMutableString* itemExtensionsFilePath = [NSMutableString stringWithString:@~/Library/Preferences/MyApp/extensions.abc]; NSDictionary* extensions = [NSDictionary dictionaryWithDictionary: [itemDataSource itemExtensions]]; [itemExtensionsFilePath setString:[itemExtensionsFilePath stringByExpandingTildeInPath]]; [[NSArchiver archivedDataWithRootObject:extensions] itemExtensionsFilePath atomically: YES]; } - (void)encodeWithCoder:(NSCoder *)coder { [coder encodeObject: string1]; [coder encodeObject: string2]; [coder encodeObject: string3]; [coder encodeObject: string4]; [coder encodeObject: string5]; [coder encodeObject: string6]; [coder encodeObject: string7]; [coder encodeObject: string8]; } According to MallocDebug, the leak is in the encodeWithCoder method. Things I've tried: 1 [coder encodeObject: [string1 autorelease]]; Which, of course, caused a crash 2 [coder encodeObject: [string1 copy]]; no diff 3 [coder encodeObject: [[string1 copy] autorelease]]; no diff 4 Drinking beer... Can anyone explain this to me? Tony What is coder? It could be that coder is deferring the encoding (saving copies of string*), and then the coder itself is never getting released. Have Instruments make sure that the coder is actually going away after the encoding is done. Also check to make sure the encoded data is going away when it is no longer needed. Sometimes the leak isn't exactly where MallocDebug says the object was allocated: -retain increments the retain count as surly as -alloc. What do the individual string* histories look like in Instruments? Speaking of Instruments, could you give us (not the mailing list, I don't think it allows attachments, but you could email me separately) an instruments session to look at? It would greatly facilitate proceedings :) Also, why are you using non-keyed encoding? -encodeObject:forKey: is the preferred way of doing things nowadays... Well, it may be the preferred way, but it is not always the best, nor even the correct way. Two reasons: 1. the resulting files are much bigger 2. NSKeyedArchiver can only store certain strings (tested in 10.4.11), which makes it absolutely unusable for the storage of strings if the possible values are not known in advance. Kind regards, Gerriet. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: I don't understand why this is leaking...
Am Di,12.08.2008 um 10:42 schrieb Gerriet M. Denkmann: On 9 Aug 2008, at 17:39:20 -0600, Jonathan deWerd [EMAIL PROTECTED] wrote: On Aug 9, 2008, at 4:48 PM, Cate Tony wrote: This code is leaking: - (void)saveItemExtensions:(id)sender { NSMutableString* itemExtensionsFilePath = [NSMutableString stringWithString:@~/Library/Preferences/MyApp/extensions.abc]; NSDictionary* extensions = [NSDictionary dictionaryWithDictionary: [itemDataSource itemExtensions]]; [itemExtensionsFilePath setString:[itemExtensionsFilePath stringByExpandingTildeInPath]]; [[NSArchiver archivedDataWithRootObject:extensions] itemExtensionsFilePath atomically: YES]; } - (void)encodeWithCoder:(NSCoder *)coder { [coder encodeObject: string1]; [coder encodeObject: string2]; [coder encodeObject: string3]; [coder encodeObject: string4]; [coder encodeObject: string5]; [coder encodeObject: string6]; [coder encodeObject: string7]; [coder encodeObject: string8]; } According to MallocDebug, the leak is in the encodeWithCoder method. Things I've tried: 1 [coder encodeObject: [string1 autorelease]]; Which, of course, caused a crash 2 [coder encodeObject: [string1 copy]]; no diff 3 [coder encodeObject: [[string1 copy] autorelease]]; no diff 4 Drinking beer... Can anyone explain this to me? Tony What is coder? It could be that coder is deferring the encoding (saving copies of string*), and then the coder itself is never getting released. Have Instruments make sure that the coder is actually going away after the encoding is done. Also check to make sure the encoded data is going away when it is no longer needed. Sometimes the leak isn't exactly where MallocDebug says the object was allocated: - retain increments the retain count as surly as -alloc. What do the individual string* histories look like in Instruments? Speaking of Instruments, could you give us (not the mailing list, I don't think it allows attachments, but you could email me separately) an instruments session to look at? It would greatly facilitate proceedings :) Also, why are you using non-keyed encoding? -encodeObject:forKey: is the preferred way of doing things nowadays... Well, it may be the preferred way, but it is not always the best, nor even the correct way. Two reasons: 1. the resulting files are much bigger 2. NSKeyedArchiver can only store certain strings (tested in 10.4.11), which makes it absolutely unusable for the storage of strings if the possible values are not known in advance. Do you have an example for that? Amin Kind regards, Gerriet. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/negm-awad%40cocoading.de This email sent to [EMAIL PROTECTED] Amin Negm-Awad [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Should I retain a variable returned from this accessor?
Am Di,12.08.2008 um 04:51 schrieb Peter N Lewis: At 4:48 PM -0400 11/8/08, Kyle Sluder wrote: On Mon, Aug 11, 2008 at 3:12 PM, Sean DeNigris [EMAIL PROTECTED] wrote: Hi, how do I handle memory management for todoUid below? Do I have to retain or autorelease it? [...snip...] // Get uid to return NSString* todoUid = [newTodo uid]; [...snip...] return todoUid; } http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Tasks/MemoryManagementRules.html You've gotten todoUid from a method that is not +alloc and does not begin with +new or contain -copy, so you do not own it. Therefore you must -retain it if you want to hold on to it beyond now. Since you don't, just let it go, it's not your responsibility. That's it. Done. I'm no Cocoa expert, but I think you're wrong on this, you've missed out a crucial line: At 3:12 PM -0400 11/8/08, Sean DeNigris wrote: // Get uid to return NSString* todoUid = [newTodo uid]; // Clean up [newTodo release]; newTodo = nil; return todoUid; [newTodo release] is not [newTodo autorelease]. So it may immediately call dealloc and dealloc the uid returned by by [newTodo uid]. To avoid this, you could do: NSString* todoUid = [[[newTodo uid] retain] autorelease]; It is quite possible that [newTodo uid] does exactly the above, but it might just return the internal ivar. If this is not true, I would very much like to be corrected! Advice on this list that I think is good advice is to always use autorelease unless there is really good reason not to YES! Many, many of memory managemt problems are solved with this technique. BTW: You can do the same inside a getter to get rid of thread problems. (eg, with a large number of objects in a loop). A -retain (+alloc, +new) release pair is no solution even in that situation, because nobody knows, whether the newly allocated object uses -autorelease itself. So with an immediate -release you get rid of the top level instances, but not of the related ones. for( … ) // 10.000.000 times { id instance = [[Instance alloc] init]; // allocates 10 helper instances, autoreleased // Do something [instance release]; // helpers are still alive! } The only working solution is to drain a new ARP inside the loop. Amin Then you would solve your problem like this: - (NSString*) saveToiCalTodo: (NSString*) theSummary : (id) theDescription { // Create new iCal todo iCalTodo* newTodo = iCal classForScriptingClass:@todo] alloc] init] autorelease]; // Add the todo to my iCal calendar [[myCalendar todos] addObject:newTodo]; // Set its summary [newTodo setSummary:theSummary]; // Store description [newTodo setObjectDescription: theDescription]; // Get uid to return NSString* todoUid = [newTodo uid]; return todoUid; } By using autorelease when you alloc the object, you avoid a bunch of possible bugs and simplify your code. Now: * if you return early for any reason, newTodo wont leak * todoUid remains valid at least until newTodo is released by the autorelease pool * Your code has less memory management routines cluttering it up and so is clearer and more appropriate for GC. But as I say, I'm no Cocoa expert, so I could be wrong. Enjoy, Peter. -- Keyboard Maestro 3 Now Available! Now With Status Menu triggers! Keyboard Maestro http://www.keyboardmaestro.com/ Macros for your Mac http://www.stairways.com/ http://download.stairways.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/negm-awad%40cocoading.de This email sent to [EMAIL PROTECTED] Amin Negm-Awad [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Get specified window from nib
Thanks!.. I tried and it can get all objects.. But It's strange that I don't find APIs of NSWindow to get its name which is shown in the Interfact Builder.. Those objects have different name in the IB and I want to get one specific window from the top object array... Is there other methods to get it? Thanks! On Mon, Aug 11, 2008 at 10:07 AM, Graham Perks [EMAIL PROTECTED] wrote: On Aug 10, 2008, at 9:01 PM, Fosse wrote: I have one nib containing more than ten dialogs and want to get the specified window after nib is loading.. Perhaps NSNib's instantiateNibWithOwner:(id)owner topLevelObjects:(NSArray **)topLevelObjects ? You'll get an array of top level objects, which will presumably contain your dialogs... If it were me I'd just join them up in IB. You only need to do it once. Graham. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: I don't understand why this is leaking...
On 12 Aug 2008, at 6:42 pm, Gerriet M. Denkmann wrote: 2. NSKeyedArchiver can only store certain strings (tested in 10.4.11), which makes it absolutely unusable for the storage of strings if the possible values are not known in advance. Eh? That's just not true. Can you provide an example of a string that it can't store? Anything that's NSCoding compliant can be stored, and NSString is. I'm sure if it weren't someone would have raised merry hell about it before now. Something's fishy... As for file sizes, is that really all that relevant these days? Archives don't store huge amount of overhead compared to the data itself - saving a few bytes here and there is not worth the pain of losing the convenience of keyed archiving. Non-keyed archiving produces inherently very fragile file formats, which are a lot of work to maintain. Keyed archiving on the other hand, makes handling format changes trivial. cheers, Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Get specified window from nib
On 12 Aug 2008, at 8:15 pm, Fosse wrote: But It's strange that I don't find APIs of NSWindow to get its name which is shown in the Interfact Builder.. Those objects have different name in the IB and I want to get one specific window from the top object array... Is there other methods to get it? No. The names assigned to objects in Interface Builder have nothing to do with anything. They are just names that help you label things in a nib so you can figure out what's what *within IB*. They are not used by any code, yours or Cocoa's. This appears to be a common misunderstanding. The right (and in fact only) way to reference an object within a nib is to connect it to an outlet declared by your File's Owner object. hth, cheers, Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: I don't understand why this is leaking...
On 12 Aug 2008, at 15:50, Negm-Awad Amin wrote: Am Di,12.08.2008 um 10:42 schrieb Gerriet M. Denkmann: On 9 Aug 2008, at 17:39:20 -0600, Jonathan deWerd [EMAIL PROTECTED]wrote: On Aug 9, 2008, at 4:48 PM, Cate Tony wrote: [...] Also, why are you using non-keyed encoding? -encodeObject:forKey: is the preferred way of doing things nowadays... Well, it may be the preferred way, but it is not always the best, nor even the correct way. Two reasons: 1. the resulting files are much bigger 2. NSKeyedArchiver can only store certain strings (tested in 10.4.11), which makes it absolutely unusable for the storage of strings if the possible values are not known in advance. Do you have an example for that? Yes, I have. 1. Simple Test: In IB create new window, add NSTextField with content $null (without the quotes) save in 10.2 or later format. Close. Open again. Look at your string. 2. A whole new project: - main.m -- #import Foundation/Foundation.h #import TwoStrings.h int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSString *s1 = @$null; // NSKeyedArchiver cannot handle this - last tested 10.4.11 NSString *s2 = @$Null; TwoStrings *to = [ [ TwoStrings alloc ] initWith: s1 and: s2 ]; NSLog(@ original: %@, to); NSData *dataA = [ NSArchiver archivedDataWithRootObject: to ]; TwoStrings *ta = [ NSUnarchiver unarchiveObjectWithData: dataA ]; NSLog(@ Archiver: %@ %3u bytes, ta, [ dataA length ]); NSData *dataK = [ NSKeyedArchiver archivedDataWithRootObject: to ]; TwoStrings *tk = [ NSKeyedUnarchiver unarchiveObjectWithData: dataK ]; NSLog(@ KeyedArchiver: %@ %3u bytes, tk, [ dataK length ]); [pool release]; return 0; } - TwoStrings.h -- @interface TwoStrings : NSObject { NSString *s1; NSString *s2; } - initWith:(NSString *)sender and: (NSString *)s ; @end - TwoStrings.m -- #import TwoStrings.h @implementation TwoStrings - initWith:(NSString *)sender and: (NSString *)s ; { self = [ super init ]; if ( self == nil ) return nil; s1 = [ sender retain ]; s2 = [ s retain ]; return self; } - (void)dealloc { [ s1 release ]; [ s2 release ]; [ super dealloc ]; } - (NSString *)description { NSString *s = [ NSString stringWithFormat: @%@ %p s1=\[EMAIL PROTECTED] s1=\%@ \,[ self class], self, s1, s2 ]; return s; } - (void)encodeWithCoder:(NSCoder *)coder { //[super encodeWithCoder:coder]; // not for direct subclasses of NSObject if ( [coder allowsKeyedCoding] ) { [ coder encodeObject: s1forKey: @s1 ]; [ coder encodeObject: s2forKey: @s2 ]; } else { [ coder encodeObject: s1 ]; [ coder encodeObject: s2 ]; }; } - (id)initWithCoder:(NSCoder *)decoder { //self = [super initWithCoder:decoder]; // not for direct subclasses of NSObject if ( [decoder allowsKeyedCoding] ) { s1 = [ decoder decodeObjectForKey: @s1 ]; s2 = [ decoder decodeObjectForKey: @s2 ]; } else { s1 = [ decoder decodeObject ]; s2 = [ decoder decodeObject ]; }; [ s1 retain ]; [ s2 retain ]; return self; } @end - End of project -- Maybe this will work on Leopard. On Tiger it does not. (No crash, nor error message either). Kind regards, Gerriet. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Get specified window from nib
On Aug 10, 2008, at 10:07 PM, Graham Perks wrote: On Aug 10, 2008, at 9:01 PM, Fosse wrote: I have one nib containing more than ten dialogs and want to get the specified window after nib is loading.. Perhaps NSNib's instantiateNibWithOwner:(id)owner topLevelObjects: (NSArray **)topLevelObjects ? You'll get an array of top level objects, which will presumably contain your dialogs... If it were me I'd just join them up in IB. You only need to do it once. Graham. What did you think of Graham Perks's suggestion to use NSNib to load the nib file? I haven't used NSNib myself -- only glanced at the docs -- but I believe it's the only way to get your program to know about the names you assigned your windows in IB. So if you rely on those names to pick the one you want, you're going to be stuck retyping them somewhere anyway, whether to make them into outlets or some other place. If there's some other attribute of the window you can use to select them, like a unique window title, one possibility is to scan the window list. See the NSWindowList() function. This assumes you only load the nib once and the window names are unique application-wide and they never change. --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 [EMAIL PROTECTED]
Re: I don't understand why this is leaking...
On 12 Aug 2008, at 17:19, Graham Cox wrote: On 12 Aug 2008, at 6:42 pm, Gerriet M. Denkmann wrote: 2. NSKeyedArchiver can only store certain strings (tested in 10.4.11), which makes it absolutely unusable for the storage of strings if the possible values are not known in advance. Eh? That's just not true. Well, this is a bold statement. Can you prove it? Can you provide an example of a string that it can't store? What about your previous sentence, if I could? Anything that's NSCoding compliant can be stored, and NSString is. Well, I admit that all NSStrings should be able to be stored. I'm sure if it weren't someone would have raised merry hell about it before now. Something's fishy... Reminds of a very rational being walking the streets with his son. The son: Hey dad, there's a hundred dollar note! Dad: No son, this cannot be. If the note were real, somebody would have picked it up long ago. As for file sizes, is that really all that relevant these days? Archives don't store huge amount of overhead compared to the data itself - saving a few bytes here and there is not worth the pain of losing the convenience of keyed archiving. A factor of two or three may be considered a few bytes here and there or might amount to some pain. All according to taste and situation. Non-keyed archiving produces inherently very fragile file formats, which are a lot of work to maintain. Keyed archiving on the other hand, makes handling format changes trivial. This is absolutely correct. Kind regards, Gerriet. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: I don't understand why this is leaking...
On 12 Aug 2008, at 8:40 pm, Gerriet M. Denkmann wrote: I'm sure if it weren't someone would have raised merry hell about it before now. Something's fishy... Reminds of a very rational being walking the streets with his son. The son: Hey dad, there's a hundred dollar note! Dad: No son, this cannot be. If the note were real, somebody would have picked it up long ago. OK, fair comment. But let's look at the string you can't store: $null This reminds *me* of the old joke: Doctor, doctor, it hurts when I do this! (...) Well, don't do that then... If that's the one string you can't store, presumably because it's used as a marker within the archive, then don't try to store what is a reserved byte sequence. For its purpose, you can find an easy way around it. What you seemed to be implying was that there is a whole class of string sequences that broke keyed archiving, which of course would be far worse than this one apparently reserved string. If you need to store $null, just substitute another string to stand for it, archive that, and reverse the substitution when you decode. If that is the argument between using keyed versus non-keyed archiving, it's an awful lot to lose for a very minor inconvenience for this one case. And, yes, I would probably agree that Apple should be performing this substitution in their code rather than exposing this bug - but then again it would only be shifting the problem onto whatever substitution string they chose, though that could be made very much less likely to collide. As for file sizes, is that really all that relevant these days? Archives don't store huge amount of overhead compared to the data itself - saving a few bytes here and there is not worth the pain of losing the convenience of keyed archiving. A factor of two or three may be considered a few bytes here and there or might amount to some pain. All according to taste and situation. True enough, but. A factor of two or three? Depends on what your data is. If you're archiving a large image or video sequence, the archive overhead is going to be an infinitesimal fraction of this. And if not, then you're likely talking about small files anyway. 10K or 30K? It hardly matters. Even if 20K of the file is not data, who cares? I know I'm willing to spend 20K (or even 200K) to read the remaining 10K (or 100K) so very conveniently. Last time I cared about 10K versus 30K was when Macs had an optional external 20MB(!) Hard Disk and 800K floppies. So yes, according to your taste and situation. But surely the pain of using non-keyed archiving *by far* outweighs these considerations? cheers, Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSTextField Bug? Can't be!
Seems to me that this might be more to do with the responder chain. The NSTextField will update its stringValue when it resigns as first responder. An NSButton does not accept first responder status so the NSTextField never gets to resign first responder status. If you are using NSViewController call -commitEditing in your button click method. This will commit any pending edits. Otherwise send -makeFirstResponder: to the view's window with the window itself as the argument. Similar effect. This situation happens frequently. It's one good reason to always use NSViewController. Check out NSEditor (Informal Protocol) and NSEditorRegistration (Informal Protocol) for the low down. Jonathan. FROM : Seth Willits DATE : Tue Aug 12 10:28:30 2008 Right. I figure though that asking for stringValue grabs the text from the field editor, so why doesn't setEnabled do the same to commit current editing? Seems logical to me. I can't imagine a situation where you'd want text the user typed into a field to be ignored after they already typed it. -- Seth Willits On Aug 11, 2008, at 10:40 PM, Graham Cox wrote: I suspect it's because of the Field Editor. The text isn't really in the field, it's in the shared field editor. If the field is disabled, it won't be updated from the field editor because disabled means refuse input. Also, it may be that when a control that is using the field editor is disabled, it disconnects from the field editor and clears its contents. You could try calling -validateEditing on the field prior to disabling it, which should copy over the text content from the field editor so that the field indeed does have this value. hth, cheers, Graham On 12 Aug 2008, at 3:31 pm, Seth Willits wrote: If a text field has focus, you type blah blah blah into it, and then click a button which asks for its string value and disables the text field, you get blah blah blah back. If a text field has focus, you type blah blah blah into it, and then click a button which disables the text field first and then asks for its string value, you get an empty string... I can make up some reasoning in my head for why that'd make sense, but it just doesn't sit well with me. If the text is *IN THE FIELD* before the field is disabled, then clearly it should be considered its string value. I can't imagine this being a bug simply because *somebody* would have noticed and fixed it by now, but I can't understand why this would be desirable behavior. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: I don't understand why this is leaking...
Probably $null is a reserved word. -encodeWithCoder: (NSString) and - initWithCoder: (NSString) should escape that. No good … Amin Am Di,12.08.2008 um 12:25 schrieb Gerriet M. Denkmann: On 12 Aug 2008, at 15:50, Negm-Awad Amin wrote: Am Di,12.08.2008 um 10:42 schrieb Gerriet M. Denkmann: On 9 Aug 2008, at 17:39:20 -0600, Jonathan deWerd [EMAIL PROTECTED] wrote: On Aug 9, 2008, at 4:48 PM, Cate Tony wrote: [...] Also, why are you using non-keyed encoding? -encodeObject:forKey: is the preferred way of doing things nowadays... Well, it may be the preferred way, but it is not always the best, nor even the correct way. Two reasons: 1. the resulting files are much bigger 2. NSKeyedArchiver can only store certain strings (tested in 10.4.11), which makes it absolutely unusable for the storage of strings if the possible values are not known in advance. Do you have an example for that? Yes, I have. 1. Simple Test: In IB create new window, add NSTextField with content $null (without the quotes) save in 10.2 or later format. Close. Open again. Look at your string. 2. A whole new project: - main.m -- #import Foundation/Foundation.h #import TwoStrings.h int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSString *s1 = @$null; // NSKeyedArchiver cannot handle this - last tested 10.4.11 NSString *s2 = @$Null; TwoStrings *to = [ [ TwoStrings alloc ] initWith: s1 and: s2 ]; NSLog(@ original: %@, to); NSData *dataA = [ NSArchiver archivedDataWithRootObject: to ]; TwoStrings *ta = [ NSUnarchiver unarchiveObjectWithData: dataA ]; NSLog(@ Archiver: %@ %3u bytes, ta, [ dataA length ]); NSData *dataK = [ NSKeyedArchiver archivedDataWithRootObject: to ]; TwoStrings *tk = [ NSKeyedUnarchiver unarchiveObjectWithData: dataK ]; NSLog(@ KeyedArchiver: %@ %3u bytes, tk, [ dataK length ]); [pool release]; return 0; } - TwoStrings.h -- @interface TwoStrings : NSObject { NSString *s1; NSString *s2; } - initWith:(NSString *)sender and: (NSString *)s ; @end - TwoStrings.m -- #import TwoStrings.h @implementation TwoStrings - initWith:(NSString *)sender and: (NSString *)s ; { self = [ super init ]; if ( self == nil ) return nil; s1 = [ sender retain ]; s2 = [ s retain ]; return self; } - (void)dealloc { [ s1 release ]; [ s2 release ]; [ super dealloc ]; } - (NSString *)description { NSString *s = [ NSString stringWithFormat: @%@ %p s1=\[EMAIL PROTECTED] s1= \[EMAIL PROTECTED],[ self class], self, s1, s2 ]; return s; } - (void)encodeWithCoder:(NSCoder *)coder { //[super encodeWithCoder:coder]; // not for direct subclasses of NSObject if ( [coder allowsKeyedCoding] ) { [ coder encodeObject: s1forKey: @s1 ]; [ coder encodeObject: s2forKey: @s2 ]; } else { [ coder encodeObject: s1 ]; [ coder encodeObject: s2 ]; }; } - (id)initWithCoder:(NSCoder *)decoder { //self = [super initWithCoder:decoder]; // not for direct subclasses of NSObject if ( [decoder allowsKeyedCoding] ) { s1 = [ decoder decodeObjectForKey: @s1 ]; s2 = [ decoder decodeObjectForKey: @s2 ]; } else { s1 = [ decoder decodeObject ]; s2 = [ decoder decodeObject ]; }; [ s1 retain ]; [ s2 retain ]; return self; } @end - End of project -- Maybe this will work on Leopard. On Tiger it does not. (No crash, nor error message either). Kind regards, Gerriet. Amin Negm-Awad [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: I don't understand why this is leaking...
On Tue, Aug 12, 2008 at 10:25 PM, Gerriet M. Denkmann [EMAIL PROTECTED] wrote: Yes, I have. 1. Simple Test: In IB create new window, add NSTextField with content $null (without the quotes) save in 10.2 or later format. Close. Open again. Look at your string. [...] Maybe this will work on Leopard. On Tiger it does not. (No crash, nor error message either). I tested this in Leopard, 2.x NIBs have this problem, but 3.X NIBs and XIBs do not. It looks like it was a bug that's fixed in Leopard, but preserved in some cases for backwards compatability. Although, I wouldn't consider this bug much of a reason for not using keyed archiving. Even though NS(Un)Archiver aren't deprecated, they have been replaced. Phil ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: I don't understand why this is leaking...
On 12 Aug 2008, at 18:26, Negm-Awad Amin wrote: Probably $null is a reserved word. -encodeWithCoder: (NSString) and -initWithCoder: (NSString) should escape that. No good … Wenn es das wäre, dann hätte man das sicherlich documentiert. (This as a challenge for our English-speaking (or should one say: germanilly challenged ?) list-members). Herzliche Grüße aus Bangkok Gerriet. A: Yes. | Q: Are you sure? | | A: Because it reverses the logical flow of conversation. | | | Q: Why is top posting frowned upon? Amin Am Di,12.08.2008 um 12:25 schrieb Gerriet M. Denkmann: On 12 Aug 2008, at 15:50, Negm-Awad Amin wrote: Am Di,12.08.2008 um 10:42 schrieb Gerriet M. Denkmann: On 9 Aug 2008, at 17:39:20 -0600, Jonathan deWerd [EMAIL PROTECTED]wrote: On Aug 9, 2008, at 4:48 PM, Cate Tony wrote: [...] Also, why are you using non-keyed encoding? - encodeObject:forKey: is the preferred way of doing things nowadays... Well, it may be the preferred way, but it is not always the best, nor even the correct way. Two reasons: 1. the resulting files are much bigger 2. NSKeyedArchiver can only store certain strings (tested in 10.4.11), which makes it absolutely unusable for the storage of strings if the possible values are not known in advance. Do you have an example for that? Yes, I have. 1. Simple Test: In IB create new window, add NSTextField with content $null (without the quotes) save in 10.2 or later format. Close. Open again. Look at your string. 2. A whole new project: - main.m -- #import Foundation/Foundation.h #import TwoStrings.h int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSString *s1 = @$null; // NSKeyedArchiver cannot handle this - last tested 10.4.11 NSString *s2 = @$Null; TwoStrings *to = [ [ TwoStrings alloc ] initWith: s1 and: s2 ]; NSLog(@ original: %@, to); NSData *dataA = [ NSArchiver archivedDataWithRootObject: to ]; TwoStrings *ta = [ NSUnarchiver unarchiveObjectWithData: dataA ]; NSLog(@ Archiver: %@ %3u bytes, ta, [ dataA length ]); NSData *dataK = [ NSKeyedArchiver archivedDataWithRootObject: to ]; TwoStrings *tk = [ NSKeyedUnarchiver unarchiveObjectWithData: dataK ]; NSLog(@ KeyedArchiver: %@ %3u bytes, tk, [ dataK length ]); [pool release]; return 0; } - TwoStrings.h -- @interface TwoStrings : NSObject { NSString *s1; NSString *s2; } - initWith:(NSString *)sender and: (NSString *)s ; @end - TwoStrings.m -- #import TwoStrings.h @implementation TwoStrings - initWith:(NSString *)sender and: (NSString *)s ; { self = [ super init ]; if ( self == nil ) return nil; s1 = [ sender retain ]; s2 = [ s retain ]; return self; } - (void)dealloc { [ s1 release ]; [ s2 release ]; [ super dealloc ]; } - (NSString *)description { NSString *s = [ NSString stringWithFormat: @%@ %p s1=\[EMAIL PROTECTED] s1= \[EMAIL PROTECTED],[ self class], self, s1, s2 ]; return s; } - (void)encodeWithCoder:(NSCoder *)coder { //[super encodeWithCoder:coder]; // not for direct subclasses of NSObject if ( [coder allowsKeyedCoding] ) { [ coder encodeObject: s1forKey: @s1 ]; [ coder encodeObject: s2forKey: @s2 ]; } else { [ coder encodeObject: s1 ]; [ coder encodeObject: s2 ]; }; } - (id)initWithCoder:(NSCoder *)decoder { //self = [super initWithCoder:decoder]; // not for direct subclasses of NSObject if ( [decoder allowsKeyedCoding] ) { s1 = [ decoder decodeObjectForKey: @s1 ]; s2 = [ decoder decodeObjectForKey: @s2 ]; } else { s1 = [ decoder decodeObject ]; s2 = [ decoder decodeObject ]; }; [ s1 retain ]; [ s2 retain ]; return self; } @end - End of project -- Maybe this will work on Leopard. On Tiger it does not. (No crash, nor error message either). Kind regards, Gerriet. Amin Negm-Awad [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: I don't understand why this is leaking...
On 12 Aug 2008, at 18:05, Graham Cox wrote: On 12 Aug 2008, at 8:40 pm, Gerriet M. Denkmann wrote: I'm sure if it weren't someone would have raised merry hell about it before now. Something's fishy... Reminds of a very rational being walking the streets with his son. The son: Hey dad, there's a hundred dollar note! Dad: No son, this cannot be. If the note were real, somebody would have picked it up long ago. OK, fair comment. But let's look at the string you can't store: $null This reminds *me* of the old joke: Doctor, doctor, it hurts when I do this! (...) Well, don't do that then... If that's the one string you can't store, presumably because it's used as a marker within the archive, then don't try to store what is a reserved byte sequence. It it were a reserved word, it would be documented so. Fact is, there is absolutly no need for reserved words. Nil should be stored as a reference to $objects[0], which is incidentally (as it has to be something) a string with value $null. And on unarchiving the unarchiver should check whether the string is a reference to the first object (and return nil) or else return its value (be it $null or whatever). Checking the value and returning nil if it is $null is a rather silly bug. For its purpose, you can find an easy way around it. What you seemed to be implying was that there is a whole class of string sequences that broke keyed archiving, which of course would be far worse than this one apparently reserved string. Yes, my statement: can store only certain strings while absolutely correct, was kind of sensational. And I admit that there are situations where the convenience of keyed archiving outweights the memory bloat (even *by far*) - and that there are other situation where it is more important to keep files or memory small. Kind regards, Gerriet. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: I don't understand why this is leaking...
Am Di,12.08.2008 um 14:11 schrieb Gerriet M. Denkmann: On 12 Aug 2008, at 18:26, Negm-Awad Amin wrote: Probably $null is a reserved word. -encodeWithCoder: (NSString) and -initWithCoder: (NSString) should escape that. No good … Wenn es das wäre, dann hätte man das sicherlich documentiert. (This as a challenge for our English-speaking (or should one say: germanilly challenged ?) list-members). The challenglish continues :-) Ich denke, dass man das einfach nicht bedacht hat. Vom Standpunkt von NSString existiert dieses Problem ja nicht. Erst in Verbindung mit dem Coder wird dieser das anders interpretieren. Aber gut, dass es gefixt ist. So etwas kann einen ja in den Wahnsinn treiben. Herzliche Grüße aus Bangkok Liebe Grüße Amin Gerriet. A: Yes. | Q: Are you sure? | | A: Because it reverses the logical flow of conversation. | | | Q: Why is top posting frowned upon? Amin Am Di,12.08.2008 um 12:25 schrieb Gerriet M. Denkmann: On 12 Aug 2008, at 15:50, Negm-Awad Amin wrote: Am Di,12.08.2008 um 10:42 schrieb Gerriet M. Denkmann: On 9 Aug 2008, at 17:39:20 -0600, Jonathan deWerd [EMAIL PROTECTED] wrote: On Aug 9, 2008, at 4:48 PM, Cate Tony wrote: [...] Also, why are you using non-keyed encoding? - encodeObject:forKey: is the preferred way of doing things nowadays... Well, it may be the preferred way, but it is not always the best, nor even the correct way. Two reasons: 1. the resulting files are much bigger 2. NSKeyedArchiver can only store certain strings (tested in 10.4.11), which makes it absolutely unusable for the storage of strings if the possible values are not known in advance. Do you have an example for that? Yes, I have. 1. Simple Test: In IB create new window, add NSTextField with content $null (without the quotes) save in 10.2 or later format. Close. Open again. Look at your string. 2. A whole new project: - main.m -- #import Foundation/Foundation.h #import TwoStrings.h int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSString *s1 = @$null; // NSKeyedArchiver cannot handle this - last tested 10.4.11 NSString *s2 = @$Null; TwoStrings *to = [ [ TwoStrings alloc ] initWith: s1 and: s2 ]; NSLog(@ original: %@, to); NSData *dataA = [ NSArchiver archivedDataWithRootObject: to ]; TwoStrings *ta = [ NSUnarchiver unarchiveObjectWithData: dataA ]; NSLog(@ Archiver: %@ %3u bytes, ta, [ dataA length ]); NSData *dataK = [ NSKeyedArchiver archivedDataWithRootObject: to ]; TwoStrings *tk = [ NSKeyedUnarchiver unarchiveObjectWithData: dataK ]; NSLog(@ KeyedArchiver: %@ %3u bytes, tk, [ dataK length ]); [pool release]; return 0; } - TwoStrings.h -- @interface TwoStrings : NSObject { NSString *s1; NSString *s2; } - initWith:(NSString *)sender and: (NSString *)s ; @end - TwoStrings.m -- #import TwoStrings.h @implementation TwoStrings - initWith:(NSString *)sender and: (NSString *)s ; { self = [ super init ]; if ( self == nil ) return nil; s1 = [ sender retain ]; s2 = [ s retain ]; return self; } - (void)dealloc { [ s1 release ]; [ s2 release ]; [ super dealloc ]; } - (NSString *)description { NSString *s = [ NSString stringWithFormat: @%@ %p s1=\[EMAIL PROTECTED] s1= \[EMAIL PROTECTED],[ self class], self, s1, s2 ]; return s; } - (void)encodeWithCoder:(NSCoder *)coder { //[super encodeWithCoder:coder]; // not for direct subclasses of NSObject if ( [coder allowsKeyedCoding] ) { [ coder encodeObject: s1forKey: @s1 ]; [ coder encodeObject: s2forKey: @s2 ]; } else { [ coder encodeObject: s1 ]; [ coder encodeObject: s2 ]; }; } - (id)initWithCoder:(NSCoder *)decoder { //self = [super initWithCoder:decoder]; // not for direct subclasses of NSObject if ( [decoder allowsKeyedCoding] ) { s1 = [ decoder decodeObjectForKey: @s1 ]; s2 = [ decoder decodeObjectForKey: @s2 ]; } else { s1 = [ decoder decodeObject ]; s2 = [ decoder decodeObject ]; }; [ s1 retain ]; [ s2 retain ]; return self; } @end - End of project -- Maybe this will work on Leopard. On Tiger it does not. (No crash, nor error message either). Kind regards, Gerriet. Amin Negm-Awad [EMAIL PROTECTED] Amin Negm-Awad [EMAIL PROTECTED]
Create a calendar group using CalendarStore framework
Hello List, Does anyone know if it is possible to programmatically create a group of calendars in the OS X calendar store (File / New Calendar Group in iCal) using the CalendarStore framework? I did not find any reference to groups in the documentation. After manually creating a calendar group in iCal I tried looping through [[CalCalendarStore defaultCalendarStore] calendars], but this only returns actual calendars - calendar groups are not present. Any ideas? Alain ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Create a calendar group using CalendarStore framework
Referring to the calendar store objects figure the groups seem to be entities of iCal. Of course you can do scripting. Worth? Amin Am Di,12.08.2008 um 14:18 schrieb Alain Schartz: Hello List, Does anyone know if it is possible to programmatically create a group of calendars in the OS X calendar store (File / New Calendar Group in iCal) using the CalendarStore framework? I did not find any reference to groups in the documentation. After manually creating a calendar group in iCal I tried looping through [[CalCalendarStore defaultCalendarStore] calendars], but this only returns actual calendars - calendar groups are not present. Any ideas? Alain ___ 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/negm-awad%40cocoading.de This email sent to [EMAIL PROTECTED] Amin Negm-Awad [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Should I retain a variable returned from this accessor?
Am Di,12.08.2008 um 14:37 schrieb Sean DeNigris: Hi, how do I handle memory management for todoUid below? Do I have to retain or autorelease it? [...snip...] // Get uid to return NSString* todoUid = [newTodo uid]; [...snip...] return todoUid; } you could do: NSString* todoUid = [[[newTodo uid] retain] autorelease]; YES! Many, many of memory managemt problems are solved with this technique. BTW: You can do the same inside a getter to get rid of thread problems. Is the performance hit of keeping objects around until the next pool drain (instead of releasing them when you're done with them) insignificant? In most cases: Yes. You can recognize the other cases after checking it. (Insert quotation of Donald Knuth here). More: As I wrote, releasing the allocated object let this object disappear. It does not free any object that had been allocated in the autorelease pool, when the released object was constructed. The isolated -release is a king of prying. So the solution is not to send some release-messages to anything aorund, trying to hit one or another object, but using a custom ARP. In other words, should it be a practice to always autorelease with alloc and init (except for loops as previously mentioned)? Amin Negm-Awad [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSImage and zooming PDFs vs. bitmaps
On 11 Aug 2008, at 17:52, Ken Ferry wrote: A combination of -setDataRetained: on image loading and -recache on zooming did the trick, although I did need to kludge in a size check before calling -recache as rasterising an entire PDF above ~10,000x10,000 quickly gets painful performance- and memory-wise. For drawing that would lead to a very large raster cache, NSImage prefers to draw directly from the source rather than make a cache. That would make lots of sense. Unfortunately it isn't doing it for me, and if the image is big enough a memory error occurs. However, it sounds like this isn't doing it for you. Could you file a bug with a demonstration app? Done. Filed as bug ID# 6143188 (NSImage caching and vector images: out- of-memory error). Perhaps you could try just turning caching off, or turning it off when the scale factor is high? Just tried this as-per your suggestion, but - setCacheMode:NSImageCacheNever doesn't appear to have any effect as the NSImage continues to create and use a raster cache. Filed as bug ID# 6143199 (NSImage caching and vector images: -setCacheMode: ignored). I also ran into a third problem while writing demos for the first two: NSImages created via +imageNamed: constructor appear to ignore - setDataRetained:YES. Filed as bug ID# 6143194 (NSImage caching and vector images: -setDataRetained: ignored). Also, sorry, there's nothing built-in that caches partial images or holds caches for multiple destination sizes. Okay, I can probably kludge something if I have to, although when zoomed in it would be much better if NSImage just drew the visible portion of the PDF directly as you say it should. In the meantime, given the problems I'm having with NSImage's caching behaviour, any suggestions on how else I could draw PDF/EPS files into nested, Core Animation-enabled NSViews? Many thanks, Hamish -- Hamish Sanderson Production Workflow Developer Sun Branding Solutions Ltd Tel: +44(0)1274 200 700 www.s-brandingsolutions.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 [EMAIL PROTECTED]
Re: I don't understand why this is leaking...
On Aug 12, 2008, at 4:49 AM, Phil wrote: On Tue, Aug 12, 2008 at 10:25 PM, Gerriet M. Denkmann [EMAIL PROTECTED] wrote: Yes, I have. 1. Simple Test: In IB create new window, add NSTextField with content $null (without the quotes) save in 10.2 or later format. Close. Open again. Look at your string. [...] Maybe this will work on Leopard. On Tiger it does not. (No crash, nor error message either). I tested this in Leopard, 2.x NIBs have this problem, but 3.X NIBs and XIBs do not. It looks like it was a bug that's fixed in Leopard, but preserved in some cases for backwards compatability. Although, I wouldn't consider this bug much of a reason for not using keyed archiving. Even though NS(Un)Archiver aren't deprecated, they have been replaced. Sequential archives are still required for Distributed Objects, since NSPortCoder doesn't support keyed archiving. This is in spite of the AppKit release notes comment By the way, in case you missed it, you should really be using keyed archiving. -- Adam smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Should I retain a variable returned from this accessor?
On Mon, Aug 11, 2008 at 10:51 PM, Peter N Lewis [EMAIL PROTECTED] wrote: [newTodo release] is not [newTodo autorelease]. So it may immediately call dealloc and dealloc the uid returned by by [newTodo uid]. You're right about this; I did miss the -release. --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 [EMAIL PROTECTED]
Re: Tidying NSURLs Containing XML
On Tue, Aug 12, 2008 at 1:45 AM, Mike [EMAIL PROTECTED] wrote: I think what I want is -stringByAddingPercentEscapesUsingEncoding: That is the exact method that Ken referred to. --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 [EMAIL PROTECTED]
Re: I don't understand why this is leaking...
On Aug 12, 2008, at 07:49 , Phil wrote: On Tue, Aug 12, 2008 at 10:25 PM, Gerriet M. Denkmann [EMAIL PROTECTED] wrote: Yes, I have. 1. Simple Test: In IB create new window, add NSTextField with content $null (without the quotes) save in 10.2 or later format. Close. Open again. Look at your string. [...] Maybe this will work on Leopard. On Tiger it does not. (No crash, nor error message either). I tested this in Leopard, 2.x NIBs have this problem, but 3.X NIBs and XIBs do not. It looks like it was a bug that's fixed in Leopard, but preserved in some cases for backwards compatability. Although, I wouldn't consider this bug much of a reason for not using keyed archiving. Even though NS(Un)Archiver aren't deprecated, they have been replaced. Just for fun I tested the example program built from the command line in Leopard (10.5.4 9E17) running XCode 3.1 (latest build) and the current Foundation library... the problem as demonstrated by the example code still exists... the string @$null gets decoded as a nil pointer instead of a string with the word $null. Jason smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Thread deadlock?
In the middle of the thread processing, I need to do some processing on a downloaded file. The file may be in the middle of being downloaded, so I need to possibly block until it is ready, then have the main thread do some work, and return to the thread. Which thread is doing the download? The main thread? Or a 3rd thread? I think you need to describe to us the exact complete high-level flow. -- Scott Ribe [EMAIL PROTECTED] http://www.killerbytes.com/ (303) 722-0567 voice ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: best graphics API for 2D game
On Aug 12, 2008, at 5:18 AM, Seth Willits wrote: On Aug 11, 2008, at 6:23 PM, steph thirion wrote: I'm new to cocoa, and I'd need a pointer to get started learning and experimenting. What would be the most adequate graphics cocoa API to render a 2D game? core graphics or opengl? The requirements would be a relatively smooth frame rate rendering, and the possibility to draw and render sharp pixels. From what I read Quartz has a vector drawing engine, but also allows to render bitmap data. Is it possible to control Quartz to draw non-anti-aliased bitmaps? Lastly, but not less importantly, it should not ask too much from the processor, mostly to avoid draining the battery on the go. (In case that matters, the end platform would be ... a significantly less powerful machine than a latest standard mac desktop.) OpenGL (ES in your case), hands down. Join the Mac Game Developers list and ask away. -- Seth Willits Thanks Seth. I just joined the game-dev list, and started to prepare myself mentally to dive in opengl (ohmm). Steph ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Use of AppKit in command-line app on headless node
Thanks for the replies - just got them now as my MobileMe email went offline for some reason last night... I noticed that there is some useful info relating to this topic in the documentation on Agents and Daemons at http://developer.apple.com/technotes/tn2005/tn2083.html#SECLIVINGDANGEROUSLY It does say that AppKit is not daemon-safe, but my testing suggests that if (as suggested in the technote) you avoid sensitive methods it should be ok (more info would be welcome). I'm curious as to whether you really read the thing I did, I did! (really) The fact that some discussion of possible issues *is* provided came of as sort of a tacit approval that in some cases this approach might be appropriate. To me it comes down to what *methods* you expect to work...I certainly wouldn't expect to be able to instantiate an NSDocumentController and create and manage documents with it in an environment with no window server. However if my NSDocument subclass contains a set of ivars (none of which use AppKit classes) that constitute a useful data model and implements file IO routines that do not, in any way, depend on the window server, document controller, or any AppKit classes, it seems reasonable to expect that this subset of functionality could be used even on a headless node. I can see how image decompression routines might be fragile, but the usage case I'm describing is a little different. One obvious alternative is to create a 'Data Object' class that has no AppKit dependencies and stash it as an instance variable in a 'thin' NSDocument subclass that just supports tasks relating to a real document-based app in a window server environment. To make my app work, I need two layers of subclass for my documents (a general NSDocument subclass and several subclasses of this for specific data types) so it's a bit more tricky. I'd need to have a data object class hierarchy and a parallel document hierarchy. If multiple inheritance was supported in Objective-C, it would be a bit simpler as I could create parent classes for data document objects and then multiply inherit the required parent classes in the document- base app (or just use the Foundation-based data object classes in headless situations). I suppose the alternative described above is one of the standard workarounds for multiple inheritance in Obj-C. So the appropriate question to have asked may well be what class structure will work well to factor out data model and NSDocument functionality so that the data model can be safely used in a headless context. Keep in mind that the only posts I could find on this were ones suggesting workarounds for use of NSImage, with the caveats noted above. Now, the consensus I'm hearing is don't do it , which will help me justify the (slightly) increased complexity required for this. Rick A routine might behave differently depending on its input parameters. For example, an image decompression routine might work for some types of images and fail for others. The behavior of any given framework, and the routines within that framework, can change from release-to-release. In other words, you're playing with fire in a gasoline-soaked shed. Just because you haven't been burned horribly *yet* doesn't mean you won't be. AppKit requires a window server connection, full stop. To the extent that it functions without one, this behavior is unsupported, unreliable, and highly risky. Don't do it. In case you didn't know, having a window server connection isn't the same as being a GUI app, however. You just need to be able to connect to it. Realistically, this means either having a user who's logged in to the GUI and always running as that user, or running as root and not logging in or out. And lastly, as far as I know you must initialize NSApplication before touching AppKit in any other way. Like the window server requirement, you may be able to get away without doing it sometimes but you should never rely on it. 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/rickhoge1%40mac.com This email sent to [EMAIL PROTECTED] (43092.6825) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Hillegass' chapter #11: Core Data
In your cars controller you have the content hooked up which shouldn't be. After you disconnect that binding your document window will display. -David On Aug 10, 2008, at 12:50 PM, Niklas Saers wrote: Hi all, I'm going through Hillegass' book 3rd edition, and I've come to the chapter I'm most excited about: Core Data. I came to the very exciting words You are done. Build and run the application, but I must have missed something important: my window doesn't show! Would any of you be so kind to please point me in the right direction as to why my window doesn't load? Further more, in my logs I get the message: [NSTableView 0x1b69f0 valueForUndefinedKey:]: this class is not key value coding-compliant for the key photo for both photo and datePurchased. What does this mean? I haven't added photo nor datePurchased to the table, I have kept them in the detail part of the window The zipped project (40kb) is at http://www.yousendit.com/download/Q01HcmxRdWNHa05jR0E9PQ for the next 7 days Thank you VERY much in advance :-) Cheers Nik ___ 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/owensd%40me.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: How to get array of characters from NSString
On Mon, Aug 11, 2008 at 9:30 PM, Deborah Goldsmith [EMAIL PROTECTED] wrote: Anyone who is considering writing code that looks through the contents of an NSString (as opposed to just treating the whole string as a unit) needs to learn the basics of processing Unicode. Joel Spolsky has a great primer on just how deep the Unicode rabbit hole goes, entitled The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!): http://www.joelonsoftware.com/articles/Unicode.html --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 [EMAIL PROTECTED]
Re: How to get array of characters from NSString
On Aug 12, 2008, at 8:41 AM, Kyle Sluder wrote: On Mon, Aug 11, 2008 at 9:30 PM, Deborah Goldsmith [EMAIL PROTECTED] wrote: Anyone who is considering writing code that looks through the contents of an NSString (as opposed to just treating the whole string as a unit) needs to learn the basics of processing Unicode. Joel Spolsky has a great primer on just how deep the Unicode rabbit hole goes, entitled The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!): http://www.joelonsoftware.com/articles/Unicode.html That article is missing several concepts which are essential for understanding Unicode; like many programmers, Mr. Spolsky thinks of Unicode as wide ASCII, which it is not. The article doesn't cover surrogate pairs (the fact that he uses the term UCS-2 instead of UTF-16 shows he's not up to date) or combining sequences (grapheme clusters). If you're going to go groveling through Unicode text, you need to understand both. This article is a bit stuffy, but also more complete, and is even shorter (I think): http://unicode.org/standard/principles.html This is also good: http://icu-project.org/userguide/unicodeBasics.html Also, Unicode does not, and likely never will, contain the Klingon script. While there was a proposal to encode it, it was rejected due to the fact that the Klingon user community (yes, it exists: http://www.amazon.com/Klingon-Hamlet-Lawrence-Schoen/dp/0671035789/) does not use the script: they write Klingon using ASCII (e.g., tlhIngan Hol). Things don't get encoded in Unicode unless there is actually a user community. That doesn't mean that fictional scripts are prohibited. There are proposals to encode Tengwar and Cirth, for example, as these have (small) user communities. :-) http://std.dkuug.dk/JTC1/SC2/WG2/docs/n1641/n1641.htm http://std.dkuug.dk/JTC1/SC2/WG2/docs/n1641/n1641.htm They've been languishing since 1997 due to more pressing work for the Unicode Technical Committee, so I wouldn't plan on writing Quenya or Sindarin in Unicode any time soon... Deborah Goldsmith Apple Inc. [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: I don't understand why this is leaking...
On Tue, Aug 12, 2008 at 7:05 AM, Graham Cox [EMAIL PROTECTED] wrote: On 12 Aug 2008, at 8:40 pm, Gerriet M. Denkmann wrote: I'm sure if it weren't someone would have raised merry hell about it before now. Something's fishy... Reminds of a very rational being walking the streets with his son. The son: Hey dad, there's a hundred dollar note! Dad: No son, this cannot be. If the note were real, somebody would have picked it up long ago. OK, fair comment. But let's look at the string you can't store: $null This reminds *me* of the old joke: Doctor, doctor, it hurts when I do this! (...) Well, don't do that then... More like this: Doctor, doctor, when I pump my arm, turn my head like this, and say the words 'klaatu barada nikto' I pass out on the floor! This isn't pain, it's a major malfunction. Any reasonable doctor would immediately get this person some medical care. Likewise, this NSKeyedArchiver behavior is a serious bug. You seem to be mixing up the difficulty in provoking it with mildness in effect. It may only happen in rare circumstances, but when it does happen, what happens is very bad behavior. 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 [EMAIL PROTECTED]
Disc write speed options
I'm trying to figure out how I can ask a DRDevice what burn speeds it's capable of so I can offer a choice to the user. When I call the status and info messages I don't see anything that looks useful. How can I get and set the burn rate ? Thanks, 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 [EMAIL PROTECTED]
Determine who ran an application
I am new to Cocoa and Xcode, so please bear with me. I am editing an existing application that we have. The application is set to run when the user logs into the machine through a loginHook. We have to pass the %USER% variable as an argument. I would like to pull the username from directly in the application. I tried to Google for this but did not have any luck. Any ideas? Travis Garrison Data Storage Systems Administrator Certified Xiotech Engineer - Magnitude 3D Ozarks Technical Community College 417-447-7522 [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Accessing memory of another application?
All, I'm trying to get started w/viewing/editing/interacting with the memory of another running application but I'm not where to get started. You could think of this as being a simple game trainer - which basically allows you to view and edit values in memory. Can anyone point me to where I should get started? Function names/examples would be a GREAT help - I haven't had experience with hooking into another application's memory. 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 [EMAIL PROTECTED]
I don't understand why this is leaking...
About $Null: It it were a reserved word, it would be documented so. The Archives and Serializations Programming Guide for Cocoa says: Keyed Archives ... Naming Values ... You should avoid using “$” as a prefix for your keys. The keyed archiver and unarchiver use keys prefixed with “$” for internal values. Although they test for and mangle user-defined keys that have a “$” prefix, this overhead slows down archiving performance. ... Greetings Klaus ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Should I retain a variable returned from this accessor?
On Aug 11, 2008, at 10:51 PM, Peter N Lewis wrote: I'm no Cocoa expert, but I think you're wrong on this, you've missed out a crucial line: At 3:12 PM -0400 11/8/08, Sean DeNigris wrote: // Get uid to return NSString* todoUid = [newTodo uid]; // Clean up [newTodo release]; newTodo = nil; return todoUid; [newTodo release] is not [newTodo autorelease]. So it may immediately call dealloc and dealloc the uid returned by by [newTodo uid]. To avoid this, you could do: Not really. This line: // Add the todo to my iCal calendar [[myCalendar todos] addObject:newTodo]; would appear to add newTodo to an NSMutableArray, which implicitly retains it. So this method retains newTodo twice but releases it once. As a result the todoUid string won't be released, as you fear, upon sending release to newTodo. NSString* todoUid = [[[newTodo uid] retain] autorelease]; It is quite possible that [newTodo uid] does exactly the above, but it might just return the internal ivar. If this is not true, I would very much like to be corrected! Advice on this list that I think is good advice is to always use autorelease unless there is really good reason not to (eg, with a large number of objects in a loop). One can think of two kinds of objects that end up in the autorelease pools. Temporary objects that will be autoreleased in one autorelease cycle and other objects that will remain in the autorelease pool indefinitely because their purpose demands persistence. In the name of efficiency one might prefer that objects in this second group not be put in autorelease pools since their memory management can be more precisely controlled with alloc/init and release. Placing them in an autorelease pool will incur some overhead in memory and cpu time each time that the pool tries to drain. The pattern for this second kind of object is exactly what the OP used in his code. alloc/init followed by a retain (usually implicit in addObject: or addSubview:) followed by release. Usually the release is the next line after the addObject:, not at the end of the method as the OP used. You can count this as 'a really good reason' or not but IMO the OP has no reason to autorelease the object as you suggest. -- Brian Stern [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: moving subviews
On Aug 12, 2008, at 00:49, Georg Seifert wrote: I have a big document view. On it I place some small subviews. I f I scroll the document view, the subviews should move with it but only till it reaches the edge of the visible area of the main view. e.g: if i move the main view down, and the subview hits the scrollbar, it should stick there. is there a sane way of achieving this or do I better lock for an other behavior? It's fairly easy to do. Register to receive bounds-changed notifications from your document view's clip view -- what the documentation calls the scroll view's content view, actually the parent view of your document view -- and also tell the clip view to post these notifications, since it doesn't do that by default. When you receive the notification, you can use the document view's visibleRect (which is the clip view bounds, but in the document view's bounds coordinate system) to work out whether and where to move the subview. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Disc write speed options
Hi Matt, Ask this in the Disc-Recording List. http://lists.apple.com to subscribe. I can send you how I do it. -Jason On Aug 12, 2008, at 8:04 AM, Matthew Mashyna wrote: I'm trying to figure out how I can ask a DRDevice what burn speeds it's capable of so I can offer a choice to the user. When I call the status and info messages I don't see anything that looks useful. How can I get and set the burn rate ? Thanks, 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/mailinglists%40jasonandannette.us This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: How to get array of characters from NSString
On Aug 12, 2008, at 9:13 AM, Deborah Goldsmith wrote: The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!): http://www.joelonsoftware.com/articles/Unicode.html That article is missing several concepts which are essential for understanding Unicode; like many programmers, Mr. Spolsky thinks of Unicode as wide ASCII, which it is not. From the article: Some people are under the misconception that Unicode is simply a 16- bit code where each character takes 16 bits and therefore there are 65,536 possible characters. This is not, actually, correct. It is the single most common myth about Unicode, so if you thought that, don't feel bad. It's worth mentioning that his article isn't meant to convey a complete understanding of Unicode; rather, it really is the absolute minimum every developer must know. Given your own earlier distinction between someone writing code that treats strings as a unit and someone writing code that looks through a string, I would argue that Spolsky's article is, indeed, a very appropriate primer for the *former* class of developer and certainly a more engaging read than many other treatises on character representations. I would also agree with your point that most people looking through strings are doing so without so much as a cursory understanding of some very important concepts. - jp smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Use of AppKit in command-line app on headless node
On Tue, Aug 12, 2008 at 11:27 AM, Rick Hoge [EMAIL PROTECTED] wrote: Thanks for the replies - just got them now as my MobileMe email went offline for some reason last night... I noticed that there is some useful info relating to this topic in the documentation on Agents and Daemons at http://developer.apple.com/technotes/tn2005/tn2083.html#SECLIVINGDANGEROUSLY It does say that AppKit is not daemon-safe, but my testing suggests that if (as suggested in the technote) you avoid sensitive methods it should be ok (more info would be welcome). I'm curious as to whether you really read the thing I did, I did! (really) The fact that some discussion of possible issues *is* provided came of as sort of a tacit approval that in some cases this approach might be appropriate. It seems pretty clear that the only cases where this approach might possibly be appropriate is when you have no alternative whatsoever to using a daemon-unsafe framework from a daemon, and even then you ought to look harder for alternatives first. In your case, it sounds like you're doing this out of convenience, not necessity. Any C programmer should be familiar with the term undefined behavior. For example: main() { struct foo *foo; printf(%d, sizeof(struct foo)); } This is not a legal C program. The foo struct has not been defined, and so using the sizeof operator on it is forbidden. The behavior of this undefined. What this means is that, essentially, anything could happen: 1) The compiler could emit an error. 2) The code could crash at runtime. 3) The code could produce an incorrect value. 4) The compiler causes demons to fly out of your nose (http://www.catb.org/jargon/html/N/nasal-demons.html). 5) The correct value is displayed. Pay particular attention to #5: one of the legal possible consequences of invoking undefined behavior is that the correct thing happens anyway! And even more importantly, it's perfectly legal for the behavior to change between any of these 5 alternatives (and the infinite possibilities beyond) just because you changed another piece of your code somewhere else, used a different compiler version, used different compiler *settings*, merely recompiled your code, or even merely re-ran code that you already compiled. The ultimate point of all of this is simple: just because it works doesn't mean you can rely on it. To the extent that the document in question explains an approach for reducing risk when using daemon-unsafe frameworks, it's just that: how to reduce your risk. It doesn't make it a safe or reasonable thing to do, and you should still avoid doing it if you have any kind of alternative. Just like how sometimes you have no choice but to use C code whose behavior is undefined (but known to do what you want in the case that you need), but whenever you can avoid doing so then you should. To me it comes down to what *methods* you expect to work... The document you linked to clearly explains that you should never expect any methods in any daemon-unsafe frameworks to work from such an environment. To the extent that some methods do work, this is purely by happenstance and they could stop working in Snow Leopard, or in 10.5.5, or with the next security update, or the next time you reboot, or recompile, or relaunch your app, or call the same method with different arguments, or even just make the same call a second time. I certainly wouldn't expect to be able to instantiate an NSDocumentController and create and manage documents with it in an environment with no window server. However if my NSDocument subclass contains a set of ivars (none of which use AppKit classes) that constitute a useful data model and implements file IO routines that do not, in any way, depend on the window server, document controller, or any AppKit classes, it seems reasonable to expect that this subset of functionality could be used even on a headless node. I can see how image decompression routines might be fragile, but the usage case I'm describing is a little different. Yes, it's reasonable to expect that this subset could be used from a daemon context. It's also reasonable to expect that this subset could not be used from a daemon context. When you're trying to decide whether it's allowed, the documentation is what prevails. The documentation in this case is quite explicit that you can't do this, and if it happens to work then it's simply by luck and may quit working (or worse, appear to work but actually provide bad results) at any time. As a concrete example, it would be perfectly reasonable for AppKit to start initializing itself and acquire the window server connection at framework load time, and call abort() if the connection cannot be acquired. Suddenly you would be utterly screwed if you had a bunch of code that relied on using any piece of AppKit, even pieces which seem like they ought to be perfectly safe, from a daemon. One obvious alternative is to create a 'Data
Re: How to get array of characters from NSString
On Tue, Aug 12, 2008 at 12:13 PM, Deborah Goldsmith [EMAIL PROTECTED] wrote: That article is missing several concepts which are essential for understanding Unicode; like many programmers, Mr. Spolsky thinks of Unicode as wide ASCII, which it is not. The article doesn't cover surrogate pairs (the fact that he uses the term UCS-2 instead of UTF-16 shows he's not up to date) or combining sequences (grapheme clusters). If you're going to go groveling through Unicode text, you need to understand both. He uses UTF-16 as well. I don't think that he doesn't understand surrogate pairs or otherwise treats Unicode as wide ASCII. In fact, I think the main point of the article was to drive home the point that the simple 1:1 mapping of glyphs to bytes that ASCII exhibits isn't even a valid concept in the world of Unicode, and gave a primer on why this is the case. Hence the Absolute Minimum part of the title. This article is a bit stuffy, but also more complete, and is even shorter (I think): http://unicode.org/standard/principles.html This is also good: http://icu-project.org/userguide/unicodeBasics.html Of course these have the added benefit of being more likely correct, since their authors work on Unicode or software implementations. :) I didn't mean to tread on your toes here, I just find that Joel's article is a very good way to quickly get programmers to understand that Unicode is a very different beast, and that it really does matter. --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 [EMAIL PROTECTED]
Re: I don't understand why this is leaking...
On Tue, Aug 12, 2008 at 12:50 PM, Klaus Backert [EMAIL PROTECTED] wrote: You should avoid using $ as a prefix for your keys. The keyed archiver and unarchiver use keys prefixed with $ for internal values. Although they test for and mangle user-defined keys that have a $ prefix, this overhead slows down archiving performance. But this isn't a key, it's a value... :( --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 [EMAIL PROTECTED]
Re: I don't understand why this is leaking...
On Tue, Aug 12, 2008 at 12:50 PM, Klaus Backert [EMAIL PROTECTED] wrote: About $Null: It it were a reserved word, it would be documented so. The Archives and Serializations Programming Guide for Cocoa says: Keyed Archives ... Naming Values ... You should avoid using $ as a prefix for your keys. The keyed archiver and unarchiver use keys prefixed with $ for internal values. Although they test for and mangle user-defined keys that have a $ prefix, this overhead slows down archiving performance. ... This is not a reserved word. This is merely a class of keys which can result in lower archiving performance (although still perfectly correct behavior). What's being discussed here is a case where a certain *value* (not a key) results in incorrect *behavior* (not just reduced speed). 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 [EMAIL PROTECTED]
Re: Accessing memory of another application?
You can't do this. Each application runs in its own protected memory. On 12 Aug 2008, at 17:04, Josh wrote: All, I'm trying to get started w/viewing/editing/interacting with the memory of another running application but I'm not where to get started. You could think of this as being a simple game trainer - which basically allows you to view and edit values in memory. Can anyone point me to where I should get started? Function names/ examples would be a GREAT help - I haven't had experience with hooking into another application's memory. 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 [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Determine who ran an application
On Aug 12, 2008, at 12:01 , GARRISON, TRAVIS J. wrote: I am new to Cocoa and Xcode, so please bear with me. I am editing an existing application that we have. The application is set to run when the user logs into the machine through a loginHook. We have to pass the %USER% variable as an argument. I would like to pull the username from directly in the application. I tried to Google for this but did not have any luck. Any ideas? If you just need the basic user id, you can use getuid(2). There are various API in the security frameworks and the directory services (10.5+) frameworks that map it to more useful Mac OS Specific user information. smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Determine who ran an application
On Tue, Aug 12, 2008 at 12:01 PM, GARRISON, TRAVIS J. [EMAIL PROTECTED] wrote: I am new to Cocoa and Xcode, so please bear with me. I am editing an existing application that we have. The application is set to run when the user logs into the machine through a loginHook. We have to pass the %USER% variable as an argument. I would like to pull the username from directly in the application. What is it you're trying to do? If you need the user's username, there are two functions for that: NSFullUserName (long user name) and NSUserName (short name, aka the UNIX username). If you need their home directory, use NSHomeDirectory. If you're trying to do authentication, you should really be using Kerberos. If the account exists in an Open Directory or Active Directory domain, you may need to use Directory Services to get the info you're after... So, in other words, we really need to know your specific goal. --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 [EMAIL PROTECTED]
Re: Disc write speed options
On Aug 12, 2008, at 11:04 AM, Matthew Mashyna wrote: I'm trying to figure out how I can ask a DRDevice what burn speeds it's capable of so I can offer a choice to the user. When I call the status and info messages I don't see anything that looks useful. How can I get and set the burn rate ? Burn speeds are more dependent on media than the drive. They will only be returned when media is actually present in the drive. If you don't mind the question, why do you think this is a good idea? Offering the user a choice of burn speeds is a very 90's thing to do, IMHO. Any drive made in the last half decade is virtually guaranteed to have burn underrun protection. Speed is no longer a direct causal factor in failed burns. Now, shoddy media quality... that is entirely a different matter, but again, speed has almost no bearing on it either. -Ed smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: I don't understand why this is leaking...
On Aug 12, 2008, at 12:50 , Klaus Backert wrote: About $Null: It it were a reserved word, it would be documented so. The Archives and Serializations Programming Guide for Cocoa says: Keyed Archives ... Naming Values ... You should avoid using “$” as a prefix for your keys. The keyed archiver and unarchiver use keys prefixed with “$” for internal values. Although they test for and mangle user-defined keys that have a “$” prefix, this overhead slows down archiving performance. ... In this case, however, it's the actual value being encoded... not the key name. Also, if you read it, it suggests that you shouldn't use it for performance reasons. It specifically states that it is supposed to properly mangle the $ in a key name (causing the performance loss)... smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Determine who ran an application
On Tue, Aug 12, 2008 at 1:09 PM, GARRISON, TRAVIS J. [EMAIL PROTECTED] wrote: I think that is whats needed. This is an application that will look up the account in Active Directory and looks for a logon script. If the logon script exists, then present a computer use agreement that the user will accept or decline, with decline logging the user out. The application will lock the computer down, so that the user cannot do anything without accepting or declining. I just had to find out what username to search for. If all you need is the username, then NSUserName is your choice. But this seems like an extravagance -- aren't your client machines bound to the AD domain? You should be able to just add the login scripts to the appropriate users/groups/computers in OD, assuming you have an OS X Server in a Golden Triangle configuration. But this might be well beyond what you're looking for, and is certainly off-topic for this list (which, BTW, you might have unintentionally forgotten to cc: in your reply). --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 [EMAIL PROTECTED]
Re: Accessing memory of another application?
Am Di,12.08.2008 um 19:01 schrieb Mike Abdullah: You can't do this. Each application runs in its own protected memory. Sometimes you can do this: http://en.wikipedia.org/wiki/Computer_virus ;-) Serious: There are techniques to get acccess to another application memory under some circumstances. None of them is related to Cocoa since there is no class named NSVirus. Amin On 12 Aug 2008, at 17:04, Josh wrote: All, I'm trying to get started w/viewing/editing/interacting with the memory of another running application but I'm not where to get started. You could think of this as being a simple game trainer - which basically allows you to view and edit values in memory. Can anyone point me to where I should get started? Function names/ examples would be a GREAT help - I haven't had experience with hooking into another application's memory. 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 [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/negm-awad%40cocoading.de This email sent to [EMAIL PROTECTED] Amin Negm-Awad [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Accessing memory of another application?
On 8/12/08 12:04 PM, Josh said: I'm trying to get started w/viewing/editing/interacting with the memory of another running application but I'm not where to get started. You could think of this as being a simple game trainer - which basically allows you to view and edit values in memory. Can anyone point me to where I should get started? Function names/examples would be a GREAT help - I haven't had experience with hooking into another application's memory. Are you the developer of both apps? If so, google shmget for starters... -- Sean McBride, B. Eng [EMAIL PROTECTED] Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Use of AppKit in command-line app on headless node
Thanks again for that very detailed post - I know it sounds like I'm being lazy, but there are other parts of the app that would have to be redesigned to allow the possibility for code use under headless conditions and it's really important to me to know why this is necessary. What you said goes a long way toward clarifying the underlying issues. Obviously I'm not going to risk it now. ... One obvious alternative is to create a 'Data Object' class that has no AppKit dependencies and stash it as an instance variable in a 'thin' NSDocument subclass that just supports tasks relating to a real document-based app in a window server environment. To make my app work, I need two layers of subclass for my documents (a general NSDocument subclass and several subclasses of this for specific data types) so it's a bit more tricky. I'd need to have a data object class hierarchy and a parallel document hierarchy. If all of the smarts are in your own custom classes, why do you need a hierarchy of NSDocument subclasses? Have a single NSDocument subclass that passes all of the important methods on to your custom classes, and your job should be done. The way the app was originally designed, the top level NSDocument subclass implements custom functionalities used by all document types. There are a few different types of document/data that are related, but different enough that it has worked well to use separate subclasses to implement them. For example different nib files are loaded depending on the document type (something that would go in the NSDocument subclass), and the data model is different (something which would go in the data object class). Rick 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/rickhoge1%40mac.com This email sent to [EMAIL PROTECTED] (43092.6825) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Accessing memory of another application?
on 2008-08-12 12:04 PM, Josh at [EMAIL PROTECTED] wrote: I'm trying to get started w/viewing/editing/interacting with the memory of another running application but I'm not where to get started. It isn't clear to me what you mean. When some people ask questions like this, what they really mean is that they want to be able to control the other application's windows, menus, etc. There are several ways to do that, including the Accessibility API and Quartz Event Taps. Other people really mean that they want to share the data used by the other application. If you wrote the other program, you can do that in a variety of ways, including shared preferences and distributed notifications. Even if you didn't write the other program, you may be able to do something with its documents or, if it supports AppleScript, with its terminology dictionary. Even if it doesn't support AppleScript, you can probably control it and thus get at its data using GUI Scripting. Other people mean literally accessing the RAM currently in use by the other application, and I have no idea how you would go about approaching that task. -- Bill Cheeseman - [EMAIL PROTECTED] Quechee Software, Quechee, Vermont, USA www.quecheesoftware.com PreFab Software - www.prefabsoftware.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 [EMAIL PROTECTED]
Re: Accessing memory of another application?
On Tue, Aug 12, 2008 at 10:31 AM, Bill Cheeseman [EMAIL PROTECTED] wrote: on 2008-08-12 12:04 PM, Josh at [EMAIL PROTECTED] wrote: I'm trying to get started w/viewing/editing/interacting with the memory of another running application but I'm not where to get started. It isn't clear to me what you mean. By game trainer, I assume the Josh means a program that you can run to peek/poke specific locations in the memory space of a videogame to change the outcome of the game (i.e. grant yourself more money/points/life, whatever). When some people ask questions like this, what they really mean is that they want to be able to control the other application's windows, menus, etc. There are several ways to do that, including the Accessibility API and Quartz Event Taps. Other people really mean that they want to share the data used by the other application. If you wrote the other program, you can do that in a variety of ways, including shared preferences and distributed notifications. Even if you didn't write the other program, you may be able to do something with its documents or, if it supports AppleScript, with its terminology dictionary. Even if it doesn't support AppleScript, you can probably control it and thus get at its data using GUI Scripting. Other people mean literally accessing the RAM currently in use by the other application, and I have no idea how you would go about approaching that task. That is, this last meaning. -- Clark S. Cox III [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Accessing memory of another application?
In practice, it's perfectly possible to access other processes memory using public functions (it require some privileges since 10.4 intel). But to do it you have to use the low-level mach API and that's off topic here. And no, code injection is not used only by virus. (see http://rentzsch.com/mach_star/ ) Le 12 août 08 à 19:18, Negm-Awad Amin a écrit : Am Di,12.08.2008 um 19:01 schrieb Mike Abdullah: You can't do this. Each application runs in its own protected memory. Sometimes you can do this: http://en.wikipedia.org/wiki/Computer_virus ;-) Serious: There are techniques to get acccess to another application memory under some circumstances. None of them is related to Cocoa since there is no class named NSVirus. Amin On 12 Aug 2008, at 17:04, Josh wrote: All, I'm trying to get started w/viewing/editing/interacting with the memory of another running application but I'm not where to get started. You could think of this as being a simple game trainer - which basically allows you to view and edit values in memory. Can anyone point me to where I should get started? Function names/ examples would be a GREAT help - I haven't had experience with hooking into another application's memory. 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 [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/negm-awad%40cocoading.de This email sent to [EMAIL PROTECTED] Amin Negm-Awad [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: How to get array of characters from NSString
Count me as another Spolsky defender. On Aug 12, 2008, at 12:13 PM, Deborah Goldsmith wrote: On Aug 12, 2008, at 8:41 AM, Kyle Sluder wrote: http://www.joelonsoftware.com/articles/Unicode.html That article is missing several concepts which are essential for understanding Unicode; like many programmers, Mr. Spolsky thinks of Unicode as wide ASCII, which it is not. The article doesn't cover surrogate pairs (the fact that he uses the term UCS-2 instead of UTF-16 shows he's not up to date) or combining sequences (grapheme clusters). If you're going to go groveling through Unicode text, you need to understand both. This article is a bit stuffy, but also more complete, and is even shorter (I think): http://unicode.org/standard/principles.html Maybe I'm spoiled on Spolsky's breezy style, but I found this article confusing and painful to read. It uses the term code point several times before defining it two-thirds of the way down. In the first paragraph it dives right into acronyms and version numbers without defining a single concept: [...] Versions of the Unicode Standard are fully compatible and synchronized with the corresponding versions of International Standard ISO/IEC 10646. For example, Unicode 5.1 contains all the same characters and encoding points as ISO/IEC 10646:2003 plus amendments. [...] Any implementation that is conformant to Unicode is also conformant to ISO/IEC 10646. For those who find the above intro fascinating, I won't keep you in suspense. The article ends like this: The Unicode encoding forms correspond exactly to forms of use and transformation formats also defined in ISO/IEC 10646. UTF-8 and UTF-16 are defined in Annexes to ISO/IEC 10646. And UTF-32 corresponds to the four-octet form UCS-4 of ISO/IEC 10646. This is also good: http://icu-project.org/userguide/unicodeBasics.html I found this much clearer and better-written than the first document you referenced. It defines terms and concepts in an orderly progression. But I would have found it drier and more difficult if I hadn't read Spolsky first. Unless Spolsky is plainly, misleadingly, dangerously wrong about something, I would recommend his article first for anyone (like me) who needs to bone up on this stuff. --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 [EMAIL PROTECTED]
Re: Accessing memory of another application?
If you 're developing the both application you can create a layer/IPC system via shm (shared memory) to communicate between your two apps, what you asked is really a newbie question regarding C programming, before trying cocoa and obj-c you should learn the base Cheers On Tue, Aug 12, 2008 at 9:04 AM, Josh [EMAIL PROTECTED] wrote: All, I'm trying to get started w/viewing/editing/interacting with the memory of another running application but I'm not where to get started. You could think of this as being a simple game trainer - which basically allows you to view and edit values in memory. Can anyone point me to where I should get started? Function names/examples would be a GREAT help - I haven't had experience with hooking into another application's memory. 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/openspecies%40gmail.com This email sent to [EMAIL PROTECTED] -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Accessing memory of another application?
do not use mach primitives in your case On Tue, Aug 12, 2008 at 10:33 AM, Jean-Daniel Dupas [EMAIL PROTECTED] wrote: In practice, it's perfectly possible to access other processes memory using public functions (it require some privileges since 10.4 intel). But to do it you have to use the low-level mach API and that's off topic here. And no, code injection is not used only by virus. (see http://rentzsch.com/mach_star/ ) Le 12 août 08 à 19:18, Negm-Awad Amin a écrit : Am Di,12.08.2008 um 19:01 schrieb Mike Abdullah: You can't do this. Each application runs in its own protected memory. Sometimes you can do this: http://en.wikipedia.org/wiki/Computer_virus ;-) Serious: There are techniques to get acccess to another application memory under some circumstances. None of them is related to Cocoa since there is no class named NSVirus. Amin On 12 Aug 2008, at 17:04, Josh wrote: All, I'm trying to get started w/viewing/editing/interacting with the memory of another running application but I'm not where to get started. You could think of this as being a simple game trainer - which basically allows you to view and edit values in memory. Can anyone point me to where I should get started? Function names/examples would be a GREAT help - I haven't had experience with hooking into another application's memory. 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 [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/negm-awad%40cocoading.de This email sent to [EMAIL PROTECTED] Amin Negm-Awad [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com This email sent to [EMAIL PROTECTED] -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Opening an external file in a external application
On Aug 11, 08, at 2:28 PM, John Love wrote: I have a multiple document Cocoa app where I (try to) open an external file in whatever application the file belongs to -- in my case, an Excel spreadsheet in Excel. The new Cocoa document window shown keeps track of the calculation progress in Excel via a NSProgressIndicator and a NSTextField. So, instead of opening a text file and showing it directly in the NSWindow of MyDocument, I just want to startup Excel by selecting the appropriate file in Cocoa's open dialog. I have 'XLS8' in my info.plist file. The Excel spreadsheet opens up and the NSProgressIndicator starts spinning and the appropriate text is placed in the NSTextField. I believe I want to do this opening within my override of - readFromURL. Am I on the right track here? John Love Found the answer -- I do need to override -readFromURL in the following manner: - (BOOL) readFromURL:(NSURL*)absoluteURL ofType:(NSString*)typeName error:(NSError**)outError { NSWorkspace *workSpace; BOOL success; workSpace = [NSWorkspace sharedWorkspace]; success = [workSpace openURL:absoluteURL]; if (success) { // do stuff here } else { // other things here } } I still need to figure out if it is possible for Excel to communicate back to my app via some sort of NSNotification. I don't have much hope of that .. so what I probably need to focus on is how to display the Excel spreadsheet in my document window. Any ideas will definitely be very appreciated. John Love P.S. -- sorry about the initial double post ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
I don't understand why this is leaking...
Am 12.08.2008 um 19:05 schrieb Jason Coco: On Aug 12, 2008, at 12:50 , Klaus Backert wrote: About $Null: It it were a reserved word, it would be documented so. The Archives and Serializations Programming Guide for Cocoa says: Keyed Archives ... Naming Values ... You should avoid using “$” as a prefix for your keys. The keyed archiver and unarchiver use keys prefixed with “$” for internal values. Although they test for and mangle user-defined keys that have a “$” prefix, this overhead slows down archiving performance. ... In this case, however, it's the actual value being encoded... not the key name. Also, if you read it, it suggests that you shouldn't use it for performance reasons. It specifically states that it is supposed to properly mangle the $ in a key name (causing the performance loss)... That's right. Sorry, I confused this. But talking about ... I read nothing in the documentation what using $-prefixed *keys* for internal values *exactly* does. It improves performance, okay, but it can be anything else, and a different thing tomorrow. I handle this implementation detail in the usual way. I will stay away from $- prefixed keys. Back to $-prefixed *values*: Gerriet Denkmann already realized something – which is not documented, as far as I know. A keyed archive contains a $object array, and the element $object[0] has the value $null. Implementation detail! I performed a test with my current project. I changed a certain value of a string variable to $null, saved it as a keyed archive in binary property list format – with the $null value anywhere in the middle –, opened the saved archive in a new document, and ... ***crash***: 2008-08-12 20:04:58.549 Blotto[24783] NSExceptionHandler has recorded the following exception: NSInvalidArgumentException -- *** -[NSPlaceholderDictionary initWithObjects:forKeys:]: number of objects (0) not equal to number of keys (21) Stack trace: 0x966eaf10 0x92c10e0c 0x92c552a0 0x92c18fc8 0x92bfaea4 0x92bfa688 0x7bd8 0x92bfaea4 0x92bfa688 0x0001840c 0x000160e8 0x93ac6344 0x00012acc 0x939504a8 0x00012e20 0x93ac5634 0x9394f960 0x93acc1fc 0x93acc03c 0x93acbec0 0x938358b4 0x93890094 0x9388fe18 0x9388f8c0 0x9388f50c 0x93799058 0x93790960 0x93881458 0x4334 0x3258 0x2f5c 0x1000 2008-08-12 20:04:58.550 Blotto[24783] NSExceptionHandler will now suspend the current thread and wait for debugger attachment _NSExceptionHandlerExceptionRaiser (in ExceptionHandling) +[NSException raise:format:] (in Foundation) -[NSDictionary initWithObjects:forKeys:] (in Foundation) -[NSDictionary initWithCoder:] (in Foundation) __decodeObjectBinary (in Foundation) __decodeObject (in Foundation) -[BloWorld initWithCoder:] (in Blotto) __decodeObjectBinary (in Foundation) __decodeObject (in Foundation) -[BloDocument readPListFromData:error:] (in Blotto) -[BloDocument readFromData:ofType:error:] (in Blotto) -[NSDocument readFromFileWrapper:ofType:error:] (in AppKit) -[YetDocument readFromFileWrapper:ofType:error:] (in Blotto) (YetDocument.m:153) -[NSDocument readFromURL:ofType:error:] (in AppKit) -[YetDocument readFromURL:ofType:error:] (in Blotto) (YetDocument.m:172) -[NSDocument _initWithContentsOfURL:ofType:error:] (in AppKit) -[NSDocument initWithContentsOfURL:ofType:error:] (in AppKit) -[NSDocumentController makeDocumentWithContentsOfURL:ofType:error:] (in AppKit) -[NSDocumentController openDocumentWithContentsOfURL:display:error:] (in AppKit) -[NSDocumentController openDocument:] (in AppKit) -[NSApplication sendAction:to:from:] (in AppKit) -[NSMenu performActionForItemAtIndex:] (in AppKit) -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] (in AppKit) -[NSMenu performKeyEquivalent:] (in AppKit) -[NSApplication _handleKeyEquivalent:] (in AppKit) -[NSApplication sendEvent:] (in AppKit) -[NSApplication run] (in AppKit) _NSApplicationMain (in AppKit) _main (in Blotto) (main.m:10) __start (in Blotto) start (in Blotto) 0x1000 (in Blotto) q.e.d. Greetings Klaus ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Get specified window from nib
On Aug 12, 2008, at 3:33 AM, Andy Lee wrote: On Aug 10, 2008, at 10:07 PM, Graham Perks wrote: On Aug 10, 2008, at 9:01 PM, Fosse wrote: I have one nib containing more than ten dialogs and want to get the specified window after nib is loading.. Perhaps NSNib's instantiateNibWithOwner:(id)owner topLevelObjects: (NSArray **)topLevelObjects ? You'll get an array of top level objects, which will presumably contain your dialogs... If it were me I'd just join them up in IB. You only need to do it once. Graham. What did you think of Graham Perks's suggestion to use NSNib to load the nib file? I haven't used NSNib myself -- only glanced at the docs -- but I believe it's the only way to get your program to know about the names you assigned your windows in IB. So if you rely on those names to pick the one you want, you're going to be stuck retyping them somewhere anyway, whether to make them into outlets or some other place. NSNib, along with NSBundle will both let you load a NIB and will return the top level objects. Neither of these methods will let you access the objects by 'name' though. The name in Interface Builder is only for you to label the objects. As others have pointed out, accessing an object by name is what an outlet is for. It effectively is accessing by name but it removes all almost all of the risk of having string constants get out of date. The correct way to accomplish this is with an outlet from the file's owner. Using outlets is less error prone than having to syncing up two sets of string constants. It would probably be best to put the related windows in one nib file each so that you can cut down the number of objects in each NIB. Right now, when the giant NIB file is loaded, every single window in your application is created. Also, by putting the windows all together in one nib, you won't be able to instantiate multiple copies of any of the windows without instantiating the whole batch. You probably wouldn't want to work with hundreds of classes in one source file. For the same reasons, you should strive to have smaller, more focused nib files. If you think about it, the string constant isn't really that different from an outlet - Jon Hess If there's some other attribute of the window you can use to select them, like a unique window title, one possibility is to scan the window list. See the NSWindowList() function. This assumes you only load the nib once and the window names are unique application- wide and they never change. --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/jhess%40apple.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSImage and zooming PDFs vs. bitmaps
On Tuesday, August 12, 2008, at 11:09AM, Ken Ferry [EMAIL PROTECTED] wrote: Okay, thanks Hamish. This area is getting some love for SnowLeopard. I suspect that all these issues except for the one about opting not to make large caches are already fixed. NSImage should be something that (a) does things you want, (b) does things you understand. As far as options, NSPDFImageRep and NSEPSImageRep themselves do not do any raster caching, so you could use them and do anything else you need on top. There are also other system APIs such as CGPDFDocument and PDFKit. FWIW, I ran into some of these problems a while ago and didn't file bug reports since I figured NSImage behaved that way by design! Anyway, I decided to avoid NSImage entirely and ended up using an object that draws the PDF as a rasterized CGImage when scrolling or at low magnification, and draws a CGPDFPage at high magnification levels. It works fairly well, although I had to cache bitmaps to disk for the large number of files I was looking at, in order to keep memory usage down. Source (BSD license) for that class is at http://code.google.com/p/fileview/source/browse/trunk/fileview/FVPDFIcon.m. Most of the complexity is due to my threading/caching scheme, but drawing takes place in drawInRect:ofContext:, and I suspect you might be able to do something similar with Core Animation. -- Adam ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Accessing memory of another application?
Am Di,12.08.2008 um 19:33 schrieb Jean-Daniel Dupas: In practice, it's perfectly possible to access other processes memory using public functions (it require some privileges since 10.4 intel). But to do it you have to use the low-level mach API and that's off topic here. This is exactly what I wrote: here are techniques to get acccess to another application memory under some circumstances. None of them is related to Cocoa … And no, code injection is not used only by virus. (see http://rentzsch.com/mach_star/ ) I know the red shed. Amin Le 12 août 08 à 19:18, Negm-Awad Amin a écrit : Am Di,12.08.2008 um 19:01 schrieb Mike Abdullah: You can't do this. Each application runs in its own protected memory. Sometimes you can do this: http://en.wikipedia.org/wiki/Computer_virus ;-) Serious: There are techniques to get acccess to another application memory under some circumstances. None of them is related to Cocoa since there is no class named NSVirus. Amin On 12 Aug 2008, at 17:04, Josh wrote: All, I'm trying to get started w/viewing/editing/interacting with the memory of another running application but I'm not where to get started. You could think of this as being a simple game trainer - which basically allows you to view and edit values in memory. Can anyone point me to where I should get started? Function names/examples would be a GREAT help - I haven't had experience with hooking into another application's memory. 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 [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/negm-awad%40cocoading.de This email sent to [EMAIL PROTECTED] Amin Negm-Awad [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org This email sent to [EMAIL PROTECTED] Amin Negm-Awad [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Monospaced Simulated Braille
For the time being I suppose you could query the Braille font for its maximum character width, then draw each character in a string individually, centering it horizontally within a rectangle that has the maximum width. That would mean manually advancing each character's position on a line and handling wrapping, but it might get you there. This solution would also have the benefit of just working if the Braille font is later fixed to be monospace. On Aug 11, 2008, at 6:31 PM, Deborah Goldsmith wrote: The Braille characters should probably be monospace. Please write a bug. On Aug 8, 2008, at 2:11 PM, James Jennings wrote: I want to display and edit simulated Braille. OS X has had Braille fonts since Tiger, so all I need to do is pass the correct Unicode codes to NSTextView, except the Braille fonts are proportional spaced, and I need monospaced. There is a Unicode entity called BRAILLE PATTERN BLANK which could double as a space, except that NSTextView doesn't treat it as white space. It's not used for finding word breaks. I've been looking for solutions along the lines of: Override the character spacing of a font, or Override the definition of white space, or Override the word break algorithm. but I haven't found documentation for any of that. Any suggestions? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Should I retain a variable returned from this accessor?
On Tue, Aug 12, 2008 at 2:12 AM, Negm-Awad Amin [EMAIL PROTECTED] wrote: BTW: You can do the same inside a getter to get rid of thread problems. Nope it does nothing to solve threading issues ([[blah retain] autorelease] isn't an atomic operation) you need to protect it with an critical section of some type. Additionally adding locking at the level of accessor is often far to granular to be useful to clients of a class. -Shawn ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Monospaced Simulated Braille
On Aug 8, 2008, at 2:11 PM, James Jennings wrote: Override the character spacing of a font, or Override the definition of white space, or Override the word break algorithm. Overriding the spacing of a font is something that has been demonstrated at least once at WWDC, in the context of NSFontDescriptor. To put it briefly, you create an NSFontDescriptor from a given font and add NSFontFixedAdvanceAttribute to override the font's glyph advancements and make it monospace, then create a font from that. We showed a code snippet for this; I'll reproduce it below. Overriding the word break and double-click algorithms is something that can be done at the NSTextStorage and/or NSTypesetter levels, but it's rather difficult, and I suspect that what you really want is a monospace variant of the font instead. Douglas Davidson From WWDC slides (somewhat schematic; modify as necessary): NSFontDescriptor *descriptor = [font fontDescriptor]; NSDictionary *newAttributes; CGFloat maxAdvance = [font maximumAdvancement].width; NSNumber *number = [NSNumber numberWithDouble:maxAdvance]; newAttributes = [NSDictionary dictionaryWithObject:number forKey:NSFontFixedAdvanceAttribute]; descriptor = [descriptor fontDescriptorByAddingAttributes:newAttributes]; font = [NSFont fontWithDescriptor:descriptor size:0.0]; ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSTextField Bug? Can't be!
It really does not have anything to do with resigning first responder. You can clearly ask for the string value while the text field is first responder and get the correct answer back. What's happening is plainly obvious, I just think it's a bug. (I filed a report. We'll see what happens.) -- Seth Willits On Aug 12, 2008, at 4:08 AM, [EMAIL PROTECTED] wrote: Seems to me that this might be more to do with the responder chain. The NSTextField will update its stringValue when it resigns as first responder. An NSButton does not accept first responder status so the NSTextField never gets to resign first responder status. If you are using NSViewController call -commitEditing in your button click method. This will commit any pending edits. Otherwise send -makeFirstResponder: to the view's window with the window itself as the argument. Similar effect. This situation happens frequently. It's one good reason to always use NSViewController. Check out NSEditor (Informal Protocol) and NSEditorRegistration (Informal Protocol) for the low down. Jonathan. FROM : Seth Willits DATE : Tue Aug 12 10:28:30 2008 Right. I figure though that asking for stringValue grabs the text from the field editor, so why doesn't setEnabled do the same to commit current editing? Seems logical to me. I can't imagine a situation where you'd want text the user typed into a field to be ignored after they already typed it. -- Seth Willits On Aug 11, 2008, at 10:40 PM, Graham Cox wrote: I suspect it's because of the Field Editor. The text isn't really in the field, it's in the shared field editor. If the field is disabled, it won't be updated from the field editor because disabled means refuse input. Also, it may be that when a control that is using the field editor is disabled, it disconnects from the field editor and clears its contents. You could try calling -validateEditing on the field prior to disabling it, which should copy over the text content from the field editor so that the field indeed does have this value. hth, cheers, Graham On 12 Aug 2008, at 3:31 pm, Seth Willits wrote: If a text field has focus, you type blah blah blah into it, and then click a button which asks for its string value and disables the text field, you get blah blah blah back. If a text field has focus, you type blah blah blah into it, and then click a button which disables the text field first and then asks for its string value, you get an empty string... I can make up some reasoning in my head for why that'd make sense, but it just doesn't sit well with me. If the text is *IN THE FIELD* before the field is disabled, then clearly it should be considered its string value. I can't imagine this being a bug simply because *somebody* would have noticed and fixed it by now, but I can't understand why this would be desirable behavior. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
What's the use of the Z_UUID in the Z_METADATA table?
What's the use of the Z_UUID in the Z_METADATA table? Is some kind of check sum or something like that? CoreData uses this value for something? Why is this value different every time the DB is regenerated? Is the generation of it a random-based one? Or is it based on random+another thing? Please don't answer my question with another question!!! At least not at first instance! :D Thanks 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 [EMAIL PROTECTED]
Re: CGImage failed to write Exif Auxiliary metadata to image
Hi Rawitat, (1) You'll need to post your code for help on this. (2) This is probably more appropriate for the CoreGraphics list, http://lists.apple.com/mailman/listinfo/quartz-dev. -Ken On Sun, Aug 10, 2008 at 7:00 AM, Rawitat Pulam [EMAIL PROTECTED] wrote: Hi, I'm having problems trying to write photo metadata. Actually, I want to copy all metadata I could get via the CGImageSourceCopyPropertiesAtIndex function to the destination image (CGImageDestinationRef). Reading the metadata isn't a problem. I could get all that are available. Simple NSLog of the properties confirmed this. The problem is when writing the metadata to the destination image. I tried both CGImageDestinationAddImage and use the properties as the option dictionary, and also tried CGImageDestinationSetProperties. Both didn't work. The metadata in the ExifAux dictionary of the properties, read correctly from the function mentioned above, failed to be written to the output image. I happen to need one of the metadata in that dictionary (LensModel). I looked in the CGImage Properties, it should support the Exif Auxiliary metadata and even have key defined for lens model. However, somehow it can't write the output image with that dictionary. I'm using Mac OS X 10.5 and ImageIO framework 2.0.2 and already have Xcode set the project so it use 10.5 SDK, not 10.4. Is there anyway I could overcome this? Or is it a limitation of current CF/ImageIO framework? Best regards, Rawitat Pulam Rawitat Pulam Lecturer Department of Computing, Faculty of Science Silpakorn University, Sanam Chandra Palace Campus Nakornpathom, Thailand ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/kenferry%40gmail.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: CGPDF - Setting /Rotation
Hi Pedro, Though people on this list will answer quartz questions if they know the answers, this is pretty deep CG. You may have better luck on the CoreGraphics list. http://lists.apple.com/mailman/listinfo/quartz-dev -Ken On Sun, Aug 10, 2008 at 3:02 PM, Pedro Cuenca [EMAIL PROTECTED] wrote: Hello, I have some code that generates PDF data, and I would need to set the /Rotation entry of some of the pages. The following code correctly sets the /MediaBox entry to the rectangle specified in the page dictionary: CGRect mediaBox = CGRectMake( 0.0, 0.0, 1024.0, 768.0 ); NSDictionary * pageInfo = [ NSDictionary dictionaryWithObjectsAndKeys: [NSData dataWithBytes: mediaBox length: sizeof(mediaBox)], kCGPDFContextMediaBox, nil ]; CGPDFContextBeginPage( pdfContext, (CFDictionaryRef) pageInfo ); However, any attempt to set the @Rotation dictionary key seems to be ignored. I have tried using different types (NSNumber, NSString, NSData) for the value with the same unsuccessful result. I couldn't find detailed documentation or sample code about CGPDFContextBeginPage(), although the documentation states it is preferred to CGContextBeginPage() since 10.4. Is there anything I am missing, or is simply the Rotation key silently ignored? If so, can you hint towards any direction I could explore to generate this value in my PDF output? Thanks, -- Pedro ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/kenferry%40gmail.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Cocoa and SOAP without WebServicesCore
I have a number of projects that require communication with a server using SOAP. Over the last couple of years I've been able to make this work on Mac OS X by leveraging WebServicesCore API, wrapped in Objective-C. Now I find myself having to deploy to a platform where not even this feeble API is available. I've been investigating alternatives, and found the gSOAP library, which at the moment looks like the best candidate. However, ideally I would like to use a pure Cocoa solution, or a project which has existing Cocoa wrappers. Does anyone have experiences with gSOAP on OS X, or know of a good alternative? Thanks, patrick -- Patrick Machielse Hieper Software http://www.hieper.nl [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: What's the use of the Z_UUID in the Z_METADATA table?
It is a implementation detail. You should not look inside the sqlite file. 2008/8/12 Gustavo Vera [EMAIL PROTECTED]: What's the use of the Z_UUID in the Z_METADATA table? Is some kind of check sum or something like that? CoreData uses this value for something? Why is this value different every time the DB is regenerated? Is the generation of it a random-based one? Or is it based on random+another thing? Please don't answer my question with another question!!! At least not at first instance! :D Thanks 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/marcelo.alves%40redefined.cc This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Use of AppKit in command-line app on headless node
On Tue, Aug 12, 2008 at 1:28 PM, Rick Hoge [EMAIL PROTECTED] wrote: Thanks again for that very detailed post - I know it sounds like I'm being lazy, but there are other parts of the app that would have to be redesigned to allow the possibility for code use under headless conditions and it's really important to me to know why this is necessary. What you said goes a long way toward clarifying the underlying issues. Obviously I'm not going to risk it now. I'm glad you found it helpful. One obvious alternative is to create a 'Data Object' class that has no AppKit dependencies and stash it as an instance variable in a 'thin' NSDocument subclass that just supports tasks relating to a real document-based app in a window server environment. To make my app work, I need two layers of subclass for my documents (a general NSDocument subclass and several subclasses of this for specific data types) so it's a bit more tricky. I'd need to have a data object class hierarchy and a parallel document hierarchy. If all of the smarts are in your own custom classes, why do you need a hierarchy of NSDocument subclasses? Have a single NSDocument subclass that passes all of the important methods on to your custom classes, and your job should be done. The way the app was originally designed, the top level NSDocument subclass implements custom functionalities used by all document types. There are a few different types of document/data that are related, but different enough that it has worked well to use separate subclasses to implement them. For example different nib files are loaded depending on the document type (something that would go in the NSDocument subclass), and the data model is different (something which would go in the data object class). Loading different nib files would be best accomplished by removing all GUI activity from your NSDocument class altogether, and having NSWindowController subclasses instead. NSDocument is built for this kind of separation of concerns (check out the -makeWindowControllers method), and in my experience it works better even for simpler scenarios. The ability of NSDocument to load and work with a nib directly is, I think, really just a shortcut for simple scenarios. As for whatever else you may have, I think the general guide is to follow MVC, and make sure you have good separation of concerns. You'll probably end up with something of a parallel hierarchy with individual window controllers that know the details of the model they're displaying, but on the other hand this is pretty standard in any circumstances. You'll end up with similar amounts of code, just split into more classes, which I generally think of as being a good thing anyway. If you separate your code cleanly into GUI and non-GUI pieces then you'll be able to run in a daemon safely and probably end up with code that's nicer to work with too. 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 [EMAIL PROTECTED]
Simple NSMutableDictionary problem
How do I have an int as a value in a NSMutableDictionary object? for example: NSMutableDictionary *myDictionary = [NSMutableDictionary alloc]; int i = 1; [myDictionary setValue:1 forKey:@One]; This causes a compiler warning: warning: passing argument 1 of 'setValue:forKey:' makes pointer from integer without a cast It seems like (b/c the type is id for the first param) that NSMutableDictionary wants a pointer. Well, how do I give it just a plain integer copy without having the compiler yell at me? I have been banging my head on my desk over this silly little thing. Also, how do I define a non-mutable dictionary of a particular size? There is no dictionaryWithCapacity function that I can find in the non-mutable version. All the examples I can find are not practical (i.e. hardcoding a dictionary at its creation with random values like @One, @Two, etc.). Thanks! Matt _ Reveal your inner athlete and share it with friends on Windows Live. http://revealyourinnerathlete.windowslive.com?locale=en-usocid=TXT_TAGLM_WLYIA_whichathlete_us___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
[Meet]: LA CocoaHeads Thursday August 14th, 7:30pm
Howdy LA CocoaHeads. We will be meeting this Thursday, 8/14/08 at 7:30pm. We will be discussing our upcoming group study of Aaron Hillegass' book Cocoa Programming for Mac OS X, 3rd Edition. I've had a lot of positive responses to my last email, so I think we'll be able to start this group study on August 28th, meeting every 2 weeks from then on. Besides discussion of the study group, the floor will be open for your Cocoa programming questions. If you're not on the LA CocoaHeads mailing list, please sign up to be kept up-to-date on our schedule and reading assignments. (It's a very low-traffic list, please don't sign up with the Digest version, as digests often go out long after meeting announcements are made and you'll miss timely emails.) http://cocoaheadsla.org/mailman/listinfo/cocoaheadsla-members We meet on Thursday at the offices of E! Entertainment at 7:30pm. Our meeting location is 5750 Wilshire Blvd Los Angeles, CA 90036. Here's a google map of the location: http://www.google.com/maps?f=qhl=enq=5750+Wilshire+Blvd,+Los+Angeles +CA+90036ie=UTF8z=15om=1iwloc=addr Free street parking is available. I'd suggest trying Masselin Ave, which is one block East of Courtyard Place. We meet near the lobby of the West building at 5750 Wilshire Blvd, on the West side of Courtyard Place. There are picknick tables in front of the lobby and we'll gather there starting at 7:20pm. From there we go inside and up to conference room 3A at around 7:45pm . If you arrive late, please ask the building security personnel in the lobby to direct you to the E! Security office, and they will be able to contact the group in conference room 3A and send someone down to meet you. If you have any questions, please email Rob Ross at rross at comcastnetsdhotcom Rob Ross, Lead Software Engineer E! Networks --- ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Simple NSMutableDictionary problem
At 9:12 pm + 12/08/2008, Matt Keyes wrote: How do I have an int as a value in a NSMutableDictionary object? for example: NSMutableDictionary *myDictionary = [NSMutableDictionary alloc]; int i = 1; [myDictionary setValue:1 forKey:@One]; This causes a compiler warning: warning: passing argument 1 of 'setValue:forKey:' makes pointer from integer without a cast It seems like (b/c the type is id for the first param) that NSMutableDictionary wants a pointer. Well, how do I give it just a plain integer copy without having the compiler yell at me? I have been banging my head on my desk over this silly little thing. Also, how do I define a non-mutable dictionary of a particular size? There is no dictionaryWithCapacity function that I can find in the non-mutable version. All the examples I can find are not practical (i.e. hardcoding a dictionary at its creation with random values like @One, @Two, etc.). Thanks! Matt You need to pass it an NSNumber. Do something like this: [myDictionary setObject:[NSNumber numberWithInt:1] forKey:@one]; Mark ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Simple NSMutableDictionary problem
On Aug 12, 2008, at 5:12 PM, Matt Keyes wrote: Also, how do I define a non-mutable dictionary of a particular size? There is no dictionaryWithCapacity function that I can find in the non-mutable version. All the examples I can find are not practical (i.e. hardcoding a dictionary at its creation with random values like @One, @Two, etc.). When you create an immutable dictionary, it contains everything it's ever going to contain, since you can't change its contents. It doesn't make sense to define an immutable dictionary of arbitrary size, since you wouldn't be able to use the empty slots for anything. --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 [EMAIL PROTECTED]
Re: What's the use of the Z_UUID in the Z_METADATA table?
On Tue, Aug 12, 2008 at 1:17 PM, Gustavo Vera [EMAIL PROTECTED] wrote: What's the use of the Z_UUID in the Z_METADATA table? Likely a UUID (Universally Unique Identifier). Is some kind of check sum or something like that? Not likely. CoreData uses this value for something? Likely. Why is this value different every time the DB is regenerated? Different instance of the database so different unique id, as a guess. Is the generation of it a random-based one? Or is it based on random+another thing? man uuid -Shawn ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: I don't understand why this is leaking...
On 13 Aug 2008, at 00:05, Jason Coco wrote: On Aug 12, 2008, at 12:50 , Klaus Backert wrote: About $Null: It it were a reserved word, it would be documented so. The Archives and Serializations Programming Guide for Cocoa says: Keyed Archives ... Naming Values ... You should avoid using “$” as a prefix for your keys. The keyed archiver and unarchiver use keys prefixed with “$” for internal values. Although they test for and mangle user-defined keys that have a “$” prefix, this overhead slows down archiving performance. ... In this case, however, it's the actual value being encoded... not the key name. Also, if you read it, it suggests that you shouldn't use it for performance reasons. It specifically states that it is supposed to properly mangle the $ in a key name (causing the performance loss)... Also: this testing for and mangling overhead, which might slow down archiving performance consists of: in: if user_key starts with '@' then prepend another '@' out:if key starts with '@@' remove one '@'. Would be interesting to know, how much this really slows down the performance. Kind regards, Gerriet. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Cocoa-dev Digest, Vol 5, Issue 1446
Pagtrick, I have a number of projects that require communication with a server using SOAP. Over the last couple of years I've been able to make this work on Mac OS X by leveraging WebServicesCore API, wrapped in Objective-C. Now I find myself having to deploy to a platform where not even this feeble API is available. I've been investigating alternatives, and found the gSOAP library, which at the moment looks like the best candidate. However, ideally I would like to use a pure Cocoa solution, or a project which has existing Cocoa wrappers. Does anyone have experiences with gSOAP on OS X, or know of a good alternative? I've used gSOAP on OSX before in various C++ projects i've done. It works well in that context, though the gSOAP code generation utilities will generate straight-C code as well, which might be easier to wrap with an ObjC class. Regarding the platform you're targeting, I suspect I might be targeting the same platform. I might very well be on the same road as you ... Regards, John Falling You - exploring the beauty of voice and sound http://www.fallingyou.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 [EMAIL PROTECTED]
Re: Simple NSMutableDictionary problem
Matt Keyes wrote: How do I have an int as a value in a NSMutableDictionary object? By wrapping it in an NSNumber. It seems like (b/c the type is id for the first param) that NSMutableDictionary wants a pointer. Well, how do I give it just a plain integer copy without having the compiler yell at me? I have been banging my head on my desk over this silly little thing. You don't. The keys and values for NSDictionary are objects. Also, how do I define a non-mutable dictionary of a particular size? There is no dictionaryWithCapacity function that I can find in the non-mutable version. All the examples I can find are not practical (i.e. hardcoding a dictionary at its creation with random values like @One, @Two, etc.). Um. What are you really trying to accomplish? What would it mean to allocate a non-mutable dictionary with the capacity for 3 objects which could never be set? What would you do with such a thing? Notice that the capacity argument in the NSMutableDictionary factory doesn't define a hard limit; it defines an initial capacity to optimize initial memory allocation. So it doesn't really give you a 3-slot dictionary or something like that. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Opening an external file in a external application
John Love wrote: I still need to figure out if it is possible for Excel to communicate back to my app via some sort of NSNotification. Very much doubt it, though you always can try Tildesoft's Notification Watcher just to be sure. Depending on the sort of operation it is that you're wanting to monitor (i.e. if it's something that doesn't block the main event loop), you may be able to poll Excel via its Apple event interface; clumsy, but better than nothing. For more specific advice and suggestions, write up a complete description of what you need to do, and try asking on the AppleScript-users list as well as that's where most Excel scripters can be found. I don't have much hope of that .. so what I probably need to focus on is how to display the Excel spreadsheet in my document window. I suspect what you really want is Windows, where Office is a major embeddable application framework in itself. ;) Failing that, there are third-party Excel parsers around for various language if all you want to do is display the spreadsheet post- processing, and don't forget stuff like OpenOffice which contain full- blown spreadsheet engines and Excel file importers/exporters. Really though, what's best/practical/possible all depends on what you're trying to do, so if you want more advice then you'll need to provide more information. HTH has -- Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.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 [EMAIL PROTECTED]
Re: Opening an external file in a external application
On 13 Aug 2008, at 4:10 am, John Love wrote: I don't have much hope of that .. so what I probably need to focus on is how to display the Excel spreadsheet in my document window. Any ideas will definitely be very appreciated. The good news (of sorts) is that MS recently published most of the Office formats: http://www.microsoft.com/interop/docs/OfficeBinaryFormats.mspx The bad news is that they run to thousands of pages. Good luck... Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Generate back trace programmatically?
Hello, is there a known reliable way to generate a back trace from the current point in a given thread's call stack? Like some kind of: +(NSString*)getCurrentStackTraceInCRDelimitedString; That would be pretty cool. Thanks in advance! Joe K. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Cocoaheads Lake Forest will be an NSCoder-style get together at a DIFFERENT meeting place tomorrow
Hello, all, CocoaHeads Lake Forest will be meeting on the second Wednesday in August from 7 to 9 PM. Our usual meeting place has had a catastrophic a/c failure, and is apparently a steam bath. We will be meeting, at a DIFFERENT location: Panera Bread, 23592 Rockfield Boulevard, Lake Forest, CA 92630 Since we will not have a projector screen and the like, let's do an NSCoder-style informal meeting. We will have WiFi, so bring laptops, bugs, and ideas. We will likely go into the NSView chapter of Hillegas with some discussion on Bindings. Thanks also to the volunteers we have had for future meetings! I truly appreciate it. Bring your comments, your books, and your bugs, and we will leap right in. As always, details can be found on the cocoaheads web site at www.cocoaheads.org. Thanks go to O'Reilly Media for providing us one of their books as a door prize. Note: if you receive this directly from me, and no longer wish to, please reply offlist, and I will pull you from future mailings. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Generate back trace programmatically?
On Aug 12, 2008, at 5:28 PM, Joseph Kelly wrote: is there a known reliable way to generate a back trace from the current point in a given thread's call stack? Yes. (Hint: See the NSException documentation in Leopard, and the ExceptionHandling framework in Tiger and earlier.) 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 [EMAIL PROTECTED]
Re: Opening an external file in a external application
has wrote: ... and don't forget stuff like OpenOffice which contain full-blown spreadsheet engines and Excel file importers/exporters. I'll make a plug for OpenOffice.org here. The 3.0 release for Mac OS X is going to be completely Aqua native with the interface done in Cocoa. This work is all done. OpenOffice.org also has a SDK that you can install. There is support for C++, Java, and StarBasic. The Java stuff is pretty much cross platform if your environment is setup properly. (There's a script to help with this.) Anyway, I've been working with the SDK using the 3.1 code. I'll check with Juergen if he thinks it will be usable for the 3.0 release which is due in a month or two. HtH, Jason ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Generate back trace programmatically?
Le 13 août 08 à 01:34, Nick Zitzmann a écrit : On Aug 12, 2008, at 5:28 PM, Joseph Kelly wrote: is there a known reliable way to generate a back trace from the current point in a given thread's call stack? Yes. (Hint: See the NSException documentation in Leopard, and the ExceptionHandling framework in Tiger and earlier.) Nick Zitzmann See also man backtrace (require 10.5). ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Accessing memory of another application?
You have to be able to do this - I have seen applications do it - you just have to type in your root password when you start the application. On Tue, Aug 12, 2008 at 1:01 PM, Mike Abdullah [EMAIL PROTECTED]wrote: You can't do this. Each application runs in its own *protected* memory. On 12 Aug 2008, at 17:04, Josh wrote: All, I'm trying to get started w/viewing/editing/interacting with the memory of another running application but I'm not where to get started. You could think of this as being a simple game trainer - which basically allows you to view and edit values in memory. Can anyone point me to where I should get started? Function names/examples would be a GREAT help - I haven't had experience with hooking into another application's memory. 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 [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Accessing memory of another application?
haha no I'm not trying to make a virus :P I'm trying to build a program which will look @ the memory of a particular game, read some values, and perhaps change them :-) Basically like game trainers you see everywhere on windows - but I don't find a lot of them on os x. On Tue, Aug 12, 2008 at 1:18 PM, Negm-Awad Amin [EMAIL PROTECTED]wrote: Am Di,12.08.2008 um 19:01 schrieb Mike Abdullah: You can't do this. Each application runs in its own protected memory. Sometimes you can do this: http://en.wikipedia.org/wiki/Computer_virus ;-) Serious: There are techniques to get acccess to another application memory under some circumstances. None of them is related to Cocoa since there is no class named NSVirus. Amin On 12 Aug 2008, at 17:04, Josh wrote: All, I'm trying to get started w/viewing/editing/interacting with the memory of another running application but I'm not where to get started. You could think of this as being a simple game trainer - which basically allows you to view and edit values in memory. Can anyone point me to where I should get started? Function names/examples would be a GREAT help - I haven't had experience with hooking into another application's memory. 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 [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/negm-awad%40cocoading.de This email sent to [EMAIL PROTECTED] Amin Negm-Awad [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Accessing memory of another application?
Hi Jean-Daniel, Thanks for the response - would you know how to go about determining what some of those public functions are? Unfortunately I'm looking to read the RAM from a game - so I guarantee those functions/memory offsets are not publicly disclosed. Or a way to randomly read offsets to determine what they contain etc I know windows has some applications which will attach to others and show which modules are loaded and some public information - but I'm quite new to the OS X development space so not sure where to search for these types of applications. Thanks again! On Tue, Aug 12, 2008 at 1:33 PM, Jean-Daniel Dupas [EMAIL PROTECTED]wrote: In practice, it's perfectly possible to access other processes memory using public functions (it require some privileges since 10.4 intel). But to do it you have to use the low-level mach API and that's off topic here. And no, code injection is not used only by virus. (see http://rentzsch.com/mach_star/ ) Le 12 août 08 à 19:18, Negm-Awad Amin a écrit : Am Di,12.08.2008 um 19:01 schrieb Mike Abdullah: You can't do this. Each application runs in its own protected memory. Sometimes you can do this: http://en.wikipedia.org/wiki/Computer_virus ;-) Serious: There are techniques to get acccess to another application memory under some circumstances. None of them is related to Cocoa since there is no class named NSVirus. Amin On 12 Aug 2008, at 17:04, Josh wrote: All, I'm trying to get started w/viewing/editing/interacting with the memory of another running application but I'm not where to get started. You could think of this as being a simple game trainer - which basically allows you to view and edit values in memory. Can anyone point me to where I should get started? Function names/examples would be a GREAT help - I haven't had experience with hooking into another application's memory. 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 [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/negm-awad%40cocoading.de This email sent to [EMAIL PROTECTED] Amin Negm-Awad [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Accessing memory of another application?
Correct :-) I mean the last one And yes I'd like to change the outcome of the game - as well as send it commands to do different things - but I have a feeling sending commands to the game is easier than reading what is in it's memory :P Thanks again everyone! On Tue, Aug 12, 2008 at 1:52 PM, Clark Cox [EMAIL PROTECTED] wrote: On Tue, Aug 12, 2008 at 10:31 AM, Bill Cheeseman [EMAIL PROTECTED] wrote: on 2008-08-12 12:04 PM, Josh at [EMAIL PROTECTED] wrote: I'm trying to get started w/viewing/editing/interacting with the memory of another running application but I'm not where to get started. It isn't clear to me what you mean. By game trainer, I assume the Josh means a program that you can run to peek/poke specific locations in the memory space of a videogame to change the outcome of the game (i.e. grant yourself more money/points/life, whatever). When some people ask questions like this, what they really mean is that they want to be able to control the other application's windows, menus, etc. There are several ways to do that, including the Accessibility API and Quartz Event Taps. Other people really mean that they want to share the data used by the other application. If you wrote the other program, you can do that in a variety of ways, including shared preferences and distributed notifications. Even if you didn't write the other program, you may be able to do something with its documents or, if it supports AppleScript, with its terminology dictionary. Even if it doesn't support AppleScript, you can probably control it and thus get at its data using GUI Scripting. Other people mean literally accessing the RAM currently in use by the other application, and I have no idea how you would go about approaching that task. That is, this last meaning. -- Clark S. Cox III [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/josh%40geesu.net This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Accessing memory of another application?
I'm not creating both applications - The application I'm trying to access was written by someone else and has no developer documentation (it's a game) My application should read the memory of the game + change values/read offsets etc... Josh On Tue, Aug 12, 2008 at 2:07 PM, mm w [EMAIL PROTECTED] wrote: If you 're developing the both application you can create a layer/IPC system via shm (shared memory) to communicate between your two apps, what you asked is really a newbie question regarding C programming, before trying cocoa and obj-c you should learn the base Cheers On Tue, Aug 12, 2008 at 9:04 AM, Josh [EMAIL PROTECTED] wrote: All, I'm trying to get started w/viewing/editing/interacting with the memory of another running application but I'm not where to get started. You could think of this as being a simple game trainer - which basically allows you to view and edit values in memory. Can anyone point me to where I should get started? Function names/examples would be a GREAT help - I haven't had experience with hooking into another application's memory. 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/openspecies%40gmail.com This email sent to [EMAIL PROTECTED] -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Accessing memory of another application?
I've worked with GDB before to debug some console applications on linux before (half-life gaming server) - but nothing very extensive. You know of any GUI tools? Also - thanks EVERYONE for your help - this has been very helpful - already checking out mach_star - looks very promising if I can find some function offsets in the game. :-) On Tue, Aug 12, 2008 at 2:10 PM, David Duncan [EMAIL PROTECTED]wrote: On Aug 12, 2008, at 9:04 AM, Josh wrote: I'm trying to get started w/viewing/editing/interacting with the memory of another running application but I'm not where to get started. You could think of this as being a simple game trainer - which basically allows you to view and edit values in memory. Your effectively asking how to create a debugger. If your brave enough to delve into the arcane art of doing so, you can try looking at the GDB sources, and there might be other ways you can do this too, but there be dragons here... -- 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 [EMAIL PROTECTED]