Re: Another app's UTI can break your app

2014-06-11 Thread Noah Desch

On Jun 10, 2014, at 3:21 PM, Seth Willits sli...@araelium.com wrote:

 My app and Coda both open plain text .sql files. Coda exports a UTI for the 
 .sql extension. So does my app.


If .sql files are a public format that was defined by neither your app nor 
Coda, you should both be *importing* UTIs for it, instead of *exporting* them. 
I wonder if this problem would occur if both of your apps only declared the 
.sql type as imported?
Exporting a type means you have defined that type and you control it. Importing 
a type simply means you would like to use it. Does it fix your app if you 
change your declaration to an import?

Regardless, an incorrect export declaration shouldn’t break other apps that 
happen to use that UTI. It’s interesting that the documentation says what 
happens when you have multiple importers and one exporter (the typical case) 
but not what happens when there are multiple exporters (the error case).

My (possibly flawed) understanding is based on:
https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_declare/understand_utis_declare.html


-Noah


___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Framework for ambient light level?

2014-04-24 Thread Noah Desch


 On Apr 24, 2014, at 5:34 PM, Rick Mann rm...@latencyzero.com wrote:
 
 
 On Apr 24, 2014, at 14:10 , William Squires wsqui...@satx.rr.com wrote:
 
   iii) Averages all the pixels to come up with a (rough) gauge of ambient 
 light level (as an unsigned byte) - preferably by using the graphics 
 coprocessor to unload the task from the main CPU!
 
 Might be hard; I suspect the camera's auto aperture will affect your 
 measurements. I don't know if it can be disabled or controlled 

Better would be to just read the current aperture setting if there's a way to 
get it. Since it's already auto-calibrated that should approximate the light 
level. 

-Noah
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Strange toolbar/view/resize cursor interaction

2014-04-21 Thread Noah Desch

I have an NSOpenGL view in a window with a nib-based toolbar that behaves 
correctly, so I don't think the OpenGL machinery is completely ignorant of 
toolbars. 

Noah Desch

 
 That sounds correct, but IIRC the methods that convert between a window’s 
 content size and its frame size don’t take the toolbar into account, which 
 means that they work with a content size” that isn’t actually the content 
 *view* size, and correcting the calculation requires the assumption of 
 extrinsic information. It strikes me as plausible that an OpenGL view might 
 need to make such a conversion, and that it was never implemented to deal 
 with the presence of a toolbar.

___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

[ANN] WFBezierCombinatorics

2014-03-07 Thread Noah Desch

I’ve written a category on NSBezierPath that allows boolean operations on paths 
(union, intersection, subtraction) which preserves curved elements throughout 
the operation and does not require flattening paths into line segments prior 
to processing.

I thought this might be a generally useful bit of code so I am making it 
available on GitHub:
https://github.com/wiresoft/WFBezierCombinatorics

I hope others may find this useful.

-Noah
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: [ANN] WFBezierCombinatorics

2014-03-07 Thread Noah Desch

Graham, I’d be glad to see how it performs with your additional test cases. 
Although I spent quite a bit of time handling special cases this is very much a 
work in progress and I appreciate any help anyone is willing to throw in.

I didn’t follow a specific algorithm, although much of the cubic bezier curve 
handling (bounding box computation, line-curve  curve-curve intersections,  
curve derivatives, etc) is based on the descriptions here:
http://pomax.github.io/bezierinfo/

In a nutshell, the algorithm I’m using is:
1) Walk the two input paths and add all their points to a vertex array
2) Compute intersections between the two paths and add them to the vertex array
3) Create two sorted index arrays which allow traversal of the polygons in 
order, including the intersections
4) filter out redundant intersections due to numeric imprecision and edge cases
5) Walk the sorted index arrays in order, building up the result bezierpath as 
you go, switching between the two index paths when you hit an intersection
6) Once you complete a polygon, pick the next starting point using some 
criteria determined by which operation (union,intersection,subtraction) you are 
doing.

Some notes…

Finding intersections between the two paths uses the naive n^2 algorithm. I’m 
aware there are better ones but the descriptions I could find mention only line 
segments and I am not sure how they generalize to curves.

Finding zeros of a cubic curve (used for curve-line intersections among other 
things) is currently quite inefficient and involves 100’s of iterations of 
Newton-Raphson. I recently came across a more efficient method that I will 
implement shortly.

Some of the unit tests in the project are not complete. I have verified their 
operation by examining the results in the debugger but writing assertions for 
dozens of vertices is quite tedious and I’m not done with that yet.

-Noah



On Mar 7, 2014, at 10:43 PM, Graham Cox graham@bigpond.com wrote:

 Hi Noah,
 
 Indeed, this is a potentially a very useful body of code.
 
 I have several implementations, some which flatten and others that do not, 
 but the non-flattening cases are not always totally reliable. This can be a 
 very hard problem to solve. I have a number of test cases that I can throw at 
 the code that might show up problems - I'll be glad to give your code a 
 whirl. Which algorithm did you employ?
 
 Thanks for doing this and making it available so cheaply (!) It's something 
 that I've always thought should be part of NSBezierPath as standard 
 (especially as Core Graphics must have the code in there already to calculate 
 clipping path intersections).
 
 --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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Core Data with ODBC databases?

2013-10-18 Thread Noah Desch

I'm not sure why you need access to the NSSaveChangesRequest transactions at 
the application layer?

In your optimistic locking example, your NSIncrementalStore gets a save request 
at step 5. It tries to commit the changes to the server, but the server comes 
back and says transaction back out. Your incremental store constructs an 
NSError describing the problem and returns nil from 
-executeRequest:withContext:error:. Your controller code that called -save sees 
the error, recognizes what it means, and starts the user back at step 1 
(presumably by calling refreshObject:mergeChanges: on all the edited objects).

Maybe I'm being naive but this seems to complete your scenario. Where did I go 
wrong?

-Noah



On Oct 18, 2013, at 9:12 AM, Mikael Hakman mhak...@dkab.net wrote:

 Both of you, Jens and Chris, are right. Core Data uses transactions 
 internally for each NSFetchRequest and NSSaveChanges request. However, the 
 transactions are not available in the user application. Let's consider the 
 above mentioned banking application - a clerk making a withdrawal or deposit 
 on an account. If your database uses optimistic transaction control then it 
 will do the following:
 
 1. Start a transaction.
 
 2. Fetch account balance from the database.
 
 3. Display balance to the clerk.
 
 4. Let the clerk add or subtract an amount.
 
 5. Update balance in database.
 
 6. Commit transaction.
 
 7. Check transaction error code.
 
 8. if error code is Transaction back out or alike then the application 
 should:
 
 9. Inform the clerk.
 
 10. Start all over again from 1 above.


___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: UIPageViewController page index woes

2013-09-28 Thread Noah Desch

So apparently the page control is entirely transparent by default. Try adding 
this to your app delegate's didFinishLaunching... method:

UIPageControl * pageControl = [UIPageControl appearance];
pageControl.pageIndicatorTintColor = [UIColor lightGrayColor];
pageControl.currentPageIndicatorTintColor = [UIColor darkGrayColor];
pageControl.backgroundColor = [UIColor clearColor];

This will apply a default customization to every page control in your app. The 
other way to apply non-transparent colors is to loop through all the sub-views 
of your UIPageViewController's view and look for the one who's kindOfClass is 
[UIPageControl class] and set whatever colors you want on it. This *might* be a 
gray area in terms of using undocumented API though.

-Noah


On Sep 26, 2013, at 5:06 PM, Noah Desch desc...@me.com wrote:

 I'm having the same issue. When I dive into the view hierarchy in the 
 debugger I see the page control inside the UIPageViewController's view, but 
 it's frame is {0,0,0,0}. 
 
 Noah Desch
 
 On Sep 25, 2013, at 7:11 PM, Rick Mann rm...@latencyzero.com wrote:
 
 
 On Sep 25, 2013, at 15:27 , Daniel Höpfl ap...@hoepfl.de wrote:
 
 On 25.09.2013 03:25, Rick Mann wrote:
 Any ideas? The example code doesn't use the page index.
 
 Did you set the transition style to
 UIPageViewControllerTransitionStyleScroll?
 
 
 Yup :-)
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: UIPageViewController page index woes

2013-09-26 Thread Noah Desch
I'm having the same issue. When I dive into the view hierarchy in the debugger 
I see the page control inside the UIPageViewController's view, but it's frame 
is {0,0,0,0}. 

Noah Desch

 On Sep 25, 2013, at 7:11 PM, Rick Mann rm...@latencyzero.com wrote:
 
 
 On Sep 25, 2013, at 15:27 , Daniel Höpfl ap...@hoepfl.de wrote:
 
 On 25.09.2013 03:25, Rick Mann wrote:
 Any ideas? The example code doesn't use the page index.
 
 Did you set the transition style to
 UIPageViewControllerTransitionStyleScroll?
 
 
 Yup :-)
 
 
 
 -- 
 Rick
 
 
 
 
 ___
 
 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:
 https://lists.apple.com/mailman/options/cocoa-dev/deschnl%40me.com
 
 This email sent to desc...@me.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Core Data Reverse Engineering KickStarter Project

2013-06-25 Thread Noah Desch
Using coredata with a documented format should probably be accomplished with an 
NSIncrementalStore subclass rather than trying to reverse engineer the existing 
undocumented format. 

Noah Desch

On Jun 25, 2013, at 11:30 AM, Scott Ribe scott_r...@elevated-dev.com wrote:

 On Jun 25, 2013, at 8:44 AM, Steve Sisak wrote:
 
 The safest thing to would probably to be to implement a Core Data 
 workalike with a documented database schema and possibly an importer for 
 real code data files.
 
 This is what I've been thinking--with the importer asserted to a crazy 
 extent, so that you get notified of anything that it doesn't completely 
 understand.
 
 -- 
 Scott Ribe
 scott_r...@elevated-dev.com
 http://www.elevated-dev.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:
 https://lists.apple.com/mailman/options/cocoa-dev/deschnl%40me.com
 
 This email sent to desc...@me.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Recomputing non-standard Core Data attributes when child MOC is saved?

2013-06-24 Thread Noah Desch
I have had really weird issues with NSManagedObjects KVOing themselves. I would 
recommend you instead override the dynamic setters for all the attributes whose 
value affects your computed property and clear your pre computed value there. 

Noah Desch

On Jun 19, 2013, at 3:21 AM, Rick Mann rm...@latencyzero.com wrote:

 I guess my objects could KVO themselves…
 
 -- 
 Rick

___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Another basic CoreData question

2010-07-08 Thread Noah Desch


On Jul 8, 2010, at 7:33 PM, gumbo...@mac.com wrote:

 Using the standard Employee/Department example, Whats the best way to set a 
 default department for an Employee?
 So that every employee is created with a relationship to the mailRoom 
 department.


Probably to add some custom code to AwakeFromInsert in your employee 
NSManagedObjectSubclass to set its own department.

-Noah___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: My program causes MacBook Pro to use NVidia graphics processor

2010-05-04 Thread Noah Desch


Well your list includes:

/System/Library/Frameworks/OpenGL.framework/Resources//GLRendererFloat.bundle/GLRendererFloat
/System/Library/Frameworks/OpenGL.framework/Resources/GLEngine.bundle/GLEngine
/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libCoreVMClient.dylib
/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGFXShared.dylib
/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib
/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLImage.dylib
/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLProgrammability.dylib
/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.dylib
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL

So I'm guessing that would do it. As to why you'd be linking against these, I 
can't answer.

-Noah




On May 3, 2010, at 9:08 PM, Gideon King wrote:

 On 04/05/2010, at 10:14 AM, Charles Srstka wrote:
 
 If you posted the results to the list, it could be very useful, as someone 
 may see something in there that they recognize.
 
 
 OK - in case it is useful, here are the results of running the app with that 
 setting, and sorting the output and removing duplicates. The first group is 
 the ones that were loaded at startup, and the second group are the new ones 
 that were loaded as I played with the app for a while. 
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How do I get a file reference w/o relying on the path?

2010-04-18 Thread Noah Desch

On Apr 18, 2010, at 10:43 AM, Brad Stone wrote:

 I'm storing the bookmark data in an array displayed in a table:
 NSData *bookmarkData = [inAbsoluteURL 
 bookmarkDataWithOptions:NSURLBookmarkCreationSuitableForBookmarkFile 
   
 includingResourceValuesForKeys:nil
   
 relativeToURL:nil
   error:error];


I am doing the same thing and it is still able to resolve the bookmarks when 
the file moves or its name changes. The only real difference I can see between 
our two approaches is that I am passing 0 for both the creation options and the 
resolution options.

What are the properties of the error object are you getting when the bookmark 
resolution fails?

-Noah
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How do I get a file reference w/o relying on the path?

2010-04-18 Thread Noah Desch

Are you sure the data is being stored into your note dictionary correctly? 
Here is my bookmark resolution code, it looks almost exactly like yours. I'm 
running on 10.6.3 and building for 10.6 with GC off.


- (NSURL *)resolveBookmarkData:(NSData *)bookmark 
withOptions:(NSURLBookmarkResolutionOptions)options needsUpdate:(BOOL *)stale
{
NSURL *url;
NSError *error;
NSMutableDictionary *userInfo;

error = Nil;
*stale = NO;
url = [NSURL URLByResolvingBookmarkData:bookmark options:options 
relativeToURL:Nil bookmarkDataIsStale:stale error:error];
if ( url ) {
return url;
}

if ( error  [[error domain] isEqualTo:NSCocoaErrorDomain]  [error 
code] == NSFileNoSuchFileError ) {
// error presentation and resolution code follows...




-Noah



On Apr 18, 2010, at 10:08 PM, Brad Stone wrote:

 The error comes back file does not exist and the NSLog statement shows url 
 = (null) after I change the name of the file in the Finder.  If I change the 
 file name back to what it was when the bookmark was saved the file opens 
 fine.  I changed my creation option to 0.  No difference.
 
 NSData *bookmarkData = [note valueForKey:@bookmarkData];
   NSError *error = nil;
   BOOL isStale;
   NSURL *url = [NSURL URLByResolvingBookmarkData:bookmarkData 
 options:0 relativeToURL:nil bookmarkDataIsStale:isStale error:error];
   NSLog(@url = %@, [url description]);
   
   if (error != nil) {
   [NSApp presentError:error];
   }
 
 
 On Apr 18, 2010, at 11:45 AM, Noah Desch wrote:
 
 
 On Apr 18, 2010, at 10:43 AM, Brad Stone wrote:
 
 I'm storing the bookmark data in an array displayed in a table:
 NSData *bookmarkData = [inAbsoluteURL 
 bookmarkDataWithOptions:NSURLBookmarkCreationSuitableForBookmarkFile 
 
 includingResourceValuesForKeys:nil
 
 relativeToURL:nil
 error:error];
 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: ObjC question

2010-04-10 Thread Noah Desch


On Apr 10, 2010, at 7:02 PM, Tony Romano wrote:

 Thanks for the reply but I am not sure I follow your point.  An instance of 
 'f' is contained precisely in one instance of Bar.  I can have many Bars but 
 each have their own instance of the class Foo.  Does the language support 
 getting the containing instance?


But how does the language know that only one instance of f is contained in one 
instance of Bar? You could have multiple Bars pointing to the same f, or you 
could instantiate an f without first enclosing it in a Bar. These are just dumb 
objects which you could do any number of things with.

If you need to enforce a specific one to one relationship between Bars and Fs 
you need to write code to support that. If you want Fs to know which Bar owns 
it, you need to write code to support that. I would suggest giving F a property 
myBar and giving it an initializer - (id)initWithBar:(Bar *)owner which sets 
the myBar property.

-Noah___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSURLEffectiveIconKey with bookmark data

2010-04-09 Thread Noah Desch

My application displays a potentially long list of items in an NSTableView. One 
of the columns represents files on the user's hard drive. This column is driven 
by the new bookmark data from the NSURL class. The bookmark data does not 
appear to be able to save effective icon data, however other data does work. 
Does anyone know of a way to get this to store the icon data?


Bookmark data for a given item is created as follows:

[[openPanel URL] bookmarkDataWithOptions:0 
includingResourceValuesForKeys:
[NSArray 
arrayWithObjects:NSURLEffectiveIconKey,NSURLLocalizedNameKey,Nil]
relativeToURL:Nil error:Nil]

According to the docs this should create bookmark data that also includes the 
file's effective icon and localized name data so that I can access those two 
items without resolving the bookmarks. I would like to avoid resolving every 
bookmark in the table when they are displayed for performance reasons and 
because I don't want the user to be presented with bookmark resolution dialogs 
as they scroll through the list.


In my NSCell subclass I load the bookmark data as follows:

resources = [NSURL resourceValuesForKeys:[NSArray 
arrayWithObjects:NSURLEffectiveIconKey, NSURLLocalizedNameKey, Nil] 
fromBookmarkData:obj];
if ( resources ) {
[self setFileIcon:[resources 
objectForKey:NSURLEffectiveIconKey]];
[self setFileName:[resources 
objectForKey:NSURLLocalizedNameKey]];
return;
}

The result is that the name is displayed but the file icon is Nil. Stepping 
through the code shows that the resources dictionary only contains one entry 
(the localized name) instead of the expected two entries so the icon data is 
not being stored or retrieved. As far as I can see this behavior (inability to 
store icon data with the bookmark) is not documented anywhere.

-Noah




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Solving memory leaks

2010-03-27 Thread Noah Desch



  but *not* this:

 self.myFields = [[NSMutableArray alloc] init];
 
 That's a memory leak right there. :)


This discussion is confusing me a bit... lets see if I got this right:

If you are *not* using getters and setters but instead have myFields declared 
as:

@interface MyClass
{
NSMutableDictionary *myFields;
}

and you use the above line of code, and subsequently release myFields in your 
dealloc method this would *not* be a memory leak, correct?

-Noah___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Weird release problem on iPhone code

2010-03-18 Thread Noah Desch

You don't own any of those objects so you should not be releasing them.

See:
http://developer.apple.com/mac/library/documentation/cocoa/conceptual/MemoryMgmt/Articles/mmRules.html

-Noah


On Mar 18, 2010, at 11:43 PM, William Squires wrote:

 I have some code like below in a UITableView delegate (specifically, the one 
 that fires when you touch a tableview row):
 
 ...
 NSDictionary *store = [self.stores objectAtIndex:indexPath.row];
 
 // store name is like NOBLE FINANCE or CUSTOMER CREDIT or such; i.e. two 
 strings seperated by a space
 NSString *temp = [store objectForKey:kKeyStoreName];
 NSString *temp2 = [store objectForKey:kKeyCity];
 NSArray *storeComponents = [temp componentsSeperatedByDelimiter:@ ];
 NSString *temp3 = [NSString stringWithFormat:%@ %@, [storeComponents 
 objectAtIndex:0], temp2];
 cell.label.text = temp3;
 // [temp3 release];
 // [storeComponents release];
 // [temp2 release];
 // [temp release];
 // [store release];
 ...
 
  If I uncomment any of the object releases above, the app crashes in the 
 simulator, and all the call-stack items are gray (non-user code). But if I 
 don't release them, they'll leak memory, won't they, since iPhone OS doesn't 
 have GC?
  Note that I've verified that 'store' is actually an NSDictionary, and temp, 
 temp2, and temp3 are non-NIL at the time they're released.
 
 ___
 
 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/noah%40wireframesoftware.com
 
 This email sent to n...@wireframesoftware.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [NSTableview] can't make selected text stay black

2010-03-05 Thread Noah Desch

Cells highlight using white text based on the background style as far as I can 
tell. Try:

[cell setBackgroundStyle:NSBackgroundStyleLight];

Instead of setting the text color.

-Noah



On Mar 5, 2010, at 5:25 PM, Kent Hauser wrote:

 Hi,
 
 I'm trying to make a NSTableView selected row not look selected. I
 subclassed NSTableView  added the following class  delegate methods:
 
 // remove selection indication
 - (void)highlightSelectionInClipRect:(NSRect)clipRect
 {
NSLog (@%s, __FUNCTION__);
 }
 
 // change selected cell text color (delegate method)
 - (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell
 forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex
 {
NSLog (@%s, __FUNCTION__);
if ([cell respondsToSelector:@selector(setTextColor:)])
[(id)cell setTextColor:[NSColor blackColor]];
 }
 
 While the hightlightSelection method does it's job, my delegate method
 doesn't paint the text black. (However, if I use redColor, I get red text).
 
 What am I missing?
 
 Thanks. Kent

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com