Re: filtering an array of entities using NSPredicate

2012-10-15 Thread Koen van der Drift
n Oct 15, 2012, at 6:23 AM, Koen van der Drift wrote: > >> On Mon, Oct 15, 2012 at 8:19 AM, Jerry Krinock wrote: >>> >>> On 2012 Oct 15, at 03:45, Koen van der Drift >>> wrote: >>> >>>> So I cannot directly filter an array of dictionaries u

Re: filtering an array of entities using NSPredicate

2012-10-15 Thread Koen van der Drift
On Mon, Oct 15, 2012 at 11:51 AM, Keary Suska wrote: > Willeke probably addressed your issue best. The contents of the collection > that you pass to the aggregate expression must be the same type of value as > the left hand expression. So, to have "name IN {ARRAY}", ARRAY *m

Re: filtering an array of entities using NSPredicate

2012-10-15 Thread Keary Suska
On Oct 15, 2012, at 6:23 AM, Koen van der Drift wrote: > On Mon, Oct 15, 2012 at 8:19 AM, Jerry Krinock wrote: >> >> On 2012 Oct 15, at 03:45, Koen van der Drift >> wrote: >> >>> So I cannot directly filter an array of dictionaries using a predicate

Re: filtering an array of entities using NSPredicate

2012-10-15 Thread Koen van der Drift
On Mon, Oct 15, 2012 at 8:19 AM, Jerry Krinock wrote: > > On 2012 Oct 15, at 03:45, Koen van der Drift > wrote: > >> So I cannot directly filter an array of dictionaries using a predicate? That >> was the whole goal of my question, see my original post. > > Oh

Re: filtering an array of entities using NSPredicate

2012-10-15 Thread Jerry Krinock
On 2012 Oct 15, at 03:45, Koen van der Drift wrote: > So I cannot directly filter an array of dictionaries using a predicate? That > was the whole goal of my question, see my original post. Oh, now I see. I'd assumed that 'persons' was an array. It's a dictiona

Re: filtering an array of entities using NSPredicate

2012-10-15 Thread Koen van der Drift
So I cannot directly filter an array of dictionaries using a predicate? That was the whole goal of my question, see my original post. - Koen. On Oct 15, 2012, at 6:33 AM, Willeke wrote: > > Op 15 okt 2012, om 02:05 heeft Koen van der Drift het volgende geschreven: > >> >

Re: filtering an array of entities using NSPredicate

2012-10-15 Thread Willeke
;} >> >> what is persons in this statement? >> [fetchRequest setPredicate: [NSPredicate predicateWithFormat: @"name IN %@", >> persons]]; > > 'persons' is an array of dictionaries, where one of the key-value pairs > contains the name. >

Re: filtering an array of entities using NSPredicate

2012-10-14 Thread Willeke
> Maybe another clue, if I NSLog the predicate, I get this: > > name IN {{"name" = "Jones A."}, {"name" = "Williams S."}, {"name" = > "Brown M."}, {"name" = "Tobias S."}} > > That seems as expected to me. > the predicate should be something like name IN {"Jones A.", "Williams S.", "Brown M.", "

Re: filtering an array of entities using NSPredicate

2012-10-14 Thread Koen van der Drift
On Oct 14, 2012, at 10:43 AM, Jerry Krinock wrote: > On 2012 Oct 14, at 07:05, Koen van der Drift > wrote: > >> name IN {{"name" = "Jones A."}, {"name" = "Williams S."}, {"name" = >> "Brown M."}, {"name" = "Tobias S."}} >> >> That seems as expected to me. > > It says that the name should be

Re: filtering an array of entities using NSPredicate

2012-10-14 Thread Jerry Krinock
On 2012 Oct 14, at 07:05, Koen van der Drift wrote: > name IN {{"name" = "Jones A."}, {"name" = "Williams S."}, {"name" = > "Brown M."}, {"name" = "Tobias S."}} > > That seems as expected to me. It says that the name should be in a set of predicates, which are boolean. That doesn't make sens

Re: filtering an array of entities using NSPredicate

2012-10-14 Thread Koen van der Drift
Maybe another clue, if I NSLog the predicate, I get this: name IN {{"name" = "Jones A."}, {"name" = "Williams S."}, {"name" = "Brown M."}, {"name" = "Tobias S."}} That seems as expected to me. - Koen. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.

Re: filtering an array of entities using NSPredicate

2012-10-14 Thread Koen van der Drift
On Sat, Oct 13, 2012 at 11:58 PM, Jerry Krinock wrote: > So you need to experiment with different methods. > > • Remove the -setPredicate: statement. Now is filteredPersons everything in > the store, as expected, or still empty? Yes, it contains all the names currently in the store. > • Chang

Re: filtering an array of entities using NSPredicate

2012-10-13 Thread Jerry Krinock
It looks to me like what you're doing should work as you expect. I don't think you are violating any of the predicate gotchas in Core Data Programming Guide ▸ Persistent Store Features. So you need to experiment with different methods. • Remove the -setPredicate: statement. Now is filteredP

filtering an array of entities using NSPredicate

2012-10-13 Thread Koen van der Drift
I have a large array for Person entities, and want to filter them before importing into my Core Data database, so that each Person will be only once in the database based on the name. The names are pulled from a database, and have the format: @"Jones, A." After some searching, I came up with t

A better solution? - Accessing an array of strings saved to user defaults via bindings (solved in the end...)

2011-07-14 Thread Peter
I have found various references on this list and on the web about the impossibility to hook up an *editable* single-column NSTableView to an NSMutableArray of strings via bindings - and about some clever ways to work around this limitation. These workarounds may work in principle, but fail in a

Re: get a dictionary out of an array of dictionaries by a criterion

2011-03-09 Thread Dave DeLong
Batholdy wrote: > Hi, > > I have a plist with an array of dictionaries. > Now every of these dictionaries has a key 'ID' with an integer. > > Now how I can get only one dictionary element out of this array where key is

get a dictionary out of an array of dictionaries by a criterion

2011-03-09 Thread Martin Batholdy
Hi, I have a plist with an array of dictionaries. Now every of these dictionaries has a key 'ID' with an integer. Now how I can get only one dictionary element out of this array where key is equal to x? thanks for any advice! ___ Cocoa-d

Re: 2D grayscale image from an array of floats

2009-12-19 Thread Martin Beroiz
Thanks for the reply, I'm a newbie and I'm still trying to figure out how are things done in Cocoa. I have another related question I'd like to ask you guys, cause I've searched through documentation and tutorials but I cannot find the exact answer. I'm trying to implement Model-Controller-Vie

Re: 2D grayscale image from an array of floats

2009-12-18 Thread Scott Ribe
A couple more things I've thought of: - There is such a thing as a grayscale image that uses floats instead of bytes for values. You may not even need to do a conversion. - You may even be able to wrap your buffer up in an image rep without copying it. I don't use NSImage; my custom image views

Re: 2D grayscale image from an array of floats

2009-12-18 Thread douglas welton
Martin, Have you looked at the API for CGImage? If not, this may be helpful as well. regards, douglas On Dec 17, 2009, at 9:25 AM, Martin Beroiz wrote: > > On Dec 17, 2009, at 6:17 AM, Graham Cox wrote: > >> >> On 17/12/2009, at 5:32 AM, Martin Beroiz wrote: >> >>> Can anyone please give

Re: 2D grayscale image from an array of floats

2009-12-17 Thread Scott Ribe
> Thanks, I'm trying that already. I don't need high performance right now, but > just out of curiosity, what would I use if I wanted ultra high performance? You would use the methods of NSBitmapImageRep that allow you to get/set the entire image buffer at once. -- Scott Ribe scott_r...@killerby

Re: 2D grayscale image from an array of floats

2009-12-17 Thread Martin Beroiz
On Dec 17, 2009, at 6:17 AM, Graham Cox wrote: > > On 17/12/2009, at 5:32 AM, Martin Beroiz wrote: > >> Can anyone please give me any hint on what would be the best approach to >> this problem? or may be point me some relevant documentation I might read? I >> know nothing about bitmap image r

Re: 2D grayscale image from an array of floats

2009-12-17 Thread Graham Cox
On 17/12/2009, at 5:32 AM, Martin Beroiz wrote: > Can anyone please give me any hint on what would be the best approach to this > problem? or may be point me some relevant documentation I might read? I know > nothing about bitmap image representation, so any pointer on that would > appreciated

2D grayscale image from an array of floats

2009-12-17 Thread Martin Beroiz
Hello, I'm new in cocoa, and I want to accomplish something in a program i'm developing. I have an array of floats, that is basically a matrix, and I want to display it on a view as a 2D grayscale image, with each pixel in a gray tone proportional the value of that float. So

Re: Binding an Array of Dictionaries

2009-12-13 Thread Gerriet M. Denkmann
On 13 Dec 2009, at 23:50, Keary Suska wrote: > On Dec 12, 2009, at 10:35 PM, Gerriet M. Denkmann wrote: > >> Well, not quite. >> As I stated in some previous post in this thread, the NSDictionaryController >> (bound to "currentDictionary") fills an editable NSTableView. >> And if the user edits

Re: Binding an Array of Dictionaries

2009-12-13 Thread Keary Suska
On Dec 13, 2009, at 9:50 AM, Keary Suska wrote: >> Well, not quite. >> As I stated in some previous post in this thread, the NSDictionaryController >> (bound to "currentDictionary") fills an editable NSTableView. >> And if the user edits some key or value in this NSTableView the >> NSDictionaryC

Re: Binding an Array of Dictionaries

2009-12-13 Thread Keary Suska
On Dec 12, 2009, at 10:35 PM, Gerriet M. Denkmann wrote: > Well, not quite. > As I stated in some previous post in this thread, the NSDictionaryController > (bound to "currentDictionary") fills an editable NSTableView. > And if the user edits some key or value in this NSTableView the > NSDiction

Re: Binding an Array of Dictionaries

2009-12-12 Thread Gerriet M. Denkmann
On 12 Dec 2009, at 23:48, Keary Suska wrote: > > On Dec 11, 2009, at 10:36 PM, Gerriet M. Denkmann wrote: > >> realContent (which contains the NSDictionary). >> >> And now I can bind the content of the NSDictionaryController to >> NSArrayController selection.realContent and everything works p

Re: Binding an Array of Dictionaries

2009-12-12 Thread Keary Suska
On Dec 11, 2009, at 10:36 PM, Gerriet M. Denkmann wrote: > realContent (which contains the NSDictionary). > > And now I can bind the content of the NSDictionaryController to > NSArrayController selection.realContent and everything works perfectly - > changes done in the TableView of my Diction

Re: Binding an Array of Dictionaries

2009-12-11 Thread Gerriet M. Denkmann
On 11 Dec 2009, at 22:54, Keary Suska wrote: > On Dec 11, 2009, at 12:45 AM, Gerriet M. Denkmann wrote: > >> I have a window with an NSTableView which is bound to an NSArrayController >> which has as content an NSMutableArray called "theArrayOfDictionaries". >> Works fine. >> >> "theArrayOfDic

Re: Binding an Array of Dictionaries

2009-12-11 Thread Keary Suska
On Dec 11, 2009, at 12:45 AM, Gerriet M. Denkmann wrote: > I have a window with an NSTableView which is bound to an NSArrayController > which has as content an NSMutableArray called "theArrayOfDictionaries". > Works fine. > > "theArrayOfDictionaries" contains NSMutableDictionaries. > So I added

Binding an Array of Dictionaries

2009-12-10 Thread Gerriet M. Denkmann
I have a window with an NSTableView which is bound to an NSArrayController which has as content an NSMutableArray called "theArrayOfDictionaries". Works fine. "theArrayOfDictionaries" contains NSMutableDictionaries. So I added another NSTableView to my window, bound to an NSDictionaryController,

Re: An array of

2009-12-05 Thread Seth Willits
On Dec 5, 2009, at 4:10 PM, R T wrote: > I am trying to create an array of CGImageRefs that I will use to create > CGLayers. > myCGImageRefImage is the CGImageRef of the key image. > Each loop, I'm trying to reload imgForLayer with this key image. > The line...imgForLayer

An array of

2009-12-05 Thread R T
I am trying to create an array of CGImageRefs that I will use to create CGLayers. myCGImageRefImage is the CGImageRef of the key image. Each loop, I'm trying to reload imgForLayer with this key image. The line...imgForLayer = CGImageCreateCopy(myCGImageRefImage) ...doesn't work at a

Re: An Array of structs

2009-11-27 Thread Jens Alfke
On Nov 27, 2009, at 7:48 AM, Alastair Houghton wrote: > You *can* have non-constant elements in struct initialisers in C, *but* only > in a context where there is code that will execute at runtime. C++ eliminates most of these restrictions, btw. And you can make your code C++ simply by changin

Re: An Array of structs

2009-11-27 Thread Alastair Houghton
On 27 Nov 2009, at 13:30, Jeremy Pereira wrote: > You can't have non constant elements in struct initialisers, testy is not a > constant. The error message spells out exactly what the issue is. You *can* have non-constant elements in struct initialisers in C, *but* only in a context where ther

Re: An Array of structs

2009-11-27 Thread Jeremy Pereira
On 27 Nov 2009, at 11:35, John Love wrote: > > I get "Initializer element is not constant. This pertains to the NSString* > because if I directly substitute the following, no compile error happens: > YearAmt gTest[] = {{@"testy", 10} > > What fundamental pertaining to C or C++ am I not getting?

Re: An Array of structs

2009-11-27 Thread Graham Cox
On 27/11/2009, at 10:35 PM, John Love wrote: > NSString *testy = @"testy"; > YearAmt gTest[] = {{testy, 10} /*, + others */}; > > I get "Initializer element is not constant. This pertains to the NSString* > because if I directly substitute the following, no compile error happens: > YearAmt gTe

An Array of structs

2009-11-27 Thread John Love
In my .h file, I have: typedef struct YearAmt { NSString *year; int amount; } YearAmt; extern NSString *testy; extern YearAmt gTest[]; In the corresponding .m file: NSString *testy = @"testy"; YearAmt gTest[] = {{testy, 10} /*, + others */}; I get "Initializer element i

Re: Core Data - attribute to hold an array of strings

2009-08-11 Thread parag vibhute
Kyle, please note that question was "Can I use the same method for *UIImage*or NSImage also? " John, you are right. Regards, Parag On Tue, Aug 11, 2009 at 1:13 AM, John Baldwin wrote: > I took this to mean that NSImage conforms to NSCoding and therefore can be > archived, whereas UIImage does no

Re: Core Data - attribute to hold an array of strings

2009-08-10 Thread John Baldwin
I took this to mean that NSImage conforms to NSCoding and therefore can be archived, whereas UIImage does not conform and requires this extra step to convert the image to an NSData object, which can be archived. John On Sunday Aug 9 4:10 PM, at 4:10 PM, Kyle Sluder wrote: On Aug 9, 2009,

Re: Core Data - attribute to hold an array of strings

2009-08-09 Thread Kyle Sluder
On Aug 9, 2009, at 4:39 AM, parag vibhute wrote: Yes, you can. Only thing is you need to convert UIImage object to NSData object. There are two C APIs Good to know for the iPhone crowd, but the question was about NSImage, which is a Mac class. --Kyle Sluder ___

Re: Core Data - attribute to hold an array of strings

2009-08-09 Thread parag vibhute
ot;. Finally, put arrayData into the >>> attribute. >>> >>> Shlok Datye >>> Coding Turtle >>> http://codingturtle.com >>> >>> >>> On 09.08.2009, at 09:48, M.S. Hrishikesh wrote: >>> >>> I created an Entity called

Re: Core Data - attribute to hold an array of strings

2009-08-09 Thread Shlok Datye
create an attribute to hold an array of strings? I know how to create an Attribute to hold a single string but I need to hold an array of strings. One way is to create another Entity called PlaceName. PlaceName will have an attribute of type String. I will then make a to-many relationship from M

Re: Core Data - attribute to hold an array of strings

2009-08-09 Thread M.S. Hrishikesh
". Finally, put arrayData into the attribute. Shlok Datye Coding Turtle http://codingturtle.com On 09.08.2009, at 09:48, M.S. Hrishikesh wrote: I created an Entity called MyPlaces. I want to store a number of strings inside MyPlaces. How do I create an attribute to hold an array of st

Re: Core Data - attribute to hold an array of strings

2009-08-09 Thread Shlok Datye
.com On 09.08.2009, at 09:48, M.S. Hrishikesh wrote: I created an Entity called MyPlaces. I want to store a number of strings inside MyPlaces. How do I create an attribute to hold an array of strings? I know how to create an Attribute to hold a single string but I need to hold an array of s

Core Data - attribute to hold an array of strings

2009-08-09 Thread M.S. Hrishikesh
I created an Entity called MyPlaces. I want to store a number of strings inside MyPlaces. How do I create an attribute to hold an array of strings? I know how to create an Attribute to hold a single string but I need to hold an array of strings. One way is to create another Entity called

Re: Binding to an array of NSStrings stored in an application's preferences

2009-07-29 Thread Quincey Morris
On Jul 29, 2009, at 19:58, Graham Cox wrote: I'm not sure I've fully followed your question, since I'm not as up with bindings as you are, but I'm just wondering: have you overlooked the fact that @"self" is a valid keypath or keypath component? If the array holds strings and you are bindin

Re: Binding to an array of NSStrings stored in an application's preferences

2009-07-29 Thread Rob Keniger
(Registering them as defaults doesn't seem to be working for me.) You can't do this with an array of NSStrings, you have to work with strings encapsulated as properties of an object, such as an NSDictionary. So you need an array of dictionaries which contain a string object for a pa

Re: Binding to an array of NSStrings stored in an application's preferences

2009-07-29 Thread Graham Cox
On 30/07/2009, at 8:15 AM, A B wrote: Without those, what keypath do I use in the NSTableView I have set up to facilitate manipulation of that list? I'm not sure I've fully followed your question, since I'm not as up with bindings as you are, but I'm just wondering: have you overlooked

Binding to an array of NSStrings stored in an application's preferences

2009-07-29 Thread A B
m as defaults doesn't seem to be working for me.) So to reiterate my questions more succinctly: How can you bind a table view to an array of NSStrings and how can you store said array in an application's preferences? Any pointers or advice that you can offer would be VERY much appr

Re: getting a point from an array of NSValue CGPoints

2009-05-23 Thread Greg Guerin
Jeff Decker wrote: It turns out that the instance of my PolygonShape class in my PolygonView class does not have any information attached to it. Did you ever do anything to attach information to it? Did you assign the variable a value? I am not sure how to connect the PolygonShape instance

Re: getting a point from an array of NSValue CGPoints

2009-05-23 Thread Jeff Decker
Thank you for your response. Your reply prompted me to explore where else my problem might lay if it is not in the unpacking of CGPoint. It turns out that the instance of my PolygonShape class in my PolygonView class does not have any information attached to it. I am not sure how to conne

Re: getting a point from an array of NSValue CGPoints

2009-05-22 Thread David Duncan
On May 22, 2009, at 12:45 PM, Jeff Decker wrote: Thank you for your help. I have a mutable array filled with NSValues which are CGPoints. I want to unpack them one by one while adding them to a CGContextAddLineToPoint rect. Here is my terrible attempt (most of the code is from the Stanf

getting a point from an array of NSValue CGPoints

2009-05-22 Thread Jeff Decker
Hello, Thank you for your help. I have a mutable array filled with NSValues which are CGPoints. I want to unpack them one by one while adding them to a CGContextAddLineToPoint rect. Here is my terrible attempt (most of the code is from the Stanford class on iTunes - which I'm really en

Re: NSArrayController bound to an array of strings

2008-11-17 Thread Scott Anguish
Dear all, If have seen lots of examples in which a NSTableView is bound to an NSArrayController which is bound to an array of entity objects, having various properties. However I am now trying to bind a table column to an array of strings and I don't seem to get this working. The strin

Re: NSArrayController bound to an array of strings

2008-11-16 Thread Andy Lee
On Nov 16, 2008, at 1:45 PM, Chris Suter wrote: The only trick I can think of is to use "string" as the model key and then, because NSString doesn't have a "string" method, you need to add a category method to NSString: - (NSString *)string { return self; } I don't know bindings, but it might

Re: NSArrayController bound to an array of strings

2008-11-16 Thread Chris Suter
On Mon, Nov 17, 2008 at 4:45 AM, Meik Schuetz <[EMAIL PROTECTED]> wrote: > Dear all, > If have seen lots of examples in which a NSTableView is bound to an > NSArrayController which is bound to an array of entity objects, having > various properties. However I am now trying to b

NSArrayController bound to an array of strings

2008-11-16 Thread Meik Schuetz
Dear all, If have seen lots of examples in which a NSTableView is bound to an NSArrayController which is bound to an array of entity objects, having various properties. However I am now trying to bind a table column to an array of strings and I don't seem to get this working. The s

Autocomplete from an array of dictionaries

2008-10-23 Thread Jason Wiggins
Hi, I'm working on an autocompletion system such as with mail To: Cc: fields etc. I have an array of dictionaries and I want the autocomplete to match to the key "description" This code below works great for an array of strings: NSArray *matchingName

[SOLVED] Autocomplete from an array of dictionaries

2008-10-23 Thread Jason Wiggins
chingNames = [[namesArray valueForKey:@"description"] filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"SELF beginswith[cd] %@", substring]]; Jason On 23/10/2008, at 19:06 , Jason Wiggins wrote: Hi, I'm working on an autocompletion system such as with mail To: