6
голосов
5ответов
2349 просмотров

Bit Curious to understand Expression Tree in .NET

I have read several articles and several stackoverflow.com posts about expression tree. It is beating my brain to understand. Questions: 1) Like DOM (Document Object Model), it is an in-memory representation of logic? 2) Somebody explained it is a mechanism to translate an executable code int...

3
голосов
2ответов
3200 просмотров

Evaluating parsed expression in Haskell

This is my first question on SO :) My Haskell knowledge is pretty limited, so i need a bit of help to get me started. I have this BNF grammar: num ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 int ::= num | num int var ::= A | B | C | ... | Z expr ::= var | int | - expr | +(expr , expr) | *...

1
голосов
2ответов
161 просмотров

python expression for this: max_value = max(firstArray) that is not in secondArray

I wasn't sure if there was any good way of doing this. But I thought I'd give stackoverflow a try :) I have a list/array with integers, and a second array also with integers. I want to find the max value from the first list, but the value can not be in the second array. Is there any "fancy" way...

0
голосов
1ответов
1442 просмотров

SQL Expressions in Crystal Reports

I am not at all familiar with SQL expressions and was hoping to get some help I have this: "Reservations"."NY IT Services/Computer Presentation" which is a boolean How would i write this to say "If "Reservations"."NY IT Services/Computer Presentation" is a 1, then display, else do not display? ...

10
голосов
6ответов
12624 просмотров

Math Expression Evaluation

What is the best way to implement a python program that will take a string and will output its result according to operator precedence (for example: "4+3*5" will output 19). I've googled for ways to solve this problem but they were all too complex, and I'm looking for a (relatively) simple one. ...

3
голосов
2ответов
972 просмотров

LINQ Is it possible to get a method name without a return type via LINQ expression trees?

I know it is possible to retrieve a property name or a method with a return type. But is it also possible to get a method name without a return type via LINQ expression trees? Example: string methodname = GetMethodname(x=>x.GetUser()); ---> results: "GetUser"

1
голосов
9ответов
1355 просмотров

Is it possible to define a variable in expression in C++?

I have this insane homework where I have to create an expression to validate date with respect to Julian and Gregorian calendar and many other things ... The problem is that it must be all in one expression, so I can't use any ; Are there any options of defining variable in expression? Somethin...

0
голосов
4ответов
2661 просмотров

Changing value in an SSRS Report

I'm trying to change the font of the text in my SSRS Report using the SSRS Expression language. I have a textbox in my report and I set the Value property of it using the SSRS Expression language ="hello" Is there a way to make the hello literal an underlined string?

0
голосов
2ответов
223 просмотров

Linq expression decimal culture

I have this piece of code: fee.SingleOrDefault(f => 100.05M >= f.Rate); In the database the Fee.Rate is a money field stored using invariant culture. But using this select gives an error because my current culture will convert "100.05" to "100,05" wihich results in; An expression of non...

10
голосов
7ответов
7483 просмотров

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) AN...

8
голосов
2ответов
12604 просмотров

JavaScript: split doesn't work in IE?

Is there a reason why the following piece of code doesn't work in IE? While with FF and other sane browsers it splits the string by the given expression, in IE it simply doesn't work. var str = "abc<font id=\"something\">def</font>gh"; alert(str.split(/(12321lt;.*?12321gt;|.)/).lengt...

3
голосов
3ответов
7910 просмотров

ANTLR Grammar for expressions

I'm trying to implement a expression handling grammar (that deals with nested parenthesis and stuff). I have the following so far, but they can't deal with some cases (successful/failure cases appear after the following code block). Anyone know what's going on? Note: The varname += and varname =...

4
голосов
3ответов
137 просмотров

OCaml: bound expressions v. functions

Here we have a function definition: let f x = x + 3;; Here is an expression: let g = 4;; Could g just be thought of as constant function that takes no arguments? Is there any difference?

17
голосов
8ответов
18542 просмотров

Best and shortest way to evaluate mathematical expressions

There are many algorithms to evaluate expressions, for example: By Recursive Descent Shunting-yard algorithm Reverse Polish notation Is there any way to evaluate any mathematical expression using C# .net reflection or other modern .net technology?

42
голосов
10ответов
84593 просмотров

How to parse a mathematical expression given as a string and return a number?

Is there a way in Java to get the result from this mathematical expression: String code = "5+4*(7-15)"; In other hand what's the best way to parse an arithmetic expression?

10
голосов
3ответов
698 просмотров

C# .NET 3.5: What is Expression<> used for?

What exactly is Expression<> used for in C#? Are there any scenarios where you would instantiate Expression<>'s yourself as an object? If so, please give an example! Thank you!

0
голосов
2ответов
435 просмотров

Linq expression subsonic 3.0.0.3

I want to 'build' a combined query for Subsonic 3.0.0.3, what is the best way for this? I tried; Expression<Func<Person, bool>> exp = p => true; Expression<Func<Person, bool>> fContinent = p => p.ContinentID == 1; Expression<Func<Perso...

2
голосов
2ответов
1849 просмотров

Spring.NET Expression that References an Object Definition

I'm trying to reference another object I've defined in a Spring config file from within an expression. Specifically, I'm trying to populate a property with the value of an expression where I call a method and then a property on the object returned from that method. I've tried the following (name...

0
голосов
1ответов
174 просмотров

Unit testing with Expressions?

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 specifical...

3
голосов
3ответов
3709 просмотров

C#: Strip Illegal Chars from a filename string

Why won't this do anything, output is identical to input? I'm baffled!!! string name = ";;;'']][[ zion \\[[[]]]" char[] invalidChars = System.IO.Path.GetInvalidPathChars(); string invalidString = Regex.Escape(new string(invalidChars)); string valid = Regex.Replace(name, "[" + invalidString + ...

60
голосов
14ответов
146254 просмотров

Reporting Services Remove Time from DateTime in Expression

I'm trying to populate an expression (default value of a parameter) with an explicit time. How do I remove the time from the the "now" function?

0
голосов
1ответов
761 просмотров

Expression Encoder - Limitations for file Dimension - min size of 64 * 64 and must be a multiple of 4?

I receive error messages when attempting to encode files in Expression Encoder when the file width or height is not a multiple of four, or is smaller than 64. I have been able to find very little in the documentation / web searches on this, and nothing that explains what settings may cause / all...

45
голосов
6ответов
12730 просмотров

Overriding grails.views.default.codec='html' config back to 'none'

In Grails (<2.3), if I leave grails.views.default.code='none' in the grails Config.groovy, it's up to me to HTML encode my expressions explicitly in the GSP files: ${myValue?.encodeAsHTML()}. If I set grails.views.default.codec='html" in the Config.groovy, then the HTML encoding happens autom...

3
голосов
1ответов
166 просмотров

In a multitier application should a client be allowed to send its own linq expressions to the server?

The rationale: HQL and NH criteria are NHibernate specific constructs and as such they are server side DAL implementation details. I do not want them to "leak" to the client side. So, our client side provides LINQ expressions for the server to process. Seems legitimate to me, some, however, th...

1
голосов
3ответов
1904 просмотров

Does anyone know how to translate LINQ Expression to NHibernate HQL statement?

Does anyone know of an existing solution to translate a LINQ Expression to HQL statement? Thanks in advance to all the good samaritans out there. P.S. We already use Linq to NHibernate. However, it only works for select statements, whereas HQL is good for other statement kinds, like delete. So...

3
голосов
2ответов
5837 просмотров

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.La...

3
голосов
4ответов
564 просмотров

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

1
голосов
1ответов
1179 просмотров

Making default control template editable in Expression blend

I created my own ContentCOntrol in XAML, e.x.: <ContentControl x:Class="server.ui.DiamondButton"> <ContentControl.Template> <ControlTemplate TargetType="src:DiamondButton"> <...> </ControlTemplate> </ContentControl.Template>...

53
голосов
1ответов
2830 просмотров

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 ...

3
голосов
2ответов
12070 просмотров

DataTable Select: Expression with a space problem

Situation: Hello! I have a little problem in a C# project. I am using the Select method from a DataTable object and using an expression to get what I want but I am having some trouble with a space in one of the strings I am using for the expression. So here is a code sample of what I have: Dat...