Search Results

Search found 4498 results on 180 pages for 'expression'.

Page 53/180 | < Previous Page | 49 50 51 52 53 54 55 56 57 58 59 60  | Next Page >

  • How do I use "Into" LINQ expression in VB.NET?

    - by SLC
    I'm converting from C# this LINQ expression. However, it does not seem to work. C# return (from w in fishSticks group w by w.FishQty into g orderby g.Key descending select g).First().First(); VB Return (From w In fishSticks Group w By w.FishQty Into g() Order By g.Key Descending Select g).First().First() Visual Studio turns g into g() itself and then gives me this error: Definition of method 'g' is not accessible in this context. Any ideas?

    Read the article

  • RegExp to validate a formula (string/boolean/numeric expression)?

    - by JSteve
    I have used regExp quit a bit of times but still far from being an expert. This time I want to validate a formula (or math expression) by regExp. The difficult part here is to validate proper starting and ending parentheses with in the formula. I believe, there would be some sample on the web but I could not find it. Can somebody post a link for such example? or help me by some other means?

    Read the article

  • Are there any Parsing Expression Grammar (PEG) libraries for Javascript or PHP?

    - by Peter J. Wasilko
    I find myself drawn to the Parsing Expression Grammar formalism for describing domain specific languages, but so far the implementation code I've found has been written in languages like Java and Haskell that aren't web server friendly in the shared hosting environment that my organization has to live with. Does anyone know of any PEG libraries or PackRat Parser Generators for Javascript or PHP? Of course code generators in any languages that can produce Javascript or PHP source code would do the trick.

    Read the article

  • How to Solve this Error "Cannot convert lambda expression to type 'string' because it is not a deleg

    - by peace
    . I get this error: "Cannot convert lambda expression to type 'string' because it is not a delegate type" - keyword select become underlined in blue Can you please advice. Employee emp = new Employee(); comHandledBySQt.DataSource = from x in emp.GetDataFromTable("1") select new { x.Id, Name = x.FirstName + " " + x.LastName }; comHandledBySQt.DisplayMember = "Name"; comHandledBySQt.ValueMember = "Id"; Above code should displays drop list of employees first name and last name in a combo box

    Read the article

  • A more elegant way to parse a string with ruby regular expression using variable grouping?

    - by i0n
    At the moment I have a regular expression that looks like this: ^(cat|dog|bird){1}(cat|dog|bird)?(cat|dog|bird)?$ It matches at least 1, and at most 3 instances of a long list of words and makes the matching words for each group available via the corresponding variable. Is there a way to revise this so that I can return the result for each word in the string without specifying the number of groups beforehand? ^(cat|dog|bird)+$ works but only returns the last match separately , because there is only one group.

    Read the article

  • how to write regular expression using proc in TCL to deal with following pattern ?

    - by Passion
    Hello Guys, I am new to TCL and seeking a help to deal with the following expression. I am getting the i/p string from the user to validate any of these strings below & no others in a line in CLI { GHI GII GJI GKI} and another tricky one is to write regexp to match only the characters which begin with alphabet A & end with B, It also have 1 or more of either YO or OY in between using procedure. Thank you

    Read the article

  • How can I right a regular expression to check if the 2 properties in an asp.net control have the same name?

    - by xaisoft
    I have the following asp.net custom validator: <asp:CustomValidator runat="server" ClientValidationFunction="valUCRRequired" ID="valUCRRequired" ErrorMessage="Field 7-Date/Time Between is Required" ControlToValidate="DTE_FROM" /> Notice that the ID and ClientValidationFunction have the same value. I want to do a regular expression search where they are the same. Right now, I am just searching for all CustomValidators.

    Read the article

  • Search tool that uses a grammar rather than regular expression?

    - by Tom Hubbard
    Are there any search tools that allow you to set up a simple token/grammar parsing system that work similar to regular expressions? What we want to do is search our ColdFusion code for queries that do not have cfqueryparams in them. A regular expression gets a bit tough in this situation because I can't keep track of the start tags while looking for something else before getting an end tag. It seems like a parsing system would work more accurately.

    Read the article

  • Binding to element in WPF: can the Path expression do math?

    - by John
    Hi I'm trying to bind a control to the parent's Height/width property using ElementName and a Path. However, I don't want to bind to the actual height, but to exactly half the height. Can the Path expression do the math? e.g. Path={ActualHeight/2} I couldn't find a way to do that. IS there any other clever approach? Thanks!

    Read the article

  • How to use Regular Expression to extract information from a HTML webpage?

    - by user569248
    How to use Regular Expression to extract the answer "Here is the answer" from a HTML webpage like this? <b>Last Question:</b> <b>Here is the answer</b> ..:: Update ::.. Thanks everybody! Here is my solution by using BeautifulSoup since I'm using Python framework: response = opener.open(url) the_page = response.read() soup = BeautifulSoup(''.join(the_page)) paraText1 = soup.body.find('div', 'div_id', text = u'Last Question:') if paraText1: answer = paraText1.next

    Read the article

  • How To? Use an Expression Tree to call a Generic Method when the Type is only known at runtime.

    - by David Williams
    Please bear with me; I am very new to expression trees and lambda expressions, but trying to learn. This is something that I solved using reflection, but would like to see how to do it using expression trees. I have a generic function: private void DoSomeThing<T>( param object[] args ) { // Some work is done here. } that I need to call from else where in my class. Now, normally, this would be be simple: DoSomeThing<int>( blah ); but only if I know, at design time that I am working with an int. When I do not know the type until runtime is where I need the help. Like I said, I know how to do it via reflection, but I would like to do it via expression trees, as my (very limited) understanding is that I can do so. Any suggestions or points to sites where I can get this understanding, preferably with sample code?

    Read the article

  • How to create a dynamic Linq Join extension method

    - by Royd Brayshay
    There was a library of dynamic Linq extensions methods released as a sample with VS2008. I'd like to extend it with a Join method. The code below fails with a parameter miss match exception at run time. Can anyone find the problem? public static IQueryable Join(this IQueryable outer, IEnumerable inner, string outerSelector, string innerSelector, string resultsSelector, params object[] values) { if (inner == null) throw new ArgumentNullException("inner"); if (outerSelector == null) throw new ArgumentNullException("outerSelector"); if (innerSelector == null) throw new ArgumentNullException("innerSelector"); if (resultsSelector == null) throw new ArgumentNullException("resultsSelctor"); LambdaExpression outerSelectorLambda = DynamicExpression.ParseLambda(outer.ElementType, null, outerSelector, values); LambdaExpression innerSelectorLambda = DynamicExpression.ParseLambda(inner.AsQueryable().ElementType, null, innerSelector, values); ParameterExpression[] parameters = new ParameterExpression[] { Expression.Parameter(outer.ElementType, "outer"), Expression.Parameter(inner.AsQueryable().ElementType, "inner") }; LambdaExpression resultsSelectorLambda = DynamicExpression.ParseLambda(parameters, null, resultsSelector, values); return outer.Provider.CreateQuery( Expression.Call( typeof(Queryable), "Join", new Type[] { outer.ElementType, inner.AsQueryable().ElementType, outerSelectorLambda.Body.Type, innerSelectorLambda.Body.Type, resultsSelectorLambda.Body.Type }, outer.Expression, inner.AsQueryable().Expression, Expression.Quote(outerSelectorLambda), Expression.Quote(innerSelectorLambda), Expression.Quote(resultsSelectorLambda))); } I've now fixed it myself, here's the answer. Please vote it up or add a better one.

    Read the article

  • Compilation error while compiling an existing code base

    - by brijesh
    Hi, While building an existing code base on Mac OS using its native build setup I am getting some basic strange error while compilation phase. /Developer/SDKs/MacOSX10.3.9.sdk/usr/include/gcc/darwin/3.3/c++/bits/locale_facets.h: In constructor 'std::collate_byname<_CharT::collate_byname(const char*, size_t)': /Developer/SDKs/MacOSX10.3.9.sdk/usr/include/gcc/darwin/3.3/c++/bits/locale_facets.h:1072: error: '_M_c_locale_collate' was not declared in this scope /Developer/SDKs/MacOSX10.3.9.sdk/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/messages_members.h: In constructor 'std::messages_byname<_CharT::messages_byname(const char*, size_t)': /Developer/SDKs/MacOSX10.3.9.sdk/usr/include/gcc/darwin/3.3/c++/ppc-darwin/bits/messages_members.h:79: error: '_M_c_locale_messages' was not declared in this scope /Developer/SDKs/MacOSX10.3.9.sdk/usr/include/gcc/darwin/3.3/c++/limits: At global scope: /Developer/SDKs/MacOSX10.3.9.sdk/usr/include/gcc/darwin/3.3/c++/limits:897: error: 'float __builtin_huge_valf()' cannot appear in a constant-expression /Developer/SDKs/MacOSX10.3.9.sdk/usr/include/gcc/darwin/3.3/c++/limits:897: error: a function call cannot appear in a constant-expression /Developer/SDKs/MacOSX10.3.9.sdk/usr/include/gcc/darwin/3.3/c++/limits:897: error: 'float __builtin_huge_valf()' cannot appear in a constant-expression /Developer/SDKs/MacOSX10.3.9.sdk/usr/include/gcc/darwin/3.3/c++/limits:897: error: a function call cannot appear in a constant-expression /Developer/SDKs/MacOSX10.3.9.sdk/usr/include/gcc/darwin/3.3/c++/limits:899: error: 'float __builtin_nanf(const char*)' cannot appear in a constant-expression /Developer/SDKs/MacOSX10.3.9.sdk/usr/include/gcc/darwin/3.3/c++/limits:899: error: a function call cannot appear in a constant-expression /Developer/SDKs/MacOSX10.3.9.sdk/usr/include/gcc/darwin/3.3/c++/limits:899: error: 'float __builtin_nanf(const char*)' cannot appear in a constant-expression /Developer/SDKs/MacOSX10.3.9.sdk/usr/include/gcc/darwin/3.3/c++/limits:899: error: a function call cannot appear in a constant-expression /Developer/SDKs/MacOSX10.3.9.sdk/usr/include/gcc/darwin/3.3/c++/limits:900: error: field initializer is not constant /Developer/SDKs/MacOSX10.3.9.sdk/usr/include/gcc/darwin/3.3/c++/limits:915: error: field initializer is not constant

    Read the article

  • Passing in a lambda to a Where statement

    - by sonicblis
    I noticed today that if I do this: var items = context.items.Where(i => i.Property < 2); items = items.Where(i => i.Property > 4); Once I access the items var, it executes only the first line as the data call and then does the second call in memory. However, if I do this: var items = context.items.Where(i => i.Property < 2).Where(i => i.Property > 4); I get only one expression executed against the context that includes both where statements. I have a host of variables that I want to use to build the expression for the linq lambda, but their presence or absence changes the expression such that I'd have to have a rediculous number of conditionals to satisfy all cases. I thought I could just add the Where() statements as in my first example above, but that doesn't end up in a single expression that contains all of the criteria. Therefore, I'm trying to create just the lambda itself as such: //bogus syntax if (var1 == "something") var expression = Expression<Func<item, bool>>(i => i.Property == "Something); if (var2 == "somethingElse") expression = expression.Where(i => i.Property2 == "SomethingElse"); And then pass that in to the where of my context.Items to evaluate. A) is this right, and B) if so, how do you do it?

    Read the article

  • Creating a sort function for a generic list

    - by Andrey
    I have a method for sorting generic lists by the object fields: public static IQueryable<T> SortTable<T>(IQueryable<T> q, string sortfield, bool ascending) { var p = Expression.Parameter(typeof(T), "p"); if (typeof(T).GetProperty(sortfield).PropertyType == typeof(int?)) { var x = Expression.Lambda<Func<T, int?>>(Expression.Property(p, sortfield), p); if (ascending) q = q.OrderBy(x); else q = q.OrderByDescending(x); } else if (typeof(T).GetProperty(sortfield).PropertyType == typeof(int)) { var x = Expression.Lambda<Func<T, int>>(Expression.Property(p, sortfield), p); if (ascending) q = q.OrderBy(x); else q = q.OrderByDescending(x); } else if (typeof(T).GetProperty(sortfield).PropertyType == typeof(DateTime)) { var x = Expression.Lambda<Func<T, DateTime>>(Expression.Property(p, sortfield), p); if (ascending) q = q.OrderBy(x); else q = q.OrderByDescending(x); } // many more for every type return q; } Is there any way I can collapse those ifs to a single generic statement? The main problem is that for the part Expression.Lambda<Func<T, int>> I am not sure how to write it generically.

    Read the article

  • How to convert int to char in JSP expression language?

    - by james.bunt
    I need to display incremented single characters to denote footnotes in a table of data in a JSP. In Java I would normally have a char variable and just increment it, or convert an int to a char by casting it (e.g. (char)(i + 97) to convert a 0-based index to a-z). I can't figure out how to do this in expression language short of writing my own JSTL function. Does anyone know how to convert an int to char in EL? Or how to increment a char variable in EL? Or possibly even a better technique to do what I'm trying to do in JSP/EL? Example of what I need to be able to produce: a mydata b myotherdata ... a first footnote b second footnote

    Read the article

  • How do you match only valid roman numerals with a regular expression?

    - by Daniel Magliola
    Thinking about my other problem, i decided I can't even create a regular expression that will match roman numerals (let alone a context-free grammar that will generate them) The problem is matching only valid roman numerals. Eg, 990 is NOT "XM", it's "CMXC" My problem in making the regex for this is that in order to allow or not allow certain characters, I need to look back. Let's take thousands and hundreds, for example. I can allow M{0,2}C?M (to allow for 900, 1000, 1900, 2000, 2900 and 3000). However, If the match is on CM, I can't allow following characters to be C or D (because I'm already at 900). How can I express this in a regex? If it's simply not expressible in a regex, is it expressible in a context-free grammar? Thanks for any pointers!

    Read the article

  • How do I get a value of a reference type in an Expression?

    - by Jon Kruger
    I have this method: public void DoSomething<T>(Expression<Func<T, object>> method) { } If this method is called like this: DoSomething(c => c.SomeMethod(new TestObject())); ... how do I get the value of the parameter that was passed into SomeMethod()? If the parameter is a value type, this works: var methodCall = (MethodCallExpression)method.Body; var parameterValue = ((ConstantExpression)methodCall.Arguments[0]).Value; However, when I pass in a reference type, methodCall.Arguments[0] is a MemberExpression, and I can't seem to figure out how to write code to get the value out of it.

    Read the article

< Previous Page | 49 50 51 52 53 54 55 56 57 58 59 60  | Next Page >