expression

XPath 1.0 to find if an element's value is in a list of values

Is there a way to construct an XPath that evaluates whether an element's value is in a predefined list of values? Something akin to this: /Location/Addr[State='TX or AL or MA'] Which would match nodes whith State elements for Texas, Alabama, or Massachusetts? I know that I can unpack the expression: /Location/Addr[State='TX] or /Loc...

Render Silverlight Animation to video file

Hi guys I need to be able to render a silverlight storyboard animation to video. The animated content itself could be simple UIElements, Images or even two or more videos playing at the same time. Several ideas came to mind like RenderTargetBitmap on a single frame basis, but: 1) I've never tested this against video embedded content ...

How parse a string as linq exprssion ?

I've this linq to devforce expression : (from r in mgr.testTables select r).OrderBy(r => r.id); I want to specify sorting column name as a string, I need something like this : string orderBy = "r => r.id"; (from r in mgr.testTables select r).OrderBy( orderBy ); is there any way to parse a string as linq expression ? ...

Modulo in order of operation

Where does modulo come in the mathematical order of operation? I am guessing it is similar to division, but before or after? ...

Forcing to make floating point calculations

In IronPython is there any way to force the expression containing integer values to be calculated as floating point. For instance, I'd like the expression 1/3 to be evaluated as 1./3. with the result 0.333... I need this to make a simple run-time expression calculator within a C# project by means of IronPython. I cannot force us...

Negating certain words from a custom rewrite expression?

Hi. I have a WP page named Book (/book/) which displays a book in various languages. The language and chapter variables are passed as query variables. So the URL structure looks like: /book/english/ (This displays a list of chapters in English) /book/english/foreword/ (This displays the Foreword of the book in English) Here is what I h...

What is the purpose of LINQ's Expression.Quote method?

The MSDN documentation states: Expression.Quote Method Creates a UnaryExpression that represents an expression that has a constant value of type Expression. I've been able to build predicate expressions for use in LINQ queries by manually constructing them using the Expression class, but have never come across the need f...

Create expression to invoke method with out parameter

Hi there, I am trying to create an expression that invokes an internal method, the internal method has an out parameter, is this possible? public class Program { static void Main(string[] args) { var type = typeof (Program); var methodInfo = type.GetMethod("ValidateActiveControl", BindingFlags.Instance | BindingF...

How to save an expression datacolumn to the database?

I have a datagridview on a form with multiple columns. Three of the columns are expression columns. One column is subtracted from the second and the result is displayed in the third. Everything works great but when I hit the save button and save to the database, all the columns are saved to the database except the three columns used in t...

How do I write a regular expression for these path expressions.

Hi, I'm trying to write a helper method that breaks down path expressions and would love some help. Please consider a path pattern like the following four (round brackets indicate predicates): item.sub_element.subsubelement(@key = string) ; or, item..subsub_element(@key = string) ; or, //subsub_element(@key = string) ; or, item(@key =...

Expression blend 4 Silverlight version Incompatibility

I am getting the below error when I try create new sketch flow application "Blend cannot continue because of compatible silverlight version could not be found" I have the following installed Microsoft Silverlight version 4.0.50524.0 Microsoft Silverlight 4 SDK Microsoft Silverlight 4 Toolkit April 2010 Microsoft Silverlight 4 Tools ...

Regular expression to find and replace unescaped Non-successive double quotes in CSV file.

This is an extension to a related question answered Here I have a weekly csv file which needs to be parsed. it looks like this. "asdf","asdf","asdf","asdf" But sometimes there are text fields which contain an extra unescaped double quote string like this "asdf","as "something" df","asdf","asdf" From the other posts on here, I was a...

How to get runtime-argument info from extression tree parameter array

Okay first to explain the rules: I need a function that constructs a delegate matching any delegate type that encapsulates a body of which invokes a delegate of type (Object) (Object[] args) with 'args' containing all of the arguments passed to the original delegate during invocation. My work so far: delegate void TestDelegate(int...

How to write a simple Expression-like class in .NET 2.0?

I'm currently working in .NET 2.0 Visual Basic. The current project is an Active Directory Wrapper class library within which I have a Searcher(Of T) generic class that I wish to use to search the underlying directory for objects. In this Searcher(Of T) class I have the following methods: Private Function GetResults() As CustomSet(Of T...

Regular expression to search for a string1 that is never followed by string2

How to construct a regular expression search pattern to find string1 that is not followed by string2 (immediately or not)? For for instance, if string1="MAN" and string2="PN", example search results would be: "M": Not found "MA": Not found "MAN": Found "BLAH_MAN_BLEH": Found "MAN_PN": Not found "BLAH_MAN_BLEH_PN": Not found "BLAH_MAN_B...

Dynamic Expression API (Dynamic.cs) Not properly parsing expression in .net 3.5

Hi I'm having trouble getting this API working in .net 3.5 (works fine in 4.0). Basically I have following code List<ParameterExpression> parameters = new List<ParameterExpression>(); parameters.Add(Expression.Parameter(typeof(double), "R0C6")); parameters.Add(Expression.Parameter(typeof(double), "R0C7")); parameters.Add(Expres...

Shortest way to write this in JavaScript

if $('.item:last').attr('id').split('-')[1] is not undefined var liid equals that, and if it is undefined then it equals null ...

Reporting Services - handling an empty date?

Hey, I have a report parameter which looks like this: 01.01.2009 00:00:00 Its a date (as string), as you might have guessed :). The problem is, this param can be an empty string as well. So I tried those expressions: =IIf(IsDate(Parameters!DateTo.Value), CDate(Parameters!DateTo.Value), "") =IIf(Len(Parameters!DateTo.Value) > 0, CDate(...

C++ rvalue expression with destructor generates warning C4701 in Visual Studio 2010

The following C++ code, compiles without warning in Visual Studio 2010: extern void callFunc( int, int ); struct str_wrapper { str_wrapper(); }; extern bool tryParseInt( const str_wrapper void test() { int x, y; if ( tryParseInt( str_wrapper(), x ) } } However if str_wrapper has a user-defined destructor, the code generates t...

XPath: how to sort a nodeset obtained by an expression using an expression?

I have a group with the following attributes: <mygroup> <item id="0"> <item id="1"> <item id="2"> </mygroup> when I cal the expression /mygroup/item I need to re-order the nodeset according the attribute "id", there is a way to do it without using the sort template? ...