expression

Searching on expression indexes

北战南征 提交于 2019-12-24 01:37:28
问题 Searching on expression indexes I'm building an expression index that substrings a source field to avoid overflowing the 2172 character limit on B-trees: CREATE INDEX record_changes_log_detail_old_value_ix_btree ON record_changes_log_detail USING btree ((substring(old_value,1,1024)::text) text_pattern_ops); For the record: -- Postgres 11.4 on RDS, 11.5 on macOS at home. -- The record_changes_log_detail table has about 8M in my test setup. -- The old_value field is of type citext. -- Values in

ExpressionSet subsetting

◇◆丶佛笑我妖孽 提交于 2019-12-24 01:17:03
问题 I have an ExpressionSet object that I want to subset. For example, > str(ESet) Formal class 'ExpressionSet' [package "Biobase"] .. ..@ assayData :.. ..@ phenoData : .. .. .. ..$ STATUS : num [1:210] 1 1 1 1 1 1 1 1 1 1 ... .... I want to extract a subset where STATUS==0 . I've tried: exprs(ESet@phenoData$STATUS==0) but it does not work. 回答1: You are almost there. Guessing at your data structure, I think the following should work: exprs(ESet)[ESet@phenoData$STATUS==0,] If you look at this

cannot apply indexing with [] to an expression

帅比萌擦擦* 提交于 2019-12-24 00:59:09
问题 var dbPerson = from p in db.People where p.Id == PersonId select p; dbPerson[0].HolidaysRemaining--; is throwing me an error with dbPerson[0] saying cannot apply indexing with [] to an expression of type 'system.linq.lqueryable,holidayBookingApp.model.person> can someone please advise how I can resolve this? Thanks 回答1: To get the first item that your query dbPerson returns, use var firstPerson = dbPerson.First(); or Single if you only expect one match and want an exception to be thrown if

How to call sql scalar function in Expression tree of linq queryable?

送分小仙女□ 提交于 2019-12-24 00:48:27
问题 I am creating lambda expression for Iqueryable to get value from a collection but I want to convert that value to other datatype like int or decimal. So as I cannot use c# casting with Iqueryable so I have created user defined scalar function in sql and trying to access that in expression but it throws exception that the 'methodname' cannot be converted to sql expression. public class Context { [DbFunction("dbo", "ConvertToDouble")] public int? ConvertToDouble(string value) { var sql = $"set

CorePlot - Expected Token Before '@' token

自闭症网瘾萝莉.ら 提交于 2019-12-24 00:46:31
问题 I am trying to incorporate CorePlot into my project. I finally manages to get my header files recognized but i keep getting the following error in my main.m. "Expected expression before '@' token" int main(int argc, char *argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([ProjectFiveAppDelegate class])); } } 回答1: The @autoreleasepool syntax was introduced fairly recently, you probably need to install Xcode 4.2. Another possibility is that your compiler

Lambda expression as member functors in a class

烂漫一生 提交于 2019-12-24 00:35:08
问题 I was thrilled when lambda expressions (LE) were part of the gcc starting a 4.5.1 and hoped they would grant a way of getting rid of those nasty functions pointer in C++, which were basically, to my understanding, compiled as C functions. All those static declarations etc... Now I wanted to use LEs in a class, where one can choose a method of computation by a functor. But due to the definition in the proposal for C++1x, this seems not to be possible at all. Here the code and the problem(s).

Long expression crashes SymPy

廉价感情. 提交于 2019-12-23 20:28:07
问题 I'm using 64-bit Python 3.3.1, pylab and 32GB system RAM. This function: def sqrt2Expansion(limit): x = Symbol('x') term = 1+1/x for _ in range(limit): term = term.subs({x: (2+1/x)}) return term.subs({x: 2}) Produces expressions of this kind: 1 + 1/(2 + 1/(2 + 1/(2 + 1/(2 + 1/(2 + 1/(...)))))) . When called as: sqrt2Expansion(100) returns valid result, but sqrt2Expansion(200) produces RuntimeError with many pages of traceback and hangs up pylab/IPython interpreter with plenty of system memory

Dynamic LINQ, Select function, works on Enumerable, but not Queryable

一笑奈何 提交于 2019-12-23 20:15:59
问题 I have been fiddling with dynamic LINQ for some time now, but I have yet to learn its secrets. I have an expression that I want to parse that looks like this: "document.LineItems.Select(i => i.Credit).Sum();" During parsing of this I reach a point where I need to call a Select function on LineItems Collection. I am using factory method of Expression.Call: Expression.Call( typeof(Queryable), "Select", new Type[] { typeof(LineItem), typeof(decimal?) }, expr, Expression.Lambda(expression, new

How to make select query by string property name in lambda expression?

帅比萌擦擦* 提交于 2019-12-23 20:13:58
问题 I would like to make a query by using lambda select, Like below: public class Foo{ public int Id {get;set;} public string Name {get;set;} public string Surname {get;set;} } var list = new List<Foo>(); var temp = list.Select(x=> x("Name"),("Surname")); The property name needs to be sent as a string, I dont know how to use, I have given it for being a example. is it possible? Edit: Foo list : 1 A B 2 C D 3 E F 4 G H I don't know type of generic list, I have property name such as "Name",

How to call method with Expression of type Func as parameter

爱⌒轻易说出口 提交于 2019-12-23 18:32:04
问题 I used Repository pattern that I saw on online tutorial... Everything works fine except for find method, I have no idea how to work with this and I'm having hard time understanding Expressions or Func types. I used linq and lambda before but I'm begginer and still don't use it fluently... public IEnumerable<TEntity> Find(Expression<Func<TEntity, bool>> predicate) { return Context.Set<TEntity>().Where(predicate); } I have this model class: public partial class Artikl { [Browsable(false)]