Search Results

Search found 5101 results on 205 pages for 'expression trees'.

Page 155/205 | < Previous Page | 151 152 153 154 155 156 157 158 159 160 161 162  | Next Page >

  • UPDATE from SELECT complains about more that one value returned

    - by Álvaro G. Vicario
    I have this data structure: request ======= building_id lot_code building ======== building_id lot_id lot === lot_id lot_code The request table is missing the value for the building_id column and I want to fill it in from the other tables. So I've tried this: UPDATE request SET building_id = ( SELECT bu.building_id FROM building bu INNER JOIN lot lo ON bu.lot_id=lo.lot_id WHERE lo.lot_code = request.lot_code ); But I'm getting this error: Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , , = or when the subquery is used as an expression. Is it due to wrong syntax? The data model allows more than one building per lot but actual data doesn't contain such cases so there should be at most one building_id per lot_code.

    Read the article

  • Grouping string by comma between brackets

    - by Myra
    Response to : http://stackoverflow.com/questions/1454913/regular-expression-to-find-a-string-included-between-two-characters-while-exclud Hi,I'm looking for a regex pattern that applies to my string including brackets: [1,2,3,4,5] [abc,ef,g] [0,2,4b,y7] could be anything including word,digit,non-word together or separated. I wish to get the group between brackets by \[(.*?)\] but what is the regex pattern that will give me the group between brackets and sub-group strings separated by commas so that the result may be following ?? Group1 : [1,2,3,4,5] Group1: 1 Group2: 2 Group3: 3 Group4: 4 Group5: 5 Group2 : [abc,ef,g] Group1: abc Group2: ef Group3: g etc .. Thank you for your help

    Read the article

  • "set -e" in shell and command substitution

    - by ivant
    In shell scripts set -e is often used to make them more robust by stopping the script when some of the commands executed from the script exits with non-zero exit code. It's usually easy to specify that you don't care about some of the commands succeeding by adding || true at the end. The problem appears when you actually care about the return value, but don't want the script to stop on non-zero return code, for example: output=$(possibly-failing-command) if [ 0 == $? -a -n "$output" ]; then ... else ... fi Here we want to both check the exit code (thus we can't use || true inside of command substitution expression) and get the output. However, if the command in command substitution fails, the whole script stops due to set -e. Is there a clean way to prevent the script from stopping here without unsetting -e and setting it back afterwards?

    Read the article

  • Intellisense in Visual Studio 2010

    - by Erik
    For some reason the Intellisense in vb.net stopped working when I use an Aggregate Lambda expression inside a With statement. With Me.SalesPackage .WebLinks = Sales.Where(Function(f) f.Current.BookerWeb > 0).Count .WebAmount = Aggregate o In Sales.Where(Function(f) f.Current.WebBooker > 0) Into Sum(o.Current.WebPrice) End With If I insert a new line between .WebLinks and .WebAmount and start typing, it works. But it won't work if I do it after the Aggregate statement... Any ideas?

    Read the article

  • Anonymous functions in C#

    - by Maxim Gershkovich
    The following syntax is valid VB.NET code Dim myCollection As New List(Of Stock) myCollection.Add(New Stock(Guid.NewGuid, "Item1")) myCollection.Add(New Stock(Guid.NewGuid, "Item2")) Dim res As List(Of Stock) = myCollection.FindAll(Function(stock As Stock) As Boolean If stock.Description = "Item2" Then Return True End If Return False End Function) How can I accomplish the same thing in C#? I have tried... myCollection.FindAll(bool delegate(Stock stock) { if (blah blah) { } }); But it appears I have somehow structured it incorrectly as I get the following error. "Error 1 Invalid expression term 'bool'"

    Read the article

  • Javascript .match plus jQuery keyup(), double match and strange behaviour

    - by Gremo
    Not really good in regular expression, but why when a match is found console.log fires two times? $('#name').keyup(function() { var regex = /[\€]/g; var count = (m = $(this).val().match(regex)) ? m.length : 0; // Num matches console.log(count); }); Output with 'hello': 0 0 0 0 0 After adding '€' symbol to 'hello' we have: 0 0 0 0 0 1 1 After adding 'h' symbol to 'hello€' we have: 0 0 0 0 0 1 1 1 Shouldn't be just one 1 after adding '€' to 'hello'?

    Read the article

  • jquery disable rule validation on a single field

    - by shake
    I am using mvc to create forms that are generated at runtime. For validation, I am trying my hand at the jquery validation library which is very convenient to use. I have the validation expression of each field in the cdata attribute of the tag <input type="text" name="xyz" id="xyz" class="defaultTextBox" cdata="{validate:{required:true, decimal:true, messages: {required:'Please enter an decimal value', decimal:'Please enter a valid decimal'}}}"> This works beautifully. Now one more requirement I have is that some fields are being shown and hidden according to the logic on the page and I need to disable the validation on the hidden fields such that they do not interfere with the form submission. Just toggling the required:true to false and back to true should be enough. Only i do not know how. Anyone has any experience with that?

    Read the article

  • Does lookaround affect which languages can be matched by regular expressions?

    - by sepp2k
    There are some features in modern regex engines which allow you to match languages that couldn't be matched without that feature. For example the following regex using back references matches the language of all strings that consist of a word that repeats itself: (.+)\1. This language is not regular and can't be matched by a regex, which does not use back references. My question: Does lookaround also affect which languages can be matched by a regular expression? I.e. are there any languages that can be matched using lookaround, which couldn't be matched otherwise? If so, is this true for all flavors of lookaround (negative or positive lookahead or lookbehind) or just for some of them?

    Read the article

  • trying to prune down a list of files

    - by romunov
    I have a list of files and I'm trying to extract all layer1_*.grd files. Is there a way of doing this in one grep expression? lof <- c("layer1_1.grd", "layer1_1.gri", "layer1_2.grd", "layer1_2.gri", "layer1_3.grd", "layer1_3.gri", "layer1_4.grd", "layer1_4.gri", "layer1_5.grd", "layer1_5.gri", "layer2_1.grd", "layer2_1.gri", "layer2_2.grd", "layer2_2.gri", "layer2_3.grd", "layer2_3.gri", "layer2_4.grd", "layer2_4.gri", "layer2_5.grd", "layer2_5.gri", "layer3_1.grd", "layer3_1.gri", "layer3_2.grd", "layer3_2.gri", "layer3_3.grd", "layer3_3.gri", "layer3_4.grd", "layer3_4.gri", "layer3_5.grd", "layer3_5.gri", "layer4_1.grd", "layer4_1.gri", "layer4_2.grd", "layer4_2.gri", "layer4_3.grd", "layer4_3.gri", "layer4_4.grd", "layer4_4.gri", "layer4_5.grd", "layer4_5.gri" I tried doing this in two steps: list.of.files <- list.files(pattern = c("1_")) list.of.files <- list.of.files[grep(".grd", list.of.files)] Can someone enlighten me how to do this with grep in one step? I naively tried passing list() and c() to the grep but, as you can imagine, it doesn't work. list.of.files <- list.files() list.of.files <- list.of.files[grep(list("1_", ".grd"), list.of.files)]

    Read the article

  • Generating dynamic C# based on textual data into the runtime?

    - by WeNeedAnswers
    Is there a quick and easy way to load textual C# into a program. I would like to load the LINQ from the database as an Expression and run it against some data (SQL or Array/List don't mind). I know I can do it using the C# CodeDom/ExpressionTree builder with Assembly Loading and Creating AppDomains, but this seems very long winded. Is there an easier way. I thought with the advent of .net 3.5 that the ExpressionTree would come to my aid, but I now realise that I have to write a parser to use this. Maybe there is a new trick in 4.0? Something along the lines of a dynamic languages Parse would be great. Any suggestions greatly appreciated.

    Read the article

  • Fluent NHibernate beginner problem: How to convert single column data to custom class?

    - by Stefan Ahlm
    I am very new to Fluent NHibernate and I have a problem that I cant find the answer to. I have a string column in my database table, containing a mathematical expression i.e: "10 + 15 * 5". On my entity I have a property that I call Formula and this returns a class that contains the mathematical "formula" (not as a string). I beleive this post http://intellect.dk/post/Implementing-custom-types-in-nHibernate.aspx explains how to solve it for NHibernate. But I am not sure... How do I get this working with Fluent NHibernate?

    Read the article

  • NHibernate: discriminator without common base class?

    - by joniba
    Is it possible to map two classes to the same property without them sharing a common base class? For example, a situation like this: class Rule { public virtual int SequenceNumber { get; set; } public virtual ICondition Condition { get; set; } } interface ICondition { } class ExpressionCondition : ICondition { public virtual string Expression { get; set; } } class ThresholdCondition : ICondition { public virtual int Threshold { get; set; } } I also cannot add some empty abstract class that both conditions inherit from because the two ICondition implementations exist in different domains that are not allowed to reference each other. (Please no responses telling me that this situation should not occur in the first place - I'm aware of it and it doesn't help me.)

    Read the article

  • Use matching value of a RegExp to name the output file.

    - by fx42
    I have this file "file.txt" which I want to split into many smaller ones. Each line of the file has an id field which looks like "id:1" for a line belonging to id 1. For each id in the file, I like to create a file named idid.txt and put all lines that belong to this id in that file. My brute force bash script solution reads as follows. count=1 while [ $count -lt 19945 ] do cat file.txt | grep "id:$count " >> ./sets/id$count.txt count='expr $count + 1' done Now this is very inefficient as I have do read through the file about 20.000 times. Is there a way to do the same operation with only one pass through the file? - What I'm probably asking for is a way to use the value that matches for a regular expression to name the associated output file.

    Read the article

  • How do I wrap this BAIL macro in Xcode?

    - by willc2
    I use this little snippet to halt my iPhone app in the simulator. NSAssert((0), @"Bail early while testing"); When I try to make it a #defined macro like this: #define BAILNOW (NSAssert((0), @"Bail early while testing")) I get this build error: error: expected expression before 'do' It seems to be related to the nesting of the NSAssert() macro but I'm at a loss as to how to get around it. Should I dig into the NSAssertionHandler docs or is there some simpler way to halt the app in it's tracks? Or should I just set a breakpoint and get on with my life?

    Read the article

  • Pass property to access using .NET

    - by BitFiddler
    I'm fairly sure this is possible, but what I want to do is have a generic method where I can pass in an object along with a Expression that will tell the method which Property to use in it's logic. Can anyone get me started on the syntax for something like this? Essentially what I would like to code is something like: Dim firstNameMapper as IColumnMapper = new ColumnMapper(of Author)(Function(x) x.FirstName) Dim someAuthorObject as new Author() fistNameMapper.Map("Richard", someAuthorObject) Now the mapper object would know to set the FirstName property to "Richard". Now using a Function here won't work, I know this... I'm just trying to give an idea what I'm trying to work towards. Thanks for any help!

    Read the article

  • C# ToDictionary can valueSelector give null?

    - by Trimack
    Hi, I want to make a dictionary out of list in a way, that the list becomes keys and values would be empty. I have following code Dictionary<XmlTest, int?> testBattery = new XmlTests().GetRandomTestBattery(id). ToDictionary(k => k, v => null); But I am getting the error "Cannot convert lambda expression to type System.Collections.Generic.IEqualityComparer' because it is not a delegate type" Any ideas how could I fix it? (I know I could iterate through and fill the dict one element at a time, but I simply want to use something more elegant)

    Read the article

  • PHP Regex Question

    - by oyerli
    Hi, I am developing an application using PHP but I am new to regular expressions, I could not find a solution to my problem. I want to replace all occurences of #word with a link, i have written a preg_match for this: $text=preg_replace('~#([\p{L}|\p{N}]+)~u', '<a href="/?aranan=$1">#$1</a>', $text); The problem is, this regular expression also matches the html character codes like &#039; and gives corrupt output. I need to exclude the words starting with &# but i do not know how to do that using regular expressions. Thanks for your help.

    Read the article

  • How to make RegexKitLite w/ iPhone SDK produce a list of all matches +/- and also return surrounding

    - by Matt
    I'd like to create a regular expression that will match and return based on the following criteria: 1) I have N search terms entered by a user 2) I have a body of text. 3) I want to return a list of all the occurrences of all the search terms entered by the user plus surrounding context. I think (\w+\W+){,4}(", ")(\W+\w+){,4} might work. 4) I don't know how to use RegexKitLite at all. Do I invoke a RegexKitLite class? or does it interface into NSString somehow?

    Read the article

  • Why size_t arguments in template declaration need to be const?

    - by ArunSaha
    I can have std::bitset< 10 > bitsetA; or const size_t LengthB = 20; std::bitset< LengthB > bitsetB; without any problem. But, if the length is not const size_t LengthC = 30; std::bitset< LengthC > bitsetC; // Line 30, say I face the following compilation error 'LengthC' cannot appear in a constant-expression template argument 1 is invalid What is the reason for that? What would be the problem, for compiler and for user code, if line 30 was to be accepted? Is it because LengthC might have some alias?

    Read the article

  • simple putStrLn in Haskell/Yampa with arrows syntax

    - by sisif
    i'm using Haskell with the Yampa FRP library which uses the arrows language extension. how can i do a simple putStrLn in a SF? mySF = proc x -> do y <- identity -< x*x putStrLn "Hello World!" ++ show y returnA -< y the arrow syntax complains about the expression not bein an arrow (of course), but even with arrows i get no output output <- identity -< putStrLn "Hello World!"

    Read the article

  • ASP.Net mysterious behaviour

    - by kalan
    Does anyone have any idea why this works (expression in the if-clause) if (!(childNode.Roles != null && !Helper.HasEqualElements((string[])childNode.Roles, System.Web.Security.Roles.GetRolesForUser()))) AddNode(childNode, parentNode); And this doesn't if (childNode.Roles == null || Helper.HasEqualElements((string[])childNode.Roles, System.Web.Security.Roles.GetRolesForUser())) AddNode(childNode, parentNode); The problem is that the second if-clause sometimes doesn't work. Though it always works in debug mode, but it sometimes fails while running. And the strange thing is that these two pieces of code seems absolutely equal for me.

    Read the article

  • scanf() (C Language ) confused me

    - by Nano HE
    Hello. When do I need to insert/don't insert & for scanf() in C? Thank you. int main() { char s1[81], s2[81], s3[81]; scanf("%s%s%s", s1, s2, s3); // If replace scanf() with the expression below, it works too. // scanf("%s%s%s", &s1, &s2, &s3); printf("\ns1 = %s\ns2 = %s\ns3 = %s", s1, s2, s3); return 0; } //programming is fun // //s1 = programming //s2 = is //s3 = fun

    Read the article

  • Django: query spanning multiple many-to-many relationships

    - by Brant
    I've got some models set up like this: class AppGroup(models.Model): users = models.ManyToManyField(User) class Notification(models.Model): groups_to_notify = models.ManyToManyField(AppGroup) The User objects come from django's authentication system. Now, I am trying to get all the notifications pertaining to the groups that the current user is a part of. I have tried.. notifications = Notification.objects.filter(groups_to_notify=AppGroup.objects.filter(users=request.user)) But that gives an error: more than one row returned by a subquery used as an expression Which I suppose is because the groups_to_notify is checking against several groups. How can I grab all the notifications meant for the user based on the groups he is a part of?

    Read the article

  • How to deal with the new line character in the Silverlight TextBox

    - by Ian Oakes
    When using a multi-line TextBox (AcceptsReturn="True") in Silverlight, line feeds are recorded as \r rather than \r\n. This is causing problems when the data is persisted and later exported to another format to be read by a Windows application. I was thinking of using a regular expression to replace any single \r characters with a \r\n, but I suck at regex's and couldn't get it to work. Because there may be a mixture of line endings just blindy replacing all \r with \r\n doesn't cut it. So two questions really... If regex is the way to go what's the correct pattern? Is there a way to get Silverlight to respect it's own Environment.NewLine character in TextBox's and have it insert \r\n rather just a single \r?

    Read the article

  • display image on a report based on two date

    - by Yongwei Xing
    Hi all I am using sql server 2005 reporting service to generate report base on a database. There are two columns which are datetime type ColumnA and ColumnB. The report would display a KPI image on this report by comparing these two columns.Below is the expression for selecting image SWITCH(DateDiff("d",Fields!ColumnA.Value,Fields!ColumnB.Value)<0,"kpi_r", DateDiff("d",Fields!ColumnA.Value,Fields!ColumnB.Value)>0,"kpi_g", DateDiff("d",Fields!ColumnA.Value,Fields!ColumnB.Value)=0,"kpi_y") For most of the records, the image is correct. Only for one record, the result is very strange. For this record ColumnA=2010-04-23 08:00:00 ColumnB=2010-04-22 17:00:00 It would display kpi_r, it displayed kpi_y. I have checked the value of DateDiff(d,Fields!ColumnA.Value,Fields!ColumnB.Value) in the SSMS, the value is -1. Why does it display kpi_y? Does anyone meet this problem before? Best Regards,

    Read the article

< Previous Page | 151 152 153 154 155 156 157 158 159 160 161 162  | Next Page >