expression

Assign Mapped Object to Expression Result in LINQ to Entities

若如初见. 提交于 2020-03-25 19:19:20
问题 I have the following child object that we use an expression to map our 'entity' to our 'domain' model. We use this when specifically calling our ChildRecordService method GetChild or GetChildren: public static Expression<Func<global::Database.Models.ChildRecord, ChildRecord>> MapChildRecordToCommon = entity => new ChildRecord { DateTime = entity.DateTime, Type = entity.Type, }; public static async Task<List<ChildRecord>> ToCommonListAsync(this IQueryable<global::Database.Models.ChildRecord>

how to convert a string to a mathematical expression programmatically

 ̄綄美尐妖づ 提交于 2020-03-22 06:22:54
问题 I am a beginner at C#. I am facing a problem while converting a string to a mathematical expression. I have a UI where user can create formula using random formula field. And in another UI user will give input of those formula field. like for example at first time the formula may be (a+b)^n and another the formula may be ((a+b+c)^n+b) . In my calculation UI for the first time user will give input for a,b,n and for 2nd formula user will give input for a,b,c,n. Can anyone please help me about

Regular expression that match letters from all language php

廉价感情. 提交于 2020-03-16 08:12:29
问题 im trying for few hours to find the right regular expression in php to match any language letters but to prevent it to allow space i have try this [^\p{L}] this is ok but it look like it allow the space then i have try this [^\w_-] and it still look that it allow space anyone can help with this please ? 回答1: You need to specify the Unicode modifier u to get Unicode character properties in PCRE. For example... $pattern = "/([\p{L}]+)/u"; $string = "你好,世界!Привет мир! !مرحبا بالعالم"; if (preg

How to use simultaneously superscript and variable in a axis label with ggplot2

泄露秘密 提交于 2020-03-13 13:04:59
问题 I would like to use together a variable (here the vector element "type") and a unit containing a superscript (here m^2) inside n axis label. data <- list(houses = data.frame(surface = c(450, 320, 280), price = c(12, 14, 6)), flats = data.frame(surface = c(45, 89, 63), price = c(4, 6, 9))) I achieve to display "m^2" using an expression, for (type in c('houses', 'flats')){ p <- ggplot(aes(x = surface, y = price), data = data[[type]]) + geom_point() + xlab(expression(paste('surface of this type

What is wrong with print (2 & 2) >> 1?

假如想象 提交于 2020-03-03 10:00:07
问题 I am just wondering what happens with that piece of code. Why the result is incorrect only when printed directly, why is the newline ignored? user@host_09:22 AM: perl print 2 >> 1, "\n"; print 2 & 2, "\n"; print (2 & 2) >> 1, "\n"; 1 2 2user@host_09:22 AM: perl $a = (2 & 2) >> 1; print "$a\n"; 1 回答1: When you print it with warnings it becomes clear(er) perl -we'print (2 & 2), "\n"' says print (...) interpreted as function at -e line 1. Useless use of a constant ("\n") in void context at -e

Why doesn't `my $x = if (0) {1} else {2}` work?

此生再无相见时 提交于 2020-03-03 06:34:40
问题 In perl, $x = if (0) {1} else {2} does not work. $ perl -E'$x = if (0) {1} else {2}' syntax error at -e line 1, near "= if" Execution of -e aborted due to compilation errors. This makes sense, because if conditionals are not expressions in Perl. They're flow control. But then my $x = do { if (0) {1} else {2} }; Does work! How come a do BLOCK can accept an if conditional? But assignment can not? It would seem in the above the flow control must either know it's context in a do BLOCK always act

Why doesn't `my $x = if (0) {1} else {2}` work?

∥☆過路亽.° 提交于 2020-03-03 06:33:06
问题 In perl, $x = if (0) {1} else {2} does not work. $ perl -E'$x = if (0) {1} else {2}' syntax error at -e line 1, near "= if" Execution of -e aborted due to compilation errors. This makes sense, because if conditionals are not expressions in Perl. They're flow control. But then my $x = do { if (0) {1} else {2} }; Does work! How come a do BLOCK can accept an if conditional? But assignment can not? It would seem in the above the flow control must either know it's context in a do BLOCK always act

How to find sum of integers in a string using JavaScript

丶灬走出姿态 提交于 2020-02-26 04:25:47
问题 I created a function with a regular expression and then iterated over the array by adding the previous total to the next index in the array. My code isn't working. Is my logic off? Ignore the syntax function sumofArr(arr) { // here i create a function that has one argument called arr var total = 0; // I initialize a variable and set it equal to 0 var str = "12sf0as9d" // this is the string where I want to add only integers var patrn = \\D; // this is the regular expression that removes the

SSIS expression

只谈情不闲聊 提交于 2020-02-24 12:31:06
问题 Anybody have any idea why this SSIS expression is not working The derived column name is from_service_date_yyyymmdd The expression is (DT_STR,4,1252)from_service_date_yyyy + RIGHT("0" + (DT_STR,2,1252)from_service_date_mm,2) + RIGHT("0" + (DT_STR,2,1252)from_service_date_dd,2) from_service_date_yyyy , from_service_date_mm and from_service_date_dd all have valid values The output from the derived column transformation does not have from_service_date_yyyymmdd . I can't figure out why. 回答1: your

Identify text data in image to read mm/dd, description and amount using opencv python

送分小仙女□ 提交于 2020-02-24 11:15:07
问题 import re import cv2 import pytesseract from pytesseract import Output from PIL import Image from pytesseract import image_to_string img = cv2.imread('/home/cybermakarov/Desktop/1.Chase Bank-page-002.jpg') d = pytesseract.image_to_data(img, output_type=Output.DICT) keys = list(d.keys()) date_pattern = '^(0[1-9]|[12]|[1-9]|3[02])/' Description_pattern='([0-9]+\/[0-9]+)|([0-9]+)|([0-9\,\.]+)' n_boxes = len(d['text']) for i in range(n_boxes): if int(d['conf'][i]) > 60: if re.match(description