Re: archiving report

2013-02-26 Thread Gwynne Raskind
nvinced that Apple has no interest > in fixing these problems. This is the exact attitude that causes Apple to be perceived as not having interest. Please file the bugs - the engineers reading this list can't give high priority to things that developers don't report, as much as th

Re: am I being called on the correct GCD queue?

2013-02-09 Thread Gwynne Raskind
tingOnMyQueue { return dispatch_get_specific(kMYObjectIsOnItsOwnQueueKey) == (__bridge void *)self; } -- Gwynne Raskind On Feb 9, 2013, at 7:19 PM, Kyle Sluder wrote: > On Feb 9, 2013, at 12:11 PM, Matt Neuburg wrote: > >> If dispatch_get_current_queue() is deprecated > >

Re: Could somebody please fix NSTimer?

2013-01-12 Thread Gwynne Raskind
patch_source_set_event_handler(timer, NULL); dispatch_source_set_cancel_handler(timer, NULL); // kill the cycle }); dispatch_resume(timer); Boom, self-destructing timer. Warning: Written in Mail and totally untested. Also, don't do this, just

Re: NSMutableData and Pinned Memory buffers..

2012-12-13 Thread Gwynne Raskind
s would be so wrong I don't think it's that bad to break it). @interface NSData (MutableImmutable) - (void *)mutableBytes; @end @implementation NSData (MutableImmutable) - (void *)mutableBytes { #if __cplusplus return const_cast(self.bytes); #else return (void *)self.b

Re: blocks and id

2012-12-12 Thread Gwynne Raskind
sed block versus one that's been copied to the heap will have different classes, which are probably siblings (i.e. [[_NSConcreteStackBlock class] isKindOfClass:[_NSMallocBlock class]] == NO). My solution to this issue has been the "exclusion" case, i.e. if (![obj isKindOfClass:[a

Re: REST, SOAP, XML-RPC, ...?

2012-11-04 Thread Gwynne Raskind
ests and responses; in this mode it presents a much (IMO) friendlier wrapper around NSURLConnection and NSURLRequest. As for server APIs, I've always just written my own very simple REST router in PHP when needed; I've worked almost exclusively with servers implemented by others, so I can&#

Re: Macro challenge with variable arguments

2012-11-01 Thread Gwynne Raskind
rmat, ...) GCLogObjCMethod(self, _cmd, __LINE__, NSStringFromClass([self class]), format, ## __VA_ARGS__) #else #define GCLOGOC(format, ...) #endif -- Gwynne Raskind ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin req

Re: 32-bit on 10.8

2012-08-11 Thread Gwynne Raskind
On Sat, Aug 11, 2012 at 1:38 PM, Jayson Adams wrote: > I say again, Apple's official 64-bit porting document states, right now, that > you may or may not want to move to 64 bit. If Apple is planning on removing > 32-bit support in the near future, they will be partly to blame for any rude > su

Re: Why Don't Cocoa's (Un)Archiving Methods return Errors?

2011-07-29 Thread Gwynne Raskind
On Fri, Jul 29, 2011 at 21:48, wrote: >> Granted that NSKeyedUnarchiver might have left some memory leaks or >> partially uninitialized objects somewhere, but unarchiving an invalid object >> should happen rarely if at all... and ordinarily my own code should never >> get pointers to such obje

Re: Help Mixing Objective-C & Objective-C++

2011-02-24 Thread Gwynne Raskind
On Feb 24, 2011, at 3:58 AM, Andreas Grosam wrote: >> You can't, but you can declare protocols for your ObjC++ classes in separate >> headers then have the ObjC classes interact with "NSObject" instead of >> Foo objects directly. >> >> FooProtocol.h >> >> @protocol Foo >> // methods the pure Ob

Re: info.plist with DYLD_LIBRARY_PATH = ~/test

2010-10-02 Thread Gwynne Raskind
On Oct 2, 2010, at 7:20 AM, Ken Thomases wrote: >> Sorry to be obtuse, but it may be that I am overlooking something. >> Presently, we have calls such as >> >> n = PyNumber_Float(obj) >> s = PyString_AsString(obj) >> >> I understand that I would need to generate #defines for all those names, >>

Re: Problem with font display

2010-05-07 Thread Gwynne Raskind
On May 7, 2010, at 3:40 PM, Jens Alfke wrote: >> In OS 9, a particular string drawn in Geneva 9 with the old DrawString() API >> was about 60 pixels wide. But when I draw that same string using the >> NSStringDrawing methods and NSFont, I get much more "squished" text about 50 >> pixels wide > O

Problem with font display

2010-05-07 Thread Gwynne Raskind
I'm working on porting an old application from OS 9 to modern Cocoa (quite a jump). Over and over I've run into an issue where the text just doesn't draw the same way no matter what I do. Until now I've been able to ignore it because the cosmetic change wasn't as obvious, but now it's causing di

Re: "-forwardInvocation:" like NSInvocation creation

2010-03-31 Thread Gwynne Raskind
On Mar 31, 2010, at 2:26 AM, Philip Mötteli wrote: >> Another alternative would be to combine method_getNumberOfArguments() and >> method_copyArgumentType() with ffi_prep_cif() and ffi_call(), which I think >> is what libobjc itself does these days. libffi is available since at least >> 10.5. Pa

Re: "-forwardInvocation:" like NSInvocation creation

2010-03-30 Thread Gwynne Raskind
On Mar 30, 2010, at 2:54 PM, Michael Ash wrote: >> I see, I really wasn't enough clear. Lets say, I have a method >> >> - someMethodWithArgument:(struct *)anArgument >> andSomeOtherArgument:(id)anotherArgument >> { >>// Here I want to create an NSInvocation, capturing the call of this >>

Re: mount dmg disk

2010-03-14 Thread Gwynne Raskind
On Mar 14, 2010, at 3:22 PM, gMail.com wrote: > Hi, > I can't find a way in Cocoa to mount a dmg disk. > So I would try to call the shell through a NSTask. > I succeed on the Terminal when executing this command line: > > echo -n password | hdiutil mount /Users/john/Documents/MyDmgDisk.dmg > > Bu

Re: Key-Value Observing speed

2010-03-12 Thread Gwynne Raskind
On Mar 12, 2010, at 10:22 PM, Michael Ash wrote: >> You're right; the specific call that's causing the worst speed issues is >> returning a property typed with this structure: >> >> typedef struct { int32_t x, y; } IntegerPoint; >> >> It's not necessarily feasible to switch this to an NSPoint; i

Re: Key-Value Observing speed

2010-03-12 Thread Gwynne Raskind
On Mar 12, 2010, at 5:49 PM, Greg Parker wrote: >> You're right; the specific call that's causing the worst speed issues is >> returning a property typed with this structure: >> >> typedef struct { int32_t x, y; } IntegerPoint; >> >> It's not necessarily feasible to switch this to an NSPoint; it

Re: Key-Value Observing speed

2010-03-12 Thread Gwynne Raskind
On Mar 12, 2010, at 4:52 PM, Peter Ammon wrote: >> While profiling a project I'm working on, I found that while most of my time >> was being spent in glFlush() (which is completely expected for an >> OpenGL-based game), a non-trivial amount of time is being spent in dozens of >> KVO internal met

Key-Value Observing speed

2010-03-12 Thread Gwynne Raskind
While profiling a project I'm working on, I found that while most of my time was being spent in glFlush() (which is completely expected for an OpenGL-based game), a non-trivial amount of time is being spent in dozens of KVO internal methods and functions. Most especially, I noticed that KVO (or

Re: Better sorting using threads?

2010-03-12 Thread Gwynne Raskind
On Mar 12, 2010, at 2:25 AM, Ken Ferry wrote: >> Does Cocoa have sorted containers so that an object can be inserted in > sorted order? If so it seems like this would be far less expensive. > > Probably the best thing to do if you want this is to maintain the sort > yourself by inserting new obje

Re: Versioning / increasing build number

2010-02-05 Thread Gwynne Raskind
On Feb 5, 2010, at 1:56 PM, jonat...@mugginsoft.com wrote: >> 2) Right now the file doesn't get built new every time I build my >> application. So the number isn't increasing yet. How can this be achieved? > I use the following in a script phase to get a perpetually increasing build > number. >

Re: Allow only root/admin users to execute the cocoa app

2010-01-24 Thread Gwynne Raskind
On Jan 25, 2010, at 1:47 AM, vincent habchi wrote: >>> I want to allow my cocoa app to be only launched by root/admin users. >>> How can i achieve this? >> As I think has already been mentioned, the UNIX approach is to set the >> application's owner as root and then make it only executable by the

Re: Problem using bindings with deep key paths

2010-01-20 Thread Gwynne Raskind
On Jan 20, 2010, at 6:05 PM, Quincey Morris wrote: >>> (Though it vaguely annoys me that I have to add a spurious >>> retain/autorelease to the Player object.) >> You don't technically have to. You could do: >> >> [self willChangeValueForKey:@"player"]; >> player = [[Player alloc] init]; >> [self

Re: Problem using bindings with deep key paths

2010-01-20 Thread Gwynne Raskind
On Jan 20, 2010, at 5:00 PM, Quincey Morris wrote: >> It didn't work. The UI did not update with the values in the Info object for >> the given Track in the Player. I tried a couple dozen things, and finally >> found that the UI updated correctly when I generated a fake KVO notification >> for t

Problem using bindings with deep key paths

2010-01-20 Thread Gwynne Raskind
This is most likely a very basic question, but I seem to be stumped just the same. I have an application nib (MainMenu) set up such that it instantiates the NSApplication delegate and the application's main window. The application delegate class has a property "player". The player is an instan

Re: My try/catch block isn't catching exceptions on 10.6

2009-11-28 Thread Gwynne Raskind
On Nov 28, 2009, at 4:25 AM, Greg Parker wrote: > Here's a fun idiom for handling both C++ and Objective-C exceptions in the > same place (on iPhone and 64-bit Mac). > >@try { >// do stuff >} @catch (NSException *e) { >// NSException >} @catch (id e) { >// Othe

Re: Is Core Data appropriate to my task?

2009-09-10 Thread Gwynne Raskind
Before anything else, let me say thank you for a clear, concise, and very helpful set of answers to my questions; I was expecting rather more of a struggle for understanding :). On Sep 10, 2009, at 5:04 PM, Ben Trumbull wrote: support for such a thing; I would either have to write a custom p

Re: Is Core Data appropriate to my task?

2009-09-10 Thread Gwynne Raskind
On Sep 10, 2009, at 3:21 PM, Erik Buck wrote: Yes. Use Core Data. Your application is exactly what Core data is intended to support. Create a planet entity. Create a one to many relationship so that each employee has one planet, but each planet has an unlimited number of employees. This

Is Core Data appropriate to my task?

2009-09-10 Thread Gwynne Raskind
I have an application that manages two kinds of data: A singular file that contains a large amount of rarely changed (but not invariant) data, and documents that contain one root object's worth of information that connects to the singular data set in a very large number of places; the docum

Re: How determine if file is in Trash, given Path or Alias

2009-06-01 Thread Gwynne Raskind
On Jun 1, 2009, at 4:31 PM, Sean McBride wrote: This is a nice trick, I wasn't aware of that function, thanks. Perhaps a minor improvement (one call instead of two): - (BOOL) isTrashedFileAtPath:(NSString*)path { Boolean inTrash = false; const UInt8* utfPath = (UInt8*)[path UTF8S

Re: Several Questions

2009-05-31 Thread Gwynne Raskind
On May 31, 2009, at 2:08 PM, Ammar Ibrahim wrote: Can you give us so more details? For example: What will the app do? Your description is very strange, lol. But indeed, you should create a normal cocoa app that do the stuff you want to do (UI + the real stuff), and a little daemon that checks

Re: Showing more warnings possible in Xcode?

2009-05-30 Thread Gwynne Raskind
On May 30, 2009, at 9:11 PM, Alex Curylo wrote: You also have the "unused" attribute: http://gcc.gnu.org/onlinedocs/gcc-3.1.1/gcc/Variable-Attributes.html That's out because I commonly have to share code with Windows compilers. ... although much less commonly now that I'm about 80% focused on

Re: Showing more warnings possible in Xcode?

2009-05-29 Thread Gwynne Raskind
On May 29, 2009, at 11:22 PM, Graham Cox wrote: Is there a way to tune xCode so that it warns you of these types of potential problems (and more)? The Java development environment I've been using for the past several years (Jetbrains IDEA) has unbelievably fantastic code-editing and compile

Re: which temp dir to use?

2009-05-25 Thread Gwynne Raskind
On May 25, 2009, at 6:52 PM, Michael Ash wrote: The authentication stuff is pertinent, because the AEWP is an example of an API which works by having an unprivileged user process communicate with a privileged process that does the work. A technique which allows you to compromise a process which u

Properly scaling a vector image with CG

2009-05-24 Thread Gwynne Raskind
I have a UIView inside a UIScrollView. The UIView has a bunch of CALayers with custom drawing code which render vector images. A nice thing about vector images is that when you zoom in on them, they still look good. But using UIScrollView's zooming support, I still get nasty bitmap zooming

Re: dot notation doesn’t work as expected f or some library classes

2009-05-24 Thread Gwynne Raskind
On May 24, 2009, at 6:00 PM, Marc Liyanage wrote: I was playing around a bit with the Obj-C 2.0 dot notation to clarify some things for me. In my own classes getters and setters are called as expected, but I noticed several times already that library classes sometimes don’t allow the dot not

Re: Controlling some of CoreAnimation's more confusing automation

2009-05-21 Thread Gwynne Raskind
On May 21, 2009, at 1:09 PM, David Duncan wrote: I have a UIView that contains a number of CALayers. Nothing unusual here. The CALayers are subclassed to do their drawing, because that was easier than separating the delegate logic from my UIView subclass (since the view can't be the delegate

Re: isKindOfClass returns null instead of YES or NO

2009-05-21 Thread Gwynne Raskind
On May 21, 2009, at 12:33 PM, Sean McBride wrote: NSLog(@"Is Member of NSURL: %@", [[step class] isMemberOfClass: [NSURL class]]); The %@ placeholder is for arguments that are objects. isMemberOfClass: and isKindOfClass: return a BOOL, which is not an object. Jeff, And if you'r

Controlling some of CoreAnimation's more confusing automation

2009-05-20 Thread Gwynne Raskind
I have a UIView that contains a number of CALayers. Nothing unusual here. The CALayers are subclassed to do their drawing, because that was easier than separating the delegate logic from my UIView subclass (since the view can't be the delegate of a sublayer - it causes an infinite recursion

Re: Sensible way to extend base class?

2009-05-20 Thread Gwynne Raskind
On May 20, 2009, at 8:56 AM, Jonathan del Strother wrote: I believe a short version of your question is: "How can I get multiple inheritance?" The short answer is that Objective-C does not support multiple inheritance. Yep. I know that, which is why I'm trying to find an elegant workaround.

Re: Distinguish Pending Text from Committed Text

2009-05-19 Thread Gwynne Raskind
On May 19, 2009, at 10:35 PM, Dong Feng wrote: Thanks Michael and Gideon's reply. [NSTextInput markedRange] works. A minor question is that [NSWindow fieldEditor] returns an NSText*, rather than an NSTextView*. I think that's because of historical reason and it should be safe to always cast a re

Re: When init returns nil does it cause a leak

2009-05-19 Thread Gwynne Raskind
On May 19, 2009, at 2:15 PM, Jesper Storm Bache wrote: In the obj-c world we then have to implement classes to be able to handle a dealloc call before the initializer has completely executed. My 2 cents... If we aren't implementing our classes this way to begin with, then we're not programm

Re: iPhone Generating and displaying images using Bitmap

2009-05-18 Thread Gwynne Raskind
On May 18, 2009, at 4:03 AM, Shraddha Karwan wrote: I have a buffer containing JPEG image data. I need to display this buffer in form of images. I copied this buffer to a file and then used the following: CGDataProviderRef ref = CGDataProviderCreateWithFilename([appFile UTF8String]); CGImage

Re: Creating NSAttributedString objects using WebKit in secondary thread

2009-05-11 Thread Gwynne Raskind
On May 11, 2009, at 7:42 PM, Dragan Milić wrote: So, I assume creating attributed strings is not thread safe, but I don't remember anything like that stated in the documentation. In my opinion, that looks like a bug. It is thread safe... if you stick to the Foundation methods. The method you

Re: Hex to NSString or NSData

2009-05-09 Thread Gwynne Raskind
On May 9, 2009, at 10:20 PM, Greg Guerin wrote: Yeah, but since that was only done as part of a benchmark, it didn't much matter. It may have skewed the numbers upwards unnecessarily, but wouldn't have changed their relation to each other since the same sequence was calculated for all three

Re: Hex to NSString or NSData

2009-05-09 Thread Gwynne Raskind
On May 9, 2009, at 9:19 PM, Greg Guerin wrote: char hexCharToNibbleL(char nibble) Is safer as: char hexCharToNibbleL(unsigned char nibble) Otherwise consider what happens if 'char' is signed by default and the incoming value is 0xB0. const char lt[255] = Should be: const char lt[256] or:

Re: Hex to NSString or NSData

2009-05-09 Thread Gwynne Raskind
On May 9, 2009, at 5:20 PM, Marcel Weiher wrote: int hexDigitToInt(char d) { int result; switch (d) { case '0': result = 0; break; case '1': result = 1; break; [snip] case 'E': result = 14; break; case 'F': result = 15; break; default: result = 0xFF;

Re: Hex to NSString or NSData

2009-05-09 Thread Gwynne Raskind
On May 8, 2009, at 11:34 PM, Mr. Gecko wrote: And how could that make @"68656c6c6f" into @"hello"? Thinking this will help you understand what I'm trying to do... On May 8, 2009, at 10:23 PM, Jerry Krinock wrote: On 2009 May 08, at 20:16, Mr. Gecko wrote: Hello, I have a string with hex and I

Re: iPhone Telephone APIs

2009-05-08 Thread Gwynne Raskind
Apologies for the random e-mail from nowhere; I replied to the wrong list. On May 8, 2009, at 1:17 PM, Gwynne Raskind wrote: On May 8, 2009, at 1:03 PM, Luke the Hiesterman wrote: On May 8, 2009, at 10:00 AM, wrote: If you feel strongly (like I do) that this functionality should be made

Re: iPhone Telephone APIs

2009-05-08 Thread Gwynne Raskind
On May 8, 2009, at 1:03 PM, Luke the Hiesterman wrote: On May 8, 2009, at 10:00 AM, wrote: If you feel strongly (like I do) that this functionality should be made available, file a bug. I'm thinking there is a legal reason this feature is not enabled, but I am unable to confirm my suspici

Re: iPhone how to suppress phone dialer screen

2009-05-08 Thread Gwynne Raskind
On May 8, 2009, at 7:35 AM, Shraddha Karwan wrote: Hi, I am writing an application which is in landscape mode. It dials a phone number using the "tel" protocol. While dialing the standard iPhone dialer screen pops up. Is there any means by which this screen can be suppressed? Or how can I

Multiple UIViewControllers don't autorotate correctly

2009-05-07 Thread Gwynne Raskind
Disclaimer: As far as my understanding goes, the iPhone SDK NDA has been lifted and I'm free to ask this question here. If for some crazy reason this isn't true, please just delete this e-mail. My iPhone application has one UIViewController for each piece of its interface. Each such control

Re: Problem Embedding Cocoa Framework

2009-05-06 Thread Gwynne Raskind
On May 6, 2009, at 9:43 PM, Marcel Weiher wrote: Nick, thanks for the tip, you set me on the right track. Here is my new understanding of the problem. In my framework target settings, the Dynamic Library Install Name is set to: $(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH) T

Re: Does Cocoa layer translate Objective-C objects to C++?

2009-05-04 Thread Gwynne Raskind
On May 3, 2009, at 8:17 PM, johnmadst...@yahoo.it wrote: I am confused. I was discussing with a developer about my desire to translate our C+ + code (really simple and few methods and classes) to Objective-C, for a Cocoa/Cocoa Touch software. His answer has been: « I do not understand the r

Re: C string constant->NSString constant without defining twice?

2009-04-28 Thread Gwynne Raskind
On Apr 28, 2009, at 5:15 PM, Kyle Sluder wrote: Except in the case where one line of code creates the temp file and then another immediately uses it and deletes is - as in my case. There is zero chance the user could FUS faster than my 2 lines of code create and delete the file. By virtue o

Re: Time since Login?

2009-04-22 Thread Gwynne Raskind
On Apr 22, 2009, at 12:00 AM, Jeremy W. Sherman wrote: How about just nice(1)-ing the process doing the intense processing to be lower-priority, and letting the scheduler sort it all out? It's my understanding that nice() prioritization is effectively meaningless on Darwin, at least accordi

Re: Problem in displaying image in NSTableView

2009-04-20 Thread Gwynne Raskind
On Apr 20, 2009, at 8:01 PM, Steve Christensen wrote: personName = @"New name"; personAddr = @"New addrress"; personPhoto = [[NSImage alloc] initWithContentsOfFile: @"/Volumes/Working/cocoa/Play-NSTableView/Linea.jpg"]; if (personPhoto == nil) { You need a call to [self dealloc] here, otherwise y

Re: Does waitUntilExit really mean that?

2009-04-14 Thread Gwynne Raskind
On Apr 14, 2009, at 4:03 AM, Uli Kusterer wrote: FWIW, I was having some strange issues with NSTask and setuid child processes (...) My eventual solution was to roll my own version of NSTask which gave me full control over the way the child process was set up, (...) I was able to track down

Re: Best way to get a non-repeating random number?

2009-04-13 Thread Gwynne Raskind
On Apr 13, 2009, at 8:36 PM, Michael Ash wrote: You can put every (unsigned) value you want in there, though in general it's used passing (unsigned)time(NULL) as parameter. This way you'll always get a different int. No you won't. It's a *random* number generator. The seed simply means you

Re: Does waitUntilExit really mean that?

2009-04-11 Thread Gwynne Raskind
On Apr 11, 2009, at 2:29 PM, Michael Domino wrote: I ended up throwing out NSTask in favor of popen for running hdiutil, and my code seems much more stable now. Did I shoot myself in the foot some other way? I'm executing this in a pthread of its own. I also kept getting exceptions thrown fo

MVC pattern, bindings, and controllers

2009-04-06 Thread Gwynne Raskind
I'm developing a Cocoa application with bindings, as should be obvious. I do apologize if this is a newbie question, but my searches of the documentation haven't made any of this clearer to me. I'm trying to make use of the MVC pattern, properly isolating UI code from my model objects using