Search Results

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

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

  • Conditional execution of EventTriggers in Silverlight 3

    - by Jason
    I'm currently working on the UI of a Silverlight application and need to be able to change the visual state of a control to one of two possible states based on it's current state when handling the same event trigger. For example: I have a control that sits partially in a clipping path, when I click the visible part of the control I want to change the state to "visible" and if I click it again when it is in its "visible" state I want to change to the "hidden" state. Example XAML: <i:Interaction.Triggers> <i:EventTrigger EventName="MouseLeftButtonUp"> <ic:GoToStateAction StateName="Visible"/> <ic:GoToStateAction StateName="Hidden"/> </i:EventTrigger> </i:Interaction.Triggers> Where "i" is "System.Windows.Interactivity;assembly=System.Windows.Interactivity" and "ic" is "Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions". I'm currently working in Expression Blend 3 and would prefer to have a XAML only solution but am not opposed to coding this if it is completely necessary. I have tried recording a change in the target state name in Blend but this did not work. Any thoughts on this?

    Read the article

  • How are property assignment expressions handled in C#?

    - by Serious
    In C# you can use a property as both an lrvalue and rvalue at the same time like this : int n = N = 1; Here is a complete C# sample : class Test { static int n; static int N { get { System.Console.WriteLine("get"); return n; } set { System.Console.WriteLine("set"); n = value; } } static void Main() { int n = N = 1; System.Console.WriteLine("{0}/{1}", n, N); } } You can't do that in C++/CLI as the resulting type of the assignment expression "N = 1" is void. EDIT: here is a C++/CLI sample that shows this : ref class A { public: static property int N; }; int main() { int n = A::N = 1; System::Console::WriteLine("{0}/{1}", n, A::N); } So what's the magic behind C# syntax allowing a void-expression to be used as a rvalue ? Is this special treatment only available for properties or do you know other C# tricks like this ?

    Read the article

  • python conditional list creation from 2D lists

    - by dls
    Say I've got a list of lists. Say the inner list of three elements in size and looks like this: ['apple', 'fruit', 1.23] The outer list looks like this data = [['apple', 'fruit', 1.23], ['pear', 'fruit', 2.34], ['lettuce', 'vegetable', 3.45]] I want to iterate through the outer list and cull data for a temporary list only in the case that element 1 matches some keyword (aka: 'fruit'). So, if I'm matching fruit, I would end up with this: tempList = [('apple', 1.23), ('pear', 2.34)] This is one way to accomplish this: tempList = [] for i in data: if i[1] == 'fruit': tempList.append(i[0], i[2]) is there some 'Pythonic' way to do this in fewer lines?

    Read the article

  • Conditional skin file in ASP.Net Theme based off of browser

    - by Dan Appleyard
    Is there a way to use a skin file in a theme only when a certain browser is used? The theme stays the same, I just want skin A to apply when a certain browser is used, and skin B when another browser is used. I know I can have server-side code to check and then set the SkinId of the control to either or, but is there another, more global way? Thanks

    Read the article

  • Using regular expressions

    - by Tom
    What is wrong with this regexp? I need it to make $name to be letter-number only. Now it doens't seem to work at all. if (!preg_match("/^[A-Za-z0-9]$/",$name)) { $e[]="name must contain only letters or numbers"; }

    Read the article

  • How to implement conditional render in JS?

    - by mare
    Below is the JS (jQuery) code of autocomplete's result function. You can see there's some lines where I print out <li>s containing some data properties (that come in as a result of automcomplete's AJAX call). How could I rewrite this so that <li> would be conditionally rendered based on whether the property contains any value being either int or string (not empty string or whitespace) or something else that can be represented as string? $(".clients-dropdown").result(function (event, data, formatted) { if (data) { // set the hidden input that we need for Client entity rematerialize $(".client-id").val(data.client_id); if (data.ClientName && data.Address1 && data.postalcode && data.postname) { $(".client-address").html( "<li>" + data.ClientName + "</li>" + "<li>" + data.Address1 + "</li>" + "<li>" + data.postalcode + " " + data.postname + "</li>" ); $(".client-details").html( "<li>" + data.PrettyId + "</li>" + "<li>" + data.VatNo + "</li>" + "<li>" + data.Phone + "</li>" + "<li>" + data.Mobile + "</li>" + "<li>" + data.Email1 + "</li>" + "<li>" + data.Contact + "</li>" ); } } Also, for the AJAX call, should my server side action return null when there's a null for a property in the database or empty string?

    Read the article

  • List files with two dots in their names using java regular expressions

    - by Nivas
    I was trying to match files in a directory that had two dots in their name, something like theme.default.properties I thought the pattern .\\..\\.. should be the required pattern [. matches any character and \. matches a dot] but it matches both oneTwo.txt and theme.default.properties I tried the following: [resources/themes has two files oneTwo.txt and theme.default.properties] 1. public static void loadThemes() { File themeDirectory = new File("resources/themes"); if(themeDirectory.exists()) { File[] themeFiles = themeDirectory.listFiles(); for(File themeFile : themeFiles) { if(themeFile.getName().matches(".\\..\\..")); { System.out.println(themeFile.getName()); } } } } This prints nothing and the following File[] themeFiles = themeDirectory.listFiles(new FilenameFilter() { public boolean accept(File dir, String name) { return name.matches(".\\..\\.."); } }); for (File file : themeFiles) { System.out.println(file.getName()); } prints both oneTwo.txt theme.default.properties I am unable to find why these two give different results and which pattern I should be using to match two dots... Can someone help?

    Read the article

  • Writing a simple conditional statement in IRB

    - by Trip
    I am looking up all Organizations with the url "http://", and updating their attributes to "". My attempt: Organization(:all).select { |o| o.url = "http://" ? o.update_attribute("url","")} Which returns a compile error: SyntaxError: compile error (irb):2: syntax error, unexpected '}' from (irb):2 Any ideas?

    Read the article

  • C++ conditional compilation

    - by Shaown
    I have the following code snippet #ifdef DO_LOG #define log(p) record(p) #else #define log(p) #endif void record(char *data){ ..... ..... } Now if I call log("hello world") in my code and DO_LOG isn't defined, will the line be compiled, in other words will it eat up the memory for the string "hello world"? P.S. There are a lot of record calls in the program and it is memory sensitive, so is there any other way to conditionally compile so that it only depends on the #define DO_LOG? Thanks in advance.

    Read the article

  • Conditional Batch file renaming with mysql data

    - by Paul Stevens
    Hello, I wonder if anyone knows how could I rename multiple files, all of them originally named with same structure, and add some data extracted from a mysql DB according to specifics rules. For example I have 500 files named with this vars: ID NAME ADDRESS PHONE.wav = 1234567 PAULSIMON WESTDR122 9942213456.wav Now I need to rename files taking some data from the databases for each file, and append the data from a query appended to the filename. For example add the data resulting from a query Where some conditions match, and the data to build the query is taked from original file name, as ID or NAME. i other words, lets say that I want to build a query taking ID & NAME from file 1234567 PAULSIMON WESTDR123 9942213456.wav as WHERE statements to take another value as BirthDATE and add this to new filename, so final result should be: ID NAME ADDRESS PHONE BIRTHDATE.wav I will appreciate any help on this. I need this to be done on a LINUX server.

    Read the article

  • Regular expressions in c++ STL

    - by Radek Šimko
    Is there any native library in STL which is tested and works without any extra compiler options? I tried to use <regex>, but the compiler outputs this: In file included from /usr/include/c++/4.3/regex:40, from main.cpp:5: /usr/include/c++/4.3/c++0x_warning.h:36:2: error: #error This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options.

    Read the article

  • Use regular expressions with Glib

    - by Sébastien
    Hello, I would like to find all comment blocks(/*...*/) but the function g_regex_match_full always returns true. Here is the code : // Create the regex. start_block_comment_regex = g_regex_new("/\*.*\*/", G_REGEX_OPTIMIZE, 0, &regex_error); //Search the regex; if(TRUE == g_regex_match_full(start_block_comment_regex, current_line, -1, 0, 0, &match_info, &regex_error)) { }

    Read the article

  • Cron expressions: leading zeros ok?

    - by JimBurnell
    A quartz-scheduled process did not kick off last evening. The only thing that looks like it MIGHT be off is that, in one entry: 0 00 23 13,15 APR ? The "minutes" field is specified as a 2-digit 00 rather than a single-digit 0. I can't find any definitive cron documentation saying whether or not this would cause a problem. I can't test it again until the off-hours. Anyone know for sure if this could be a problem? if so, it's rather a silly one.

    Read the article

  • jquery reset conditional filter

    - by VictorS
    I have 2 dropdown lists on my webform and using jquery trying to filter/reset filter 2nd dropdown elements based on 1st dropdown selection. $(document).ready(function() { $('#dropdown1').change(function(e) { switch ($(this).val()) { case "4": //this removal works $('#dropdown2').filter(function() { return ($(this).val() == 16); }).remove(); break; ................. default: //how would I restore filter here? } } }); Removing part works, so it filters item with no problem, but I have difficulty restoring the filter on dropdown 2 if something else is chosen in dropdown 1. I was trying to use .hide() and .show() instead of .remove() but it doesn't seem to work on IE6 at least.

    Read the article

  • Conditional row count in linq to nhibernate doesn't work

    - by Lucasus
    I want to translate following simple sql query into Linq to NHibernate: SELECT NewsId ,sum(n.UserHits) as 'HitsNumber' ,sum(CASE WHEN n.UserHits > 0 THEN 1 ELSE 0 END) as 'VisitorsNumber' FROM UserNews n GROUP BY n.NewsId My simplified UserNews class: public class AktualnosciUzytkownik { public virtual int UserNewsId { get; set; } public virtual int UserHits { get; set; } public virtual User User { get; set; } // UserId key in db table public virtual News News { get; set; } // NewsId key in db table } I've written following linq query: var hitsPerNews = (from n in Session.Query<UserNews>() group n by n.News.NewsId into g select new { NewsId = g.Key, HitsNumber = g.Sum(x => x.UserHits), VisitorsNumber = g.Count(x => x.UserHits > 0) }).ToList(); But generated sql just ignores my x => x.UserHits > 0 statement and makes unnecessary 'left outer join': SELECT news1_.NewsId AS col_0_0_, CAST(SUM(news0_.UserHits) AS INT) AS col_1_0_, CAST(COUNT(*) AS INT) AS col_2_0_ FROM UserNews news0_ LEFT OUTER JOIN News news1_ ON news0_.NewsId=news1_.NewsId GROUP BY news1_.NewsId How Can I fix or workaround this issue? Maybe this can be done better with QueryOver syntax?

    Read the article

  • The shortest way to convert infix expressions to postfix (RPN) in C

    - by kuszi
    Original formulation is given here (you can try also your program for correctness) . Additional rules: 1. The program should read from standard input and write do standard output. 2. The program should return zero to the calling system/program. 3. The program should compile and run with gcc -O2 -lm -s -fomit-frame-pointer. The challenge has some history: the call for short implementations has been announced at the Polish programming contest blog in September 2009. After the contest, the shortest code was 81 chars long. Later on the second call has been made for even shorter code and after the year matix2267 published his solution in 78 bytes: main(c){read(0,&c,1)?c-41&&main(c-40&&(c%96<27||main(c),putchar(c))):exit(0);} Anyone to make it even shorter or prove this is impossible?

    Read the article

  • Conditional SELECT MySQL

    - by user188693
    Don't know if this is possible, but I'd like to select records based on the field value of recur_type, where the 'm' is the day of the week. If it's a weekly recurring event, I need to make sure this is a day it recurs on, otherwise, I want to return all days. however, I'm getting an empty result set: SELECT * FROM wp_fun_bec_events WHERE start_date <= '2009-10-12' AND ( end_date >= '2009-10-12' OR (recur_end > '0' AND recur_end >= '2009-10-12' ) ) AND ('m' IN ( CASE WHEN 'recur_type' = 'weekly' THEN recur_days ELSE 's/m/t/w/r/f/a' END ) ) ORDER BY start_date, start_time Any ideas??

    Read the article

  • Lambda expressions and nullable types

    - by Mathew
    I have two samples of code. One works and returns the correct result, one throws a null reference exception. What's the difference? I know there's some magic happening with capturing variables for the lambda expression but I don't understand what's going on behind the scenes here. int? x = null; bool isXNull = !x.HasValue; // this works var result = from p in data.Program where (isXNull) select p; return result.Tolist(); // this doesn't var result2 = from p in data.Program where (!x.HasValue) select p; return result2.ToList();

    Read the article

  • How to get only a filename (not full path) into $1, using the PERL, regular expressions

    - by Scott
    I want to keep only the filenames (not full paths) and add the filename to some bbcode. Here is the HTML to be converted: <a href=/path/to/full/image.jpg rel=prettyPhoto><img rel=prettyPhoto src=/path/to/thumb/image.jpg /></a> Notice I cannot have rel="foo" (no double quotes).. Here is what I have in PERL, to perform the conversion: s/\<a href=(.+?)\ rel=prettyPhoto\>\<img rel=prettyPhoto src=(.+?) \/>\<\/a\>/\[box\]$1\[\/box\]/gi; This converts the HTML to: [box]/path/to/image.jpg[/box] But this is what I want as a result: [box]image.jpg[/box] The HTML must remain the same. So how do I change my PERL so that $1 contains only the filename?

    Read the article

  • How to with extract url from tweet using Regular Expressions

    - by neutreno
    Ok so i'm executing the following line of code in javascript RegExp('(http:\/\/t.co\/)[a-zA-Z0-9\-\.]{8}').exec(tcont); where tcont is equal to some string like 'Test tweet to http://t.co/GXmaUyNL' (the content of a tweet obtained by jquery). However it is returning, in the case above for example, 'http://t.co/GXmaUyNL,http://t.co/'. This is frustracting because I want the url without the bit on the end - after and including the comma. Any ideas why this is appearing? Thanks

    Read the article

  • Need help with a Linq XML conditional grouping query

    - by FiveTools
    I have the following xml fragment: <BANNER ID="Banner 2" ROW_WIDTH="200"> <BANNER_TEXTS ID="BANNER_TEXTS"> <BANNER_TEXT UNDERLINE="false" SPAN_COL="1" WIDTHT="78px"></BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="3" WIDTHT="234px">Years In Practice</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="3" WIDTHT="234px">Internet Usage</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="4" WIDTHT="312px">Sales Reps Seen / Week</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="3" WIDTHT="234px">Prescription Volume</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="3" WIDTHT="222px">Patient Load</BANNER_TEXT> </BANNER_TEXTS> <BANNER_TEXTS ID="COLUMN_TEXTS"> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="78px">Total</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="78px">&#60; 11 years</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="78px">11-20 years</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="78px">21-30 years</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="78px">Light 1-5 hrs</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="78px">Medium 6-10 hrs</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="78px">Heavy &#62;10 hrs</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="78px">0</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="78px">1-2</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="78px">3-5</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="78px">&#62;5</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="78px">1-100</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="78px">101-150</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="78px">&#62;150</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="74px">1-100</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="74px">101-200</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="74px">&#62;200</BANNER_TEXT> </BANNER_TEXTS> <BANNER_TEXTS ID="COLUMN_TEXTS"> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(A)</COLUMN_TEXT> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(B)</COLUMN_TEXT> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(C)</COLUMN_TEXT> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(D)</COLUMN_TEXT> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(E)</COLUMN_TEXT> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(F)</COLUMN_TEXT> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(G)</COLUMN_TEXT> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(H)</COLUMN_TEXT> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(I)</COLUMN_TEXT> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(J)</COLUMN_TEXT> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(K)</COLUMN_TEXT> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(L)</COLUMN_TEXT> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(M)</COLUMN_TEXT> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(N)</COLUMN_TEXT> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(O)</COLUMN_TEXT> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(P)</COLUMN_TEXT> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(Q)</COLUMN_TEXT> </BANNER_TEXTS> </BANNER> I would like to group all the 'BANNER_TEXT' in the second sequence using the first sequence 'BANNER_TEXT' as the key (only include elements where string is not null or empty). The span_col attribute in the first 'BANNER_TEXT' sequence indicates which elements by position in the 2nd sequence are related. An example: 'Years in Practice' would be the first key and the attribute SPAN_COL=3 for that element indicates it would contain '< 11 years', '11-20 years', '21-30 years' (the first grouping of string.empty = Total would be skipped).

    Read the article

  • HowTo: Conditional Page Break in SSRS 2010 ?

    - by SwissCoder
    Hi there I just migrated a project from .NET 3.5 to 4.0, accordingly the reports now use SSRS included in .net 4.0/VS2010. Before conditionally setting a rectangles visibility did the trick for me. (inside the rectangle I put a rectangle with a pagebreak) But this stopped working now.. any help appreciated

    Read the article

  • JavaScript Regular expressions, match and replace link

    - by Thoman
    Hello please help me <html> <body> http://domainname.com/abc/xyz.zip http://domainname2.com/abc/xyz.zip </body> </html> I want replace with link and out put like <html> <body> <a href="http://domainname.com/abc/xyz.zip">http://domainname.com/abc/xyz.zip</a> <a href="http://domainname2.com/abc/xyz.zip">http://domainname2.com/abc/xyz.zip</a> </body> </html> Great Thank

    Read the article

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