contains

linq and contains

i have func public PageOfList<ConsaltQuestion> Filter(int? type, int pageId, EntityCollection<ConsaltCost> ConsaltRoles) { // return _dataContext.ConsaltQuestion.Where((o => o.Type == type || type == null) && (o=>o.Paid == paid)); return (from i in _dataContext.ConsaltQuestion where ((i.Type == type || type == null) &...

detect a string contained by another discontinuously

Recently I'm working on bad content(such as advertise post) filter of a BBS.And I write a function to detect a string is in another string not continuously.Code as below: $str = 'helloguys'; $substr1 = 'hlu'; $substr2 = 'elf'; function detect($a,$b) //function that detect a in b { $c = ''; for($i=0;$i<=strlen($a);$i++) { ...

Any big difference between using contains or loop through a list?

Hi, Performance wise, is there really a big difference between using: ArrayList.contains(o) vs foreach|iterator LinkedList.contains(o) vs foreach|iterator Of course, for the foreach|iterator loops, I'll have to explicitly compare the methods and return true or false accordingly. The object I'm comparing is an object where equals() ...

:contains for multiple words

I am using the following jQuery var etag = 'kate' if (etag.length > 0) { $('div').each(function () { $(this).find('ul:not(:contains(' + etag + '))').hide(); $(this).find('ul:contains(' + etag + ')').show(); }); }​ towards the following HTML <div id="2"> <ul> <li>john</li> <li>jack</li> </ul> <ul> <li>ka...

SQL SERVER FULL-TEXT INDEX, CONTAINS return empty

Hi, All: I got a issue about full index, any body can help me on this? 1) set up full text index CREATE FULLTEXT INDEX ON dbo.Companies(my table name) ( CompanyName(colum of my table) Language 0X0 ) KEY INDEX IX_Companies_CompanyAlias ON QuestionsDB WITH CHANGE_TRACKING AUTO GO 2) Using CONTAINS to find the matched rows SELECT Co...

Java - Is Set.contains() broken on OpenJDK 6?

Hey, I've come across a really strange problem. I have written a simple Deck class which represents a standard 52 card deck of playing cards. The class has a method missingCards() which returns the set of all cards which have been drawn from the deck. If I try and compare two identical sets of missing cards using .equals() I'm told they...

Why do we have contains(Object o) instead of contains(E e)?

Is it to maintain backwards compatibility with older (un-genericized) versions of Collection? Or is there a more subtle detail that I am missing? I see this pattern repeated in remove also (remove(Object o)), but add is genericized as add(E e). ...

array contains in where

hi, i've to get rows from a table CBR_MissioniGruppi that have id in gruppi list. I've tried with this, but doesn't work. List<int> gruppi = new List<int>() { 1, 2 }; foreach (CBR_MissioniGruppi mg in db.CBR_MissioniGruppi.Where(p => gruppi.Contains(p.GruppoID))) How can i do it? thanks ...

Search in a List<DataRow>?

Hello, I have a List which I create from a DataTabe which only has one column in it. Lets say the column is called MyColumn. Each element in the list is an object array containing my columns, in this case, only one (MyColumn). Whats the most elegant way to check if that object array contains a certain value? Thanks ...

How do I tell jQuery to not bubble up the tree when using contains(string)?

I need to hide a div that has a certain string in it, using contains.. but jQuery is hiding all div's that are parents of the target div too ! $("div:contains('user_notifications')").css("display","none") how do I tell jQuery to just match the div that actually contains that string? Thanks Edit: here's the inner div that contai...

correct this xpath expression please

This is a piece of my XML document: <?xml version="1.0" encoding="UTF-8"?> <catalog> <mfVictor> <decal> <company>Victor</company> <title>Wood Horn with Blue Background</title> <image> <url>victor01.jpg</url> <width>60</width> <height>60</height> <name>Wood Horn Blue Background</name> <link></li...

comparing variables for validate addMethod

Ive been struggling with this all day, been close a couple times but nothing seems to work exactly. I have a text input <input type="text" name="USA_sub" id="USA_sub" /> and after that an input <input type="text" name="FirstName" id="FirstName" /> I need to make sure (create a validation rule) that states "#FirstName" 's value must be ...

Entity Framework Contains method and objects

Hi, Is there a way of using the Contains method in Entity Framework 4 with the actual id of the object? Take these entities as an example: public class Order { public int OrderId { get; set; } // PK public string CustomerId { get; set; } // FK to Customer } public class OrderItem { public int OrderId { get; ...

How can I hide a string and replace it with a view/hide button using jQuery?

I have a field that is dynamically being filled. I know that the first few words of the string are always going to be: The order was manually edited: This is followed by a list of all the edits that was made. This list can be somewhat long sometimes. I want to hide the list of edits, and replace it with a button that says 'Click...

How can I select a string within a string and save it into a variable with jQuery?

I have a string that is dynamically entered into: <span class="note_message">The order was manually edited:<br/>The list of edits goes here, and this maybe somewhat long sometimes</span> That is an example of a string that may be entered into the span. It ALWAYS starts with "The order was manually edited:", so I would like to use jQue...

LIKEs and ORs and stuff in Linq

I'm trying to write a linq-to-sql query using || that behaves the same way as the OR in SQL when combined with a LIKE/Contains. SQL: SELECT * FROM Users WHERE GroupNumber = 'A123456' OR (FirstName like 'Bob%' AND LastName like 'Smith%') This will result in everyone with a name like "Bob Smith" as well as everyone with a GroupNumber e...

What's the fastest way to check List<String> contains a unique String?

It's in Java. Basically I have about 1,000,000 strings, for each request I have to check a String is belonged to the list or not. I'm worried about the performance, so what's the best method? ArrayList? Hash? Thanks. ...

LINQ many to many hell - querying where CONTAINS ALL

I have a many to many relationship as follows: Products ProductID Description ProductFeatures ProductFeatureID ProductID FeatureID Features FeatureID Description Any Product can have many Features. I then come along with an iQueryable called "SearchFeatures" which contains two particular Feature objects that I want to search on. I ...

Java container .contains question

Is there an easy way to check a container if it contains a value, not an object? This is the code I'd like to work: String[] i = {"One", "Two", "Three"}; if (Arrays.asList(i).contains("One")){ return true; } Is there a way to do this or will I have to loop through the array myself? ...

Ignoring Apostrophes In Contains

Simple question, perhaps a difficult answer. We're using CONTAINS but when matching criteria containing apostrophes (because these are for French road names), then obviously they don't match. So for example, searching for "Lislet" when the database contains "L'islet" yields nothing. I've looked into using dictionaries and thesauruses ...