Search Results

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

Page 44/87 | < Previous Page | 40 41 42 43 44 45 46 47 48 49 50 51  | Next Page >

  • Am I right in thinking there is no way to put an if statement and an else statement on line in Python?

    - by Louise
    Am I right in thinking I can't put an if-statement and the corresponding else-statement on one line in Python? NB: variable = value1 if condition else value2 is NOT two statements. It's one statement which can take the value of one of two expressions. I want to do something like if condition a=value else b=value Am I right in thinking this requires a full if-else in Python? Like if condition: a=value else: b=value Thanks, Louise

    Read the article

  • Navigation and WebBrowser control

    - by Neir0
    Hi, Can i use XPAth expressions to navigate through DOM elements in WebBrowser control? May be attaching javascript code and use document.evaluate function is right way? Can another activeX browser component(firefox,webkit.net) help me to solve my task?

    Read the article

  • Smart search/replace in Vim

    - by Amir Rachum
    I have a file with the following expressions: something[0] Where instead of 0 there could be different numbers. I want to replace all these occurances with somethingElse0 Where the number should be the same as in the expression I replaced. How do I do that?

    Read the article

  • UNIX find for finding file names NOT ending in specific extensions?

    - by Cristi Diaconescu
    Is there a simple way to recursively find all files in a directory hierarchy, that do not end in a list of extensions? E.g. all files that are not *.dll or *.exe UNIX/GNU find, powerful as it is, doesn't seem to have an exclude mode (or I'm missing it), and I've always found it hard to use regular expressions to find things that don't match a particular expression. I'm in a Windows environment (using the GnuWin32 port of most GNU tools), so I'm equally open for Windows-only solutions.

    Read the article

  • Poor man's "lexer" for C#

    - by Paul Hollingsworth
    I'm trying to write a very simple parser in C#. I need a lexer -- something that lets me associate regular expressions with tokens, so it reads in regexs and gives me back symbols. It seems like I ought to be able to use Regex to do the actual heavy lifting, but I can't see an easy way to do it. For one thing, Regex only seems to work on strings, not streams (why is that!?!?). Basically, I want an implementation of the following interface: interface ILexer : IDisposable { /// <summary> /// Return true if there are more tokens to read /// </summary> bool HasMoreTokens { get; } /// <summary> /// The actual contents that matched the token /// </summary> string TokenContents { get; } /// <summary> /// The particular token in "tokenDefinitions" that was matched (e.g. "STRING", "NUMBER", "OPEN PARENS", "CLOSE PARENS" /// </summary> object Token { get; } /// <summary> /// Move to the next token /// </summary> void Next(); } interface ILexerFactory { /// <summary> /// Create a Lexer for converting a stream of characters into tokens /// </summary> /// <param name="reader">TextReader that supplies the underlying stream</param> /// <param name="tokenDefinitions">A dictionary from regular expressions to their "token identifers"</param> /// <returns>The lexer</returns> ILexer CreateLexer(TextReader reader, IDictionary<string, object> tokenDefinitions); } So, pluz send the codz... No, seriously, I am about to start writing an implementation of the above interface yet I find it hard to believe that there isn't some simple way of doing this in .NET (2.0) already. So, any suggestions for a simple way to do the above? (Also, I don't want any "code generators". Performance is not important for this thing and I don't want to introduce any complexity into the build process.)

    Read the article

  • DataColumn.Expression Power

    - by Graham
    the following code Dim dc = New DataColumn(name, GetType(Double), "[col1] ^ [col2]") produces the following error: The expression contains unsupported operator '^'. Is this right, is the power operand not support in datacolumn expressions??? Anyone have an idea how i'd write this?

    Read the article

  • How to check if a given Regex is valid?

    - by Philipp Andre
    Hi folks, I have a little program allowing users to type-in some regular expressions. afterwards i like to check if this input is a valid regex or not. I'm wondering if there is a build-in method in Java, but could not find such jet. Can you give me some advice? Best regards Phil

    Read the article

  • HTML Scraping in Php.

    - by tsellon
    I've been doing some html scraping in PHP using regular expressions. This works, but the result is finicky and fragile. Has anyone used any packages that provide a more robust solution? A config driven solution would be ideal, but I'm not picky.

    Read the article

  • Finding Last Fired time using a Cron Expression in Java

    - by a-sak
    Is there a way in Java to find the "Last Fired Time" from a Cron Expression. E.g. If now = 25-Apr-2010 10pm, cron expression "0 15 10 ? * *" (quartz) should return me 25-Apr-2010 10:15am I do not care if we use standard cron expressions (like Unix and Quartz) or less popular ones if they can fetch me the correct "Last Fired Time"

    Read the article

  • Extracting a string between specified characters in python

    - by Seth
    I'm a newbie to regular expressions and I have the following string: sequence = ["{\"First\":\"Belyuen,NT,0801\",\"Second\":\"Belyuen,NT,0801\"}","{\"First\":\"Larrakeyah,NT,0801\",\"Second\":\"Larrakeyah,NT,0801\"}"] I am trying to extract the text Belyuen,NT,0801 and Larrakeyah,NT,0801 in python. I have the following code which is not working: re.search('\:\\"...\\', ''.join(sequence)) I.e. I want to get the string between characters :\ and \.

    Read the article

  • Delete all characters in a multline string upto a given pattern

    - by biffabacon
    Using Python I need to delete all charaters in a multiline string up to the first occurrence of a given pattern. In Perl this can be done using regular expressions with something like: #remove all chars up to first occurrence of cat or dog or rat $pattern = 'cat|dog|rat' $pagetext =~ s/(.*)($pattern)/$2/xms; What's the best way to do it in Python?

    Read the article

  • Lisp's "some" in Python?

    - by Mark Probst
    I have a list of strings and a list of filters (which are also strings, to be interpreted as regular expressions). I want a list of all the elements in my string list that are accepted by at least one of the filters. Ideally, I'd write [s for s in strings if some (lambda f: re.match (f, s), filters)] where some is defined as def some (pred, list): for x in list: res = pred (x) if res: return res return False Is something like that already available in Python, or is there a more idiomatic way to do this?

    Read the article

  • Is there an easy method to combine two relative paths in C# ?

    - by Ioannis
    I want to combine two relative paths in C#. For example: string path1 = "/System/Configuration/Panels/Alpha"; string path2 = "Panels/Alpha/Data"; I want to return string result = "/System/Configuration/Panels/Alpha/Data"; I can implement this by splitting the second array and compare it in a for loop but I was wondering if there is something similar to Path.Combine available or if this can be accomplished with regular expressions or Linq? Thanks

    Read the article

  • Conditional operator in if-statement?

    - by Pindatjuh
    I've written the following if-statement in Java: if(methodName.equals("set" + this.name) || isBoolean() ? methodName.equals("is" + this.name) : methodName.equals("get" + this.name)) { ... } Is this a good practice to write such expressions in if, to separate state from condition? And can this expression be simplified?

    Read the article

  • Linq Expression Trees in Compact Framework.

    - by Michal Drozdowicz
    The lack of expression trees in Compact Framework has bugged me for some time now, but I haven't really looked for a solution. Today, I've found a blog post about an alternative System.Linq.Expressions built on top of Mono System.Core and used e.g. by db4o (you can find it here). My question is - have you used this library and if so, what were your experiences with it (especially regarding performance)?

    Read the article

  • Delayed computation as DAG in .NET

    - by Tristan
    I'm playing around with declarative / delayed computation, where expressions are built up into a directed acyclic graph. Microsoft's GPU Accelerator does something similar. Are there any libraries available for .Net languages that makes it easier to build a representation of the computation?

    Read the article

  • Mod rewrite with multiple query strings

    - by Boris
    Hi, I'm a complete n00b when it comes to regular expressions. I need these redirects: (1) www.mysite.com/products.php?id=001&product=Product-Name&source=Source-Name should become -> www.mysite.com/Source-Name/001-Product-Name (2) www.mysite.com/stores.php?id=002&name=Store-Name should become -> www.mysite.com/002-Store-Name Any help much appreciated :)

    Read the article

  • With PHP preg_match_all, get value of href

    - by Jeremy Dicaire
    Hi, I don'T really understabd how regular expressions works even after I read this tutorial http://www.webcheatsheet.com/php/regular_expressions.php Here is what I need to find: And it should return: http://link Here is what I tried: $find = preg_match_all('/<link type="text/html" rel="alternate" href=".*',$file,$patterns2); You can laught :) Thanks in advance for your help and your time :)

    Read the article

  • Question regarding php Regular expression filenames

    - by jason
    I am very bad at regular expressions, but I have a regular expression that is working okay, except for one issue: /\/(.*?).php/ I only need this regular expression to find things like: /this-a-valid-page.php {some words here} /anotherpage.php { some words here} http://www.google.com but do not find URLs the problem i am having is that it find this parts of full URLS i want it to avoid these all together. http://www.google.com/page.php because i have another function that does something different than the filename reg exp.

    Read the article

  • Delete all characters in a multline string up to a given pattern

    - by biffabacon
    Using Python I need to delete all charaters in a multiline string up to the first occurrence of a given pattern. In Perl this can be done using regular expressions with something like: #remove all chars up to first occurrence of cat or dog or rat $pattern = 'cat|dog|rat' $pagetext =~ s/(.*?)($pattern)/$2/xms; What's the best way to do it in Python?

    Read the article

< Previous Page | 40 41 42 43 44 45 46 47 48 49 50 51  | Next Page >