Re: NSDistributedNotificationCenter questions.

2011-02-19 Thread Mr. Gecko
Something like this? static NSAutoreleasePool *pool = nil; void runloop(CFRunLoopObserverRef observer, CFRunLoopActivity activity, void *info) { if (activity & kCFRunLoopEntry) { if (pool!=nil) [pool drain]; pool = [NSAutoreleasePool new]; } else i

NSTextAttachment, MouseOver, GlyphPosition

2011-02-19 Thread Peter Krajčík
Hi, I have subclassed NSTextAttachment/NSAttachemntCell pair and I need to implement mouseOver. NSTextAttachment are inserted programatically to NSTextField's NSAttributedString object, displayed correctly and I can manipulate them. I have found not very elegant way how to create and track NSTra

inter-process locks

2011-02-19 Thread Alexander Cohen
Hello, Is there anyway to do interprocess locks using cocoa ( like a Mutex in Win32 )? The best i've found is not cocoa and uses flock but the man pages say its advisory only which is kindof scary. any help appreciated. thx AC___ Cocoa-dev mailing

Getting NSScrollView to ignore scrolling

2011-02-19 Thread Andrew Shamel
HI All, I have a NSTableView/NSScrollView setup that I've configured automatically to resize to contain the content of the table. This may sound silly, but I don't want scrolling behavior, but NSTableView seems to be designed to be inside a NSScrollView. My question is this: how do I get th

Re: inter-process locks

2011-02-19 Thread Michael Babin
On Feb 19, 2011, at 12:29 PM, Alexander Cohen wrote: > Is there anyway to do interprocess locks using cocoa ( like a Mutex in Win32 > )? The best i've found is not cocoa and uses flock but the man pages say its > advisory only which is kindof scary. NSDistributedLock:

Connect iPad to Servlets on a Web Server

2011-02-19 Thread Bing Li
Dear all, I am a new programmer on iMac. I have a Tomcat Web server. I would like to connect my iPad to the servlets on the Web server. However, I have not got the approaches to do that. I am reading the articles, URL Loading System Programming Guide and CFNetwork Programming Guide. According t

Re: inter-process locks

2011-02-19 Thread Greg Guerin
Alexander Cohen wrote: Is there anyway to do interprocess locks using cocoa ( like a Mutex in Win32 )? The best i've found is not cocoa and uses flock but the man pages say its advisory only which is kindof scary. man semget man semop man semctl They're part of the Posix IPC functions, so

NSCalendar dateByAddingComponents: yields inconsistent results

2011-02-19 Thread Jim Thomason
I'm utterly stumped. I haven't managed to boil this down to a succinct test case yet. It only intermittently appears, basically, after I end up doing a "lot" of date calculations on a separate thread. For some nebulous value of a "lot". The gyst is this - on occasion, NSCalendar's dateByAddingCom

Re: inter-process locks

2011-02-19 Thread Alexander Cohen
Yeah, that seems like a good option but since its based off of flock, it has the same issues. Things like apps crashing or not unlocking by error will prevent other processes from obtaining the lock even though the lock is not 'really' in use anymore. AC On Feb 19, 2011, at 1:58 PM, Michael Ba

Re: NSCalendar dateByAddingComponents: yields inconsistent results

2011-02-19 Thread Stephen J. Butler
On Sat, Feb 19, 2011 at 1:16 PM, Jim Thomason wrote: > static NSCalendar* gmtCalendar = nil; > -(NSCalendar*) gmtCalendar { >    @synchronized(self) { >        if (gmtCalendar == nil) { >            NSLog(@"NEEDS NEW GMT!"); >            NSCalendar* newGMTCalendar = [[NSCalendar alloc] > initWithC

Re: inter-process locks

2011-02-19 Thread Stephen J. Butler
On Sat, Feb 19, 2011 at 1:20 PM, Alexander Cohen wrote: > Yeah, that seems like a good option but since its based off of flock, it has > the same issues. Things like apps crashing or not unlocking by error will > prevent other processes from obtaining the lock even though the lock is not > 'rea

Re: NSCalendar dateByAddingComponents: yields inconsistent results

2011-02-19 Thread Jim Thomason
> Is this method called from different threads? NSCalendar is > thread-unsafe (not to be shared across threads): Gaaah. Yes, that's exactly it. I'm glad I tracked the issues with gmtCalendar and posted the method. I re-wrote it to use the threadDictionary instead of a static and all my problems m

RE: NSComboxBox alternative

2011-02-19 Thread FirstName LastName
The idea of using a combo box is that the text field contains the currently selected path while the list contains a history of previously selected paths. The NSPathControl only supports a single path and the NSPathStylePopup does not allow to choose a path from the previous history but a totall

RE: NSComboxBox alternative

2011-02-19 Thread FirstName LastName
I think the NSTableView in not retractable. It wastes space to have the whole history always displayed when in many cases the user will just choose the most recently used path. Also, multiple NSPathControls in popup mode is not the purpose of this UI. The idea is to choose a path but to keep a

Re: NSComboxBox alternative

2011-02-19 Thread Kyle Sluder
On Sat, Feb 19, 2011 at 12:15 PM, FirstName LastName wrote: > I think the NSTableView in not retractable. It wastes space to have the whole > history always displayed when in many cases the user will just choose the > most recently used path. Also, multiple NSPathControls in popup mode is not >

Re: NSTextAttachment, MouseOver, GlyphPosition

2011-02-19 Thread Peter Krajčík
Hi, one of the ways could be to use own NSLayoutManager and use it to draw NSAttributed string in my subclass of NSTextAttachmentCell and its draw method. NSLayoutManager has boundingRectForGlyphRange:inTextContainer: method from which I could obtain bounds of glyph representing NSTextAttachmen

-[NSSet containsObject:] returns NO when it should return YES

2011-02-19 Thread Michael Crawford
I'm trying to compare instances of NSNumber using NSSet. I have a set of numbers, which represent 64-bit persistent IDs for iTunes media-items. I access these values using the -[NSNumber longLongValue] method. I'm adding them to an instance of NSSet and then use that instance to determine whe

Re: -[NSSet containsObject:] returns NO when it should return YES

2011-02-19 Thread Scott Ribe
On Feb 19, 2011, at 3:17 PM, Michael Crawford wrote: > I assumed that the -[NSObject hash] method is used to determining equality > and that to different NSNumber instances will hash out to the same value if > they have the same 64-bit value stored inside. I'm pretty sure that, for instance, tw

Re: -[NSSet containsObject:] returns NO when it should return YES

2011-02-19 Thread Jim Correia
On Feb 19, 2011, at 2:17 PM, Michael Crawford wrote: > I'm trying to compare instances of NSNumber using NSSet. I have a set of > numbers, which represent 64-bit persistent IDs for iTunes media-items. I > access these values using the -[NSNumber longLongValue] method. I'm adding > them to an

Re: -[NSSet containsObject:] returns NO when it should return YES

2011-02-19 Thread Andy Lee
On Feb 19, 2011, at 5:17 PM, Michael Crawford wrote: > When I look inside the set, you will see that the value -1748299021286640132 > is in the set. However, when -containsObject is called, it returns NO. Are you sure the objects you are dealing with are always NSNumbers? If one of them is an N

Re: Getting NSScrollView to ignore scrolling

2011-02-19 Thread Peter Lübke
HI All, I have a NSTableView/NSScrollView setup that I've configured automatically to resize to contain the content of the table. This may sound silly, but I don't want scrolling behavior, but NSTableView seems to be designed to be inside a NSScrollView. My question is this: how do I get

Re: Getting NSScrollView to ignore scrolling

2011-02-19 Thread Quincey Morris
On Feb 19, 2011, at 16:25, Peter Lübke wrote: >> My question is this: how do I get the scroll view to ignore scrolling >> messages? The tables/scrollviews are sitting on views that are part of a >> homebrew collection view, and the scrolling "catches" on them, even though >> there's no scrolli

[Solved]: Trouble with design pattern

2011-02-19 Thread Carlos Eduardo Mello
Thanks Andy, Jon, Kirk, Murat and everyone who responded. All your advices were very usefull. I decided to use the delegate pattern and everything is working perfectly now. In fact I am starting to be able to implement sevall of my planed funcionalities just by adding messages to my working

Re: inter-process locks

2011-02-19 Thread Ken Thomases
On Feb 19, 2011, at 12:29 PM, Alexander Cohen wrote: > Is there anyway to do interprocess locks using cocoa ( like a Mutex in Win32 > )? The best i've found is not cocoa and uses flock but the man pages say its > advisory only which is kindof scary. "Advisory" only means that programs need to e

Re: -[NSSet containsObject:] returns NO when it should return YES

2011-02-19 Thread Ken Thomases
On Feb 19, 2011, at 4:17 PM, Michael Crawford wrote: > I also assumed that whether or not the value is signed or unsigned; negative > or positive makes no difference as long as calling the same accessor method > on both NSNumber instances returns the same result. I think this is wrong. I can't

Re: -[NSSet containsObject:] returns NO when it should return YES

2011-02-19 Thread Michael Crawford
On Feb 19, 2011, at 9:31 PM, Ken Thomases wrote: > On Feb 19, 2011, at 4:17 PM, Michael Crawford wrote: > >> I also assumed that whether or not the value is signed or unsigned; negative >> or positive makes no difference as long as calling the same accessor method >> on both NSNumber instances

Re: -[NSSet containsObject:] returns NO when it should return YES

2011-02-19 Thread Kyle Sluder
On Feb 19, 2011, at 7:01 PM, Michael Crawford wrote: > > I assumed this is the case because regardless of whether or not you call > -boolValue or -longLongValue, -hash returns the same result. I've already > shown that they do indeed contain the same value, when -longLongValue is > called on

Re: -[NSSet containsObject:] returns NO when it should return YES

2011-02-19 Thread Andy Lee
On Feb 19, 2011, at 6:08 PM, Andy Lee wrote: > I just did a quick test and confirmed that you do get two different instances > with the same hash, but they are in face isEqual: to each other and hence > their presence in a set is detected, as I would expect. > > NSNumber *one = [NSNumber numbe

Re: -[NSSet containsObject:] returns NO when it should return YES

2011-02-19 Thread Ken Thomases
On Feb 19, 2011, at 9:01 PM, Michael Crawford wrote: > On Feb 19, 2011, at 9:31 PM, Ken Thomases wrote: > >> On Feb 19, 2011, at 4:17 PM, Michael Crawford wrote: >> >>> I also assumed that whether or not the value is signed or unsigned; >>> negative or positive makes no difference as long as ca

Re: -[NSSet containsObject:] returns NO when it should return YES

2011-02-19 Thread Quincey Morris
On Feb 19, 2011, at 19:06, Kyle Sluder wrote: > On Feb 19, 2011, at 7:01 PM, Michael Crawford wrote: > >> >> I assumed this is the case because regardless of whether or not you call >> -boolValue or -longLongValue, -hash returns the same result. I've already >> shown that they do indeed cont

Re: -[NSSet containsObject:] returns NO when it should return YES

2011-02-19 Thread Ken Thomases
On Feb 19, 2011, at 9:26 PM, Quincey Morris wrote: > On Feb 19, 2011, at 19:06, Kyle Sluder wrote: > >> Your experience indicates that -containsObject: uses pointer identity, >> whereas -member: uses -isEqual:. > > What's especially confusing is that -[NSArray containsObject:] is documented >

Re: Multithread, Window, Event, Runloop, ... => Headache

2011-02-19 Thread Marco Antognini
On Feb 19, 2011, at 3:10, Ken Thomases wrote: > On Feb 17, 2011, at 8:48 AM, Marco Antognini wrote: > >> But now I'm stuck with a problem : is there any way to create/destroy >> window/view, make them live (e.g. rendering process) and get event >> notification; all that only in a worker thread

mount .dmg and run file from there

2011-02-19 Thread Crni Gorac
Am working on a small application that would download given larger .dmg installer, showing download progress along the way, and then mount .dmg image and run .pkg file from this image. I have everything working properly, except for that last step. I'm using NSWorkspace openFile to mount the .dmg

How to use Photo Albums of the landscape mode iphone app

2011-02-19 Thread 吴明
HI Guys: My iphone app Interface Orientation is landscape. I need load a picture to my app. so. I use if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypePhotoLibrary]) { picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; } [self presentModal

NSDateFormatter initialization+formatting not working

2011-02-19 Thread Markus Spoettl
Hello, I'm not getting why this is not working: NSDate *date = [NSDate date]; NSDateFormatter *df1 = [[NSDateFormatter alloc] initWithDateFormat:@"EEE d" allowNaturalLanguage:NO]; NSString *s1 = [df1 stringFromDate:date]; s1 ---> @"EEE d"; NSDateFormatter *df2 = [[NSDateFormatter alloc

Keeping Multiple Identical Tables in Synch - Weird SortDescriptor Binding Problem

2011-02-19 Thread Peter Zegelin
I have several tables showing the same data that need to stay in synch. The tables are instantiated via the same nib so they are identical. The tables get their data through an array controller bound to an array in a shared object and their selection stay in synch by the array controller being

Re: NSDateFormatter initialization+formatting not working

2011-02-19 Thread Ken Thomases
On Feb 19, 2011, at 9:53 PM, Markus Spoettl wrote: > NSDateFormatter *df1 = [[NSDateFormatter alloc] initWithDateFormat:@"EEE d" > allowNaturalLanguage:NO]; > NSString *s1 = [df1 stringFromDate:date]; > > s1 ---> @"EEE d"; > > NSDateFormatter *df2 = [[NSDateFormatter alloc] init]; > [df2 setDa

Re: Keeping Multiple Identical Tables in Synch - Weird SortDescriptor Binding Problem

2011-02-19 Thread Quincey Morris
On Feb 19, 2011, at 20:00, Peter Zegelin wrote: > I have several tables showing the same data that need to stay in synch. The > tables are instantiated via the same nib so they are identical. The tables > get their data through an array controller bound to an array in a shared > object and the

Re: -[NSSet containsObject:] returns NO when it should return YES

2011-02-19 Thread Andy Lee
On Feb 19, 2011, at 10:31 PM, Ken Thomases wrote: > On Feb 19, 2011, at 9:26 PM, Quincey Morris wrote: > >> On Feb 19, 2011, at 19:06, Kyle Sluder wrote: >> >>> Your experience indicates that -containsObject: uses pointer identity, >>> whereas -member: uses -isEqual:. >> >> What's especially c

Re: -[NSSet containsObject:] returns NO when it should return YES

2011-02-19 Thread Roland King
On 20-Feb-2011, at 1:54 PM, Andy Lee wrote: > > One thing I'm puzzled about is that NSSet does not copy its entries the way > NSDictionary copies its keys. This is implied by the member: documentation > quoted earlier: > > "If the set contains an object equal to object (as determined by isEqu

Re: -[NSSet containsObject:] returns NO when it should return YES

2011-02-19 Thread Andy Lee
Ah, thanks. That's here: I was only looking at the NSSet docs. --Andy On Feb 20, 2011, at 1:03 AM, Roland King wrote: > > On 20-Feb-2011, at 1:54 PM, Andy Lee wrote: > >> >> One thing I'

Re: mount .dmg and run file from there

2011-02-19 Thread Uli Kusterer
On 19.02.2011, at 13:12, Crni Gorac wrote: > Am working on a small application that would download given larger > .dmg installer, showing download progress along the way, and then > mount .dmg image and run .pkg file from this image. I have everything > working properly, except for that last step.

Re: -[NSSet containsObject:] returns NO when it should return YES

2011-02-19 Thread Greg Guerin
Michael Crawford wrote: The following gdb console output demonstrates an instance of a media-item persistent-ID property that, when queried gives a large unsigned number. When I ask again using the -longLongValue method, I get the answer I was expecting. When I look inside the set, you