Search Results

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

Page 65/205 | < Previous Page | 61 62 63 64 65 66 67 68 69 70 71 72  | Next Page >

  • In XSLT is it possible to use the value of an xpath expression in a call to a template using an par

    - by Cell
    I am performing an xsl transform and in it I call a template with a param using the following code <xsl:call-template name="GenerateColumns"> <xsl:with-param name="curRow" select="$curRow"/> <xsl:with-param name="curCol" select="$curCol + 1"/> </xsl:call-template> This calls a template function which outputs part of a table element in HTML. The curRow and curCol are used to determine which row and column we are in the table. gbl_maxCols is set to the number of columns in an html table <xsl:template name="GenerateColumns"> <xsl:when test="$curCol &lt;= $gbl_maxCols"> <td> <xsl:attribute="colspan"> <xsl:value-of select="/page/column/@skipColumns"/> </xsl:attribute> </xsl:when> </xsl:template> The result of this function is a set of td elements, however some of these elements (those with a skipColumn attribute greater than 1 span more than 1 column, I need to skip this many columns with the next call to generateColumns. this works just like I would expect in the case where I simply increment the curCol param but I have a case where I need to use the value from the xml attribute skipColumns in the math to calculate the value for curCol. In the above case I iterate through all the columns and this works for the majority of my use cases. However in same cases I need to skip over some of the columns and need to pass in that value from the xml attribute to calculate how many columns I need to skip. My naive first attempt was something like this <xsl:call-template name="GenerateColumns"> <xsl:with-param name="curRow" select="$curRow"/> <xsl:with-param name="curCol" select="$curCol + /page/column/@skipColumns"/> </xsl:call-template> But unforutnately this does not seem to work. Is there any way to use an attribute from an xml page in the calculation for the value of a param in xsl. My xml page is something like this (edited heavily since the xml file is rather large) <page> <column name="blank" skipColumns="1"/> <column name="blank" skipColumns="1"/> <column name="test" skipColumns="3"/> <column name="blank" skipColumns="1"/> <column name="test2" skipColumns="6"/> </page> after all of this I would like to have a set of td elements like the following <td></td><td></td><td colSpan="3"></td><td></td><td colSpan="6"></td> if I just iterate through the columns I instead end up with something like this which gives me more td elements than I should have <td></td><td></td><td colSpan="3"></td><td></td><td colSpan="6"></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td> Edited to provide more information

    Read the article

  • How to test a lamda expression var query result is null?

    - by mike
    var query = from emp in dbEmp.Employees join dept in dbEmp.Departments on emp.DeptID equals dept.DeptID where dept.DepartmentName.Contains(this.TextBox1.Text) select new { EmpID = emp.EmpID, EmpName = emp.EmpName, Age = emp.Age, Address = emp.Address, DeptName = dept.DepartmentName }; if (query==null) Label1.Text = "no results match your search"; GridView1.DataSource = query; GridView1.DataBind(); Everything works in the right way, but the label doesn't show the message when query result returns null. The label can show without condition(querry==null). So how to test if a var query result returns nothing? Thanks

    Read the article

  • Trying to insert a row using stored procedured with a parameter binded to an expression.

    - by Arvind Singh
    Environment: asp.net 3.5 (C# and VB) , Ms-sql server 2005 express Tables Table:tableUser ID (primary key) username Table:userSchedule ID (primary key) thecreator (foreign key = tableUser.ID) other fields I have created a procedure that accepts a parameter username and gets the userid and inserts a row in Table:userSchedule Problem: Using stored procedure with datalist control to only fetch data from the database by passing the current username using statement below works fine protected void SqlDataSourceGetUserID_Selecting(object sender, SqlDataSourceSelectingEventArgs e) { e.Command.Parameters["@CurrentUserName"].Value = Context.User.Identity.Name; } But while inserting using DetailsView it shows error Procedure or function OASNewSchedule has too many arguments specified. I did use protected void SqlDataSourceCreateNewSchedule_Selecting(object sender, SqlDataSourceSelectingEventArgs e) { e.Command.Parameters["@CreatedBy"].Value = Context.User.Identity.Name; } DetailsView properties: autogen fields: off, default mode: insert, it shows all the fields that may not be expected by the procedure like ID (primary key) not required in procedure and CreatedBy (user id ) field . So I tried removing the 2 fields from detailsview and shows error Cannot insert the value NULL into column 'CreatedBy', table 'D:\OAS\OAS\APP_DATA\ASPNETDB.MDF.dbo.OASTest'; column does not allow nulls. INSERT fails. The statement has been terminated. For some reason parameters value is not being set. Can anybody bother to understand this and help?

    Read the article

  • Regular expression for finding non-breaking string names in code and then breaking them up for SQL q

    - by Rob Segal
    I am trying to devlop a regex for finding camel case strings in several code files I am working with so I can break them up into separate words for use in a SQL query. I have strings of the form... EmailAddress FirstName MyNameIs And I want them like this... Email Address First Name My Name Is An example SQL query which I currently have is... select FirstName, MyNameIs from MyTables I need the queries in the form... select FirstName as 'First Name', MyNameIs as 'My Name Is' from MyTables Any time a new capital letter appears that should be a new grouping which I can pick out of the matched string. I currently have the following regex... ([A-Z][a-z]+)+ Which does match the cases I have shown above but when I want to perform a replace I need to define groups. Currently I have tried... (([A-Z])([a-z]+))+ Which sort of works. It will pick out "Address" as the first grouping from "EmailAddress" as opposed to "Email" which is what I was expecting. No doubt there is something I'm misunderstanding here so any help is greatly appreciated.

    Read the article

  • Craft a JSONpath expression so that it retrieves only a specific value?

    - by Alex
    Hello, I have some JSON of which the following is a small sample: results": { "div": [ { "class": "sylEntry", "id": "sylOne", "div": [ { "class": "sT", "id": "sOT", "p": "Mon 11/17, Computer work time" }, { "class": "des", "id": "dOne", "p": "All classes Siebel 0218" } ] }, I would like to only retrieve the "p" content for the div element with class "sT". I would like to use a loop and doing something like this: var arrayOfResults = $.results..div.p does not work because I only want to retrieve the p value for the div element with class "sT". So how do I construct my JSONpath so that it will retrive the array of p elements that are contained within the divs class "sT". Thanks!!

    Read the article

  • Is it possible to include a Sexpr before the expression has been evaluated in Sweave / R ?

    - by PaulHurleyuk
    Hello, I'm writing a Sweave document, and I want to include a small section that details the R and package versions, platofrms and how long ti took to evalute the doucment, however, I want to put this in the middle of the document ! I was using a \Sexpr{elapsed} to do this (which didn't work), but thought if I put the code printing elapsed in a chunk that evaluates at the end, I could then include the chunk half way through, which also fails. My document looks something like this % \documentclass[a4paper]{article} \usepackage[OT1]{fontenc} \usepackage{longtable} \usepackage{geometry} \usepackage{Sweave} \geometry{left=1.25in, right=1.25in, top=1in, bottom=1in} \begin{document} <<label=start, echo=FALSE, include=FALSE>>= startt<-proc.time()[3] @ Text and Sweave Code in here % This document was created on \today, with \Sexpr{print(version$version.string)} running on a \Sexpr{print(version$platform)} platform. It took approx sec to process. <<>>= <<elapsed>> @ More text and Sweave code in here <<label=bye, include=FALSE, echo=FALSE>>= odbcCloseAll() endt<-proc.time()[3] elapsedtime<-as.numeric(endt-startt) @ <<label=elapsed, include=FALSE, echo=FALSE>>= print(elapsedtime) @ \end{document} But this doesn't seem to work (amazingly !) Does anyone know how I could do this ? Thanks Paul.

    Read the article

  • Is it a solvable problem to generate a regular expression that matches some input set?

    - by Roman
    I provide some input set which contains known separated number of text blocks. I want to make a program that automatically generate 1 or more regular expressions each of which matches every text block in the input set. I see some relatively easy ways to implement a brute-force search. But I'm not an expert in compilers theory. That's why I'm curious: 1) is this problem solvable? or there are some principle impossibility to make such algorithm? 2) is it possible to achieve polynomial complexity for this algorithm and avoid brute forcing?

    Read the article

  • Why does my Perl regular expression only find the last occurrence?

    - by scharan
    I have the following input to a Perl script and I wish to get the first occurrence of NAME="..." strings in each of the <table>...</table> structures. The entire file is read into a single string and the regex acts on that input. However, the regex always returns the last occurrence of NAME="..." strings. Can anyone explain what is going on and how this can be fixed? Input file: ADSDF <TABLE> NAME="ORDERSAA" line1 line2 NAME="ORDERSA" line3 NAME="ORDERSAB" </TABLE> <TABLE> line1 line2 NAME="ORDERSB" line3 </TABLE> <TABLE> line1 line2 NAME="ORDERSC" line3 </TABLE> <TABLE> line1 line2 NAME="ORDERSD" line3 line3 line3 </TABLE> <TABLE> line1 line2 NAME="QUOTES2" line3 NAME="QUOTES3" NAME="QUOTES4" line3 NAME="QUOTES5" line3 </TABLE> <TABLE> line1 line2 NAME="QUOTES6" NAME="QUOTES7" NAME="QUOTES8" NAME="QUOTES9" line3 line3 </TABLE> <TABLE> NAME="MyName IsKhan" </TABLE> Perl Code starts here: use warnings; use strict; my $nameRegExp = '(<table>((NAME="(.+)")|(.*|\n))*</table>)'; sub extractNames($$){ my ($ifh, $ofh) = @_; my $fullFile; read ($ifh, $fullFile, 1024);#Hardcoded to read just 1024 bytes. while( $fullFile =~ m#$nameRegExp#gi){ print "found: ".$4."\n"; } } sub main(){ if( ($#ARGV + 1 )!= 1){ die("Usage: extractNames infile\n"); } my $infileName = $ARGV[0]; my $outfileName = $ARGV[1]; open my $inFile, "<$infileName" or die("Could not open log file $infileName"); my $outFile; #open my $outFile, ">$outfileName" or die("Could not open log file $outfileName"); extractNames( $inFile, $outFile ); close( $inFile ); #close( $outFile ); } #call main();

    Read the article

  • How do you validate a URL with a regular expression in Python?

    - by Zachary Spencer
    I'm building a Google App Engine app, and I have a class to represent an RSS Feed. I have a method called setUrl which is part of the feed class. It accepts a url as an input. I'm trying to use the re python module to validate off of the RFC 3986 Reg-ex (http://www.ietf.org/rfc/rfc3986.txt) Below is a snipped which should work, right? I'm incredibly new to Python and have been beating my head against this for the past 3 days. p = re.compile('^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?') m = p.match(url) if m: self.url = url return url

    Read the article

  • C# regular expression for finding forms with input tags in HTML?

    - by johnrl
    Hi all. I have a simple problem: I want to construct a regex that matches a form in HTML, but only if the form has any input tags. Example: The following should be matched (ignoring attributes): .. <form> .. <input/> .. </form> .. But the following should not (ignoring attributes): .. <form> .. </form> .. I have tried everything from look-arounds to capture groups but it quickly gets complicated. I want to believe there is a simple regex to capture the problem. Please note that it is important that the regex pairs the opening and closing tags according to the HTML code which means the following does not work: <form>.+<input/>.+</form> because it matches wrongly like this: .. <form> <--- This is wrongly matched as the opening tag .. </form> <form> <-- This is the correct opening tag of the correct form .. <input/> .. </form> <--- This is matched as the closing tag ..

    Read the article

  • C# How do I replace an actual asterisk character (*) in a Regex expression?

    - by fraXis
    Hello, I have a statement: I have a string such as content = "* test *" I want to search and replace it with so when I am done the string contains this: content = "(*) test (*)" My code is: content = Regex.Replace(content, "*", "(*)"); But this causes an error in C# because it thinks that the * is part of the Regular Expressions Syntax. How can I modify this code so it changes all asterisks in my string to (*) instead without causing a runtime error? Thanks.

    Read the article

  • What RegEx should I use to return parameter names wrapped within brackets in an expression?

    - by burak ozdogan
    Hi, I have a set of expressions representing some formula with some parameters inside. Like: "[parameter1] * [parameter2] * [multiplier]" and many others like this. I want to use a regEx so that I can get a list of strings (List<string> ) which will have [paramter1] [paramter2] [multiplier] inside. I am not using regular expressions so often; if you have already used something like this I would appreciate if you can share. Thanks!

    Read the article

  • How do I get around this lambda expression outer variable issue?

    - by panamack
    I'm playing with PropertyDescriptor and ICustomTypeDescriptor (still) trying to bind a WPF DataGrid to an object, for which the data is stored in a Dictionary. Since if you pass WPF DataGrid a list of Dictionary objects it will auto generate columns based on the public properties of a dictionary (Comparer, Count, Keys and Values) my Person subclasses Dictionary and implements ICustomTypeDescriptor. ICustomTypeDescriptor defines a GetProperties method which returns a PropertyDescriptorCollection. PropertyDescriptor is abstract so you have to subclass it, I figured I'd have a constructor that took Func and an Action parameters that delegate the getting and setting of the values in the dictionary. I then create a PersonPropertyDescriptor for each Key in the dictionary like this: foreach (string s in this.Keys) { var descriptor = new PersonPropertyDescriptor( s, new Func<object>(() => { return this[s]; }), new Action<object>(o => { this[s] = o; })); propList.Add(descriptor); } The problem is that each property get's its own Func and Action but they all share the outer variable s so although the DataGrid autogenerates columns for "ID","FirstName","LastName", "Age", "Gender" they all get and set against "Gender" which is the final resting value of s in the foreach loop. How can I ensure that each delegate uses the desired dictionary Key, i.e. the value of s at the time the Func/Action is instantiated? Much obliged. Here's the rest of my idea, I'm just experimenting here these are not 'real' classes... // DataGrid binds to a People instance public class People : List<Person> { public People() { this.Add(new Person()); } } public class Person : Dictionary<string, object>, ICustomTypeDescriptor { private static PropertyDescriptorCollection descriptors; public Person() { this["ID"] = "201203"; this["FirstName"] = "Bud"; this["LastName"] = "Tree"; this["Age"] = 99; this["Gender"] = "M"; } //... other ICustomTypeDescriptor members... public PropertyDescriptorCollection GetProperties() { if (descriptors == null) { var propList = new List<PropertyDescriptor>(); foreach (string s in this.Keys) { var descriptor = new PersonPropertyDescriptor( s, new Func<object>(() => { return this[s]; }), new Action<object>(o => { this[s] = o; })); propList.Add(descriptor); } descriptors = new PropertyDescriptorCollection(propList.ToArray()); } return descriptors; } //... other other ICustomTypeDescriptor members... } public class PersonPropertyDescriptor : PropertyDescriptor { private Func<object> getFunc; private Action<object> setAction; public PersonPropertyDescriptor(string name, Func<object> getFunc, Action<object> setAction) : base(name, null) { this.getFunc = getFunc; this.setAction = setAction; } // other ... PropertyDescriptor members... public override object GetValue(object component) { return getFunc(); } public override void SetValue(object component, object value) { setAction(value); } }

    Read the article

< Previous Page | 61 62 63 64 65 66 67 68 69 70 71 72  | Next Page >