Search Results

Search found 6715 results on 269 pages for 'preg match'.

Page 117/269 | < Previous Page | 113 114 115 116 117 118 119 120 121 122 123 124  | Next Page >

  • Why isn't this simple MySQL statement working?

    - by Clark
    I am trying to match a user inputted search term against two tables: posts and galleries. The problem is the union all clause isn't working. Is there something wrong with my code? $query = mysql_query(" SELECT * FROM posts WHERE title LIKE '%$searchTerm%' OR author LIKE '%$searchTerm%' OR location LIKE '%$searchTerm%' OR excerpt LIKE '%$searchTerm%' OR content LIKE '%$searchTerm%' UNION ALL SELECT * FROM galleries WHERE title LIKE '%$searchTerm%' ");

    Read the article

  • Form filter in symfony: imposible when a field is type "date"

    - by user248959
    Hi, anyone has tried to create a symfony form filter from a class which has a field of type "date" ? When i do it, i get this error: 500 | Internal Server Error | Doctrine_Connection_Mysql_Exception SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens stack trace I think the error dependens on this command: 'SELECT b.id AS b_id, b.day AS b_day FROM birthday b WHERE b.day = ? AND b.day <= ?', array('month' = '1','day' = '2', 'year' = '2014') but i dont know how can i solve it.. Any idea? Javi

    Read the article

  • postgres subquery w/ derived column

    - by Wells
    The following query won't work, but it should be clear what I'm trying to do: split the value of 't' on space and use the last element in that array in the subquery (as it will match tl). Any ideas how to do this? Thanks! SELECT t, y, "type", regexp_split_to_array(t, ' ') as t_array, sum(dr), ( select uz from f.tfa where tl = t_array[-1] ) as uz, sc FROM padres.yd_fld WHERE y = 2010 AND pos <> 0 GROUP BY t, y, "type", sc;

    Read the article

  • What is user gcc's purpose in requesting code possibly like this?

    - by James Morris
    In the question between syntax, are there any equal function the user gcc is requesting only what I can imagine to be the following code: #include <stdio.h> #include <string.h> /* estimated magic values */ #define MAXFUNCS 8 #define MAXFUNCLEN 3 int the_mainp_compare_func(char** mainp) { char mainp0[MAXFUNCS][MAXFUNCLEN] = { 0 }; char mainp1[MAXFUNCS][MAXFUNCLEN] = { 0 }; char* psrc, *pdst; int i = 0; int func = 0; psrc = mainp[0]; printf("scanning mainp[0] for functions...\n"); while(*psrc) { if (*psrc == '\0') break; else if (*psrc == ',') ++psrc; else { mainp0[func][0] = *psrc++; if (*psrc == ',') { mainp0[func][1] = '\0'; psrc++; } else if (*psrc !='\0') { mainp0[func][1] = *psrc++; mainp0[func][2] = '\0'; } printf("function: '%s'\n", mainp0[func]); } ++func; } printf("\nscanning mainp[1] for functions...\n"); psrc = mainp[1]; func = 0; while(*psrc) { if (*psrc == '\0') break; else if (*psrc == ',') ++psrc; else { mainp1[func][0] = *psrc++; if (*psrc == ',') { mainp1[func][1] = '\0'; psrc++; } else if (*psrc !='\0') { mainp1[func][1] = *psrc++; mainp1[func][2] = '\0'; } printf("function: '%s'\n", mainp1[func]); } ++func; } printf("\ncomparing functions in '%s' with those in '%s'\n", mainp[0], mainp[1] ); int func2; func = 0; while (*mainp0[func] != '\0') { func2 = 0; while(*mainp1[func2] != '\0') { printf("comparing %s with %s\n", mainp0[func], mainp1[func2]); if (strcmp(mainp0[func], mainp1[func2++]) == 0) return 1; /* not sure what to return here */ } ++func; } /* no matches == failure */ return -1; /* not sure what to return on failure */ } int main(int argc, char** argv) { char* mainp[] = { "P,-Q,Q,-R", "R,A,P,B,F" }; if (the_mainp_compare_func(mainp) == 1) printf("a match was found, but I don't know what to do with it!\n"); else printf("no match found, and I'm none the wiser!\n"); return 0; } My question is, what is it's purpose?

    Read the article

  • What should be the RegEx if I want to find the text between the phrases " IF (NEW." and " !"?

    - by Parth
    What should be the RegEx if I want to find the text between the phrases " IF (NEW." and " !"? Likewise I am thinking of the pattern as $pattern = '/(?<= IF (NEW.)[^ !]+/'; I am matching it as $input = $row4['ACTION_STATEMENT']; preg_match_all($pattern, $input, $captures); What if I want $captures as an array, in which all values will be stored which will match with above pattern being in between of this pattern?

    Read the article

  • Can the .NET MethodInfo cache be cleared or disabled?

    - by Anton
    Per MSDN, calling Type.GetMethods() stores reflected method information in a MemberInfo cache so the expensive operation doesn't have to be performed again. I have an application that scans assemblies/types, looking for methods that match a given specification. The problem is that memory consumption increases significantly (especially with large numbers of referenced assemblies) since .NET hangs onto the method metadata. Is there any way to clear or disable this MemberInfo cache?

    Read the article

  • How can I serve up color-coded Java code using PHP?

    - by Eric
    I'd like to embed code from my SVN repository into my website, using PHP. The SVN has public anonymous access, so the PHP code should be fine reading it. The code on said SVN is java, and so far I've had no luck finding a syntax-highlighter to make the code more readable. Ideally I'd like one that uses CSS classes so that I can change the colors to match the look of the website. Could someone point me to a PHP library that highlights Java code?

    Read the article

  • Finding all CLASSPATH resources matching a pattern

    - by binil
    I want to read a bunch of text files, by loading them as resources using the context classloader. URL url = Thread.currentThread() .getContextClassloader() .getResource("folder/foo.txt"); Is there some way to get a list of resources whose names match a given pattern? For eg: URL[] matchingUrls = someLibrary.getMatchingResources("folder/*.txt"); Libraries like Spring can scan the classpath to find classes with a given annotation, so I am wondering if there something similar to load a bunch of resources.

    Read the article

  • Design pattern suggestion

    - by Avinash
    Following is the problem statement. There are n numbers of match strings, If event A occurs and then in certain period of time event B occurs then I do not raise alarm. but if B do not occurs then i have to raise alarm. There can be multiple chain of events which defines whether to raise alarm or not.

    Read the article

  • Unusual Template Behavior with XSL

    - by bobber205
    Experiencing some very odd behavior with, what should be, a very simple use of XSL and XSLT. Here's a code sample. <xsl:template match="check"> <div class="check"> <xsl:apply-templates mode="check"> <xsl:with-param name="checkName">testVariable</xsl:with-param> </xsl:apple-templates> </div> </xsl:template> The template called above <xsl:template match="option" mode="check"> <xsl:param name="checkName" /> <div class="option"> <input type="checkbox"> </input> <label> testText </label> </div> </xsl:template> Pretty simple right? It should, for each instance of a instance in the XML create a checkbox in a with a hard coded label. However, what I'm getting is <div class="check"></div> <div class="option>Checkbox stuff here</div> <div class="option>Checkbox stuff here</div> <div class="option>Checkbox stuff here</div> <div class="option>Checkbox stuff here</div> <div class="check"></div> <div class="option>Checkbox stuff here</div> <div class="option>Checkbox stuff here</div> <div class="option>Checkbox stuff here</div> <div class="option>Checkbox stuff here</div> Here's some sample XML <check><option key="1"/><option key="0"/><option key="0"/><option key="0"/><option key="0"/></check> Anyone know what's going on? :D

    Read the article

  • patterns in case statement in bash scripting

    - by Ramiro Rela
    The man says that case statements use "filename expansion pattern matching". I usually want to have short names for some parameters, so I go: case $1 in req|reqs|requirements) TASK="Functional Requirements";; met|meet|meetings) TASK="Meetings with the client";; esac logTimeSpentIn "$TASK" I tried patterns like "req*" or "me{e,}t" which I understand would expand correctly to match those values in the context of filename expansion, but it doesn't work. Thanks.

    Read the article

  • Fastest way to get array of NSRange objects for all uppercase letters in an NSString?

    - by Bama91
    I need NSRange objects for the position of each uppercase letter in a given NSString for input into a method for a custom attributed string class.  There are of course quite a few ways to accomplish this such as rangeOfString:options: with NSRegularExpressionSearch or using RegexKitLite to get each match separately while walking the string.  What would be the fastest performing approach to accomplish this task?

    Read the article

  • Using a large list of terms, search through page text and replace words with links

    - by dunc
    A while ago I posted this question asking if it's possible to convert text to HTML links if they match a list of terms from my database. I have a fairly huge list of terms - around 6000. The accepted answer on that question was superb, but having never used XPath, I was at a loss when problems started occurring. At one point, after fiddling with code, I somehow managed to add over 40,000 random characters to our database - the majority of which required manual removal. Since then I've lost faith in that idea and the more simple PHP solutions simply weren't efficient enough to deal with the amount of data and the quantity of terms. My next attempt at a solution is to write a JS script which, once the page has loaded, retrieves the terms and matches them against the text on a page. This answer has an idea which I'd like to attempt. I would use AJAX to retrieve the terms from the database, to build an object such as this: var words = [ { word: 'Something', link: 'http://www.something.com' }, { word: 'Something Else', link: 'http://www.something.com/else' } ]; When the object has been built, I'd use this kind of code: //for each array element $.each(words, function() { //store it ("this" is gonna become the dom element in the next function) var search = this; $('.message').each( function() { //if it's exactly the same if ($(this).text() === search.word) { //do your magic tricks $(this).html('<a href="' + search.link + '">' + search.link + '</a>'); } } ); } ); Now, at first sight, there is a major issue here: with 6,000 terms, will this code be in any way efficient enough to do what I'm trying to do?. One option would possibly be to perform some of the overhead within the PHP script that the AJAX communicates with. For instance, I could send the ID of the post and then the PHP script could use SQL statements to retrieve all of the information from the post and match it against all 6,000 terms.. then the return call to the JavaScript could simply be the matching terms, which would significantly reduce the number of matches the above jQuery would make (around 50 at most). I have no problem with the script taking a few seconds to "load" on the user's browser, as long as it isn't impacting their CPU usage or anything like that. So, two questions in one: Can I make this work? What steps can I take to make it as efficient as possible? Thanks in advance,

    Read the article

  • update variable after success of ajax function

    - by Scarface
    Hey guys quick question, I am sending a request with the jquery ajax function with a variable. After the request I want that variable updated to match the value of the sent back information, so next time the ajax function executes, it send the value of the new variable. $.ajax({ type: "POST", data: "countusers=" + countusers, url: "tester.php", dataType: 'json', success: function(json) { var countusers=json.rownumber; } } })

    Read the article

  • Python sort strings started with digits

    - by vlad
    I have the next list: a = ['1th Word', 'Another Word', '10th Word'] print a.sort() >>> ['10th Word', '1th Word', 'Another Word'] But I need: ['1th Word', '10th Word','Another Word'] Is there an easy way to do this? I tried: r = re.compile(r'(\d+)') def sort_by_number(s): m = r.match(s) return m.group(0) x.sort(key=sort_by_number) But some strings do not have numbers and this leads to an errors. Thanks.

    Read the article

  • Linear gradients library

    - by Lieven Cardoen
    Is there a place online where I can find like 16 linear gradients that match good with each other? I need them for a chart of mine and the ones generated (by Flex) aren't good enough. So, I'm kind off searching for a library of gradients (linear in my case).

    Read the article

  • WAS hosting of queues

    - by user80855
    I read that when hosting a queue endpoint all these names need to match: Hosted in IIS at: http://localhost/MyService.svc service endpoint address: http://localhost/private/MyService.svc queue: .\private$\MyService.svc So I wonder, how can you host a service with multiple endpoints to different queues? For example a service that is listening to two queues… (using two endpoints).

    Read the article

  • extract word with regular expression

    - by farka
    I have a string 1/temperatoA,2/CelcieusB!23/33/44,55/66/77 and I would like to extract the words temperatoA and CelcieusB. I have this regular expression (\d+/(\w+),?)*! but I only get the match 1/temperatoA,2/CelcieusB! Why?

    Read the article

  • Select statement to check multiple rows against 2 variables

    - by Duncan Cook
    I have the following table : alertID inspectorID datelive dateread 1 none 2012-11-06 10:36:03.350 NULL 2 none 2012-11-06 10:36:25.043 NULL 3 none 2012-11-06 10:36:42.433 NULL 1 31030 2012-11-06 10:37:19.193 2012-06-11 10:34:47.000 I want to select the alerts that dont have the inspectors ID against it AND where the alert ID doenst match the one that has the inspectorID against it, ie inspector has read alert 1 so i only want it to return alerts 2 & 3 Am using Classic ASP and MS-SQL Cheers

    Read the article

  • getting Url in the call back function of WebRequesting

    - by Stacker
    lets say i have a web request: WebRequest webRequest = WebRequest.Create(Url); webRequest.BeginGetResponse(this.RespCallback, webRequest); now is there is any way to do retierve the URL in private void RespCallback(IAsyncResult asynchronousResult) { // here } the idea is i want to provide a squence id in the url while doing webrequest and then reterive it on the call back and match it to know that this call back is from that request. any idea?

    Read the article

< Previous Page | 113 114 115 116 117 118 119 120 121 122 123 124  | Next Page >