Search Results

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

Page 37/113 | < Previous Page | 33 34 35 36 37 38 39 40 41 42 43 44  | Next Page >

  • conditional or js to detect whether user is on windows XP?

    - by Haroldo
    Because windows xp renders certain fonts so poorly, i would like to detect whether the user is using that OS and add a class to the body accordingly. I'm looking ideally for an html conditional statement or php $_SERVER var to do this However failing that a piece of javscript along the lines of below would do if(users_os === 'xp'){ $('body').addClass('xp'); } What avenues should i be persuing?!!! thanks!

    Read the article

  • If you're not supposed to use Regular Expressions to parse HTML, then how are HTML parsers written?

    - by Andy E
    I see questions every day asking how to parse or extract something from some HTML string and the first answer/comment is always "Don't use RegEx to parse HTML, lest you feel the wrath!" (that last part is sometimes omitted). This is rather confusing for me, I always thought that in general, the best way to parse any complicated string is to use a regular expression. So how does a HTML parser work? Doesn't it use regular expressions to parse. One particular argument for using a regular expression is that there's not always a parsing alternative (such as JavaScript, where DOMDocument isn't a universally available option). jQuery, for instance, seems to manage just fine using a regex to convert a HTML string to DOM nodes. Not sure whether or not to CW this, it's a genuine question that I want to be answered and not really intended to be a discussion thread.

    Read the article

  • Is it possible to join these two regex expressions into one?

    - by Pure.Krome
    Hi folks, i have the following two regular expressions (in order btw). 1. ^~/buying/(.*)\?(.*) => foo= group 1 baa= group 2. 2. ^~/buying/(.*) => foo= group 1 baa= nothing/empty/null/baibai What's i'm trying to do is, if the url has a questionmark, then split it into two groups. Otherwise, just throw all the stuff into the first group. the reason why the order is important for me, is that if i switch them round, the '?' regex will never get fired because the #2 expression (above) will catch all. So .. can this be re-fixed? NOTE: I have tried using this website** to help me debug/tweak .. but I can't figure it out. ** I have no affiliation with that site.

    Read the article

  • How can I capture a multiline pattern using a regular expressions in java?

    - by lampShade
    I have a text file that I need to parse using regular expressions. The text that I need to capture is in multiline groups like this: truck zDoug Doug's house (123) 456-7890 [email protected] 30 61234.56 8/10/2003 vehicle eRob Rob's house (987) 654-3210 [email protected] For this example I need to capture truck followed by the next seven lines.In other words, in this "block" I have 8 groups. This is what I've tried but it will not capture the next line: (truck)\n(\w). NOTE: I'm using the program RegExr to test my regex before I port it to Java.

    Read the article

  • R: How to pass a list of selection expressions (strings in this case) to the subset function?

    - by John
    Here is some example data: data = data.frame(series = c("1a", "1b", "1e"), reading = c(0.1, 0.4, 0.6)) > data series reading 1 1a 0.1 2 1b 0.4 3 1e 0.6 Which I can pull out selective single rows using subset: > subset (data, series == "1a") series reading 1 1a 0.1 And pull out multiple rows using a logical OR > subset (data, series == "1a" | series == "1e") series reading 1 1a 0.1 3 1e 0.6 But if I have a long list of series expressions, this gets really annoying to input, so I'd prefer to define them in a better way, something like this: series_you_want = c("1a", "1e") (although even this sucks a little) and be able to do something like this, subset (data, series == series_you_want) The above obviously fails, I'm just not sure what the best way to do this is?

    Read the article

  • How to use regular expressions to pull a substring? (screen scraping)

    - by Diego
    Hey guys, i'm really trying to understand regular expressions while scraping a site, i've been using it in my code enough to pull the following, but am stuck here. I need to quickly grab this: http://www.example.com/online/store/TitleDetail?detail&sku=123456789 from this: ('<a href="javascript:if(handleDoubleClick(this.id)){window.location=\'http://www.example.com/online/store/TitleDetail?detail&sku=123456789\';}" id="getTitleDetails_123456789">\r\n\t\t\t \tcheck store inventory\r\n\t\t\t </a>', 1) This is where I got confused. any ideas?

    Read the article

  • Microsoft expressions ... How its different from visual studio ?

    - by Xinus
    I heard just Microsoft Expressions studio from my project manager and he told me to explore on it and find out if we can do development faster using it as compared to vs2008, I started downloading trial version and started googling about it, but I couldn't find answers to following questions Why Microsoft came out with new IDE when they already have very successful one i.e. the visual studio ? How its different that visual studio ? Does it offer advantages over visual studio ? Can somebody please help me find out these answers ?

    Read the article

  • So, I guess I can't use "&&" in the Python if conditional. Any help?

    - by Sergio Tapia
    Here's my code: # F. front_back # Consider dividing a string into two halves. # If the length is even, the front and back halves are the same length. # If the length is odd, we'll say that the extra char goes in the front half. # e.g. 'abcde', the front half is 'abc', the back half 'de'. # Given 2 strings, a and b, return a string of the form # a-front + b-front + a-back + b-back def front_back(a, b): # +++your code here+++ if len(a) % 2 == 0 && len(b) % 2 == 0: return a[:(len(a)/2)] + b[:(len(b)/2)] + a[(len(a)/2):] + b[(len(b)/2):] else: #todo! Not yet done. :P return I'm getting an error in the IF conditional. What am I doing wrong?

    Read the article

  • Can we use Resource Expressions in javascript and other parts except Literal?

    - by balexandre
    The Literal control works all the time <asp:Literal ID="Literal7" runat="server" Text="<%$ Resources:ErrorMessages, errorCompanyNotFound %>" /> But if I want to use this as a parameter in an image, like <img src="blahblah" alt="" title"<%$ Resources:ErrorMessages, errorCompanyNotFound %>" /> It gives the annoying error Literal expressions like '' are not allowed. Use instead. Same happens if I try to access it through Javascript var noHit = '<%$ Resources:ErrorMessages, errorCompanyNotFound %>'; Does anyone had any idea how can I fetch the Global Resource value under this circumstances?

    Read the article

  • What types of conditions can be used for conditional compilation in C++?

    - by user1002288
    This is an exam question for C++: Which of the following statements accurately describe the condition that can be used for conditional compilation in C++? A. The condition can depend on the value of environment variables. B. The condition can depend on the value of any const variables. C. The condition can depend on the value of program variables. D. The condition can use the sizeof() operator to make decision about compiler-dependent operations based on the size of standard data type. E. The condition must evaluate to either a 0 or 1 during preprocessing. I think the answer is E. Is this correct?

    Read the article

  • SSIS Technique to Remove/Skip Trailer and/or Bad Data Row in a Flat File

    - by Compudicted
    I noticed that the question on how to skip or bypass a trailer record or a badly formatted/empty row in a SSIS package keeps coming back on the MSDN SSIS Forum. I tried to figure out the reason why and after an extensive search inside the forum and outside it on the entire Web (using several search engines) I indeed found that it seems even thought there is a number of posts and articles on the topic none of them are employing the simplest and the most efficient technique. When I say efficient I mean the shortest time to solution for the fellow developers. OK, enough talk. Let’s face the problem: Typically a flat file (e.g. a comma delimited/CSV) needs to be processed (loaded into a database in most cases really). Oftentimes, such an input file is produced by some sort of an out of control, 3-rd party solution and would come in with some garbage characters and/or even malformed/miss-formatted rows. One such example could be this imaginary file: As you can see several rows have no data and there is an occasional garbage character (1, in this example on row #7). Our task is to produce a clean file that will only capture the meaningful data rows. As an aside, our output/target may be a database table, but for the purpose of this exercise we will simply re-format the source. Let’s outline our course of action to start off: Will use SSIS 2005 to create a DFT; The DFT will use a Flat File Source to our input [bad] flat file; We will use a Conditional Split to process the bad input file; and finally Dump the resulting data to a new [clean] file. Well, only four steps, let’s see if it is too much of work. 1: Start the BIDS and add a DFT to the Control Flow designer (I named it Process Dirty File DFT): 2, and 3: I had added the data viewer to just see what I am getting, alas, surprisingly the data issues were not seen it:   What really is the key in the approach it is to properly set the Conditional Split Transformation. Visually it is: and specifically its SSIS Expression LEN([After CS Column 0]) > 1 The point is to employ the right Boolean expression (yes, the Conditional Split accepts only Boolean conditions). For the sake of this post I re-named the Output Name “No Empty Rows”, but by default it will be named Case 1 (remember to drag your first column into the expression area)! You can close your Conditional Split now. The next part will be crucial – consuming the output of our Conditional Split. Last step - #4: Add a Flat File Destination or any other one you need. Click on the Conditional Split and choose the green arrow to drop onto the target. When you do so make sure you choose the No Empty Rows output and NOT the Conditional Split Default Output. Make the necessary mappings. At this point your package must look like: As the last step will run our package to examine the produced output file. F5: and… it looks great!

    Read the article

  • GUI for watching logs (tail and grep)

    - by Grzegorz Oledzki
    Could you recommend a GUI application with powerful log watching capabilities? Generally it would work as tail -f in GUI, but on top of that following features would be very useful: filtering out some lines based on (regular) expressions coloring some lines based on (regular) expressions interactive search saveable configuration easily applicable to different files notifications based on (regular) expressions A similar tool on Windows is BareTail and its paid version - BareTailPro

    Read the article

  • GUI for watching logs (tail and grep)

    - by Grzegorz Oledzki
    Could you recommend a GUI application with powerful log watching capabilities? Generally it would work as tail -f in GUI, but on top of that following features would be very useful: filtering out some lines based on (regular) expressions coloring some lines based on (regular) expressions interactive search saveable configuration easily applicable to different files notifications based on (regular) expressions A similar tool on Windows is BareTail and its paid version - BareTailPro

    Read the article

  • Linq PredicateBuilder with conditional AND, OR and NOT filters.

    - by richeym
    We have a project using LINQ to SQL, for which I need to rewrite a couple of search pages to allow the client to select whether they wish to perform an and or an or search. I though about redoing the LINQ queries using PredicateBuilder and have got this working pretty well I think. I effectively have a class containing my predicates, e.g.: internal static Expression<Func<Job, bool>> Description(string term) { return p => p.Description.Contains(term); } To perform the search i'm doing this (some code omitted for brevity): public Expression<Func<Job, bool>> ToLinqExpression() { var predicates = new List<Expression<Func<Job, bool>>>(); // build up predicates here if (SearchType == SearchType.And) { query = PredicateBuilder.True<Job>(); } else { query = PredicateBuilder.False<Job>(); } foreach (var predicate in predicates) { if (SearchType == SearchType.And) { query = query.And(predicate); } else { query = query.Or(predicate); } } return query; } While i'm reasonably happy with this, I have two concerns: The if/else blocks that evaluate a SearchType property feel like they could be a potential code smell. The client is now insisting on being able to perform 'and not' / 'or not' searches. To address point 2, I think I could do this by simply rewriting my expressions, e.g.: internal static Expression<Func<Job, bool>> Description(string term, bool invert) { if (invert) { return p => !p.Description.Contains(term); } else { return p => p.Description.Contains(term); } } However this feels like a bit of a kludge, which usually means there's a better solution out there. Can anyone recommend how this could be improved? I'm aware of dynamic LINQ, but I don't really want to lose LINQ's strong typing.

    Read the article

  • Selectively replacing words outside of tags using regular expressions in PHP?

    - by Gary Willoughby
    I have a paragraph of text and i want to replace some words using PHP (preg_replace). Here's a sample piece of text: This lesson addresses rhyming [one]words and ways[/one] that students may learn to identify these words. Topics include learning that rhyming words sound alike and these sounds all come from the [two]ending of the words[/two]. This can be accomplished by having students repeat sets of rhyming words so that they can say them and hear them. The students will also participate in a variety of rhyming word activities. In order to demonstrate mastery the students will listen to [three]sets of words[/three] and tell the teacher if the words rhyme or not. If you notice there are many occurances of the word 'words'. I want to replace all the occurances that don't occur inside any of the tags with the word 'birds'. So it looks like this: This lesson addresses rhyming [one]words and ways[/one] that students may learn to identify these birds. Topics include learning that rhyming birds sound alike and these sounds all come from the [two]ending of the words[/two]. This can be accomplished by having students repeat sets of rhyming birds so that they can say them and hear them. The students will also participate in a variety of rhyming word activities. In order to demonstrate mastery the students will listen to [three]sets of words[/three] and tell the teacher if the birds rhyme or not. Would you use regular expressions to accomplish this? Can a regular expression accomplish this?

    Read the article

  • How can I factor out repeated expressions in an SQL Query? Column aliases don't seem to be the ticke

    - by Weston C
    So, I've got a query that looks something like this: SELECT id, DATE_FORMAT(CONVERT_TZ(callTime,'+0:00','-7:00'),'%b %d %Y') as callDate, DATE_FORMAT(CONVERT_TZ(callTime,'+0:00','-7:00'),'%H:%i') as callTimeOfDay, SEC_TO_TIME(callLength) as callLength FROM cs_calldata WHERE customerCode='999999-abc-blahblahblah' AND CONVERT_TZ(callTime,'+0:00','-7:00') >= '2010-04-25' AND CONVERT_TZ(callTime,'+0:00','-7:00') <= '2010-05-25' If you're like me, you probably start thinking that maybe it would improve readability and possibly the performance of this query if I wasn't asking it to compute CONVERT_TZ(callTime,'+0:00','-7:00') four separate times. So I try to create a column alias for that expression and replace further occurances with that alias: SELECT id, CONVERT_TZ(callTime,'+0:00','-7:00') as callTimeZoned, DATE_FORMAT(callTimeZoned,'%b %d %Y') as callDate, DATE_FORMAT(callTimeZoned,'%H:%i') as callTimeOfDay, SEC_TO_TIME(callLength) as callLength FROM cs_calldata WHERE customerCode='5999999-abc-blahblahblah' AND callTimeZoned >= '2010-04-25' AND callTimeZoned <= '2010-05-25' This is when I learned, to quote the MySQL manual: Standard SQL disallows references to column aliases in a WHERE clause. This restriction is imposed because when the WHERE clause is evaluated, the column value may not yet have been determined. So, that approach would seem to be dead in the water. How is someone writing queries with recurring expressions like this supposed to deal with it?

    Read the article

  • How do I use .htaccess conditional redirects for multiple domains?

    - by John
    I'm managing about 15 or so domains for a particular promotion. Each domain has specific redirects in place, as shown below. Rather than make 15 different .htaccess files that I would later have to manage separately, I'd like to use a single .htaccess file and use a symbolic link into each website's directory. The trouble is that, I can't figure out how to make the rules apply only for a specific domain. Every time I visit www.redirectsite2.com, it sends me to www.targetsite.com/search.html?state=PA&id=75, when it should instead be sending me to www.targetsite.com/search.html?state=NJ&id=68. How exactly do I make multiple RewriteRules apply for a given domain and only that domain? Is this even possible to do within a single .htaccess file? Options +FollowSymlinks # redirectsite1.com RewriteEngine On RewriteBase / # start processing rules for www.redirectsite1.com RewriteCond %{QUERY_STRING} ^$ RewriteCond %{HTTP_HOST} ^www\.redirectsite1\.com$ # rule for organic visit first RewriteRule ^$ http://targetsite.com/search.html?state=PA&id=75 [QSA,R,L] RewriteRule ^PGN$ http://targetsite.com/search.html?state=PA&id=26 [QSA,R,NC,L] RewriteRule ^NS$ http://targetsite.com/search.html?state=PA&id=27 [QSA,R,NC,L] RewriteRule ^INQ$ http://targetsite.com/search.html?state=PA&id=28 [QSA,R,NC,L] RewriteRule ^AA$ http://targetsite.com/search.html?state=PA&id=29 [QSA,R,NC,L] RewriteRule ^PI$ http://targetsite.com/search.html?state=PA&id=30 [QSA,R,NC,L] RewriteRule ^GV$ http://targetsite.com/search.html?state=PA&id=31 [QSA,R,NC,L] # catch-all rule, using the same id as the organic visit RewriteRule ^([a-z]+)?$ http://targetsite.com/search.html?state=PA&id=75 [QSA,R,NC,L] # end processing rules for www.redirectsite1.com # begin rules for redirectsite2.com RewriteCond %{QUERY_STRING} ^$ RewriteCond %{HTTP_HOST} ^www\.redirectsite2\.com$ # rule for organic visit first RewriteRule ^$ http://targetsite.com/search.html?state=NJ&id=68 [QSA,R,L] RewriteRule ^SL$ http://targetsite.com/search.html?state=NJ&id=6 [QSA,R,NC,L] RewriteRule ^APP$ http://targetsite.com/search.html?state=NJ&id=8 [QSA,R,NC,L] # catch-all rule, using the same id as the organic visit RewriteRule ^([a-z]+)?$ http://targetsite.com/search.html?state=NJ&id=68 [QSA,R,NC,L] Thanks for any help you may be able to provide!

    Read the article

< Previous Page | 33 34 35 36 37 38 39 40 41 42 43 44  | Next Page >