Search Results

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

Page 179/269 | < Previous Page | 175 176 177 178 179 180 181 182 183 184 185 186  | Next Page >

  • Question in Flex (parser)

    - by shkk
    Hello... I want to ask you a question about Flex, the program for parsing code. Supposing I have an instruction like this one, in the rules part: "=" BEGIN(attribution); <attribution>{var_name} { fprintf(yyout, "="); ECHO; } <attribution>";" BEGIN(INITIAL); {var_name} is a regular expression that matches a variable's name, and all I want to do is to copy at the output all the attribution instructions, such as a = 3; or b = a; My rule though cannot write with fprintf the left member of the attribution, but only = 3; or =a; One solution for that might be that, after I make the match "=" and I am in the attribution state, to go 2 positions back as to get the left operand as well. How can I do that in Flex?

    Read the article

  • parallel.foreach with custom collection

    - by SchwartzE
    I am extending the System.Net.Mail.MailAddress class to include an ID field, so I created a new custom MailAddress class that inherited from the existing class and a new custom MailAddressCollection class. I then overrode the existing System.Net.Mail.MailMessage.To to use my new collection. I would like to process the recipients in parallel, but I can't get the syntax right. This is the syntax I am using. Parallel.ForEach(EmailMessage.To, (MailAddress address) => { emailService.InsertRecipient(emailId, address.DisplayName, address.Address, " "); }); I get the following errors: The best overloaded method match for 'System.Threading.Tasks.Parallel.ForEach(System.Collections.Generic.IEnumerable, System.Action)' has some invalid arguments Argument 1: cannot convert from 'EmailService.MailAddressCollection' to 'System.Collections.Generic.IEnumerable' What syntax do I need to use custom collections?

    Read the article

  • autocomplete-like feature with a python dict

    - by tipu
    In PHP, I had this line matches = preg_grep('/^for/', array_keys($hash)); What it would do is it would grab the words: fork, form etc. that are in $hash. In Python, I have a dict with 400,000 words. It's keys are words I'd like to present in an auto-complete like feature (the values in this case are meaningless). How would I be able to return the keys from my dictionary that match the input? For example (as used earlier), if I have my_dic = t{"fork" : True, "form" : True, "fold" : True, "fame" : True} and I get some input "for", It'll return a list of "fork", "form", "fold"

    Read the article

  • How can I parse free text (Twitter tweets) against a large database of values?

    - by user136416
    Hi there Suppose I have a database containing 500,000 records, each representing, say, an animal. What would be the best approach for parsing 140 character tweets to identify matching records by animal name? For instance, in this string... "I went down to the woods to day and couldn't believe my eyes: I saw a bear having a picnic with a squirrel." ... I would like to flag up the words "bear" and "squirrel", as they appear in my database. This strikes me as a problem that has probably been solved many times, but from where I'm sitting it looks prohibitively intensive - iterating over every db record checking for a match in the string is surely a crazy way to do it. Can anyone with a comp sci degree put me out of my misery? I'm working in C# if that makes any difference. Cheers!

    Read the article

  • Maven + Java package declaration

    - by Vasan
    We have a Maven project (packaged as JAR) with Java files. A new Java source file was recently added to this project. The path in which the Java file was added, does not match its package declaration. As expected, Eclipse shows an error in the class for the mismatch. However, Maven builds the project just fine. In the generated JAR file, the .class file is present in the path indicated by the package declaration. We tried moving the Java source file to other incorrect folders (i.e. different from the package declaration), but every time Maven builds the project fine. So, does Maven ignore the actual directory in which the .java file is present? Does it only consider package declaration?

    Read the article

  • IE Hanging on jQuery code

    - by OrangeRind
    Here's another clichéd problem, but I couldn't find an exact match to this. I haven't posted any source here, as you can freely see all that is there on the link. :-) Statement:I have a web page at http://agrimgupta.com/antaragni/ Disclaimer: Pardon me for the pathetic coding on that page. ;-) It was done on a very short interval. Improvements will be done at a later stage. Observation: This page is functioning normally on my localhost on all browsers. Problem: IE 8 is crawling (nearly hanging) while loading this page from the website. Although it is working fine on localhost. When on the website, It fails to render the mouseover effects, doing them in almost what seems like a minute. Question: How to resolve this stuck up of IE? It is necessary to resolve this. Thanks in Advance

    Read the article

  • WPF: Set style on immediate children only

    - by ollifant
    In my application I have a tab control which has several tab items. The problem is that I want to apply a style to these tab items, but to no other (nested) tab items. I have tried setting the following style on the tab control, but this also effects all children: <Style x:Key="tabControlStyle" TargetType="{x:Type TabControl}"> <Setter Property="TabItem.Template" Value="{StaticResource tabItemTemplate}" /> </Style> By using the code above I get the following error: 'TabItem' ControlTemplate TargetType does not match templated type 'TabControl', as TabItem and TabControl have the same DependencyProperty "Template", and the code tries to set the TabItemTemplate as TabControl- Template. Can anybody help me?

    Read the article

  • git - how do I clone into a non-empty directory?

    - by shovas
    I have directory A with files matching directory B. Directory A may have other needed files. Directory B is a git repo. I want to clone directory B to directory A but git-clone won't allow me to since the directory is non-empty. I was hoping it would just clone .git and since all the files match I could go from there? I can't clone into an empty directory because I have files in directory A that are not in directory B and I want to keep them. Copying .git is not an option since I want refs to push/pull with and I don't want to set them up manually. Is there any way to do this? Update: I think this works, can anyone see any problems? -- cd a git clone --no-hardlinks --no-checkout ../b a.tmp mv a.tmp/.git . rm -rf a.tmp git unstage # apparently git thinks all the files are deleted if you don't do this

    Read the article

  • Comparing an array of users to an array of structs with user object as attribute, and returning matc

    - by keruilin
    I have an array of users who are friends. Let us call this array: friends I then have an array of structs. Each struct has a user object as an attribute (it also has a rank attribute). Here's what the struct class looks like, to add some context: class Leader < Struct.new(:rank, :user); end Let us call this array of structs: all_leaders_plus_rank I want to compare friends and all_leaders_plus_rank, and add the match from all_leaders_plus_rank to a new array of structs called friendly_leaders.

    Read the article

  • css to replace characters in paragraph tag

    - by Thariama
    Already checked exisitng questions for this, but didn't find an exact match. My aim is to replace characters (like spaces) on a webpage with a small image using css. Example: <p><span>This is a text</span></p> becomes: <p><span>ThisIMGisIMGaIMGtext</span></p> (where IMG stands for a visible image (middot-pic for a space f.e.)) I cannot think of a suitable css selector. But myabe one of you guys (or girls) know a solution. Is this possible at all?

    Read the article

  • How to combine Option values in Scala?

    - by Jeff
    Hi! I want to be able to apply an operation f: (T,T) => T to two Option[T] values in Scala. I want the result to be None if any of the two values is None. More specifically, I want to know if is there a shorter way to do the following: def opt_apply[T](f: (T,T) => T, x: Option[T], y: Option[T]): Option[T] = { (x,y) match { case (Some(u),Some(v)) => Some(f(u,v)) case _ => None } } I have tryied (x zip y) map {case (u,v) => f(u,v)} but the result is an Iterator[T] not an Option[T]. Any help will be appreciated. Thanks.

    Read the article

  • Neural network input data, cartesian plane x/y coordinates, correlate with Handwriting.

    - by Sam
    I very curious about making a handwriting recognition application in a web browser. Users draw a letter, ajax sends the data to the server, neural network finds the closest match, and returns results. So if you draw an a, the first result should be an a, then o, then e, something like that. I'm don't know much about neural networks. What kinda data would I need to pass to the NN. Could it be an array of the x/y coordinates where the user has drawn on a pad. Or what type of data is the neural network expecting or would produce the best results for handwriting?

    Read the article

  • Find first cell in a row that contains a number?

    - by Dexter
    I'm working in Excel with an exported table such as this: |-------------------------------------------------------------------------------| | | A | B | C | D | E | F | G | H | I | |---|-------------------|-----|-----|-----|-----|-----|-------|-----|-----------| | 1 | Domain | JAN | FEB | MAR | APR | MAY | Start | End | Change | |---|-------------------|-----|-----|-----|-----|-----|-------|-----|-----------| | 2 | www.mydomain1.com | | 1 | 4 | 3 | 1 | 1 | 1 | 0 | |---|-------------------|-----|-----|-----|-----|-----|-------|-----|-----------| | 3 | www.mydomain2.com | 2 | 4 | 12 | 18 | 23 | 2 | 23 | 21 | |---|-------------------|-----|-----|-----|-----|-----|-------|-----|-----------| | 4 | www.mydomain3.com | | | 14 | 12 | | 14 | xxx | NOT FOUND | |-------------------------------------------------------------------------------| I'm trying to compare the current state (last cell) to the original cell (first cell with a value). In column I, I have the formula =IF(G2 = "xxx", "NOT FOUND", IF(H2 = "xxx", "NOT FOUND", H2 - G2)) In column H, I have the formula =IF(F2 = "", "xxx", F2) In column G, I need to find the first cell with a number. If there isn't one in that range, I need G to be "xxx". I suppose I only need to check for the first cell in the range (B2 to F2) that contains a value, not just a number. I tried using an Index and Match combo, but I couldn't quite understand it.

    Read the article

  • How to use multiple restrictions in C# Generics properly?

    - by plouh
    I am attempting to bind c# generics to a class and an interface like this: public class WizardPage<T> where T : UserControl, IWizardControl { private T page; public WizardPage( T page ) { this.page = page; } } And use it with this: public MyControl : UserControl, IWizardControl { //... } Somehow C# doesn't seem to be able to decide that MyControl is a proper instance of T as public class Wizard<T> where T : UserControl, IWizardControl { private WizardPage<T> Page1; public Wizard( MyControl control ) { this.Page1 = new WizardPage(control); } } fails with error The best overloaded method match for 'Controls.WizardPage.WizardPage(T)' has some invalid arguments Am I doing something wrong or is this just not going to work?

    Read the article

  • How to build our own java custom layout

    - by nguyendat
    Please help me how to creat own custom layout, container, component, layout manager... Example: Containers and Layout Managers Create a window frame. Nest panels within a frame for better layout control. Create and display buttons in a panel. List two component attributes that are controlled by a layout manager. Set the layout manager for a container. Place components in a panel using BorderLayout, GridLayout, and FlowLayout. Name one advantage of each of the layout managers. Create panels with titles. i was search on google but can't find any that match my requirement Thanks for your help

    Read the article

  • How to query for entities with no matching siblings, with LINQ?

    - by Ryan
    I've got the two following entities ... class Citation { public int CitationId { get; set; } public string Identifier { get; set; } } class CitationIdentifier { public int CitationIdentifierId { get; set; } public string Identifier { get; set; } } I'm trying to query for all Citation records where the Identifier property does not match any of the CitationIdentifiers record Identifier property. So, if I have a Citation with an Identifier property containing "foo", but there are no CitationIdentifier records with an Identifier property containing "foo", then I'd like to retrieve that Citation. I'm working with an IDbSet<Citation>. Any ideas? Thanks.

    Read the article

  • jquery loop and compare values

    - by lgt
    Is it possible to use jqueries each loop in this form to dissolve hyperlinks? $(document).ready(function() { var toExclude =['http://www.google.com', 'http://example']; $.each(toExclude, function(key, value) { $("a[href='+value+']").replaceWith(function(){ var url=value; var matches = url.match(/^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i); var domain = matches && matches[1]; return domain; }); }); });

    Read the article

  • How can I pass a type as a parameter in scala?

    - by rsan
    I'm having a really hard time trying to figure out how can I store or pass a type in scala. What I want to achive is something like this: abstract class Foo( val theType : type ) object Foo{ case object Foo1 extends Foo(String) case object Foo2 extends Foo(Long) } So at some point I can do this: theFoo match{ case String => "Is a string" case Long => "Is a long" } and when obtaining the object being able to cast it: theFoo.asInstanceOf[Foo1.theType] Is this possible? If is possible, is a good aproach? What I'm trying to achieve ultimately is writing a pseudo schema for byte stream treatment. E.g if I have an schema Array(Foo1,Foo1,Foo2,Foo3,Foo1) I could parse Arrays of bytes that complain with that schema, if at some point I have a different stream of bytes I could just write a new schema Array(Foo3, Foo4, Foo5) without having to reimplement parsing logic. Regards,

    Read the article

  • how do i get textfield value then combine with regex

    - by klox
    i have this code for get data from textfield: <script type="text/javascript"> var mod=document.getElementById("mod").value; ajax(mod); function callback() { if(ajaxObj(mod) { document.getElementById("divResult").innerHTML=ajaxObj.responseText; }); }; </script> and this one for search character: <script> var str="KD-R435MUN2D"; var matches=str.match(/([EJU]).*(D)/i); if (matches) { var firstletter = matches [1]; var secondletter = matches [2]; var thirdletter = matches [3]; alert(firstletter + secondletter + thirdletter); }else{ alert (":("); } </script> how to combine both?please help...

    Read the article

  • replace \n and \r\n with <br /> in java

    - by Bala R
    This has been asked several times for several languages but I can't get it to work. I have a string like this String str = "This is a string.\nThis is a long string."; And I'm trying to replace the \n with <br /> using str = str.replaceAll("(\r\n|\n)", "<br />"); but the \n is not getting replaced. I tried to use this RegEx Tool to verify and I see the same result. The input string does not have a match for "(\r\n|\n)". What am i doing wrong ?

    Read the article

  • MySQL AND alternative for eatch table in a join

    - by Scott
    I have a simple join in a query however I need to have a condition on both of the tables "confirmed='yes'" but if one of the tables doesn't have any that match the query returns with no rows. Database: .----------parties----------. | id - party_id - confirmed | |---------------------------| | 1 1 yes | | 1 2 no | | 1 3 no | +---------------------------+ .-----------events----------. | id - event_id - confirmed | |---------------------------| | 1 1 no | +---------------------------+ Query: SELECT p.party_id, e.event_id FROM parties p LEFT JOIN events e ON p.id=e.id WHERE p.id = '1' AND p.party_id IN (1,2,3) AND e.event_id IN (1) AND p.confirmed='yes' AND e.confirmed='yes' It returns nothing but I want it to return party_id 1 with a empty event_id. I hope this make sense and I not missing anything, Thanks for your help!

    Read the article

  • Any way to make GetTypes() less brittle.

    - by scope-creep
    I'm iterating through all the types in GAC, GAC_32 and GAC_MSIL looking for specific types, fundamentally to match those using clauses in my source code, so when I compile the source. I'll know exactly what assembly dll's to provide. I'm getting all the file names from each of those directory and applying GetTypes to each assembly in turn and comparing the returned types against my using list. But the problem I have is that GetTypes() keeps crapping out with an exception, when it can't load the types from a loaded assembly. Is their any way to make GetTypes() less brittle. For instance, when parsing this assembly on my box, {blbmmc, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35}, it craps out. Any suggestions welcome. I know this is a fairly lengthly process, but I figure i'll eventually use a subset of common assemblies to search, or possibly cache the list of types-assembly dll name at program start. Thanks.

    Read the article

  • Regular Expression repetition of class

    - by codersarepeople
    I am trying to figure out a regular expression for the following: <tr class="A">.*</tr><tr class="(B|C)">.*</tr> Now The second tr class will repeat an unknown number of times, with something unknown in between repetitions, but simply putting it in parentheses and added a plus doesn't work. Here's the PHP code that didn't work: $pattern = '/<tr\ class=\"A\">.*(<tr\ class=\"(B|C)\">.*<\/tr>.*)+/'; preg_match_all($pattern,$playerHtml,$scores); But it only returns the first Here's an example of something that should match: <tr class="A">blah</tr>blah <tr class="B">blah</tr>blah <tr class="B">blah</tr>blah <tr class="C">blah</tr> This only matches blahblahblah

    Read the article

  • Using a database/index sequential file independently of the Unix distribution

    - by Helper Method
    What I'm planning to do is a) parse a file for some lines matching a regular expression b) store the match in some sort of database / file so I don't have to do the parsing again and again c) call another program passing the matches as arguments While I can imagine how to do a) and c), I'm a little bit unsure about b). The matches are of the form key:attribute1:attribute2:attribute3 where attribute 2 may be optional. I'm thinking of storing the results in a simple database but the problem is the database needs to available on a number of Unix platform for the program to work. Are there any (simple) databases which can be found on any Unix platforms? Or should I use some sort of index-sequential file?

    Read the article

  • Access violation C++ (Deleting items in a vector)

    - by Gio Borje
    I'm trying to remove non-matching results from a memory scanner I'm writing in C++ as practice. When the memory is initially scanned, all results are stored into the _results vector. Later, the _results are scanned again and should erase items that no longer match. The error: Unhandled exception at 0x004016f4 in .exe: 0xC0000005: Access violation reading location 0x0090c000. // Receives data DWORD buffer; for (vector<memblock>::iterator it = MemoryScanner::_results.begin(); it != MemoryScanner::_results.end(); ++it) { // Reads data from an area of memory into buffer ReadProcessMemory(MemoryScanner::_hProc, (LPVOID)(*it).address, &buffer, sizeof(buffer), NULL); if (value != buffer) { MemoryScanner::_results.erase(it); // where the program breaks } }

    Read the article

< Previous Page | 175 176 177 178 179 180 181 182 183 184 185 186  | Next Page >