Search Results

Search found 2155 results on 87 pages for 'mathematical expressions'.

Page 57/87 | < Previous Page | 53 54 55 56 57 58 59 60 61 62 63 64  | Next Page >

  • how to prevent white spaces in a regular expression regex validation

    - by Rees
    i am completely new to regular expressions and am trying to create a regular expression in flex for a validation. using a regular expression, i am going to validate that the user input does NOT contain any white-space and consists of only characters and digits... starting with digit. so far i have: expression="[A-Za-z][A-Za-z0-9]*" this correctly checks for user input to start with a character followed by a possible digit, but this does not check if there is white space...(in my tests if user input has a space this input will pass through validation - this is not desired) can someone tell me how i can modify this expression to ensure that user input with whitespace is flagged as invalid?

    Read the article

  • Javascript regex only matching entire url as typing

    - by dt
    I'm trying to use javascript to find all URLs in a textarea as the person is typing (onkeyup). The problem that I'm having is in finding a regex to match the entire URL, I need it only to match all the URL's in the text area that are complete URLs. All of the existing regex expressions that I find through Google and through my own experiementing seem to match as soon as the user has typed the first part of the pattern. So, for example, if I'm typing and then start to type http://w, all of a sudden, it will match. I need to find a regex that will match and return an array of all the urls that are in the textarea, while also not matching unless the person has completed typing the full URL. Hopefully that makes sense! Thank you!

    Read the article

  • Expression Tree

    - by nettguy
    My understanding of expression tree is : Expression trees are in-memory representation of expression like arithmetic or boolean expression.The expressions are stored into the parsed tree.so we can easily transalate into any other language. Linq to SQL uses expression tree.Normally in LINQ to SQL query the compiler translates it into parsed expression trees.These are passed to Sql Server as T-SQL Statements.The Sql server executes the T-SQL query and sends down the result back.That is why when you execute LINQ to SQL you gets IQueryable<T> not IEnumetrable<T>.Because IQuerybale contains public IQueryable:IEnumerable { Type Element {get;} Expression Expression {get;} IQueryaleProvider Provider {get;} } Questions : Microsoft uses Expression trees to play with LINQ-to-Sql.What are the different ways can i use expression trees to boost my code. Apart from LINQ to SQL,Linq to amazon ,who used expression trees in their applications? Linq to Object return IEnumerable,Linq to SQL return IQueryable ,What does LINQ to XML return?

    Read the article

  • Object tree navigation language in Java

    - by lewap
    In the system which I'm currently developing I often have to navigate an object tree and based on its state and values take actions. In normal Java this results in tedious for loops, if statements etc... Are there alternative ways to achieve tree navigation, similar to XPath for XML? I know there is JXPath and OGNL, but do you know any other libraries for such purpose? Do you know any libraries which generate bytecodes for specific tree navigation expressions to make the processing as fast as Java native fors and ifs?

    Read the article

  • Scala: Can I nudge a combinator parser to be locally greedy?

    - by eed3si9n
    Suppose I have an ambiguous language expressed in combinator parser. Is there a way to make certain expressions locally greedy? Here's an example of what I mean. import scala.util.parsing.combinator._ object Example extends JavaTokenParsers { def obj: Parser[Any] = (shortchain | longchain) ~ anyrep def longchain: Parser[Any] = zero~zero~one~one def shortchain: Parser[Any] = zero~zero def anyrep: Parser[Any] = rep(any) def any: Parser[Any] = zero | one def zero: Parser[Any] = "0" def one: Parser[Any] = "1" def main(args: Array[String]) { println(parseAll(obj, args(0) )) } } After compiling, I can run it as follows: $ scala Example 001111 [1.7] parsed: ((0~0)~List(1, 1, 1, 1)) I would like to somehow instruct the first part of obj to be locally greedy and match with longchain. If I switch the order around, it matches the longchain, but that's not because of the greediness. def obj: Parser[Any] = (longchain | shortchain) ~ anyrep

    Read the article

  • How to convert a PCRE to a POSIX RE?

    - by David M
    This interesting question http://stackoverflow.com/questions/2837267/ concerned how to do a negative look-ahead in MySQL. The poster wanted to get the effect of Kansas(?! State) because MySQL doesn't implement look-ahead assertions, a number of answers came up the equivalent Kansas($|[^ ]| ($|[^S])| S($|[^t])| St($|[^a])| Sta($|[^t])| Stat($|[^e])) The poster pointed out that's a PITA to do for potentially lots of expressions. Is there a script/utility/mode of PCRE (or some other package) that will convert a PCRE (if possible) to an equivalent regex that doesn't use Perl's snazzy features? I'm fully aware that some Perl-style regexes cannot be stated as an ordinary regex, so I would not expect the tool to do the impossible, of course!

    Read the article

  • SSRS: Report label position dynamic

    - by Nauman
    I have a report which displays customer address in multiple labels. My customers use windowed envelopes for mailing. I need the address labels position to be configurable. Something like, I'll have a database table which stores the Top/Left position of each label per customer. Based on this table, I need to position the address labels on my report. I thought, it is doable by expressions, but Location property doesn't provides ability to set an expression and make the label's top and left dynamic. Anybody, any ideas, on how to achieve this?

    Read the article

  • Prevent SQL injection from form-generated SQL.

    - by Markos Fragkakis
    Hi all, I have a search table where user will be able to filter results with a filter of the type: Field [Name], Value [John], Remove Rule Field [Surname], Value [Blake], Remove Rule Field [Has Children], Value [Yes], Remove Rule Add Rule So the user will be able to set an arbitrary set of filters, which will result essentially in a completely dynamic WHERE clause. In the future I will also have to implement more complicated logical expressions, like Where (name=John OR name=Nick) AND (surname=Blake OR surname=Bourne), Of all 10 fields the user may or may not filter by, I don't know how many and which filters the user will set. So, I cannot use a prepared statement (which assumes that at least we know the fields in the WHERE clause). This is why prepared statements are unfortunately out of the question, I have to do it with plain old, generated SQL. What measures can I take to protect the application from SQL Injection (REGEX-wise or any other way)?

    Read the article

  • How do I replace custom "tags" in a string?

    - by Fake Code Monkey Rashid
    Given the following: $foo = "Yo [user Cobb] I heard you like dreams so I put a dream in yo dream in yo dream so you can dream while you dream while you dream." I'd like to do this: $foo = bar($foo); echo $foo; And get something like this: Yo Cobb I heard you like dreams so I put a dream in yo dream in yo dream so you can dream while you dream while you dream. I'm unsure of how the bar function should work. I think this is doable with regular expressions but I personally find those hard to understand. Using the strpos function is another method but I wonder if there is a better solution. Pseudocode is fine but actual code will be appreciated.

    Read the article

  • Not-quite-JSON string deserialization in Python

    - by cpharmston
    I get the following text as a string from an XML-based REST API 'd':4 'ca':5 'sen':1 'diann':2,6,8 'feinstein':3,7,9 that I'm looking to deserialize into a pretty little Python dictionary: { 'd': [4], 'ca': [5], 'sen': [1], 'diann': [2, 6, 8], 'feinstein': [3, 7, 9] } I'm hoping to avoid using regular expressions or heavy string manipulation, as this format isn't documented and may change. The best I've been able to come up with: members = {} for m in elem.text.split(' '): m = m.split(':') members[m[0].replace("'", '')] = map(int, m[1].split(',')) return members Obviously a terrible approach, but it works, and that's better than anything else I've got right now. Any suggestions on better approaches?

    Read the article

  • remove multiple training slashes mod_rewrite

    - by Boyan
    I know this question was asked a number of times on this site alone, but browsing through the relevant posts I couldn't find a solution. Trying to remove multiple trailing slashes after domain. The following mod_rewrite expressions seem to work for URLs such as http://www.domain.com//path1///path2////, but do not work for domain// DirectorySlash Off RewriteEngine on # Canonical fix RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC] RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301] RewriteRule ^/main.do http://www.domain.com/ [R=301,L] RewriteRule ^/index.jsp http://www.domain.com/ [R=301,L] # Remove bogus query strings RewriteCond %{query_string} q= [NC] RewriteRule (.*) http://www.domain.com/$1? [R=301,L] # Remove multiple slashes after domain - DOESN'T WORK!!! #RewriteCond %{REQUEST_URI} ^//+(.*)$ [OR] #RewriteCond %{REQUEST_URI} ^(.*/)/+$ #RewriteRule / http://www.domain.com/%1 [R=301,L] # Remove multiple slashes anywhere in URL RewriteCond %{REQUEST_URI} ^(.*)//(.*)$ RewriteRule . %1/%2 [R=301,L] # Externally redirect to get rid of trailing slash except for home page, ads RewriteCond %{REQUEST_URI} !^/ads/ RewriteRule ^(.+)/$ $1 [R=301,L] Your help is appreciated.

    Read the article

  • How to export scrubyt extractor?

    - by robintw
    I've written a scrubyt extractor based on the 'learning' technique - that is, specifying the current text on the page and getting it to work out the XPath expressions itself. However, I now want to export the extractor so that it can be used even when the page has changed. The documentation for scrubyt seems to be all over the place now, but from what I can find I should be able to put the line extractor.export(__FILE__) and it should work. It doesn't - I just get an error saying that there is the wrong number of arguments for export, it should have 0. I've tried it without any arguments and it still fails. I would ask on the scrubyt forum, but it seems like no-one's been there for ages! Any ideas what to do here?

    Read the article

  • How can I update an expression in a Runt::Schedule object?

    - by Reid Beels
    Runt provides a Schedule class for managing collections of events, each represented by a temporal expression. The Schedule class provides an update method, cited in the release notes as "allowing clients to update existing expressions". The implementation of this method, however, simply calls a supplied block, providing the temporal expression for the specified event (as shown). # From lib/runt/schedule.rb:61 # # Call the supplied block/Proc with the currently configured # TemporalExpression associated with the supplied Event. # def update(event,&block) block.call(@elems[event]) end How is one expected to use this method to update an expression?

    Read the article

  • Transforming a string to a valid PDO_MYSQL DSN

    - by Alix Axel
    What is the most concise way to transform a string in the following format: mysql:[/[/]][user[:pass]@]host[:port]/db[/] Into a usuable PDO connection/instance (using the PDO_MYSQL DSN), some possible examples: $conn = new PDO('mysql:host=host;dbname=db'); $conn = new PDO('mysql:host=host;port=3307;dbname=db'); $conn = new PDO('mysql:host=host;port=3307;dbname=db', 'user'); $conn = new PDO('mysql:host=host;port=3307;dbname=db', 'user', 'pass'); I've been trying some regular expressions (preg_[match|split|replace]) but they either don't work or are too complex, my gut tells me this is not the way to go but nothing else comes to my mind. Any suggestions?

    Read the article

  • Java RandomAccessFile - dealing with different newline styles?

    - by waitinforatrain
    Hey, I'm trying to seek through a RandomAccessFile, and as part of an algorithm I have to read a line, and then seek backwards from the end of the line E.g String line = raf.readLine(); raf.seek (raf.getFilePointer() - line.length() + m.start() + m.group().length()); //m is a Matcher for regular expressions I've been getting loads of off-by-one errors and couldn't figure out why. I just discovered it's because some files I'm reading from have UNIX-style linefeeds, \r\n, and some have just windows-style \n. Is there an easy to have the RandomAccessFile treat all linefeeds as windows-style linefeeds?

    Read the article

  • remove multiple trailing slashes mod_rewrite

    - by Boyan
    I know this question was asked a number of times on this site alone, but browsing through the relevant posts I couldn't find a solution. Trying to remove multiple trailing slashes after domain. The following mod_rewrite expressions seem to work for URLs such as http://www.domain.com//path1///path2////, but do not work for domain// DirectorySlash Off RewriteEngine on # Canonical fix RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC] RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301] RewriteRule ^/main.do http://www.domain.com/ [R=301,L] RewriteRule ^/index.jsp http://www.domain.com/ [R=301,L] # Remove bogus query strings RewriteCond %{query_string} q= [NC] RewriteRule (.*) http://www.domain.com/$1? [R=301,L] # Remove multiple slashes after domain - DOESN'T WORK!!! #RewriteCond %{REQUEST_URI} ^//+(.*)$ [OR] #RewriteCond %{REQUEST_URI} ^(.*/)/+$ #RewriteRule / http://www.domain.com/%1 [R=301,L] # Remove multiple slashes anywhere in URL RewriteCond %{REQUEST_URI} ^(.*)//(.*)$ RewriteRule . %1/%2 [R=301,L] # Externally redirect to get rid of trailing slash except for home page, ads RewriteCond %{REQUEST_URI} !^/ads/ RewriteRule ^(.+)/$ $1 [R=301,L] Your help is appreciated.

    Read the article

  • Is it possible to use objects as function paremeters in EL with JBoss EL resolver?

    - by calavera.info
    There is this sentence in JBoss EL resolver online documentation: It's important to fully understand how this extension to EL works. When the page is rendered, the parameter names are stored (for example, hotel.id and user.username), and evaluated (as value expressions) when the page is submitted. You can't pass objects as parameters! But I had used objects as function parameters in my project before I accidentally read this hint and it worked! How is it possible? I'm afraid of that there is some magic now...

    Read the article

  • What is the C# equivalent of java.util.regex?

    - by peter.murray.rust
    I am converting Java code to C# and need to replace the use of Java's regex. A typical use is import java.util.regex.Matcher; import java.util.regex.Pattern; //... String myString = "B12"; Pattern pattern = Pattern.compile("[A-Za-z](\\d+)"); Matcher matcher = Pattern.matcher(myString); String serial = (matcher.matches()) ? matcher.group(1) : null; which should extract a capture group from a matched target string. I'd be grateful for simple examples. EDIT: I have now added the C# equivalent of the code as an answer. EDIT: Here is a tutorial on the use of the actual expressions. EDIT: Here is a useful comparison of C# and Java (and Perl.)

    Read the article

  • Django queries Especial Caracters

    - by Jorge Machado
    Hi, I Working on location from google maps and using django to. My question is: I have a String in request.GET['descricao'] lets say it contains "Via rapida". In my database i have store = "Via Rápida" i'm doing : local = Local.objects.filter(name__icontains=request.GET['descricao']) with that i can get everthing fine like "Via Rapida" but the result that have "Via rápida" never get match in the query (ASCI caracter may be ?) what must i do given a string "Via rapida" match "via rápida" and "via rapida" ? Regular Expressions ? how ? Thanks

    Read the article

  • Using PIG with Hadoop, how do I regex match parts of text with an unknown number of groups?

    - by lmonson
    I'm using Amazon's elastic map reduce. I have log files that look something like this random text foo="1" more random text foo="2" more text noise foo="1" blah blah blah foo="1" blah blah foo="3" blah blah foo="4" ... How can I write a pig expression to pick out all the numbers in the 'foo' expressions? I prefer tuples that look something like this: (1,2) (1) (1,3,4) I've tried the following: TUPLES = foreach LINES generate FLATTEN(EXTRACT(line,'foo="([0-9]+)"')); But this yields only the first match in each line: (1) (1) (1)

    Read the article

  • Modifying a model and texture mid-game code

    - by MicroPirate
    Just have a question for anyone out there who knows some sort of game engine pretty well. What I am trying to implement is some sort of script or code that will allow me to make a custom game character and textures mid-game. A few examples would be along the lines of changing facial expressions and body part positions in the game SecondLife. I don't really need a particular language, feel free to use your favorite, I'm just really looking for an example on how to go about this. Also I was wondering if there is anyway to combine textures for optimization; for example if i wanted to add a tattoo to a character midgame, is there any code that could combine his body texture and the tattoo texture into one texture to use (this way I can simply just render one texture per body.) Any tips would be appreciated, sorry if the question is a wee bit to vauge.

    Read the article

  • Translate a webpage in PHP

    - by Rob
    I'm looking to translate a webpage in PHP 5 so I can save the translation and make it easily accessible via mydomain.com/lang/fr/category/article.html rather than users having to go through google translate. I've found various easy ways to translate text via CURL, however what i'd really like to be able to do is translate an entire webpage but obviously ignore the tags. The problem is that Google Translate messes up all the HTML tags, class names etc Does anyone know of a php class that can translate an entire webpage whilst ignoring the tags? I'm guessing it may be possible via advanced regular expressions or something like that, but i'm not sure. I can't just curl Google's response as i'll have all the extra JS that they put in. Any ideas?

    Read the article

  • Storing expression references to data base

    - by Marcus
    I have standard arithmetic expressions sotred as strings eg. "WIDTH * 2 + HEIGHT * 2" In this example WIDTH and HEIGHT references other objects in my system and the literals WIDTH and HEIGHT refers to a property (Name) on those objects. The problem I'm having is when the Name property on an expression object changes the expression won't match anymore. One solution I came up with is to instead of storing "WIDTH * 2 + HEIGHT * 2" i store "{ID_OF_WIDTH} * 2 + {ID_OF_HEIGHT} * 2" And let my parser be able to parse this new syntax and implement an interface or such on referenced objects IExpressionReference { string IdentifierName { get; } } Anyone have a better/alternative solution to my problem?

    Read the article

  • php regex to remove HTML

    - by Me1000
    Before we start, strip_tags() doesn't work. now, I've got some data that needs to be parsed, the problem is, I need to get rid of all the HTML that has been formated very strangely. the tags look like this: (notice the spaces) < p > blah blah blah < / p > < a href= " link.html " > blah blah blah < /a > All the regexs I've been trying aren't working, and I don't know enough about regex formating to make them work. I don't care about preserving anything inside of the tags, and would prefer to get rid of the text inside a link if I could. Anyone have any idea? (I really need to just sit down and learn regular expressions one day)

    Read the article

  • .NET library for generating javascript?

    - by Rune
    Do you know of a .NET library for generating javascript code? I want to generate javascript code based on information in my .NET application. I would like to be able to create an AST-like datastructure (using C#) and have it turned into valid javascript. I need to be able to create functions, statements, expressions etc., so I need something more than a JSON serializer - but I guess you could think of this as a (very) generalized JSON serializer. Do such libraries exist and if so, could you recommend any? Thank you.

    Read the article

< Previous Page | 53 54 55 56 57 58 59 60 61 62 63 64  | Next Page >