Search Results

Search found 3176 results on 128 pages for 'parsing'.

Page 53/128 | < Previous Page | 49 50 51 52 53 54 55 56 57 58 59 60  | Next Page >

  • What is the best file format to parse?

    - by anxiety
    Scenario: I'm working on a rails app that will take data entry in the form of uploaded text-based files. I need to parse these files before importing the data. I can choose the file type uploaded to the app; the software used by those uploading has several export options regarding file type. While it may be insignificant, I was wondering if there is a specific file type that is most efficiently parsed. This question can be viewed as language-independent, I believe. (While XML is commonly parsed, it is not a feasible file type for sake of this project.)

    Read the article

  • ANTRL: token to text in rewrite rule

    - by Antonio
    I'm building an AST using ANTLR. I want to write a production that match a this string: ${identifier} so, in my grammar file I have: reference : DOLLAR LBRACE IDENT RBRACE -> ^(NODE_VAR_REFERENCE IDENT) ; This works fine. I'm using my own adaptor to emit tree nodes. The rewrite rule used creates for me two nodes: one for NODE_VAR_REFERENCE and one for IDENT. What I want to do is create only one node (for NODE_VAR_REFERENCE token) and this node must have the IDENT token in his "token" field. Is this possible using a rewrite rule? Thanks.

    Read the article

  • IE: position two text lines on top and bottom corners in table cell?

    - by diggonce
    I have a table with dynamic data. And there is a specific line of text which should be displayed only when a user hovers over the table row. This line of text should be 'fixed' to the table cell's bottom edge. It works so far with Firefox, but fails in IE. Live code can be seen here: http://2010resolutions.org/test/index.html The text in red should be fixed to the table cell's bottom border. (They will have a fixed height and width) Any clues how to get this working in IE? Any help is appreciated. Here's the code: <style> table { width: 500px; background: gray; } td { vertical-align: top; } .wrapper { position: relative; background: green; } tr, td, .wrapper { height: 100%; padding-bottom: 0.75em; } .bottom { position: absolute; left: 0; bottom: 0; background: red; } .bottom { visibility: hidden; } tr:hover .bottom { visibility: visible; } </style> <table> <tr class="data"> <td> <div class="wrapper"> This is line 1<br /> This is line 2<br /> This is line 3<br /> <span class="bottom">Bottom line 1</span> </div> </td> <td> <div class="wrapper"> This is line 4<br /> This is line 5<br /> This is line 6<br /> <span class="bottom">Bottom line 2</span></span> </div> </td> <td> <div class="wrapper"> This is line 7<br /> This is line 8<br /> This is line 9<br /> This is line 10<br /> This is line 11<br /> This is line 12<br /> <span class="bottom">Bottom line 3</span> </div> </td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> </table>

    Read the article

  • how to control textbox type to double in visual basic?

    - by fema
    Hi, I'd like to make a textbox that accepts only numbers, but not integer, but rather double. I've read here about e.Handled = Not Char.IsDigit(e.KeyChar) and it works, but again, it can be used only for integer, since it declines decimal point. Another thing I've read here is If Not Double.TryParse(TextBox2.Text, value) Then .... and it would work fine, except that it allows only decimal comma instead of point. I don't know whether it's because of my location settings (Hungary, we use commas instead of points), but I don't have any other idea how to solve my problem, and the SQL server I send my data uses decimal point. Thanks in advance.

    Read the article

  • Implemeting web-based autocomplete for structured input

    - by ravigad
    I am looking to implement web-based autocomplete for structured commands. So, for example, suppose I was trying to implement a web-based Windows command line with autocomplete, in such a case I would want to suggest all the available commands, then, once a user selects a command, all the options for that command, then if a user enters a switch (say '-' dash or '/' slash) then offer all the switches for that command and all the relevant values that can follow, and so on. All from the same text input box. If you have used version 4.0 of JIRA, I am thinking of something similar to the JQL search input box that they have implemented. I have not managed to find any tutorials that look at this scenario end-to-end (which is a shame, because it would be great to see more applications that do this). What I am looking for is some guidance on the steps needed to implement this solution: Do you have any experience implementing such a solution and if so what components did you use? Would you use a framework such as ANTLR to provide the available options to the end user? If not what would do? Sorry for raising such a general question, but my main problem is working out how the pieces fit together as opposed to, say, how to do autocomplete or how to parse/tokenize an input command...

    Read the article

  • An MP3 parser to extract numbered frames?

    - by Xepoch
    I am writing a streaming application for MP3 (CBR). It is all passthru, meaning I don't have to decode/encode, I just need to pass on the data as I see it come through. I want to be able to count the MP3 frames as they passthru (and some other stuff like throughput calculations). According to the MP3 frame header spec, the sync word appears to be 11 bits of 1s, however I notice (naturally) that the frame payload which I should safely assume to be binary and thus it is not odd at all to see 11 1s in sequence. My questions: Is there a Unix/Linux MP3 parser utility (dd-style) that can pull numbered frames from an MP3 file/pipe? Any perl wisdom here? How does one delineate an MP3 header block from any other binary payload data? and lastly: Is a constant bitrate (CBR) MP3 defined by payload bytes or are the header bytes included in the aggregate # of bytes/bits per any given timeslice? Thanks,

    Read the article

  • JavaCC: How can I specify which token(s) are expected in certain context?

    - by java.is.for.desktop
    Hello, everyone! I need to make JavaCC aware of a context (current parent token), and depending on that context, expect different token(s) to occur. Consider the following pseudo-code: TOKEN <abc> { "abc*" } // recognizes "abc", "abcd", "abcde", ... TOKEN <abcd> { "abcd*" } // recognizes "abcd", "abcde", "abcdef", ... TOKEN <element1> { "element1" "[" expectOnly(<abc>) "]" } TOKEN <element2> { "element2" "[" expectOnly(<abcd>) "]" } ... So when the generated parser is "inside" a token named "element1" and it encounter "abcdef" it recognizes it as <abc>, but when its "inside" a token named "element2" it recognizes the same string as <abcd>. element1 [ abcdef ] // aha! it can only be <abc> element2 [ abcdef ] // aha! it can only be <abcd> If I'm not wrong, it would behave similar to more complex DTD definitions of an XML file. So, how can one specify, in which "context" which token(s) are valid/expected? NOTE: It would be not enough for my real case to define a kind of "hierarchy" of tokens, so that "abcdef" is always first matched against <abcd> and than <abc>. I really need context-aware tokens.

    Read the article

  • Match Anything Except a Sub-pattern

    - by Tim Lytle
    I'd like to accomplish what this (invalid I believe) regular expression tries to do: <p><a>([^(<\/a>)]+?)<\/a></p>uniquestring Essentially match anything except a closing anchor tag. Simple non-greedy doesn't help here because `uniquestring' may very well be after another distant closing anchor tag: <p><a>text I don't <tag>want</tag> to match</a></p>random data<p><a>text I do <tag>want to</tag> match</a></p>uniquestring more matches <p><a>of <tag>text I do</tag> want to match</a></p>uniquestring So I have more tag in between the anchor tags. And I'm using the presence of uniquestring to determine if I want to match the data. So a simple non-greedy ends up matching everything from the start of the data I don't want to the end of the data I do want. I know I'm edging close to the problems regular expressions (or at least my knowledge of them) aren't good at solving. I could just through the data at an HTML/XML parser, but it is just one simple(ish) search. Is there some easy way to do this that I'm just missing?

    Read the article

  • F# ref-mutable vars vs object fields

    - by rwallace
    I'm writing a parser in F#, and it needs to be as fast as possible (I'm hoping to parse a 100 MB file in less than a minute). As normal, it uses mutable variables to store the next available character and the next available token (i.e. both the lexer and the parser proper use one unit of lookahead). My current partial implementation uses local variables for these. Since closure variables can't be mutable (anyone know the reason for this?) I've declared them as ref: let rec read file includepath = let c = ref ' ' let k = ref NONE let sb = new StringBuilder() use stream = File.OpenText file let readc() = c := stream.Read() |> char // etc I assume this has some overhead (not much, I know, but I'm trying for maximum speed here), and it's a little inelegant. The most obvious alternative would be to create a parser class object and have the mutable variables be fields in it. Does anyone know which is likely to be faster? Is there any consensus on which is considered better/more idiomatic style? Is there another option I'm missing?

    Read the article

  • PHP Dom problem, how to insert html code in a particular div

    - by sala_7
    I am trying to replace the html code inside the div 'resultsContainer' with the html of $response. The result of my unsuccessful code is that the contents of 'resultsContainer' remain and the html of $response shows up on screen as text rather than being parsed as html. Finally, I would like to inject the content of $response inside 'resultContainer' without having to create any new div, I need this: <div id='resultsContainer'>Html inside $response here...</div> and NOT THIS: <div id='resultsContainer'><div>Html inside $response here...</div></div> // Set Config libxml_use_internal_errors(true); $doc = new DomDocument(); $doc->strictErrorChecking = false; $doc->validateOnParse = true; // load the html page $app = file_get_contents('index.php'); $doc->loadHTML($app); // get the dynamic content $response = file_get_contents('search.php'.$query); $response = utf8_decode($response); // add dynamic content to corresponding div $node = $doc->createElement('div', $response); $doc->getElementById('resultsContainer')->appendChild($node); // echo html snapshot echo $doc->saveHTML();

    Read the article

  • Effective way of String splitting

    - by openidsujoy
    I have a completed string like this N:Pay in Cash++RGI:40++R:200++T:Purchase++IP:N++IS:N++PD:PC++UCP:598.80++UPP:0.00++TCP:598.80++TPP:0.00++QE:1++QS:1++CPC:USD++PPC:Points++D:Y++E:Y++IFE:Y++AD:Y++IR:++MV:++CP:~ ~N:ERedemption++RGI:42++R:200++T:Purchase++IP:N++IS:N++PD:PC++UCP:598.80++UPP:0.00++TCP:598.80++TPP:0.00++QE:1++QS:1++CPC:USD++PPC:Points++D:Y++E:Y++IFE:Y++AD:Y++IR:++MV:++CP: this string is like this It's list of PO's(Payment Options) which are separated by ~~ this list may contains one or more PO contains only Key-Value Pairs which separated by : spaces are denoted by ++ I need to extract the values for Key "RGI" and "N". I can do it via for loop , I want a efficient way to do this. any help on this.

    Read the article

  • C++ Beginner - Best way to read 3 consecutive values from the command line?

    - by Francisco P.
    Hello everyone, I am writing a text-based Scrabble implementation for a college project. The specification states that the user's position input must be read from single line, like this: Coordinates of the word's first letter and orientation (<A – P> <1 – 15> <H ou V>): G 5 H G 5 H is the user's input for that particular example. The order, as shown, must be char int char. What is the best way to read the user's input? cin >> row >> column >> orientation will cause crashes if the user screws up. A getline and a subsequent string parser are a valid solution, but represent a bit of work. Is there another, better, way to do this, that I am missing? Thanks for your time!

    Read the article

  • Good way to parse query string

    - by m.edmondson
    I have a String that contains the following: ?workarea=London+&+Home+Counties+Ltd&sub=fs&&&FASh*5 which resembles a URI query string. What is the best way to parse the elements of this string (workarea and sub) without messing about with string manipulation? If I use HttpUtility.ParseQueryString is gets stuck as both elements include &. However if I encode the whole thing first I lose the seperations of the elements. Ideally the output would be: workarea = London & Home Counties Ltd sub = fs&&&FASh*5

    Read the article

  • Postfix and right-associative operators in LR(0) parsers

    - by Ian
    Is it possible to construct an LR(0) parser that could parse a language with both prefix and postfix operators? For example, if I had a grammar with the + (addition) and ! (factorial) operators with the usual precedence then 1+3! should be 1 + 3! = 1 + 6 = 7, but surely if the parser were LR(0) then when it had 1+3 on the stack it would reduce rather than shift? Also, do right associative operators pose a problem? For example, 2^3^4 should be 2^(3^4) but again, when the parser have 2^3 on the stack how would it know to reduce or shift? If this isn't possible is there still a way to use an LR(0) parser, possibly by converting the input into Polish or Reverse Polish notation or adding brackets in the appropriate places? Would this be done before, during or after the lexing stage?

    Read the article

  • Parse one String data using C#

    - by skumar
    I need to parse the following string data and convert it into the specified C# class object. Please suggest me a solution for this: Input string: A||B||C Output: Class containing a list of 3 objects of type string i.e A, B, C Input String: A||{a1||a2||a3}||B||C Output: Class containing a list of 3 elements i.e A, B, C and inside A having one more List with 3 elements i.e a1, a2, a3. Here elements inside brace symbol { .. } would represent the child elements. Note: Child elements could have again multiple child elements. Please help me on this.

    Read the article

  • PHP - complete url parser help

    - by Mark
    I have been trying to find an effective url parser, php's own does not include subdomain or extension. On php.net a number of users had contributed and made this: function parseUrl($url) { $r = "^(?:(?P<scheme>\w+)://)?"; $r .= "(?:(?P<login>\w+):(?P<pass>\w+)@)?"; $r .= "(?P<host>(?:(?P<subdomain>[-\w\.]+)\.)?" . "(?P<domain>[-\w]+\.(?P<extension>\w+)))"; $r .= "(?::(?P<port>\d+))?"; $r .= "(?P<path>[\w/]*/(?P<file>\w+(?:\.\w+)?)?)?"; $r .= "(?:\?(?P<arg>[\w=&]+))?"; $r .= "(?:#(?P<anchor>\w+))?"; $r = "!$r!"; // Delimiters preg_match ( $r, $url, $out ); return $out; } Unfortunately it fails on paths with a '-' and I can't for the life of me workout how to amend it to accept '-' in the path name. Thanks

    Read the article

  • input URL, output contents of "view page source", i.e. after javascript / etc, library or command-li

    - by Ryan Berckmans
    I need a scalable, automated, method of dumping the contents of "view page source" (DOM) to a file. Programs such as wget or curl will non-interactively retrieve a set of URLs, but do not execute javascript or any of that 'fancy stuff'. My ideal solution looks like any of the following (fantasy solutions): cat urls.txt | google-chrome --quiet --no-gui \ --output-sources-directory=~/urls-source (fantasy command line, no idea if flags like these exist) or cat urls.txt | python -c "import some-library; \ ... use some-library to process urls.txt ; output sources to ~/urls-source" As a secondary concern, I also need: dump all included javascript source to file (a la firebug) dump pdf/image of page to file (print to file)

    Read the article

  • SimpleTest assertTags - loose matching? (for CakePHP)

    - by Arkaaito
    I'd like to use SimpleTest to set up some functionality tests for our project - in particular, we have a very busy page which has some random components and some static components, and I'd like to be able to write a simple test which only confirms the static bits (preferably only the one or two most important ones). In other words, I want to be able to leave out any tags on the page I don't care about, and write something like: $result = "<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><title>...</title><meta .../></head><body><script type="text/javascript">...</script><div class="center-splash"><span>Welcome JohnDoe</span><p>Your progress:</p>...</div><div class="left-column">...</div><div class="right-column">...</div>...</body></html>"; $expects = array('html'=>true,'body'=>true,'div'=>array('class'=>'center_splash'),'span'=>true,'Welcome JohnDoe','/span','/div','/body','/html'); $this->assertTagsButIgnoreExtras($result, $expects); When I try this with assertTags it fails. Is there a version of assertTags which allows this - something either officially part of the SimpleTest or CakePHP project or unofficially put out under the MIT license or similar?

    Read the article

  • sql report link with rs:Command paramaters not opening in JSF page

    - by H3wh0s33ks
    I have a report that we need to link (which we've checked to be working) to in a JSF project, the link looks like the following: http://www.example.com/report/summary&rs:Command=Render However when we try to load the page that links to it we get the following error: The reference to entity "rs:Command" must end with the ';' How can I link to the report within my pages and prevent it from trying to parse the rs:Command?

    Read the article

  • strange characters at beginning of file

    - by luca
    there are strange characters at the beginning of a file I'm editing (using textmate..) I don't know when they appeared, they're invisible in textmate but my script that reads the file goes crazy.. this is the first few chars in the file (as seen with od command): 0000000 177377 000120 000105 000117 000120 000114 000105 000072 the first 2 shouldn't be there I think.. maybe they were caused by some strange dropbox sync? Or something else.. but they tend to reappear (I don't yet know when..) My question: what is that 177377 and a simple way to remove it in my ruby script? thanks

    Read the article

  • Python + Expat: Error on &#0; entities

    - by clacke
    I have written a small function, which uses ElementTree and xpath to extract the text contents of certain elements in an xml file: #!/usr/bin/env python2.5 import doctest from xml.etree import ElementTree from StringIO import StringIO def parse_xml_etree(sin, xpath): """ Takes as input a stream containing XML and an XPath expression. Applies the XPath expression to the XML and returns a generator yielding the text contents of each element returned. >>> parse_xml_etree( ... StringIO('<test><elem1>one</elem1><elem2>two</elem2></test>'), ... '//elem1').next() 'one' >>> parse_xml_etree( ... StringIO('<test><elem1>one</elem1><elem2>two</elem2></test>'), ... '//elem2').next() 'two' >>> parse_xml_etree( ... StringIO('<test><null>&#0;</null><elem3>three</elem3></test>'), ... '//elem2').next() 'three' """ tree = ElementTree.parse(sin) for element in tree.findall(xpath): yield element.text if __name__ == '__main__': doctest.testmod(verbose=True) The third test fails with the following exception: ExpatError: reference to invalid character number: line 1, column 13 Is the � entity illegal XML? Regardless whether it is or not, the files I want to parse contain it, and I need some way to parse them. Any suggestions for another parser than Expat, or settings for Expat, that would allow me to do that?

    Read the article

< Previous Page | 49 50 51 52 53 54 55 56 57 58 59 60  | Next Page >