Search Results

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

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

  • Databinding expression for retrieving value of related collection using LINQ

    - by joshb
    I have a GridView that is bound to a LINQDataSource control that is returning a collection of customers. Within my DataGrid I need to display the home phone number of a customer, if they have one. The phone numbers of a customer are stored in a separate table with a foreign key pointing to the customer table. The following binding expression gets me the first phone number for a customer: <asp:TemplateField HeaderText="LastName" SortExpression="LastName"> <ItemTemplate> <asp:Label ID="PhoneLabel" runat="server" Text='<%# Eval("Phones[0].PhoneNumber") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> I need to figure out how to get the home phone number specifically (filter based on phone type) and handle the scenario where the customer does not have a home phone in the database. Right now it's throwing an out of range exception if the customer does not have any phone numbers. I've tried using the Where operator with a lambda expression to filter the phone type but it doesn't work: <%# Eval("Phones.Where(p => p.PhoneTypeId == 2).PhoneNumber") %> Solutions or links to any good articles on the subject would be much appreciated.

    Read the article

  • Create lambda action from function expression

    - by Martin Robins
    It is relatively easy to create a lambda function that will return the value of a property from an object, even including deep properties... Func<Category, string> getCategoryName = new Func<Category, string>(c => c.Name); and this can be called as follows... string categoryName = getCategoryName(this.category); But, given only the resulting function above (or the expression originally used to create the function), can anybody provide an easy way to create the opposing action... Action<Category, string> setCategoryName = new Action<Category, string>((c, s) => c.Name = s); ...that will enable the same property value to be set as follows? setCategoryName(this.category, ""); Note that I am looking for a way to create the action programatically from the function or expression - I hope that I have shown that I already know how to create it manually. I am open to answers that work in both .net 3.5 and 4.0. Thanks.

    Read the article

  • C++ variable to const expression

    - by user1344784
    template <typename Real> class A{ }; template <typename Real> class B{ }; //... a few dozen more similar template classes class Computer{ public slots: void setFrom(int from){ from_ = from; } void setTo(int to){ to_ = to; } private: template <int F, int T> void compute(){ using boost::fusion::vector; using boost::fusion::at_c; vector<A<float>, B<float>, ...> v; at_c<from_>(v).operator()(at_c<to_>(v)); //error; needs to be const-expression. }; This question isn't about Qt, but there is a line of Qt code in my example. The setFrom() and setTo() are functions that are called based on user selection via the GUI widget. The root of my problem is that 'from' and 'to' are variables. In my compute member function I need to pick a type (A, B, etc.) based on the values of 'from' and 'to'. The only way I know how to do what I need to do is to use switch statements, but that's extremely tedious in my case and I would like to avoid. Is there anyway to convert the error line to a constant-expression?

    Read the article

  • MTD Expression on a single column - SSRS

    - by Eric
    I need a bit of help here. I have been unable to create an 'Month To Date' expression to a single column on SSRS. I tested the following expression from a similar question in the forum, but it gives me a squiggly line below the variable 'd' =IIF(Fields!CreateDate.Value >= DateAdd(d,-7,Today()), Sum(Fields!Sales.Value), 0) If I run it, of course I got an error telling me that 'd' is not declared. ;) I changed it to ... DateAdd("d",-7,Today()), Sum(Fields!Sales.Value) ... following the example and the squiggly goes below the brackets of "today()" and needless to say it...but still not working. I tried a Dateadd(mm..Datediff ... and still nothing. My report has the following columns: Country | CustomerName | Sales | InvNotProcessed | Open Order | Orders | TotalbyCust What I need is to show the new MTD sales only in the column named "Sales" while the other three shows the rest of the query, which should be open as some orders may take quite a while to manufacture and invoice. the last column sums the totals of all other columns. Any help will be much appreciated. Regards, Eric

    Read the article

  • LINQ Expression - Dynamic From & Where Clause

    - by chillydk147
    I have the following list of integers that I need to extract varying lists of integers containing numbers from say 2-4 numbers in count. The code below will extract lists with only 2 numbers. var numList = new List<int> { 5, 20, 1, 7, 19, 3, 15, 60, 3, 21, 57, 9 }; var selectedNums = (from n1 in numList from n2 in numList where (n1 > 10) && (n2 > 10) select new { n1, n2 }).ToList(); Is there any way to build up this Linq expression dynamically so that if I wanted lists of 3 numbers it would be compiled as below, this would save me having to package the similar expression inside a different method. var selectedNums = (from n1 in numList from n2 in numList from n3 in numList where (n1 > 10) && (n2 > 10) && (n3 > 10) select new { n1, n2, n3 }).ToList();

    Read the article

  • Silverlight: Why doesn't this binding expression work?

    - by Rosarch
    I'm having difficulty with a binding expression in Silverlight 3 for the Windows Phone 7. <Grid x:Name="LayoutRoot" Background="Transparent"> <controls:Pivot ItemsSource="{Binding SectionViewModels}"> <!-- ... --> <controls:Pivot.ItemTemplate> <DataTemplate> <Grid> <!-- this is the troublesome binding --> <TextBlock Style="{StaticResource disabledText}" Visibility="{Binding ElementName=LayoutRoot, Path=DataContext.NoStoryContent}"> Do you have a network connection? </TextBlock> <!-- ... --> The style, in app.xaml: <Style x:Key="disabledText" TargetType="TextBlock"> <Setter Property="Foreground" Value="{StaticResource PhoneDisabledBrush}" /> <Setter Property="TextWrapping" Value="Wrap" /> <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeLarge}" /> </Style> Code behind: public Visibility NoStoryContent { get { // trivial return value for debugging // no breakpoint here is hit return Visibility.Collapsed; } } public Sections() { InitializeComponent(); LayoutRoot.DataContext = this; } What am I doing wrong here? I suspect I have a mistake in the binding expression, but I'm not sure where.

    Read the article

  • error: switch quantity not an integer

    - by nikeunltd
    I have researched my issue all over StackOverflow and multi-google links, and I am still confused. I figured the best thing for me is ask... Im creating a simple command line calculator. Here is my code so far: const std::string Calculator::SIN("sin"); const std::string Calculator::COS("cos"); const std::string Calculator::TAN("tan"); const std::string Calculator::LOG( "log" ); const std::string Calculator::LOG10( "log10" ); void Calculator::set_command( std::string cmd ) { for(unsigned i = 0; i < cmd.length(); i++) { cmd[i] = tolower(cmd[i]); } command = cmd; } bool Calculator::is_legal_command() const { switch(command) { case TAN: case SIN: case COS: case LOG: case LOG10: return true; break; default: return false; break; } } the error i get is: Calculator.cpp: In member function 'bool Calculator::is_trig_command() const': Calculator.cpp: error: switch quantity not an integer Calculator.cpp: error: 'Calculator::TAN' cannot appear in a constant-expression Calculator.cpp: error: 'Calculator::SIN' cannot appear in a constant-expression Calculator.cpp: error: 'Calculator::COS' cannot appear in a constant-expression The mighty internet, it says strings are allowed to be used in switch statements. Thanks everyone, I appreciate your help.

    Read the article

  • 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

  • Latex font for special expression

    - by Claus
    Hi I wanna highlight some special terms throughout my thesis. I do not wanna use tt{} or emph{} or bold to do that but some special font. Can here somebody suggest me common pratice how to do that? Many thanks, Claus

    Read the article

  • Reg Expression htaccess RewriteRule

    - by Rick
    I am new to using regular expressions for rewriting URL's in htaccess I need to redirect mysite.com/123 to mysite.com/, IF cookie named 'ref' is set. my current htaccess is: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_COOKIE} ref=true [NC] RewriteRule ^/([0-9]+)/$ http://www.mysite.com </IfModule> The goal is that when someone enters site with: mysite.com/111(some number) that they are redirected to the home page of the site after the cookie is set. Be nice... I'm new! ;o)

    Read the article

  • Exclude regular expression from virtual host

    - by Joao Trindade
    I have a virtual host in apache which is redirecting requests to another web server. <VirtualHost *:80> DocumentRoot /var/www ServerName another.host ProxyPass / http://another.host2:8081/ ProxyPassReverse / http://another.host2:8081/ </VirtualHost> I need to exclude an URL pattern from being catch by this virtual host. Basically I don't want requests with the url: http://another.host:8081/~username to be forwarded to the other server. Can this be done?

    Read the article

  • Quick Replace in Visual Studio 2010 fails to use Tagged Expression n

    - by slomojo
    I'm trying to do some basic regex Quick Replace operations in Visual Studio 2010, but when I use regex grouping I don't get Tagged Expressions (ie. \1 \2 etc.) returning their values, instead they are blank. For example: Text int a = int.Parse("10"); int b = int.Parse("20"); int c = int.Parse("30"); Search Pattern (regex enabled) int\.Parse\("([0-9]*)"\); Replace \1; Replaced Text int a = ; int b = ; int c = ;

    Read the article

  • Excel Matching problem with logic expression

    - by abelenky
    I have a block of data that represents the steps in a process and the possible errors: ProcessStep Status FeesPaid OK FormRecvd OK RoleAssigned OK CheckedIn Not Checked In. ReadyToStart Not Ready for Start I want to find the first Status that is not "OK". I have attempted this: =Match("<>""OK""", StatusRange, 0) which is supposed to return the index of the first element in the range that is NOT-EQUAL (<) to "OK" But this doesn't work, instead returning #N/A. I expect it to return 4 (index #4, in a 1-based index, representing that CheckedIn is the first non-OK element) Any ideas how to do this?

    Read the article

  • Regular expression in mySQL [migrated]

    - by Rayne
    I have a mysql table that has 2 columns - Column 1 contains a string value, and Column 2 contains the number of times that string value occurred. I'm trying to find the string abc.X.def, where the beginning of the string is "abc.", followed by one or more characters, then the string ".def". There could be more characters following ".def". How can I find such strings, then add the occurrence of such strings and display the results? For example, if I have abc.111.def23 1 abc.111.def 2 abc.22.def444 1 abc.111.def 1 Then I will get abc.111.def23 1 abc.111.def 3 abc.22.def444 1 Thank you.

    Read the article

  • How do I use Sketchflow sample data for a ListBoxItem Template at design time?

    - by Boris Nikolaevich
    I am using Expression Blend 4 and Visual Studio 2010 to create a Sketchflow prototype. I have a Sample Data collection and a ListBox that is bound to it. This displays as I would expect both at design time and at run time. However, the ListBoxItem template it just complex enough that I wanted to pull it out into its own XAML file. Even though the items still render as expected in the main ListBox where the template is used, when I open the template itself, all of the databound controls are empty. If I add a DataContext to the template, I can see and work with the populated objects while in the template, but then that local DataContext overrides the DataContext set on the listbox. A bit of code will illustrate. Start by creating a Sketchflow project (I am using Silverlight, but it should work the same for WPF), then add a project data source called SampleDataSource. Add a collection called ListData, with a single String property called Title. Here is the (scaled down) code for the main Sketchflow screen, which we'll call Main.xaml: <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:DemoScreens" mc:Ignorable="d" x:Class="DemoScreens.Main" Width="800" Height="600"> <UserControl.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="ProjectDataSources.xaml"/> </ResourceDictionary.MergedDictionaries> <DataTemplate x:Key="ListBoxItemTemplate"> <local:DemoListBoxItemTemplate d:IsPrototypingComposition="True" Margin="0,0,5,0" Width="748"/> </DataTemplate> </ResourceDictionary> </UserControl.Resources> <Grid x:Name="LayoutRoot" Background="#5c87b2" DataContext="{Binding Source={StaticResource SampleDataSource}}"> <ListBox Background="White" x:Name="DemoList" Style="{StaticResource ListBox-Sketch}" Margin="20,100,20,20" ItemTemplate="{StaticResource ListBoxItemTemplate}" ItemsSource="{Binding ListData}" ScrollViewer.HorizontalScrollBarVisibility="Disabled"/> </Grid> </UserControl> You can see that it references the DemoListBoxItemTemplate, which is defined in its own DemoListBoxItemTemplate.xaml: <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:DemoScreens" mc:Ignorable="d" x:Class="DemoScreens.DemoListBoxItemTemplate"> <Grid x:Name="LayoutRoot"> <TextBlock Text="{Binding Title}" Style="{StaticResource BasicTextBlock-Sketch}" Width="150"/> </Grid> </UserControl> Obviously, this is way simpler than my actual listbox, but it should be enough to illustrate my problem. When you open Main.xaml in the Expression designer, the list box is populated with sample data. But when you open DemoListBoxItemTemplate.xaml, there is no data context and therefore no data to display—which makes it more difficult to identify controls visually. How can I have sample data displayed when I am working with the template, while still allowing the larger set of sample data to be used for the ListBox itself?

    Read the article

  • Application Screen Repainting Issues

    - by Jeff Sheldon
    I have this issue lately at work. It drives be nuts, and I finally stopped to ask this question. It's quite often that an application I've been running just randomly fails to repaint itself for a while, usually in the editor screen. I most often see this occurring with Expression Web, Visual Studio 2008/2010 and SQL Server Management studio. These applications are what I work in the most, so I'm not surprised to mostly see it here. But I was curious if anyone else had a solution for this. I've tried: Reboots. The screen shot below is about 10 minutes after a reboot. New Video Drivers. This machine is running a Nvidia Quadro NVS 290 video card with the latest drivers. Closing other applications, this is the only thing running right now. As far as hardware, this machine has Dual Quad-Core Xeon 2.83ghz Processors, with 10 gigs of memory, running Windows XP SP3 64bit. Any help would be great. JNK EDIT: Per comments from deleted (wrong) answer: I'm running dual monitors. Set it to single display, still occurred. Rebooted, and tried it again, and it still occurred. Switched it back to dual screen. My resolution is only 1400x900 on each.

    Read the article

  • Microsoft sort une RC de Silverlight 4 pour les développeurs, et une Bêta de Expression Blend 4

    Microsoft sort une RC de Silverlight 4 Pour les développeurs, et une Bêta de Expression Blend 4 Microsoft vient d'annoncer une version RC (Release Candidate) de sa technologie web Silverlight 4. Elle est la suite logique de la version bêta, qui elle avait été diffusée lors de la Professional Developers Conference en novembre denier. Silverlight 4 RC permet notamment la prise en charge d'outils de développement tels que Visual Studio et Expression Blend avec la technologie Sketchflow. Dans le même temps, le MIX10 qui se déroule actuellement à Las Vegas a également permis à Microsoft de dévoiler la Bêta de Expression Blend 4, l'outil de conception d'interfaces ...

    Read the article

  • Complex(?) regex: Is expression, but not another

    - by Kieron
    (If you can make a better title, please do) Hi, I need to make sure a string matches the following regex: ^[0-9a-zA-Z]{1}[0-9a-zA-Z\.\-_]*$ (Starts with a letter or number, then any number of letters, numbers, dots, dashes or underscores) But given that, I need to make sure it doesn't match a Guid, my Guid matching reg-ex looks like this (obviously, this needs to be negated in the merged result): ^([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}$ The last requirement here is that they must (if it's possible) be merged into a single expression.

    Read the article

  • How is this Quartz Cron Expression executed

    - by n002213f
    I have a the following; private String cronExpression = ""; private final String jobID = "MyJObID"; ... Scheduler scheduler = ServiceLocator.getInstance().getScheduler(); CronTrigger trigger = new CronTrigger(jobID , Scheduler.DEFAULT_GROUP, cronExpression); JobDetail jobDetail = new JobDetail(jobID , Scheduler.DEFAULT_GROUP, MyJob.class); scheduler.scheduleJob(jobDetail, trigger); My question is when is this job triggered for the empty cron expression?

    Read the article

  • Regular expression replace a word by a link

    - by AnhTu
    I want to write a regular expression that will replace the word Paris by a link, for only the word is not ready a part of a link. Example: i'm living <a href="Paris" atl="Paris link">in Paris</a>, near Paris <a href="gare">Gare du Nord</a>, i love Paris. would become i'm living.........near <a href="">Paris</a>..........i love <a href="">Paris</a>.

    Read the article

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