Search Results

Search found 2819 results on 113 pages for 'conditional expressions'.

Page 22/113 | < Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >

  • SQL conditional row insert

    - by Pablo
    Is it possible to insert a new row if a condition is meet? For example, i have this table with no primary key nor uniqueness +----------+--------+ | image_id | tag_id | +----------+--------+ | 39 | 8 | | 8 | 39 | | 5 | 11 | +----------+--------+ I would like to insert a row if a combination of image_id and tag_id doesn't exists for example; INSERT ..... WHERE image_id!=39 AND tag_id!=8

    Read the article

  • Regular Expressions in PHP

    - by kelly
    Sorry for unclear description, my English is not good. My problem is that I want to decode a string, and this string has nested content delimited by {}. For example: The string: {any string0{any string 00{any string 000....}}}{any string1}any string. The result I want to get: array[0] = {any string0{any string 00{any string 000....}}} array[1] = {any string1} I hope it's clear enough.

    Read the article

  • Confused with conditional and logical operators - VB.net

    - by AgentRev
    I'm kind of new to VB.net, and since I just finished a C# course, the lack of parentheses creates a lot of confusion on how to write certain combinations of operators. The C# equivalent of the line I am trying to reproduce in VB would be like this : if ( (a == 0 && b != null) || (a == 1 && c != null) ) I'm have no idea how to write this in VB, I've tried many combinations of And, Or, AndAlso, OrElse, etc. but I can't achieve the desired result. I can't find any clear example of C# v.s. VB.net comparison on operators, and the notes I have aren't helpful either. Can someone help me figure this out?

    Read the article

  • Initializing PHP class property declarations with simple expressions yields syntax error

    - by user171929
    According to the PHP docs, one can initialize properties in classes with the following restriction: "This declaration may include an initialization, but this initialization must be a constant value--that is, it must be able to be evaluated at compile time and must not depend on run-time information in order to be evaluated." I'm trying to initialize an array and having some issues. While this works fine: public $var = array( 1 => 4, 2 => 5, ); This creates a syntax error: public $var = array( 1 => 4, 2 => (4+1), ); Even this isn't accepted: public $var = 4+1; which suggests it's not a limitation of the array() language construct. Now, the last time I checked, "4+1" equated to a constant value that not only should be accepted, but should in fact be optimized away. In any case, it's certainly able to be evaluated at compile-time. So what's going on here? Is the limitation really along the lines of "cannot be any calculated expression at all", versus any expression "able to be evaluated at compile time"? The use of "evaluated" in the doc's language suggests that simple calculations are permitted, but alas.... If this is a bug in PHP, does anyone have a bug ID? I tried to find one but didn't have any luck.

    Read the article

  • SQL conditional Pivot

    - by Coov
    Yes, this is another Pivot question... I've read through nearly all the previous questions and I can't seem to hack together a query that does what I need. Here is what my table looks like: FirmName Account Balance Pmt Revolving Installment Mortgage Amex 12345 10000 2000 1 0 0 Discover 54321 20000 4000 1 0 0 Chase 13579 100000 1500 0 0 1 Wells Fargo 2468 40000 900 0 1 0 The last three bit columns (Revolving, Installment, & Mortgage) dictate how the columns should be rolled up into a type. Each result requires three columns based on the type and its row count. The outcome should be one row with many columns. Here is what the result should look like: Revolving1_Firm Revolving1_Balance Revolving1_Pmt Revolving2_Firm Revolving2_Balance Revolving2_Pmt Realestate1_Firm Realestate1_Balance Realestate1_Pmt Vehicle1_Firm Vehicle1_Balance Vehicle1_Pmt Amex 10000 2000 Discover 20000 4000 Chase 100000 1500 Wells Fargo 40000 900 How do you pivot based on the bit fields (Revolving, Installment, & Mortgage) and retain the proper count so that that each column gets count # appended to it?

    Read the article

  • How to allow user to set expressions detrmining property value in PropertyGrid

    - by savras
    I noticed that programs like Report Builder allow user to set property value or an expression determining property value. I want to the add same functionality to my application. So is there any simple way to do so or do i have to redefine all type converters so that they allow to set expression in addition to their original functionality. http://img204.imageshack.us/img204/7934/48707358.jpg

    Read the article

  • Best practice with respect to NPE and multiple expressions on single line

    - by JRL
    I'm wondering if it is an accepted practice or not to avoid multiple calls on the same line with respect to possible NPEs, and if so in what circumstances. For example: getThis().doThat(); vs Object o = getThis(); o.doThat(); The latter is more verbose, but if there is an NPE, you immediately know what is null. However, it also requires creating a name for the variable and more import statements. So my questions around this are: Is this problem something worth designing around? Is it better to go for the first or second possibility? Is the creation of a variable name something that would have an effect performance-wise? Is there a proposal to change the exception message to be able to determine what object is null in future versions of Java ?

    Read the article

  • Conditional column values in NSTableView?

    - by velocityb0y
    I have an NSTableView that binds via an NSArrayController to an NSMutableArray. What's in the array are derived classes; the first few columns of the table are bound to properties that exist on the base class. That all works fine. Where I'm running into problem is a column that should only be populated if the row maps to one specific subclass. The property that column is meant to display only exists in that subclass, since it makes no sense in terms of the base class. The user will know, from the first two columns, why the third column's cell is populated/editable or not. The binding on the third column's value is on arrangedObjects, with a model path of something like "foo.name" where foo is the property on the subclass. However, this doesn't work, as the other subclasses in the hierarchy are not key-value compliant for foo. It seems like my only choice is to have foo be a property on the base class so everybody responds to it, but this clutters up the interfaces of the model objects. Has anyone come up with a clean design for this situation? It can't be uncommon (I'm a relative newcomer to Cocoa and I'm just learning the ins and outs of bindings.)

    Read the article

  • Conditional row coloring in a PocketPyGUI table (PythonCE)

    - by PabloG
    I'm working on a an PythonCE application, using the PocketPyGUI toolkit. I'm using the gui.Table control to display a large list of choices (addresses, codes and data associated), and I want to assign a different color to the rows that have been completed. Is there any way to colorize the rows given certain conditions? TIA, Pablo

    Read the article

  • SQL Server Conditional Mailing Address Formatting

    - by Rob Packwood
    I have the following SQL to format a US address into each line for a mailing address but it is rather ugly. Is there a better way to solve this problem or does it have to be this ugly? declare @NL varchar(2); set @NL = char(13) + char(10); select case when rtrim(coalesce(AttentionLine,'') ) != '' then rtrim(AttentionLine ) + @NL else '' end + case when rtrim(coalesce(Recipient,'') ) != '' then rtrim(Recipient ) + @NL else '' end + case when rtrim(coalesce(AddlAddrLine,'') ) != '' then rtrim(AddlAddrLine ) + @NL else '' end + case when rtrim(coalesce(DeliveryAddr,'') ) != '' then rtrim(DeliveryAddr ) + @NL else '' end + case when rtrim(coalesce(LastLine,'') ) != '' then rtrim(LastLine ) + @NL else '' end + case when rtrim(coalesce(Country,'') ) != '' then rtrim(Country ) + @NL else '' end as FormattedMailingAddress from Address where Id = 1

    Read the article

  • Regular expressions and matching URLs with metacharacters

    - by James P.
    I'm having trouble finding a regular expression that matches the following String. Korben;http://feeds.feedburner.com/KorbensBlog-UpgradeYourMind?format=xml;1 One problem is escaping the question mark. Java's pattern matcher doesn't seem to accept \? as a valid escape sequence but it also fails to work with the tester at myregexp.com. Here's what I have so far: ([a-zA-Z0-9])+;http://([a-zA-Z0-9./-]+);[0-9]+ Any suggestions? Edit: The original intent was to match all URLs that could be found after the first semi colon.

    Read the article

  • converting a treebank of vertical trees to s-expressions

    - by Andreas
    I need to preprocess a treebank corpus of sentences with parse trees. The input format is a vertical representation of trees, like so: S =NP ==(DT +def) the == (N +ani) man =VP ==V walks ...and I need it like: (S (NP (DT the) (N man)) (VP (V walks))) I have code that almost does it, but not quite. There's always a missing paren somewhere. Should I use a proper parser, maybe a CFG? The current code is at http://github.com/andreasvc/eodop/blob/master/arbobanko.py The code also contains real examples from the treebank.

    Read the article

  • #include in C# (conditional compilation)

    - by HeavyWave
    Is it possible in C# to set such a condition that if the condition is true - compile one file;If condition is false - compile another file? Sort of like #ifdef DEBUG #include Class1.cs #else #include Class2.cs #endif Or possibly set it up in project properties.

    Read the article

  • Complicated conditional SQL query

    - by DevAno1
    I'm not even sure if it's possible but I need it for my Access database. So I have following db structure : Now I need to perform a query that takes category_id from my product and do the magic : - let's say product belongs to console (category_id is in table Console) - from console_types take type_id, where category_id == category_id - but if product belongs to console_game (category_id is in table console_game) - from console_game take game_cat_id, where category_id == category_id I'm not sure if mysql is capable of such thing. If not I'm really f&%ranked up. Maybe there is a way to split this into 2,3 separate queries ?

    Read the article

  • SQL Query with conditional JOIN

    - by mariki
    The scenario: Table1 CatId|Name|Description Table2 ItId|Title|Date|CatId (foreign key) I want to return all rows from Table1 and Title,Date from Table2, where The returned from Table 2 must be the Latest one by the date column. (in second table there many items with same CatId and I need just the latest) I have 2 queries but can't merge them together: Query 1: SELECT Table1.Name, Table1.Description, Table2.Title, Table2.Date FROM Table1 LEFT JOIN Table2 ON Table1.CatId=Table2.CatId Query2: SELECT TOP 1 Table2.Title, Table2.Date FROM Table2 WHERE Table2.CatId = @inputParam ORDER BY Table2.Date DESC

    Read the article

  • Need some sort of "conditional grouping" in MySQL.

    - by serg555
    I have Article table: id | type | date ----------------------- 1 | A | 2010-01-01 2 | A | 2010-01-01 3 | B | 2010-01-01 Field type can be A, B or C. I need to run a report that would return how many articles of each type there is per every day, like this: date | count(type="A") | count(type="B") | count(type="C") ----------------------------------------------------- 2010-01-01 | 2 | 1 | 0 2010-01-02 | 5 | 6 | 7 Currently I am running 3 queries for every type and then manually merging the results select date, count(id) from article where type="A" group by date Is it possible to do this in one query? (in pure sql, no stored procedures or anything like that). Thanks

    Read the article

  • Pro/con: Initializing a variable in a conditional statement

    - by steffenj
    In C++ you can initialize a variable in an if statement, like so: if (CThing* pThing = GetThing()) { } Why would one consider this bad or good style? What are the benefits and disadvantages? Personally i like this style because it limits the scope of the pThing variable, so it can never be used accidentally when it is NULL. However, i don't like that you can't do this: if (CThing* pThing = GetThing() && pThing->IsReallySomeThing()) { } If there's a way to make the above work, please post. But if that's just not possible, i'd still like to know why. Question borrowed from here, similar topic but PHP.

    Read the article

  • Are there any libraries for parsing "number expressions" like 1,2-9,33- in Java

    - by mihi
    Hi, I don't think it is hard, just tedious to write: Some small free (as in beer) library where I can put in a String like 1,2-9,33- and it can tell me whether a given number matches that expression. Just like most programs have in their print range dialogs. Special functions for matching odd or even numbers only, or matching every number that is 2 mod 5 (or something like that) would be nice, but not needed. The only operation I have to perform on this list is whether the range contains a given (nonnegative) integer value; more operations like max/min value (if they exist) or an iterator would be nice, of course. What would be needed that it does not occupy lots of RAM if anyone enters 1-10000000 but the only number I will ever query is 12345 :-) (To implement it, I would parse a list into several (min/max/value/mod) pairs, like 1,10,0,1 for 1-10 or 11,33,1,2 for 1-33odd, or 12,62,2,10 for 12-62/10 (i. e. 12, 22, 32, ..., 62) and then check each number for all the intervals. Open intervals by using Integer.MaxValue etc. If there are no libs, any ideas to do it better/more efficient?)

    Read the article

  • Conditional Regex Replace in C# without MatchEvaluator

    - by Buttink
    So, Im trying to make a program to rename some files. For the most part, I want them to look like this, [Testing]StupidName - 2[720p].mkv But, I would like to be able to change the format, if so desired. If I use MatchEvaluators, you would have to recompile every time. Thats why I don't want to use the MatchEvaluator. The problem I have is that I don't know how, or if its possible, to tell Replace that if a group was found, include this string. The only syntax for this I have ever seen was something like (?<group>:data), but I can't get this to work. Well if anyone has an idea, im all for it.

    Read the article

  • TextMate: Conditional formatting?

    - by Nebs
    I want to be able to color lines differently based on the starting character. eg.: - This is line 1 - This is line 2 x This is line 3 - This is line 4 x This is line 5 So lines 1,2,4 (starting with '-') should be blue while lines 3,5 (starting with 'x') should be red. Is this possible? How would you do it? Thanks.

    Read the article

  • How can I convert Perl regular expressions to boost regular expressions?

    - by YY
    I'm not familiar with Perl and boost regular expression and I want to convert a Perl code to c++. I want to convert special regular expression in Perl into c++ using Boost regexp library. Please help me understand what I must do? Here is some regexps that a word of a sentence may match: if ($word =~ /^[\.:\,()\'\`-]/) { # hack for punctuation } if ($word =~ /^[A-Z]/) { return; } if ($word =~ /[A-Za-z0-9]+\-[A-Za-z0-9]+/) { # all hyphenated words return; } if ($word =~ /.*[0-9].*/) { # all numbers return; }

    Read the article

< Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >