I want to check if a file path is in a given directory (or one of its subdirectories), from PowerShell.
Right now I'm doing:
$file.StartsWith( $directory, [StringComparison]::InvariantCultureIgnoreCase )
but I'm sure there are better ways.
I could do take $file.Directory and iterate over all .Parents, but I was hoping for something...
Hi,
I have a List<MyObj> with the class MyObj : IComparable. I wrote the method CompareTo in the MyObj class per the IComparable interface, but when I use the List<MyObj>.Contains(myObjInstance) it returns false when it should be true.
I'm not sure I'm understanding how I need to proceed to make sure the List uses my custom comparison...
from the following strings:
"details.php?news=13&action=main&menu_type=&option=single&news_id=4792&pub_no=50"
Is this possible in String str.contains(strcase)
where strcase="details.php", "news_id" can both be checked at the same time.
Not like: str.contains("details.php")&&str.contains("news_id").
both cases should be taken to t...
i need to determine if a value exists in an array using javascript.
I am using the following function:
Array.prototype.contains = function(obj) {
var i = this.length;
while (i--) {
if (this[i] == obj) {
return true;
}
}
return false;
}
The above function always returns false.
The array val...
I am using xVal combind with the jquery.validate plugin, but have come across a slight problem in that it is posting validation messages twice in a certain instance. I think this bug should be fairly easily fixed with some clever jQuery in the placement of the error message.
I am trying to find a way to see if a ul already contains an l...
Good day,
I have a Hibernate mapping that looks something like this:
<class name="MyEntity">
<set name="scalarSet" table="(select fk, scalar_value from other_table)">
<key column="fk"/>
<property column="scalar_value" type="long"/>
</set>
</class
Given this, how do I query such that a value of MyEntity.scalarSet (which is...
I want to test whether a certain string is contained in a short list of strings. Currently the code is like this:
if (new List<string> { "A", "B", "C" }.Contains (str)) {
However, this seems bloated. For instance, iirc, in Java I could simply write {"A", "B", "C"}.Contains(str) which would be much preferable to the above.
I'm sure th...
i have the following linq query that create a left join between two tables:
var joinResultRows = from leftTable in dataSet.Tables[leftTableName].AsEnumerable()
join
rightTable in dataSet.Tables[rightTableName].AsEnumerable()
on...
Greetings,
I am trying to tear down query returned from find call using containable in CakePHP.
for example I have 2 models, User and Post. User hasMany Post.
Now when I am using containable on find call like so:
$User->id = 1;
$User->find('first', array(
'fields' => array('id'),
'contain' => array('Post')
))
It will not re...
Hello,
I have a webpage (A) and I am embedding (A) to my mainpage (B) using iframe. This (A) contains a link which closes the browser window:
<a href="" onclick="window.opener = window;
window.close();
return false;">Close The Page</a>
Since I embedd (A), the close ability in (A) is no more functional. What I need to do is, w...
Hi Guys,
Say I have 2 divs:
<div>£ 21.99</div>
<div>£</div>
If I only want to select the div that contains the symbol only, how would I go about this?
I have tried:
if ($('div:contains("£")').length > 0)
{
$(this).addClass("pound");
}
...
Hi, I'm trying to work out how to create a query using Linq to NHibernate.
I have two classes like this:
public class Foo
{
private ISet<Bar> _bars = new HashedSet<Bar>();
public virtual ISet<Bar> Bars
{
get { return _bars; }
set { _bars = value; }
}
}
public class Bar
{
public string Name { get; se...
Hello guys,
I'm having problem with the contains in jquery. It seems that it only accepts one word. Not a phrase or two words.
Example:
$('#div:contains('Word')'); --> This is okay
$('#div:contains('Just another word')'); --> This will return empty/this will not match.
Have you experience this kind of problem?
Your reply is greatl...
Precisely which methods in a Class are responsible for the List<T>'s Contains() to operate?
I have overloaded == in my class. But it seems to have no effect.
...
Hi,
I am new to JQuery and maybe am missing the obvious, but how can I filter a table using the contains selector but have it look for multiple strings using an OR operator. In other words, I would like rows containing "Red" OR "Yellow" to be hidden.
So far I have this which works by hiding all rows except the given date:
$(function()...
Edited
Solution using or rather than union !
It seems there is a problem with linq2sql w.r.t selecting a relation post a UNION
msdn's social forums also indicate it as so
Intent
To get WCtegories & WPBands having items ("W") and each item with either a price or an offer specified
Sql just works fine but linq is bugging out with erro...
Someone has an answer to this missing feature in Entity Framework. Does anyone have a solution to the missing Contains method in Entity Framework that works? I've tried a number of those on here and through Google, but none of them seem to actually work.
...
My Linq To Sql query
PROJETS = PROJETS.Where(p => (p.VilleArrive != "" && p.VilleArrive != null) && p.VilleArrive.Contains(alerte.VilleArrive));
is translated like this
SELECT * // (many columns)
FROM [dbo].[cov_Projet] AS [t0]
WHERE ([t0].[VilleArrive] <> @p0) // city != ""
AND ([t0].[VilleArrive] IS NOT NULL) // city != nul...
How do you check that an element is in a set?
Is there a simpler equivalent of the following code:
myset.find(x) != myset.end()
...
Hi Guys ang Gals,
I'm being given XML in the following format, and am parsing it with PHP's SimpleXML.
<?xml version="1.0" encoding="UTF-8"?>
<ManageMyBooking>
<BookingInfo>
<PartyDetails>
<Passenger>
<PaxNo>1</PaxNo>
<Title>Mrs</Title>
<Surname>Murphy</Surname>
...