predicate

NSPredicateEditor and relationships

I've seen that every predicate that works in a query with a relationship contains at the start the words ANY or ALL (ie: ANY tags.name LIKE[c] "car"), the fact is, if I remove it (ie: tags.name LIKE[c] "car"), the result is wrong or I get a message like this one : Can't do regex matching on object. Since i'm using an NSPredicateEditor t...

Is Predicate<T> not available in .NET 3.0+

Is Predicate available anywhere in .NET? From MSDN http://msdn.microsoft.com/en-us/library/bfcke1bz.aspx, I don't see a Predicate anywhere. I see an anonymous that returns a boolean but no generics or a "Predicate" keyword. ...

Finding invisible folders with spotlight by constructing an NSPredicate with NSMetadataQuery

I am constructing an NSmetaDataQuery to find invisible folders (Like ".myInvisibleFolder"). Unfortunately, spotlight does not seem to be locating folders beginning with ".", even when specifically included in the predicate. What works and doesn't work Searching for any non-invisable filename works. Searching content works (kMDItemTex...

Sorting names with numbers correctly

For sorting item names, I want to support numbers correctly. i.e. this: 1 Hamlet 2 Ophelia ... 10 Laertes instead of 1 Hamlet 10 Laertes 2 Ophelia ... Does anyone know of a comparison functor that already supports that? (i.e. a predicate that can be passed to std::sort) I basically have two patterns to support: Leading number (as...

Filter NSArray iphone

Hi, I use coredata to fill an array with data that is displayed in a tableview. In the tableview, I have two section. When a cell is pushed in section1, I want that cell to be moved to section2, and the other way around. Im not quite sure how to accomplish this, and I been sitting trying to figure it out for about 8 hours now. Th...

Linq to EF Expression Tree / Predicate int.Parse workaround

Hi All, I have a linq Entity called Enquiry, which has a property: string DateSubmitted. I'm writing an app where I need to return IQueryable for Enquiry that have a DateSubmitted within a particular date range. Ideally I'd like to write something like IQueryable<Enquiry> query = Context.EnquirySet.AsQueryable<Enquiry>(); int dateSt...

C# List.Find method - how can I pass a value into the predicate??

Hi, I can't work out how to do a "find" on a List I have based on use of a value that I'll pass in at run time. If you see my below code, I want to be able to find the CustomClass in the List for which it's Path parameter is equal to X, where X will be defined at run time. Any ideas how to do such a find on a List? Or is this not po...

Use more than one predicate in a function parameter?

I have a class that builds a url with query string parameters and so on. The class has a method: Url() which returns the complete url composed from the class properties and another method: UrlNew() which allows passing a predicate as parameter for the replacement of the value of one of the properties and THEN Returns the modified URL. No...

How to get the body of a predicate?

I Have a quite simple question that I just cant figure out. The method code is simple: protected void Require<TValidator, TParam>(TValidator validator, Expression<Func<TValidator, TParam>> property, Predicate<TParam> predicate) { var propertyValue = property.Compile().Invoke(validator); if(!predicate.Invoke(propertyValue)) ...

An example for using predicate to replace 'if' in c#?

I read that the 'if' keyword is evil, and better to use predicate to replace if. Then I googled, but still dont get it. Can anyone be kind to provide an example? ...

Predicate syntax when partitioning a vector of pointers (C++)

I have a vector of pointers to objects. I'd like to remove objects from this vector according to an attribute that's reported by a member function. I'm trying to follow a nice example I found on how to delete certain pointers (and their associated objects) from the vector. The basic idea is to partition the vector, delete the chosen obj...

Applications of Unification?

What are (practical) applications of Unification ? Where it is been used in real world? I couldn't get the whole idea of what it is really about and why its considered as a part of Artificial Intelligence. ...

MVC / EF Query -- A better way?

Objective: Get a list of name|id pairs for a select list from table A where the id does not exist in a filtered collection of Table B records. Constraints: Using MVC 1.0, Entity Framework (no L2S, DataContext, etc.), C# My question is whether there's a smarter way to go about doing this than what I've got working so far--which just s...

IEnumerable question: Best performance?

Quick question: Which one is faster? foreach (Object obj in Collection) { if(obj.Mandatory){ ... } } or foreach (Object obj in Collection.FindAll(o => o.Mandatory)) { ... } and if you know a faster suggestion, i'd be pleased to know. Thank you ...

Adding a parameter to a FindAll for a Generic List in VB.NET

Excellent question and useful looking answers at: http://stackoverflow.com/questions/731337/adding-a-parameter-to-a-findall-for-a-generic-list-in-c But can anyone help turn Jon Skeet's assistance into valid .NET 2.0 VB? I have run his answers through a couple of the usual CSharp converters but the results don't compile. ...

Sorting Core Data with Predicate to eliminate duplicates

I have an Event database loaded into Core Data that has duplicate Event titles. This has been made so the database can provide unique information for each day of the event. Eg fluctuations in pricing on each date. I now need to remove the duplicate event titles from a list that will be displayed as table view with NSFetchRequest and NS...

Avoiding union by join?

Hi, My problem is on Oracle, but is probably database independent (?). I have the following tables: aa vid cb --- -- 1 10 2 15 bb vid cb --- -- 3 25 4 24 *rep repid vid p ----- --- -- 99 1 aa 99 2 aa 99 3 bb 99 4 bb The column p indicates in which table to get the row....

Disjunctive normal form with range predicate

Hey! I need a library/algorithm that can transform an arbitrary logical expression that contains range predicates into a reduced disjoint normal form. Example : (x > 40) & ( (x > 50) | (y > 10)) -> (x > 50) | (x > 40) & (y > 10) Basically, what I want to simply such an expression in order to evaluated as fast as possible. Anyone c...

Becoming operational in Prolog ASAP

Hi all, May be this sort of question has been asked many times( as I see the list when I move the cursor to this messagebox), But my company has a project running in Prolog and I want to clarify few things about how to go about learning it. I know Prolog is different. It should not be learnt just like any other language. Having said t...

Defining is_a predicate in prolog?

Hello, I'm trying to define the inheritance-check predicate is_a/2 in Prolog, but so far all my trials failed. The is_a(X, Y) predicate should return true whenever Y is a superclass of X. For example: object(bare). object(mammal). object(animal). object(bird). is_a(bare, mammal). is_a(mammal, animal). is_a(bird, animal). is_a(X, Y):- ...