Search Results

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

Page 59/113 | < Previous Page | 55 56 57 58 59 60 61 62 63 64 65 66  | Next Page >

  • How to create 2 different scripts for 2 browsers (IE+all the rest)

    - by Barnabas Nagy
    I'm trying to solve an IE CSS issue by using conditional tags. My jQuery that does the job of tabbed box effect calls an id that is inside the conditional tags. I've given new ids to IE so on IE the jQuery is not working. I tried to duplicate the script with the new id in one of the script but the 2 scripts seems to get in conflict. My jQuery (in between the head tags) is (for all all browsers except IE): <script> var currentTab = 0; // Set to a different number to start on a different tab. function openTab(clickedTab) { var thisTab = $(".tabbed-box .tabs a").index(clickedTab); $(".tabbed-box .tabs li a").removeClass("active"); $(".tabbed-box .tabs li a:eq("+thisTab+")").addClass("active"); $(".tabbed-box .tabbed-content").hide(); $(".tabbed-box .tabbed-content:eq("+thisTab+")").show(); currentTab = thisTab; } $(document).ready(function() { $(".tabs li:eq(0) a").css("border-left", "none"); $(".tabbed-box .tabs li a").click(function() { openTab($(this)); return false; }); $(".tabbed-box .tabs li a:eq("+currentTab+")").click() }); </script> And I would need this for IE: <script> var currentTab = 0; // Set to a different number to start on a different tab. function openTab(clickedTab) { var thisTab = $(".tabbed-box .tabs a").index(clickedTab); $(".tabbed-box ie-.tabs li a").removeClass("active"); $(".tabbed-box ie-.tabs li a:eq("+thisTab+")").addClass("active"); $(".tabbed-box .tabbed-content").hide(); $(".tabbed-box .tabbed-content:eq("+thisTab+")").show(); currentTab = thisTab; } $(document).ready(function() { $(".ie-tabs li:eq(0) a").css("border-left", "none"); $(".tabbed-box .ie-tabs li a").click(function() { openTab($(this)); return false; }); $(".tabbed-box .ie-tabs li a:eq("+currentTab+")").click() }); </script> Having the 2 scripts in the head conflicts with each other. Maybe there is a way to combine them?

    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

  • GTK+ Compile Error

    - by Alon
    When trying to compile GTK+ with target for DirectFB, it throws: configure: error: conditional "XINPUT_NONE" was never defined. Usually this means the macro was only invoked conditionally. Any ideas? Thanks.

    Read the article

  • How can I recreate a SQL statement using NHibernate that has an inner select case?

    - by brianberns
    I am trying to recreate something like the following SQL using NHibernate criteria: select Range, count(*) from ( select case when ent.ID between 'A' and 'N' then 'A-M' else 'Other' end as Range from Subject ) tbl group by tbl.Range I am able to create the inner select as follows: session.CreateCriteria<Subject>() .SetProjection( Projections.Conditional( Expression.Between("Name", "A", "N"), Projections.Constant("A-M"), Projections.Constant("Other"))) .List(); However, I can't figure out how to pipe those results into a grouping by row count.

    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

  • Python/Biomolecular Physics- Trying to code a simple stochastic simulation of a system exhibiting co

    - by user359597
    *edited 6/17/10 I'm trying to understand how to improve my code (make it more pythonic). Also, I'm interested in writing more intuitive 'conditionals' that would describe scenarios that are commonplace in biochemistry. The conditional criteria in the below program is explained in Answer #2, but I am not satisfied with it- it is correct, but isn't obvious and isn't easy to implement for more complicated conditional scenarios. Ideas welcome. Comments/criticisms welcome. First posting experience @ stackoverflow- please comment on etiquette if needed. The code generates a list of values that are the solution to the following exercise: "In a programming language of your choice, implement Gillespie’s First Reaction Algorithm to study the temporal behaviour of the reaction A---B in which the transition from A to B can only take place if another compound, C, is present, and where C dynamically interconverts with D, as modelled in the Petri-net below. Assume that there are 100 molecules of A, 1 of C, and no B or D present at the start of the reaction. Set kAB to 0.1 s-1 and both kCD and kDC to 1.0 s-1. Simulate the behaviour of the system over 100 s." def sim(): # Set the rate constants for all transitions kAB = 0.1 kCD = 1.0 kDC = 1.0 # Set up the initial state A = 100 B = 0 C = 1 D = 0 # Set the start and end times t = 0.0 tEnd = 100.0 print "Time\t", "Transition\t", "A\t", "B\t", "C\t", "D" # Compute the first interval transition, interval = transitionData(A, B, C, D, kAB, kCD, kDC) # Loop until the end time is exceded or no transition can fire any more while t <= tEnd and transition >= 0: print t, '\t', transition, '\t', A, '\t', B, '\t', C, '\t', D t += interval if transition == 0: A -= 1 B += 1 if transition == 1: C -= 1 D += 1 if transition == 2: C += 1 D -= 1 transition, interval = transitionData(A, B, C, D, kAB, kCD, kDC) def transitionData(A, B, C, D, kAB, kCD, kDC): """ Returns nTransition, the number of the firing transition (0: A->B, 1: C->D, 2: D->C), and interval, the interval between the time of the previous transition and that of the current one. """ RAB = kAB * A * C RCD = kCD * C RDC = kDC * D dt = [-1.0, -1.0, -1.0] if RAB > 0.0: dt[0] = -math.log(1.0 - random.random())/RAB if RCD > 0.0: dt[1] = -math.log(1.0 - random.random())/RCD if RDC > 0.0: dt[2] = -math.log(1.0 - random.random())/RDC interval = 1e36 transition = -1 for n in range(len(dt)): if dt[n] > 0.0 and dt[n] < interval: interval = dt[n] transition = n return transition, interval if __name__ == '__main__': sim()

    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

  • if-else structure

    - by Halo
    I have these long statements that I will refer to as x,y etc. here. My conditional statements' structure goes like this: if(x || y || z || q){ if(x) do someth else if (y) do something if(z) do something else if(q) do something } else do smthing Is there a better, shorter way to write this thing? Thanks

    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

  • sendmessage mouseevent not working

    - by kevin
    I have this code: Private Const MOUSEEVENTF_LEFTDOWN = &H2 Private Const MOUSEEVENTF_LEFTUP = &H4 Dim WindowHandle As Long = FindWindow(vbNullString, "Ultima Online") SendMessage(WindowHandle, MOUSEEVENTF_LEFTDOWN, 0, 0) SendMessage(WindowHandle, MOUSEEVENTF_LEFTUP, 0, 0) I know it is getting the windowhandle fine, because I made a conditional statment that pops up a messagebox if windowhandle = 0 The problem is that it is not sending the mouse click to the window.

    Read the article

  • Overriding an ActiveRecord attribute

    - by jspooner
    I have a model with a completed:boolean column that I'd like override so I can add some conditional code. I've never override an ActiveRecord attribute before and wanted to know if the method below is good practice? class Article < ActiveRecord::Base def completed=(b) write_attribute(:completed, b) # IF b is true then do something end end

    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

  • 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

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