Re: The best way to call Cocoa methods not implemented in previous versions of the SDK?

2011-09-06 Thread Ken Thomases
On Sep 6, 2011, at 6:31 PM, Chris Hanson wrote: > Furthermore, Xcode 3.2.6 and 4.0 added "Latest Mac OS X" and "Latest iOS" > options to the Base SDK pop-up, which is preferable to specifying a > particular OS version for the SDK against which you wish to build. "Preferable" only if you want un

Re: The best way to call Cocoa methods not implemented in previous versions of the SDK?

2011-09-06 Thread Ken Thomases
On Sep 6, 2011, at 6:52 PM, Chris Hanson wrote: > On Sep 6, 2011, at 4:44 PM, Ken Thomases wrote: > >> On Sep 6, 2011, at 6:31 PM, Chris Hanson wrote: >> >>> Furthermore, Xcode 3.2.6 and 4.0 added "Latest Mac OS X" and "Latest iOS" >>>

Re: Lion breaks the ability to "click-through" transparent window areas when the window is resizable.

2011-09-09 Thread Ken Thomases
On Sep 9, 2011, at 10:43 PM, Andreas Mayer wrote: > While doing some additional testing before writing a bug report, I noticed > that Apple's "RoundTransparentWindow" sample code did work as expected! > Turns out that setIgnoresMouseEvents:NO will do the actual breaking. > Bug ID# 10104405 > >

Re: sheet not receiving all events?

2011-09-17 Thread Ken Thomases
On Sep 17, 2011, at 5:19 AM, Torsten Curdt wrote: > So next I re-created the NSPanel step-by-step. As it turns out > unchecking "resize" on the NSPanel causes this weird behavior. > > Any ideas why that is the case? A bug? >From the NSWindow docs: > canBecomeKeyWindow > Indicates whether the wi

Re: Cleaning up a window with blocks

2011-09-29 Thread Ken Thomases
On Sep 29, 2011, at 11:42 AM, Thomas Davie wrote: > A quick scan over the code says that your issue is that you're referring to > theObserver inside theObserver, which, when the block is constructed, as not > yet been assigned the result of addObserverForName:... You can fix that by declaring t

Re: delegate of an NWindowController's window

2011-09-29 Thread Ken Thomases
On Sep 29, 2011, at 5:38 PM, Jamie Pinkham wrote: > On Sep 29, 2011, at 6:22 PM, Koen van der Drift > wrote: > >> I'm trying to get the delegate of a window that is controlled by a custom >> NSWindowController as follows: >> >> NSWindow *win = [self window]; >> id del = [win deleg

Re: Mystery of the missing symbol

2011-10-02 Thread Ken Thomases
On Oct 2, 2011, at 7:50 PM, Graham Cox wrote: > With a deployment target of 10.5, shouldn't the linker or compiler complain > at some point? No, that's not something that the deployment target affects. The whole point of specifying one version via the SDK but an earlier version via deployment

Re: NSPrintInfo and NSPageLayout

2011-10-06 Thread Ken Thomases
On Oct 6, 2011, at 8:46 AM, Torsten Curdt wrote: > 1) Currently I set the width of the view to the page size width minus > the left and right margin. Frankly speaking I have no clue if that is > the right thing to do. Or is imageablePageBounds the one to use? I'm not sure. I know that you can ge

Re: NSPrintInfo and NSPageLayout

2011-10-07 Thread Ken Thomases
On Oct 7, 2011, at 5:05 AM, Torsten Curdt wrote: >> The -runModal method uses the shared print info object, which can be >> obtained with +[NSPrintInfo sharedPrintInfo]. You can change the shared >> print info with +[NSPrintInfo setSharedPrintInfo:], if you have reason to. >> Alternatively, y

Re: NSPrintInfo and NSPageLayout

2011-10-07 Thread Ken Thomases
On Oct 7, 2011, at 5:41 AM, Torsten Curdt wrote: > So I have the panel and the preview is correct. Now I click to change > the orientation from portrait to landscape. Of course at a scaling > factor of 100% it should fill the page, but instead it's just sticks > to the previous size and centers it

Re: NSPrintInfo and NSPageLayout

2011-10-08 Thread Ken Thomases
On Oct 8, 2011, at 8:29 AM, Torsten Curdt wrote: >>> So I have the panel and the preview is correct. Now I click to change >>> the orientation from portrait to landscape. Of course at a scaling >>> factor of 100% it should fill the page, but instead it's just sticks >>> to the previous size and ce

Re: dataWithBytesNoCopy:length:freeWhenDone

2011-10-08 Thread Ken Thomases
On Oct 8, 2011, at 10:05 PM, Quincey Morris wrote: > On Oct 8, 2011, at 14:31 , silve...@wfmh.org.pl wrote: > >> What am I doing wrong? Shouldn't the instance created using >> dataWithBytesNoCopy:length:freeWhenDone simply hold the same bytes as >> the originally provided ones? > I'd guess th

Re: How to get mount options of a mounted volume?

2011-10-11 Thread Ken Thomases
On Oct 11, 2011, at 6:42 AM, Oleg Krupnov wrote: > I'd like to get the mount options of a particular volume (like "rw", > "nobrowse", "automounted" etc.) of a mounted volume, like those I get > when I run "mount" command in the Terminal. There are many ways to get volume information. For the mou

Re: "diskutil info -plist" via Cocoa object?

2011-10-11 Thread Ken Thomases
On Oct 11, 2011, at 1:12 PM, Todd Heberlein wrote: > I was looking at the rich information provided by diskutil: > > $ diskutil info -plist /Volumes/blah > > NSWorkspace has some of this information, but I was wondering if there is a > Cocoa object that provides more of the information pr

Re: List of registered URI handlers?

2011-10-11 Thread Ken Thomases
On Oct 11, 2011, at 5:18 PM, Tito Ciuro wrote: > How would I determine which URI handlers are registered with the system? For > example, amzn://, fb://, etc. > > Is there a way to determine this type of information? Not programmatically, I don't believe. (Launch Services will show you the URI

Re: Window collection behavior, remove from cycle?

2011-10-11 Thread Ken Thomases
On Oct 11, 2011, at 7:37 PM, Arbit Richardi wrote: > I have a fullscreen window that should effectively disable window > cycling; because I've taken over the entire screen, it doesn't makes > sense to be able to bring other windows in front of the fullscreen > one. > > NSWindow's NSWindowCollecti

Re: How to get mount options of a mounted volume?

2011-10-11 Thread Ken Thomases
On Oct 12, 2011, at 1:12 AM, Oleg Krupnov wrote: > On Wed, Oct 12, 2011 at 5:51 AM, Ken Thomases wrote: > >> On Oct 11, 2011, at 6:42 AM, Oleg Krupnov wrote: >> >>> I'd like to get the mount options of a particular volume (like "rw", >>>

Re: How to get key code from "SysDefined" Carbon Event

2011-10-18 Thread Ken Thomases
On Oct 18, 2011, at 11:21 PM, Jerry Krinock wrote: > P.S. typeEventHotKeyID should be eventTypeHotKeyID "Should" in what sense? It's a type indicator, that's why it starts with "type". The type it is conveying in this case is EventHotKeyID, the type of your hotKeyID parameter (and of the val

Re: ARC + return of autoreleased CFType

2011-10-19 Thread Ken Thomases
On Oct 19, 2011, at 8:04 AM, John Pannell wrote: > I've got a category on NSColor to return a CGColor value. Source looks like > this: > > - (CGColorRef)CGColor > { >NSColor *colorRGB = [self > colorUsingColorSpaceName:NSCalibratedRGBColorSpace]; >CGFloat components[4]; >[colorRGB

Re: CFRunLoopObserver causes crash on NSView drag.

2011-10-22 Thread Ken Thomases
On Oct 22, 2011, at 8:53 AM, Mr. Gecko wrote: > static NSAutoreleasePool *pool = nil; > > void runloop(CFRunLoopObserverRef observer, CFRunLoopActivity activity, void > *info) { > if (activity & kCFRunLoopEntry) { > if (pool!=nil) [pool drain]; > pool = [NSAutor

Re: getResourceValue:forKey:error: Unrecognized Selector

2011-10-28 Thread Ken Thomases
On Oct 26, 2011, at 10:20 PM, GW Rodriguez wrote: > I am trying to limit files with certain UTI's from dropping into a table > view. Here's my code so far: > > // in the init method I set the registerForDraggedTypes with NSURLPboardType > > -(NSDragOperation) tableView: (NSTableView*)tv >

Re: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Ken Thomases
On Nov 1, 2011, at 6:31 PM, Jens Alfke wrote: > On Nov 1, 2011, at 3:06 PM, Vojtěch Meluzín wrote: > >> Anyway we are getting out of the topic. Does anyone here know why the modal >> windows work in a plugin (in a normal application) and not from a console >> application? > > Basically, apps a

Re: Printing image represented by multiple tiles using Cocoa

2011-11-04 Thread Ken Thomases
On Oct 23, 2011, at 6:26 AM, Rahul Kesharwani wrote: > I have a application that prints a image of a page of document on paper. The > image is usually tiled and is provided as a set of 4 tiles representing the > entire image. Till now this is being done using Carbon printing APIs . The APIs you

Re: How to get Notification of particular NSUserDefault keys (from the NSGlobalDomain)

2011-11-04 Thread Ken Thomases
On Nov 2, 2011, at 1:47 PM, Travis Griggs wrote: > I'm trying to create a language binding into the Cocoa environment. And my > current problem is how to be able to determine when NSUserDefaults values > have changed. > [...] I just want to know when a user changes a value found in the > NSGlo

Re: ObjectController preventing WindowController from releasing

2011-11-07 Thread Ken Thomases
On Nov 7, 2011, at 10:09 AM, Jonathan Taylor wrote: > I have a window and window controller which in the absence of an object > controller work fine, and both are deallocated when the window is closed. If > I add an ObjectController to the NIB and bind its "Content Object" to "File's > Owner.se

Re: ObjectController preventing WindowController from releasing

2011-11-07 Thread Ken Thomases
On Nov 7, 2011, at 11:16 AM, Jonathan Taylor wrote: > Thanks very much for your reply! You're welcome. >> What would you sensibly bind to the File's Owner itself, rather than one of >> its properties? In other words, what is bound to or through the object >> controller? > > OK, I am not abso

Re: Custom About Box with background shape

2011-11-08 Thread Ken Thomases
On Nov 7, 2011, at 2:04 PM, Chris Paveglio wrote: > I have a custom about box, and it's sort of like Adobe apps, where it's not a > traditional window but a graphic/image I made that is a shape like a hexagon > with a drop shadow. > It works fine and I can call it and I disable the window backgr

Re: NSFileHandle readInBackground vs threading?

2011-11-08 Thread Ken Thomases
On Nov 9, 2011, at 12:45 AM, Kyle Sluder wrote: > On Tue, Nov 8, 2011 at 9:43 PM, Scott Ribe > wrote: >> I assume by "local socket" you mean either a UNIX domain socket or just a >> regular TCP socket on the local machine? If so, just using regular read & >> write calls there's no way for data

Re: NSArray, NSDictionary property attribute issue, retain or copy?

2011-11-13 Thread Ken Thomases
On Nov 13, 2011, at 2:48 AM, ico wrote: > We always use copy attribute on the NSString property declaration because > it will figure it out that when you pass a mutable copy, if will copy then > make the object to be immutable version and assign it to your property, and > it will retain if you pas

Re: Calling a Cocoa library from C

2011-11-14 Thread Ken Thomases
On Nov 14, 2011, at 1:22 PM, Greg Parker wrote: > On Nov 12, 2011, at 2:29 AM, Jean-Daniel Dupas wrote: >> Le 12 nov. 2011 à 03:34, Charles Srstka a écrit : >>> >>> In this day and age, you should probably just use @autoreleasepool instead >>> of NSAutoreleasePool: >>> >>> int get_float_data(fl

Re: Calling a Cocoa library from C

2011-11-14 Thread Ken Thomases
On Nov 14, 2011, at 3:26 PM, Charles Srstka wrote: > On Nov 14, 2011, at 1:40 PM, Ken Thomases wrote: > >> But NSAutoreleasePool doesn't drain on an exception, since it doesn't have >> an explicit scope. Code posted earlier in this thread used @try-@finally to

Re: NSView mouseDown truncated coordinates

2011-11-26 Thread Ken Thomases
On Nov 25, 2011, at 7:17 PM, Steven Spencer wrote: > I'm using a NSTrackingArea in a view to receive mouseMoved events. > The cursor location in the mouseMoved and mouseDragged events have > non-integer coordinates (as expected). > e.g. x:140.601562 y:128.082031 > > However, the mouseDown and mo

Re: Exceptions and autorelease pools

2011-12-06 Thread Ken Thomases
On Dec 6, 2011, at 2:47 PM, Larry Campbell wrote: > void allocAndRaise() > { >[[[NSString alloc] initWithString:@"foo bar and zot"] autorelease]; >[NSException raise:@"foo" format:@"bar"]; > } > > //#define LEAK > > void foo() > { >NSAutoreleasePool *pool = [NSAutoreleasePool new]; >

Re: Locks

2011-12-06 Thread Ken Thomases
On Dec 6, 2011, at 5:28 PM, koko wrote: > In windows we have: > > LONG volatile Mylock = 0; > InterlockedIncrement(&Mylock); > InterlockedDecrement(&Mylock); > > > What should these be replaced with for OSX as in : > > #ifndef MAC > LONG volatile Mylock = 0; > #else > // Mac > #endif > > >

Re: Exceptions and autorelease pools

2011-12-06 Thread Ken Thomases
On Dec 6, 2011, at 8:01 PM, Steve Sisak wrote: > Given that operations have much shorter lifespan than threads, I'd worry > about the leaked NSAutoreleasePool objects in a long-running application. When using Cocoa, exceptions should be, well, exceptional. They should not be used for flow cont

Re: Locks

2011-12-06 Thread Ken Thomases
On Dec 6, 2011, at 9:07 PM, koko wrote: > I cannot use NSLock as this is in a BSD Static lib and I am required to > implement as close to windows as possible. There's no general prohibition against using Cocoa in a static library. I also pointed you to pthread's mutex as an alternative. Also,

Re: Locks

2011-12-06 Thread Ken Thomases
On Dec 6, 2011, at 10:05 PM, Don Quixote de la Mancha wrote: > Contrary to Ken Thomases' assertion, there are all kinds of reasons to > use atomic operations as locking primitives. One is that they cannot > result in process context switches; if you are certain that you will >

Re: NSNetService getInputStream:outputStream: and ARC

2011-12-08 Thread Ken Thomases
On Dec 8, 2011, at 4:11 PM, Martin Linklater wrote: > Hi - I'm writing some OSX NSNetService code with ARC enabled, and I'm getting > the following compile error with the following code: > > @property(strong) NSInputStream* inputStream; > @property(strong) NSOutputStream* outputStream; > > - (v

Re: Singletons with ARC

2011-12-08 Thread Ken Thomases
On Dec 8, 2011, at 11:18 PM, Abdul Sowayan wrote: > Hi Ben, > >> I'm rather confused by the commonly used implementation of singletons. >> (Ignoring the fact that perhaps I shouldn't be using singletons) I would >> appreciate you view on this. >> >> Normally I implement a singleton such as.. >

Re: Singletons with ARC

2011-12-08 Thread Ken Thomases
On Dec 9, 2011, at 1:11 AM, Uli Kusterer wrote: > On 09.12.2011, at 07:55, Ken Thomases wrote: >> >> Double-checked locking is broken. It is an anti-pattern in many languages, >> including the C family under most common implementations. Don't use it. >>

Re: why does this method return an id?

2011-12-11 Thread Ken Thomases
On Dec 11, 2011, at 12:37 PM, Fritz Anderson wrote: > Stream of consciousness answer; I don't have time to make it self-consistent. > With the return type defined as id, the declaration > > NSAtrributedString * attrString = [NSAttributedString string]; > > is not merely useful, but legal with

Re: Mysterious "File exists" message logged to console

2011-12-15 Thread Ken Thomases
On Dec 15, 2011, at 9:29 AM, Mike Abdullah wrote: > I'm trying to track down a bug and have a copy of a customer's console log to > help me. There's rather a lot of messages like this: > > open on /Users/foo/bar/mydocument.package/DSC_0221.jpg: File exists > > Searching the web has been f

Re: Handling UTIs from a Cocoa protocol

2011-12-17 Thread Ken Thomases
On Dec 17, 2011, at 11:13 PM, Charles Srstka wrote: > Chris already answered your main question, but I’d just like to add that it’s > probably better to use UTTypeConformsTo() instead of UTTypeEqual() to test > UTIs. This way, in the hypothetical case that you encounter a subtype of one > of th

Re: Reversed Mouse Wheel in Lion

2011-12-18 Thread Ken Thomases
On Dec 18, 2011, at 2:25 AM, Dany Golubitsky wrote: > As you know, there is an option in Lion to reverse mouse wheel in Lion to be > more like TrackPad. Is there any way to know from the application the state > of this option? Is there any system call for that? >From the AppKit release notes >

Re: Handling UTIs from a Cocoa protocol

2011-12-18 Thread Ken Thomases
On Dec 18, 2011, at 2:36 AM, Charles Srstka wrote: > On Dec 18, 2011, at 2:31 AM, C.W. Betts wrote: > >> So I would do something along the lines of [NSArray >> arrayWithObjects:ClassName1, ClassName2, nil]? > > Or just class1, class2, etc. where class1 and class2 are both of type Class. You ca

Re: NSString looses Umlaute

2011-12-22 Thread Ken Thomases
On Dec 22, 2011, at 9:54 AM, Alexander Reichstadt wrote: > The DBF file format documentation says the header is in binary, then there is > a linefeed (\r), then there is the body. Each field has a fixed length, > wether used or not doesn't matter, the unused rest is filled with spaces. > > So,

Re: Lion: Batch close

2011-12-22 Thread Ken Thomases
On Dec 22, 2011, at 11:52 PM, Appa Rao Mulpuri wrote: > I tried Instruments and it is showing the following crash log: > > 1 libobjc.A.dylib 0x7fff952f5d5e > objc_exception_throw + 43 > 2 CoreFoundation 0x7fff9697e4c9 -[NSException > raise] +

Re: Core Audio Help

2011-12-23 Thread Ken Thomases
On Dec 23, 2011, at 10:46 PM, Phil Hystad wrote: > I was able to go to lists.apple.com earlier today and join the core audio api > list. Got my confirmation e-mail and everything. Plus, even received a > couple of messages posted to core audio from others. There's also the Core Audio forum <

Re: __PRETTY_FUNCTION__.219635

2011-12-24 Thread Ken Thomases
On Dec 24, 2011, at 6:11 AM, Peter Hudson wrote: > I have been making a few ( trivial ) changes to some code and when the app > runs it grinds to a halt with an > Objective-c exception and the next to last item on my stack is > > __PRETTY_FUNCTION__.219635 > > ( the top of the stack being

Re: Interpreting Call Stack when Crash occurs in Inline Function

2011-12-26 Thread Ken Thomases
On Dec 26, 2011, at 4:31 PM, Jerry Krinock wrote: > If you declare a C function as inline, and this function invokes other > functions, does this function appear to invoke itself in the call stack of a > crash report? > > See lines 5-8, in this call stack. 'MyFunction' is declared 'inline' and

Re: RaiseMan Exception

2011-12-29 Thread Ken Thomases
On Dec 29, 2011, at 3:14 PM, Todd Heberlein wrote: > (1) Add one Person object > (2) wait 30-60 seconds. > > crash. > > No clicking on the Edit menu. No clicking away to another application. On Dec 29, 2011, at 2:52 PM, Todd Heberlein wrote: > The exception is from the default template code: >

Re: Code error in Your First Mac App tutorial..

2011-12-29 Thread Ken Thomases
On Dec 29, 2011, at 3:38 PM, Peter Teeson wrote: > I'm familiarizing myself with Xcode 4.2.1 under Lion 10.7.2 so am doing the > "Your First Mac App" tutorial. > > This code snippet from the tutorial is incorrect and causes an error in > compilation. > if (sender == textField) { senderNa

Re: Interpreting GDB Stack Frames

2012-01-01 Thread Ken Thomases
Please don't cross-post. On Jan 1, 2012, at 9:26 AM, Ayers, Joseph wrote: > I have a program crashing loading a NIB that isn't explicitly specified. The > call frame is below From the call frame it looks like it's called in line 8. > How do I reveal the name of the nib file? Probably you shoul

Re: NSOpenPanel and finding files

2012-01-01 Thread Ken Thomases
On Jan 1, 2012, at 11:52 PM, Gideon King wrote: > Hi, I'm trying to use an open panel to open a particular type of file > (.nmcset). > [...] the search field at the top of the open panel, I can't seem to find my > files. > > [...] if I type "fred" or "fred.nmcset" or ".nmcset" into the search

Re: NSTask terminates when NSApplication exits

2012-01-18 Thread Ken Thomases
On Jan 18, 2012, at 3:13 PM, Keary Suska wrote: > Any special handling of NSTask aside, Mac OS X uses Unix-based process > control which closes all child processes when the parent is closed. No, that's not true. Where did you get that? Processes with a controlling terminal get a SIGHUP when th

Re: Is slowing down bindings updates possible?

2012-01-18 Thread Ken Thomases
On Jan 18, 2012, at 6:12 PM, Marcel Weiher wrote: > On Jan 14, 2012, at 18:37 , Kyle Sluder wrote: > >> The UI will register as a KVO observer, or as an NSNotification observer, or >> perhaps the controller will just call -setObjectValue: directly. > > In my experience and opinion most of these

Re: NSTask terminates when NSApplication exits

2012-01-19 Thread Ken Thomases
On Jan 19, 2012, at 12:49 PM, Jens Alfke wrote: > On Jan 19, 2012, at 10:10 AM, Scott Ribe wrote: > >> Not true. It looks like the case at a cursory level because session >> management does this when you're in the terminal. There are various ways to >> arrange for a process to exit when its par

Re: NSSlider and arrangedObjects

2012-01-21 Thread Ken Thomases
On Jan 21, 2012, at 1:00 AM, Quincey Morris wrote: > On Jan 19, 2012, at 03:03 , Tobias Wood wrote: > >> Binding the NSSlider's value to the NSArrayController's >> "arrangedObjects.propertyName" causes my program to get a SIGABRT on >> opening, with the following uncaught exception: >> "Cannot

Re: Strange renaming of Documents folder

2012-01-21 Thread Ken Thomases
On Jan 21, 2012, at 7:32 AM, Martin Hewitson wrote: > I have a user that has been using a document based app of mine and they are > reporting something very strange. > > The user is Spanish and so had a "Documentos" folder in his home directory. > He created a new document in this app then went

Re: Strange renaming of Documents folder

2012-01-21 Thread Ken Thomases
On Jan 21, 2012, at 6:17 PM, John Joyce wrote: > To best verify this yourself, create a new user account on a Mac, set Spanish > to the top of the list of preferred languages in System Preferences > Text & > Language > Log out, log back in to that user to ensure that all apps and processes in >

Re: NSSlider and arrangedObjects

2012-01-22 Thread Ken Thomases
On Jan 21, 2012, at 6:37 PM, Quincey Morris wrote: > On Jan 21, 2012, at 00:54 , Ken Thomases wrote: > >> Table columns do have special handling for array-valued bindings. It's that >> they distribute the array values among their rows. Table columns are not >>

Re: NSTextView : Scroll top when bound-to string changes

2012-01-22 Thread Ken Thomases
On Jan 20, 2012, at 7:33 AM, Jerry Krinock wrote: > I've bound the 'Attributed String' of an NSTextView. This view a detail > view; its text changes whenever the user changes the selection in an > associated table. Upon changing, the text scrolls to the bottom. I want it > to stay at the top

Re: NSOpenPanel problem

2012-01-22 Thread Ken Thomases
On Jan 22, 2012, at 1:24 PM, Jan E. Schotsman wrote: > Suppose I want to display a modeless choose file dialog with the > beginWithCompletionHandler method. > How can I pass some context info to the handler? Blocks capture whatever local variables you reference within them. If you reference in

Re: NSOpenPanel problem

2012-01-23 Thread Ken Thomases
On Jan 23, 2012, at 9:16 AM, Jan E. Schotsman wrote: > On Jan 23, 2012, at 11:37 AM, Conrad Shultz wrote: > >>> if I try to pass on someString in a C struct (contextInfo) then the >>> compiler complains that ARC doesn't like object pointers in C structs. >>> I could serialize and unserialize the

Re: NSOpenPanel problem

2012-01-23 Thread Ken Thomases
On Jan 23, 2012, at 12:22 PM, Jan E. Schotsman wrote: > On Jan 23, 2012, at 5:08 PM, Ken Thomases wrote: > >> If you're supporting Leopard, then you can't use ARC and the original >> problem goes away. > > ??? I have set development target = 10.7 SDK, deploym

Re: Programmatically create aliases to unmounted servers?

2012-01-24 Thread Ken Thomases
On Jan 24, 2012, at 4:24 PM, Zajkowski, James wrote: > I'm looking for a way to construct an alias file (a bookmark file) with a > specific but unmounted file server location. That is, I want to put an icon > on user's desktops that says "Network Space" and have it resolve to > afp://ser.ver.a

Re: KeyCode to Character mapping

2012-01-25 Thread Ken Thomases
On Jan 24, 2012, at 1:30 AM, Akhil Jindal wrote: > I am developing a desktop application on cocoa and am trying to handle the > menu keyboard shortcuts on my own. That's weird. Why? Maybe your reasons for doing so are based on faulty assumptions or what you're _really_ trying to accomplish --

Re: KeyCode to Character mapping

2012-01-25 Thread Ken Thomases
On Jan 25, 2012, at 5:03 AM, Akhil Jindal wrote: > On Wed, Jan 25, 2012 at 1:24 PM, Ken Thomases wrote: > >> What are you passing in for the modifiers? I would expect that passing in >> cmdKeyBit would result in UCKeyTranslate returning latin characters. > > I'm

Re: KeyCode to Character mapping

2012-01-25 Thread Ken Thomases
On Jan 25, 2012, at 5:51 AM, Akhil Jindal wrote: > On Wed, Jan 25, 2012 at 5:09 PM, Ken Thomases wrote: > >> Oops, sorry. I should have said "cmdKey" instead of "cmdKeyBit", and I >> should have also said it needs to be right-shifted by 8 bits. So, try

Re: Bindings crash

2012-01-26 Thread Ken Thomases
On Jan 26, 2012, at 4:12 AM, Arved von Brasch wrote: > - (NSString *)usedSpace { > NSDictionary *systemInfo = [[NSFileManager defaultManager] > attributesOfFileSystemForPath: [[NSBundle mainBundle] bundlePath] error: nil]; > NSDecimalNumber *total = [NSDecimalNumber decimalNumberWithS

Re: ARC and blocks

2012-01-26 Thread Ken Thomases
On Jan 26, 2012, at 3:51 PM, Jan E. Schotsman wrote: > This code is given in the "Transitioning to ARC Release Notes" as an example > of accomodating blocks in an ARC environment: > > __block MyViewController *myController = [[MyViewController alloc] init…]; > // ... > myController.completionHan

Re: How to get the dispatch queue for the current thread's runloop?

2012-01-27 Thread Ken Thomases
On Jan 27, 2012, at 2:14 PM, Jens Alfke wrote: > I'm really used to using -performSelector:withObject:afterDelay: to make > something happen later. But I'd much rather use a block than a target/action. > I can't find any API for this, however. Am I missing something? What I want > is basically

Re: Blocks and Methods...

2012-01-28 Thread Ken Thomases
On Jan 28, 2012, at 10:40 AM, R wrote: > I originally chose to hold the block in an array, but that failed. > I'm still confused over that... By itself, an array only retains the block. A block must be explicitly copied if it is to outlive the scope that created it. And, of course, that copy

Re: getting a nsurl file size

2012-01-28 Thread Ken Thomases
On Jan 28, 2012, at 11:53 PM, Eric Smith wrote: > I'm trying to determine the size of a file on a server. If I send the > following message to an NSURL named "path", I get: > > [path getResourceValue:&value forKey:@"content-length" error:&error]; > > value comes back nil. Two things: * Did t

Re: NSPopUpButton Binding Frustration

2012-01-30 Thread Ken Thomases
On Jan 30, 2012, at 12:32 AM, Seth Willits wrote: > Say I have a file type popup in a save sheet for saving an image: > > @property NSString * fileType; > > - (NSArray *)fileTypes > { > return [NSArray arrayWithObjects:(id)kUTTypeJPEG, (id)kUTTypePNG, > (id)kUTTypeTIFF, nil]; > } > > - (

Re: NSPopUpButton Binding Frustration

2012-01-30 Thread Ken Thomases
On Jan 30, 2012, at 1:12 PM, Seth Willits wrote: > On Jan 30, 2012, at 8:26 AM, Ken Thomases wrote: > >> content -> fileTypes >> contentValues -> fileTypes.displayName >> contentObjects -> fileTypes.uti >> selectedObject -> fileType > > &g

Re: How to deactivate an app

2012-01-31 Thread Ken Thomases
On Jan 31, 2012, at 1:55 AM, Gerriet M. Denkmann wrote: > I have an app A, where I can select a word and press a button. > This starts (or activates) another app called B, which displays some > information about this word. > But if there is no information about the word, app B should make app A

Re: How to deactivate an app

2012-01-31 Thread Ken Thomases
On Feb 1, 2012, at 1:20 AM, Gerriet M. Denkmann wrote: > I tried: > > - (void)applicationWillBecomeActive:(NSNotification *)aNotification > { > (void)aNotification; > > NSRunningApplication *currentApplication = [ NSRunningApplication > currentApplication ]; > NSString *bundle

Re: Transparent window not getting mouse down events

2012-02-01 Thread Ken Thomases
On Feb 1, 2012, at 6:59 AM, Marshall Houskeeper wrote: > I was confused because the NSWindows method ignoresMouseEvents returns false > after I initialize the window. So the calling of the setIgnoresMouseEvents > must have some other side effect. Yes, it seems that there are actually three s

Re: Odd behavior of NSItemReplacementDirectory

2012-02-09 Thread Ken Thomases
On Feb 9, 2012, at 2:38 PM, Jens Alfke wrote: > The behavior of NSItemReplacementDirectory is contrary to the docs and sort > of suboptimal. Am I missing something or are the docs just wrong? > > (1) The docs say the ‘appropriateForURL’ parameter is "a directory inside of > which you want to cr

Re: copy & isEqual nightmares

2012-02-12 Thread Ken Thomases
Both of the code snippets on that StackOverflow thread have bugs if you're manually managing memory (as opposed to using GC or ARC). Since they use the dot syntax to set the property of the copy, they are invoking the setter. In all probability, the setter does memory management. It takes own

Re: Odd display of percent character

2012-02-13 Thread Ken Thomases
On Feb 13, 2012, at 11:04 AM, Chris Paveglio wrote: > I'm having an issue with the percent character being displayed as random > numbers in an NSAlertPanel (modal). My app has an ivar, "fullString", > including the usual property/synthesize getters and setters, there is nothing > special about

Re: copy & isEqual nightmares

2012-02-16 Thread Ken Thomases
On Feb 15, 2012, at 11:39 AM, Quincey Morris wrote: > I was just acknowledging the difference between (say) a NSMutableDictionary > whose internal state changes over time without affecting the objects it's > isEqual to (just itself, in this case) [...] A dictionary is equal to any other diction

Re: CGWarpMouseCursorPosition and large delta/offset at next mouse motion event

2012-02-16 Thread Ken Thomases
This isn't really a Cocoa issue. Seems more appropriate for quartz-dev... On Feb 16, 2012, at 3:29 AM, Samuel Williams wrote: > I'm using CGWarpMouseCursorPosition to position the cursor in the window > after grabbing it and hiding it. I'm using > CGAssociateMouseAndMouseCursorPosition(true/fals

Re: copy & isEqual nightmares

2012-02-16 Thread Ken Thomases
On Feb 16, 2012, at 10:47 AM, Quincey Morris wrote: > On Feb 16, 2012, at 08:30 , Ken Thomases wrote: > >> A dictionary is equal to any other dictionary with equal keys and values. >> That's true for a mutable dictionary, too. Mutating a mutable dictionary >> wil

Re: copy & isEqual nightmares

2012-02-16 Thread Ken Thomases
On Feb 16, 2012, at 3:47 PM, Quincey Morris wrote: > On Feb 16, 2012, at 11:44 , Ken Thomases wrote: > >> Well, the documentation for -[NSDictionary isEqualToDictionary:] >> <https://developer.apple.com/library/ios/DOCUMENTATION/Cocoa/Reference/Foundation/Classes/NSDicti

Re: __block __weak - am I doing this right?

2012-02-16 Thread Ken Thomases
On Feb 16, 2012, at 2:05 PM, Greg Parker wrote: > On Feb 16, 2012, at 8:22 AM, Matt Neuburg wrote: >> On Wed, 15 Feb 2012 16:20:50 -0800, Greg Parker said: >>> >>> Are you using GC or ARC? I think this is safe with GC but not safe with >>> ARC, but I'm not an expert in the NSNotificationCenter

Re: standard user or admin user ?

2012-02-16 Thread Ken Thomases
On Feb 16, 2012, at 3:10 PM, Jens Alfke wrote: > On Feb 16, 2012, at 9:46 AM, Rajendran P wrote: > >> Is there any cocoa by which i can determine , if the logged in user is >> standard user or admin user ? > > I believe you just use regular POSIX APIs to determine whether the user is a > mem

Re: copy & isEqual nightmares

2012-02-17 Thread Ken Thomases
On Feb 17, 2012, at 2:33 PM, Ben Kennedy wrote: > On 16 Feb 2012, at 3:54 pm, Ken Thomases wrote: > >> In other words, you're being silly. It's clear to everyone that -[NSString >> isEqual:] must have semantics built on -[NSString isEqualToString:], which >>

Re: My runloop-based async code breaks with GCD

2012-02-17 Thread Ken Thomases
On Feb 17, 2012, at 6:22 PM, Jens Alfke wrote: > The trouble I’m having is that neither GCD dispatch_queues nor > NSOperationQueues seem to have runloops, so any code that explicitly or > implicitly uses runloops for scheduling breaks when it’s invoked from a block > running on a dispatch or op

Re: I added an exception breakpoint to my app...

2012-02-24 Thread Ken Thomases
Kyle misunderstood what you were asking. The debugger is simply reporting that it found the proper place to set the breakpoint. It resolved from a symbol to an address. Nothing has actually happened. No exception was raised or caught. The breakpoint has not yet been hit. The debugger is jus

Re: How do IB inspector fields relate to the actual objects?

2012-02-29 Thread Ken Thomases
On Feb 29, 2012, at 1:03 PM, Howard Moon wrote: > I've added a Panel to a nib for an audio plug-in I'm working on, and am > having trouble determining how the IB Inspector settings relate to the actual > objects, such as an NSPanel. In the Inspector, there are several Style Mask > checkb

Re: textfield problem

2012-03-03 Thread Ken Thomases
On Mar 2, 2012, at 2:35 PM, H. Miersch wrote: > i have a problem with a text field that won't accept any input. the textfield > is one of three on a panel that appears only when the input is needed. I > activate the panel with this line:[app beginSheet:Sheet > modalForWindow:mainWindow moda

Re: textfield problem

2012-03-03 Thread Ken Thomases
On Mar 3, 2012, at 3:17 AM, H. Miersch wrote: >> Does the panel have a title bar or resize indicator -- not when it's running >> as a sheet, but in its style mask? See the documentation for -[NSWindow >> canBecomeKeyWindow]. > > as i said in my previous email, i re-did it using a window. and t

Re: Can't get same window to show twice

2012-03-03 Thread Ken Thomases
On Mar 2, 2012, at 4:34 AM, -Sergei G- wrote: > 1st time I click on menu item I see the window. I then use close button. > Click on the same menu item and get nothing. Action handler executes, but I > see no window. > > In app delegate: > > @property (strong, nonatomic) NSWindowController *myW

Re: No indentation when displaying an icon in an NSMenuItem

2012-03-08 Thread Ken Thomases
On Mar 6, 2012, at 7:21 PM, Prime Coderama wrote: > I am trying to add an icon to only one NSMenuItem item but it is indenting > the icon and text by 1 level. > > I tried to set the setIndentationLevel to "0" but that doesn't work. > > An example of what I am trying to achieve can be seen in th

Re: Why are 2 Terminal windows opening with NSAppleScript?

2012-03-08 Thread Ken Thomases
On Mar 7, 2012, at 9:32 PM, Prime Coderama wrote: > If no Terminal app is open, the following code opens TWO Terminal windows. > Why is it doing this? I only want one window to open. > > If only one Terminal window is open, then the following code opens only ONE > additional window. > > NSAppl

Re: worker thread iterating over array - SLOW

2011-01-31 Thread Ken Thomases
On Jan 31, 2011, at 8:48 PM, Peter Lübke wrote: > Thanks Ken, You're welcome. > Am 01.02.2011 um 02:07 schrieb Ken Thomases: > >> So, you have effectively failed to shift the work from the main thread to >> the worker thread. The main thread is a "server&qu

Re: NSDateFormatter misbehaving

2011-02-02 Thread Ken Thomases
On Feb 2, 2011, at 3:14 PM, lorenzo7...@gmail.com wrote: > Here is the code I'm using to format a date string: > > > NSDate *date = [NSDate date]; > > NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; > [dateFormatter setDateStyle:NSDateFormatterBehavior10_4]; The above should u

Re: Read Protected File

2011-02-04 Thread Ken Thomases
On Feb 4, 2011, at 7:10 AM, Jeremy Matthews wrote: > I'm trying to read a protected file (one which I don't have rights to > access). The only way I know around this is with an Authorization routine + > NSTask, or to create a Helper Tool. > Is there a better way? Don't know if it's better, but

<    1   2   3   4   5   6   7   8   9   10   >