expressions

Subsonic 2.2 - Update with expresssion - how to make my solution better?

Hi, I'm learning SubSonic 2.2, and have the following query, but it feels "Wrong" writing my expression ("count + 1") as a string. Can any experts suggest a better way that this? int records = new Update(Wordsfile.Schema) .SetExpression(Wordsfile.CountColumn).EqualTo("count + 1") .Where(Wordsfile.Co...

LINQ Dynamic Expression API, predicate with DBNull.Value comparison

I have an issue using the Dynamic Expression API. I cannot seem to compare a DataTable field against DBNull.Value. The API is supposed to be able to "support static field or static property access. Any public field or property can be accessed.". However given the following query: var whatever = table1.AsEnumerable() ...

How to combine two expressions: result = exp1(exp2);

As subject, how to combine two expressions into a single one for this case: Expression<Func<IEnumerable<T>, IEnumerable<T>>> exp1; Expression<Func<IEnumerable<T>, IEnumerable<T>>> exp2; Expression<Func<IEnumerable<T>, IEnumerable<T>>> result = ???; // exp1(exp2) ...

Curiosity: Why does Expression<...> when compiled run faster than a minimal DynamicMethod?

I'm currently doing some last-measure optimizations, mostly for fun and learning, and discovered something that left me with a couple of questions. First, the questions: When I construct a method in-memory through the use of DynamicMethod, and use the debugger, is there any way for me to step into the generated assembly code, when vie...

C# expression evaluates to a namespace

MSDN docs state "An expression is a fragment of code that can be evaluated to a single value, object, method, or namespace." Could someone please explain what it means for an expression to evaluate to a namespace - how can that be? edit: fixed typo ...

C#, create (method?) expression and call it ...

I'm realtively new to c# expression. I have some class something like that class SimpleClass { private string ReturnString(string InputString) { return "result is: "+InputString; } public string Return(Expression exp) { LambdaExpression lambda = Expression.Lambda(exp); return lambda.Compile()...

Unit testing with Expressions?

Hi All, I am unit testing some code that interactes with a repository, that takes an expression (Expression<Func<Entity, bool>>) to filter the results, like so: int orderId = 10; _respository.GetFiltered(order => order.Id == orderId); I am having a problem Unit Testing, more specifically setting up expectations that an expression wi...

c expression Evaluator

Okay lets say I have a string such as this in a text file: ((( var1 AND var2 AND var3) OR var4) AND ((var5 OR var6) AND var7)) after parsing this into the c program and the vars are handled and set correctly it will end up looking something like this: ((( 1 AND 0 AND 0) OR 1) AND ((0 OR 1) AND 1)) Are there any useful libraries out...

Are named functions underrated in JavaScript?

Taking the jQuery framework for example, if you run code like this: $(document).ready(function init() { foo.bar(); }); The stack trace you get in Firebug will look like this: init() anonymous() anonymous([function(), init(), function(), 4 more...], function(), Object name=args) anonymous() anonymous() As you can see, it's not very ...

PHP Debugging with Expressions?

Hi, I am new to debugging and I'm very interested in knowing how to setup expressions in debugging environment. For example, if I want to see when a variable $a changes it value to non-empty, how would I find it out? ...

c expression evaluator take 2

In reference to the accepted solution in: SO:expression_evaluator Can anyone provide a version that works with negation as well? things like ((!(0 or !1) and !((0 or 1 or 1) and !1)) need to work as well. I got it working so that negating the 0's or 1's is fine but I can't get it to work with the negation of whole groups(!'s at begi...

Need help creating Linq.Expression to Enumerable.GroupBy

I am attempting to generate an Expression tree that ultimately calls a series of GroupBy methods on the Enumerable type. In simplified form I am attempting something like this: IEnumerable<Data> list = new List<Data>{new Data{Name = "A", Age=10}, new Data{Name = "A", Age=12}, new Data{Name = "B", Age=20}, new Data{Name="C", Ag...

Converting a Scheme expression to a string

Given an expression '(lambda (x) x) How can I translate this into a string. I thought symbol->string will do the job but no it cant not a symbol. e.g for a macro to-string: (to-string (lambda(x) x)) this should return >> "(lambda (x) x)" Any ideas folks Thanks ...

PHP, Eclipse/Zend Studio & Debugging with expressions

Hi, I have a variable in my PHP application that changes often, I'd like to debug so that it keeps executing until the variable changes to a specific value (in this case boolean true). I've heard this could be done with expressions? True? ...

Nhiberate Criterion Expression Combining "ands" and "ors"

I am having a little trouble with building my criteria object. Normally, I Build my cruteria similarly to this: ISession session = GetSession(); ICriteria criteria = session.CreateCriteria(typeof(MyObject)) .Add(Expression.Gt("StartDate", DateTime.Now.ToUniversalTime())) .Add(Expression.Eq("SubObject.Sub...

Scripting After Effects

I need to learn Affect Effect expressions and scripting fast. Can you recommend any resources on this topic? I've got a pretty knowledge of other scripting concept and languages like javascript. I just need the know-how on after effect scripting itself.. I'm using AE9 Thanks a mill! ...

Visual Studio fails to display some watched expressions

In Visual Studio, most of my objects and variables cannot be resolved during a debugging session for various reasons. This means I cannot inspect or watch objects or their invoke their functions making it extremely difficult to debug my code because most of my expressions simply won't work. Some typical errors I get when adding an expr...

Generic Database Linq

Given a function as below, i can take a single table from my database and write a lambda using the Where extension method and pretty much build all the other cases using a simple wrapper method and supplying a filter. public void getPeople(Expression<Func<tblPeople, bool>> filter, Action<List<tblPeople>> callback) { ...

Sequence points and partial order

A few days back there was a discussion here about whether the expression i = ++i + 1 invokes UB (Undefined Behavior) or not. Finally the conclusion was made that it invokes UB as the value of 'i' is changing more than once between two sequence points. I was involved in a discussion with Johannes Schaub in that same thread. Accor...

Report expression help

I am using the following expression in a local report for a WinForms application, but I receive "#Error" when the field value is null: =IIf(Fields!MyField.Value = "", "NULL", Left(Fields!MyField.Value, Len(Fields!MyField.Value) - 2)) I am doing this to strip off a trailing comma and space of the value. The IIf() works, the Left() wor...