Re: Dictionaries or custom class containing no methods?

2014-06-17 Thread Trygve Inda
Doesn't seem weird to me, I do it all the time. One advantage of using a custom class over a dictionary is that the compiler knows what's expected of it, while a dictionary is just a black box. On Jun 17, 2014, at 3:21 PM, Trygve Inda wrote: I need to store a large collection

Re: Dictionaries or custom class containing no methods?

2014-06-17 Thread Trygve Inda
On Jun 17, 2014, at 4:16 PM, Trygve Inda wrote: Doesn't seem weird to me, I do it all the time. One advantage of using a custom class over a dictionary is that the compiler knows what's expected of it, while a dictionary is just a black box. On Jun 17, 2014, at 3:21 PM, Trygve Inda

Re: CGDisplayIOServicePort deprecated in 10.9... IOServicePortFromCGDisplayID?

2014-06-16 Thread Trygve Inda
What do you need the IOServicePort for? This GitHub comment provides the outline of a solution for getting information about individual displays, which would seem to be more verbose but safer than granting client apps access to the window server's mach ports:

initWithCoder: calling init in custom class

2014-06-16 Thread Trygve Inda
I have a custom class: @interface MyClass : NSObject {} @property (nonatomic, retain) NSNumber* valueA; @property (nonatomic, retain) NSNumber* valueB; @property (nonatomic, retain) NSNumber* valueC; @end @implementation MyClass -(id)init { if (self = [super init]) { [self

Re: initWithCoder: calling init in custom class

2014-06-16 Thread Trygve Inda
On Jun 16, 2014, at 13:36 , Trygve Inda cocoa...@xericdesign.com wrote: In the later method, if the encoded object does not contain kValueCKey, the object created will still have the correct default value for valueC (9). It won’t, because you assigned nil to valueC *after* it’s set

CGDisplayIOServicePort deprecated in 10.9... IOServicePortFromCGDisplayID?

2014-06-15 Thread Trygve Inda
Someone suggested here: http://stackoverflow.com/questions/20025868/cgdisplayioserviceport-is-deprec ated-in-os-x-10-9-how-to-replace?answertab=votes#tab-top that io_service_t service = IOServicePortFromCGDisplayID(displayID); Could be used to replace io_service_t service =

Re: NSPredicate and custom sort selector

2014-05-31 Thread Trygve Inda
A string is a string - the user's input will have the ratioValue property available. Up to you to sanity check the user input of course. Kirk Kerekes (iPhone) On May 30, 2014, at 4:56 PM, Trygve Inda cocoa...@xericdesign.com wrote: Create a property-styled category on NSString

Re: NSPredicate and custom sort selector

2014-05-30 Thread Trygve Inda
On May 29, 2014, at 2:52 PM, Trygve Inda wrote: I have an array of objects. One property of this object is a ratio stored as a string (e.g. 5:8, 9:4, 21:2) etc. I have a category on NSString: -(NSComparisonResult)compareAspectString:(NSString *)aString This does the division

Re: NSPredicate and custom sort selector

2014-05-30 Thread Trygve Inda
Create a property-styled category on NSString that returns the numeric value of a ratio-string -- call it ratioValue perhaps. Then you can have a predicate format of the form: @self.ratioValue %@.ratioValue -- or whatever. The same category would be useful in KVC collection

Re: NSPredicate and custom sort selector

2014-05-30 Thread Trygve Inda
Create a property-styled category on NSString that returns the numeric value of a ratio-string -- call it ratioValue perhaps. Then you can have a predicate format of the form: @self.ratioValue %@.ratioValue -- or whatever. The same category would be useful in KVC collection

stringWithContentsOfFile:usedEncoding returns no err and no encoding

2014-05-30 Thread Trygve Inda
I have a database file exported as text from FileMaker which has several high-ASCII French characters. NSError* error = nil; NSStringEncoding* enc = nil; NSString* contents = [NSString stringWithContentsOfFile:path usedEncoding:enc error:error]; This works but enc and error are both nil after

NSPredicate and custom sort selector

2014-05-29 Thread Trygve Inda
I have an array of objects. One property of this object is a ratio stored as a string (e.g. 5:8, 9:4, 21:2) etc. I have a category on NSString: -(NSComparisonResult)compareAspectString:(NSString *)aString This does the division and compares the aspect ratios correctly. Now I need a predicate

Re: NSPredicate and custom sort selector

2014-05-29 Thread Trygve Inda
On May 29, 2014, at 2:52 PM, Trygve Inda wrote: I have an array of objects. One property of this object is a ratio stored as a string (e.g. 5:8, 9:4, 21:2) etc. I have a category on NSString: -(NSComparisonResult)compareAspectString:(NSString *)aString This does the division

IKImageBrowser Non-Square Cells

2014-05-18 Thread Trygve Inda
Using apple sample ImageBrowserAppearance code as a basis, I am trying to make non-square cells in an IKImageBrowser. Specifically my cells need to be an aspect ration of 2:1 (wide) instead of square. I have overridden: -(NSRect)imageContainerFrame -(NSRect)selectionFrame -(NSRect)frame In

Re: IKImageBrowser Non-Square Cells

2014-05-18 Thread Trygve Inda
The docs for IKImageBrowserCell say: frame Returns the receiver’s frame rectangle, which defines its position in its IKImageBrowserView. - (NSRect)frame Return Value The coordinates of the frame, in the IKImageBrowserView coordinate space. Discussion Subclasses should not override

DTS: how long for response?

2014-05-14 Thread Trygve Inda
I used a DTS incident and have not heard back in 24 hours. Does anyone know about how long it normally takes these days (Mac OS X)? It's been several years since I have used one. Thanks, Trygve ___ Cocoa-dev mailing list

Hang during AESend

2014-05-13 Thread Trygve Inda
Sometimes, I am getting a hang. I can reproduce it by creating a lot of Apple Events (~100) within a few seconds, but it is not predictable enough to always happen at the same time. Console reports: 5/13/14 12:52:59.290 PM appleeventsd[56]: Got kAELookupClientPort with no criteria:{command=300,

Re: Hang during AESend

2014-05-13 Thread Trygve Inda
On May 13, 2014, at 13:03 , Trygve Inda cocoa...@xericdesign.com wrote: NSAppleEventDescriptor *appleEvent = [NSAppleEventDescriptor appleEventWithEventClass: kMyAEClass eventID: kMyAEEventID targetDescriptor: targetDescriptor returnID: kAutoGenerateReturnID transactionID

Re: Hang during AESend

2014-05-13 Thread Trygve Inda
On May 13, 2014, at 13:03 , Trygve Inda cocoa...@xericdesign.com wrote: NSAppleEventDescriptor *appleEvent = [NSAppleEventDescriptor appleEventWithEventClass: kMyAEClass eventID: kMyAEEventID targetDescriptor: targetDescriptor returnID: kAutoGenerateReturnID transactionID

canAsynchronouslyWriteToURL:ofType:forSaveOperation: Prevent Quit?

2014-04-20 Thread Trygve Inda
I return YES from canAsynchronouslyWriteToURL:ofType:forSaveOperation: Which works fine, but the user is able to quit the app while the save is in progress. Is there way way to know when the save is complete so that I can prevent quit before the save ends? Thanks, Trygve

Re: canAsynchronouslyWriteToURL:ofType:forSaveOperation: Prevent Quit?

2014-04-20 Thread Trygve Inda
On 20 Apr 2014, at 19:58, Trygve Inda cocoa...@xericdesign.com wrote: I return YES from canAsynchronouslyWriteToURL:ofType:forSaveOperation: Which works fine, but the user is able to quit the app while the save is in progress. Is there way way to know when the save is complete so

Re: canAsynchronouslyWriteToURL:ofType:forSaveOperation: Prevent Quit?

2014-04-20 Thread Trygve Inda
Do you override any other NSDocument saving methods? I believe NSDocument’s internal use of -performAsynchronousFileAccess… should cause it to delay NSApplication termination. --Kyle Sluder My Document class contains: //Read File Package -(BOOL)readFromFileWrapper:(NSFileWrapper

Re: canAsynchronouslyWriteToURL:ofType:forSaveOperation: Prevent Quit?

2014-04-20 Thread Trygve Inda
Do you override any other NSDocument saving methods? I believe NSDocument’s internal use of -performAsynchronousFileAccess… should cause it to delay NSApplication termination. --Kyle Sluder On Apr 20, 2014, at 1:01 PM, Trygve Inda cocoa...@xericdesign.com wrote: On 20 Apr 2014, at 19

Re: canAsynchronouslyWriteToURL:ofType:forSaveOperation: Prevent Quit?

2014-04-20 Thread Trygve Inda
On Apr 20, 2014, at 4:29 PM, Trygve Inda cocoa...@xericdesign.com wrote: A small correction... This seems to only happen when I do a Save As. If the file is dirty and I do a Save, the file is dirty warning catches the quit. Does the bad behavior also apply to Save if you turn off

Re: canAsynchronouslyWriteToURL:ofType:forSaveOperation: Prevent Quit?

2014-04-20 Thread Trygve Inda
On Apr 20, 2014, at 6:58 PM, Trygve Inda cocoa...@xericdesign.com wrote: On Apr 20, 2014, at 4:29 PM, Trygve Inda cocoa...@xericdesign.com wrote: A small correction... This seems to only happen when I do a Save As. If the file is dirty and I do a Save, the file is dirty warning catches

NSOperation subclass with abstract class?

2014-04-07 Thread Trygve Inda
Hi have three different NSOperation subclasses: MyOperationA : NSOperation MyOperationB : NSOperation MyOperationC : NSOperation Each of my subclasses have a set of 4 required properties: NSString* data1 NSString* data2 NSString* data3 NSString* data4 Beyond that, my three subclasses are

Re: NSDictionary @synchronize to read multiple objects

2014-04-01 Thread Trygve Inda
On Apr 1, 2014, at 12:25 AM, Jens Alfke wrote: On Mar 31, 2014, at 10:16 PM, Trygve Inda cocoa...@xericdesign.com wrote: I need to be able to set a new myDict and not have it happen between the reading of different values from the dictionary by other threads. Don’t expose the dictionary

NSDictionary @synchronize to read multiple objects

2014-03-31 Thread Trygve Inda
I have an object with a dictionary property defined as: @property (nonatomic, retain) NSMutableDictionary* myDict; This gets set when it is received via an AppleEvent from another application. Multiple threads in the receiving app need to read (the threads never write, only read) from the

Re: Best way to composite/tile multiple CGImages to one image

2014-03-14 Thread Trygve Inda
On Mar 8, 2014, at 9:17 AM, Trygve Inda cocoa...@xericdesign.com wrote: On 08 Mar 2014, at 04:38, Trygve Inda cocoa...@xericdesign.com wrote: I need to composite/tile about 20 images in a 4x5 grid to one image. What for? Knowing that might help finding a way to speed it up. I.e. why

Re: Best way to composite/tile multiple CGImages to one image

2014-03-08 Thread Trygve Inda
On 08 Mar 2014, at 04:38, Trygve Inda cocoa...@xericdesign.com wrote: I need to composite/tile about 20 images in a 4x5 grid to one image. What for? Knowing that might help finding a way to speed it up. I.e. why are the images separate, where are they supposed to go in the end? Display

NSTask for external tool - keep active/prevent relaunch?

2014-03-07 Thread Trygve Inda
My app sometimes needs to call an external tool that runs via NSTask and delivers text output back to my app. I profiled it and most of the time (30%) is spent in [NSConcreteTask launchWithDictionary] Is there any technique I can use to keep this running and thus not have to relaunch it the next

Best way to composite/tile multiple CGImages to one image

2014-03-07 Thread Trygve Inda
I need to composite/tile about 20 images in a 4x5 grid to one image. Currently I do: NSImage* canvas = [[[NSImage alloc] initWithSize:NSMakeSize(canvasWide, canvasHigh)] autorelease]; [canvas lockFocus]; Loop { ... Get the CGImage which comes from an AVAssetImageGenerator frameImage =

Re: NSTask for external tool - keep active/prevent relaunch?

2014-03-07 Thread Trygve Inda
There is, but, first of all, why does this external tool terminate? What is it? I'd like it to work with md5, ffmpeg and others. These all work fine, but quit after returning their data. T. ___ Cocoa-dev mailing list

Re: Best way to composite/tile multiple CGImages to one image

2014-03-07 Thread Trygve Inda
On 8 Mar 2014, at 2:38 pm, Trygve Inda cocoa...@xericdesign.com wrote: Profiling this shows lots of time (90%) is spent in drawInRect and it takes about 2 seconds to run. Is there a better way to do this that is faster? Maybe keep everything in CG and only convert to NSImage at the end

Re: Best way to composite/tile multiple CGImages to one image

2014-03-07 Thread Trygve Inda
Just a follow up... I modified the color space with: [canvasImageRep bitmapImageRepByConvertingToColorSpace:[[[NSColorSpace alloc] initWithCGColorSpace:colorSpace] autorelease] renderingIntent:NSColorRenderingIntentDefault]; I still get the same times to place 20 images in a 4x5

Re: Best way to composite/tile multiple CGImages to one image

2014-03-07 Thread Trygve Inda
On 8 Mar 2014, at 4:12 pm, Trygve Inda cocoa...@xericdesign.com wrote: I get the same times doing it this way, but maybe my color spaces are different. The CGImage returned from my AVAsset is: CGColorSpace 0x100550490 (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; Composite NTSC) I

Re: NSTask for external tool - keep active/prevent relaunch?

2014-03-07 Thread Trygve Inda
On Mar 7, 2014, at 8:38 PM, Trygve Inda cocoa...@xericdesign.com wrote: I'd like it to work with md5, ffmpeg and others. These all work fine, but quit after returning their data. There’s nothing you can do about that, unless those tools allow multiple input files to be passed

Re: Best way to composite/tile multiple CGImages to one image

2014-03-07 Thread Trygve Inda
On 8 Mar 2014, at 5:02 pm, Trygve Inda cocoa...@xericdesign.com wrote: This is slower by about 15%. :( Bummer. I'm thinking that two seconds to composite 20 x 1920 x 1080 X 32 bits isn't too bad actually. That's 165 MB of actual pixel data to iterate over, and at each pixel it's

Re: NSDocument save incremental file package in-place

2014-03-03 Thread Trygve Inda
I did some testing about optimal number of files per folder for our package format and 3750 files per directory are way too many. The file system is much more efficient if you spread those files into sub-folders. We got the best performance with a 3-level sparse folder index (files are

Re: NSDocument save incremental file package in-place

2014-03-02 Thread Trygve Inda
You also need to overwrite - (void)setFileURL:(NSURL *)absoluteURL in which you call super and then update your stored wrapper (if you have one already) using -[NSFileWrapper readFromURL:options:error:]. You need to do this because the filewrapper you return in -fileWrapperOfType::

Re: NSDocument save incremental file package in-place

2014-03-02 Thread Trygve Inda
A follow up... Adding this to my NSDocument subclass: - (BOOL)writeToURL:(NSURL *)absoluteURL ofType:(NSString *)typeName forSaveOperation:(NSSaveOperationType)saveOperation originalContentsURL:(NSURL *)absoluteOriginalContentsURL error:(NSError **)outError { NSError* error;

Re: NSDocument save incremental file package in-place

2014-03-02 Thread Trygve Inda
7,500 file operations of any kind are going to take some time, even just creating hard links. Does it require 40 seconds? Well, I don't know. But I do seriously doubt that it could be done in 1 second. You might try it out yourself, write test code to create a new package, walk through your

Re: NSDocument save incremental file package in-place

2014-03-02 Thread Trygve Inda
I did some testing about optimal number of files per folder for our package format and 3750 files per directory are way too many. The file system is much more efficient if you spread those files into sub-folders. We got the best performance with a 3-level sparse folder index (files are

NSDocument save incremental file package in-place

2014-03-01 Thread Trygve Inda
I have a Document whose file type is a package and potentially contains a few thousand files. My test case is about 7500 files (mostly images). I am using -(NSFileWrapper *)fileWrapperOfType:(NSString *)typeName error:(NSError **)outError The problem is that when there is a very small change

Re: NSDocument save incremental file package in-place

2014-03-01 Thread Trygve Inda
On Mar 1, 2014, at 07:23 , Trygve Inda cocoa...@xericdesign.com wrote: The problem is that when there is a very small change (just adding or removing one of the files in the package), the system does not save in place. Rather it reads the previous package file completely, writes out

Re: NSDocument save incremental file package in-place

2014-03-01 Thread Trygve Inda
On Mar 1, 2014, at 11:11 , Trygve Inda cocoa...@xericdesign.com wrote: I really need this to be faster. I think the point I was trying to reach was that your next step is to investigate what is taking the time. IIRC there’s a NSURL attribute key you can use to retrieve a file’s inode

Re: NSDocument save incremental file package in-place

2014-03-01 Thread Trygve Inda
On 1 Mar 2014, at 19:11, Trygve Inda cocoa...@xericdesign.com wrote: On Mar 1, 2014, at 07:23 , Trygve Inda cocoa...@xericdesign.com wrote: The problem is that when there is a very small change (just adding or removing one of the files in the package), the system does not save in place

Re: NSDocument save incremental file package in-place

2014-03-01 Thread Trygve Inda
On 1 Mar 2014, at 23:26, Trygve Inda cocoa...@xericdesign.com wrote: I have a top level FileWrapper which contains the wrappers for all my files. Is there any sample code that would help me figure out the right way to do this? [NSFileWrapper writeToURL:options:originalContentsURL:error

Re: NSDocument save incremental file package in-place

2014-03-01 Thread Trygve Inda
On 1 Mar 2014, at 23:26, Trygve Inda cocoa...@xericdesign.com wrote: I have a top level FileWrapper which contains the wrappers for all my files. Is there any sample code that would help me figure out the right way to do this? [NSFileWrapper writeToURL:options:originalContentsURL:error

NSUndoManager, NSTableView with bindings

2014-02-16 Thread Trygve Inda
I have an NSTableView with several columns bound to an NSArrayController which manages the array of my custom objects. Undo of course works while editing a cell in the NSTableView, but once the edit is complete, I need to manage it myself. How is the best way to do this? I need to know the

NSTableView highlight row on mouseDown vs mouseUp

2014-02-10 Thread Trygve Inda
I have several NSTableViews in my windows. One of them only highlights a new row on mouseUp, while the others highlight the clicked row on mouseDown. How can I fix the one table so that it too highlights on mouseDown? Trygve ___ Cocoa-dev mailing

makeDocumentForURL:nil withContentsOfURL:fileURL causing deletion

2014-02-08 Thread Trygve Inda
I am reading a document in the format of the old version of my app and converting it to a new format. The old version is not a document at all but is a fixed data file in /Application Support/MyApp/ MyDocument *untitledDoc = [[NSDocumentController sharedDocumentController] makeDocumentForURL:nil

IKImageBrowser problem - mimic Safari Top Sites

2014-02-02 Thread Trygve Inda
I am trying to get an effect like Safari's top sites using IKImageBrowserView. Safari lets the areas of the webpages be non-square. If you shrink the window vertically a lot, the pages will appear as wide, thin rectangles. IKImageBrowserView seems to force everything to be squares with text

NSTableView end editing keep same First Responder

2014-01-26 Thread Trygve Inda
If I highlight a row in my NSTableView it turns blue and I can edit individual cells. Tab jumps to the next column. When I hit return however, the row turns grey and the table loses first responder status. I receive a proper controlTextDidBeginEditing once an edit takes place (ie adding or

Re: NSTableView end editing keep same First Responder

2014-01-26 Thread Trygve Inda
Hitting return results in the Table losing focus, the selected row highlight turns grey and controlTextDidEndEditing is never called. Upon further research, it only does this when the column being edited is included in the sort descriptors for the table view.

NSTableView, NSArrayController predicate, change data exception

2014-01-13 Thread Trygve Inda
I have an NSTableView backed by an NSArrayController. I call setFilterPredicate on the NSArrayController to set a predicate of rating == 2 This does filter the table to show only those entries where rating is 2. The rating column is a Level Indicator and set to show star ratings in IB. It is

Re: NSTableView, NSArrayController predicate, change data exception

2014-01-13 Thread Trygve Inda
I have an NSTableView backed by an NSArrayController. I call setFilterPredicate on the NSArrayController to set a predicate of rating == 2 This does filter the table to show only those entries where rating is 2. The rating column is a Level Indicator and set to show star ratings in IB. It

Re: Keep sibling view in Responder Chain

2013-12-28 Thread Trygve Inda
On 27 Dec 2013, at 13:52, Trygve Inda cocoa...@xericdesign.com wrote: I have a document with a SourceView on the left side (like iTunes). Some main menu commands pertain to actions in the Source View. This works fine if the SourceView is the active view but my window has other views held

Re: Keep sibling view in Responder Chain

2013-12-28 Thread Trygve Inda
Can you give an example of how you do that? I guess I'd want it right after my document controller. Do I need to walk the list looking for my document controller? Or just do: [[document windowController] setNextResponder:sourceViewController] Trygve Well, you’ll also want to give

Keep sibling view in Responder Chain

2013-12-27 Thread Trygve Inda
I have a document with a SourceView on the left side (like iTunes). Some main menu commands pertain to actions in the Source View. This works fine if the SourceView is the active view but my window has other views held in a SplitView. If a sibling of the SourceView is active, the SourceView is

Re: Keep sibling view in Responder Chain

2013-12-27 Thread Trygve Inda
Hi Use SetNextResponder method to insert your view into the responder chain. https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Even tOverview/EventArchitecture/EventArchitecture.html will give the more information. So when can I know to call

Re: NSArrayController + NSTableView addObject ends editing

2013-12-24 Thread Trygve Inda
On Nov 14, 2013, at 8:04 AM, Trygve Inda cocoa...@xericdesign.com wrote: On Nov 14, 2013, at 12:54 AM, Trygve Inda cocoa...@xericdesign.com wrote: I have a NSTableView backed by an NSArrayController. If I am editing a cell in a row in the tableview and call addObject

Re: NSArrayController + NSTableView addObject ends editing

2013-12-24 Thread Trygve Inda
This is not because you are adding a row per se, but because the action is changing the first responder. If you don't want to allow changing the first responder you will need to subclass (the table view, cell, or window) to refuse to resign first responder status under the desired conditions.

Re: NSArrayController + NSTableView addObject ends editing

2013-12-24 Thread Trygve Inda
It seems that NSTableView's reloadData called by NSArrayController's addObject kills the edit session (without giving my delegate a chance to refuse to end the editing). Is there a way to add items to the table and not end my editing? Think of the Finder and you are editing a file name, while

Re: NSArrayController + NSTableView addObject ends editing

2013-12-24 Thread Trygve Inda
On Dec 24, 2013, at 11:41 , Trygve Inda cocoa...@xericdesign.com wrote: It seems that NSTableView's reloadData called by NSArrayController's addObject kills the edit session (without giving my delegate a chance to refuse to end the editing). Is there a way to add items to the table

NSArray firstObject?

2013-12-22 Thread Trygve Inda
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Founda tion/Classes/NSArray_Class/NSArray.html#//apple_ref/doc/uid/2137-SW40 firstObject Returns the first object in the array. - (id)firstObject Return Value The first object in the array. If the array is empty, returns

Re: NSArray firstObject?

2013-12-22 Thread Trygve Inda
Yes. This method is there since 10.6 so you can safely call it. using latest header or category on it. On Dec 23, 2013, at 1:49, Seth Willits sli...@araelium.com wrote: On Dec 22, 2013, at 9:31 AM, Trygve Inda cocoa...@xericdesign.com wrote: Available in OS X v10.6 and later

NSArrayController + NSTableView addObject ends editing

2013-11-14 Thread Trygve Inda
I have a NSTableView backed by an NSArrayController. If I am editing a cell in a row in the tableview and call addObject on the NSArrayController (to add a new row to the tableview), my editing session for some other row is ended. addObject is called from an NSNotification method when some other

Re: NSArrayController + NSTableView addObject ends editing

2013-11-14 Thread Trygve Inda
On Nov 14, 2013, at 12:54 AM, Trygve Inda cocoa...@xericdesign.com wrote: I have a NSTableView backed by an NSArrayController. If I am editing a cell in a row in the tableview and call addObject on the NSArrayController (to add a new row to the tableview), my editing session for some

NSCopying vs NSMutableCopying for custom object

2013-10-27 Thread Trygve Inda
My object looks like: @interface MyObject : NSObject NSCoding, NSCopying { MyOtherObject* library; NSString*identifier; NSString*name; BOOL removed; } @property (nonatomic, retain) MyOtherObject*library; @property (copy, readwrite)NSString*

Determine keys used in NSPredicate

2013-10-19 Thread Trygve Inda
I have an array of objects. These objects may have some dynamic properties handled with valueForUndefinedKey. If I create a predicate along the lines of: myObject.proertyA = something AND myObject.proertyB = somethingElse AND myObject.dynamicPropertyA = someOtherThing How can I look at

Re: Determine keys used in NSPredicate

2013-10-19 Thread Trygve Inda
On Oct 19, 2013, at 10:44 PM, Trygve Inda wrote: I have an array of objects. These objects may have some dynamic properties handled with valueForUndefinedKey. If I create a predicate along the lines of: myObject.proertyA = something AND myObject.proertyB = somethingElse

NSPopUpButton binding value/selected problem

2013-10-17 Thread Trygve Inda
I have an NSArray Controller that manages an array of Dictionaries that contain two NSString objects Name and Identifier The Name field is shown in an NSTable and is user editable while the Identifier is generated when the dictionary is created and is used to reference the object by the app

NSDocument read from file, force save to different file

2013-10-09 Thread Trygve Inda
Version 1 of my app only saved it's (single container) data in ~/Library/Application Support/ Version 2 is document-based. I need to be able to load the data from the old App Support location (which is in a different format as well). This part is easy with a case within my readFromFileWrapper.

Bug in NSTableView Autosave Columns (duplicate columns)

2013-10-05 Thread Trygve Inda
I have a Preferences window with an NSTableView containing 3 columns. Each one has a different title and sort key. If I check the Autosave box for my table (which has a unique Autosave name) and check column information I run into a bug. The next time I launch the app, one of my columns is

Re: Bug in NSTableView Autosave Columns (duplicate columns)

2013-10-05 Thread Trygve Inda
I have a Preferences window with an NSTableView containing 3 columns. Each one has a different title and sort key. If I check the Autosave box for my table (which has a unique Autosave name) and check column information I run into a bug. The next time I launch the app, one of my columns is

NSOutlineView cell size 8 pixels too narrow

2013-10-01 Thread Trygve Inda
When my window first loads, I have an NSOutlineView (which has it's internal NSScrollView). This is placed in my window and I have a custom Cell done with: @interface SourceViewCell : NSTextFieldCell My cell width is 8 pixels too narrow until I resize the window (even by only a pixel). It is as

NSFileWrapper and plist

2013-09-13 Thread Trygve Inda
I have an NSDictionary that contains objects that support NSCopying. I can use writeToFile:atomically: and it saves a nice plist file that I can read cleanly. If I use NSFileWrapper however (for my document-based app), I need to use a keyed archiver to conver the NSDictionary to NSData. After

Re: 32bit vs 64bit and QuickTime/AVFoundation

2013-09-09 Thread Trygve Inda
On 09/09/2013, at 9:56 PM, Trygve Inda cocoa...@xericdesign.com wrote: am considering merging them into one app, but it would have to be 32bit only (though of course it will run on 64bit systems). Is there any real drawback to this? I'd like to support 10.6 - 10.9 and I know that if I

32bit vs 64bit and QuickTime/AVFoundation

2013-09-09 Thread Trygve Inda
I have a helper tool that needs to use both C-based QuickTime/QTKit as well as AV Foundation to process things for the main app. Currently I am actually using two helper tools - one 32bit app to work with QuickTime (since some of the old API will not work in 64bit), and a second 32/64bit app to

Re: IOS floating point performance

2013-08-08 Thread Trygve Inda
On 8 Aug, 2013, at 3:28 PM, Kevin Meaney k...@yvs.eu.com wrote: I could well be wrong as I'm working from ancient memory but I believe c upgrades floats to doubles to perform calculations and then if result is stored in a float it will chuck away precision at time of assignment to the

IOS floating point performance

2013-08-07 Thread Trygve Inda
I have an app that is running slow. I have narrowed it down to several functions which are trig-intensive (used to calculate the position of the moon at a given moment and more specifically to calculate rise/set times). To calculate the position and rise/set times for a month on average,

Re: IOS floating point performance

2013-08-07 Thread Trygve Inda
A few things: - The little ARM in the iPad 3 is nothing compared to your desktop. Not only is it not as fast, it doesn't have the memory bandwidth. Also, an iPad 4 will be twice as fast. - make sure you're running optimized code. You can set optimization flags on individual files (that's

Re: IOS floating point performance

2013-08-07 Thread Trygve Inda
I'm a little surprised to see that veclib supports doubles. My instinct (based on imagining that you'll be striding through an array with vector registers that can hold two doubles or four floats)* is that floats could be much faster, and you should really think about whether you need doubles:

Re: IOS floating point performance

2013-08-07 Thread Trygve Inda
On Aug 7, 2013, at 14:34 , Trygve Inda cocoa...@xericdesign.com wrote: I am currently doing it on an NSThread. I may try replacing all the doubles with floats in the algorithm and see how that goes (on a backup of course!). Yes, floats should help (unless precision errors make it worse

Re: IOS floating point performance

2013-08-07 Thread Trygve Inda
I have written an app that does astronomical calculations like that , Sun and Moon rise and set and location and….. I never saw a problem with speed. I was very impressed with how much it can do. However, are you using Objective C methods for the calculations? The run time dispatch in

IOS force hidden tab to adjust subviews after rotation

2013-08-01 Thread Trygve Inda
In my iOS app with two tabs, after the device is rotated, is there a way to force the hidden tab to re-layout its subviews BEFORE clicking that tab to make it visible? One of my tabs uses an image from another tab and I need it to adjust its frame rect. Thanks.

Re: IOS force hidden tab to adjust subviews after rotation

2013-08-01 Thread Trygve Inda
On Thu, Aug 1, 2013, at 08:48 AM, Trygve Inda wrote: In my iOS app with two tabs, after the device is rotated, is there a way to force the hidden tab to re-layout its subviews BEFORE clicking that tab to make it visible? One of my tabs uses an image from another tab and I need

LayoutSubviews after orientation change in inactive tab

2013-07-31 Thread Trygve Inda
I have a tabbed iOS app. Tab #2 has a background that is obtained from an auto-resizing scrollView in Tab #1. If I am viewing Tab #2, and rotate the device, I need the layout for Tab #1 to reconfigure its views immediately rather than until I select it again. How can I do this? I have added a

Re: UIScrollView to UIImage

2013-07-28 Thread Trygve Inda
Update: CGRect rect = [scrollView bounds]; UIGraphicsBeginImageContextWithOptions(rect.size,YES,0.0f); CGContextRef context = UIGraphicsGetCurrentContext(); [scrollView.layer renderInContext:context]; UIImage *capturedImage = UIGraphicsGetImageFromCurrentImageContext();

UIScrollView to UIImage

2013-07-17 Thread Trygve Inda
I am trying to take a snapshot of my UIScrollView and store it in a UIImage: UIGraphicsBeginImageContext(scrollView.bounds.size); [scrollView.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); This

Re: UIScrollView to UIImage

2013-07-17 Thread Trygve Inda
Does it do that even if the scroll view isn't scrolled at all but is at the very top? On 18 Jul, 2013, at 9:56, Trygve Inda cocoa...@xericdesign.com wrote: I am trying to take a snapshot of my UIScrollView and store it in a UIImage: UIGraphicsBeginImageContext(scrollView.bounds.size

NSFileWrapper NSKeyedArchiver and Mutability

2013-06-24 Thread Trygve Inda
NSMutableDictionary* myMutDict = [[NSMutableDictionary alloc] init]; NSData* myMutData = [NSKeyedArchiver archivedDataWithRootObject:myMutDict]; If I unarchive this, I was under the impression that it would return an immutable object. However, if I do: NSFileWrapper* myWrapper =

NSArrayController setSortDescriptors error

2013-06-17 Thread Trygve Inda
NSSortDescriptor* sortDesc; sortDesc = [[NSSortDescriptor alloc] initWithKey:kMainColumnIdentifier ascending:YES selector:@selector(compare:)]; NSArray* testArray = [NSArray arrayWithObject:sortDesc]; [myArrayController setSortDescriptors:testArray]; [sortDesc release]; On the

Prevent NSLevelIndicatorCell change when clicking in non-selected row

2013-06-13 Thread Trygve Inda
I have an NSTableView and one column uses NSLevelIndicatorCell. I want to prevent the action from being run (so that it can't be changed) if the click is in a non-selected row. This is to prevent accidental changes. Ideas? Thanks, Trygve ___

NSURLRequest returning bizarre page

2013-06-10 Thread Trygve Inda
I am using the following code (url changed, but it is a .txt file) NSString* tleAddress = @http://www.somesite.com/somefile.txt;; NSURLRequest* tleRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:tleAddress] cachePolicy:0 timeoutInterval:5.0]; NSURLResponse* tleResponse = nil;

Re: NSURLRequest returning bizarre page

2013-06-10 Thread Trygve Inda
What is the header of the file being fetched set to? On Jun 10, 2013, at 8:06 PM, Trygve Inda wrote: I believe it is just a plain text file. Safari will not allow me to view source on the page and FireFox says: text/plain ISO-8859-1 FireFox also says: The character encoding of the plain

Re: NSURLRequest returning bizarre page

2013-06-10 Thread Trygve Inda
Well, that's it, isn't it? On Jun 10, 2013, at 8:32 PM, Trygve Inda wrote: What is the header of the file being fetched set to? On Jun 10, 2013, at 8:06 PM, Trygve Inda wrote: I believe it is just a plain text file. Safari will not allow me to view source on the page and FireFox

NSSplitView: Many subviews and ViewControllers, best practices

2013-05-21 Thread Trygve Inda
I have an NSDocument-based app. The NSDocument's window has at it's root, an NSSplitView with 7 separate panes/subviews... A Source list on the left and several panes to the right with horizontal and vertical splits. In one pane, I need to have three different views supported by an NSBox that I

NSDocument initWithContentsOfURL vs readFromURL

2013-05-20 Thread Trygve Inda
When I open a document from a file (double clicking or via File-Open), my Document object gets -(id)initWithContentsOfURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError **)outError It seems like I could just read the file there and load it into my internal structures in my

<    1   2   3   4   5   >