Search Results

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

Page 75/113 | < Previous Page | 71 72 73 74 75 76 77 78 79 80 81 82  | Next Page >

  • are there any negative implications of sourcing a javascript file that does not actually exist?

    - by dreftymac
    If you do script src="/path/to/nonexistent/file.js" in an HTML file and call that in a browser, and there are no dependencies or resources anywhere else in the HTML file that expect the file or code therein to actually exist, is there anything inherently bad-practice about doing this? Yes, it is an odd question. The rationale is the developer is dealing with a CMS that allows custom (self-contained) javascript files to be provided in certain circumstances. The problem is the CMS is not very flexible when it comes to creating conditional includes for javascript. Therefore it is easier to just make references to the self-contained js files regardless of whether they are actually at the specified path. Since no errors are displayed to the user, should this practice be considered a viable option?

    Read the article

  • Bug in Mathematica's Integrate with PrincipalValue->True

    - by Janus
    It seems that Mathematica's handling of principal value integrals fails on some corner cases. Consider these two expressions (which should give the same result): Integrate[UnitBox[x]/(x0 - x), {x, -Infinity, Infinity}, PrincipalValue -> True, Assumptions -> {x0 > 0}] /. x0 -> 1 // Simplify Integrate[UnitBox[x]/(x0 - x) /. x0 -> 1, {x, -Infinity, Infinity}, PrincipalValue -> True] In Mathematica 7.0.0 I get I Pi+Log[3] Log[3] Has this been fixed in later versions? Does anybody have an idea for a (more or less) general workaround?

    Read the article

  • Functional languages targeting the LLVM

    - by Matthew
    Are there any languages that target the LLVM that: Are statically typed Use type inference Are functional (i.e. lambda expressions, closures, list primitives, list comprehensions, etc.) Have first class object-oriented features (inheritance, polymorphism, mixins, etc.) Have a sophisticated type system (generics, covariance and contravariance, etc.) Scala is all of these, but only targets the JVM. F# (and to some extent C#) is most if not all of these, but only targets .NET. What similar language targets the LLVM?

    Read the article

  • How to sift idioms and set phrases apart from other common phrases using NLP techniques?

    - by hippietrail
    What techniques exist that can tell the difference betwen plain common phrases such as "to the", "and the" and set phrases and idioms which have their own lexical meanings such as "pick up", "fall in love", "red herring", "dead end"? Are there techniques which are successful even without a dictionary, statistical methods HMMs train on large corpora for instance? Or are there heuristics such as ignoring or weighting down "promiscuous" words which can co-occur with just about any word versus words which occur either alone or in a specific limited set of idiomatic phrases? If there are such heuristics, how do we take into account set phrases and verbal phrases which do incorporate promiscuous words such as "up" in "beat up", "eat up", "sit up", "think up"? UPDATE I've found an interesting paper online: Unsupervised Type and Token Identi?cation of Idiomatic Expressions

    Read the article

  • How to regex match a string of alnums and hyphens, but which doesn't begin or end with a hyphen?

    - by Shahar Evron
    I have some code validating a string of 1 to 32 characters, which may contain only alpha-numerics and hyphens ('-') but may not begin or end with a hyphen. I'm using PCRE regular expressions & PHP (albeit the PHP part is not really important in this case). Right now the pseudo-code looks like this: if (match("/^[\p{L}0-9][\p{L}0-9-]{0,31}$/u", string) and not match("/-$/", string)) print "success!" That is, I'm checking first that the string is of right contents, doesn't being with a '-' and is of the right length, and then I'm running another test to see that it doesn't end with a '-'. Any suggestions on merging this into a single PCRE regular expression? I've tried using look-ahead / look-behind assertions but couldn't get it to work.

    Read the article

  • Objective-C "if" statements not retaining

    - by seanny94
    I know the title of this question is a bit confusing, but here it goes anyway: I'm creating an NSString after an if statement but it just doesn't seem to want to retain outside of the statement. My conditional looks like this: if ([[password stringValue] isEqualToString:@""]) { NSString *pwd = [[NSString alloc]initWithString:@"password"]; } else { NSString *pwd = [[NSString alloc]initWithFormat:@"%@", [password stringValue]]; } ... and I call pwd later in the script like this: NSArray *arguments; arguments = [NSArray arrayWithObjects: ip, pwd, nil]; [task setArguments: arguments]; But when I do so in this way, the first snippet returns a warning of Unused variable 'pwd' and the latter call ends up in an error of 'pwd' undeclared. What am I doing wrong here? Thanks in advance. ;)

    Read the article

  • Listing mysql row entries from tags into one single row

    - by Derrick
    Hi guys, Ive got two tables, one a listings and another representing a list of tags for the listing table. In the listings table the tag ids are stored in a field called tags as 1-2-3- this has worked out very well for me regular expressions and joins to seperate and display the data, BUT... I now need to pull the titles of those tags into a single row. See below. listings table id tags 1 1-2-3- 2 4-5-6- tags table id title 1 pig 2 dog 3 cat 4 mouse 5 elephant 6 duck And what I need to produce out of the listings table is: id tags 2 mouse, elephant, duck any suggestions?

    Read the article

  • watchpoint in GDB

    - by Tim
    Hi, If I set a watchpoint for a variable local to the current scope, it will be auto deleted when going out of the scope. Is there any way to set it once and keep it auto alive whenever entering the same scope? Is there anyway to set conditional watchpoint, like "watch var1 if var1==0"? In my case, the condition does't work. gdb stops whenever var1's value is changed, instead of untill "var1==0" is true. My gdb is GNU gdb 6.8-debian. Thanks and regards!

    Read the article

  • How to handle subclasses in JasperReports?

    - by gotch4
    I've two classes (A and B) that extend a base class BASE. I need to make a report that takes an array of such classes and the prints the fields of A or B. I tought of using conditional expressions, then casting to one or another (depending on a field value). But I can't cast, because I don't know how to refere to the current bean. To do this I am using a JRBeanCollectionDataSource filled with a List<BASE>. How do I cast every bean to A or B in a report (or subreport)? I tried: ((A)this) but it says basically that this contains the report instance, not the current bean and gives error.

    Read the article

  • Regex pattern for searches with include and exclude

    - by alex-kravchenko-zmeyp
    I am working on a Regex pattern for searches that should allow optional '+' sign to include in the search and '-' sign to exclude from the search. For example: +apple orange -peach should search for apples and oranges and not for peaches. Also the pattern should allow for phrases in double quotes mixed with single words, for example: "red apple" -"black grape" +orange - you get the idea, same as most of the internet searches. So I am running 2 regular expressions, first to pick all the negatives, which is simple because '-' is required: (?<=[\-]"?)((?<=")(?<exclude>[^"]+)|(?<exclude>[^\s,\+\-"]+)) And second to pick positives, and it is a little more complex because '+' is optional: ((?<=[\+\s]")(?<include>[^\s"\+\-][^"]+))|(?<include>(?<![\-\w]"?)([\w][^,\s\-\+]+))(?<!") Positive search is where I am having a problem, it works fine when I run it in RegexBuddy but when I try in .Net the pattern picks up second word from negative criteria, for example in -"black grape" it picks up word 'grape' even though it ends with double quote. Any suggestions?

    Read the article

  • Expression Tree : C#

    - 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 when our LINQ to SQL query compiler translates it to 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

  • How to handle an "infinite" IEnumerable?

    - by Danvil
    A trivial example of an "infinite" IEnumerable would be IEnumerable<int> Numbers() { int i=0; while(true) { yield return i++; } } I know, that foreach(int i in Numbers().Take(10)) { Console.WriteLine(i); } and var q = Numbers(); foreach(int i in q.Take(10)) { Console.WriteLine(i); } both work fine (and print out the number 0-9). But are there any pitfalls when copying or handling expressions like q? Can I rely on the fact, that they are always evaluated "lazy"? Is there any danger to produce an infinite loop?

    Read the article

  • Can I use android.os.* libraries in a standalone project?

    - by medicdave
    I'm trying to develop an external library (not sure if that's the right term) to provide prepackaged functionality in Android projects. Working in Eclipse, I've added the appropriate android.jar file to the build path, and everything is happy both while editing and upon compilation. However, when I use Android's Handler and Message classes (android.os.Handler, android.os.Message) for inter-thread communication, I get exceptions unless I'm running within an Android app, on the emulator or a device. I can no longer test my library in a "standalone" way without having to go through a running Android target. Is there any way for me to include these two Android classes and still be able to test my library standalone? Do I need to have the Android source available? Or would it require some sort of conditional compilation hand-waving?

    Read the article

  • How to determine if an event is already subscribed

    - by Ram
    Hi, In my .NET application I am subscribing to events from another class. The subscription is conditional. I am subscribing to events when the control is visible and de-subscribing it when it become invisible. However in some conditions I do not want to de-subscribe the event even if the control is not visible as I want the result of an operation which is happening on background thread . Is there any way through which I can determine if a that class has already subscribed to that event. I know we can do it in the class which will raise that event by checking event with null but I don not know how to do it in a class which will subscribe to that event.

    Read the article

  • How to extract URL parameters from a URL with Ruby or Rails?

    - by Flackou
    Hi, I have some URLs, like http://www.example.com/something?param1=value1&param2=value2&param3=value3, and I would like to extract the parameters from these URLs and get them in a Hash. Obviously, I could use regular expressions, but I was just wondering if there was easier ways to do that with Ruby or Rails. I haven't found anything in the Ruby Module 'URI' but perhaps I missed something. In fact, I need a method that would do that : extract_parameters_from_url("http://www.example.com/something?param1=value1&param2=value2&param3=value3") => {:param1 => 'value1', :param2 => 'value2', :param3 => 'value3'} Would you have some advices? Thanks in advance. Julien

    Read the article

  • Numbering Regex Submatches

    - by gentlylisped
    Is there a canonical ordering of submatch expressions in a regular expression? For example: What is the order of the submatches in "(([0-9]{3}).([0-9]{3}).([0-9]{3}).([0-9]{3}))\s+([A-Z]+)" ? a. (([0-9]{3})\.([0-9]{3})\.([0-9]{3})\.([0-9]{3}))\s+([A-Z]+) (([0-9]{3})\.([0-9]{3})\.([0-9]{3})\.([0-9]{3})) ([A-Z]+) ([0-9]{3}) ([0-9]{3}) ([0-9]{3}) ([0-9]{3}) b. (([0-9]{3})\.([0-9]{3})\.([0-9]{3})\.([0-9]{3}))\s+([A-Z]+) (([0-9]{3})\.([0-9]{3})\.([0-9]{3})\.([0-9]{3})) ([0-9]{3}) ([0-9]{3}) ([0-9]{3}) ([0-9]{3}) ([A-Z]+) or c. somthin' else.

    Read the article

  • Regular expression to match one of two video ID's in a Google Video URL

    - by Baldur
    I need to grab the video ID from a Google Video URL. There are two different types of URLs that I need to be able to match: http://video.google.com/videoplay?docid=-3498228245415745977# where I need to be able to match -3498228245415745977 (note the dash; -), and video.google.com/videoplay?docid=-3498228245415745977#docid=2728972720932273543 where I need to match 2728972720932273543. Is there any good regular expression that can match this? This is what I've got so far: @"docid=(-?\d{19}+)" since the video ID seems to be 19 characters except when it's prefixed with the dash. I'm using C# (of which I have very little experience) if that changes anything. P.s. I would also appreciate you review my regular expressions for YouTube (@"[\?&]v=([^&#])";), RedTube (@"/(\d{1,6})") and Vimeo (@"/(\d*)"). I do not expect users to enter the full URL and thus do not match the ^http://\\.?sitename+\\.\\w{2,3}.

    Read the article

  • Math with interpolated variables?

    - by Idan Gazit
    Consider the following sass: $font-size: 18; $em: $font-size; $column: $font-size * 3; // The column-width of my grid in pixels $gutter: $font-size * 1; // The gutter-width of my grid in pixels $gutter-em: #{$gutter / $em}em; // The gutter-width in ems. $column-em: #{$column / $em}em; // The column-width in ems; $foo = $gutter-em / 2; // This results in a value like "1em/2". :( $bar = ($gutter-em / 2); // this doesn't work either, same as above. How can I generate a $foo that works, and that I can reuse further in other expressions?

    Read the article

  • Python regular expression help

    - by dlw
    Hi SO, I can't seem to create the correct regular expression to extract the correct tokens from my string. Padding the beginning of the string with a space generates the correct output, but seems less than optimal: >>> import re >>> s = '-edge_0triggered a-b | -level_Sensitive c-d | a-b-c' >>> re.findall(r'\W(-[\w_]+)',' '+s) ['-edge_0triggered', '-level_Sensitive'] # correct output Here are some of the regular expressions I've tried, does anyone have a regex suggestion that doesn't involve changing the original string and generates the correct output >>> re.findall(r'(-[\w_]+)',s) ['-edge_0triggered', '-b', '-level_Sensitive', '-d', '-b', '-c'] >>> re.findall(r'\W(-[\w_]+)',s) ['-level_Sensitive'] Thanks -- DW

    Read the article

  • How can I replace only the last occurence of an number in a string with php?

    - by Shawn
    How would you change this: a-10-b-19-c into something like this: a-10-b-20-c using regular expressions in PHP? The only solution I've found so far is: reverse the original string - "c-91-b-01-a" find the first number - "91" reverse it - "19" turn in into a number (parseInt) - 19 add 1 to it (+1) - 20 turn it into a string again (toString) - "20" reverse it again - "02" replace the original match with this new number - "c-02-b-01-a" reverse the string - "a-10-b-20-c" I was hoping someone on SO would have a simpler way to do this... Anyone?

    Read the article

  • Efficient data structure design

    - by Sway
    Hi there, I need to match a series of user inputed words against a large dictionary of words (to ensure the entered value exists). So if the user entered: "orange" it should match an entry "orange' in the dictionary. Now the catch is that the user can also enter a wildcard or series of wildcard characters like say "or__ge" which would also match "orange" The key requirements are: * this should be as fast as possible. * use the smallest amount of memory to achieve it. If the size of the word list was small I could use a string containing all the words and use regular expressions. however given that the word list could contain potentially hundreds of thousands of enteries I'm assuming this wouldn't work. So is some sort of 'tree' be the way to go for this...? Any thoughts or suggestions on this would be totally appreciated! Thanks in advance, Matt

    Read the article

  • Why does Excel expose an 'Evaluate' method at all?

    - by jtolle
    A few questions have come up recently involving the Application.Evaluate method callable from Excel VBA. The old XLM macro language also exposes an EVALUATE() function. Both can be quite useful. Does anyone know why the general expression evaluator is exposed, though? My own hunch is that Excel needed to give people a way to get ranges from string addresses, and to get the value of named formulas, and just opening a portal to the expression evaluator was the easiest way. But of course you don't need the ability to evaluate arbitrary expressions just to do that. Application.Evaluate seems kind of...unfinished. It isn't very well documented, and there are quite a few quirks and limitations (as described by Charles Williams here: http://www.decisionmodels.com/calcsecretsh.htm) with what is exposed. I suppose the answer could be simply "why not expose it?", but I'd be interested to know what design decisions led to this feature. Failing that, I'd be interested to hear other hunches.

    Read the article

  • Merging MySQL row entries into a single row

    - by Derrick
    I've got two tables, one for listings and another representing a list of tags for the listings table. In the listings table the tag ids are stored in a field called tags as 1-2-3-. This has worked out very well for me (regular expressions and joins to separate and display the data), but I now need to pull the titles of those tags into a single row. See below. listings table id tags 1 1-2-3- 2 4-5-6- tags table id title 1 pig 2 dog 3 cat 4 mouse 5 elephant 6 duck And what I need to produce out of the listings table is: id tags 2 mouse, elephant, duck

    Read the article

  • C# Lambda Problem

    - by Chris Klepeis
    Probably something simple, but as I'm new to lambda expressions, the problem evades me: m => m.contactID == contactID && m.primaryAddress == true && (m.addressTypeID == 2 || m.addressTypeID == 3) I tried to use that lambda expression but I receive an invalid operator. Is there a way to simplify this so that it would work? Edit: The equivolent sql query would be: SELECT * FROM Contact WHERE contactID = 3 AND primaryAddress = 1 AND (addressTypeID = 2 OR addressTypeID = 3) I have a repository function defined like so: public E Single(Expression<Func<E, bool>> where) { return objectSet.Single<E>(where); } I'm passing the lambda expression above into this function. Invalid operator error.

    Read the article

  • Why is this if statement failing?

    - by Rawling
    I'm working on an existing class that is two steps derived from System.Windows.Forms.Combo box. The class overrides the Text property thus: public override string Text { get { return this.AccessibilityObject.Value; } set { if (base.Text != value) { base.Text = value; } } } The reason given for that "get" is this MS bug: http://support.microsoft.com/kb/814346 However, I'm more interested in the fact that the "if" doesn't work. There are times where "base.Text != value" is true and yet pressing F10 steps straight to the closing } of the "set" and the Text property is not changed. I've seen this both by just checking values in the debugger, and putting a conditional breakpoint on that only breaks when the "if" statement's predicate is true. How on earth can "if" go wrong? The class between this and ComboBox doesn't touch the Text property. The bug above shouldn't really be affecting anything - it says it's fixed in VS2005. Is the debugger showing different values than the program itself sees?

    Read the article

< Previous Page | 71 72 73 74 75 76 77 78 79 80 81 82  | Next Page >